public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] designware_i2c: disable i2c controller during target address setup
@ 2013-11-07 13:52 Alexey Brodkin
  2013-11-07 17:24 ` Albert ARIBAUD
  2013-11-13  6:38 ` [U-Boot] " Heiko Schocher
  0 siblings, 2 replies; 4+ messages in thread
From: Alexey Brodkin @ 2013-11-07 13:52 UTC (permalink / raw)
  To: u-boot

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

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>

Cc: Tom Rini <trini@ti.com>
cc: Armando Visconti <armando.visconti@st.com>
Cc: Stefan Roese <sr@denx.de>
Cc: Albert ARIBAUD <albert.u.boot@aribaud.net>
Cc: Heiko Schocher <hs@denx.de>
Cc: Vipin KUMAR <vipin.kumar@st.com>
Cc: Tom Rix <Tom.Rix@windriver.com>
Cc: Mischa Jonker <mjonker@synopsys.com>
---
 drivers/i2c/designware_i2c.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/drivers/i2c/designware_i2c.c b/drivers/i2c/designware_i2c.c
index c2f0662..c5c6015 100644
--- a/drivers/i2c/designware_i2c.c
+++ b/drivers/i2c/designware_i2c.c
@@ -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);
 }
 
 /*
-- 
1.8.4.2

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [U-Boot] [PATCH] designware_i2c: disable i2c controller during target address setup
  2013-11-07 13:52 [U-Boot] [PATCH] designware_i2c: disable i2c controller during target address setup Alexey Brodkin
@ 2013-11-07 17:24 ` Albert ARIBAUD
       [not found]   ` <1383845539.2186.25.camel@abrodkin-8560l.internal.synopsys.com>
  2013-11-13  6:38 ` [U-Boot] " Heiko Schocher
  1 sibling, 1 reply; 4+ messages in thread
From: Albert ARIBAUD @ 2013-11-07 17:24 UTC (permalink / raw)
  To: u-boot

Hi Alexey,

On Thu,  7 Nov 2013 17:52:18 +0400, Alexey Brodkin
<Alexey.Brodkin@synopsys.com> wrote:

> As it is stated in DesignWare I2C databook: writes to IC_TAR (0x4)
> register succeed only when IC_ENABLE[0] is set to 0.
> 
> Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
> 
> Cc: Tom Rini <trini@ti.com>
> cc: Armando Visconti <armando.visconti@st.com>
> Cc: Stefan Roese <sr@denx.de>
> Cc: Albert ARIBAUD <albert.u.boot@aribaud.net>
> Cc: Heiko Schocher <hs@denx.de>
> Cc: Vipin KUMAR <vipin.kumar@st.com>
> Cc: Tom Rix <Tom.Rix@windriver.com>
> Cc: Mischa Jonker <mjonker@synopsys.com>
> ---

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

Amicalement,
-- 
Albert.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [U-Boot] [PATCH] designware_i2c: disable i2c controller during target address setup
       [not found]   ` <1383845539.2186.25.camel@abrodkin-8560l.internal.synopsys.com>
@ 2013-11-08 12:10     ` Albert ARIBAUD
  0 siblings, 0 replies; 4+ messages in thread
From: Albert ARIBAUD @ 2013-11-08 12:10 UTC (permalink / raw)
  To: u-boot

Hi Alexey,

On Thu, 7 Nov 2013 17:32:19 +0000, Alexey Brodkin
<Alexey.Brodkin@synopsys.com> wrote:

> On Thu, 2013-11-07 at 18:24 +0100, Albert ARIBAUD wrote:
> > Hi Alexey,
> > 
> > On Thu,  7 Nov 2013 17:52:18 +0400, Alexey Brodkin
> > <Alexey.Brodkin@synopsys.com> wrote:
> > 
> > /me wonders what made this patch Cc: me. Is it ARM-related in some way?
> > 
> > Amicalement,
> 
> 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. :)

> -Alexey

Amicalement,
-- 
Albert.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [U-Boot] designware_i2c: disable i2c controller during target address setup
  2013-11-07 13:52 [U-Boot] [PATCH] designware_i2c: disable i2c controller during target address setup Alexey Brodkin
  2013-11-07 17:24 ` Albert ARIBAUD
@ 2013-11-13  6:38 ` Heiko Schocher
  1 sibling, 0 replies; 4+ messages in thread
From: Heiko Schocher @ 2013-11-13  6:38 UTC (permalink / raw)
  To: u-boot

Hello Alexey,

Am 07.11.2013 14:52, schrieb 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.
>
> Signed-off-by: Alexey Brodkin<abrodkin@synopsys.com>
>
> Cc: Tom Rini<trini@ti.com>
> cc: Armando Visconti<armando.visconti@st.com>
> Cc: Stefan Roese<sr@denx.de>
> Cc: Albert ARIBAUD<albert.u.boot@aribaud.net>
> Cc: Heiko Schocher<hs@denx.de>
> Cc: Vipin KUMAR<vipin.kumar@st.com>
> Cc: Tom Rix<Tom.Rix@windriver.com>
> Cc: Mischa Jonker<mjonker@synopsys.com>
>
> ---
> drivers/i2c/designware_i2c.c | 12 ++++++++++++
>   1 file changed, 12 insertions(+)

Thanks!

Applied to u-boot-i2c.git

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-11-13  6:38 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-07 13:52 [U-Boot] [PATCH] designware_i2c: disable i2c controller during target address setup Alexey Brodkin
2013-11-07 17:24 ` Albert ARIBAUD
     [not found]   ` <1383845539.2186.25.camel@abrodkin-8560l.internal.synopsys.com>
2013-11-08 12:10     ` Albert ARIBAUD
2013-11-13  6:38 ` [U-Boot] " Heiko Schocher

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox