On Tue, Feb 18, 2025 at 07:11:33PM +0800, Binbin Zhou wrote: > According to the chip manual, the I2C register access type of > Loongson-2K2000/LS7A is "B", so we can only access registers in byte > form (readb/writeb). > > Although Loongson-2K0500/Loongson-2K1000 do not have similar > constraints, register accesses in byte form also behave correctly. > > Also, in hardware, the frequency division registers are defined as two > separate registers (high 8-bit and low 8-bit), so we just access them > directly as bytes. ... > /* Calculate and set i2c frequency. */ > - writew(LS2X_I2C_PCLK_FREQ / (5 * t->bus_freq_hz) - 1, > - priv->base + I2C_LS2X_PRER); > + val = LS2X_I2C_PCLK_FREQ / (5 * t->bus_freq_hz) - 1; > + writeb(FIELD_GET(GENMASK(7, 0), val), priv->base + I2C_LS2X_PRER_LO); > + writeb(FIELD_GET(GENMASK(15, 8), val), priv->base + I2C_LS2X_PRER_HI); Now this needs a comment to prevent from appearing a patch that basically changes that back to 16-bit write. -- With Best Regards, Andy Shevchenko