public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Lubomir Popov <lpopov@mm-sol.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] A question about unconfigured pads check in omap24xx_i2c
Date: Thu, 07 Nov 2013 09:57:30 +0200	[thread overview]
Message-ID: <527B47EA.2080905@mm-sol.com> (raw)
In-Reply-To: <527B21C7.6070203@denx.de>

Hi Heiko,

On 07-Nov-13 7:14, Heiko Schocher wrote:
> Hello Lubomir,
>
> Am 06.11.2013 14:19, schrieb Lubomir Popov:
>> On 06-Nov-13 14:12, Nikita Kiryanov wrote:
>>> In drivers/i2c/omap24xx_i2c.c there are a few checks that attempt to
>>> detect unconfigured pads for the i2c bus in use. These checks are
>>> all in the form of
>>>
>>> if (status == I2C_STAT_XRDY) {
>>> printf("unconfigured pads\n");
>>> return -1;
>>> }
>>>
>>> This check seems peculiar to me since the meaning of I2C_STAT_XRDY is
>>> that new data is requested for transmission. Why is that indication 
>>> that
>>> the bus is not padconf'd for I2C?
>> Hi Nikita,
>>
>> This has been empirically confirmed on OMAP4 and OMAP5. When the pads 
>> are not
>> configured, the I2C controller is actually disconnected from the bus. 
>> The clock
>> input for its state machine has to come from the bus however due to 
>> stretching
>> etc., although it is internally generated. So actually nothing 
>> changes within
>> the controller after a transaction attempt is made, and it keeps its 
>> initial
>> state with XRDY set only (ready to accept transmit data). I use this 
>> as an
>> indicator. Not perfect, but works in most cases.
>
> Thanks for this explanation! Maybe we can document this somewhere in
> the code?
>
> bye,
> Heiko
You are right, it would be good to document it. Unfortunately I have not
been on the U-Boot wave for some months now due to very heavy engagement
with other stuff; have even unsubscribed from the list. I think however
that in order to give definite statements and improve the driver, a new
round of experiments has to be made to cover the two major types of design
flaws (software and/or hardware): incorrect pad configuration, and missing
pullups (internal or external). I wrote this driver more that 6 months ago
with the goal to have something working properly (the then existing one was,
mildly put, not good), and this detection is just a bonus side effect.

In summary, the professional approach would require some more effort, which
I'm not sure when I could afford. Otherwise, if just an explanation for the
current algo is to be given, no problem - I can just add some comments.

What do you think?

Regards,
Lubo

  reply	other threads:[~2013-11-07  7:57 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-06 12:12 [U-Boot] A question about unconfigured pads check in omap24xx_i2c Nikita Kiryanov
2013-11-06 13:19 ` Lubomir Popov
2013-11-07  5:14   ` Heiko Schocher
2013-11-07  7:57     ` Lubomir Popov [this message]
2013-11-07  8:04       ` Heiko Schocher
2013-11-07  8:15         ` Lubomir Popov
2013-11-08 17:27   ` Nikita Kiryanov
2013-11-08 21:26     ` Lubomir Popov
2013-11-11 11:15       ` Nikita Kiryanov
2013-11-11 15:51         ` Lubomir Popov

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=527B47EA.2080905@mm-sol.com \
    --to=lpopov@mm-sol.com \
    --cc=u-boot@lists.denx.de \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox