Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

i2c: exynos5: Preserve high speed master code

When the driver starts to send a message with the MASTER_ID field
set (high speed), the whole I2C_ADDR register is overwritten including
MASTER_ID as the SLV_ADDR_MAS field is set.

This patch preserves already written fields in I2C_ADDR when writing
SLV_ADDR_MAS.

Fixes: 8a73cd4cfa15 ("i2c: exynos5: add High Speed I2C controller driver")
Signed-off-by: Mårten Lindahl <martenli@axis.com>
Reviewed-by: Krzysztof Kozlowski <krzk@kernel.org>
Tested-by: Krzysztof Kozlowski <krzk@kernel.org>
Signed-off-by: Wolfram Sang <wsa@kernel.org>

authored by

Mårten Lindahl and committed by
Wolfram Sang
f4ff0104 e87cc183

+7 -1
+7 -1
drivers/i2c/busses/i2c-exynos5.c
··· 606 606 u32 i2c_ctl; 607 607 u32 int_en = 0; 608 608 u32 i2c_auto_conf = 0; 609 + u32 i2c_addr = 0; 609 610 u32 fifo_ctl; 610 611 unsigned long flags; 611 612 unsigned short trig_lvl; ··· 641 640 int_en |= HSI2C_INT_TX_ALMOSTEMPTY_EN; 642 641 } 643 642 644 - writel(HSI2C_SLV_ADDR_MAS(i2c->msg->addr), i2c->regs + HSI2C_ADDR); 643 + i2c_addr = HSI2C_SLV_ADDR_MAS(i2c->msg->addr); 644 + 645 + if (i2c->op_clock >= I2C_MAX_FAST_MODE_PLUS_FREQ) 646 + i2c_addr |= HSI2C_MASTER_ID(MASTER_ID(i2c->adap.nr)); 647 + 648 + writel(i2c_addr, i2c->regs + HSI2C_ADDR); 645 649 646 650 writel(fifo_ctl, i2c->regs + HSI2C_FIFO_CTL); 647 651 writel(i2c_ctl, i2c->regs + HSI2C_CTL);