@@ -111,7 +111,6 @@ static struct platform_device davinci_nand_device = {
static struct davinci_i2c_platform_data i2c_pdata = {
.bus_freq = 400 /* kHz */,
.bus_delay = 0 /* usec */,
- .sda_pin = 15,
.scl_pin = 14,
};
@@ -629,7 +629,6 @@ static struct i2c_board_info __initdata i2c_info[] = {
static struct davinci_i2c_platform_data i2c_pdata = {
.bus_freq = 20 /* kHz */,
.bus_delay = 100 /* usec */,
- .sda_pin = 44,
.scl_pin = 43,
};
@@ -16,8 +16,7 @@
struct davinci_i2c_platform_data {
unsigned int bus_freq; /* standard bus frequency (kHz) */
unsigned int bus_delay; /* post-transaction delay (usec) */
- unsigned int sda_pin; /* GPIO pin ID to use for SDA */
- unsigned int scl_pin; /* GPIO pin ID to use for SCL */
+ unsigned int scl_pin; /* GPIO pin ID to use for SCL */
};
/* for board setup code */
@@ -64,6 +64,7 @@
#define DAVINCI_I2C_IVR_REG 0x28
#define DAVINCI_I2C_EMDR_REG 0x2c
#define DAVINCI_I2C_PSC_REG 0x30
+#define DAVINCI_I2C_REVID2_REG 0x38
#define DAVINCI_I2C_IVR_AAS 0x07
#define DAVINCI_I2C_IVR_SCD 0x06
@@ -133,11 +134,21 @@ static inline u16 davinci_i2c_read_reg(struct davinci_i2c_dev *i2c_dev, int reg)
}
/* Generate a pulse on the i2c clock pin. */
-static void generic_i2c_clock_pulse(unsigned int scl_pin)
+static void generic_i2c_clock_pulse(unsigned int revid, unsigned int scl_pin)
{
u16 i;
+ int ret;
if (scl_pin) {
+ if (revid == 0x05) {
+ ret = gpio_request(scl_pin, "SCL Pin\n");
+ if (ret) {
+ pr_warning("gpio request pin %d failed\n",
+ scl_pin);
+ return;
+ }
+ gpio_direction_output(scl_pin, 1);
+ }
/* Send high and low on the SCL line */
for (i = 0; i < 9; i++) {
gpio_set_value(scl_pin, 0);
@@ -162,8 +173,10 @@ static void i2c_recover_bus(struct davinci_i2c_dev *dev)
flag |= DAVINCI_I2C_MDR_NACK;
/* write the data into mode register */
davinci_i2c_write_reg(dev, DAVINCI_I2C_MDR_REG, flag);
- if (pdata)
- generic_i2c_clock_pulse(pdata->scl_pin);
+ if (pdata) {
+ flag = davinci_i2c_read_reg(dev, DAVINCI_I2C_REVID2_REG);
+ generic_i2c_clock_pulse(flag, pdata->scl_pin);
+ }
/* Send STOP */
flag = davinci_i2c_read_reg(dev, DAVINCI_I2C_MDR_REG);
flag |= DAVINCI_I2C_MDR_STP;