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

From: Andrew Lunn

Date: Mon Feb 23 2026 - 19:37:49 EST


> + 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