summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorƁukasz Majewski <l.majewski@samsung.com>2012-11-13 03:21:52 +0000
committerAnatolij Gustschin <agust@denx.de>2012-11-14 11:21:07 +0100
commitb5bf9cafea246a6572c122bb3971cb48f50fc9ce (patch)
tree87e1757094ee1a44bef2ba26fff14fc8adef4bc2 /drivers
parenta6d0f62a0ccac7669b1efe320e28c276b1b8084b (diff)
downloadu-boot-imx-b5bf9cafea246a6572c122bb3971cb48f50fc9ce.zip
u-boot-imx-b5bf9cafea246a6572c122bb3971cb48f50fc9ce.tar.gz
u-boot-imx-b5bf9cafea246a6572c122bb3971cb48f50fc9ce.tar.bz2
pmic:i2c: Handle PMIC I2C transmission comprising of two bytes
This patch adds support for proper handling of a PMIC I2C transmission comprising of two bytes. Signed-off-by: Lukasz Majewski <l.majewski@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Cc: Stefano Babic <sbabic@denx.de>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/misc/pmic_i2c.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/drivers/misc/pmic_i2c.c b/drivers/misc/pmic_i2c.c
index 95a3365..e74c372 100644
--- a/drivers/misc/pmic_i2c.c
+++ b/drivers/misc/pmic_i2c.c
@@ -44,6 +44,10 @@ int pmic_reg_write(struct pmic *p, u32 reg, u32 val)
buf[1] = (val >> 8) & 0xff;
buf[2] = val & 0xff;
break;
+ case 2:
+ buf[0] = (val >> 8) & 0xff;
+ buf[1] = val & 0xff;
+ break;
case 1:
buf[0] = val & 0xff;
break;
@@ -73,6 +77,9 @@ int pmic_reg_read(struct pmic *p, u32 reg, u32 *val)
case 3:
ret_val = buf[0] << 16 | buf[1] << 8 | buf[2];
break;
+ case 2:
+ ret_val = buf[0] << 8 | buf[1];
+ break;
case 1:
ret_val = buf[0];
break;
@@ -88,7 +95,7 @@ int pmic_reg_read(struct pmic *p, u32 reg, u32 *val)
int pmic_probe(struct pmic *p)
{
I2C_SET_BUS(p->bus);
- debug("PMIC:%s probed!\n", p->name);
+ debug("Bus: %d PMIC:%s probed!\n", p->bus, p->name);
if (i2c_probe(pmic_i2c_addr)) {
printf("Can't find PMIC:%s\n", p->name);
return -1;