diff --git a/drivers/amlogic/ethernet/phy/amlogic.c b/drivers/amlogic/ethernet/phy/amlogic.c index 8a8290f0c5ca..32de2e5c89f8 100644 --- a/drivers/amlogic/ethernet/phy/amlogic.c +++ b/drivers/amlogic/ethernet/phy/amlogic.c @@ -126,6 +126,7 @@ void reset_internal_phy(struct phy_device *phydev) pr_info("reset phy\n"); } +unsigned int enable_wol_check = 1; static int internal_phy_read_status(struct phy_device *phydev) { int err; @@ -142,22 +143,28 @@ static int internal_phy_read_status(struct phy_device *phydev) /*Bit 9:5: Read Address*/ /*Bit 4:0: Write Address*/ /*read wol bank reg12*/ - val = ((1 << 15) | (1 << 11) | (1 << 10) | (12 << 5)); - phy_write(phydev, 0x14, val); - wol_reg12 = phy_read(phydev, 0x15); - if ((phydev->link) && (phydev->speed != SPEED_10)) { - if ((wol_reg12 & 0x1000)) + + /*add enable/disable to stop the check for debug*/ + /*cause this part will involve many issue*/ + if (enable_wol_check) { + val = ((1 << 15) | (1 << 11) | (1 << 10) | (12 << 5)); + phy_write(phydev, 0x14, val); + wol_reg12 = phy_read(phydev, 0x15); + if ((phydev->link) && (phydev->speed != SPEED_10)) { + if ((wol_reg12 & 0x1000)) + reg12_error_count = 0; + if (!(wol_reg12 & 0x1000)) { + reg12_error_count++; + pr_info("wol_reg12[12]==0, error\n"); + } + if (reg12_error_count >= + (phydev->drv->features & 0xff)) { + reg12_error_count = 0; + reset_internal_phy(phydev); + } + } else { reg12_error_count = 0; - if (!(wol_reg12 & 0x1000)) { - reg12_error_count++; - pr_info("wol_reg12[12]==0, error\n"); } - if (reg12_error_count >= (phydev->drv->features & 0xff)) { - reg12_error_count = 0; - reset_internal_phy(phydev); - } - } else { - reg12_error_count = 0; } linkup = phydev->link; err = genphy_update_link(phydev); diff --git a/drivers/amlogic/ethernet/phy/phy_debug.c b/drivers/amlogic/ethernet/phy/phy_debug.c index cbe9b5fb8885..ee7ebba55316 100644 --- a/drivers/amlogic/ethernet/phy/phy_debug.c +++ b/drivers/amlogic/ethernet/phy/phy_debug.c @@ -553,6 +553,8 @@ static void am_net_eye_pattern_on(void) unsigned int value; c_phy_dev->autoneg = AUTONEG_DISABLE; + /*stop check wol when doing eye pattern, otherwise it will reset phy*/ + enable_wol_check = 0; phy_write(c_phy_dev, 0, 0x2100); value = phy_read(c_phy_dev, 17); pr_info("0x11 %x\n", value); @@ -563,12 +565,20 @@ static void am_net_eye_pattern_off(void) unsigned int value; c_phy_dev->autoneg = AUTONEG_ENABLE; + enable_wol_check = 1; phy_write(c_phy_dev, 0, 0x1000); value = phy_read(c_phy_dev, 17); pr_info("0x11 %x\n", value); phy_write(c_phy_dev, 17, (value & ~0x0004)); } +static void am_net_debug_mode(void) +{ /*disable autoneg*/ + c_phy_dev->autoneg = AUTONEG_DISABLE; + /*disable wol check*/ + enable_wol_check = 0; +} + static ssize_t eth_phyreg_func( struct class *class, struct class_attribute *attr, const char *buf, size_t count) @@ -642,6 +652,10 @@ static ssize_t eth_phyreg_func( am_net_eye_pattern_off(); break; } + if (argv[0][1] == 'd' || argv[0][1] == 'D') { + am_net_debug_mode(); + break; + } break; default: goto end; diff --git a/drivers/amlogic/ethernet/phy/phy_debug.h b/drivers/amlogic/ethernet/phy/phy_debug.h index 1065437b3082..51f3b15d20a5 100644 --- a/drivers/amlogic/ethernet/phy/phy_debug.h +++ b/drivers/amlogic/ethernet/phy/phy_debug.h @@ -36,7 +36,8 @@ #include #include "eth_reg.h" - +/*add this to stop checking wol,which will reset phy*/ +extern unsigned int enable_wol_check; int gmac_create_sysfs(struct phy_device *phydev, void __iomem *ioaddr); int gmac_remove_sysfs(struct phy_device *phydev); #endif