ar71xx: allow to disable link polling on unused PHYs
authorGabor Juhos <juhosg@openwrt.org>
Sun, 29 Apr 2012 18:29:24 +0000 (18:29 +0000)
committerGabor Juhos <juhosg@openwrt.org>
Sun, 29 Apr 2012 18:29:24 +0000 (18:29 +0000)
SVN-Revision: 31533

target/linux/ar71xx/files/arch/mips/ath79/dev-eth.c
target/linux/ar71xx/files/arch/mips/include/asm/mach-ath79/ag71xx_platform.h
target/linux/ar71xx/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_ar7240.c

index d9880e0803d248514e20b647cbd975c717a0c1cf..1e6b8b0a17707ae0ec152ca18c968c221066dc54 100644 (file)
@@ -721,6 +721,8 @@ void __init ath79_register_eth(unsigned int id)
                        pdata->speed = SPEED_1000;
                        pdata->duplex = DUPLEX_FULL;
                        pdata->switch_data = &ath79_switch_data;
+
+                       ath79_switch_data.phy_poll_mask |= BIT(4);
                }
                pdata->has_gbit = 1;
                pdata->is_ar724x = 1;
@@ -776,6 +778,8 @@ void __init ath79_register_eth(unsigned int id)
                        pdata->speed = SPEED_1000;
                        pdata->duplex = DUPLEX_FULL;
                        pdata->switch_data = &ath79_switch_data;
+
+                       ath79_switch_data.phy_poll_mask |= BIT(4);
                }
 
                pdata->has_gbit = 1;
index 43e67557aec25ec0e88b6d83cd14de275e962489..6e90ba4335999cea66d610616289af01d7e67c65 100644 (file)
@@ -19,6 +19,7 @@
 
 struct ag71xx_switch_platform_data {
        u8              phy4_mii_en:1;
+       u8              phy_poll_mask;
 };
 
 struct ag71xx_platform_data {
index fc8b6d53ebbc899e3ea3183d712b203dc4a2381b..49f077520be20b183fd2f3a7242f7653fffa5f3f 100644 (file)
@@ -1115,19 +1115,26 @@ static void link_function(struct work_struct *work) {
        struct ag71xx *ag = container_of(work, struct ag71xx, link_work.work);
        struct ar7240sw *as = ag->phy_priv;
        unsigned long flags;
+       u8 mask;
        int i;
        int status = 0;
 
-       for (i = 0; i < as->swdev.ports; i++) {
-               int link = ar7240sw_phy_read(ag->mii_bus, i, MII_BMSR);
-               if(link & BMSR_LSTATUS) {
+       mask = ~as->swdata->phy_poll_mask;
+       for (i = 0; i < AR7240_NUM_PHYS; i++) {
+               int link;
+
+               if (!(mask & BIT(i)))
+                       continue;
+
+               link = ar7240sw_phy_read(ag->mii_bus, i, MII_BMSR);
+               if (link & BMSR_LSTATUS) {
                        status = 1;
                        break;
                }
        }
 
        spin_lock_irqsave(&ag->lock, flags);
-       if(status != ag->link) {
+       if (status != ag->link) {
                ag->link = status;
                ag71xx_link_adjust(ag);
        }