提交 215f170d 编写于 作者: T Tyrone Ting 提交者: Zheng Zengkai

i2c: npcm: Correct register access width

stable inclusion
from stable-v5.10.121
commit 5c0dfca6b9ccfa5d86c031645f7fecb322db11eb
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I5L6CQ

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=5c0dfca6b9ccfa5d86c031645f7fecb322db11eb

--------------------------------

[ Upstream commit ea9f8426 ]

The SMBnCTL3 register is 8-bit wide and the 32-bit access was always
incorrect, but simply didn't cause a visible error on the 32-bit machine.

On the 64-bit machine, the kernel message reports that ESR value is
0x96000021. Checking Arm Architecture Reference Manual Armv8 suggests that
it's the alignment fault.

SMBnCTL3's address is 0xE.

Fixes: 56a1485b ("i2c: npcm7xx: Add Nuvoton NPCM I2C controller driver")
Signed-off-by: NTyrone Ting <kfting@nuvoton.com>
Reviewed-by: NJonathan Neuschäfer <j.neuschaefer@gmx.net>
Signed-off-by: NWolfram Sang <wsa@kernel.org>
Signed-off-by: NSasha Levin <sashal@kernel.org>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
Acked-by: NXie XiuQi <xiexiuqi@huawei.com>
上级 57ceea20
...@@ -359,14 +359,14 @@ static int npcm_i2c_get_SCL(struct i2c_adapter *_adap) ...@@ -359,14 +359,14 @@ static int npcm_i2c_get_SCL(struct i2c_adapter *_adap)
{ {
struct npcm_i2c *bus = container_of(_adap, struct npcm_i2c, adap); struct npcm_i2c *bus = container_of(_adap, struct npcm_i2c, adap);
return !!(I2CCTL3_SCL_LVL & ioread32(bus->reg + NPCM_I2CCTL3)); return !!(I2CCTL3_SCL_LVL & ioread8(bus->reg + NPCM_I2CCTL3));
} }
static int npcm_i2c_get_SDA(struct i2c_adapter *_adap) static int npcm_i2c_get_SDA(struct i2c_adapter *_adap)
{ {
struct npcm_i2c *bus = container_of(_adap, struct npcm_i2c, adap); struct npcm_i2c *bus = container_of(_adap, struct npcm_i2c, adap);
return !!(I2CCTL3_SDA_LVL & ioread32(bus->reg + NPCM_I2CCTL3)); return !!(I2CCTL3_SDA_LVL & ioread8(bus->reg + NPCM_I2CCTL3));
} }
static inline u16 npcm_i2c_get_index(struct npcm_i2c *bus) static inline u16 npcm_i2c_get_index(struct npcm_i2c *bus)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册