Author: raj
Date: Tue Aug 25 09:47:12 2009
New Revision: 196534
URL: http://svn.freebsd.org/changeset/base/196534

Log:
  Introduce MII_ADDR_BASE option on ARM, which allows to override the default
  per platform requirements.
  
  Notes:
  - Only used by mge(4) at the moment.
  
  - This is very simplified approach and should be replaced by some long-term
    solution for managing the board/platform configuration (among others the
    MAC-PHY binding info).
  
  Submitted by: Michal Hajduk
  Obtained from:        Semihalf

Modified:
  head/sys/conf/options.arm
  head/sys/dev/mge/if_mge.c

Modified: head/sys/conf/options.arm
==============================================================================
--- head/sys/conf/options.arm   Tue Aug 25 09:39:11 2009        (r196533)
+++ head/sys/conf/options.arm   Tue Aug 25 09:47:12 2009        (r196534)
@@ -24,6 +24,7 @@ KERNVIRTADDR          opt_global.h
 LOADERRAMADDR          opt_global.h
 PHYSADDR               opt_global.h
 PHYSMEM_SIZE           opt_global.h
+MII_ADDR_BASE          opt_global.h
 SKYEYE_WORKAROUNDS     opt_global.h
 SOC_MV_DISCOVERY       opt_global.h
 SOC_MV_KIRKWOOD                opt_global.h

Modified: head/sys/dev/mge/if_mge.c
==============================================================================
--- head/sys/dev/mge/if_mge.c   Tue Aug 25 09:39:11 2009        (r196533)
+++ head/sys/dev/mge/if_mge.c   Tue Aug 25 09:47:12 2009        (r196534)
@@ -69,7 +69,9 @@ __FBSDID("$FreeBSD$");
 #include <dev/mii/mii.h>
 #include <dev/mii/miivar.h>
 
-#define        MV_PHY_ADDR_BASE        8
+#ifndef MII_ADDR_BASE
+#define MII_ADDR_BASE 8
+#endif
 
 #include <dev/mge/if_mgevar.h>
 #include <arm/mv/mvreg.h>
@@ -1264,14 +1266,15 @@ mge_miibus_readreg(device_t dev, int phy
 
        /*
         * We assume static PHY address <=> device unit mapping:
-        * PHY Address = MV_PHY_ADDR_BASE + devce unit.
+        * PHY Address = MII_ADDR_BASE + devce unit.
         * This is true for most Marvell boards.
         * 
         * Code below grants proper PHY detection on each device
         * unit.
         */
 
-       if ((MV_PHY_ADDR_BASE + device_get_unit(dev)) != phy)
+       
+       if ((MII_ADDR_BASE + device_get_unit(dev)) != phy)
                return (0);
 
        MGE_WRITE(sc_mge0, MGE_REG_SMI, 0x1fffffff &
@@ -1292,7 +1295,7 @@ mge_miibus_writereg(device_t dev, int ph
 {
        uint32_t retries;
 
-       if ((MV_PHY_ADDR_BASE + device_get_unit(dev)) != phy)
+       if ((MII_ADDR_BASE + device_get_unit(dev)) != phy)
                return (0);
 
        MGE_WRITE(sc_mge0, MGE_REG_SMI, 0x1fffffff &
_______________________________________________
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