[U-Boot] [PATCH 1/3] i2c: add i2c_core and prepare for new multibus support
Heiko Schocher
hs at denx.de
Thu Jan 19 07:35:33 CET 2012
Hello Wolfgang, Timur, Simon,
Wolfgang Denk wrote:
> Dear Simon Glass,
>
> In message <CAPnjgZ2kLPfMzzwgHkDJ4eL+wixqLv89+CvdVP7PCcy+XFaqNQ at mail.gmail.com> you wrote:
>>> I was really hoping we could get rid of the concept of a "current" i2c
>>> adapter, and just force all drivers to specify the I2C adapter they
>>> want to use for a given I2C operation. =A0That's how Linux operates, and
>>> it will prevent stuff like this:
>> I agree completely, it was one of the things I was going to ask for.
>> We should add a new parameter to calls instead IMO.
>
> Let's do one step at a time. Now we go for multi-bus support.
Ok.
> Implementing a new, better device interface is one of the next steps,
> then.
Some thoughts to the subject "get rid of concept of a current i2c"
- First, it would be great to get rid of that ;-)
- 2 reasons why we currently need the info, what is the current
i2c adapter/i2c bus:
- U-Boot principle says, don't init a device, if you don't use it.
So, if we switch to another i2c adapter or i2c bus (A i2c bus is a
combination if one i2c adpater and n i2c muxes), we must deinit
the current adapter/bus. Ok, current code didn't this too, but
this should a goal to keep in mind ... or we define, that this
is not needed.
- If we have i2c muxes, and you don't know your current i2c bus,
you must on every i2c access also setup the i2c muxes on this
i2c bus ... would we do this really?
if we have the current i2c bus info, we just have to check, if
we are on this bus, and do the i2c access ... if we are not on
this i2c bus, we can deinit it complete (the new i2c_core disconnects
for example all i2c muxes on the i2c bus) and init the new bus.
All this work is done in a central function i2c_set_bus_numer()
- Looking in the new multibus i2c_core.c file, we should get rid of
static unsigned int i2c_cur_bus __attribute__((section(".data"))) =
CONFIG_SYS_SPD_BUS_NUM;
and "cur_adap" renamed to "cur_i2c_bus" and should be a
"struct i2c_bus_hose" pointer.
bye,
Heiko
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
More information about the U-Boot
mailing list