[U-Boot] [Resend PATCH V2] misc: pmic: fix regression in pmic_fsl.c (SPI)

Stefano Babic sbabic at denx.de
Thu Oct 20 09:31:44 CEST 2011


On 10/20/2011 08:34 AM, Helmut Raiger wrote:
> 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 at hale.at>
> ---
>  V2: threw in the wrong read back line (again and again)
> 

Hi Helmut,

>  drivers/misc/pmic_fsl.c |    5 +----
>  drivers/misc/pmic_spi.c |    3 +--
>  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)) {

Right. I wait just a bit for further comments, then I will push to
u-boot-imx.

Acked-by: Stefano Babic <sbabic at denx.de>

Best regards,
Stefano Babic

-- 
=====================================================================
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80  Email: office at denx.de
=====================================================================


More information about the U-Boot mailing list