[U-Boot] [PATCH 2/2] WIP: tegra: i2c: Enable new CONFIG_SYS_I2C framework

Heiko Schocher hs at denx.de
Wed Oct 31 07:00:19 CET 2012


Hello Stephen,

On 30.10.2012 23:32, Stephen Warren wrote:
> On 10/30/2012 11:28 AM, Simon Glass wrote:
>> (just for illustration, please don't merge)
>>
>> This enables CONFIG_SYS_I2C on Tegra, updating existing boards and the Tegra
>> i2c driver to support this.
>
>> diff --git a/drivers/i2c/i2c_core.c b/drivers/i2c/i2c_core.c
>
>> +#ifdef CONFIG_TEGRA_I2C
>> +extern struct i2c_adapter tegra_i2c_adap[];
>> +#endif
>
> I'm not sure why that's needed if the config files have to put the
> adpater list into a #define:
>
>> diff --git a/include/configs/seaboard.h b/include/configs/seaboard.h
>
>> +#define CONFIG_SYS_I2C
>> +#define CONFIG_SYS_I2C_ADAPTERS	{&tegra_i2c_adap[0]}
>> +#define CONFIG_SYS_NUM_I2C_ADAPTERS	TEGRA_I2C_NUM_CONTROLLERS
>
> But, why is CONFIG_SYS_I2C_ADAPTERS needed; can't the adapter init
> functions (which presumably would be called from board code or as a
> result of DT parsing) dynamically register themselves?

This would not work, if we are running for example from flash on
powerpc before relocation. There some boards need to read RAM
infos from an SPD Eeprom through i2c ... so we must have very early
i2c bus ready and usable ...

It maybe a good plus to add i2c busses/adapters dynamically after
relocation is done and we have enough RAM ... I tried such an
approach here:

http://git.denx.de/?p=u-boot/u-boot-i2c.git;a=commit;h=ccb680c8cf9002232bc459e4003e3b47db5e1bf4

but this is an old state (only rebased a long time),
but it is maybe a good base for doing such an feature
if it is needed ...

> Aside from that, this looks OK to me at a quick glance.

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