Skip to content
Snippets Groups Projects
Commit e95829e1 authored by Oleksii Kutuzov's avatar Oleksii Kutuzov
Browse files

[DRIVER][PHY] realtek: Add LED configuration via device tree

parent 28bc224b
No related branches found
No related tags found
No related merge requests found
...@@ -27,6 +27,8 @@ ...@@ -27,6 +27,8 @@
#define RTL821x_EXT_PAGE_SELECT 0x1e #define RTL821x_EXT_PAGE_SELECT 0x1e
#define RTL821x_PAGE_SELECT 0x1f #define RTL821x_PAGE_SELECT 0x1f
#define RTL8211F_LCR 0x10
#define RTL8211F_EEELCR 0x11
#define RTL8211F_PHYCR1 0x18 #define RTL8211F_PHYCR1 0x18
#define RTL8211F_PHYCR2 0x19 #define RTL8211F_PHYCR2 0x19
#define RTL8211F_INSR 0x1d #define RTL8211F_INSR 0x1d
...@@ -334,6 +336,7 @@ static int rtl8211f_config_init(struct phy_device *phydev) ...@@ -334,6 +336,7 @@ static int rtl8211f_config_init(struct phy_device *phydev)
struct rtl821x_priv *priv = phydev->priv; struct rtl821x_priv *priv = phydev->priv;
struct device *dev = &phydev->mdio.dev; struct device *dev = &phydev->mdio.dev;
u16 val_txdly, val_rxdly; u16 val_txdly, val_rxdly;
u32 reg_lcr, reg_eeelcr;
int ret; int ret;
ret = phy_modify_paged_changed(phydev, 0xa43, RTL8211F_PHYCR1, ret = phy_modify_paged_changed(phydev, 0xa43, RTL8211F_PHYCR1,
...@@ -408,6 +411,22 @@ static int rtl8211f_config_init(struct phy_device *phydev) ...@@ -408,6 +411,22 @@ static int rtl8211f_config_init(struct phy_device *phydev)
return ret; return ret;
} }
// Configure LED Control Register if specified in device tree
if (!of_property_read_u32(dev->of_node, "realtek,lcr-conf", &reg_lcr)) {
dev_info(dev, "Setting LEDCR value to 0x%04x\n", reg_lcr);
phy_write(phydev, RTL821x_PAGE_SELECT, 0xd04);
phy_write(phydev, RTL8211F_LCR, reg_lcr);
phy_write(phydev, RTL821x_PAGE_SELECT, 0x0);
}
// Configure EEE LED Control Register if specified in device tree
if (!of_property_read_u32(dev->of_node, "realtek,eee-lcr-conf", &reg_eeelcr)) {
dev_info(dev, "Setting EEE LEDCR value to 0x%04x\n", reg_eeelcr);
phy_write(phydev, RTL821x_PAGE_SELECT, 0xd04);
phy_write(phydev, RTL8211F_EEELCR, reg_eeelcr);
phy_write(phydev, RTL821x_PAGE_SELECT, 0x0);
}
return genphy_soft_reset(phydev); return genphy_soft_reset(phydev);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment