Simon Kagstrom | 2 Jul 15:02
Favicon

[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;

 	if ((u32) dataptr & 0x07) {
 		printf("Err..(%s) xmit dataptr not 64bit aligned\n",
--

-- 
1.6.0.4

Gmane