From 6269556397ed646e9fdcdefa855944fcff0f3608 Mon Sep 17 00:00:00 2001 From: Rouven Czerwinski Date: Wed, 25 Aug 2021 08:55:54 +0200 Subject: net: eqos: let phy_resume handle fixed link phys Currently barebox will try to talk to the phy over mdio, even if the parent is a fixed-link. This will result in the following stacktrace: barebox@Linux Automation Test Automation Controller (TAC):/ dhcp unable to handle NULL pointer dereference at address 0x00000130 pc : [] lr : [] sp : dffefd40 ip : 004c4b40 fp : d00286e0 r10: cf25cc4e r9 : 00000000 r8 : 05f5e100 r7 : 00000130 r6 : 00000000 r5 : 00000000 r4 : 00000130 r3 : 00000109 r2 : 00000000 r1 : 00000000 r0 : 00000130 Flags: nZCv IRQs off FIQs off Mode SVC_32 WARNING: [] (slice_acquire+0xc/0x28) from [] (mdiobus_read+0x13/0x28) WARNING: [] (mdiobus_read+0x13/0x28) from [] (eqos_start+0x85/0x32c) WARNING: [] (eqos_start+0x85/0x32c) from [] (eth_open+0xd/0x24) WARNING: [] (eth_open+0xd/0x24) from [] (dhcp+0xb/0x3a) WARNING: [] (dhcp+0xb/0x3a) from [] (do_dhcp+0xfb/0x114) WARNING: [] (do_dhcp+0xfb/0x114) from [] (execute_command+0x23/0x4c) WARNING: [] (execute_command+0x23/0x4c) from [] (run_list_real+0x5bf/0x638) WARNING: [] (run_list_real+0x5bf/0x638) from [] (parse_stream_outer+0xc7/0x154) WARNING: [] (parse_stream_outer+0xc7/0x154) from [] (run_shell+0x3f/0x6c) WARNING: [] (run_shell+0x3f/0x6c) from [] (run_init+0x191/0x200) WARNING: [] (run_init+0x191/0x200) from [] (start_barebox+0x2b/0x6c) WARNING: [] (start_barebox+0x2b/0x6c) from [] (barebox_non_pbl_start+0x121/0x164) WARNING: [] (barebox_non_pbl_start+0x121/0x164) from [] (__bare_init_start+0x1/0xc) WARNING: [] (unwind_backtrace+0x1/0x78) from [] (panic+0x1d/0x34) WARNING: [] (panic+0x1d/0x34) from [] (do_exception+0xf/0x14) WARNING: [] (do_exception+0xf/0x14) from [] (do_data_abort+0x21/0x34) WARNING: [] (do_data_abort+0x21/0x34) from [] (do_abort_6+0x48/0x54) Simply return with 0 if bus is NULL which indicates that the phy is connected to a fixed link. Signed-off-by: Rouven Czerwinski Link: https://lore.barebox.org/20210825065554.23283-1-r.czerwinski@pengutronix.de Signed-off-by: Sascha Hauer --- drivers/net/designware_eqos.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/net/designware_eqos.c b/drivers/net/designware_eqos.c index f83ec12714..f83e5d6d9b 100644 --- a/drivers/net/designware_eqos.c +++ b/drivers/net/designware_eqos.c @@ -362,6 +362,10 @@ static int phy_resume(struct phy_device *phydev) { int bmcr; + // Bus will be NULL if a fixed-link is used. + if (!phydev->bus) + return 0; + bmcr = phy_read(phydev, MII_BMCR); if (bmcr < 0) return bmcr; -- cgit v1.2.3