[U-Boot] [RFC] I2C: change CONFIG_SYS_SPD_BUS_NUM to CONFIG_I2C_DEFAULT_BUS_NUM

Wolfgang Denk wd at denx.de
Tue Mar 15 00:28:35 CET 2011


Dear Matthew McClintock,

In message <1300135645-21544-1-git-send-email-msm at freescale.com> you wrote:
> The bus that the i2c api can access before relocating from flash
> is defined via CONFIG_SYS_SPD_BUS_NUM, however we want to use
> the i2c bus before relocating from flash for non-SPD related
> reasons. Therefore, we rename this define to something more
> appropriate
> ---
> 
> We are trying to access the I2C bus before relocation from flash to read
> switch settings. Using the current CONFIG_SYS_SPD_BUS_NUM define to do this
> is fine for our needs however I would like to ask if we wanted to change
> this to a new more generic define CONFIG_I2C_DEFAULT_BUS_NUM

Well, obviously you need to update the documentation, too:

> -		CONFIG_SYS_SPD_BUS_NUM
> +		CONFIG_I2C_DEFAULT_BUS_NUM
>  
>  		If defined, then this indicates the I2C bus number for DDR SPD.
>  		If not defined, then U-Boot assumes that SPD is on I2C bus 0.

"bus number for DDR SPD" is not really correct any more?

> @@ -2834,7 +2834,7 @@ Low Level (hardware related) configuration options:
>    SPD_EEPROM_ADDRESS
>  		I2C address of the SPD EEPROM
>  
> -- CONFIG_SYS_SPD_BUS_NUM
> +- CONFIG_I2C_DEFAULT_BUS_NUM
>  		If SPD EEPROM is on an I2C bus other than the first
>  		one, specify here. Note that the value must resolve
>  		to something your driver can deal with.

"SPD EEPROM" is not correct either...

> --- a/board/freescale/common/sys_eeprom.c
> +++ b/board/freescale/common/sys_eeprom.c
> @@ -495,11 +495,11 @@ int mac_read_from_eeprom(void)
>   * This function is called before relocation, so we need to read a private
>   * copy of the EEPROM into a local variable on the stack.
>   *
> - * Also, we assume that CONFIG_SYS_EEPROM_BUS_NUM == CONFIG_SYS_SPD_BUS_NUM.  The global
> - * variable i2c_bus_num must be compile-time initialized to CONFIG_SYS_SPD_BUS_NUM,
> + * Also, we assume that CONFIG_SYS_EEPROM_BUS_NUM == CONFIG_I2C_DEFAULT_BUS_NUM.  The global
> + * variable i2c_bus_num must be compile-time initialized to CONFIG_I2C_DEFAULT_BUS_NUM,
>   * so that the SPD code will work.  This means that all pre-relocation I2C
> - * operations can only occur on the CONFIG_SYS_SPD_BUS_NUM bus.  So if
> - * CONFIG_SYS_EEPROM_BUS_NUM != CONFIG_SYS_SPD_BUS_NUM, then we can't read the EEPROM when
> + * operations can only occur on the CONFIG_I2C_DEFAULT_BUS_NUM bus.  So if
> + * CONFIG_SYS_EEPROM_BUS_NUM != CONFIG_I2C_DEFAULT_BUS_NUM, then we can't read the EEPROM when
>   * this function is called.  Oh well.

Lines too long.


> -static unsigned int i2c_bus_num __attribute__ ((section (".data"))) = CONFIG_SYS_SPD_BUS_NUM;
> +static unsigned int i2c_bus_num __attribute__ ((section (".data"))) = CONFIG_I2C_DEFAULT_BUS_NUM;

Ditto.


Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Until you walk a mile in another man's moccasins, you  can't  imagine
the smell.


More information about the U-Boot mailing list