between two calls of dm9000_recv_common in eth_rx, it's possible that
hardware get multi packet like a data and an arp or multi data(like tftp
 for window size, RFC7440), check the ISR for status and clear
immediately leads an unexpected behavior while the hardware runs well.

keeping the ISR check could reduce the check behavior of MRCMDX
register, so I just change the pos of clear and run well in larger window size 
of tftp.

Signed-off-by: xslynin <[email protected]>
---
 drivers/net/dm9000x.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/dm9000x.c b/drivers/net/dm9000x.c
index 9e17f0b9c28..14ec85b4308 100644
--- a/drivers/net/dm9000x.c
+++ b/drivers/net/dm9000x.c
@@ -492,8 +492,6 @@ static int dm9000_recv_common(struct dm9000_priv *db, uchar 
*rdptr)
        if (!(dm9000_ior(db, DM9000_ISR) & 0x01)) /* Rx-ISR bit must be set. */
                return 0;
 
-       dm9000_iow(db, DM9000_ISR, 0x01); /* clear PR status latched in bit 0 */
-
        /* There is _at least_ 1 package in the fifo, read them all */
        dm9000_ior(db, DM9000_MRCMDX);  /* Dummy read */
 
@@ -512,8 +510,10 @@ static int dm9000_recv_common(struct dm9000_priv *db, 
uchar *rdptr)
                return -EINVAL;
        }
 
-       if (rxbyte != DM9000_PKT_RDY)
+       if (rxbyte != DM9000_PKT_RDY) {
+               dm9000_iow(db, DM9000_ISR, 0x01); /* clear PR status latched in 
bit 0 */
                return 0; /* No packet received, ignore */
+       }
 
        debug("receiving packet\n");
 
-- 
2.34.1

Reply via email to