Skip to content

Commit 5b57ec6

Browse files
committed
Ethernet :1. modify ethernet LED behavior for meet ASUS ethernet LED spec.
2. only adjust rgmii driver for RTL8211E (Distinguish between RTL8211F and RTL8211E) Change-Id: I74ad16c11fc7d05594c922575fb1fd5740603bd2
1 parent 077fdc6 commit 5b57ec6

File tree

1 file changed

+33
-3
lines changed

1 file changed

+33
-3
lines changed

drivers/net/ethernet/stmicro/stmmac/stmmac_main.c

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -689,7 +689,7 @@ static void stmmac_release_ptp(struct stmmac_priv *priv)
689689
stmmac_ptp_unregister(priv);
690690
}
691691

692-
void setLedConfiguration(struct phy_device *phydev) {
692+
void set_led_configuration_e(struct phy_device *phydev) {
693693

694694
// disable EEE LED mode
695695
phy_write(phydev, 31, 0x0005);
@@ -727,6 +727,22 @@ void setLedConfiguration(struct phy_device *phydev) {
727727
phy_write(phydev, 31, 0);
728728
}
729729

730+
void set_led_configuration_f(struct phy_device *phydev) {
731+
// To switch Page0xd04
732+
phy_write(phydev, 31, 0x0d04);
733+
734+
//Disable EEELCR mode
735+
phy_write(phydev, 17, 0);
736+
printk("%s: #### before setting led, Reg16 = 0x%x\n", __func__, phy_read(phydev, 16));
737+
738+
//LED Link speed default setting
739+
phy_write(phydev, 16, 0x8910);
740+
printk("%s: #### after setting led, Reg16 = 0x%x\n", __func__, phy_read(phydev, 16));
741+
742+
//switch to PHY`s Page0
743+
phy_write(phydev, 31, 0);
744+
}
745+
730746
void adjust_rgmii_driving(struct phy_device *phydev)
731747
{
732748
// set to extension page
@@ -744,6 +760,21 @@ void adjust_rgmii_driving(struct phy_device *phydev)
744760
phy_write(phydev, 31, 0);
745761
}
746762

763+
extern int get_board_id(void);
764+
void setConfiguration(struct phy_device *phydev) {
765+
bool is_rtl8211f = get_board_id() >= 5 ? true: false;
766+
printk("%s: #### hwid = %d, PYH is %s \n", __func__, get_board_id(), is_rtl8211f ? "RTL8211F" : "RTL8211E");
767+
if (is_rtl8211f) {
768+
// RTL8211F
769+
set_led_configuration_f(phydev);
770+
} else {
771+
// RTL8211E
772+
set_led_configuration_e(phydev);
773+
adjust_rgmii_driving(phydev);
774+
}
775+
}
776+
777+
747778
/**
748779
* stmmac_adjust_link - adjusts the link parameters
749780
* @dev: net device structure
@@ -785,8 +816,7 @@ static void stmmac_adjust_link(struct net_device *dev)
785816

786817
if (phydev->speed != priv->speed) {
787818
new_state = 1;
788-
setLedConfiguration(phydev);
789-
adjust_rgmii_driving(phydev);
819+
setConfiguration(phydev);
790820
switch (phydev->speed) {
791821
case 1000:
792822
if (likely(priv->plat->has_gmac))

0 commit comments

Comments
 (0)