net: designware: improve ethernet DMA reset
PATCH 1/1 net: designware: improve ethernet DMA reset
Problem: uboot ethernet always have "DMA reset timeout" after linux usage, detected on VIM2 VIM3 VIM3L amlogic devices, mainline uboot and mainline linux > 5.1? .
How-to reproduce:
1) Poweron device => ethernet uboot work fine.
2) Linux start and ethernet interface up and same works.
3) Reboot to uboot again and we cant use ethernet anymore. uboot always have "DMA reset timeout" inside designware_eth_init() only poweroff/poweron cycle can solve this problem.
Solution: add phy_reset() into waiting DMA reset cycle, this insertion doesn't break normal behaviour (maybe).
Note: same need explore real problem why its happens! because this patch may be just hack.
--- drivers/net/designware.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/net/designware.c +4 -0
@@ -371,6 +371,7 @@ int designware_eth_init(struct dw_eth_dev *priv, u8 *enetaddr)struct eth_dma_regs *dma_p = priv->dma_regs_p;unsigned int start;int ret; +int phy_reset_force =0 ;writel (readl (&dma_p->busmode) |DMAMAC_SRST , &dma_p->busmode);
@@ -389,6 +390,9 @@ int designware_eth_init(struct dw_eth_dev *priv, u8 *enetaddr)printf ("DMA reset timeout\n" );return -ETIMEDOUT ; } +// forced phy reset after 0.2s can help with DMAMAC_SRST +if (phy_reset_force++ ==2 ) +phy_reset (priv->phydev);mdelay (100 ); };
Signature · 1 line
2.25.1
Hi,
Quoted 12 lines · Artem Lapkin
Problem: uboot ethernet always have "DMA reset timeout" after linux usage, detected on VIM2 VIM3 VIM3L amlogic devices, mainline uboot and mainline linux > 5.1? .
How-to reproduce:
1) Poweron device => ethernet uboot work fine.
2) Linux start and ethernet interface up and same works.
3) Reboot to uboot again and we cant use ethernet anymore. uboot always have "DMA reset timeout" insidedesignware_eth_init()only poweroff/poweron cycle can solve this problem.
Quoted 5 lines
Solution: add
phy_reset()into waiting DMA reset cycle, this insertion doesn't break normal behaviour (maybe).Note: same need explore real problem why its happens! because this patch may be just hack.
Interesting, maybe add this phy_reset() call only if the GPIO reset is not available ?
Neil
Quoted 29 lines
Signed-off-by Artem Lapkin <[email protected]>--- drivers/net/designware.c | 4 ++++ 1 file changed, 4 insertions(+)drivers/net/designware.c +4
-0@@ -371,6 +371,7 @@ int designware_eth_init(struct dw_eth_dev *priv, u8 *enetaddr)struct eth_dma_regs *dma_p = priv->dma_regs_p;unsigned int start;int ret; +int phy_reset_force =0 ;writel (readl (&dma_p->busmode) |DMAMAC_SRST , &dma_p->busmode);@@ -389,6 +390,9 @@ int designware_eth_init(struct dw_eth_dev *priv, u8 *enetaddr)printf ("DMA reset timeout\n" );return -ETIMEDOUT ; } +// forced phy reset after 0.2s can help with DMAMAC_SRST +if (phy_reset_force++ ==2 ) +phy_reset (priv->phydev);mdelay (100 ); };