History

net: usb: asix: suspend embedded PHY if external is used

In case external PHY is used, we need to take care of embedded PHY. Since there are no methods to disable this PHY from the MAC side and keeping RMII reference clock, we need to suspend it. This patch will reduce electrical noise (PHY is continuing to send FLPs) and power consumption by 0,22W.

Oleksij Rempel committed 4 years ago

Commit 4d17d431 parent d5f3c812 files · +20 −1Browse files

Unified · Split

2 files
  1. drivers/net/usb/asix.h +3 −0
  2. drivers/net/usb/asix_devices.c +17 −1
drivers/net/usb/asix.h+3−0
@@ -158,6 +158,8 @@ · 157 unmodified lines
158#define AX_EEPROM_MAGIC 0xdeadbeef158#define AX_EEPROM_MAGIC 0xdeadbeef
159#define AX_EEPROM_LEN 0x200159#define AX_EEPROM_LEN 0x200
160 160
161#define AX_EMBD_PHY_ADDR 0x10
162
161/* This structure cannot exceed sizeof(unsigned long [5]) AKA 20 bytes */163/* This structure cannot exceed sizeof(unsigned long [5]) AKA 20 bytes */
162struct asix_data {164struct asix_data {
163 u8 multi_filter[AX_MCAST_FILTER_SIZE];165 u8 multi_filter[AX_MCAST_FILTER_SIZE];
@@ -183,6 +185,7 @@ struct asix_common_private { · 19 unmodified lines
183 struct asix_rx_fixup_info rx_fixup_info;185 struct asix_rx_fixup_info rx_fixup_info;
184 struct mii_bus *mdio;186 struct mii_bus *mdio;
185 struct phy_device *phydev;187 struct phy_device *phydev;
188 struct phy_device *phydev_int;
186 u16 phy_addr;189 u16 phy_addr;
187 bool embd_phy;190 bool embd_phy;
188 u8 chipcode;191 u8 chipcode;
drivers/net/usb/asix_devices.c+17−1
@@ -679,6 +679,22 @@ static int ax88772_init_phy(struct usbnet *dev) · 678 unmodified lines
679 679
680 phy_attached_info(priv->phydev);680 phy_attached_info(priv->phydev);
681 681
682 if (priv->embd_phy)
683 return 0;
684
685 /* In case main PHY is not the embedded PHY and MAC is RMII clock
686 * provider, we need to suspend embedded PHY by keeping PLL enabled
687 * (AX_SWRESET_IPPD == 0).
688 */
689 priv->phydev_int = mdiobus_get_phy(priv->mdio, AX_EMBD_PHY_ADDR);
690 if (!priv->phydev_int) {
691 netdev_err(dev->net, "Could not find internal PHY\n");
692 return -ENODEV;
693 }
694
695 priv->phydev_int->mac_managed_pm = 1;
696 phy_suspend(priv->phydev_int);
697
682 return 0;698 return 0;
683}699}
684 700
@@ -734,7 +750,7 @@ static int ax88772_bind(struct usbnet *dev, struct usb_interface *intf) · 49 unmodified lines
734 return ret;750 return ret;
735 751
736 priv->phy_addr = ret;752 priv->phy_addr = ret;
737 priv->embd_phy = ((priv->phy_addr & 0x1f) == 0x10);753 priv->embd_phy = ((priv->phy_addr & 0x1f) == AX_EMBD_PHY_ADDR);
738 754
739 ret = asix_read_cmd(dev, AX_CMD_STATMNGSTS_REG, 0, 0, 1,755 ret = asix_read_cmd(dev, AX_CMD_STATMNGSTS_REG, 0, 0, 1,
740 &priv->chipcode, 0);756 &priv->chipcode, 0);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t