Skip to contentSkip to conversation

net: dsa: b53: mmap: fix device tree support

PATCH Superseded Álvaro Fernández Rojas 4 participants 6 messages Mar 10, 2023 – Mar 18, 2023

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: dsa: b53: mmap: fix device tree support

B53_CPU_PORT should also be enabled in order to get a working switch.

Fixes a5538a777b73 ("net: dsa: b53: mmap: Add device tree support")
---
 drivers/net/dsa/b53/b53_mmap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/dsa/b53/b53_mmap.c +1 -1
index e968322dfbf0..24ea2e19dfa6 100644
@@ -263,7 +263,7 @@ static int b53_mmap_probe_of(struct platform_device *pdev,
 		if (of_property_read_u32(of_port, "reg", &reg))
 			continue;
 
-		if (reg < B53_CPU_PORT)
+		if (reg <= B53_CPU_PORT)
 			pdata->enabled_ports |= BIT(reg);
 	}
 
Signature · 1 line
2.30.2
maintainer
#1 lore raw

drivers/net/dsa/b53/b53_mmap.c static int b53_mmap_probe_of(struct platform_device *pdev, · line 267

Quoted 11 lines · On Fri, 10 Mar 2023 13:10:59 +0100 Álvaro Fernández Rojas wrote:
drivers/net/dsa/b53/b53_mmap.c +1 -1
index e968322dfbf0..24ea2e19dfa6 100644
@@ -263,7 +263,7 @@ static int b53_mmap_probe_of(struct platform_device *pdev,
 		if (of_property_read_u32(of_port, "reg", &reg))
 			continue;
 
-		if (reg < B53_CPU_PORT)
+		if (reg <= B53_CPU_PORT)
 			pdata->enabled_ports |= BIT(reg);

Should we switch to B53_N_PORTS instead?
That's the bound used by the local "for each port" macro:

#define b53_for_each_port(dev, i) \      
        for (i = 0; i < B53_N_PORTS; i++) \
                if (dev->enabled_ports & BIT(i)) 
#2 lore raw
Quoted 16 lines · Jakub Kicinski

drivers/net/dsa/b53/b53_mmap.c static int b53_mmap_probe_of(struct platform_device *pdev, · line 267

Quoted 11 lines · On Fri, 10 Mar 2023 13:10:59 +0100 Álvaro Fernández Rojas wrote:
drivers/net/dsa/b53/b53_mmap.c +1 -1
index e968322dfbf0..24ea2e19dfa6 100644
@@ -263,7 +263,7 @@ static int b53_mmap_probe_of(struct platform_device *pdev,
  		if (of_property_read_u32(of_port, "reg", &reg))
  			continue;
 
-		if (reg < B53_CPU_PORT)
+		if (reg <= B53_CPU_PORT)
  			pdata->enabled_ports |= BIT(reg);

Should we switch to B53_N_PORTS instead?
That's the bound used by the local "for each port" macro:

Quoted 3 lines
#define b53_for_each_port(dev, i) \
         for (i = 0; i < B53_N_PORTS; i++) \
                 if (dev->enabled_ports & BIT(i))

Yes, checking against B53_N_PORTS would be a better check.

Signature · 1 line
Florian
#3 lore raw

PATCH v2 1/1 net: dsa: b53: mmap: fix device tree support

In reply to Álvaro Fernández Rojas

CPU port should also be enabled in order to get a working switch.

Fixes a5538a777b73 ("net: dsa: b53: mmap: Add device tree support")

---
v2: switch to B53_N_PORTS

 drivers/net/dsa/b53/b53_mmap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/dsa/b53/b53_mmap.c +1 -1
index e968322dfbf0..70887e0aece3 100644
@@ -263,7 +263,7 @@ static int b53_mmap_probe_of(struct platform_device *pdev,
 		if (of_property_read_u32(of_port, "reg", &reg))
 			continue;
 
-		if (reg < B53_CPU_PORT)
+		if (reg < B53_N_PORTS)
 			pdata->enabled_ports |= BIT(reg);
 	}
 
Signature · 1 line
2.30.2
#5 lore raw
In reply to Álvaro Fernández Rojas
This patch was applied to netdev/net.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This patch was applied to netdev/net.git (main)
by Jakub Kicinski <[email protected]>:

Quoted 8 lines · On Thu, 16 Mar 2023 18:28:07 +0100 you wrote:

CPU port should also be enabled in order to get a working switch.

Fixes a5538a777b73 ("net: dsa: b53: mmap: Add device tree support")

---
v2: switch to B53_N_PORTS

[...]

Here is the summary with links:
- [v2] net: dsa: b53: mmap: fix device tree support

    https://git.kernel.org/netdev/net/c/30796d0dcb6e

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html