mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Stefan Kerkmann <s.kerkmann@pengutronix.de>
To: Sascha Hauer <s.hauer@pengutronix.de>,
	 BAREBOX <barebox@lists.infradead.org>
Cc: Stefan Kerkmann <s.kerkmann@pengutronix.de>
Subject: [PATCH] net: designware: let phy_resume handle fixed link phys
Date: Thu, 10 Oct 2024 16:23:04 +0200	[thread overview]
Message-ID: <20241010-fix-designware-fixed-link-v1-1-de2df5485a25@pengutronix.de> (raw)

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>




             reply	other threads:[~2024-10-10 14:24 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-10 14:23 Stefan Kerkmann [this message]
2024-10-14 11:14 ` Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20241010-fix-designware-fixed-link-v1-1-de2df5485a25@pengutronix.de \
    --to=s.kerkmann@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=s.hauer@pengutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox