Date: Wed, 2 May 2012 06:18:12 +0000 (UTC) From: Adrian Chadd <adrian@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r234910 - head/sys/mips/atheros Message-ID: <201205020618.q426ICmG068202@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: adrian Date: Wed May 2 06:18:12 2012 New Revision: 234910 URL: http://svn.freebsd.org/changeset/base/234910 Log: 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. Modified: head/sys/mips/atheros/if_arge.c head/sys/mips/atheros/if_argevar.h Modified: head/sys/mips/atheros/if_arge.c ============================================================================== --- head/sys/mips/atheros/if_arge.c Wed May 2 06:17:16 2012 (r234909) +++ head/sys/mips/atheros/if_arge.c Wed May 2 06:18:12 2012 (r234910) @@ -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 Modified: head/sys/mips/atheros/if_argevar.h ============================================================================== --- head/sys/mips/atheros/if_argevar.h Wed May 2 06:17:16 2012 (r234909) +++ head/sys/mips/atheros/if_argevar.h Wed May 2 06:18:12 2012 (r234910) @@ -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;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201205020618.q426ICmG068202>