[PATCH 0/3] 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(-)

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.
Signed-off-by: Erik Schumacher erik.schumacher@iris-sensing.com --- drivers/net/dwc_eth_qos.c | 3 +++ drivers/net/dwc_eth_qos.h | 1 + 2 files changed, 4 insertions(+)
diff --git a/drivers/net/dwc_eth_qos.c b/drivers/net/dwc_eth_qos.c index 3415c418a9..ab51a98e9d 100644 --- a/drivers/net/dwc_eth_qos.c +++ b/drivers/net/dwc_eth_qos.c @@ -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); diff --git a/drivers/net/dwc_eth_qos.h b/drivers/net/dwc_eth_qos.h index ce57e22a81..123f98d5d5 100644 --- a/drivers/net/dwc_eth_qos.h +++ b/drivers/net/dwc_eth_qos.h @@ -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 {

On Mon, Oct 28, 2024 at 6:42 PM Erik Schumacher erik.schumacher@iris-sensing.com wrote:
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.
Signed-off-by: Erik Schumacher erik.schumacher@iris-sensing.com
Applied all, thanks.

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")
Signed-off-by: Erik Schumacher erik.schumacher@iris-sensing.com --- drivers/net/dwc_eth_qos_imx.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+)
diff --git a/drivers/net/dwc_eth_qos_imx.c b/drivers/net/dwc_eth_qos_imx.c index 642432834f..af42f7436c 100644 --- a/drivers/net/dwc_eth_qos_imx.c +++ b/drivers/net/dwc_eth_qos_imx.c @@ -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 = {

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.
Signed-off-by: Erik Schumacher erik.schumacher@iris-sensing.com --- drivers/net/dwc_eth_qos.c | 4 ---- 1 file changed, 4 deletions(-)
diff --git a/drivers/net/dwc_eth_qos.c b/drivers/net/dwc_eth_qos.c index ab51a98e9d..2279481d93 100644 --- a/drivers/net/dwc_eth_qos.c +++ b/drivers/net/dwc_eth_qos.c @@ -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>
participants (2)
-
Erik Schumacher
-
Fabio Estevam