summaryrefslogtreecommitdiff
path: root/sys/arch/armv7/imx
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@cvs.openbsd.org>2018-03-11 17:58:53 +0000
committerMark Kettenis <kettenis@cvs.openbsd.org>2018-03-11 17:58:53 +0000
commitba3e15997e1463a817692444c9e59ae15204a81d (patch)
tree8b940c5a18eb79c97395677330056a920d0d4bea /sys/arch/armv7/imx
parent550302f8427d89f30665f0c29772f1f42660913c (diff)
Wait for ETHEREN bit to clear instead of the RESET bit to prevent an
infinite loop on some i.MX6 boards. From Artturi Alm.
Diffstat (limited to 'sys/arch/armv7/imx')
-rw-r--r--sys/arch/armv7/imx/if_fec.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/sys/arch/armv7/imx/if_fec.c b/sys/arch/armv7/imx/if_fec.c
index 899c1904144..4e52631a578 100644
--- a/sys/arch/armv7/imx/if_fec.c
+++ b/sys/arch/armv7/imx/if_fec.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_fec.c,v 1.20 2017/01/22 10:17:37 dlg Exp $ */
+/* $OpenBSD: if_fec.c,v 1.21 2018/03/11 17:58:52 kettenis Exp $ */
/*
* Copyright (c) 2012-2013 Patrick Wildt <patrick@blueri.se>
*
@@ -339,7 +339,8 @@ fec_attach(struct device *parent, struct device *self, void *aux)
/* reset the controller */
HSET4(sc, ENET_ECR, ENET_ECR_RESET);
- while(HREAD4(sc, ENET_ECR) & ENET_ECR_RESET);
+ while (HREAD4(sc, ENET_ECR) & ENET_ECR_ETHEREN)
+ continue;
HWRITE4(sc, ENET_EIMR, 0);
HWRITE4(sc, ENET_EIR, 0xffffffff);
@@ -604,7 +605,8 @@ fec_init(struct fec_softc *sc)
/* reset the controller */
HSET4(sc, ENET_ECR, ENET_ECR_RESET);
- while(HREAD4(sc, ENET_ECR) & ENET_ECR_RESET);
+ while (HREAD4(sc, ENET_ECR) & ENET_ECR_ETHEREN)
+ continue;
/* set hw address */
HWRITE4(sc, ENET_PALR,
@@ -703,7 +705,8 @@ fec_stop(struct fec_softc *sc)
/* reset the controller */
HSET4(sc, ENET_ECR, ENET_ECR_RESET);
- while(HREAD4(sc, ENET_ECR) & ENET_ECR_RESET);
+ while (HREAD4(sc, ENET_ECR) & ENET_ECR_ETHEREN)
+ continue;
}
void