Skip to contentSkip to conversation

net: fsl_enetc: fix imdio register calculation

PATCH Applied Heiko Thiery 8 participants 10 messages Apr 28, 2025 – May 12, 2025 Network drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: fsl_enetc: fix imdio register calculation

From: Thomas Schaefer <[email protected]>

With commit cc4e8af2c552, fsl_enetc register accessors have been split to handle different register offsets on different SoCs. However, for internal MDIO register calculation, only ENETC_PM_IMDIO_BASE was fixed without adding the SoC specific MAC register offset.

As a result, the network support for the Kontron SMARC-sAL28 and probably other boards based on the LS1028A CPU is broken.

Add the SoC specific MAC register offset to calculation of imdio.priv to fix this.

Fixes cc4e8af2c552 ("net: fsl_enetc: Split register accessors")

---

But the question that now arises is, does this code path work on the imx SoCs as well. Now the imx specific offset 0x5000 is added here and was not used before.

Can someone please test this on an imx9 and confirm?

 drivers/net/fsl_enetc.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/fsl_enetc.c +3 -1
index 52fa820f51..97cccda451 100644
@@ -473,13 +473,15 @@ static int enetc_init_sxgmii(struct udevice *dev)
 /* Apply protocol specific configuration to MAC, serdes as needed */
 static void enetc_start_pcs(struct udevice *dev)
 {
+	struct enetc_data *data = (struct enetc_data *)dev_get_driver_data(dev);
 	struct enetc_priv *priv = dev_get_priv(dev);
 
 	/* register internal MDIO for debug purposes */
 	if (enetc_read_pcapr_mdio(dev)) {
 		priv->imdio.read = enetc_mdio_read;
 		priv->imdio.write = enetc_mdio_write;
-		priv->imdio.priv = priv->port_regs + ENETC_PM_IMDIO_BASE;
+		priv->imdio.priv = priv->port_regs + data->reg_offset_mac +
+		                   ENETC_PM_IMDIO_BASE;
 		strlcpy(priv->imdio.name, dev->name, MDIO_NAME_LEN);
 		if (!miiphy_get_dev_by_name(priv->imdio.name))
 			mdio_register(&priv->imdio);
Signature · 1 line
2.20.1
Reviewed-by on v1 1/1
#1 lore raw

[+ Vladimir]

Hi,

nice catch!

Quoted 1 line

With commit cc4e8af2c552, fsl_enetc register accessors have been split to

With 'commit cc4e8af2c552 ("net: fsl_enetc: Split register accessors")'

Quoted 7 lines

handle different register offsets on different SoCs. However, for internal MDIO register calculation, only ENETC_PM_IMDIO_BASE was fixed without adding the SoC specific MAC register offset.

As a result, the network support for the Kontron SMARC-sAL28 and probably other boards based on the LS1028A CPU is broken.

Quoted 6 lines

Add the SoC specific MAC register offset to calculation of imdio.priv to fix this.

Fixes cc4e8af2c552 ("net: fsl_enetc: Split register accessors")

With the nitpick above:

Quoted 5 lines

---

But the question that now arises is, does this code path work on the imx SoCs as well. Now the imx specific offset 0x5000 is added here and was not used before.

Maybe the imx9 doesn't use the internal MDIO controller or the board which was this tested on doesn't use the PCS?

-michael

Quoted 26 lines

Can someone please test this on an imx9 and confirm?

 drivers/net/fsl_enetc.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/fsl_enetc.c +3 -1
index 52fa820f51..97cccda451 100644
@@ -473,13 +473,15 @@ static int enetc_init_sxgmii(struct udevice *dev)
 /* Apply protocol specific configuration to MAC, serdes as needed */
 static void enetc_start_pcs(struct udevice *dev)
 {
+	struct enetc_data *data = (struct enetc_data *)dev_get_driver_data(dev);
 	struct enetc_priv *priv = dev_get_priv(dev);
 
 	/* register internal MDIO for debug purposes */
 	if (enetc_read_pcapr_mdio(dev)) {
 		priv->imdio.read = enetc_mdio_read;
 		priv->imdio.write = enetc_mdio_write;
-		priv->imdio.priv = priv->port_regs + ENETC_PM_IMDIO_BASE;
+		priv->imdio.priv = priv->port_regs + data->reg_offset_mac +
+		                   ENETC_PM_IMDIO_BASE;
 		strlcpy(priv->imdio.name, dev->name, MDIO_NAME_LEN);
 		if (!miiphy_get_dev_by_name(priv->imdio.name))
 			mdio_register(&priv->imdio);
Reviewed-by Tested-by
#2 lore raw
Quoted 30 lines · Michael Walle

[+ Vladimir]

Hi,

nice catch!

Quoted 1 line

With commit cc4e8af2c552, fsl_enetc register accessors have been split to

With 'commit cc4e8af2c552 ("net: fsl_enetc: Split register accessors")'

Quoted 7 lines

handle different register offsets on different SoCs. However, for internal MDIO register calculation, only ENETC_PM_IMDIO_BASE was fixed without adding the SoC specific MAC register offset.

As a result, the network support for the Kontron SMARC-sAL28 and probably other boards based on the LS1028A CPU is broken.

Quoted 6 lines

Add the SoC specific MAC register offset to calculation of imdio.priv to fix this.

Fixes cc4e8af2c552 ("net: fsl_enetc: Split register accessors")

With the nitpick above:

Quoted 2 lines

---

Quoted 8 lines
Quoted 3 lines

But the question that now arises is, does this code path work on the imx SoCs as well. Now the imx specific offset 0x5000 is added here and was not used before.

Maybe the imx9 doesn't use the internal MDIO controller or the board which was this tested on doesn't use the PCS?

-michael

The imx specific offset 0x5000 should be correct.

In downstream, the ENETC_PM_IMDIO_BASE macro is used in common code, but defined twice - there is a conditional include of either fsl_enetc.h, or fsl_enetc4.h, depending on whether CONFIG_ARCH_IMX9 is defined. Thus, ENETC_PM_IMDIO_BASE is replaced either with 0x8030 or 0x5030 in downstream.
https://github.com/nxp-qoriq/u-boot/blob/lf-6.12.3-1.0.0/drivers/net/fsl_enetc.c#L25
https://github.com/nxp-qoriq/u-boot/blob/lf-6.12.3-1.0.0/drivers/net/fsl_enetc.h#L76
https://github.com/nxp-qoriq/u-boot/blob/lf-6.12.3-1.0.0/drivers/net/fsl_enetc4.h#L126

I guess Marek fell into the pitfall when upstreaming.

Quoted 16 lines
Quoted 16 lines

Can someone please test this on an imx9 and confirm?

 drivers/net/fsl_enetc.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/fsl_enetc.c +1 -0
index 52fa820f51..97cccda451 100644
@@ -473,13 +473,15 @@ static int enetc_init_sxgmii(struct udevice *dev)
 /* Apply protocol specific configuration to MAC, serdes as needed */
 static void enetc_start_pcs(struct udevice *dev)
 {
+	struct enetc_data *data = (struct enetc_data *)dev_get_driver_data(dev);
 	struct enetc_priv *priv = dev_get_priv(dev);
 
Quoted 11 lines

drivers/net/fsl_enetc.c static int enetc_init_sxgmii(struct udevice *dev) · line 487

Quoted 10 lines
drivers/net/fsl_enetc.c +2 -1
 	/* register internal MDIO for debug purposes */
 	if (enetc_read_pcapr_mdio(dev)) {
 		priv->imdio.read = enetc_mdio_read;
 		priv->imdio.write = enetc_mdio_write;
-		priv->imdio.priv = priv->port_regs + ENETC_PM_IMDIO_BASE;
+		priv->imdio.priv = priv->port_regs + data->reg_offset_mac +
+		                   ENETC_PM_IMDIO_BASE;
 		strlcpy(priv->imdio.name, dev->name, MDIO_NAME_LEN);
 		if (!miiphy_get_dev_by_name(priv->imdio.name))
 			mdio_register(&priv->imdio);

+Fang Wei to confirm/test for i.MX95.

#3 lore raw
Quoted 79 lines
Quoted 25 lines
Quoted 2 lines

With commit cc4e8af2c552, fsl_enetc register accessors have been split to

With 'commit cc4e8af2c552 ("net: fsl_enetc: Split register accessors")'

Quoted 7 lines

handle different register offsets on different SoCs. However, for internal MDIO register calculation, only ENETC_PM_IMDIO_BASE was fixed without adding the SoC specific MAC register offset.

As a result, the network support for the Kontron SMARC-sAL28 and probably other boards based on the LS1028A CPU is broken.

Quoted 6 lines

Add the SoC specific MAC register offset to calculation of imdio.priv to fix this.

Fixes cc4e8af2c552 ("net: fsl_enetc: Split register accessors")

With the nitpick above:

Quoted 2 lines

---

Quoted 8 lines
Quoted 3 lines

But the question that now arises is, does this code path work on the imx SoCs as well. Now the imx specific offset 0x5000 is added here and was not used before.

Maybe the imx9 doesn't use the internal MDIO controller or the board which was this tested on doesn't use the PCS?

-michael

The imx specific offset 0x5000 should be correct.

In downstream, the ENETC_PM_IMDIO_BASE macro is used in common code, but defined twice - there is a conditional include of either fsl_enetc.h, or fsl_enetc4.h, depending on whether CONFIG_ARCH_IMX9 is defined. Thus, ENETC_PM_IMDIO_BASE is replaced either with 0x8030 or 0x5030 in downstream.
https://github.com/nxp-qoriq/u-boot/blob/lf-6.12.3-1.0.0/drivers/net/fsl_enetc.
c#L25
https://github.com/nxp-qoriq/u-boot/blob/lf-6.12.3-1.0.0/drivers/net/fsl_enetc.
h#L76
https://github.com/nxp-qoriq/u-boot/blob/lf-6.12.3-1.0.0/drivers/net/fsl_enetc
4.h#L126

I guess Marek fell into the pitfall when upstreaming.

Quoted 17 lines
Quoted 17 lines

Can someone please test this on an imx9 and confirm?

 drivers/net/fsl_enetc.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/fsl_enetc.c index renamed from drivers/net/fsl_enetc.c +0 -0

52fa820f51..97cccda451 100644

drivers/net/fsl_enetc.c +2 -0
@@ -473,13 +473,15 @@ static int enetc_init_sxgmii(struct udevice
 *dev)
 /* Apply protocol specific configuration to MAC, serdes as needed
 */  static void enetc_start_pcs(struct udevice *dev)  {
+	struct enetc_data *data = (struct enetc_data
+*)dev_get_driver_data(dev);
 	struct enetc_priv *priv = dev_get_priv(dev);
 
Quoted 11 lines

drivers/net/fsl_enetc.c static int enetc_init_sxgmii(struct udevice *dev) · line 487

Quoted 10 lines
drivers/net/fsl_enetc.c +2 -1
 	/* register internal MDIO for debug purposes */
 	if (enetc_read_pcapr_mdio(dev)) {
 		priv->imdio.read = enetc_mdio_read;
 		priv->imdio.write = enetc_mdio_write;
-		priv->imdio.priv = priv->port_regs + ENETC_PM_IMDIO_BASE;
+		priv->imdio.priv = priv->port_regs + data->reg_offset_mac +
+		                   ENETC_PM_IMDIO_BASE;
 		strlcpy(priv->imdio.name, dev->name, MDIO_NAME_LEN);
 		if (!miiphy_get_dev_by_name(priv->imdio.name))
 			mdio_register(&priv->imdio);
Quoted 4 lines

+Fang Wei to confirm/test for i.MX95.

Hi Alice,

Can you help check this patch on i.MX95?

#4 lore raw

Hi Alice, Hi Marek,

Am Di., 29. Apr. 2025 um 03:19 Uhr schrieb Wei Fang <[email protected]>:

Quoted 85 lines
Quoted 32 lines
Quoted 32 lines
Quoted 2 lines

With commit cc4e8af2c552, fsl_enetc register accessors have been split to

With 'commit cc4e8af2c552 ("net: fsl_enetc: Split register accessors")'

Quoted 7 lines

handle different register offsets on different SoCs. However, for internal MDIO register calculation, only ENETC_PM_IMDIO_BASE was fixed without adding the SoC specific MAC register offset.

As a result, the network support for the Kontron SMARC-sAL28 and probably other boards based on the LS1028A CPU is broken.

Quoted 6 lines

Add the SoC specific MAC register offset to calculation of imdio.priv to fix this.

Fixes cc4e8af2c552 ("net: fsl_enetc: Split register accessors")

With the nitpick above:

Quoted 5 lines

---

But the question that now arises is, does this code path work on the imx SoCs as well. Now the imx specific offset 0x5000 is added here and was not used before.

Maybe the imx9 doesn't use the internal MDIO controller or the board which was this tested on doesn't use the PCS?

Quoted 6 lines
Quoted 1 line

-michael

The imx specific offset 0x5000 should be correct.

In downstream, the ENETC_PM_IMDIO_BASE macro is used in common code, but defined twice - there is a conditional include of either fsl_enetc.h, or

fsl_enetc4.h,

Quoted 4 lines

depending on whether CONFIG_ARCH_IMX9 is defined. Thus, ENETC_PM_IMDIO_BASE is replaced either with 0x8030 or 0x5030 in downstream.

https://github.com/nxp-qoriq/u-boot/blob/lf-6.12.3-1.0.0/drivers/net/fsl_enetc
.

Quoted 2 lines

c#L25

https://github.com/nxp-qoriq/u-boot/blob/lf-6.12.3-1.0.0/drivers/net/fsl_enetc
.

Quoted 2 lines

h#L76

https://github.com/nxp-qoriq/u-boot/blob/lf-6.12.3-1.0.0/drivers/net/fsl_enetc

Quoted 33 lines

4.h#L126

I guess Marek fell into the pitfall when upstreaming.

Quoted 28 lines
Quoted 27 lines

Can someone please test this on an imx9 and confirm?

 drivers/net/fsl_enetc.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/fsl_enetc.c index renamed from drivers/net/fsl_enetc.c +0 -0

52fa820f51..97cccda451 100644

drivers/net/fsl_enetc.c +4 -1
@@ -473,13 +473,15 @@ static int enetc_init_sxgmii(struct udevice
 *dev)
 /* Apply protocol specific configuration to MAC, serdes as needed
 */  static void enetc_start_pcs(struct udevice *dev)  {
+ struct enetc_data *data = (struct enetc_data
+*)dev_get_driver_data(dev);
  struct enetc_priv *priv = dev_get_priv(dev);
 
  /* register internal MDIO for debug purposes */
  if (enetc_read_pcapr_mdio(dev)) {
          priv->imdio.read = enetc_mdio_read;
          priv->imdio.write = enetc_mdio_write;
-         priv->imdio.priv = priv->port_regs + ENETC_PM_IMDIO_BASE;
+         priv->imdio.priv = priv->port_regs + data->reg_offset_mac +
+                            ENETC_PM_IMDIO_BASE;
          strlcpy(priv->imdio.name, dev->name, MDIO_NAME_LEN);
          if (!miiphy_get_dev_by_name(priv->imdio.name))
                  mdio_register(&priv->imdio);
Quoted 9 lines
Quoted 4 lines

+Fang Wei to confirm/test for i.MX95.

Hi Alice,

Can you help check this patch on i.MX95?

Friendly reminder, are you able to confirm that?

BR,
Heiko

Tested-by
#5 lore raw
Quoted 93 lines · Heiko Thiery

Hi Alice, Hi Marek,

Am Di., 29. Apr. 2025 um 03:19 Uhr schrieb Wei Fang <[email protected]>:

Quoted 87 lines
Quoted 80 lines
Quoted 26 lines
Quoted 3 lines

With commit cc4e8af2c552, fsl_enetc register accessors have been split to

With 'commit cc4e8af2c552 ("net: fsl_enetc: Split register accessors")'

Quoted 7 lines

handle different register offsets on different SoCs. However, for internal MDIO register calculation, only ENETC_PM_IMDIO_BASE was fixed without adding the SoC specific MAC register offset.

As a result, the network support for the Kontron SMARC-sAL28 and probably other boards based on the LS1028A CPU is broken.

Quoted 6 lines

Add the SoC specific MAC register offset to calculation of imdio.priv to fix this.

Fixes cc4e8af2c552 ("net: fsl_enetc: Split register accessors")

With the nitpick above:

Quoted 2 lines

---

Quoted 8 lines
Quoted 3 lines

But the question that now arises is, does this code path work on the imx SoCs as well. Now the imx specific offset 0x5000 is added here and was not used before.

Maybe the imx9 doesn't use the internal MDIO controller or the board which was this tested on doesn't use the PCS?

-michael

The imx specific offset 0x5000 should be correct.

In downstream, the ENETC_PM_IMDIO_BASE macro is used in common code, but defined twice - there is a conditional include of either fsl_enetc.h, or fsl_enetc4.h, depending on whether CONFIG_ARCH_IMX9 is defined. Thus, ENETC_PM_IMDIO_BASE is replaced either with 0x8030 or 0x5030 in downstream.
https://github.com/nxp-qoriq/u-boot/blob/lf-6.12.3-1.0.0/drivers/net/fsl_enetc.
c#L25
https://github.com/nxp-qoriq/u-boot/blob/lf-6.12.3-1.0.0/drivers/net/fsl_enetc.
h#L76
https://github.com/nxp-qoriq/u-boot/blob/lf-6.12.3-1.0.0/drivers/net/fsl_enetc
4.h#L126

I guess Marek fell into the pitfall when upstreaming.

Quoted 17 lines
Quoted 17 lines

Can someone please test this on an imx9 and confirm?

 drivers/net/fsl_enetc.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/fsl_enetc.c index renamed from drivers/net/fsl_enetc.c +0 -0

52fa820f51..97cccda451 100644

drivers/net/fsl_enetc.c +2 -0
@@ -473,13 +473,15 @@ static int enetc_init_sxgmii(struct udevice
 *dev)
 /* Apply protocol specific configuration to MAC, serdes as needed
 */  static void enetc_start_pcs(struct udevice *dev)  {
+ struct enetc_data *data = (struct enetc_data
+*)dev_get_driver_data(dev);
  struct enetc_priv *priv = dev_get_priv(dev);
 
Quoted 11 lines

drivers/net/fsl_enetc.c static int enetc_init_sxgmii(struct udevice *dev) · line 487

Quoted 10 lines
drivers/net/fsl_enetc.c +2 -1
  /* register internal MDIO for debug purposes */
  if (enetc_read_pcapr_mdio(dev)) {
          priv->imdio.read = enetc_mdio_read;
          priv->imdio.write = enetc_mdio_write;
-         priv->imdio.priv = priv->port_regs + ENETC_PM_IMDIO_BASE;
+         priv->imdio.priv = priv->port_regs + data->reg_offset_mac +
+                            ENETC_PM_IMDIO_BASE;
          strlcpy(priv->imdio.name, dev->name, MDIO_NAME_LEN);
          if (!miiphy_get_dev_by_name(priv->imdio.name))
                  mdio_register(&priv->imdio);
Quoted 4 lines

+Fang Wei to confirm/test for i.MX95.

Hi Alice,

Quoted 8 lines
Quoted 1 line

Can you help check this patch on i.MX95?

Friendly reminder, are you able to confirm that?

BR,
Heiko

Hi Heiko,

I was able to test this on top of master with an imx95_19x19_evk - enetc (1gb) interface works before and after the patch. Was there something more specific that needs testing?

Best Regards,

Tim

#6 lore raw

Hi Tim,

Am Di., 6. Mai 2025 um 17:31 Uhr schrieb Tim Harvey <[email protected]>:

Quoted 113 lines
Quoted 11 lines · Heiko Thiery

Hi Alice, Hi Marek,

Am Di., 29. Apr. 2025 um 03:19 Uhr schrieb Wei Fang <[email protected]>:

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 3 lines

With commit cc4e8af2c552, fsl_enetc register accessors have been split to

With 'commit cc4e8af2c552 ("net: fsl_enetc: Split register

accessors")'

Quoted 15 lines
Quoted 15 lines
Quoted 15 lines
Quoted 15 lines
Quoted 14 lines

handle different register offsets on different SoCs. However, for internal MDIO register calculation, only ENETC_PM_IMDIO_BASE was fixed without adding the SoC specific MAC register offset.

As a result, the network support for the Kontron SMARC-sAL28 and probably other boards based on the LS1028A CPU is broken.

Add the SoC specific MAC register offset to calculation of imdio.priv to fix this.

Fixes cc4e8af2c552 ("net: fsl_enetc: Split register accessors")
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

With the nitpick above:

Quoted 3 lines

---

But the question that now arises is, does this code path work on

the

Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 7 lines
Quoted 2 lines

imx SoCs as well. Now the imx specific offset 0x5000 is added here and was not used before.

Maybe the imx9 doesn't use the internal MDIO controller or the board which was this tested on doesn't use the PCS?

-michael

The imx specific offset 0x5000 should be correct.

In downstream, the ENETC_PM_IMDIO_BASE macro is used in common code,

but

Quoted 1 line
Quoted 1 line
Quoted 1 line

defined twice - there is a conditional include of either fsl_enetc.h,

or fsl_enetc4.h,

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

depending on whether CONFIG_ARCH_IMX9 is defined. Thus, ENETC_PM_IMDIO_BASE is replaced either with 0x8030 or 0x5030 in downstream.

https://github.com/nxp-qoriq/u-boot/blob/lf-6.12.3-1.0.0/drivers/net/fsl_enetc
.

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

c#L25

https://github.com/nxp-qoriq/u-boot/blob/lf-6.12.3-1.0.0/drivers/net/fsl_enetc
.

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

h#L76

https://github.com/nxp-qoriq/u-boot/blob/lf-6.12.3-1.0.0/drivers/net/fsl_enetc

Quoted 10 lines
Quoted 10 lines
Quoted 10 lines

4.h#L126

I guess Marek fell into the pitfall when upstreaming.

Quoted 6 lines

drivers/net/fsl_enetc.c

Quoted 6 lines

Can someone please test this on an imx9 and confirm?

 drivers/net/fsl_enetc.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/fsl_enetc.c +0 -0

index

Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines

52fa820f51..97cccda451 100644

drivers/net/fsl_enetc.c +2 -0
@@ -473,13 +473,15 @@ static int enetc_init_sxgmii(struct udevice
 *dev)
 /* Apply protocol specific configuration to MAC, serdes as needed
 */  static void enetc_start_pcs(struct udevice *dev)  {
+ struct enetc_data *data = (struct enetc_data
+*)dev_get_driver_data(dev);
  struct enetc_priv *priv = dev_get_priv(dev);
 
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

drivers/net/fsl_enetc.c static int enetc_init_sxgmii(struct udevice *dev)

Quoted 5 lines
drivers/net/fsl_enetc.c +0 -1
  /* register internal MDIO for debug purposes */
  if (enetc_read_pcapr_mdio(dev)) {
          priv->imdio.read = enetc_mdio_read;
          priv->imdio.write = enetc_mdio_write;
-         priv->imdio.priv = priv->port_regs +

ENETC_PM_IMDIO_BASE;

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

drivers/net/fsl_enetc.c static int enetc_init_sxgmii(struct udevice · line 484

Quoted 1 line
drivers/net/fsl_enetc.c +1 -0
+         priv->imdio.priv = priv->port_regs +

data->reg_offset_mac +

Quoted 19 lines
Quoted 6 lines
Quoted 6 lines
Quoted 5 lines
Quoted 4 lines
drivers/net/fsl_enetc.c +1 -0
+                            ENETC_PM_IMDIO_BASE;
          strlcpy(priv->imdio.name, dev->name, MDIO_NAME_LEN);
          if (!miiphy_get_dev_by_name(priv->imdio.name))
                  mdio_register(&priv->imdio);
Quoted 8 lines
Quoted 4 lines

+Fang Wei to confirm/test for i.MX95.

Hi Alice,

Can you help check this patch on i.MX95?

Friendly reminder, are you able to confirm that?

Quoted 10 lines
Quoted 2 lines

BR,
Heiko

Hi Heiko,

I was able to test this on top of master with an imx95_19x19_evk - enetc (1gb) interface works before and after the patch. Was there something more specific that needs testing?

No, this should be ok, I think it is good to know that the fix does not influence the behavior on the imx9.

Quoted 7 lines

Best Regards,

Tim

Thanks,
Heiko

Reviewed-by on v1 1/1
#7 lore raw
In reply to Heiko Thiery
Quoted 10 lines · Heiko Thiery

From: Thomas Schaefer <[email protected]>

With commit cc4e8af2c552, fsl_enetc register accessors have been split to handle different register offsets on different SoCs. However, for internal MDIO register calculation, only ENETC_PM_IMDIO_BASE was fixed without adding the SoC specific MAC register offset.

As a result, the network support for the Kontron SMARC-sAL28 and probably other boards based on the LS1028A CPU is broken.

Quoted 6 lines

Add the SoC specific MAC register offset to calculation of imdio.priv to fix this.

Fixes cc4e8af2c552 ("net: fsl_enetc: Split register accessors")
Reviewed-by Alice Guo on v1 1/1
#8 lore raw
In reply to Heiko Thiery

Best Regards,
Alice Guo

Quoted 61 lines

-----邮件原件-----
发件人: U-Boot <[email protected]> 代表 Heiko Thiery 发送时间: 2025年4月28日 18:00
收件人: [email protected]
抄送: Joe Hershberger <[email protected]>; Ramon Fried <[email protected]>; Tom Rini <[email protected]>; Marek Vasut <[email protected]>; Alice Guo <[email protected]>; Ye Li <[email protected]>; [email protected]; Michael Walle <[email protected]>; Thomas Schäfer <[email protected]>; Heiko Thiery <[email protected]>
主题: [PATCH] net: fsl_enetc: fix imdio register calculation

From: Thomas Schaefer <[email protected]>

With commit cc4e8af2c552, fsl_enetc register accessors have been split to handle different register offsets on different SoCs. However, for internal MDIO register calculation, only ENETC_PM_IMDIO_BASE was fixed without adding the SoC specific MAC register offset.

As a result, the network support for the Kontron SMARC-sAL28 and probably other boards based on the LS1028A CPU is broken.

Add the SoC specific MAC register offset to calculation of imdio.priv to fix this.

Fixes cc4e8af2c552 ("net: fsl_enetc: Split register accessors")

---

But the question that now arises is, does this code path work on the imx SoCs as well. Now the imx specific offset 0x5000 is added here and was not used before.

Can someone please test this on an imx9 and confirm?

 drivers/net/fsl_enetc.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/fsl_enetc.c index renamed from drivers/net/fsl_enetc.c +0 -0

52fa820f51..97cccda451 100644

drivers/net/fsl_enetc.c +4 -2
@@ -473,13 +473,15 @@ static int enetc_init_sxgmii(struct udevice *dev)
 /* Apply protocol specific configuration to MAC, serdes as needed */  static
 void enetc_start_pcs(struct udevice *dev)  {
+	struct enetc_data *data = (struct enetc_data
+*)dev_get_driver_data(dev);
 	struct enetc_priv *priv = dev_get_priv(dev);
 
 	/* register internal MDIO for debug purposes */
 	if (enetc_read_pcapr_mdio(dev)) {
 		priv->imdio.read = enetc_mdio_read;
 		priv->imdio.write = enetc_mdio_write;
-		priv->imdio.priv = priv->port_regs + ENETC_PM_IMDIO_BASE;
+		priv->imdio.priv = priv->port_regs + data->reg_offset_mac +
+		                   ENETC_PM_IMDIO_BASE;
 		strlcpy(priv->imdio.name, dev->name, MDIO_NAME_LEN);
 		if (!miiphy_get_dev_by_name(priv->imdio.name))
 			mdio_register(&priv->imdio);
--

2.20.1

#9 lore raw
In reply to Heiko Thiery
Quoted 11 lines · Heiko Thiery

From: Thomas Schaefer <[email protected]>

With commit cc4e8af2c552, fsl_enetc register accessors have been split to handle different register offsets on different SoCs. However, for internal MDIO register calculation, only ENETC_PM_IMDIO_BASE was fixed without adding the SoC specific MAC register offset.

As a result, the network support for the Kontron SMARC-sAL28 and probably other boards based on the LS1028A CPU is broken.

Quoted 6 lines

Add the SoC specific MAC register offset to calculation of imdio.priv to fix this.

Fixes cc4e8af2c552 ("net: fsl_enetc: Split register accessors")

Applied, thanks.