Skip to contentSkip to conversation

net: cpsw: Fix crashes on beaglebone black

PATCH In review [email protected] 3 participants 3 messages Dec 27, 2014 – Jan 6, 2015 Network drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: cpsw: Fix crashes on beaglebone black

Hello,

The current version (2014.12.0-00116-ge91702b) crashes on the beaglebone black if the ethernet driver is enabled. Here is the trace:

barebox 2014.12.0-00116-ge91702b #15 Sat Dec 27 15:30:25 CET 2014

Board: TI AM335x BeagleBone black
detected 'BeagleBone Black'
cpsw 4a100000.ethernet: detected phy mask 0x1
mdio_bus: miibus0: probed
eth0: got preset MAC address: d0:39:72:41:0a:26 cpsw 4a100000.ethernet: probe failed: I/O error unable to handle paging request at address 0x6e6f62f2

pc : [<9fe24e4a>]    lr : [<9fe0751f>]

sp : 9ffffe60 ip : ffffffff fp : 00000000
r10: 8ff1d8b8 r9 : 8ff12534 r8 : 8ff1d974
r7 : ffffffff r6 : 8ff1d8e0 r5 : 9fe55220 r4 : 6e6f62f2
r3 : 00000000 r2 : 00000000 r1 : 8ff1d8e0 r0 : 6e6f62f2
Flags: nZCV IRQs off FIQs on Mode SVC_32
[<9fe24e4a>] (strcmp+0xc/0x1a) from [<9fe0751f>] (get_device_by_name_id+0x1f/0x38)
[<9fe0751f>] (get_device_by_name_id+0x1f/0x38) from [<9fe07837>] (register_device+0x17/0xc8)
[<9fe07837>] (register_device+0x17/0xc8) from [<9fe1dcb3>] (of_platform_device_create+0x17b/0x1b0)
[<9fe1dcb3>] (of_platform_device_create+0x17b/0x1b0) from [<9fe1dd13>] (of_platform_bus_create+0x2b/0x68)
[<9fe1dd13>] (of_platform_bus_create+0x2b/0x68) from [<9fe1dda7>] (of_platform_populate+0x2f/0x44)
[<9fe1dda7>] (of_platform_populate+0x2f/0x44) from [<9fe07967>] (platform_probe+0x9/0xa)
[<9fe07967>] (platform_probe+0x9/0xa) from [<9fe07561>] (device_probe+0x11/0x44)
[<9fe07561>] (device_probe+0x11/0x44) from [<9fe075bb>] (match.part.2+0x27/0x2e)
[<9fe075bb>] (match.part.2+0x27/0x2e) from [<9fe076d5>] (register_driver+0x59/0x74)
[<9fe076d5>] (register_driver+0x59/0x74) from [<9fe00827>] (start_barebox+0x1b/0xb8)
[<9fe00827>] (start_barebox+0x1b/0xb8) from [<9fe3291f>] (__start+0xa3/0xb8) [<9fe3291f>] (__start+0xa3/0xb8) from [<9fe00005>] (__bare_init_start+0x1/0xc)

[<9fe32349>] (unwind_backtrace+0x1/0x58) from [<9fe258e9>] (panic+0x1d/0x34) [<9fe258e9>] (panic+0x1d/0x34) from [<9fe327e1>] (do_exception+0xd/0x10) [<9fe327e1>] (do_exception+0xd/0x10) from [<9fe32849>] (do_data_abort+0x21/0x2c)
[<9fe32849>] (do_data_abort+0x21/0x2c) from [<9fe32508>] (data_abort+0x48/0x60)

The following patch resolves the problem on my board. Please review it and check if it is fine.

Regards,

---
 drivers/net/cpsw.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/net/cpsw.c +2 -4
index b6618ad..311cd44 100644
@@ -1202,10 +1202,8 @@ int cpsw_probe(struct device_d *dev)
                struct phy_device *phy;
 
                phy = mdiobus_scan(&priv->miibus, priv->slaves[i].phy_id);
-               if (IS_ERR(phy)) {
-                       ret = PTR_ERR(phy);
-                       goto out;
-               }
+               if (IS_ERR(phy))
+                       continue;
 
                phy->dev.device_node = priv->slaves[i].dev.device_node;
                ret = phy_register_device(phy);
Signature · 7 lines
2.1.4


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#1 lore raw

Hello Philippe,

Am Samstag, den 27.12.2014, 15:39 +0100 schrieb [email protected]:

Quoted 44 lines

Hello,

The current version (2014.12.0-00116-ge91702b) crashes on the beaglebone black if the ethernet driver is enabled. Here is the trace:

barebox 2014.12.0-00116-ge91702b #15 Sat Dec 27 15:30:25 CET 2014

Board: TI AM335x BeagleBone black
detected 'BeagleBone Black'
cpsw 4a100000.ethernet: detected phy mask 0x1
mdio_bus: miibus0: probed
eth0: got preset MAC address: d0:39:72:41:0a:26 cpsw 4a100000.ethernet: probe failed: I/O error unable to handle paging request at address 0x6e6f62f2

pc : [<9fe24e4a>]    lr : [<9fe0751f>]

sp : 9ffffe60 ip : ffffffff fp : 00000000
r10: 8ff1d8b8 r9 : 8ff12534 r8 : 8ff1d974
r7 : ffffffff r6 : 8ff1d8e0 r5 : 9fe55220 r4 : 6e6f62f2
r3 : 00000000 r2 : 00000000 r1 : 8ff1d8e0 r0 : 6e6f62f2
Flags: nZCV IRQs off FIQs on Mode SVC_32
[<9fe24e4a>] (strcmp+0xc/0x1a) from [<9fe0751f>] (get_device_by_name_id+0x1f/0x38)
[<9fe0751f>] (get_device_by_name_id+0x1f/0x38) from [<9fe07837>] (register_device+0x17/0xc8)
[<9fe07837>] (register_device+0x17/0xc8) from [<9fe1dcb3>] (of_platform_device_create+0x17b/0x1b0)
[<9fe1dcb3>] (of_platform_device_create+0x17b/0x1b0) from [<9fe1dd13>] (of_platform_bus_create+0x2b/0x68)
[<9fe1dd13>] (of_platform_bus_create+0x2b/0x68) from [<9fe1dda7>] (of_platform_populate+0x2f/0x44)
[<9fe1dda7>] (of_platform_populate+0x2f/0x44) from [<9fe07967>] (platform_probe+0x9/0xa)
[<9fe07967>] (platform_probe+0x9/0xa) from [<9fe07561>] (device_probe+0x11/0x44)
[<9fe07561>] (device_probe+0x11/0x44) from [<9fe075bb>] (match.part.2+0x27/0x2e)
[<9fe075bb>] (match.part.2+0x27/0x2e) from [<9fe076d5>] (register_driver+0x59/0x74)
[<9fe076d5>] (register_driver+0x59/0x74) from [<9fe00827>] (start_barebox+0x1b/0xb8)
[<9fe00827>] (start_barebox+0x1b/0xb8) from [<9fe3291f>] (__start+0xa3/0xb8) [<9fe3291f>] (__start+0xa3/0xb8) from [<9fe00005>] (__bare_init_start+0x1/0xc)

Quoted 8 lines

[<9fe32349>] (unwind_backtrace+0x1/0x58) from [<9fe258e9>] (panic+0x1d/0x34) [<9fe258e9>] (panic+0x1d/0x34) from [<9fe327e1>] (do_exception+0xd/0x10) [<9fe327e1>] (do_exception+0xd/0x10) from [<9fe32849>] (do_data_abort+0x21/0x2c)
[<9fe32849>] (do_data_abort+0x21/0x2c) from [<9fe32508>] (data_abort+0x48/0x60)

I suspect the issue comes from the dummy cpsw_emac1 node which adds a non existing phy in the beaglebone device tree. So the mdiobus_scan fails. This patch will workaround the issue but I'm unsure about right solution here.

Regards,
Teresa

Quoted 19 lines

The following patch resolves the problem on my board. Please review it and check if it is fine.

Regards,

---
 drivers/net/cpsw.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/net/cpsw.c +0 -0
index b6618ad..311cd44 100644
@@ -1202,10 +1202,8 @@ int cpsw_probe(struct device_d *dev)
                struct phy_device *phy;
 

drivers/net/cpsw.c int cpsw_probe(struct device_d *dev) · line 1209

Quoted 10 lines
drivers/net/cpsw.c +2 -4
                phy = mdiobus_scan(&priv->miibus, priv->slaves[i].phy_id);
-               if (IS_ERR(phy)) {
-                       ret = PTR_ERR(phy);
-                       goto out;
-               }
+               if (IS_ERR(phy))
+                       continue;
 
                phy->dev.device_node = priv->slaves[i].dev.device_node;
                ret = phy_register_device(phy);

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox

#2 lore raw
Quoted 12 lines · Teresa Gámez

Hello Philippe,

Quoted 9 lines

[<9fe32349>] (unwind_backtrace+0x1/0x58) from [<9fe258e9>] (panic+0x1d/0x34) [<9fe258e9>] (panic+0x1d/0x34) from [<9fe327e1>] (do_exception+0xd/0x10) [<9fe327e1>] (do_exception+0xd/0x10) from [<9fe32849>] (do_data_abort+0x21/0x2c)
[<9fe32849>] (do_data_abort+0x21/0x2c) from [<9fe32508>] (data_abort+0x48/0x60)

Quoted 4 lines

I suspect the issue comes from the dummy cpsw_emac1 node which adds a non existing phy in the beaglebone device tree. So the mdiobus_scan fails. This patch will workaround the issue but I'm unsure about right solution here.

You are right, this is not the ideal solution. Nevertheless I just sent out a similar patch. It should be good enough for now.

In the longer run the phy shouldn't be probed for in the devices probe function. There also should be a way to disable a slave in the device tree, right now both slaves are defined in the dtsi file and a status = "disabled" is ignored (Does this work in the kernel?).
Also the cpsw driver should accept a proper phy binding. The official agreed-upon binding is phy-handle = <&ethphy>, not phy_id = <&miibus>, <0>. The driver should at least optionally support this.

Sascha

Signature · 9 lines
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox