On Wed, Feb 19, 2025 at 4:08 AM Binbin Zhou zhoubinbin@loongson.cn 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).
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.
Reviewed-by: Andy Shevchenko andy@kernel.org
...
/*
* According to the chip manual, we can only access the registers as bytes,
* otherwise the high bits will be truncated.
* So set the I2C frequency with a sequential writeb instead of writew.
writeb() writew()
*/