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>
This commit is contained in:
Helmut Raiger 2011-10-19 20:34:43 +00:00 committed by Albert ARIBAUD
parent 28b119e933
commit 435a728587
2 changed files with 2 additions and 6 deletions

View File

@ -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

View File

@ -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)) {