[U-Boot] [PATCH v4 11/11] dm: i2c: tegra: Convert to driver model

Masahiro Yamada yamada.m at jp.panasonic.com
Fri Dec 5 14:15:45 CET 2014


Hi Simon,



On Thu,  4 Dec 2014 21:21:30 -0700
Simon Glass <sjg at chromium.org> wrote:

> +static const struct dm_i2c_ops tegra_i2c_ops = {
> +	.xfer		= tegra_i2c_xfer,
> +	.probe_chip	= tegra_i2c_probe_chip,
> +	.set_bus_speed	= tegra_i2c_set_bus_speed,
> +};
>  
> -	for (i = 0; i < TEGRA_I2C_NUM_CONTROLLERS; i++) {
> -		struct i2c_bus *bus = &i2c_controllers[i];
> +static int tegra_i2c_child_pre_probe(struct udevice *dev)
> +{
> +	struct dm_i2c_chip *i2c_chip = dev_get_parentdata(dev);
>  
> -		if (bus->inited && bus->is_dvc)
> -			return i;
> -	}
> +	if (dev->of_offset == -1)
> +		return 0;
> +	return i2c_chip_ofdata_to_platdata(gd->fdt_blob, dev->of_offset,
> +					   i2c_chip);
> +}


As I said in v3, it is unfortunate that uclass does not support .child_pre_probe.


sandbox_i2c.c and tegra-i2c.c have a similar .child_pre_probe.
I copied tegra_i2c_child_pre_probe() to my i2c driver verbatim.

I guess every driver will do so.


Is it a good idea to move .child_pre_probe to uclass_driver?




Best Regards
Masahiro Yamada



More information about the U-Boot mailing list