Hi Linus > +static int realtek_smi_read_reg(struct realtek_smi *smi, u32 addr, u32 *data) > +{ > + unsigned long flags; > + u8 lo = 0; > + u8 hi = 0; > + int ret; > + > + spin_lock_irqsave(&smi->lock, flags); > + > + realtek_smi_start(smi); > + > + /* send READ command */ > + ret = realtek_smi_write_byte(smi, smi->cmd_read); > + if (ret) > + goto out; > + > + /* set ADDR[7:0] */ > + ret = realtek_smi_write_byte(smi, addr & 0xff); > + if (ret) > + goto out; > + > + /* set ADDR[15:8] */ > + ret = realtek_smi_write_byte(smi, addr >> 8); > + if (ret) > + goto out; > + > + /* read DATA[7:0] */ > + realtek_smi_read_byte0(smi, &lo); > + /* read DATA[15:8] */ > + realtek_smi_read_byte1(smi, &hi); > + > + *data = ((u32) lo) | (((u32) hi) << 8);
If i'm reading this correct, addr is a u16 and data is also u16? So it is pretty similar to SMI. I'm wondering if this should be modelled as a normal MDIO bus? Put the driver as drivers/net/mdio-realtek.c? I need to study the rest of the code to see if this is a good idea or not. Andrew