Thread (20 messages) 20 messages, 3 authors, 2026-02-24

Re: [PATCH net-next 2/2] net: phy: add Rust reference driver for ET1011C

From: Andrew Lunn <andrew@lunn.ch>
Date: 2026-02-24 00:37:25
Also in: lkml, rust-for-linux

+    fn read_status(dev: &mut phy::Device) -> Result<u16> {
+        dev.genphy_read_status::<C22>()?;
+
+        let val = dev.read(ET1011C_STATUS_REG)?;
+        if (val & ET1011C_SPEED_MASK) == ET1011C_GIGABIT_SPEED {
+            let cfg = dev.read(ET1011C_CONFIG_REG)?;
+            let cfg = cfg & !ET1011C_TX_FIFO_MASK;
+            dev.write(
+                ET1011C_CONFIG_REG,
+                cfg | ET1011C_GMII_INTERFACE | ET1011C_SYS_CLK_EN | ET1011C_TX_FIFO_DEPTH_16,
+            )?;
+        }
This is not the same as the C code. read_status() will be called once
per second. The C code only does the read/modify/write when the speed
reported by genphy_read_status() is different to the previous
value. This code appears to do it every second.

       Andrew
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help