[U-Boot] [PATCH v4 03/16] i2c: add Faraday FTI2C010 I2C controller support

Kuo-Jung Su
2013-05-08T01:51:45Z

2013/5/7 Heiko Schocher <hs@denx.de>:
> Hello Kuo-Jung,
>
> Am 07.05.2013 08:32, schrieb Kuo-Jung Su:
>> From: Kuo-Jung Su <dantesu@faraday-tech.com>
>>
>> Faraday FTI2C010 is a multi-function I2C controller
>> which supports both master and slave mode.
>> This patch simplily implements the master mode only.
>>
>> Signed-off-by: Kuo-Jung Su <dantesu@faraday-tech.com>
>> CC: Heiko Schocher <hs@denx.de>
>> ---
>> Changes for v4:
>> - Coding Style cleanup.
>> - Make it a separate patch, rather then a part of
>> Faraday A36x patch series
>> - Use macro constants for timeout control
>>
>> Changes for v3:
>> - Coding Style cleanup.
>> - Drop macros for wirtel()/readl(), call them directly.
>> - Always insert a blank line between declarations and code.
>> - Replace all the infinite wait loop with a timeout.
>> - Add '__iomem' to all the declaration of HW register pointers.
>>
>> Changes for v2:
>> - Coding Style cleanup.
>> - Use readl(), writel(), clrsetbits_le32() to replace REG() macros.
>> - Use structure based hardware registers to replace the macro constants.
>> - Replace BIT() with BIT_MASK().
>>
>> drivers/i2c/Makefile | 1 +
>> drivers/i2c/fti2c010.c | 371 ++++++++++++++++++++++++++++++++++++++++++++++++
>> drivers/i2c/fti2c010.h | 81 +++++++++++
>> 3 files changed, 453 insertions(+)
>> create mode 100644 drivers/i2c/fti2c010.c
>> create mode 100644 drivers/i2c/fti2c010.h
>
> As I posted the new i2c multibus/multiadapter framework:
>
> http://lists.denx.de/pipermail/u-boot/2013-May/153452.html
>
> maybe it is possible you can adapt your i2c driver based on
> this patches?
>

Sure, why not?
But it looks to me that the new i2c framework has not yet committed
into the mainline u-boot git repository, so I'll only update the fti2c010 driver
and postpone the board related stuff until the new i2c framework get accepted.

>> diff --git a/drivers/i2c/Makefile b/drivers/i2c/Makefile
>> index 5dbdbe3..ed2b8c0 100644
>> --- a/drivers/i2c/Makefile
>> +++ b/drivers/i2c/Makefile
>> @@ -29,6 +29,7 @@ COBJS-$(CONFIG_BFIN_TWI_I2C) += bfin-twi_i2c.o
>> COBJS-$(CONFIG_DRIVER_DAVINCI_I2C) += davinci_i2c.o
>> COBJS-$(CONFIG_DW_I2C) += designware_i2c.o
>> COBJS-$(CONFIG_FSL_I2C) += fsl_i2c.o
>> +COBJS-$(CONFIG_FTI2C010) += fti2c010.o
>
> For the new framework this should be something like
> CONFIG_SYS_I2C_FTI2C010 ... and as I think, this
> name would be good also for the old framework.
>

Got it, thanks

>> COBJS-$(CONFIG_I2C_MVTWSI) += mvtwsi.o
>> COBJS-$(CONFIG_I2C_MV) += mv_i2c.o
>> COBJS-$(CONFIG_I2C_MXC) += mxc_i2c.o
> [...]
>
> Rest of your patch looks good to me ...
>

I think it would be better to update the 'CONFIG_HARD_I2C' ifdef statement
of the fti2c010 as bellow:

#if !defined(CONFIG_SYS_I2C) && !defined(CONFIG_HARD_I2C)
#error "fti2c010: either CONFIG_SYS_I2C or CONFIG_HARD_I2C would be defined"
#endif

> bye,
> Heiko
> --
> DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
> HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany

--
Best wishes,
Kuo-Jung Su