Skip to contentSkip to conversation

i2c: exynos5: Preserve high speed master code

PATCH Applied Mårten Lindahl 3 participants 5 messages Feb 16, 2021 – Feb 26, 2021

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 i2c: exynos5: Preserve high speed master code

From: Mårten Lindahl <[email protected]>

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.

---
v2:
- Change commit message as the problem is not in the controller but in the driver.
- Use MASTER_ID macro instead of reading back register contents.

 drivers/i2c/busses/i2c-exynos5.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/i2c/busses/i2c-exynos5.c +7 -1
index 20a9881a0d6c..5ac30d95650c 100644
@@ -606,6 +606,7 @@ static void exynos5_i2c_message_start(struct exynos5_i2c *i2c, int stop)
 	u32 i2c_ctl;
 	u32 int_en = 0;
 	u32 i2c_auto_conf = 0;
+	u32 i2c_addr = 0;
 	u32 fifo_ctl;
 	unsigned long flags;
 	unsigned short trig_lvl;
@@ -640,7 +641,12 @@ static void exynos5_i2c_message_start(struct exynos5_i2c *i2c, int stop)
 		int_en |= HSI2C_INT_TX_ALMOSTEMPTY_EN;
 	}
 
-	writel(HSI2C_SLV_ADDR_MAS(i2c->msg->addr), i2c->regs + HSI2C_ADDR);
+	i2c_addr = HSI2C_SLV_ADDR_MAS(i2c->msg->addr);
+
+	if (i2c->op_clock >= I2C_MAX_FAST_MODE_PLUS_FREQ)
+		i2c_addr |= HSI2C_MASTER_ID(MASTER_ID(i2c->adap.nr));
+
+	writel(i2c_addr, i2c->regs + HSI2C_ADDR);
 
 	writel(fifo_ctl, i2c->regs + HSI2C_FIFO_CTL);
 	writel(i2c_ctl, i2c->regs + HSI2C_CTL);
Signature · 1 line
2.11.0
maintainer Reviewed-by Tested-by on v2 1/1
#1 lore raw
Quoted 10 lines · Mårten Lindahl

From: Mårten Lindahl <[email protected]>

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.

Quoted 9 lines

---
v2:
- Change commit message as the problem is not in the controller but in the driver.
- Use MASTER_ID macro instead of reading back register contents.

 drivers/i2c/busses/i2c-exynos5.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

Best regards,
Krzysztof

#2 lore raw
In reply to Mårten Lindahl
Quoted 10 lines · Mårten Lindahl

From: Mårten Lindahl <[email protected]>

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.

Looks good. Is there a Fixes-tag we could apply?

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

#3 lore raw
Quoted 8 lines · Wolfram Sang
Quoted 6 lines · Mårten Lindahl

From: Mårten Lindahl <[email protected]>

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.

Quoted 6 lines
Quoted 4 lines

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

Looks good. Is there a Fixes-tag we could apply?

The first commit, 2013 :)

Fixes 8a73cd4cfa15 ("i2c: exynos5: add High Speed I2C controller driver")

Best regards,
Krzysztof

Applied
#4 lore raw
Quoted 12 lines · Krzysztof Kozlowski
Quoted 11 lines · Wolfram Sang
Quoted 9 lines · Mårten Lindahl

From: Mårten Lindahl <[email protected]>

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.

Quoted 6 lines
Quoted 3 lines
Quoted 1 line

Looks good. Is there a Fixes-tag we could apply?

The first commit, 2013 :)

Fixes 8a73cd4cfa15 ("i2c: exynos5: add High Speed I2C controller driver")

Thanks! Applied to for-current.