diff mbox series

[V2] net: stmmac: dwmac-loongson: Add fix_soc_reset() callback

Message ID 20250212023622.14512-1-zhaoqunqin@loongson.cn (mailing list archive)
State Superseded
Delegated to: Netdev Maintainers
Headers show
Series [V2] net: stmmac: dwmac-loongson: Add fix_soc_reset() callback | expand

Checks

Context Check Description
netdev/series_format warning Single patches do not need cover letters; Target tree name not specified in the subject
netdev/tree_selection success Guessed tree name to be net-next
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/build_tools success No tools touched, skip
netdev/cc_maintainers warning 5 maintainers not CCed: alexandre.torgue@foss.st.com chenfeiyang@loongson.cn linux-stm32@st-md-mailman.stormreply.com mcoquelin.stm32@gmail.com linux-arm-kernel@lists.infradead.org
netdev/build_clang success Errors and warnings before: 1 this patch: 1
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success Fixes tag looks correct
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 26 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0
netdev/contest success net-next-2025-02-12--06-00 (tests: 889)

Commit Message

Qunqin Zhao Feb. 12, 2025, 2:36 a.m. UTC
Loongson's DWMAC device may take nearly two seconds to complete DMA reset,
however, the default waiting time for reset is 200 milliseconds.

Fixes: 803fc61df261 ("net: stmmac: dwmac-loongson: Add Loongson Multi-channels GMAC support")
Signed-off-by: Qunqin Zhao <zhaoqunqin@loongson.cn>
Reviewed-by: Huacai Chen <chenhuacai@loongson.cn>
---
v2: Added comments. Changed callback name to loongson_dwmac_fix_reset.

 .../net/ethernet/stmicro/stmmac/dwmac-loongson.c   | 14 ++++++++++++++
 1 file changed, 14 insertions(+)


base-commit: a64dcfb451e254085a7daee5fe51bf22959d52d3

Comments

Krzysztof Kozlowski Feb. 12, 2025, 5:42 a.m. UTC | #1
On 12/02/2025 03:36, Qunqin Zhao wrote:
> Loongson's DWMAC device may take nearly two seconds to complete DMA reset,
> however, the default waiting time for reset is 200 milliseconds.
> 
> Fixes: 803fc61df261 ("net: stmmac: dwmac-loongson: Add Loongson Multi-channels GMAC support")

You still miss cc-stable.

Best regards,
Krzysztof
Qunqin Zhao Feb. 12, 2025, 6:04 a.m. UTC | #2
在 2025/2/12 下午1:42, Krzysztof Kozlowski 写道:
> On 12/02/2025 03:36, Qunqin Zhao wrote:
>> Loongson's DWMAC device may take nearly two seconds to complete DMA reset,
>> however, the default waiting time for reset is 200 milliseconds.
>>
>> Fixes: 803fc61df261 ("net: stmmac: dwmac-loongson: Add Loongson Multi-channels GMAC support")
> You still miss cc-stable.
OK, thanks.
>
> Best regards,
> Krzysztof
Huacai Chen Feb. 12, 2025, 6:13 a.m. UTC | #3
On Wed, Feb 12, 2025 at 2:03 PM Qunqin Zhao <zhaoqunqin@loongson.cn> wrote:
>
>
> 在 2025/2/12 下午1:42, Krzysztof Kozlowski 写道:
> > On 12/02/2025 03:36, Qunqin Zhao wrote:
> >> Loongson's DWMAC device may take nearly two seconds to complete DMA reset,
> >> however, the default waiting time for reset is 200 milliseconds.
> >>
> >> Fixes: 803fc61df261 ("net: stmmac: dwmac-loongson: Add Loongson Multi-channels GMAC support")
> > You still miss cc-stable.
> OK, thanks.
You can copy-paste the error message to commit message since you need
V3, and the title should begin with [PATCH net V3].

Huacai

> >
> > Best regards,
> > Krzysztof
>
Qunqin Zhao Feb. 13, 2025, 1:30 a.m. UTC | #4
在 2025/2/12 下午2:13, Huacai Chen 写道:
> On Wed, Feb 12, 2025 at 2:03 PM Qunqin Zhao <zhaoqunqin@loongson.cn> wrote:
>>
>> 在 2025/2/12 下午1:42, Krzysztof Kozlowski 写道:
>>> On 12/02/2025 03:36, Qunqin Zhao wrote:
>>>> Loongson's DWMAC device may take nearly two seconds to complete DMA reset,
>>>> however, the default waiting time for reset is 200 milliseconds.
>>>>
>>>> Fixes: 803fc61df261 ("net: stmmac: dwmac-loongson: Add Loongson Multi-channels GMAC support")
>>> You still miss cc-stable.
>> OK, thanks.
> You can copy-paste the error message to commit message since you need
> V3, and the title should begin with [PATCH net V3].
OK, thanks.
>
> Huacai
>
>>> Best regards,
>>> Krzysztof
diff mbox series

Patch

diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c
index bfe6e2d631bd..f5acfb7d4ff6 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c
@@ -516,6 +516,19 @@  static int loongson_dwmac_acpi_config(struct pci_dev *pdev,
 	return 0;
 }
 
+/* Loongson's DWMAC device may take nearly two seconds to complete DMA reset */
+static int loongson_dwmac_fix_reset(void *priv, void __iomem *ioaddr)
+{
+	u32 value = readl(ioaddr + DMA_BUS_MODE);
+
+	value |= DMA_BUS_MODE_SFT_RESET;
+	writel(value, ioaddr + DMA_BUS_MODE);
+
+	return readl_poll_timeout(ioaddr + DMA_BUS_MODE, value,
+				  !(value & DMA_BUS_MODE_SFT_RESET),
+				  10000, 2000000);
+}
+
 static int loongson_dwmac_probe(struct pci_dev *pdev, const struct pci_device_id *id)
 {
 	struct plat_stmmacenet_data *plat;
@@ -566,6 +579,7 @@  static int loongson_dwmac_probe(struct pci_dev *pdev, const struct pci_device_id
 
 	plat->bsp_priv = ld;
 	plat->setup = loongson_dwmac_setup;
+	plat->fix_soc_reset = loongson_dwmac_fix_reset;
 	ld->dev = &pdev->dev;
 	ld->loongson_id = readl(res.addr + GMAC_VERSION) & 0xff;