[U-Boot] [PATCH] i2c: fix SDA contention in read_byte()

Reinhard Meyer reinhard.meyer at emk-elektronik.de
Wed Jul 14 08:31:58 CEST 2010


Thomas Chou schrieb:
> Reinhard Meyer wrote:
>> Thomas Chou schrieb:
>>> Reinhard Meyer wrote:
>>>> Its even simpler, provided the  hardware can do open collector. Here
>>>> was my solution for AVR32AP7000:
>>>>
>>> Then we could add a config for open drain similar to that of linux driver.
>>>
>>> # ifndef I2C_SDA
>>> #  ifdef CONFIG_SOFT_I2C_GPIO_SDA_IS_OPEN_DRAIN
>>> #   define I2C_SDA(bit) gpio_set_value(CONFIG_SOFT_I2C_GPIO_SDA, bit)
>>> #  else
>>> #   define I2C_SDA(bit) \
>>>     if (bit) {                        \
>>>         gpio_direction_input(CONFIG_SOFT_I2C_GPIO_SDA);    \
>>>     } else {                        \
>>>         gpio_direction_output(CONFIG_SOFT_I2C_GPIO_SDA, 0);\
>>>     }
>>> #  endif
>>> # endif
>> Why would we need that? Since the defines reside in the board/project specific
>> include/configs/*.h file, it is well known if the hardware has open drain or
>> not.
> 
> We want to use common gpio framework and unify the soft i2c access. 
> Please see the patches from Mike Frysinger,
> [07/05] i2c: soft_i2c: add simple GPIO implementation
>
So, above #-code would be in soft_i2c.c in the future? Then I agree the
define would be useful. However Soft I2C should always allow for some quite
uncommon ways to handle the SDA and SCL lines, not everytime the hardware
is like simple GPIO... As I see, as long as I define alle I2C_ related things
myself, this is still the case.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: reinhard_meyer.vcf
Type: text/x-vcard
Size: 370 bytes
Desc: not available
Url : http://lists.denx.de/pipermail/u-boot/attachments/20100714/adf14b80/attachment.vcf 


More information about the U-Boot mailing list