[U-Boot] [PATCH] mmc: rmobile: add a compiler barrier

Nobuhiro Iwamatsu iwamatsu at nigauri.org
Tue Jun 7 02:16:04 CEST 2016


Applied, thanks.

Best regards,
  Nobuhiro

2016-04-04 18:49 GMT+09:00 Yannick Gicquel <yannick.gicquel at iot.bzh>:
> Building w/ GCC v5.2, the SD card access is broken due to invalid data
> in the response command reconstructed at the end of
> sh_sdhci_get_response().
>
> Add a memory barrier between the two main steps of this function to
> ensure the resp[] table content is consistent before bits reordering.
>
> This fix has been tested Ok on Porter board rev1.0 using v2016.03
> release.
>
> Signed-off-by: Yannick Gicquel <yannick.gicquel at iot.bzh>
> ---
>  drivers/mmc/sh_sdhi.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/drivers/mmc/sh_sdhi.c b/drivers/mmc/sh_sdhi.c
> index 30e538c..dc4c686 100644
> --- a/drivers/mmc/sh_sdhi.c
> +++ b/drivers/mmc/sh_sdhi.c
> @@ -430,6 +430,9 @@ static void sh_sdhi_get_response(struct sh_sdhi_host *host, struct mmc_cmd *cmd)
>         }
>
>         p2 = (unsigned long *)cmd->response;
> +
> +       barrier();
> +
>  #if defined(__BIG_ENDIAN_BITFIELD)
>         for (i = 0; i < cnt; i++) {
>                 *p2++ = ((*p1 >> 16) & 0x0000ffff) |
> --
> 1.9.1
>



-- 
Nobuhiro Iwamatsu
   iwamatsu at {nigauri.org / debian.org}
   GPG ID: 40AD1FA6


More information about the U-Boot mailing list