[U-Boot] [PATCH 1/3]: arm: Kirkwood: Fix compiler optimization bug for kwgbe_send

Simon Kagstrom simon.kagstrom at netinsight.net
Fri Jul 3 10:18:59 CEST 2009


Thanks for the comments Prafulla!

On Thu, 2 Jul 2009 21:36:19 -0700
Prafulla Wadaskar <prafulla at marvell.com> 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 <simon.kagstrom at netinsight.net>
---
 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


More information about the U-Boot mailing list