summaryrefslogtreecommitdiffstats
path: root/sys/mips
diff options
context:
space:
mode:
authoradrian <adrian@FreeBSD.org>2012-05-02 06:18:12 +0000
committeradrian <adrian@FreeBSD.org>2012-05-02 06:18:12 +0000
commit0d88d07cc7b6176fa9538e02be7ceb3cebd22da0 (patch)
tree80bd1b536b02b489bf0aa4f6f963207fb0300fb7 /sys/mips
parentc37159910d07966bead3a804a8d6e7348e8ee3aa (diff)
downloadFreeBSD-src-0d88d07cc7b6176fa9538e02be7ceb3cebd22da0.zip
FreeBSD-src-0d88d07cc7b6176fa9538e02be7ceb3cebd22da0.tar.gz
Allow the MII mode to be overridden via 'hint.arge.X.miimode'.
It takes a number at the moment, rather than a string. Some of the Linux board configurations specify the MII mode explicitly.
Diffstat (limited to 'sys/mips')
-rw-r--r--sys/mips/atheros/if_arge.c24
-rw-r--r--sys/mips/atheros/if_argevar.h1
2 files changed, 25 insertions, 0 deletions
diff --git a/sys/mips/atheros/if_arge.c b/sys/mips/atheros/if_arge.c
index 2c4a1be..d5f67d1 100644
--- a/sys/mips/atheros/if_arge.c
+++ b/sys/mips/atheros/if_arge.c
@@ -103,6 +103,14 @@ typedef enum {
ARGE_DBG_RESET = 0x00000020,
} arge_debug_flags;
+static const char * arge_miicfg_str[] = {
+ "NONE",
+ "GMII",
+ "MII",
+ "RGMII",
+ "RMII"
+};
+
#ifdef ARGE_DEBUG
#define ARGEDEBUG(_sc, _m, ...) \
do { \
@@ -333,6 +341,7 @@ arge_attach(device_t dev)
int is_base_mac_empty, i;
uint32_t hint;
long eeprom_mac_addr = 0;
+ int miicfg = 0;
sc = device_get_softc(dev);
sc->arge_dev = dev;
@@ -363,6 +372,17 @@ arge_attach(device_t dev)
("if_arge: Only MAC0 and MAC1 supported"));
/*
+ * Get the MII configuration, if applicable.
+ */
+ if (resource_int_value(device_get_name(dev), device_get_unit(dev),
+ "miimode", &miicfg) == 0) {
+ /* XXX bounds check? */
+ device_printf(dev, "%s: overriding MII mode to '%s'\n",
+ __func__, arge_miicfg_str[miicfg]);
+ sc->arge_miicfg = miicfg;
+ }
+
+ /*
* Get which PHY of 5 available we should use for this unit
*/
if (resource_int_value(device_get_name(dev), device_get_unit(dev),
@@ -497,6 +517,10 @@ arge_attach(device_t dev)
arge_reset_miibus(sc);
#endif
+ /* Configure MII mode, just for convienence */
+ if (sc->arge_miicfg != 0)
+ ar71xx_device_set_mii_if(sc->arge_mac_unit, sc->arge_miicfg);
+
/*
* Set all Ethernet address registers to the same initial values
* set all four addresses to 66-88-aa-cc-dd-ee
diff --git a/sys/mips/atheros/if_argevar.h b/sys/mips/atheros/if_argevar.h
index dc3d931..f592d85 100644
--- a/sys/mips/atheros/if_argevar.h
+++ b/sys/mips/atheros/if_argevar.h
@@ -135,6 +135,7 @@ struct arge_softc {
void *arge_intrhand;
device_t arge_miibus;
device_t arge_miiproxy;
+ ar71xx_mii_mode arge_miicfg;
bus_dma_tag_t arge_parent_tag;
bus_dma_tag_t arge_tag;
struct mtx arge_mtx;
OpenPOWER on IntegriCloud