summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorMateusz Kulikowski <mateusz.kulikowski@gmail.com>2016-01-23 11:54:33 +0100
committerTom Rini <trini@konsulko.com>2016-01-25 10:39:50 -0500
commite7138b34b0def8c015cca74dd4b25d9bc0aca069 (patch)
treedf6bd5e58c19980f88449a823184f467ee6a26ec /drivers
parent8c25c2592e07cb494d1353b98a07638a1cfa2bae (diff)
downloadu-boot-imx-e7138b34b0def8c015cca74dd4b25d9bc0aca069.zip
u-boot-imx-e7138b34b0def8c015cca74dd4b25d9bc0aca069.tar.gz
u-boot-imx-e7138b34b0def8c015cca74dd4b25d9bc0aca069.tar.bz2
net: zynq_gem: Use shared wait_for_bit
Use existing library function to poll bit(s). Signed-off-by: Mateusz Kulikowski <mateusz.kulikowski@gmail.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/zynq_gem.c35
1 files changed, 2 insertions, 33 deletions
diff --git a/drivers/net/zynq_gem.c b/drivers/net/zynq_gem.c
index 7059c84..97e30f3 100644
--- a/drivers/net/zynq_gem.c
+++ b/drivers/net/zynq_gem.c
@@ -19,6 +19,7 @@
#include <asm/io.h>
#include <phy.h>
#include <miiphy.h>
+#include <wait_bit.h>
#include <watchdog.h>
#include <asm/system.h>
#include <asm/arch/hardware.h>
@@ -448,38 +449,6 @@ static int zynq_gem_init(struct udevice *dev)
return 0;
}
-static int wait_for_bit(const char *func, u32 *reg, const u32 mask,
- bool set, unsigned int timeout)
-{
- u32 val;
- unsigned long start = get_timer(0);
-
- while (1) {
- val = readl(reg);
-
- if (!set)
- val = ~val;
-
- if ((val & mask) == mask)
- return 0;
-
- if (get_timer(start) > timeout)
- break;
-
- if (ctrlc()) {
- puts("Abort\n");
- return -EINTR;
- }
-
- udelay(1);
- }
-
- debug("%s: Timeout (reg=%p mask=%08x wait_set=%i)\n",
- func, reg, mask, set);
-
- return -ETIMEDOUT;
-}
-
static int zynq_gem_send(struct udevice *dev, void *ptr, int len)
{
u32 addr, size;
@@ -521,7 +490,7 @@ static int zynq_gem_send(struct udevice *dev, void *ptr, int len)
printf("TX buffers exhausted in mid frame\n");
return wait_for_bit(__func__, &regs->txsr, ZYNQ_GEM_TSR_DONE,
- true, 20000);
+ true, 20000, true);
}
/* Do not check frame_recd flag in rx_status register 0x20 - just poll BD */