
Le 11/02/2011 23:25, Wolfgang Denk a écrit :
Commit 3c0659b "ARM: Avoid compiler optimization for readb, writeb and friends." introduced I/O accessors with memory barriers. Unfortunately the new write*() accessors introduced a bug:
The problem is that the argument "v" gets evaluated twice. This breaks code like used here (from "drivers/net/dnet.c"):
for (i = 0; i< wrsz; i++) writel(*bufp++,&dnet->regs->TX_DATA_FIFO);
Use auxiliary variables to avoid such problems.
Signed-off-by: Wolfgang Denkwd@denx.de Cc: Albert Aribaudalbert.aribaud@free.fr Cc: Alexander Hollerholler@ahsoftware.de Cc: Dirk Behmedirk.behme@googlemail.com
This patch fixes a pretty nasty problem. Everybody who has experienced strange failures on ARM lately should apply it ASAP and re-test. As far as I can tell at least the following drivers are affected:
drivers/net/dnet.c: writel(*bufp++,&dnet->regs->TX_DATA_FIFO); drivers/usb/musb/musb_core.c: writeb(*data++,&musbr->fifox[ep]); drivers/mmc/pxa_mmc.c: writel(*src++, MMC_TXFIFO); drivers/mmc/mxcmmc.c: writel(*buf++,&host->base->buffer_access); drivers/spi/davinci_spi.c: writel(data1_reg_val | *txp++,&ds->regs->dat1);
Albert, please apply ASAP!
Applied, available on u-boot-arm/master.
Amicalement,