Skip to contentSkip to conversation

Support for multiple SGMII/TBI interfaces for TSEC ethernet

PATCH Superseded Peter Tyser 1 participant 1 message Sep 9, 2008 Network drivers

v2 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 Support for multiple SGMII/TBI interfaces for TSEC ethernet

Fix TBI PHY accesses to use the proper offset in CPU register space. The previous code would incorrectly access the TBI PHY by reading/writing to CPU register space at the same location as would be used to access external PHYs.

---

I replaced the hardcoding of CFG_TBIPA_VALUE in the tsec_configure_serdes() to support possible changes of the TBI addressing down the road, but kept the default TBI PHY address at CFG_TBIPA_VALUE as Andy Flemming suggested.

 drivers/net/tsec.c |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)
drivers/net/tsec.c +5 -4
index f81211a..43e5dff 100644
@@ -283,11 +283,13 @@ uint tsec_local_mdio_read(volatile tsec_t *phyregs, uint phyid, uint regnum)
 /* Configure the TBI for SGMII operation */
 static void tsec_configure_serdes(struct tsec_private *priv)
 {
-	tsec_local_mdio_write(priv->phyregs, CFG_TBIPA_VALUE, TBI_ANA,
+	/* Access TBI PHY registers at given TSEC register offset as opposed to the
+	 * register offset used for external PHY accesses */
+	tsec_local_mdio_write(priv->regs, priv->regs->tbipa, TBI_ANA,
 			TBIANA_SETTINGS);
-	tsec_local_mdio_write(priv->phyregs, CFG_TBIPA_VALUE, TBI_TBICON,
+	tsec_local_mdio_write(priv->regs, priv->regs->tbipa, TBI_TBICON,
 			TBICON_CLK_SELECT);
-	tsec_local_mdio_write(priv->phyregs, CFG_TBIPA_VALUE, TBI_CR,
+	tsec_local_mdio_write(priv->regs, priv->regs->tbipa, TBI_CR,
 			TBICR_SETTINGS);
 }
 
@@ -304,7 +306,6 @@ static int init_phy(struct eth_device *dev)
 
 	/* Assign a Physical address to the TBI */
 	regs->tbipa = CFG_TBIPA_VALUE;
-	phyregs->tbipa = CFG_TBIPA_VALUE;
 	asm("sync");
 
 	/* Reset MII (due to new addresses) */
Signature · 1 line
1.5.4.3