|
13 | 13 | #include <linux/dma-mapping.h> |
14 | 14 | #include <linux/platform_device.h> |
15 | 15 | #include <linux/gpio.h> |
| 16 | +#include <linux/gpio/machine.h> |
16 | 17 | #include <linux/i2c.h> |
17 | 18 | #include <linux/platform_data/pcf857x.h> |
18 | 19 | #include <linux/platform_data/at24.h> |
@@ -595,18 +596,28 @@ static struct i2c_board_info __initdata i2c_info[] = { |
595 | 596 | }, |
596 | 597 | }; |
597 | 598 |
|
| 599 | +static struct gpiod_lookup_table i2c_recovery_gpiod_table = { |
| 600 | + .dev_id = "i2c_davinci", |
| 601 | + .table = { |
| 602 | + GPIO_LOOKUP("davinci_gpio", 44, "sda", |
| 603 | + GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN), |
| 604 | + GPIO_LOOKUP("davinci_gpio", 43, "scl", |
| 605 | + GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN), |
| 606 | + }, |
| 607 | +}; |
| 608 | + |
598 | 609 | /* The msp430 uses a slow bitbanged I2C implementation (ergo 20 KHz), |
599 | 610 | * which requires 100 usec of idle bus after i2c writes sent to it. |
600 | 611 | */ |
601 | 612 | static struct davinci_i2c_platform_data i2c_pdata = { |
602 | 613 | .bus_freq = 20 /* kHz */, |
603 | 614 | .bus_delay = 100 /* usec */, |
604 | | - .sda_pin = 44, |
605 | | - .scl_pin = 43, |
| 615 | + .gpio_recovery = true, |
606 | 616 | }; |
607 | 617 |
|
608 | 618 | static void __init evm_init_i2c(void) |
609 | 619 | { |
| 620 | + gpiod_add_lookup_table(&i2c_recovery_gpiod_table); |
610 | 621 | davinci_init_i2c(&i2c_pdata); |
611 | 622 | i2c_add_driver(&dm6446evm_msp_driver); |
612 | 623 | i2c_register_board_info(1, i2c_info, ARRAY_SIZE(i2c_info)); |
|
0 commit comments