[U-Boot-Users] [PATCH v2 3/7] add an i2c driver for mx31
Guennadi Liakhovetski
lg at denx.de
Tue Apr 15 10:54:49 CEST 2008
On Tue, 15 Apr 2008, Wolfgang Denk wrote:
> In message <Pine.LNX.4.64.0804150024500.5332 at axis700.grange> you wrote:
> > >
> > > Aren't we just moving the #ifdef hell from one place to another?
> >
> > Wouldn't it be logical to assume, that if CONFIG_I2C_MXC is defined,
> > CONFIG_HARD_I2C is meant too? So, we could just put in i2c.h
>
> Well, what exactly is CONFIG_I2C_MXC supposed to mean? Sorry for
> asking, but I cannot find it documented anywhere (hint! hint! This
> needs to be fixed!). I tend to believe that in it's current form it's
> redundant, meaning that we have both CONFIG_CMD_I2C and CONFIG_MX31.
Ok, looking at examples, e.g., at cpu/mpc824x/drivers/i2c/i2c.c, it looks
like u-boot presumes, that a system may only want to use one (hardware)
i2c driver. I don't understand why this restriction is made, but if we
want to keep it, we could just drop CONFIG_I2C_MXC and just use
CONFIG_HARD_I2C. As for redundancy - that's exactly the reason why I don't
think it is redundant. I can imagine an i.MX31 based system with another
hardware i2c controller, wanting to use the external one and not needing
the built-in one.
My preference would be to let CONFIG_I2C_MXC mean "use the mxc_i2c.c
driver for I2C controllers like those on i.MX* / MXC SoCs from Freescale,"
similar to how i2c host drivers under drivers/i2c use their (also not
always documented) config options:
CONFIG_TSI108_I2C, CONFIG_DRIVER_OMAP24XX_I2C, CONFIG_DRIVER_OMAP1510_I2C
and they just define both the hartdware-specific config and
CONFIG_HARD_I2C in their *_config.h, but check only for the specific one
in the .c file. So, shall I just remove the ifdef from .c, add
OBJS-$(CONFIG_I2C_MXC) += ...
to the Makefile and add it to the README?
Thanks
Guennadi
---
Guennadi Liakhovetski, Ph.D.
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office at denx.de
More information about the U-Boot
mailing list