Author: nbd
Date: 2014-11-19 21:17:30 +0100 (Wed, 19 Nov 2014)
New Revision: 43328

Modified:
   trunk/target/linux/generic/files/drivers/net/phy/ar8216.c
   trunk/target/linux/generic/files/drivers/net/phy/ar8216.h
Log:
ar8216: introduce global constant for number of PHYs

All supported switches have 5 PHYs. Currently partially 5 is hardcoded
and partially switch-specific constants exist.
Replace them with a global constant.

Signed-off-by: Heiner Kallweit <[email protected]>

Modified: trunk/target/linux/generic/files/drivers/net/phy/ar8216.c
===================================================================
--- trunk/target/linux/generic/files/drivers/net/phy/ar8216.c   2014-11-19 
20:17:24 UTC (rev 43327)
+++ trunk/target/linux/generic/files/drivers/net/phy/ar8216.c   2014-11-19 
20:17:30 UTC (rev 43328)
@@ -51,6 +51,8 @@
 #define AR8XXX_CAP_GIGE                        BIT(0)
 #define AR8XXX_CAP_MIB_COUNTERS                BIT(1)
 
+#define AR8XXX_NUM_PHYS        5
+
 enum {
        AR8XXX_VER_AR8216 = 0x01,
        AR8XXX_VER_AR8236 = 0x03,
@@ -868,7 +870,7 @@
 
        /* Initialize the PHYs */
        bus = priv->mii_bus;
-       for (i = 0; i < 5; i++) {
+       for (i = 0; i < AR8XXX_NUM_PHYS; i++) {
                mdiobus_write(bus, i, MII_ADVERTISE,
                              ADVERTISE_ALL | ADVERTISE_PAUSE_CAP |
                              ADVERTISE_PAUSE_ASYM);
@@ -954,7 +956,7 @@
 
        /* Initialize the ports */
        bus = priv->mii_bus;
-       for (i = 0; i < 5; i++) {
+       for (i = 0; i < AR8XXX_NUM_PHYS; i++) {
                /* initialize the port itself */
                mdiobus_write(bus, i, MII_ADVERTISE,
                        ADVERTISE_ALL | ADVERTISE_PAUSE_CAP | 
ADVERTISE_PAUSE_ASYM);
@@ -1609,7 +1611,7 @@
        ar8327_leds_init(priv);
 
        bus = priv->mii_bus;
-       for (i = 0; i < AR8327_NUM_PHYS; i++) {
+       for (i = 0; i < AR8XXX_NUM_PHYS; i++) {
                ar8327_phy_fixup(priv, i);
 
                /* start aneg on the PHY */

Modified: trunk/target/linux/generic/files/drivers/net/phy/ar8216.h
===================================================================
--- trunk/target/linux/generic/files/drivers/net/phy/ar8216.h   2014-11-19 
20:17:24 UTC (rev 43327)
+++ trunk/target/linux/generic/files/drivers/net/phy/ar8216.h   2014-11-19 
20:17:30 UTC (rev 43328)
@@ -291,7 +291,6 @@
 
 #define AR8327_NUM_PORTS       7
 #define AR8327_NUM_LEDS                15
-#define AR8327_NUM_PHYS                5
 #define AR8327_PORTS_ALL       0x7f
 #define AR8327_NUM_LED_CTRL_REGS       4
 
_______________________________________________
openwrt-commits mailing list
[email protected]
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-commits

Reply via email to