diff options
author | Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> | 2012-11-02 10:36:51 +0100 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2012-11-15 08:34:53 +0100 |
commit | 32a9da73c21acf07333687472c6411ab95bc7446 (patch) | |
tree | 26ca616ebc7f087540aa07f50cdb44e24b44059e /include/i2c | |
parent | 334e8f3b62f922370723b911c9afda7e6cd5d27d (diff) | |
download | barebox-32a9da73c21acf07333687472c6411ab95bc7446.tar.gz barebox-32a9da73c21acf07333687472c6411ab95bc7446.tar.xz |
i2c: add i2c-gpio support
Based on linux 3.7-rc2
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'include/i2c')
-rw-r--r-- | include/i2c/i2c-gpio.h | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/include/i2c/i2c-gpio.h b/include/i2c/i2c-gpio.h new file mode 100644 index 0000000000..55feb82a90 --- /dev/null +++ b/include/i2c/i2c-gpio.h @@ -0,0 +1,38 @@ +/* + * i2c-gpio interface to platform code + * + * Copyright (C) 2007 Atmel Corporation + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ +#ifndef _LINUX_I2C_GPIO_H +#define _LINUX_I2C_GPIO_H + +/** + * struct i2c_gpio_platform_data - Platform-dependent data for i2c-gpio + * @sda_pin: GPIO pin ID to use for SDA + * @scl_pin: GPIO pin ID to use for SCL + * @udelay: signal toggle delay. SCL frequency is (500 / udelay) kHz + * @timeout_ms: clock stretching timeout in ms. If the slave keeps + * SCL low for longer than this, the transfer will time out. + * @sda_is_open_drain: SDA is configured as open drain, i.e. the pin + * isn't actively driven high when setting the output value high. + * gpio_get_value() must return the actual pin state even if the + * pin is configured as an output. + * @scl_is_open_drain: SCL is set up as open drain. Same requirements + * as for sda_is_open_drain apply. + * @scl_is_output_only: SCL output drivers cannot be turned off. + */ +struct i2c_gpio_platform_data { + unsigned int sda_pin; + unsigned int scl_pin; + int udelay; + int timeout_ms; + unsigned int sda_is_open_drain:1; + unsigned int scl_is_open_drain:1; + unsigned int scl_is_output_only:1; +}; + +#endif /* _LINUX_I2C_GPIO_H */ |