[U-Boot] [PATCH v7 2/6] spi: cadence_qspi: fix indirect read/write start address

Wolfgang Denk wd at denx.de
Thu Sep 24 09:18:39 CEST 2015


Dear Vikas,

In message <1443053976-9112-3-git-send-email-vikas.manocha at st.com> you wrote:
> Indirect read/write start addresses are flash start addresses for indirect read
> or write transfers. These should be absolute flash addresses instead of
> offsets.
...
>  	/* Get address */
>  	addr_value = cadence_qspi_apb_cmd2addr(&cmdbuf[1], addr_bytes);
> -	writel(addr_value, plat->regbase + CQSPI_REG_INDIRECTRDSTARTADDR);
> +	writel((u32)plat->ahbbase + addr_value,
> +	       plat->regbase + CQSPI_REG_INDIRECTRDSTARTADDR);
...
>  	/* Setup write address. */
>  	reg = cadence_qspi_apb_cmd2addr(&cmdbuf[1], addr_bytes);
> -	writel(reg, plat->regbase + CQSPI_REG_INDIRECTWRSTARTADDR);
> +	writel((u32)plat->ahbbase + reg,
> +	       plat->regbase + CQSPI_REG_INDIRECTWRSTARTADDR);

As has been pointed out before, adding type casts to silence compiler
warnings is inherently wrong.  The compiler issues a warning here to
tell you that your code is broken, so you should fix your code and not
silence the warning to paper over it.

Please fix.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Voodoo Programming: Things programmers do that  they  know  shouldn't
work  but they try anyway, and which sometimes actually work, such as
recompiling everything.                             - Karl Lehenbauer


More information about the U-Boot mailing list