mirror of
https://github.com/torvalds/linux.git
synced 2026-03-08 04:24:31 +01:00
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>
This commit is contained in:
commit
b9970c4d2a
5 changed files with 19 additions and 7 deletions
|
|
@ -49,7 +49,7 @@ struct imx_dwmac_ops {
|
|||
u32 flags;
|
||||
bool mac_rgmii_txclk_auto_adj;
|
||||
|
||||
int (*fix_soc_reset)(void *priv, void __iomem *ioaddr);
|
||||
int (*fix_soc_reset)(struct stmmac_priv *priv, void __iomem *ioaddr);
|
||||
int (*set_intf_mode)(struct plat_stmmacenet_data *plat_dat);
|
||||
void (*fix_mac_speed)(void *priv, int speed, unsigned int mode);
|
||||
};
|
||||
|
|
@ -265,9 +265,9 @@ static void imx93_dwmac_fix_speed(void *priv, int speed, unsigned int mode)
|
|||
writel(old_ctrl, dwmac->base_addr + MAC_CTRL_REG);
|
||||
}
|
||||
|
||||
static int imx_dwmac_mx93_reset(void *priv, void __iomem *ioaddr)
|
||||
static int imx_dwmac_mx93_reset(struct stmmac_priv *priv, void __iomem *ioaddr)
|
||||
{
|
||||
struct plat_stmmacenet_data *plat_dat = priv;
|
||||
struct plat_stmmacenet_data *plat_dat = priv->plat;
|
||||
u32 value = readl(ioaddr + DMA_BUS_MODE);
|
||||
|
||||
/* DMA SW reset */
|
||||
|
|
|
|||
|
|
@ -509,10 +509,15 @@ static int loongson_dwmac_acpi_config(struct pci_dev *pdev,
|
|||
}
|
||||
|
||||
/* Loongson's DWMAC device may take nearly two seconds to complete DMA reset */
|
||||
static int loongson_dwmac_fix_reset(void *priv, void __iomem *ioaddr)
|
||||
static int loongson_dwmac_fix_reset(struct stmmac_priv *priv, void __iomem *ioaddr)
|
||||
{
|
||||
u32 value = readl(ioaddr + DMA_BUS_MODE);
|
||||
|
||||
if (value & DMA_BUS_MODE_SFT_RESET) {
|
||||
netdev_err(priv->dev, "the PHY clock is missing\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
value |= DMA_BUS_MODE_SFT_RESET;
|
||||
writel(value, ioaddr + DMA_BUS_MODE);
|
||||
|
||||
|
|
|
|||
|
|
@ -100,7 +100,7 @@ int stmmac_reset(struct stmmac_priv *priv, void __iomem *ioaddr)
|
|||
return -EINVAL;
|
||||
|
||||
if (plat && plat->fix_soc_reset)
|
||||
return plat->fix_soc_reset(plat, ioaddr);
|
||||
return plat->fix_soc_reset(priv, ioaddr);
|
||||
|
||||
return stmmac_do_callback(priv, dma, reset, ioaddr);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7984,7 +7984,14 @@ int stmmac_resume(struct device *dev)
|
|||
stmmac_free_tx_skbufs(priv);
|
||||
stmmac_clear_descriptors(priv, &priv->dma_conf);
|
||||
|
||||
stmmac_hw_setup(ndev, false);
|
||||
ret = stmmac_hw_setup(ndev, false);
|
||||
if (ret < 0) {
|
||||
netdev_err(priv->dev, "%s: Hw setup failed\n", __func__);
|
||||
mutex_unlock(&priv->lock);
|
||||
rtnl_unlock();
|
||||
return ret;
|
||||
}
|
||||
|
||||
stmmac_init_coalesce(priv);
|
||||
phylink_rx_clk_stop_block(priv->phylink);
|
||||
stmmac_set_rx_mode(ndev);
|
||||
|
|
|
|||
|
|
@ -238,7 +238,7 @@ struct plat_stmmacenet_data {
|
|||
int (*set_clk_tx_rate)(void *priv, struct clk *clk_tx_i,
|
||||
phy_interface_t interface, int speed);
|
||||
void (*fix_mac_speed)(void *priv, int speed, unsigned int mode);
|
||||
int (*fix_soc_reset)(void *priv, void __iomem *ioaddr);
|
||||
int (*fix_soc_reset)(struct stmmac_priv *priv, void __iomem *ioaddr);
|
||||
int (*serdes_powerup)(struct net_device *ndev, void *priv);
|
||||
void (*serdes_powerdown)(struct net_device *ndev, void *priv);
|
||||
int (*mac_finish)(struct net_device *ndev,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue