Skip to content

Commit 0777724

Browse files
Wang Dongshengdavem330
authored andcommitted
net: phy: marvell: change default m88e1510 LED configuration
The m88e1121 LED default configuration does not apply m88e151x. So add a function to relpace m88e1121 LED configuration. Signed-off-by: Wang Dongsheng <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 248c690 commit 0777724

File tree

2 files changed

+38
-18
lines changed

2 files changed

+38
-18
lines changed

drivers/net/phy/marvell.c

Lines changed: 36 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,9 @@
130130
#define MII_88E1318S_PHY_WOL_CTRL_CLEAR_WOL_STATUS BIT(12)
131131
#define MII_88E1318S_PHY_WOL_CTRL_MAGIC_PACKET_MATCH_ENABLE BIT(14)
132132

133-
#define MII_88E1121_PHY_LED_CTRL 16
133+
#define MII_PHY_LED_CTRL 16
134134
#define MII_88E1121_PHY_LED_DEF 0x0030
135+
#define MII_88E1510_PHY_LED_DEF 0x1177
135136

136137
#define MII_M1011_PHY_STATUS 0x11
137138
#define MII_M1011_PHY_STATUS_1000 0x8000
@@ -632,8 +633,40 @@ static int m88e1510_config_aneg(struct phy_device *phydev)
632633
return err;
633634
}
634635

636+
static void marvell_config_led(struct phy_device *phydev)
637+
{
638+
u16 def_config;
639+
int err;
640+
641+
switch (MARVELL_PHY_FAMILY_ID(phydev->phy_id)) {
642+
/* Default PHY LED config: LED[0] .. Link, LED[1] .. Activity */
643+
case MARVELL_PHY_FAMILY_ID(MARVELL_PHY_ID_88E1121R):
644+
case MARVELL_PHY_FAMILY_ID(MARVELL_PHY_ID_88E1318S):
645+
def_config = MII_88E1121_PHY_LED_DEF;
646+
break;
647+
/* Default PHY LED config:
648+
* LED[0] .. 1000Mbps Link
649+
* LED[1] .. 100Mbps Link
650+
* LED[2] .. Blink, Activity
651+
*/
652+
case MARVELL_PHY_FAMILY_ID(MARVELL_PHY_ID_88E1510):
653+
def_config = MII_88E1510_PHY_LED_DEF;
654+
break;
655+
default:
656+
return;
657+
}
658+
659+
err = phy_write_paged(phydev, MII_MARVELL_LED_PAGE, MII_PHY_LED_CTRL,
660+
def_config);
661+
if (err < 0)
662+
pr_warn("Fail to config marvell phy LED.\n");
663+
}
664+
635665
static int marvell_config_init(struct phy_device *phydev)
636666
{
667+
/* Set defalut LED */
668+
marvell_config_led(phydev);
669+
637670
/* Set registers from marvell,reg-init DT property */
638671
return marvell_of_reg_init(phydev);
639672
}
@@ -813,21 +846,6 @@ static int m88e1111_config_init(struct phy_device *phydev)
813846
return genphy_soft_reset(phydev);
814847
}
815848

816-
static int m88e1121_config_init(struct phy_device *phydev)
817-
{
818-
int err;
819-
820-
/* Default PHY LED config: LED[0] .. Link, LED[1] .. Activity */
821-
err = phy_write_paged(phydev, MII_MARVELL_LED_PAGE,
822-
MII_88E1121_PHY_LED_CTRL,
823-
MII_88E1121_PHY_LED_DEF);
824-
if (err < 0)
825-
return err;
826-
827-
/* Set marvell,reg-init configuration from device tree */
828-
return marvell_config_init(phydev);
829-
}
830-
831849
static int m88e1318_config_init(struct phy_device *phydev)
832850
{
833851
if (phy_interrupt_is_valid(phydev)) {
@@ -841,7 +859,7 @@ static int m88e1318_config_init(struct phy_device *phydev)
841859
return err;
842860
}
843861

844-
return m88e1121_config_init(phydev);
862+
return marvell_config_init(phydev);
845863
}
846864

847865
static int m88e1510_config_init(struct phy_device *phydev)
@@ -2087,7 +2105,7 @@ static struct phy_driver marvell_drivers[] = {
20872105
.features = PHY_GBIT_FEATURES,
20882106
.flags = PHY_HAS_INTERRUPT,
20892107
.probe = &m88e1121_probe,
2090-
.config_init = &m88e1121_config_init,
2108+
.config_init = &marvell_config_init,
20912109
.config_aneg = &m88e1121_config_aneg,
20922110
.read_status = &marvell_read_status,
20932111
.ack_interrupt = &marvell_ack_interrupt,

include/linux/marvell_phy.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@
2727
*/
2828
#define MARVELL_PHY_ID_88E6390 0x01410f90
2929

30+
#define MARVELL_PHY_FAMILY_ID(id) ((id) >> 4)
31+
3032
/* struct phy_device dev_flags definitions */
3133
#define MARVELL_PHY_M1145_FLAGS_RESISTANCE 0x00000001
3234
#define MARVELL_PHY_M1118_DNS323_LEDS 0x00000002

0 commit comments

Comments
 (0)