From: Heiko Schocher <hs@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] 7/12 Multiadapter/multibus I2C, drivers part 4
Date: Fri, 20 Feb 2009 09:53:02 +0100 [thread overview]
Message-ID: <499E6F6E.70305@denx.de> (raw)
In-Reply-To: <Pine.LNX.4.64ksi.0902191406290.19156@home-gw.koi8.net>
Hello ksi,
ksi at koi8.net wrote:
> On Thu, 19 Feb 2009, Wolfgang Denk wrote:
>
>> Dear ksi at koi8.net,
>>
>> In message <Pine.LNX.4.64ksi.0902191141090.18501@home-gw.koi8.net> you wrote:
[...]
>>> That means you'll have to rewrite the entire U-Boot. 99% of the boards have
>>> only one bus so they did not switch busses. That means they never called
>>> that i2c_set_bus_num() relying on i2c_init() in libxxx/board.c instead.
>> I cannot follow your argument.
>>
>> Yes, the status quo is as you describe, it relies on i2c_init() and
>> is simple-minded and does not support an arbitry number of
>> arbitrarily complex I2C bus trees and multiplexors and expanders and
>> what else. But it was sufficient for the first 10 years and 500
>> boards of U-Boot development.
>>
>> Now we are discussion a major redesign, so what is the big problem of
>> changing this part? "rewrite the entire U-Boot"? Please stay serious.
>> Compared to the other changes you suggest, this is not that big a
>> part.
>
> No, my changes are limited. Look, somebody must initialize an adapter. As
> for now it is done with a single i2c_init() usually in libxxx/board.c. Then
> the entire code assumes adapter is already initialized and just issues
> i2c_read/write() as it see fits. 99% of this code is written on assumption
> that there is only one I2C bus so it doesn't use i2c_set_bus_num() or
> whatever, it just fires up i2c_read() and that's it.
>
> This would perfectly work with my changes without modifying that code -- the
> only bus is bus number 0 so there is nothing wrong with not setting the bus
> for each I2C access; it is already at that only bus.
>
> Now, if we have adapter initialization moved to i2c_set_bus() all that code
> will cease to work because i2c_set_bus() is never called thus adapter will
> never be initialized and all those i2c_read() and friends will fail.
But you can call i2c_set_bus_num instead of i2c_init in lib_xxx/board.c
and all old boards will work as they did. Ok, we didn;t can get rid of
initializing bus 0, but with moving init() in i2c_set_bus_num, we only
init additional hardwareadapters only, if we need them.
> That means that we should read through each and every board's code to find
> where i2c functions are used and add i2c_set_bus() calls as needed. That is
> not INSTEAD of that big rewrite, that is _IN ADDITION_ to it. That is a very
> sizeable chunk of additional changes.
No, we have not to do this. See above. And if some board use multibus,
yes they have to do a i2c_set_bus_num before they access the i2c bus,
because they must know on which bus they have to read, and the actual
bus could be changed.
> I DID think of adding adapter initialization to i2c_set_bus() initially but
> then it turned out it generated more problems than it solved (and it solved
> none) so I dropped that idea.
Please tell us the problems, so we can think of it, maybe I overlook something.
Thats the reason why we discuss this here.
bye
Heiko
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
next prev parent reply other threads:[~2009-02-20 8:53 UTC|newest]
Thread overview: 75+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-02-13 10:17 [U-Boot] [PATCH] 7/12 Multiadapter/multibus I2C, drivers part 4 Heiko Schocher
2009-02-13 21:23 ` ksi at koi8.net
2009-02-14 8:24 ` Heiko Schocher
2009-02-15 5:03 ` ksi at koi8.net
2009-02-15 7:56 ` Heiko Schocher
2009-02-16 6:35 ` ksi at koi8.net
2009-02-16 9:03 ` Heiko Schocher
2009-02-16 22:17 ` Wolfgang Denk
2009-02-17 21:23 ` ksi at koi8.net
2009-02-16 22:16 ` Wolfgang Denk
2009-02-17 21:22 ` ksi at koi8.net
2009-02-18 7:23 ` Heiko Schocher
2009-02-16 22:11 ` Wolfgang Denk
2009-02-17 21:19 ` ksi at koi8.net
2009-02-17 22:49 ` Wolfgang Denk
2009-02-17 23:42 ` ksi at koi8.net
2009-02-18 0:13 ` Wolfgang Denk
2009-02-18 0:35 ` ksi at koi8.net
2009-02-18 7:47 ` Heiko Schocher
2009-02-18 18:05 ` ksi at koi8.net
2009-02-18 18:26 ` Wolfgang Denk
2009-02-18 19:47 ` ksi at koi8.net
2009-02-18 22:09 ` Wolfgang Denk
2009-02-18 23:00 ` ksi at koi8.net
2009-02-18 23:31 ` Wolfgang Denk
2009-02-19 0:46 ` ksi at koi8.net
2009-02-19 8:00 ` Heiko Schocher
2009-02-19 19:48 ` ksi at koi8.net
2009-02-19 20:50 ` Wolfgang Denk
2009-02-19 22:26 ` ksi at koi8.net
2009-02-20 8:53 ` Heiko Schocher [this message]
2009-02-20 7:08 ` Heiko Schocher
2009-02-20 7:06 ` Heiko Schocher
2009-02-18 7:33 ` Heiko Schocher
2009-02-18 8:06 ` Wolfgang Denk
2009-02-18 8:15 ` Heiko Schocher
2009-02-18 8:55 ` Wolfgang Denk
2009-02-18 18:58 ` ksi at koi8.net
2009-02-18 18:51 ` ksi at koi8.net
2009-02-18 17:44 ` ksi at koi8.net
2009-02-19 6:10 ` Heiko Schocher
2009-02-19 14:46 ` ksi at koi8.net
2009-02-19 15:06 ` Heiko Schocher
2009-02-19 19:52 ` ksi at koi8.net
2009-02-19 20:55 ` Wolfgang Denk
2009-02-19 22:33 ` ksi at koi8.net
2009-02-20 7:09 ` Heiko Schocher
2009-02-18 7:20 ` Heiko Schocher
2009-02-18 18:48 ` ksi at koi8.net
2009-02-19 6:31 ` Heiko Schocher
2009-02-19 19:35 ` ksi at koi8.net
2009-02-19 21:22 ` Wolfgang Denk
2009-02-20 0:13 ` ksi at koi8.net
2009-02-20 7:01 ` Heiko Schocher
2009-02-20 21:29 ` ksi at koi8.net
2009-02-21 7:25 ` Heiko Schocher
2009-02-21 18:19 ` ksi at koi8.net
2009-02-18 8:17 ` Heiko Schocher
2009-02-18 8:58 ` Heiko Schocher
2009-02-18 18:57 ` ksi at koi8.net
2009-02-18 21:56 ` Wolfgang Denk
2009-02-18 22:32 ` ksi at koi8.net
2009-02-18 22:48 ` Wolfgang Denk
2009-02-19 0:35 ` ksi at koi8.net
2009-02-19 8:04 ` Heiko Schocher
2009-02-19 21:29 ` Wolfgang Denk
2009-02-19 7:39 ` Heiko Schocher
2009-02-19 19:40 ` ksi at koi8.net
2009-02-19 6:42 ` Heiko Schocher
2009-02-18 18:53 ` ksi at koi8.net
2009-02-19 6:34 ` Heiko Schocher
2009-02-19 19:36 ` ksi at koi8.net
-- strict thread matches above, loose matches on Subject: below --
2009-02-12 22:25 ksi at koi8.net
2009-02-16 21:58 ` Wolfgang Denk
2009-02-17 20:02 ` ksi at koi8.net
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=499E6F6E.70305@denx.de \
--to=hs@denx.de \
--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