[U-Boot] [PATCH] ARM: imx6: DHCOM i.MX6 PDK: Switch to DM for I2C

Marek Vasut marex at denx.de
Wed Jul 3 11:29:33 UTC 2019


On 7/3/19 10:20 AM, Ludwig Zenz wrote:
[...]

>  static int setup_dhcom_mac_from_fuse(void)
>  {
> +	struct udevice *dev;
>  	unsigned char enetaddr[6];
>  	int ret;
>  
> @@ -228,13 +145,14 @@ static int setup_dhcom_mac_from_fuse(void)
>  		return 0;
>  	}
>  
> -	ret = i2c_set_bus_num(2);
> +#ifdef CONFIG_SYS_I2C_MXC_I2C3
> +	ret = i2c_get_chip_for_busnum(2, EEPROM_I2C_ADDRESS, 1, &dev);

Isn't there some DM way which avoids using bus sequence numbers ?
If there is, subsequent patch is fine.

>  	if (ret) {
> -		printf("Error switching I2C bus!\n");
> +		printf("Cannot find EEPROM!\n");
>  		return ret;
>  	}
>  
> -	ret = i2c_read(EEPROM_I2C_ADDRESS, 0xfa, 0x1, enetaddr, 0x6);
> +	ret = dm_i2c_read(dev, 0xfa, enetaddr, 0x6);
>  	if (ret) {
>  		printf("Error reading configuration EEPROM!\n");
>  		return ret;

[...]

> diff --git a/configs/dh_imx6_defconfig b/configs/dh_imx6_defconfig
> index 4734ed76e5..b0749a054f 100644
> --- a/configs/dh_imx6_defconfig
> +++ b/configs/dh_imx6_defconfig
> @@ -48,6 +48,13 @@ CONFIG_ENV_IS_IN_SPI_FLASH=y
>  CONFIG_DWC_AHSATA=y
>  CONFIG_BOOTCOUNT_LIMIT=y
>  CONFIG_DM_GPIO=y
> +CONFIG_DM_I2C=y
> +CONFIG_I2C_SET_DEFAULT_BUS_NUM=y
> +CONFIG_I2C_DEFAULT_BUS_NUMBER=0x2

Are these two ^ needed ?

> +CONFIG_SYS_I2C_MXC=y
> +CONFIG_SYS_I2C_MXC_I2C1=y
> +CONFIG_SYS_I2C_MXC_I2C2=y
> +CONFIG_SYS_I2C_MXC_I2C3=y

Are these three ^ really needed ?

[...]


More information about the U-Boot mailing list