summaryrefslogtreecommitdiff
path: root/drivers/misc/fsl_pmic.c
diff options
context:
space:
mode:
authorWolfgang Denk <wd@denx.de>2010-10-11 10:19:04 +0200
committerWolfgang Denk <wd@denx.de>2010-10-11 10:19:04 +0200
commite67f46286440a53fb1d693152667ea3b1a6b3060 (patch)
tree3fdedda3a9122785e07e209ab6a5a0fc7fd65fd7 /drivers/misc/fsl_pmic.c
parentbfc7bea6adc46e1db2f5a5e3464d7652ed67c864 (diff)
parentf8f8acd7249d224ed5f9704a5738c469b137bc8e (diff)
downloadu-boot-imx-e67f46286440a53fb1d693152667ea3b1a6b3060.zip
u-boot-imx-e67f46286440a53fb1d693152667ea3b1a6b3060.tar.gz
u-boot-imx-e67f46286440a53fb1d693152667ea3b1a6b3060.tar.bz2
Merge branch 'master' of git://git.denx.de/u-boot-imx
Diffstat (limited to 'drivers/misc/fsl_pmic.c')
-rw-r--r--drivers/misc/fsl_pmic.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/drivers/misc/fsl_pmic.c b/drivers/misc/fsl_pmic.c
index dca0a1d..5ee1de1 100644
--- a/drivers/misc/fsl_pmic.c
+++ b/drivers/misc/fsl_pmic.c
@@ -46,6 +46,7 @@ void pmic_spi_free(struct spi_slave *slave)
u32 pmic_reg(u32 reg, u32 val, u32 write)
{
u32 pmic_tx, pmic_rx;
+ u32 tmp;
if (!slave) {
slave = pmic_spi_probe();
@@ -65,7 +66,9 @@ u32 pmic_reg(u32 reg, u32 val, u32 write)
pmic_tx = (write << 31) | (reg << 25) | (val & 0x00FFFFFF);
- if (spi_xfer(slave, 4 << 3, &pmic_tx, &pmic_rx,
+ tmp = cpu_to_be32(pmic_tx);
+
+ if (spi_xfer(slave, 4 << 3, &tmp, &pmic_rx,
SPI_XFER_BEGIN | SPI_XFER_END)) {
spi_release_bus(slave);
return -1;
@@ -73,7 +76,8 @@ u32 pmic_reg(u32 reg, u32 val, u32 write)
if (write) {
pmic_tx &= ~(1 << 31);
- if (spi_xfer(slave, 4 << 3, &pmic_tx, &pmic_rx,
+ tmp = cpu_to_be32(pmic_tx);
+ if (spi_xfer(slave, 4 << 3, &tmp, &pmic_rx,
SPI_XFER_BEGIN | SPI_XFER_END)) {
spi_release_bus(slave);
return -1;
@@ -81,7 +85,7 @@ u32 pmic_reg(u32 reg, u32 val, u32 write)
}
spi_release_bus(slave);
- return pmic_rx;
+ return cpu_to_be32(pmic_rx);
}
void pmic_reg_write(u32 reg, u32 value)