summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Hemp <c.hemp@phytec.de>2014-01-09 10:54:37 +0100
committerJustin Waters <justin.waters@timesys.com>2014-05-14 14:13:29 -0400
commite5f3bd7b9d300cdc5794bbaa69316d2f332112c5 (patch)
tree25fde7878df69b556d19344195755c5b64f7a421
parent8935241147f6848f84bc9e721f51ae47cd18c923 (diff)
mfd: da9063: disable timeout feature
This patch fix bug report #131: i.MX6 crashes: voltage too low | Sometimes, after voltage scaling, the processor hangs. It seems, that the | voltage is set too low for appropriate frequency setting. | | It seems that the problem occurs only if the delay between two message bits | (e.g. between Send Slave address write command and send data command) is | greater than 23ms. If this delay occurs, the PMIC seems to reset the I2C | interface and so doesn't react to the other bits of the message (e.g. by | not sending a ACK). If we deactivate the I2C timeout feature the module runs stable. Signed-off-by: Christian Hemp <c.hemp@phytec.de>
-rw-r--r--drivers/mfd/da9063-core.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/drivers/mfd/da9063-core.c b/drivers/mfd/da9063-core.c
index 8c4fb8d570f3..16d29ccd3b87 100644
--- a/drivers/mfd/da9063-core.c
+++ b/drivers/mfd/da9063-core.c
@@ -147,6 +147,37 @@ out:
return val;
}
+int da9063_page_reg_write(struct da9063 *da9063, u16 reg, u8 val)
+{
+ u8 pmic_page = DA9063_I2C_PAGE(reg);
+ u8 pmic_reg = DA9063_I2C_REG(reg);
+ int ret, ret2;
+
+ mutex_lock(&da9063->io_mutex);
+
+ if (pmic_page != DA9063_REG_PAGE0) {
+ ret = da9063_write_device(da9063, DA9063_REG_PAGE_CON, 1,
+ &pmic_page);
+
+ if (ret)
+ goto out;
+ }
+
+ ret = da9063_write_device(da9063, pmic_reg, 1, &val);
+
+ if (pmic_page != DA9063_REG_PAGE0) {
+ pmic_page = DA9063_REG_PAGE0;
+ ret2 = da9063_write_device(da9063, DA9063_REG_PAGE_CON, 1,
+ &pmic_page);
+ if (ret2 && ret == 0)
+ ret = ret2;
+ }
+out:
+ mutex_unlock(&da9063->io_mutex);
+
+ return ret;
+}
+
int da9063_reg_read(struct da9063 *da9063, u16 reg)
{
u8 val;
@@ -288,6 +319,7 @@ int da9063_device_init(struct da9063 *da9063, unsigned int irq)
{
struct da9063_pdata *pdata = da9063->dev->platform_data;
int ret = 0;
+ int val;
mutex_init(&da9063->io_mutex);
@@ -334,6 +366,11 @@ int da9063_device_init(struct da9063 *da9063, unsigned int irq)
if (ret)
dev_err(da9063->dev, "Cannot add MFD cells\n");
+ val = da9063_page_reg_read(da9063, DA9063_REG_CONFIG_J);
+ da9063_page_reg_write(da9063, DA9063_REG_CONFIG_J, val & ~0x40);
+ if (ret)
+ dev_err(da9063->dev, "Cannot set register correct\n");
+
dev_info(da9063->dev, "Device detected DA9063\n" );
return ret;