Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge branch 'refine-stmmac-code'

Tiezhu Yang says:

====================
Refine stmmac code

Here are three small patches to refine stmmac code when debugging and
testing the problem "Failed to reset the dma".
====================

Link: https://patch.msgid.link/20250811073506.27513-1-yangtiezhu@loongson.cn
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

+19 -7
+3 -3
drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c
··· 49 49 u32 flags; 50 50 bool mac_rgmii_txclk_auto_adj; 51 51 52 - int (*fix_soc_reset)(void *priv, void __iomem *ioaddr); 52 + int (*fix_soc_reset)(struct stmmac_priv *priv, void __iomem *ioaddr); 53 53 int (*set_intf_mode)(struct plat_stmmacenet_data *plat_dat); 54 54 void (*fix_mac_speed)(void *priv, int speed, unsigned int mode); 55 55 }; ··· 265 265 writel(old_ctrl, dwmac->base_addr + MAC_CTRL_REG); 266 266 } 267 267 268 - static int imx_dwmac_mx93_reset(void *priv, void __iomem *ioaddr) 268 + static int imx_dwmac_mx93_reset(struct stmmac_priv *priv, void __iomem *ioaddr) 269 269 { 270 - struct plat_stmmacenet_data *plat_dat = priv; 270 + struct plat_stmmacenet_data *plat_dat = priv->plat; 271 271 u32 value = readl(ioaddr + DMA_BUS_MODE); 272 272 273 273 /* DMA SW reset */
+6 -1
drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c
··· 509 509 } 510 510 511 511 /* Loongson's DWMAC device may take nearly two seconds to complete DMA reset */ 512 - static int loongson_dwmac_fix_reset(void *priv, void __iomem *ioaddr) 512 + static int loongson_dwmac_fix_reset(struct stmmac_priv *priv, void __iomem *ioaddr) 513 513 { 514 514 u32 value = readl(ioaddr + DMA_BUS_MODE); 515 + 516 + if (value & DMA_BUS_MODE_SFT_RESET) { 517 + netdev_err(priv->dev, "the PHY clock is missing\n"); 518 + return -EINVAL; 519 + } 515 520 516 521 value |= DMA_BUS_MODE_SFT_RESET; 517 522 writel(value, ioaddr + DMA_BUS_MODE);
+1 -1
drivers/net/ethernet/stmicro/stmmac/hwif.c
··· 100 100 return -EINVAL; 101 101 102 102 if (plat && plat->fix_soc_reset) 103 - return plat->fix_soc_reset(plat, ioaddr); 103 + return plat->fix_soc_reset(priv, ioaddr); 104 104 105 105 return stmmac_do_callback(priv, dma, reset, ioaddr); 106 106 }
+8 -1
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
··· 7984 7984 stmmac_free_tx_skbufs(priv); 7985 7985 stmmac_clear_descriptors(priv, &priv->dma_conf); 7986 7986 7987 - stmmac_hw_setup(ndev, false); 7987 + ret = stmmac_hw_setup(ndev, false); 7988 + if (ret < 0) { 7989 + netdev_err(priv->dev, "%s: Hw setup failed\n", __func__); 7990 + mutex_unlock(&priv->lock); 7991 + rtnl_unlock(); 7992 + return ret; 7993 + } 7994 + 7988 7995 stmmac_init_coalesce(priv); 7989 7996 phylink_rx_clk_stop_block(priv->phylink); 7990 7997 stmmac_set_rx_mode(ndev);
+1 -1
include/linux/stmmac.h
··· 238 238 int (*set_clk_tx_rate)(void *priv, struct clk *clk_tx_i, 239 239 phy_interface_t interface, int speed); 240 240 void (*fix_mac_speed)(void *priv, int speed, unsigned int mode); 241 - int (*fix_soc_reset)(void *priv, void __iomem *ioaddr); 241 + int (*fix_soc_reset)(struct stmmac_priv *priv, void __iomem *ioaddr); 242 242 int (*serdes_powerup)(struct net_device *ndev, void *priv); 243 243 void (*serdes_powerdown)(struct net_device *ndev, void *priv); 244 244 int (*mac_finish)(struct net_device *ndev,