Changeset 43356


Ignore:
Timestamp:
2014-11-24T10:33:48+01:00 (3 years ago)
Author:
nbd
Message:

ar8216: Fix issue with autoneg being disabled under 3.14, revert 43332

Patch reverts 43332 which seems to cause issues with VLAN functionality.
Add a specific check to check whether ANEG is still enabled and re-enable
it if necessary. Disable generic phy soft reset for kernel >=3.16.

Signed-off-by: Heiner Kallweit <hkallweit1@…>

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/target/linux/generic/files/drivers/net/phy/ar8216.c

    r43334 r43356  
    3737#include <linux/leds.h> 
    3838#include <linux/gpio.h> 
     39#include <linux/version.h> 
    3940 
    4041#include "ar8216.h" 
     
    341342        } 
    342343        return -ETIMEDOUT; 
     344} 
     345 
     346static int 
     347ar8xxx_phy_check_aneg(struct phy_device *phydev) 
     348{ 
     349        int ret; 
     350 
     351        if (phydev->autoneg != AUTONEG_ENABLE) 
     352                return 0; 
     353        /* 
     354         * BMCR_ANENABLE might have been cleared 
     355         * by phy_init_hw in certain kernel versions 
     356         * therefore check for it 
     357         */ 
     358        ret = phy_read(phydev, MII_BMCR); 
     359        if (ret < 0) 
     360                return ret; 
     361        if (ret & BMCR_ANENABLE) 
     362                return 0; 
     363 
     364        dev_info(&phydev->dev, "ANEG disabled, re-enabling ...\n"); 
     365        ret |= BMCR_ANENABLE | BMCR_ANRESTART; 
     366        return phy_write(phydev, MII_BMCR, ret); 
    343367} 
    344368 
     
    27752799 
    27762800        if (chip_is_ar8327(priv) || chip_is_ar8337(priv)) 
    2777                 return 0; 
     2801                return ar8xxx_phy_check_aneg(phydev); 
    27782802 
    27792803        priv->phy = phydev; 
     
    28492873} 
    28502874 
     2875static int 
     2876ar8xxx_phy_config_aneg(struct phy_device *phydev) 
     2877{ 
     2878        if (phydev->addr == 0) 
     2879                return 0; 
     2880 
     2881        return genphy_config_aneg(phydev); 
     2882} 
     2883 
    28512884static const u32 ar8xxx_phy_ids[] = { 
    28522885        0x004dd033, 
     
    30113044} 
    30123045 
     3046#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,16,0) 
     3047static int 
     3048ar8xxx_phy_soft_reset(struct phy_device *phydev) 
     3049{ 
     3050        /* we don't need an extra reset */ 
     3051        return 0; 
     3052} 
     3053#endif 
     3054 
    30133055static struct phy_driver ar8xxx_phy_driver = { 
    30143056        .phy_id         = 0x004d0000, 
     
    30203062        .detach         = ar8xxx_phy_detach, 
    30213063        .config_init    = ar8xxx_phy_config_init, 
    3022         .config_aneg    = genphy_config_aneg, 
     3064        .config_aneg    = ar8xxx_phy_config_aneg, 
    30233065        .read_status    = ar8xxx_phy_read_status, 
     3066#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,16,0) 
     3067        .soft_reset     = ar8xxx_phy_soft_reset, 
     3068#endif 
    30243069        .driver         = { .owner = THIS_MODULE }, 
    30253070}; 
Note: See TracChangeset for help on using the changeset viewer.