[U-Boot] [PATCH] 7/12 Multiadapter/multibus I2C, drivers part 4
Heiko Schocher
hs at denx.de
Thu Feb 19 07:34:54 CET 2009
Hello ksi,
ksi at koi8.net wrote:
> On Wed, 18 Feb 2009, Heiko Schocher wrote:
>
>> Hello ksi,
>>
>> ksi at koi8.net wrote:
>>> On Mon, 16 Feb 2009, Wolfgang Denk wrote:
>>>
>>>> Dear ksi at koi8.net,
>>>>
>>>> In message <Pine.LNX.4.64ksi.0902142019520.6240 at home-gw.koi8.net> you wrote:
>> [...]
>>>>> And remember, the devil is in details. How are you going to assign
>>>>> (initialize) that innocent looking "cur_adap_nr->hwadapnr"? How are you
>>>>> going to work on an adapter other that "current" in a situation when you can
>>>>> NOT change "current" adapter (e.g. perform all I2C layer initialization
>>>>> while still running from flash?) Remember, this is plain C and there is no
>>>> What makes you insist that we cannot change a variable if we need to
>>>> be able to change one?
>>> It is NOT just variable. My approach uses i2c _BUS_, not _ADAPTER_. And
>>> number of busses can be bigger than number of adapters (e.g. when some
>>> busses a reached via muxes or switches.) When doing i2c_set_current_bus()
>>> you are switching _NOT_ adapters, but busses. That involves not only
>>> changing that global variable but also reprogramming muxes/switches for
>>> i2c_set_current_bus() to be consistent and hardware independent. Otherwise
>> You have no i2c_set_current_bus() in your code! I think you mean
>> i2c_set_current_bus(), right?
>>
>> And this function fails when running from flash! So, how can you switch
>> busses with your patches when running from flash?
>>
>> Here your function:
>>
>> int i2c_set_bus_num(unsigned int bus)
>> {
>> #ifndef CONFIG_SYS_I2C_DIRECT_BUS
>> int i;
>> u_int8_t buf;
>> #endif
>>
>> if ((bus >= CONFIG_SYS_NUM_I2C_BUSSES) || !(gd->flags & GD_FLG_RELOC))
>> return(-1);
>> [...]
>>
>> This function wouldn;t work from flash ...
>
> So what? I don't need that function to initialize adapters.
Read my EMail!
But to switch busses, right? And how you switch busses, when running
from flash, and you do a:
if ((bus >= CONFIG_SYS_NUM_I2C_BUSSES) || !(gd->flags & GD_FLG_RELOC))
return(-1);
in it??
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