summaryrefslogtreecommitdiffstats
path: root/sys/arm/at91
diff options
context:
space:
mode:
authorimp <imp@FreeBSD.org>2015-11-07 20:02:07 +0000
committerimp <imp@FreeBSD.org>2015-11-07 20:02:07 +0000
commit8861584a6b2f53110bf466fa5b3f7a2e706bf56b (patch)
treedc16307029d15faec6bccf6aa5895613de6bc55e /sys/arm/at91
parent3e1b1042f9be832e2d34f2c86937e16870c23aac (diff)
downloadFreeBSD-src-8861584a6b2f53110bf466fa5b3f7a2e706bf56b.zip
FreeBSD-src-8861584a6b2f53110bf466fa5b3f7a2e706bf56b.tar.gz
Add support for RMII in macb, cribbed slightly from the ate
driver. This is taken from the MAC at boot, but can be overridden with 'options AT91_MACB_USE_RMII'. Switch to macb for HL201 and SAM9G20EK boards. It now works both places. Also start to sneak up on FDT for the SAM9G20EK board, but leave disabled due to issues with MMC that haven't been resolved. Add early debug support for the SAM9G20EK since that is required for FDT to work presently on these SoC.
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