u-boot-brain/doc/device-tree-bindings/i2c/i2c-gpio.txt
Przemyslaw Marczak c54473cb25 dm: i2c: add i2c-gpio driver
This commit adds driver model support to software emulated i2c bus driver.
This driver supports kernel-style device tree bindings. Fdt properties in use:
- compatible - "i2c-gpio"
- gpios      - data and clock GPIO pin phandles
- delay-us   - micro seconds delay between GPIOs toggle operations,
               which is 1/4 of I2C speed clock period.

Added:
- Config: CONFIG_DM_I2C_GPIO
- File: drivers/i2c/i2c-gpio.c
- File: doc/device-tree-bindings/i2c/i2c-gpio.txt

Driver base code is taken from: drivers/i2c/soft-i2c.c, changes:
- use "i2c-gpio" naming
- update comments style
- move preprocesor macros into functions
- add device tree support
- add driver model i2c support
- code cleanup,
- add Kconfig entry

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
Acked-by: Simon Glass <sjg@chromium.org>
Added braces in i2c_gpio_xfer() to fix style nit:
Signed-off-by: Simon Glass <sjg@chromium.org>
2015-04-18 11:11:17 -06:00

38 lines
757 B
Plaintext

I2C gpio device binding
=======================
Driver:
- drivers/i2c/i2c-gpio.c
Software i2c device-tree node properties:
Required:
* #address-cells = <1>;
* #size-cells = <0>;
* compatible = "i2c-gpio";
* gpios = <sda ...>, <scl ...>;
Optional:
* i2c-gpio,delay-us = <5>;
The resulting transfer speed can be adjusted by setting the delay[us]
between gpio-toggle operations. Speed [Hz] = 1000000 / 4 * udelay[us],
It not defined, then default is 5us (~50KHz).
Example:
i2c-gpio@1 {
#address-cells = <1>;
#size-cells = <0>;
compatible = "i2c-gpio";
gpios = <&gpd1 0 GPIO_ACTIVE_HIGH>, /* SDA */
<&gpd1 1 GPIO_ACTIVE_HIGH>; /* CLK */
i2c-gpio,delay-us = <5>;
some_device@5 {
compatible = "some_device";
reg = <0x5>;
...
};
};