From: Igor Grinberg <grinberg-UTxiZqZC01RS1MOuV/RT9w@public.gmane.org>
To: Haojian Zhuang <haojian.zhuang-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: Sebastian Andrzej Siewior
<bigeasy-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org>,
eric.y.miao-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org,
sodaville-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org,
linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
ben-linux-elnMNo+KYs3YtjvyW6yDsg@public.gmane.org,
Dirk Brandewie
<dirk.brandewie-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
linux-lFZ/pmaqli7XmaaqVzeoHQ@public.gmane.org,
tglx-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org
Subject: Re: [PATCH 6/7] i2c/pxa2xx: reset the chip if the bus is not free
Date: Thu, 25 Nov 2010 08:43:48 +0200 [thread overview]
Message-ID: <4CEE05A4.6030201@compulab.co.il> (raw)
In-Reply-To: <AANLkTi=8Xy3M7QGO54nt_r0_12z3+o8G5fAqQmxkTH4o-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
Hi,
On 11/25/10 04:49, Haojian Zhuang wrote:
> On Thu, Nov 25, 2010 at 10:30 AM, Haojian Zhuang
> <haojian.zhuang-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>> On Thu, Nov 25, 2010 at 5:20 AM, Sebastian Andrzej Siewior
>> <bigeasy-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org> wrote:
>>> I haven't seen this (yet) during a normal transfer but starting
>>> i2cdetect seems to hang the bus. On my Sodaville board, i2cdetect runs
>>> fine on bus zero and runs into timeouts on bus one and two. The chip
>>> never recovers from this condition. The following transfers hang as
>>> well. The ISR_UB never disappears.
>>> Issuing a chip reset fixes the timeout and following transfer succeed.
>>>
>>> Signed-off-by: Sebastian Andrzej Siewior <bigeasy-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org>
>>> Signed-off-by: Dirk Brandewie <dirk.brandewie-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
>>> ---
>>> drivers/i2c/busses/i2c-pxa.c | 35 +++++++++++++++++++----------------
>>> 1 files changed, 19 insertions(+), 16 deletions(-)
>>>
>>> diff --git a/drivers/i2c/busses/i2c-pxa.c b/drivers/i2c/busses/i2c-pxa.c
>>> index bd4b885..1a48470 100644
>>> --- a/drivers/i2c/busses/i2c-pxa.c
>>> +++ b/drivers/i2c/busses/i2c-pxa.c
>>> @@ -257,23 +257,7 @@ static void i2c_pxa_abort(struct pxa_i2c *i2c)
>>> _ICR(i2c));
>>> }
>>>
>>> -static int i2c_pxa_wait_bus_not_busy(struct pxa_i2c *i2c)
>>> -{
>>> - int timeout = DEF_TIMEOUT;
>>>
>>> - while (timeout-- && readl(_ISR(i2c)) & (ISR_IBB | ISR_UB)) {
>>> - if ((readl(_ISR(i2c)) & ISR_SAD) != 0)
>>> - timeout += 4;
>>> -
>>> - msleep(2);
>>> - show_state(i2c);
>>> - }
>>> -
>>> - if (timeout < 0)
>>> - show_state(i2c);
>>> -
>>> - return timeout < 0 ? I2C_RETRY : 0;
>>> -}
>>>
>>> static int i2c_pxa_wait_master(struct pxa_i2c *i2c)
>>> {
>>> @@ -425,6 +409,25 @@ static void i2c_pxa_reset(struct pxa_i2c *i2c)
>>> udelay(100);
>>> }
>>>
>>> +static int i2c_pxa_wait_bus_not_busy(struct pxa_i2c *i2c)
>>> +{
>>> + int timeout = DEF_TIMEOUT;
>>> +
>>> + while (timeout-- && readl(_ISR(i2c)) & (ISR_IBB | ISR_UB)) {
>>> + if ((readl(_ISR(i2c)) & ISR_SAD) != 0)
>>> + timeout += 4;
>>> +
>>> + msleep(2);
>>> + show_state(i2c);
>>> + }
>>> +
>>> + if (timeout < 0) {
>>> + show_state(i2c);
>>> + i2c_pxa_reset(i2c);
>>> + }
>> Even you reset I2C controller, it shouldn't help you since bus isn't
>> free. I thinkt that you should reset I2C bus before you reseting I2C
>> controller.
>>
> Excuse me that my previous comments are for PXA master mode.
>
> I think that you're focused on pxa working on slave mode. But if pxa
> is working in master mode, it seems that we needn't reset I2C
> controller since it doesn't help.
As for PXA3xx, the Developer Manual states:
"Software must ensure that the TWSI unit is not busy (ISR[UB] = 0)
before it asserts a reset. Software must also ensure that the TWSI bus is idle (ISR[IBB] = 0)
when the unit is enabled after reset."
>From my experience, in master mode resetting the controller
does not help and if the bus is busy for too much time,
there always was a h/w problem involved.
>>> +
>>> + return timeout < 0 ? I2C_RETRY : 0;
>>> +}
>>>
>>> #ifdef CONFIG_I2C_PXA_SLAVE
>>> /*
>>> --
>>> 1.7.3.2
>>>
>>>
>>> _______________________________________________
>>> linux-arm-kernel mailing list
>>> linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org
>>> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
>>>
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
>
--
Regards,
Igor.
WARNING: multiple messages have this Message-ID (diff)
From: grinberg@compulab.co.il (Igor Grinberg)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 6/7] i2c/pxa2xx: reset the chip if the bus is not free
Date: Thu, 25 Nov 2010 08:43:48 +0200 [thread overview]
Message-ID: <4CEE05A4.6030201@compulab.co.il> (raw)
In-Reply-To: <AANLkTi=8Xy3M7QGO54nt_r0_12z3+o8G5fAqQmxkTH4o@mail.gmail.com>
Hi,
On 11/25/10 04:49, Haojian Zhuang wrote:
> On Thu, Nov 25, 2010 at 10:30 AM, Haojian Zhuang
> <haojian.zhuang@gmail.com> wrote:
>> On Thu, Nov 25, 2010 at 5:20 AM, Sebastian Andrzej Siewior
>> <bigeasy@linutronix.de> wrote:
>>> I haven't seen this (yet) during a normal transfer but starting
>>> i2cdetect seems to hang the bus. On my Sodaville board, i2cdetect runs
>>> fine on bus zero and runs into timeouts on bus one and two. The chip
>>> never recovers from this condition. The following transfers hang as
>>> well. The ISR_UB never disappears.
>>> Issuing a chip reset fixes the timeout and following transfer succeed.
>>>
>>> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
>>> Signed-off-by: Dirk Brandewie <dirk.brandewie@gmail.com>
>>> ---
>>> drivers/i2c/busses/i2c-pxa.c | 35 +++++++++++++++++++----------------
>>> 1 files changed, 19 insertions(+), 16 deletions(-)
>>>
>>> diff --git a/drivers/i2c/busses/i2c-pxa.c b/drivers/i2c/busses/i2c-pxa.c
>>> index bd4b885..1a48470 100644
>>> --- a/drivers/i2c/busses/i2c-pxa.c
>>> +++ b/drivers/i2c/busses/i2c-pxa.c
>>> @@ -257,23 +257,7 @@ static void i2c_pxa_abort(struct pxa_i2c *i2c)
>>> _ICR(i2c));
>>> }
>>>
>>> -static int i2c_pxa_wait_bus_not_busy(struct pxa_i2c *i2c)
>>> -{
>>> - int timeout = DEF_TIMEOUT;
>>>
>>> - while (timeout-- && readl(_ISR(i2c)) & (ISR_IBB | ISR_UB)) {
>>> - if ((readl(_ISR(i2c)) & ISR_SAD) != 0)
>>> - timeout += 4;
>>> -
>>> - msleep(2);
>>> - show_state(i2c);
>>> - }
>>> -
>>> - if (timeout < 0)
>>> - show_state(i2c);
>>> -
>>> - return timeout < 0 ? I2C_RETRY : 0;
>>> -}
>>>
>>> static int i2c_pxa_wait_master(struct pxa_i2c *i2c)
>>> {
>>> @@ -425,6 +409,25 @@ static void i2c_pxa_reset(struct pxa_i2c *i2c)
>>> udelay(100);
>>> }
>>>
>>> +static int i2c_pxa_wait_bus_not_busy(struct pxa_i2c *i2c)
>>> +{
>>> + int timeout = DEF_TIMEOUT;
>>> +
>>> + while (timeout-- && readl(_ISR(i2c)) & (ISR_IBB | ISR_UB)) {
>>> + if ((readl(_ISR(i2c)) & ISR_SAD) != 0)
>>> + timeout += 4;
>>> +
>>> + msleep(2);
>>> + show_state(i2c);
>>> + }
>>> +
>>> + if (timeout < 0) {
>>> + show_state(i2c);
>>> + i2c_pxa_reset(i2c);
>>> + }
>> Even you reset I2C controller, it shouldn't help you since bus isn't
>> free. I thinkt that you should reset I2C bus before you reseting I2C
>> controller.
>>
> Excuse me that my previous comments are for PXA master mode.
>
> I think that you're focused on pxa working on slave mode. But if pxa
> is working in master mode, it seems that we needn't reset I2C
> controller since it doesn't help.
As for PXA3xx, the Developer Manual states:
"Software must ensure that the TWSI unit is not busy (ISR[UB] = 0)
before it asserts a reset. Software must also ensure that the TWSI bus is idle (ISR[IBB] = 0)
when the unit is enabled after reset."
next prev parent reply other threads:[~2010-11-25 6:43 UTC|newest]
Thread overview: 48+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-11-24 21:20 I2C support for Sodaville Sebastian Andrzej Siewior
2010-11-24 21:20 ` Sebastian Andrzej Siewior
[not found] ` <1290633617-15311-1-git-send-email-bigeasy-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org>
2010-11-24 21:20 ` [PATCH 1/7] i2c/pxa2xx: Don't touch ISAR if not in slave mode Sebastian Andrzej Siewior
2010-11-24 21:20 ` Sebastian Andrzej Siewior
[not found] ` <1290633617-15311-2-git-send-email-bigeasy-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org>
2010-11-25 23:52 ` Ben Dooks
2010-11-25 23:52 ` Ben Dooks
[not found] ` <20101125235255.GB15948-SMNkleLxa3Z6Wcw2j4pizdi2O/JbrIOy@public.gmane.org>
2010-11-26 18:28 ` [sodaville] " Sebastian Andrzej Siewior
2010-11-26 18:28 ` Sebastian Andrzej Siewior
2010-11-24 21:20 ` [PATCH 2/7] arm/pxa2xx: reorganize I2C files Sebastian Andrzej Siewior
2010-11-24 21:20 ` Sebastian Andrzej Siewior
[not found] ` <1290633617-15311-3-git-send-email-bigeasy-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org>
2010-11-25 23:55 ` Ben Dooks
2010-11-25 23:55 ` Ben Dooks
[not found] ` <20101125235520.GC15948-SMNkleLxa3Z6Wcw2j4pizdi2O/JbrIOy@public.gmane.org>
2010-11-26 0:03 ` Russell King - ARM Linux
2010-11-26 0:03 ` Russell King - ARM Linux
[not found] ` <20101126000341.GB9310-l+eeeJia6m9vn6HldHNs0ANdhmdF6hFW@public.gmane.org>
2010-11-26 14:11 ` Sebastian Andrzej Siewior
2010-11-26 14:11 ` Sebastian Andrzej Siewior
2010-11-24 21:20 ` [PATCH 3/7] i2c/pxa2xx: Add PCI support for PXA I2C controller Sebastian Andrzej Siewior
2010-11-24 21:20 ` Sebastian Andrzej Siewior
[not found] ` <1290633617-15311-4-git-send-email-bigeasy-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org>
2010-11-25 23:59 ` Ben Dooks
2010-11-25 23:59 ` Ben Dooks
[not found] ` <20101125235933.GD15948-SMNkleLxa3Z6Wcw2j4pizdi2O/JbrIOy@public.gmane.org>
2010-11-26 14:16 ` Sebastian Andrzej Siewior
2010-11-26 14:16 ` Sebastian Andrzej Siewior
2010-11-24 21:20 ` [PATCH 4/7] i2c/pxa2xx: add support for shared IRQ handler Sebastian Andrzej Siewior
2010-11-24 21:20 ` Sebastian Andrzej Siewior
[not found] ` <1290633617-15311-5-git-send-email-bigeasy-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org>
2010-11-25 2:26 ` Haojian Zhuang
2010-11-25 2:26 ` Haojian Zhuang
2010-11-25 10:48 ` Sebastian Andrzej Siewior
2010-11-25 10:48 ` Sebastian Andrzej Siewior
2010-11-24 21:20 ` [PATCH 5/7] i2c/pxa2xx: check timeout correctly Sebastian Andrzej Siewior
2010-11-24 21:20 ` Sebastian Andrzej Siewior
2010-11-24 21:20 ` [PATCH 6/7] i2c/pxa2xx: reset the chip if the bus is not free Sebastian Andrzej Siewior
2010-11-24 21:20 ` Sebastian Andrzej Siewior
[not found] ` <1290633617-15311-7-git-send-email-bigeasy-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org>
2010-11-25 2:30 ` Haojian Zhuang
2010-11-25 2:30 ` Haojian Zhuang
[not found] ` <AANLkTikvN+==eTkoh7CTQyN0mbfvPhH6Uh9NX5QW7WFx-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-11-25 2:49 ` Haojian Zhuang
2010-11-25 2:49 ` Haojian Zhuang
[not found] ` <AANLkTi=8Xy3M7QGO54nt_r0_12z3+o8G5fAqQmxkTH4o-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-11-25 6:43 ` Igor Grinberg [this message]
2010-11-25 6:43 ` Igor Grinberg
[not found] ` <4CEE05A4.6030201-UTxiZqZC01RS1MOuV/RT9w@public.gmane.org>
2010-11-25 7:04 ` Haojian Zhuang
2010-11-25 7:04 ` Haojian Zhuang
2010-11-25 12:24 ` Sebastian Andrzej Siewior
2010-11-25 12:24 ` Sebastian Andrzej Siewior
[not found] ` <4CEE5587.90109-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org>
2010-11-25 13:10 ` Igor Grinberg
2010-11-25 13:10 ` Igor Grinberg
[not found] ` <4CEE602D.5090501-UTxiZqZC01RS1MOuV/RT9w@public.gmane.org>
2010-11-25 13:39 ` Sebastian Andrzej Siewior
2010-11-25 13:39 ` Sebastian Andrzej Siewior
2010-11-24 21:20 ` [PATCH 7/7] i2c/pxa2xx: pass of_node from platform driver to adapter Sebastian Andrzej Siewior
2010-11-24 21:20 ` Sebastian Andrzej Siewior
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4CEE05A4.6030201@compulab.co.il \
--to=grinberg-utxizqzc01rs1mouv/rt9w@public.gmane.org \
--cc=ben-linux-elnMNo+KYs3YtjvyW6yDsg@public.gmane.org \
--cc=bigeasy-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org \
--cc=dirk.brandewie-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=eric.y.miao-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=haojian.zhuang-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
--cc=linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-lFZ/pmaqli7XmaaqVzeoHQ@public.gmane.org \
--cc=sodaville-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org \
--cc=tglx-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.