[U-Boot] [PATCH] dm: i2c: mxc support DM

Marek Vasut marex at denx.de
Wed Apr 15 13:38:24 CEST 2015


On Wednesday, April 15, 2015 at 11:35:54 AM, Peng Fan wrote:
> Add support when CONFIG_DM_I2C configured.
> 
> Test results:
> => i2c dev 0
> Setting bus to 0
> => i2c probe
> Valid chip addresses: 08 50
> => i2c md 8 38
> 0038: 08 08 08 08 08 08 08 08 08 08 08 08 08 08 08 08    ................
> => i2c mw 8 38 5 1
> => i2c md 8 38
> 0038: 05 05 05 05 05 05 05 05 05 05 05 05 05 05 05 05    ................
> => dm tree
>  Class       Probed   Name
> ----------------------------------------
>  root        [ + ]    root_driver
>  thermal     [   ]    |-- imx_thermal
>  simple_bus  [ + ]    |-- soc
>  simple_bus  [   ]    |   |-- aips-bus at 30000000
>  simple_bus  [   ]    |   |   |-- anatop at 30360000
>  simple_bus  [   ]    |   |   `-- snvs at 30370000
>  simple_bus  [   ]    |   |-- aips-bus at 30400000
>  simple_bus  [ + ]    |   `-- aips-bus at 30800000
>  i2c         [ + ]    |       |-- i2c at 30a20000
>  i2c_generic [ + ]    |       |   |-- generic_8
>  i2c_generic [ + ]    |       |   `-- generic_50
>  i2c         [   ]    |       |-- i2c at 30a40000
>  spi         [   ]    |       `-- qspi at 30bb0000
>  simple_bus  [   ]    `-- regulators
> 
> Signed-off-by: Peng Fan <Peng.Fan at freescale.com>

Hi,

[...]

> +static int i2c_init_transfer_(struct i2c_bus *i2c_bus, u32 chip,
> +			      bool read)
> +{
> +	unsigned int temp;
> +	int ret;
> +	struct mxc_i2c_regs *i2c_regs = i2c_bus->regs;
> +
> +	/* Enable I2C controller */
> +#ifdef I2C_QUIRK_REG
> +	if (readb(&i2c_regs->i2cr) & I2CR_IDIS) {
> +#else
> +	if (!(readb(&i2c_regs->i2cr) & I2CR_IEN)) {
> +#endif

This is a little odd, maybe you can rename this to some sensible name
since it's IMX specific ?


More information about the U-Boot mailing list