Skip to contentSkip to conversation

designware_i2c: disable i2c controller during target address setup

PATCH In review Alexey Brodkin 3 participants 4 messages Nov 7, 2013 – Nov 13, 2013 1 message not in the archive I2C

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 designware_i2c: disable i2c controller during target address setup

As it is stated in DesignWare I2C databook: writes to IC_TAR (0x4) register succeed only when IC_ENABLE[0] is set to 0.

Cc Tom Rini <[email protected]>
cc Armando Visconti <[email protected]>
Cc Stefan Roese <[email protected]>
Cc Albert ARIBAUD <[email protected]>
Cc Heiko Schocher <[email protected]>
Cc Vipin KUMAR <[email protected]>
Cc Tom Rix <[email protected]>
Cc Mischa Jonker <[email protected]>
---
 drivers/i2c/designware_i2c.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)
drivers/i2c/designware_i2c.c +12 -0
index c2f0662..c5c6015 100644
@@ -151,7 +151,19 @@ void i2c_init(int speed, int slaveadd)
  */
 static void i2c_setaddress(unsigned int i2c_addr)
 {
+	unsigned int enbl;
+
+	/* Disable i2c */
+	enbl = readl(&i2c_regs_p->ic_enable);
+	enbl &= ~IC_ENABLE_0B;
+	writel(enbl, &i2c_regs_p->ic_enable);
+
 	writel(i2c_addr, &i2c_regs_p->ic_tar);
+
+	/* Enable i2c */
+	enbl = readl(&i2c_regs_p->ic_enable);
+	enbl |= IC_ENABLE_0B;
+	writel(enbl, &i2c_regs_p->ic_enable);
 }
 
 /*
Signature · 1 line
1.8.4.2
#1 lore raw

PATCH 1/1 designware_i2c: disable i2c controller during target address setup

Hi Alexey,

Quoted 13 lines · Alexey Brodkin

As it is stated in DesignWare I2C databook: writes to IC_TAR (0x4) register succeed only when IC_ENABLE[0] is set to 0.

Cc Tom Rini <[email protected]>
cc Armando Visconti <[email protected]>
Cc Stefan Roese <[email protected]>
Cc Albert ARIBAUD <[email protected]>
Cc Heiko Schocher <[email protected]>
Cc Vipin KUMAR <[email protected]>
Cc Tom Rix <[email protected]>
Cc Mischa Jonker <[email protected]>
Quoted 1 line

---

/me wonders what made this patch Cc: me. Is it ARM-related in some way?

Amicalement,

Signature · 1 line
Albert.

A message that is not in the archive (sent off-list or not yet received): [email protected]

#3 lore raw

PATCH 1/1 designware_i2c: disable i2c controller during target address setup

Hi Alexey,

Quoted 10 lines · Alexey Brodkin
Quoted 8 lines · Albert ARIBAUD

Hi Alexey,

On Thu, 7 Nov 2013 17:52:18 +0400, Alexey Brodkin <[email protected]> wrote:

/me wonders what made this patch Cc: me. Is it ARM-related in some way?

Amicalement,

Quoted 8 lines

Hi Albert,

I noticed that you were a committer of 496ba48f5ec60187d9ff7e4298e3d37677d74530 "i2c: designware_i2c.c: Add support for the "i2c probe" command".

So I concluded that you might be interested in this driver and thus may want to be in the loop.

Thanks, that explains it -- although I don't remember why this one went through me, but then, that is /my/ problem. :)

Quoted 1 line

-Alexey

Amicalement,

Signature · 1 line
Albert.
#4 lore raw
In reply to Alexey Brodkin

Hello Alexey,

Am 07.11.2013 14:52, schrieb Alexey Brodkin:

Quoted 14 lines

As it is stated in DesignWare I2C databook: writes to IC_TAR (0x4) register succeed only when IC_ENABLE[0] is set to 0.

Cc Tom Rini<[email protected]>
cc Armando Visconti<[email protected]>
Cc Stefan Roese<[email protected]>
Cc Albert ARIBAUD<[email protected]>
Cc Heiko Schocher<[email protected]>
Cc Vipin KUMAR<[email protected]>
Cc Tom Rix<[email protected]>
Cc Mischa Jonker<[email protected]>
Quoted 3 lines

---
drivers/i2c/designware_i2c.c | 12 ++++++++++++

  1 file changed, 12 insertions(+)

Thanks!

Applied to u-boot-i2c.git

bye,
Heiko

Signature · 2 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany