[U-Boot] [PATCH 13/13] misc: pmic: drop old Freescale's pmic driver

Helmut Raiger
2011-10-19T13:23:27Z

On 10/08/2011 06:36 PM, Stefano Babic wrote:
> Signed-off-by: Stefano Babic<sbabic@denx.de>
> ---
> drivers/misc/Makefile | 1 -
> drivers/misc/fsl_pmic.c | 235 -----------------------------------------------
> 2 files changed, 0 insertions(+), 236 deletions(-)
> delete mode 100644 drivers/misc/fsl_pmic.c
>
I just checked PMIC action on our board (i.mx31 and mc13783) and the new
code is not working here, it even:

TT01> pmic write 20 17
raise: Signal # 8 caught
<reg num> = 32 is invalid. Should be less than 0
TT01> pmic read 20
<reg num> = 32 is invalid. Should be less than 0
PMIC: Register read failed

0x20: 0x00000000

At first glance I found in pmic_fsl.c:

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);
}

which must be wrong. NULL is de-referenced in both cases and this error
is even forced by pmic_spi.c:

if (write) {
pmic_tx = p->hw.spi.prepare_tx(0, NULL, write);
pmic_tx &= ~(1 << 31);

Probably val == NULL was meant as escape not to touch the pmic_tx value,
in the original driver it's done that way.
One could fix this by using a static variable in pmic_spi_prepare_tx(),
but I'm
not sure if this was the intention.

I wonder why it was missed during testing as it seems configuration
independent.
Helmut

--
Scanned by MailScanner.