]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
net: phy: marvell: add new default led configure for m88e151x
authorJian Shen <shenjian15@huawei.com>
Mon, 22 Apr 2019 13:52:23 +0000 (21:52 +0800)
committerDavid S. Miller <davem@davemloft.net>
Tue, 23 Apr 2019 17:40:32 +0000 (10:40 -0700)
The default m88e151x LED configuration is 0x1177, used LED[0]
for 1000M link, LED[1] for 100M link, and LED[2] for active.
But for some boards, which use LED[0] for link, and LED[1] for
active, prefer to be 0x1040. To be compatible with this case,
this patch defines a new dev_flag, and set it before connect
phy in HNS3 driver. When phy initializing, using the new
LED configuration if this dev_flag is set.

Signed-off-by: Jian Shen <shenjian15@huawei.com>
Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mdio.c
drivers/net/phy/marvell.c
include/linux/marvell_phy.h

index 12be4e293fcff2adffe5c0f7ab290a2e18f6f7e3..1e8134892d775cca14e9ebe00c62d93940e4ff06 100644 (file)
@@ -3,6 +3,7 @@
 
 #include <linux/etherdevice.h>
 #include <linux/kernel.h>
+#include <linux/marvell_phy.h>
 
 #include "hclge_cmd.h"
 #include "hclge_main.h"
@@ -209,6 +210,8 @@ int hclge_mac_connect_phy(struct hnae3_handle *handle)
 
        linkmode_clear_bit(ETHTOOL_LINK_MODE_FIBRE_BIT, phydev->supported);
 
+       phydev->dev_flags |= MARVELL_PHY_LED0_LINK_LED1_ACTIVE;
+
        ret = phy_connect_direct(netdev, phydev,
                                 hclge_mac_adjust_link,
                                 PHY_INTERFACE_MODE_SGMII);
index 8754cb883d021636fe7f5b9dccf72aa6518bd824..a7e8c8113d972b6b3ec09ca788e7185a1f10b3d8 100644 (file)
 #define MII_PHY_LED_CTRL               16
 #define MII_88E1121_PHY_LED_DEF                0x0030
 #define MII_88E1510_PHY_LED_DEF                0x1177
+#define MII_88E1510_PHY_LED0_LINK_LED1_ACTIVE  0x1040
 
 #define MII_M1011_PHY_STATUS           0x11
 #define MII_M1011_PHY_STATUS_1000      0x8000
@@ -633,7 +634,10 @@ static void marvell_config_led(struct phy_device *phydev)
         * LED[2] .. Blink, Activity
         */
        case MARVELL_PHY_FAMILY_ID(MARVELL_PHY_ID_88E1510):
-               def_config = MII_88E1510_PHY_LED_DEF;
+               if (phydev->dev_flags & MARVELL_PHY_LED0_LINK_LED1_ACTIVE)
+                       def_config = MII_88E1510_PHY_LED0_LINK_LED1_ACTIVE;
+               else
+                       def_config = MII_88E1510_PHY_LED_DEF;
                break;
        default:
                return;
index 73d04743a2bbe99a002dc1555e76c19c73c6a9f7..af6b11d4d6737845b3c41fd09eab1a674d2253c5 100644 (file)
@@ -34,5 +34,6 @@
 /* struct phy_device dev_flags definitions */
 #define MARVELL_PHY_M1145_FLAGS_RESISTANCE     0x00000001
 #define MARVELL_PHY_M1118_DNS323_LEDS          0x00000002
+#define MARVELL_PHY_LED0_LINK_LED1_ACTIVE      0x00000004
 
 #endif /* _MARVELL_PHY_H */