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;
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to