summaryrefslogtreecommitdiffstats
path: root/sys/arm/at91
diff options
context:
space:
mode:
Diffstat (limited to 'sys/arm/at91')
-rw-r--r--sys/arm/at91/if_macb.c9
-rw-r--r--sys/arm/at91/if_macbreg.h3
-rw-r--r--sys/arm/at91/if_macbvar.h4
3 files changed, 12 insertions, 4 deletions
diff --git a/sys/arm/at91/if_macb.c b/sys/arm/at91/if_macb.c
index 6ad167c..7e411f5 100644
--- a/sys/arm/at91/if_macb.c
+++ b/sys/arm/at91/if_macb.c
@@ -25,6 +25,7 @@
*/
#include "opt_platform.h"
+#include "opt_at91.h"
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
@@ -1359,8 +1360,14 @@ macb_attach(device_t dev)
sc->clock = sc->clock << 10;
+#ifdef AT91_MACB_USE_RMII
+ sc->use_rmii = USRIO_RMII;
+#else
+ sc->use_rmii = read_4(sc, EMAC_USRIO) & USRIO_RMII;
+#endif
+
write_4(sc, EMAC_NCFGR, sc->clock);
- write_4(sc, EMAC_USRIO, USRIO_CLOCK); //enable clock
+ write_4(sc, EMAC_USRIO, USRIO_CLOCK | sc->use_rmii); //enable clock
write_4(sc, EMAC_NCR, MPE_ENABLE); //enable MPE
diff --git a/sys/arm/at91/if_macbreg.h b/sys/arm/at91/if_macbreg.h
index 163d79d..59cf17c 100644
--- a/sys/arm/at91/if_macbreg.h
+++ b/sys/arm/at91/if_macbreg.h
@@ -99,7 +99,8 @@
#define CFG_DRFCS (1 << 17)
-#define USRIO_CLOCK (1 << 1)
+#define USRIO_RMII (1 << 0) /* RMII vs MII pins */
+#define USRIO_CLOCK (1 << 1) /* Enable the clock! */
diff --git a/sys/arm/at91/if_macbvar.h b/sys/arm/at91/if_macbvar.h
index 4469b03..662c71c 100644
--- a/sys/arm/at91/if_macbvar.h
+++ b/sys/arm/at91/if_macbvar.h
@@ -131,8 +131,8 @@ struct macb_softc
struct macb_chain_data macb_cdata;
int clock;
-};
-
+ uint32_t use_rmii; /* 0 or USRIO_RMII */
+};
#endif
OpenPOWER on IntegriCloud