[U-Boot] [PATCH 1/3]: arm: Kirkwood: Fix compiler optimization bug for kwgbe_send
Prafulla Wadaskar
prafulla at marvell.com
Fri Jul 3 06:36:19 CEST 2009
> -----Original Message-----
> From: u-boot-bounces at lists.denx.de
> [mailto:u-boot-bounces at lists.denx.de] On Behalf Of Simon Kagstrom
> Sent: Thursday, July 02, 2009 6:32 PM
> To: Simon Kagstrom
> Cc: U-Boot ML
> Subject: [U-Boot] [PATCH 1/3]: arm: Kirkwood: Fix compiler
> optimization bug for kwgbe_send
>
> Fix compiler optimization bug for kwgbe_send
>
> kwgbe_send/recv both have loops waiting for the hardware to
> set a bit.
> GCC 4.3.3 cleverly optimizes the send case to ... a while(1);
> loop. This patch makes the structure volatile to force
> re-loading of the transmit descriptor.
>
> Signed-off-by: Simon Kagstrom <simon.kagstrom at netinsight.net>
> ---
> drivers/net/kirkwood_egiga.c | 6 +++---
> 1 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/net/kirkwood_egiga.c
> b/drivers/net/kirkwood_egiga.c index 3c5db19..db55d9d 100644
> --- a/drivers/net/kirkwood_egiga.c
> +++ b/drivers/net/kirkwood_egiga.c
> @@ -484,9 +484,9 @@ static int kwgbe_halt(struct eth_device
> *dev) static int kwgbe_send(struct eth_device *dev, volatile
> void *dataptr,
> int datasize)
> {
> - struct kwgbe_device *dkwgbe = to_dkwgbe(dev);
> - struct kwgbe_registers *regs = dkwgbe->regs;
> - struct kwgbe_txdesc *p_txdesc = dkwgbe->p_txdesc;
> + volatile struct kwgbe_device *dkwgbe = to_dkwgbe(dev);
> + volatile struct kwgbe_registers *regs = dkwgbe->regs;
> + volatile struct kwgbe_txdesc *p_txdesc = dkwgbe->p_txdesc;
Only p_txdesc needed volatile, not others...
Regards ....
Prafulla . .
More information about the U-Boot
mailing list