mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] net: designware: let phy_resume handle fixed link phys
@ 2024-10-10 14:23 Stefan Kerkmann
  2024-10-14 11:14 ` Sascha Hauer
  0 siblings, 1 reply; 2+ messages in thread
From: Stefan Kerkmann @ 2024-10-10 14:23 UTC (permalink / raw)
  To: Sascha Hauer, BAREBOX; +Cc: Stefan Kerkmann

This applies the same handling of fixed-link phys to the designware
driver as Rouven Czerwinski already did in commit
`6269556397ed646e9fdcdefa855944fcff0f3608 (net: eqos: let phy_resume
handle fixed link phys)`.

Without this change the driver segfaults on the socfpga platform if
there is no mdio bus attached, as it is the case in a fixed-link setup:

unable to handle NULL pointer dereference at address 0x00000140
pc : [<1fd026ae>]    lr : [<1fd026a7>]
sp : 1fff7e50  ip : 0be53f7a  fp : 00000000
r10: 0ffb6288  r9 : ff703000  r8 : 0fea5af0
r7 : 00000140  r6 : 00000000  r5 : 00000001  r4 : 00000140
r3 : 1fd026a7  r2 : 1fe462c8  r1 : 07e80000  r0 : 00000140
Flags: Nzcv  IRQs off  FIQs off  Mode SVC_32
[<1fd026ae>] (__slice_acquire+0x12/0x40) from [<1fd1cec7>] (mdiobus_read+0x13/0x2e)
[<1fd1cec7>] (mdiobus_read+0x13/0x2e) from [<1fd1d637>] (dwc_ether_open+0xaf/0x378)
[<1fd1d637>] (dwc_ether_open+0xaf/0x378) from [<1fd4f543>] (eth_open+0x2b/0x40)
[<1fd4f543>] (eth_open+0x2b/0x40) from [<1fd4f5c7>] (eth_open_all+0x47/0x5c)
[<1fd4f5c7>] (eth_open_all+0x47/0x5c) from [<1fd019a9>] (run_init+0xfd/0x264)
[<1fd019a9>] (run_init+0xfd/0x264) from [<1fd01b5d>] (start_barebox+0x4d/0xc8)
[<1fd01b5d>] (start_barebox+0x4d/0xc8) from [<1fd62c89>] (barebox_non_pbl_start+0xc1/0xe8)
[<1fd62c89>] (barebox_non_pbl_start+0xc1/0xe8) from [<1fd00005>] (__bare_init_start+0x1/0xc)

Signed-off-by: Stefan Kerkmann <s.kerkmann@pengutronix.de>
---
This applies the same handling of fixed-link phys to the designware
driver as Rouven Czerwinski already did in commit
`6269556397ed646e9fdcdefa855944fcff0f3608 (net: eqos: let phy_resume
handle fixed link phys)`.
---
 drivers/net/designware.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/net/designware.c b/drivers/net/designware.c
index 66f28b429d..706987675c 100644
--- a/drivers/net/designware.c
+++ b/drivers/net/designware.c
@@ -181,6 +181,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;

---
base-commit: 5a2866973d386ffe9b9f5c429a0cbcd58bcef69c
change-id: 20241010-fix-designware-fixed-link-5b40650ae5fe

Best regards,
-- 
Stefan Kerkmann <s.kerkmann@pengutronix.de>




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

end of thread, other threads:[~2024-10-14 13:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-10-10 14:23 [PATCH] net: designware: let phy_resume handle fixed link phys Stefan Kerkmann
2024-10-14 11:14 ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox