Skip to content

Commit 6d50712

Browse files
Ken Chenfacebook-github-bot
authored andcommitted
minilaketb : config phy(RTL8211E-VB) LED (torvalds#544)
Summary: Summary : 1. config phy led, 1000M is amber LED, 100M/10M is green LED. 2. remove the CONFIG_FTGMAC100_NCSI for minilaketb, because minilaketb is dedicated lan. Test Plan : test on minilaketb pass Closes facebookexternal/openbmc.quanta#544 Reviewed By: vineelasmile Differential Revision: D8188370 Pulled By: mikechoifb fbshipit-source-id: 2743d2e
1 parent 8f44d82 commit 6d50712

File tree

3 files changed

+31
-5
lines changed

3 files changed

+31
-5
lines changed

drivers/net/ethernet/faraday/ftgmac100.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2117,7 +2117,7 @@ void ncsi_start(struct net_device *dev) {
21172117
//TODO: This is an issue in Get_Version_ID that always returns
21182118
//mezz_type to be -1, so it only calls Get_MAC_Address_bcm.
21192119
//It may need to work with Mlx to find a solution.
2120-
#if defined(CONFIG_FBY2) || defined(CONFIG_YOSEMITE) || defined(CONFIG_MINILAKETB) //For multi-host NIC initialization
2120+
#if defined(CONFIG_FBY2) || defined(CONFIG_YOSEMITE) //For multi-host NIC initialization
21212121
// Try Mlx first
21222122
Get_MAC_Address_mlx(dev);
21232123
Set_MAC_Affinity_mlx(dev);
@@ -3258,6 +3258,7 @@ static int ftgmac100_open(struct net_device *netdev)
32583258
init_completion(&priv->ncsi_complete);
32593259
dev_add_pack(&ptype_ncsi);
32603260
#else
3261+
phy_config_led(priv->mii_bus);
32613262
phy_start(priv->phydev);
32623263
#endif
32633264

@@ -3266,10 +3267,6 @@ static int ftgmac100_open(struct net_device *netdev)
32663267

32673268
/* enable all interrupts */
32683269
#ifdef CONFIG_FTGMAC100_NCSI
3269-
#ifdef CONFIG_MINILAKETB
3270-
iowrite32(INT_MASK_ALL_ENABLED, priv->base + FTGMAC100_OFFSET_IER);
3271-
return 0;
3272-
#endif
32733270
iowrite32(INT_MASK_NCSI_ENABLED, priv->base + FTGMAC100_OFFSET_IER);
32743271
ncsi_start(netdev);
32753272
#else

drivers/net/phy/phy.c

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -777,6 +777,34 @@ void phy_start(struct phy_device *phydev)
777777
}
778778
EXPORT_SYMBOL(phy_start);
779779

780+
void phy_config_led(struct mii_bus *bus)
781+
{
782+
u16 data;
783+
u8 phy_addr = 0x01; //for minilaketb
784+
785+
//static int ftgmac100_mdiobus_read(struct mii_bus *bus, int phy_addr, int regnum)
786+
//static int ftgmac100_mdiobus_write(struct mii_bus *bus, int phy_addr, int regnum, u16 value)
787+
788+
//To switch to extension Page44, set register31 Data = 0x07, set register30 Data = 0x2C
789+
bus->write(bus, phy_addr, 31, 0x07);
790+
bus->write(bus, phy_addr, 30, 0x2C);
791+
792+
// LED1(Amber) is 1000M, bit6 = 1
793+
// LED2(Green) is 100M/10M, bit8/9 = 1
794+
data = bus->read(bus, phy_addr, 28);
795+
data = data & 0xF000;
796+
data = data | 0x0340;
797+
bus->write(bus, phy_addr, 28, data);
798+
799+
data = bus->read(bus, phy_addr, 26);
800+
data = data & 0xFF8F;
801+
data = data | 0x0010;
802+
bus->write(bus, phy_addr, 26, data);
803+
804+
//After LED setting, switch to page0 (register31 Data = 0x00)
805+
bus->write(bus, phy_addr, 31, 0x0000);
806+
}
807+
780808
/**
781809
* phy_state_machine - Handle the state machine
782810
* @work: work_struct that describes the work to be done

include/linux/phy.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -726,6 +726,7 @@ struct phy_device *phy_connect(struct net_device *dev, const char *bus_id,
726726
phy_interface_t interface);
727727
void phy_disconnect(struct phy_device *phydev);
728728
void phy_detach(struct phy_device *phydev);
729+
void phy_config_led(struct mii_bus *bus);
729730
void phy_start(struct phy_device *phydev);
730731
void phy_stop(struct phy_device *phydev);
731732
int phy_start_aneg(struct phy_device *phydev);

0 commit comments

Comments
 (0)