devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1 net 0/3] Some bug fixes
@ 2023-12-11 10:20 Yanteng Si
  2023-12-11 10:33 ` [PATCH v1 net 1/3] stmmac: dwmac-loongson: Make sure MDIO is initialized before use Yanteng Si
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Yanteng Si @ 2023-12-11 10:20 UTC (permalink / raw)
  To: andrew, tsbogend
  Cc: Yanteng Si, robh+dt, krzysztof.kozlowski+dt, conor+dt,
	peppe.cavallaro, alexandre.torgue, joabreu, davem, edumazet, kuba,
	pabeni, mcoquelin.stm32, devicetree, linux-mips, chenhuacai,
	netdev, loongarch, chris.chenfeiyang

* Put Krzysztof's patch into my thread, pick Conor's Reviewed-by
  tag and Jiaxun's Acked-by tag.(prev version is RFC patch)

* I fixed an Oops related to mdio, mainly to ensure that
  mdio is initialized before use, because it will be used
  in a series of patches I am working on.

see <https://lore.kernel.org/loongarch/cover.1699533745.git.siyanteng@loongson.cn/T/#t>


Krzysztof Kozlowski (2):
  stmmac: dwmac-loongson: drop useless check for compatible fallback
  MIPS: dts: loongson: drop incorrect dwmac fallback compatible

Yanteng Si (1):
  stmmac: dwmac-loongson: Make sure MDIO is initialized before use

 .../boot/dts/loongson/loongson64-2k1000.dtsi  |  3 +--
 arch/mips/boot/dts/loongson/ls7a-pch.dtsi     |  3 +--
 .../ethernet/stmicro/stmmac/dwmac-loongson.c  | 19 ++++++-------------
 3 files changed, 8 insertions(+), 17 deletions(-)

-- 
2.31.4


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH v1 net 1/3] stmmac: dwmac-loongson: Make sure MDIO is initialized before use
  2023-12-11 10:20 [PATCH v1 net 0/3] Some bug fixes Yanteng Si
@ 2023-12-11 10:33 ` Yanteng Si
  2023-12-11 14:03   ` Andrew Lunn
  2023-12-11 10:33 ` [PATCH v1 net 2/3] stmmac: dwmac-loongson: drop useless check for compatible fallback Yanteng Si
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 6+ messages in thread
From: Yanteng Si @ 2023-12-11 10:33 UTC (permalink / raw)
  To: andrew, tsbogend
  Cc: Yanteng Si, robh+dt, krzysztof.kozlowski+dt, conor+dt,
	peppe.cavallaro, alexandre.torgue, joabreu, davem, edumazet, kuba,
	pabeni, mcoquelin.stm32, devicetree, linux-mips, chenhuacai,
	netdev, loongarch, chris.chenfeiyang

Generic code will use mdio. If it is not initialized before use,
the kernel will Oops.

Fixes: 30bba69d7db4 ("stmmac: pci: Add dwmac support for Loongson")
Signed-off-by: Yanteng Si <siyanteng@loongson.cn>
Signed-off-by: Feiyang Chen <chenfeiyang@loongson.cn>
---
 .../net/ethernet/stmicro/stmmac/dwmac-loongson.c   | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c
index 2cd6fce5c993..e7701326adc6 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c
@@ -68,17 +68,15 @@ static int loongson_dwmac_probe(struct pci_dev *pdev, const struct pci_device_id
 	if (!plat)
 		return -ENOMEM;
 
+	plat->mdio_bus_data = devm_kzalloc(&pdev->dev,
+					   sizeof(*plat->mdio_bus_data),
+					   GFP_KERNEL);
+	if (!plat->mdio_bus_data)
+		return -ENOMEM;
+
 	plat->mdio_node = of_get_child_by_name(np, "mdio");
 	if (plat->mdio_node) {
 		dev_info(&pdev->dev, "Found MDIO subnode\n");
-
-		plat->mdio_bus_data = devm_kzalloc(&pdev->dev,
-						   sizeof(*plat->mdio_bus_data),
-						   GFP_KERNEL);
-		if (!plat->mdio_bus_data) {
-			ret = -ENOMEM;
-			goto err_put_node;
-		}
 		plat->mdio_bus_data->needs_reset = true;
 	}
 
-- 
2.31.4


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH v1 net 2/3] stmmac: dwmac-loongson: drop useless check for compatible fallback
  2023-12-11 10:20 [PATCH v1 net 0/3] Some bug fixes Yanteng Si
  2023-12-11 10:33 ` [PATCH v1 net 1/3] stmmac: dwmac-loongson: Make sure MDIO is initialized before use Yanteng Si
@ 2023-12-11 10:33 ` Yanteng Si
  2023-12-11 10:33 ` [PATCH v1 net 3/3] MIPS: dts: loongson: drop incorrect dwmac fallback compatible Yanteng Si
  2023-12-13 11:00 ` [PATCH v1 net 0/3] Some bug fixes patchwork-bot+netdevbpf
  3 siblings, 0 replies; 6+ messages in thread
From: Yanteng Si @ 2023-12-11 10:33 UTC (permalink / raw)
  To: andrew, tsbogend
  Cc: Krzysztof Kozlowski, robh+dt, krzysztof.kozlowski+dt, conor+dt,
	peppe.cavallaro, alexandre.torgue, joabreu, davem, edumazet, kuba,
	pabeni, mcoquelin.stm32, devicetree, linux-mips, chenhuacai,
	netdev, loongarch, chris.chenfeiyang, Yanteng Si, Conor Dooley,
	Jiaxun Yang

From: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>

Device binds to proper PCI ID (LOONGSON, 0x7a03), already listed in DTS,
so checking for some other compatible does not make sense.  It cannot be
bound to unsupported platform.

Drop useless, incorrect (space in between) and undocumented compatible.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: Yanteng Si <siyanteng@loongson.cn>
Reviewed-by: Conor Dooley <conor.dooley@microchip.com>
Acked-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
---
 drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c
index e7701326adc6..9e40c28d453a 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c
@@ -59,11 +59,6 @@ static int loongson_dwmac_probe(struct pci_dev *pdev, const struct pci_device_id
 		return -ENODEV;
 	}
 
-	if (!of_device_is_compatible(np, "loongson, pci-gmac")) {
-		pr_info("dwmac_loongson_pci: Incompatible OF node\n");
-		return -ENODEV;
-	}
-
 	plat = devm_kzalloc(&pdev->dev, sizeof(*plat), GFP_KERNEL);
 	if (!plat)
 		return -ENOMEM;
-- 
2.31.4


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH v1 net 3/3] MIPS: dts: loongson: drop incorrect dwmac fallback compatible
  2023-12-11 10:20 [PATCH v1 net 0/3] Some bug fixes Yanteng Si
  2023-12-11 10:33 ` [PATCH v1 net 1/3] stmmac: dwmac-loongson: Make sure MDIO is initialized before use Yanteng Si
  2023-12-11 10:33 ` [PATCH v1 net 2/3] stmmac: dwmac-loongson: drop useless check for compatible fallback Yanteng Si
@ 2023-12-11 10:33 ` Yanteng Si
  2023-12-13 11:00 ` [PATCH v1 net 0/3] Some bug fixes patchwork-bot+netdevbpf
  3 siblings, 0 replies; 6+ messages in thread
From: Yanteng Si @ 2023-12-11 10:33 UTC (permalink / raw)
  To: andrew, tsbogend
  Cc: Krzysztof Kozlowski, robh+dt, krzysztof.kozlowski+dt, conor+dt,
	peppe.cavallaro, alexandre.torgue, joabreu, davem, edumazet, kuba,
	pabeni, mcoquelin.stm32, devicetree, linux-mips, chenhuacai,
	netdev, loongarch, chris.chenfeiyang, Yanteng Si, Conor Dooley,
	Jiaxun Yang

From: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>

Device binds to proper PCI ID (LOONGSON, 0x7a03), already listed in DTS,
so checking for some other compatible does not make sense.  It cannot be
bound to unsupported platform.

Drop useless, incorrect (space in between) and undocumented compatible.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: Yanteng Si <siyanteng@loongson.cn>
Reviewed-by: Conor Dooley <conor.dooley@microchip.com>
Acked-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
---
 arch/mips/boot/dts/loongson/loongson64-2k1000.dtsi | 3 +--
 arch/mips/boot/dts/loongson/ls7a-pch.dtsi          | 3 +--
 2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/arch/mips/boot/dts/loongson/loongson64-2k1000.dtsi b/arch/mips/boot/dts/loongson/loongson64-2k1000.dtsi
index f878f47e4501..ee3e2153dd13 100644
--- a/arch/mips/boot/dts/loongson/loongson64-2k1000.dtsi
+++ b/arch/mips/boot/dts/loongson/loongson64-2k1000.dtsi
@@ -130,8 +130,7 @@ gmac@3,0 {
 				compatible = "pci0014,7a03.0",
 						   "pci0014,7a03",
 						   "pciclass0c0320",
-						   "pciclass0c03",
-						   "loongson, pci-gmac";
+						   "pciclass0c03";
 
 				reg = <0x1800 0x0 0x0 0x0 0x0>;
 				interrupts = <12 IRQ_TYPE_LEVEL_LOW>,
diff --git a/arch/mips/boot/dts/loongson/ls7a-pch.dtsi b/arch/mips/boot/dts/loongson/ls7a-pch.dtsi
index 7c69e8245c2f..cce9428afc41 100644
--- a/arch/mips/boot/dts/loongson/ls7a-pch.dtsi
+++ b/arch/mips/boot/dts/loongson/ls7a-pch.dtsi
@@ -193,8 +193,7 @@ gmac@3,0 {
 				compatible = "pci0014,7a03.0",
 						   "pci0014,7a03",
 						   "pciclass020000",
-						   "pciclass0200",
-						   "loongson, pci-gmac";
+						   "pciclass0200";
 
 				reg = <0x1800 0x0 0x0 0x0 0x0>;
 				interrupts = <12 IRQ_TYPE_LEVEL_HIGH>,
-- 
2.31.4


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH v1 net 1/3] stmmac: dwmac-loongson: Make sure MDIO is initialized before use
  2023-12-11 10:33 ` [PATCH v1 net 1/3] stmmac: dwmac-loongson: Make sure MDIO is initialized before use Yanteng Si
@ 2023-12-11 14:03   ` Andrew Lunn
  0 siblings, 0 replies; 6+ messages in thread
From: Andrew Lunn @ 2023-12-11 14:03 UTC (permalink / raw)
  To: Yanteng Si
  Cc: tsbogend, robh+dt, krzysztof.kozlowski+dt, conor+dt,
	peppe.cavallaro, alexandre.torgue, joabreu, davem, edumazet, kuba,
	pabeni, mcoquelin.stm32, devicetree, linux-mips, chenhuacai,
	netdev, loongarch, chris.chenfeiyang

On Mon, Dec 11, 2023 at 06:33:11PM +0800, Yanteng Si wrote:
> Generic code will use mdio. If it is not initialized before use,
> the kernel will Oops.
> 
> Fixes: 30bba69d7db4 ("stmmac: pci: Add dwmac support for Loongson")
> Signed-off-by: Yanteng Si <siyanteng@loongson.cn>
> Signed-off-by: Feiyang Chen <chenfeiyang@loongson.cn>

Reviewed-by: Andrew Lunn <andrew@lunn.ch>

    Andrew

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v1 net 0/3] Some bug fixes
  2023-12-11 10:20 [PATCH v1 net 0/3] Some bug fixes Yanteng Si
                   ` (2 preceding siblings ...)
  2023-12-11 10:33 ` [PATCH v1 net 3/3] MIPS: dts: loongson: drop incorrect dwmac fallback compatible Yanteng Si
@ 2023-12-13 11:00 ` patchwork-bot+netdevbpf
  3 siblings, 0 replies; 6+ messages in thread
From: patchwork-bot+netdevbpf @ 2023-12-13 11:00 UTC (permalink / raw)
  To: Yanteng Si
  Cc: andrew, tsbogend, robh+dt, krzysztof.kozlowski+dt, conor+dt,
	peppe.cavallaro, alexandre.torgue, joabreu, davem, edumazet, kuba,
	pabeni, mcoquelin.stm32, devicetree, linux-mips, chenhuacai,
	netdev, loongarch, chris.chenfeiyang

Hello:

This series was applied to netdev/net.git (main)
by David S. Miller <davem@davemloft.net>:

On Mon, 11 Dec 2023 18:20:32 +0800 you wrote:
> * Put Krzysztof's patch into my thread, pick Conor's Reviewed-by
>   tag and Jiaxun's Acked-by tag.(prev version is RFC patch)
> 
> * I fixed an Oops related to mdio, mainly to ensure that
>   mdio is initialized before use, because it will be used
>   in a series of patches I am working on.
> 
> [...]

Here is the summary with links:
  - [v1,net,1/3] stmmac: dwmac-loongson: Make sure MDIO is initialized before use
    https://git.kernel.org/netdev/net/c/e87d3a1370ce
  - [v1,net,2/3] stmmac: dwmac-loongson: drop useless check for compatible fallback
    https://git.kernel.org/netdev/net/c/31fea092c6f9
  - [v1,net,3/3] MIPS: dts: loongson: drop incorrect dwmac fallback compatible
    https://git.kernel.org/netdev/net/c/4907a3f54b12

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2023-12-13 11:00 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-12-11 10:20 [PATCH v1 net 0/3] Some bug fixes Yanteng Si
2023-12-11 10:33 ` [PATCH v1 net 1/3] stmmac: dwmac-loongson: Make sure MDIO is initialized before use Yanteng Si
2023-12-11 14:03   ` Andrew Lunn
2023-12-11 10:33 ` [PATCH v1 net 2/3] stmmac: dwmac-loongson: drop useless check for compatible fallback Yanteng Si
2023-12-11 10:33 ` [PATCH v1 net 3/3] MIPS: dts: loongson: drop incorrect dwmac fallback compatible Yanteng Si
2023-12-13 11:00 ` [PATCH v1 net 0/3] Some bug fixes patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).