From: Simon Kagstrom Date: Fri, 3 Jul 2009 10:18:59 +0200 Subject: [U-Boot] [PATCH 1/3]: arm: Kirkwood: Fix compiler optimization bug for kwgbe_send In-Reply-To: <73173D32E9439E4ABB5151606C3E19E201EA4C0592@SC-VEXCH1.marvell.com> References: <20090702150213.21ef8efb@marrow.netinsight.se> <73173D32E9439E4ABB5151606C3E19E201EA4C0592@SC-VEXCH1.marvell.com> Message-ID: <20090703101859.0d9f0e84@marrow.netinsight.se> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Thanks for the comments Prafulla! On Thu, 2 Jul 2009 21:36:19 -0700 Prafulla Wadaskar wrote: > > + 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... Right - I just took the approach from kwgbe_recv. Here is an updated patch which only makes the transmit descriptor volatile. // Simon -- 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 --- drivers/net/kirkwood_egiga.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/drivers/net/kirkwood_egiga.c b/drivers/net/kirkwood_egiga.c index 3c5db19..b8a771f 100644 --- a/drivers/net/kirkwood_egiga.c +++ b/drivers/net/kirkwood_egiga.c @@ -486,7 +486,7 @@ static int kwgbe_send(struct eth_device *dev, volatile void *dataptr, { struct kwgbe_device *dkwgbe = to_dkwgbe(dev); struct kwgbe_registers *regs = dkwgbe->regs; - struct kwgbe_txdesc *p_txdesc = dkwgbe->p_txdesc; + volatile struct kwgbe_txdesc *p_txdesc = dkwgbe->p_txdesc; if ((u32) dataptr & 0x07) { printf("Err..(%s) xmit dataptr not 64bit aligned\n", -- 1.6.0.4