Skip to content

Commit f06e4bf

Browse files
Qunqin Zhaokuba-moo
authored andcommitted
net: stmmac: dwmac-loongson: Add fix_soc_reset() callback
Loongson's DWMAC device may take nearly two seconds to complete DMA reset, however, the default waiting time for reset is 200 milliseconds. Therefore, the following error message may appear: [14.427169] dwmac-loongson-pci 0000:00:03.2: Failed to reset the dma Fixes: 803fc61 ("net: stmmac: dwmac-loongson: Add Loongson Multi-channels GMAC support") Cc: [email protected] Signed-off-by: Qunqin Zhao <[email protected]> Reviewed-by: Huacai Chen <[email protected]> Reviewed-by: Jacob Keller <[email protected]> Acked-by: Yanteng Si <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 992ee3e commit f06e4bf

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -516,6 +516,19 @@ static int loongson_dwmac_acpi_config(struct pci_dev *pdev,
516516
return 0;
517517
}
518518

519+
/* Loongson's DWMAC device may take nearly two seconds to complete DMA reset */
520+
static int loongson_dwmac_fix_reset(void *priv, void __iomem *ioaddr)
521+
{
522+
u32 value = readl(ioaddr + DMA_BUS_MODE);
523+
524+
value |= DMA_BUS_MODE_SFT_RESET;
525+
writel(value, ioaddr + DMA_BUS_MODE);
526+
527+
return readl_poll_timeout(ioaddr + DMA_BUS_MODE, value,
528+
!(value & DMA_BUS_MODE_SFT_RESET),
529+
10000, 2000000);
530+
}
531+
519532
static int loongson_dwmac_probe(struct pci_dev *pdev, const struct pci_device_id *id)
520533
{
521534
struct plat_stmmacenet_data *plat;
@@ -566,6 +579,7 @@ static int loongson_dwmac_probe(struct pci_dev *pdev, const struct pci_device_id
566579

567580
plat->bsp_priv = ld;
568581
plat->setup = loongson_dwmac_setup;
582+
plat->fix_soc_reset = loongson_dwmac_fix_reset;
569583
ld->dev = &pdev->dev;
570584
ld->loongson_id = readl(res.addr + GMAC_VERSION) & 0xff;
571585

0 commit comments

Comments
 (0)