* SMDK6440: I2C writes fails
@ 2010-06-23 5:45 Naveen Krishna Ch
2010-06-24 11:32 ` Mark Brown
0 siblings, 1 reply; 6+ messages in thread
From: Naveen Krishna Ch @ 2010-06-23 5:45 UTC (permalink / raw)
To: Mark Brown; +Cc: linux-samsung-soc, Ben Dooks
Hi Mark,
I was adding I2C support on SMDK6440 and found this removing the 1ms delay
is causing I2C write and reads to fail..
http://www.mail-archive.com/linux-i2c@vger.kernel.org/msg03070.html
[root@Samsung mars]# date | ./eeprog /dev/i2c-0 0x50 -w 0x200 -f
eeprog 0.7.6, a 24Cxx EEPROM reader/writer
Copyright (c) 2003-2004 by Stefano Barbato - All rights reserved.
Bus: /dev/i2c-0, Address: 0x50, Mode: 8bit
Writing stdin starting at address 0x200
..Error i2c_write_2b: No such device or address
Error at line 150: write error
[root@Samsung mars]#
Where should i be looking,
Will changing the spin counts work?
Can you please help me with this.
--
Shine bright,
(: Naveen Krishna Ch :)
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: SMDK6440: I2C writes fails
2010-06-23 5:45 SMDK6440: I2C writes fails Naveen Krishna Ch
@ 2010-06-24 11:32 ` Mark Brown
2010-06-24 12:35 ` Naveen Krishna Ch
0 siblings, 1 reply; 6+ messages in thread
From: Mark Brown @ 2010-06-24 11:32 UTC (permalink / raw)
To: Naveen Krishna Ch; +Cc: linux-samsung-soc, Ben Dooks
On Wed, Jun 23, 2010 at 11:15:55AM +0530, Naveen Krishna Ch wrote:
> Where should i be looking,
I would suggest looking at the driver and comparing it with the
datasheet.
> Will changing the spin counts work?
I'd expect this to be unlikely. Note that if we run out of spins we
still go for the 1ms sleep that was being used originally so it's more
likely that there's a bug in the chip when that register is being read
(though this would be surprising) or some other change in your kernel is
causing problems.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: SMDK6440: I2C writes fails
2010-06-24 11:32 ` Mark Brown
@ 2010-06-24 12:35 ` Naveen Krishna Ch
2010-06-24 16:35 ` Mark Brown
0 siblings, 1 reply; 6+ messages in thread
From: Naveen Krishna Ch @ 2010-06-24 12:35 UTC (permalink / raw)
To: Mark Brown; +Cc: linux-samsung-soc, Ben Dooks
Hi Mark,
On 24 June 2010 17:02, Mark Brown <broonie@opensource.wolfsonmicro.com> wrote:
>
> On Wed, Jun 23, 2010 at 11:15:55AM +0530, Naveen Krishna Ch wrote:
>
> > Where should i be looking,
>
> I would suggest looking at the driver and comparing it with the
> datasheet.
>
> > Will changing the spin counts work?
>
> I'd expect this to be unlikely. Note that if we run out of spins we
> still go for the 1ms sleep that was being used originally so it's more
> likely that there's a bug in the chip when that register is being read
> (though this would be surprising) or some other change in your kernel is
> causing problems.
--- a/drivers/i2c/busses/i2c-s3c2410.c
+++ b/drivers/i2c/busses/i2c-s3c2410.c
@@ -527,7 +527,7 @@ static int s3c24xx_i2c_doxfer(struct s3c24xx_i2c *i2c,
/* first, try busy waiting briefly */
do {
iicstat = readl(i2c->regs + S3C2410_IICSTAT);
- } while ((iicstat & S3C2410_IICSTAT_START) && --spins);
+ } while (--spins && (iicstat & S3C2410_IICSTAT_START));
/* if that timed out sleep */
if (!spins) {
Does the trick..
--
Shine bright,
(: Naveen Krishna Ch :)
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: SMDK6440: I2C writes fails
2010-06-24 12:35 ` Naveen Krishna Ch
@ 2010-06-24 16:35 ` Mark Brown
2010-06-28 5:54 ` Naveen Krishna Ch
[not found] ` <AANLkTikPNJXmcdGxAutoScAnrgvowKE9ChsOaOGQM9sC@mail.gmail.com>
0 siblings, 2 replies; 6+ messages in thread
From: Mark Brown @ 2010-06-24 16:35 UTC (permalink / raw)
To: Naveen Krishna Ch; +Cc: linux-samsung-soc@vger.kernel.org, Ben Dooks
On 24 Jun 2010, at 13:35, Naveen Krishna Ch <naveenkrishna.ch@gmail.com> wrote:
> Hi Mark,
>
> On 24 June 2010 17:02, Mark Brown <broonie@opensource.wolfsonmicro.com> wrote:
>>
>> On Wed, Jun 23, 2010 at 11:15:55AM +0530, Naveen Krishna Ch wrote:
>>
>>> Where should i be looking,
>>
>> I would suggest looking at the driver and comparing it with the
>> datasheet.
>>
>>> Will changing the spin counts work?
>>
>> I'd expect this to be unlikely. Note that if we run out of spins we
>> still go for the 1ms sleep that was being used originally so it's more
>> likely that there's a bug in the chip when that register is being read
>> (though this would be surprising) or some other change in your kernel is
>> causing problems.
>
> --- a/drivers/i2c/busses/i2c-s3c2410.c
> +++ b/drivers/i2c/busses/i2c-s3c2410.c
> @@ -527,7 +527,7 @@ static int s3c24xx_i2c_doxfer(struct s3c24xx_i2c *i2c,
> /* first, try busy waiting briefly */
> do {
> iicstat = readl(i2c->regs + S3C2410_IICSTAT);
> - } while ((iicstat & S3C2410_IICSTAT_START) && --spins);
> + } while (--spins && (iicstat & S3C2410_IICSTAT_START));
>
> /* if that timed out sleep */
> if (!spins) {
>
> Does the trick..
That smells rather like a compiler bug to me - the two versions
ought to be equivalent apart from the ordering of the comparisons.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: SMDK6440: I2C writes fails
2010-06-24 16:35 ` Mark Brown
@ 2010-06-28 5:54 ` Naveen Krishna Ch
[not found] ` <AANLkTikPNJXmcdGxAutoScAnrgvowKE9ChsOaOGQM9sC@mail.gmail.com>
1 sibling, 0 replies; 6+ messages in thread
From: Naveen Krishna Ch @ 2010-06-28 5:54 UTC (permalink / raw)
To: Mark Brown; +Cc: linux-samsung-soc@vger.kernel.org, Ben Dooks
Hi Mark,
On 24 June 2010 22:05, Mark Brown <broonie@opensource.wolfsonmicro.com> wrote:
>
> On 24 Jun 2010, at 13:35, Naveen Krishna Ch <naveenkrishna.ch@gmail.com> wrote:
>
> > Hi Mark,
> >
> > On 24 June 2010 17:02, Mark Brown <broonie@opensource.wolfsonmicro.com> wrote:
> >>
> >> On Wed, Jun 23, 2010 at 11:15:55AM +0530, Naveen Krishna Ch wrote:
> >>
> >>> Where should i be looking,
> >>
> >> I would suggest looking at the driver and comparing it with the
> >> datasheet.
> >>
> >>> Will changing the spin counts work?
> >>
> >> I'd expect this to be unlikely. Note that if we run out of spins we
> >> still go for the 1ms sleep that was being used originally so it's more
> >> likely that there's a bug in the chip when that register is being read
> >> (though this would be surprising) or some other change in your kernel is
> >> causing problems.
> >
> > --- a/drivers/i2c/busses/i2c-s3c2410.c
> > +++ b/drivers/i2c/busses/i2c-s3c2410.c
> > @@ -527,7 +527,7 @@ static int s3c24xx_i2c_doxfer(struct s3c24xx_i2c *i2c,
> > /* first, try busy waiting briefly */
> > do {
> > iicstat = readl(i2c->regs + S3C2410_IICSTAT);
> > - } while ((iicstat & S3C2410_IICSTAT_START) && --spins);
> > + } while (--spins && (iicstat & S3C2410_IICSTAT_START));
> >
> > /* if that timed out sleep */
> > if (!spins) {
> >
> > Does the trick..
>
> That smells rather like a compiler bug to me - the two versions
> ought to be equivalent apart from the ordering of the comparisons.
I'm not sure, I'm using arm-2009q3 toolchain.
--
Shine bright,
(: Naveen Krishna Ch :)
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: SMDK6440: I2C writes fails
[not found] ` <AANLkTikPNJXmcdGxAutoScAnrgvowKE9ChsOaOGQM9sC@mail.gmail.com>
@ 2010-06-28 14:17 ` Mark Brown
0 siblings, 0 replies; 6+ messages in thread
From: Mark Brown @ 2010-06-28 14:17 UTC (permalink / raw)
To: Naveen Krishna Ch; +Cc: linux-samsung-soc@vger.kernel.org, Ben Dooks
On Mon, Jun 28, 2010 at 10:53:18AM +0530, Naveen Krishna Ch wrote:
> On 24 June 2010 22:05, Mark Brown <broonie@opensource.wolfsonmicro.com>wrote:
> > That smells rather like a compiler bug to me - the two versions
> > ought to be equivalent apart from the ordering of the comparisons.
> I'm not sure, I'm using arm-2009q3 toolchain.
I don't see any reason to suspect that a particular codesourcery code
drop from last year would be compltely bug free?
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2010-06-28 14:17 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-06-23 5:45 SMDK6440: I2C writes fails Naveen Krishna Ch
2010-06-24 11:32 ` Mark Brown
2010-06-24 12:35 ` Naveen Krishna Ch
2010-06-24 16:35 ` Mark Brown
2010-06-28 5:54 ` Naveen Krishna Ch
[not found] ` <AANLkTikPNJXmcdGxAutoScAnrgvowKE9ChsOaOGQM9sC@mail.gmail.com>
2010-06-28 14:17 ` Mark Brown
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.