diff options
author | Wayne Zou <b36644@freescale.com> | 2011-08-08 10:12:32 +0800 |
---|---|---|
committer | Alex Gonzalez <alex.gonzalez@digi.com> | 2012-01-17 15:56:51 +0100 |
commit | a5800eb518a4c8997f9a18386857431c9c6b148f (patch) | |
tree | f551e0301b1fefa5c7625d3b73fc75c54e634235 /drivers | |
parent | 89fa2e38506f286367bc0a64ba3f41dad10f8d2c (diff) |
ENGR00154432 PMIC DA9053: fix I2C NAK for first access and shutdown issue
During the platform boot up, during the platform does DA9053 Read/Write
operation, it writes slave address and wait for ACK . Instead of ACK
PMIC sends NAK. A workaround fix is provided as a part of retries
fix I2C NAK for very first access.
Also fix a bug when the system fails to start after software shutdown.
Signed-off-by: Wayne Zou <b36644@freescale.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/mfd/da9052-i2c.c | 30 |
1 files changed, 14 insertions, 16 deletions
diff --git a/drivers/mfd/da9052-i2c.c b/drivers/mfd/da9052-i2c.c index 28a8ca8d8507..3a1011682224 100644 --- a/drivers/mfd/da9052-i2c.c +++ b/drivers/mfd/da9052-i2c.c @@ -21,23 +21,21 @@ static struct da9052 *da9052_i2c; static int da9052_i2c_is_connected(void) { + struct da9052_ssc_msg msg; + int retries = 10, ret = -1; + + msg.addr = DA9052_INTERFACE_REG; + do { + /* Test i2c connectivity by reading the GPIO_0-1 register */ + if (0 != da9052_i2c_read(da9052_i2c, &msg)) { + printk(KERN_INFO"da9052_i2c_is_connected - i2c read failed.....\n"); + } else { + printk(KERN_INFO"da9052_i2c_is_connected - i2c read success....\n"); + ret = 0; + } + } while (ret != 0 && retries--); - struct da9052_ssc_msg msg; - - //printk("Entered da9052_i2c_is_connected.............\n"); - - msg.addr = DA9052_INTERFACE_REG; - - /* Test spi connectivity by performing read of the GPIO_0-1 register */ - if ( 0 != da9052_i2c_read(da9052_i2c, &msg)) { - printk("da9052_i2c_is_connected - i2c read failed.............\n"); - return -1; - } - else { - printk("da9052_i2c_is_connected - i2c read success..............\n"); - return 0; - } - + return ret; } static int __devinit da9052_i2c_probe(struct i2c_client *client, |