diff mbox series

[U-Boot,v3,07/11] drivers: net: aquantia: set SMBus addr based on DT property

Message ID 20191114162838.7150-8-alexandru.marginean@nxp.com
State Accepted
Commit 05f86070c0722015520ceb172b22070db5d0aa35
Delegated to: Joe Hershberger
Headers show
Series Add XFI, USXGMII net protocols, use them in Aquantia driver | expand

Commit Message

Alexandru Marginean Nov. 14, 2019, 4:28 p.m. UTC
Aquantia PHYs have a SMBus interface mostly used for debug.  The addresses
on this interface are normally set up by PHY firmware, but depending on the
board they may end up not being unique.  Add an optional DT property used
to change SMBus address if needed.

Signed-off-by: Alex Marginean <alexandru.marginean@nxp.com>
---
 drivers/net/phy/aquantia.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

Comments

Joe Hershberger Nov. 30, 2019, 12:36 a.m. UTC | #1
On Thu, Nov 14, 2019 at 10:31 AM Alex Marginean
<alexandru.marginean@nxp.com> wrote:
>
> Aquantia PHYs have a SMBus interface mostly used for debug.  The addresses
> on this interface are normally set up by PHY firmware, but depending on the
> board they may end up not being unique.  Add an optional DT property used
> to change SMBus address if needed.
>
> Signed-off-by: Alex Marginean <alexandru.marginean@nxp.com>

Acked-by: Joe Hershberger <joe.hershberger@ni.com>
diff mbox series

Patch

diff --git a/drivers/net/phy/aquantia.c b/drivers/net/phy/aquantia.c
index 06532c51d5..151e0ee9e9 100644
--- a/drivers/net/phy/aquantia.c
+++ b/drivers/net/phy/aquantia.c
@@ -91,6 +91,9 @@ 
 #define AQUANTIA_VND1_GSYSCFG_5G		3
 #define AQUANTIA_VND1_GSYSCFG_10G		4
 
+#define AQUANTIA_VND1_SMBUS0			0xc485
+#define AQUANTIA_VND1_SMBUS1			0xc495
+
 /* addresses of memory segments in the phy */
 #define DRAM_BASE_ADDR 0x3FFE0000
 #define IRAM_BASE_ADDR 0x40000000
@@ -352,6 +355,18 @@  static int aquantia_dts_config(struct phy_device *phydev)
 		phy_write(phydev, MDIO_MMD_PMAPMD, AQUANTIA_PMA_RX_VENDOR_P1,
 			  reg);
 	}
+	if (!ofnode_read_u32(node, "smb-addr", &prop)) {
+		debug("smb-addr = %x\n", (int)prop);
+		/*
+		 * there are two addresses here, normally just one bus would
+		 * be in use so we're setting both regs using the same DT
+		 * property.
+		 */
+		phy_write(phydev, MDIO_MMD_VEND1, AQUANTIA_VND1_SMBUS0,
+			  (u16)(prop << 1));
+		phy_write(phydev, MDIO_MMD_VEND1, AQUANTIA_VND1_SMBUS1,
+			  (u16)(prop << 1));
+	}
 
 #endif
 	return 0;