[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20241001112512.4861-3-fujita.tomonori@gmail.com>
Date: Tue, 1 Oct 2024 11:25:12 +0000
From: FUJITA Tomonori <fujita.tomonori@...il.com>
To: netdev@...r.kernel.org
Cc: rust-for-linux@...r.kernel.org,
andrew@...n.ch,
hkallweit1@...il.com,
tmgross@...ch.edu,
ojeda@...nel.org,
alex.gaynor@...il.com,
gary@...yguo.net,
bjorn3_gh@...tonmail.com,
benno.lossin@...ton.me,
a.hindborg@...sung.com,
aliceryhl@...gle.com
Subject: [PATCH net-next v1 2/2] net: phy: qt2025: wait until PHY becomes ready
Wait until a PHY becomes ready in the probe callback by using a sleep
function.
Signed-off-by: FUJITA Tomonori <fujita.tomonori@...il.com>
---
drivers/net/phy/qt2025.rs | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/drivers/net/phy/qt2025.rs b/drivers/net/phy/qt2025.rs
index 28d8981f410b..3a8ef9f73642 100644
--- a/drivers/net/phy/qt2025.rs
+++ b/drivers/net/phy/qt2025.rs
@@ -93,8 +93,15 @@ fn probe(dev: &mut phy::Device) -> Result<()> {
// The micro-controller will start running from SRAM.
dev.write(C45::new(Mmd::PCS, 0xe854), 0x0040)?;
- // TODO: sleep here until the hw becomes ready.
- Ok(())
+ // sleep here until the hw becomes ready.
+ for _ in 0..60 {
+ kernel::delay::sleep(core::time::Duration::from_millis(50));
+ let val = dev.read(C45::new(Mmd::PCS, 0xd7fd))?;
+ if val != 0x00 && val != 0x10 {
+ return Ok(());
+ }
+ }
+ Err(code::ENODEV)
}
fn read_status(dev: &mut phy::Device) -> Result<u16> {
--
2.34.1
Powered by blists - more mailing lists