Skip to content

Commit a29aaf5

Browse files
Moiz SonasathSamuel Ortiz
authored andcommitted
mfd: Disable TWL4030/5030 I2C1/I2C4 internal pull-ups
This patch disables TWL4030/5030 I2C1 adn I2C4(SR) internal pull-up, to use only the external HW resistor >=470 Ohm for the assured functionality in HS mode. While testing the I2C in High Speed mode, it was discovered that without a proper pull-up resistor, there is data corruption during multi-byte transfer. RTC(time_set) test case was used for testing. From the analysis done, it was concluded that ideally we need a pull-up of 1.6k Ohm(recomended) or atleast 470 Ohm or greater for assured performance in HS mode. Signed-off-by: Moiz Sonasath <m-sonasath@ti.com> Signed-off-by: Allen Pais <allen.pais@ti.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
1 parent e82c60a commit a29aaf5

2 files changed

Lines changed: 28 additions & 0 deletions

File tree

‎drivers/mfd/twl-core.c‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -958,6 +958,7 @@ twl_probe(struct i2c_client *client, const struct i2c_device_id *id)
958958
int status;
959959
unsigned i;
960960
struct twl4030_platform_data *pdata = client->dev.platform_data;
961+
u8 temp;
961962

962963
if (!pdata) {
963964
dev_dbg(&client->dev, "no platform data?\n");
@@ -1025,6 +1026,18 @@ twl_probe(struct i2c_client *client, const struct i2c_device_id *id)
10251026
goto fail;
10261027
}
10271028

1029+
/* Disable TWL4030/TWL5030 I2C Pull-up on I2C1 and I2C4(SR) interface.
1030+
* Program I2C_SCL_CTRL_PU(bit 0)=0, I2C_SDA_CTRL_PU (bit 2)=0,
1031+
* SR_I2C_SCL_CTRL_PU(bit 4)=0 and SR_I2C_SDA_CTRL_PU(bit 6)=0.
1032+
*/
1033+
1034+
if (twl_class_is_4030()) {
1035+
twl_i2c_read_u8(TWL4030_MODULE_INTBR, &temp, REG_GPPUPDCTR1);
1036+
temp &= ~(SR_I2C_SDA_CTRL_PU | SR_I2C_SCL_CTRL_PU | \
1037+
I2C_SDA_CTRL_PU | I2C_SCL_CTRL_PU);
1038+
twl_i2c_write_u8(TWL4030_MODULE_INTBR, temp, REG_GPPUPDCTR1);
1039+
}
1040+
10281041
status = add_children(pdata, id->driver_data);
10291042
fail:
10301043
if (status < 0)

‎include/linux/i2c/twl.h‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,21 @@ int twl6030_interrupt_mask(u8 bit_mask, u8 offset);
239239

240240
/*----------------------------------------------------------------------*/
241241

242+
/*Interface Bit Register (INTBR) offsets
243+
*(Use TWL_4030_MODULE_INTBR)
244+
*/
245+
246+
#define REG_GPPUPDCTR1 0x0F
247+
248+
/*I2C1 and I2C4(SR) SDA/SCL pull-up control bits */
249+
250+
#define I2C_SCL_CTRL_PU BIT(0)
251+
#define I2C_SDA_CTRL_PU BIT(2)
252+
#define SR_I2C_SCL_CTRL_PU BIT(4)
253+
#define SR_I2C_SDA_CTRL_PU BIT(6)
254+
255+
/*----------------------------------------------------------------------*/
256+
242257
/*
243258
* Keypad register offsets (use TWL4030_MODULE_KEYPAD)
244259
* ... SIH/interrupt only

0 commit comments

Comments
 (0)