summaryrefslogtreecommitdiff
path: root/drivers/misc
diff options
context:
space:
mode:
authorHelmut Raiger <helmut.raiger@hale.at>2011-10-19 20:34:43 +0000
committerTerry Lv <r65388@freescale.com>2012-04-20 13:00:55 +0800
commitb0b3b3afe427a5d4b71b4fe0e1675c2a0568bb13 (patch)
treec383d5ef829434e876004c82191a7dcef464d4f5 /drivers/misc
parent18796325e9e57b1770c593a2690e056efbfbde07 (diff)
downloadu-boot-imx-b0b3b3afe427a5d4b71b4fe0e1675c2a0568bb13.zip
u-boot-imx-b0b3b3afe427a5d4b71b4fe0e1675c2a0568bb13.tar.gz
u-boot-imx-b0b3b3afe427a5d4b71b4fe0e1675c2a0568bb13.tar.bz2
misc: pmic: fix regression in pmic_fsl.c (SPI)
This fixes write access to PMIC registers, the bug was introduced partly in commit 64aac65099 and in commit c9fe76dd91. It was tested on an i.mx31 with a mc13783. Signed-off-by: Helmut Raiger <helmut.raiger@hale.at> Acked-by: Stefano Babic <sbabic@denx.de>
Diffstat (limited to 'drivers/misc')
-rw-r--r--drivers/misc/pmic_fsl.c5
-rw-r--r--drivers/misc/pmic_spi.c3
2 files changed, 2 insertions, 6 deletions
diff --git a/drivers/misc/pmic_fsl.c b/drivers/misc/pmic_fsl.c
index b6e809a..0ff75ed 100644
--- a/drivers/misc/pmic_fsl.c
+++ b/drivers/misc/pmic_fsl.c
@@ -29,10 +29,7 @@
#if defined(CONFIG_PMIC_SPI)
static u32 pmic_spi_prepare_tx(u32 reg, u32 *val, u32 write)
{
- if ((val == NULL) && (write))
- return *val & ~(1 << 31);
- else
- return (write << 31) | (reg << 25) | (*val & 0x00FFFFFF);
+ return (write << 31) | (reg << 25) | (*val & 0x00FFFFFF);
}
#endif
diff --git a/drivers/misc/pmic_spi.c b/drivers/misc/pmic_spi.c
index ff35377..5a0dd22 100644
--- a/drivers/misc/pmic_spi.c
+++ b/drivers/misc/pmic_spi.c
@@ -76,8 +76,7 @@ static u32 pmic_reg(struct pmic *p, u32 reg, u32 *val, u32 write)
}
if (write) {
- pmic_tx = p->hw.spi.prepare_tx(0, NULL, write);
- pmic_tx &= ~(1 << 31);
+ pmic_tx = p->hw.spi.prepare_tx(reg, val, 0);
tmp = cpu_to_be32(pmic_tx);
if (spi_xfer(slave, pmic_spi_bitlen, &tmp, &pmic_rx,
pmic_spi_flags)) {