Skip to content

Commit b6393ce

Browse files
Wei FangNipaLocal
authored andcommitted
net: enetc: add port MDIO support for ENETC v4
The NETC IP provides two ways for ENETC to access its external PHY. One is that EMDIO function provides a means for different ENETCs to share a single set of MDIO signals to access their PHYs. And this EMDIO support has been added in the commit a52201f ("net: enetc: add i.MX95 EMDIO support"). The other one is that each ENETC has a set of MDIO registers to access and control its PHY. When the PHY node is a child node of the ENETC node, the ENETC will use its port MDIO to access its external PHY. For the on-die PHY (PCS/Serdes), each ENETC has an internal MDIO bus for managing the on-die PHY, this internal MDIO bus is controlled by a set of internal MDIO registers of the ENETC port. Because the port MDIO support has been added to the driver for ENETC v1. The difference between ENETC v4 and ENETC v1 is the base address of the MDIO registers, so we only need to add the new base address to add the port MDIO support for ENETC v4. Signed-off-by: Wei Fang <wei.fang@nxp.com> Signed-off-by: NipaLocal <nipa@local>
1 parent 5f0d00c commit b6393ce

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

drivers/net/ethernet/freescale/enetc/enetc4_hw.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,9 @@
170170
/* Port MAC 0/1 Maximum Frame Length Register */
171171
#define ENETC4_PM_MAXFRM(mac) (0x5014 + (mac) * 0x400)
172172

173+
/* Port internal MDIO base address, use to access PCS */
174+
#define ENETC4_PM_IMDIO_BASE 0x5030
175+
173176
/* Port MAC 0/1 Pause Quanta Register */
174177
#define ENETC4_PM_PAUSE_QUANTA(mac) (0x5054 + (mac) * 0x400)
175178

@@ -198,6 +201,9 @@
198201
#define SSP_1G 2
199202
#define PM_IF_MODE_ENA BIT(15)
200203

204+
/* Port external MDIO Base address, use to access off-chip PHY */
205+
#define ENETC4_EMDIO_BASE 0x5c00
206+
201207
/**********************ENETC Pseudo MAC port registers************************/
202208
/* Port pseudo MAC receive octets counter (64-bit) */
203209
#define ENETC4_PPMROCR 0x5080

drivers/net/ethernet/freescale/enetc/enetc_pf_common.c

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,12 @@ static int enetc_mdio_probe(struct enetc_pf *pf, struct device_node *np)
176176
bus->parent = dev;
177177
mdio_priv = bus->priv;
178178
mdio_priv->hw = &pf->si->hw;
179-
mdio_priv->mdio_base = ENETC_EMDIO_BASE;
179+
180+
if (is_enetc_rev1(pf->si))
181+
mdio_priv->mdio_base = ENETC_EMDIO_BASE;
182+
else
183+
mdio_priv->mdio_base = ENETC4_EMDIO_BASE;
184+
180185
snprintf(bus->id, MII_BUS_ID_SIZE, "%s", dev_name(dev));
181186

182187
err = of_mdiobus_register(bus, np);
@@ -221,7 +226,12 @@ static int enetc_imdio_create(struct enetc_pf *pf)
221226
bus->phy_mask = ~0;
222227
mdio_priv = bus->priv;
223228
mdio_priv->hw = &pf->si->hw;
224-
mdio_priv->mdio_base = ENETC_PM_IMDIO_BASE;
229+
230+
if (is_enetc_rev1(pf->si))
231+
mdio_priv->mdio_base = ENETC_PM_IMDIO_BASE;
232+
else
233+
mdio_priv->mdio_base = ENETC4_PM_IMDIO_BASE;
234+
225235
snprintf(bus->id, MII_BUS_ID_SIZE, "%s-imdio", dev_name(dev));
226236

227237
err = mdiobus_register(bus);

0 commit comments

Comments
 (0)