diff options
author | Michal Simek <michal.simek@xilinx.com> | 2015-12-10 14:42:01 (GMT) |
---|---|---|
committer | Michal Simek <michal.simek@xilinx.com> | 2016-01-27 14:55:52 (GMT) |
commit | 26c7945a24b8bd5565e9b1481dac10ff14eca177 (patch) | |
tree | b5fb25a587279f78289672f677e1946159ed0ca3 /drivers/net | |
parent | 5a4baa33e4d0beb9708719160bfc3f91a8f9f3bf (diff) | |
download | u-boot-fsl-qoriq-26c7945a24b8bd5565e9b1481dac10ff14eca177.tar.xz |
net: emaclite: Fix logic around available TX buffers
Simplify logic how to find out if there is free TX buffer.
Both buffers are checked all the time that's why logic around order
can be removed.
Also add check when only one buffer is available.
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/xilinx_emaclite.c | 24 |
1 files changed, 8 insertions, 16 deletions
diff --git a/drivers/net/xilinx_emaclite.c b/drivers/net/xilinx_emaclite.c index 72b6e0a..b0c2635 100644 --- a/drivers/net/xilinx_emaclite.c +++ b/drivers/net/xilinx_emaclite.c @@ -379,28 +379,20 @@ static int emaclite_init(struct eth_device *dev, bd_t *bis) return 0; } -static int xemaclite_txbufferavailable(struct eth_device *dev) +static int xemaclite_txbufferavailable(struct xemaclite *emaclite) { - u32 reg; - u32 txpingbusy; - u32 txpongbusy; - struct xemaclite *emaclite = dev->priv; + u32 tmp; + struct emaclite_regs *regs = emaclite->regs; /* * Read the other buffer register * and determine if the other buffer is available */ - reg = in_be32 (dev->iobase + - emaclite->nexttxbuffertouse + 0); - txpingbusy = ((reg & XEL_TSR_XMIT_BUSY_MASK) == - XEL_TSR_XMIT_BUSY_MASK); - - reg = in_be32 (dev->iobase + - (emaclite->nexttxbuffertouse ^ XEL_TSR_OFFSET) + 0); - txpongbusy = ((reg & XEL_TSR_XMIT_BUSY_MASK) == - XEL_TSR_XMIT_BUSY_MASK); + tmp = ~in_be32(®s->tx_ping_tsr); + if (emaclite->txpp) + tmp |= ~in_be32(®s->tx_pong_tsr); - return !(txpingbusy && txpongbusy); + return !(tmp & XEL_TSR_XMIT_BUSY_MASK); } static int emaclite_send(struct eth_device *dev, void *ptr, int len) @@ -415,7 +407,7 @@ static int emaclite_send(struct eth_device *dev, void *ptr, int len) if (len > PKTSIZE) len = PKTSIZE; - while (!xemaclite_txbufferavailable(dev) && maxtry) { + while (xemaclite_txbufferavailable(emaclite) && maxtry) { udelay(10); maxtry--; } |