Skip to contentSkip to conversation

Fix eqos rmii reset on i.MX93

PATCH Applied Erik Schumacher 2 participants 5 messages Oct 28, 2024 – Oct 30, 2024

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover Fix eqos rmii reset on i.MX93

This patch series implements the workaround for an errata of the i.MX93 which fails to finish the eqos reset procedure in RMII mode.

Trying to use RMII on i.MX93 without these patches results in an error:

u-boot=> dhcp
EQOS_DMA_MODE_SWR stuckFAILED: -110u-boot=>

The first patch adds general support for platform specific reset logic. The second patch implements the workaround for the i.MX93. And the third patch removes obsolete includes in dwc_eth_qos.c

Erik Schumacher (3):
net: dwc_eth_qos: Add support for platform specific reset
net: dwc_eth_qos_imx: Add platform specific reset for i.MX93
net: dwc_eth_qos: Remove obsolete imx8 includes

 drivers/net/dwc_eth_qos.c     |  7 +++----
 drivers/net/dwc_eth_qos.h     |  1 +
 drivers/net/dwc_eth_qos_imx.c | 22 ++++++++++++++++++++++
 3 files changed, 26 insertions(+), 4 deletions(-)
Signature · 1 line
2.47.0
#1 lore raw

PATCH 1/3 net: dwc_eth_qos: Add support for platform specific reset

This patch adds support for optional platform specific reset logic in the dwc_eth_qos driver. This new function 'eqos_fix_soc_reset' is called after the EQOS_DMA_MODE_SWR is set and before the driver waits for this bit to clear.

---
 drivers/net/dwc_eth_qos.c | 3 +++
 drivers/net/dwc_eth_qos.h | 1 +
 2 files changed, 4 insertions(+)
drivers/net/dwc_eth_qos.c +3 -0
index 3415c418a9..ab51a98e9d 100644
@@ -712,6 +712,9 @@ static int eqos_start(struct udevice *dev)
 	 */
 	setbits_le32(&eqos->dma_regs->mode, EQOS_DMA_MODE_SWR);
 
+	if (eqos->config->ops->eqos_fix_soc_reset)
+		eqos->config->ops->eqos_fix_soc_reset(dev);
+
 	ret = wait_for_bit_le32(&eqos->dma_regs->mode,
 				EQOS_DMA_MODE_SWR, false,
 				eqos->config->swr_wait, false);
drivers/net/dwc_eth_qos.h +1 -0
index ce57e22a81..123f98d5d5 100644
@@ -248,6 +248,7 @@ struct eqos_ops {
 	int (*eqos_set_tx_clk_speed)(struct udevice *dev);
 	int (*eqos_get_enetaddr)(struct udevice *dev);
 	ulong (*eqos_get_tick_clk_rate)(struct udevice *dev);
+	void (*eqos_fix_soc_reset)(struct udevice *dev);
 };
 
 struct eqos_priv {
Signature · 1 line
2.47.0
reviewer Applied
#2 lore raw

Re: [PATCH 1/3] net: dwc_eth_qos: Add support for platform specific reset

Quoted 7 lines · Erik Schumacher

This patch adds support for optional platform specific reset logic in the dwc_eth_qos driver. This new function 'eqos_fix_soc_reset' is called after the EQOS_DMA_MODE_SWR is set and before the driver waits for this bit to clear.

Applied all, thanks.

#3 lore raw

PATCH 2/3 net: dwc_eth_qos_imx: Add platform specific reset for i.MX93

In reply to Erik Schumacher

The EQOS on i.MX93 fails to finish the reset procedure in RMII mode. This is described in errata ERR051683. This patch implements the provided workaround which sets the PS and FES bits after the SWR is set by using the eqos_fix_soc_reset function.

Adapted from linux-kernel commit b536f32b5b03 ("net: stmmac: dwmac-imx:
use platform specific reset for imx93 SoCs")

---
 drivers/net/dwc_eth_qos_imx.c | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)
drivers/net/dwc_eth_qos_imx.c +22 -0
index 642432834f..af42f7436c 100644
@@ -216,6 +216,27 @@ static int eqos_get_enetaddr_imx(struct udevice *dev)
 	return 0;
 }
 
+static void eqos_fix_soc_reset_imx(struct udevice *dev)
+{
+	struct eqos_priv *eqos = dev_get_priv(dev);
+
+	if (IS_ENABLED(CONFIG_IMX93)) {
+		/*
+		 * Workaround for ERR051683 in i.MX93
+		 * The i.MX93 requires speed configuration bits to be set to
+		 * complete the reset procedure in RMII mode.
+		 * See b536f32b5b03 ("net: stmmac: dwmac-imx: use platform
+		 * specific reset for imx93 SoCs") in linux
+		 */
+		if (eqos->config->interface(dev) == PHY_INTERFACE_MODE_RMII) {
+			udelay(200);
+			setbits_le32(&eqos->mac_regs->configuration,
+				     EQOS_MAC_CONFIGURATION_PS |
+				     EQOS_MAC_CONFIGURATION_FES);
+		}
+	}
+}
+
 static struct eqos_ops eqos_imx_ops = {
 	.eqos_inval_desc = eqos_inval_desc_generic,
 	.eqos_flush_desc = eqos_flush_desc_generic,
@@ -232,6 +253,7 @@ static struct eqos_ops eqos_imx_ops = {
 	.eqos_set_tx_clk_speed = eqos_set_tx_clk_speed_imx,
 	.eqos_get_enetaddr = eqos_get_enetaddr_imx,
 	.eqos_get_tick_clk_rate = eqos_get_tick_clk_rate_imx,
+	.eqos_fix_soc_reset = eqos_fix_soc_reset_imx,
 };
 
 struct eqos_config __maybe_unused eqos_imx_config = {
Signature · 1 line
2.47.0
#4 lore raw

PATCH 3/3 net: dwc_eth_qos: Remove obsolete imx8 includes

In reply to Erik Schumacher

They were added with commit 0e9d23945ce0 ("net: eqos: implement callbaks to get interface and set txclk rate") but were not removed with commit 5fc783b5d9c9 ("net: dwc_eth_qos: move i.MX code out") when i.MX specific code was moved to a separate file.

---
 drivers/net/dwc_eth_qos.c | 4 ----
 1 file changed, 4 deletions(-)
drivers/net/dwc_eth_qos.c +0 -4
index ab51a98e9d..2279481d93 100644
@@ -47,10 +47,6 @@
 #include <asm/cache.h>
 #include <asm/gpio.h>
 #include <asm/io.h>
-#ifdef CONFIG_ARCH_IMX8M
-#include <asm/arch/clock.h>
-#include <asm/mach-imx/sys_proto.h>
-#endif
 #include <linux/bitfield.h>
 #include <linux/delay.h>
 #include <linux/printk.h>
Signature · 1 line
2.47.0