]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
zynq_gem: Fix incorrect clearing of RX_STATUS
authorPeter Crosthwaite <peter.crosthwaite@xilinx.com>
Sat, 5 Jan 2013 03:57:21 +0000 (13:57 +1000)
committerMichal Simek <michal.simek@xilinx.com>
Wed, 9 Jan 2013 14:46:53 +0000 (15:46 +0100)
The RX_STATUS register was being cleared after servicing the underlying event.
This is incorrect as if another packet is received after the service routine
(Xgmac_process_rx()) returns, then the frame-received flag for the new packet
will be cleared. U-boot will then completely miss the new packet even though
the hardware has sucessfully received it.

Fixed by clearing the RX_STATUS register immediately after polling.

Reported-by: Jason Wu <huanyu@xilinx.com>
Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
drivers/net/zynq_gem_wrap.c

index c4ef62f159424dcb6badc79ae58fa68d59e475ff..62adce2bb0099e50febd5837f931c33f55a73d61 100644 (file)
@@ -498,6 +498,8 @@ int Xgmac_rx(struct eth_device *dev)
        status =
            XEmacPss_ReadReg(EmacPssInstancePtr->Config.BaseAddress,
                             XEMACPSS_RXSR_OFFSET);
+       XEmacPss_WriteReg(EmacPssInstancePtr->Config.BaseAddress,
+                               XEMACPSS_RXSR_OFFSET, status);
        if (status & XEMACPSS_RXSR_FRAMERX_MASK) {
 
 //             printf("rx packet received\n");
@@ -507,11 +509,6 @@ int Xgmac_rx(struct eth_device *dev)
                } while (retval == 0) ;
        }
 
-       /* Clear interrupt status.
-        */
-       XEmacPss_WriteReg(EmacPssInstancePtr->Config.BaseAddress,
-                         XEMACPSS_RXSR_OFFSET, status);
-
        return 1;
 }