Commit bb726b75 authored by Clark Wang's avatar Clark Wang Committed by David S. Miller

net: phy: realtek: add support for RTL8211F(D)(I)-VD-CG

RTL8211F(D)(I)-VD-CG is the pin-to-pin upgrade chip from
RTL8211F(D)(I)-CG.

Add new PHY ID for this chip.
It does not support RTL8211F_PHYCR2 anymore, so remove the w/r operation
of this register.
Signed-off-by: default avatarClark Wang <xiaoning.wang@nxp.com>
Signed-off-by: default avatarWei Fang <wei.fang@nxp.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent de437089
...@@ -70,6 +70,7 @@ ...@@ -70,6 +70,7 @@
#define RTLGEN_SPEED_MASK 0x0630 #define RTLGEN_SPEED_MASK 0x0630
#define RTL_GENERIC_PHYID 0x001cc800 #define RTL_GENERIC_PHYID 0x001cc800
#define RTL_8211FVD_PHYID 0x001cc878
MODULE_DESCRIPTION("Realtek PHY driver"); MODULE_DESCRIPTION("Realtek PHY driver");
MODULE_AUTHOR("Johnson Leung"); MODULE_AUTHOR("Johnson Leung");
...@@ -78,6 +79,7 @@ MODULE_LICENSE("GPL"); ...@@ -78,6 +79,7 @@ MODULE_LICENSE("GPL");
struct rtl821x_priv { struct rtl821x_priv {
u16 phycr1; u16 phycr1;
u16 phycr2; u16 phycr2;
bool has_phycr2;
}; };
static int rtl821x_read_page(struct phy_device *phydev) static int rtl821x_read_page(struct phy_device *phydev)
...@@ -94,6 +96,7 @@ static int rtl821x_probe(struct phy_device *phydev) ...@@ -94,6 +96,7 @@ static int rtl821x_probe(struct phy_device *phydev)
{ {
struct device *dev = &phydev->mdio.dev; struct device *dev = &phydev->mdio.dev;
struct rtl821x_priv *priv; struct rtl821x_priv *priv;
u32 phy_id = phydev->drv->phy_id;
int ret; int ret;
priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
...@@ -108,13 +111,16 @@ static int rtl821x_probe(struct phy_device *phydev) ...@@ -108,13 +111,16 @@ static int rtl821x_probe(struct phy_device *phydev)
if (of_property_read_bool(dev->of_node, "realtek,aldps-enable")) if (of_property_read_bool(dev->of_node, "realtek,aldps-enable"))
priv->phycr1 |= RTL8211F_ALDPS_PLL_OFF | RTL8211F_ALDPS_ENABLE | RTL8211F_ALDPS_XTAL_OFF; priv->phycr1 |= RTL8211F_ALDPS_PLL_OFF | RTL8211F_ALDPS_ENABLE | RTL8211F_ALDPS_XTAL_OFF;
ret = phy_read_paged(phydev, 0xa43, RTL8211F_PHYCR2); priv->has_phycr2 = !(phy_id == RTL_8211FVD_PHYID);
if (ret < 0) if (priv->has_phycr2) {
return ret; ret = phy_read_paged(phydev, 0xa43, RTL8211F_PHYCR2);
if (ret < 0)
return ret;
priv->phycr2 = ret & RTL8211F_CLKOUT_EN; priv->phycr2 = ret & RTL8211F_CLKOUT_EN;
if (of_property_read_bool(dev->of_node, "realtek,clkout-disable")) if (of_property_read_bool(dev->of_node, "realtek,clkout-disable"))
priv->phycr2 &= ~RTL8211F_CLKOUT_EN; priv->phycr2 &= ~RTL8211F_CLKOUT_EN;
}
phydev->priv = priv; phydev->priv = priv;
...@@ -400,12 +406,14 @@ static int rtl8211f_config_init(struct phy_device *phydev) ...@@ -400,12 +406,14 @@ static int rtl8211f_config_init(struct phy_device *phydev)
val_rxdly ? "enabled" : "disabled"); val_rxdly ? "enabled" : "disabled");
} }
ret = phy_modify_paged(phydev, 0xa43, RTL8211F_PHYCR2, if (priv->has_phycr2) {
RTL8211F_CLKOUT_EN, priv->phycr2); ret = phy_modify_paged(phydev, 0xa43, RTL8211F_PHYCR2,
if (ret < 0) { RTL8211F_CLKOUT_EN, priv->phycr2);
dev_err(dev, "clkout configuration failed: %pe\n", if (ret < 0) {
ERR_PTR(ret)); dev_err(dev, "clkout configuration failed: %pe\n",
return ret; ERR_PTR(ret));
return ret;
}
} }
return genphy_soft_reset(phydev); return genphy_soft_reset(phydev);
...@@ -923,6 +931,18 @@ static struct phy_driver realtek_drvs[] = { ...@@ -923,6 +931,18 @@ static struct phy_driver realtek_drvs[] = {
.resume = rtl821x_resume, .resume = rtl821x_resume,
.read_page = rtl821x_read_page, .read_page = rtl821x_read_page,
.write_page = rtl821x_write_page, .write_page = rtl821x_write_page,
}, {
PHY_ID_MATCH_EXACT(RTL_8211FVD_PHYID),
.name = "RTL8211F-VD Gigabit Ethernet",
.probe = rtl821x_probe,
.config_init = &rtl8211f_config_init,
.read_status = rtlgen_read_status,
.config_intr = &rtl8211f_config_intr,
.handle_interrupt = rtl8211f_handle_interrupt,
.suspend = genphy_suspend,
.resume = rtl821x_resume,
.read_page = rtl821x_read_page,
.write_page = rtl821x_write_page,
}, { }, {
.name = "Generic FE-GE Realtek PHY", .name = "Generic FE-GE Realtek PHY",
.match_phy_device = rtlgen_match_phy_device, .match_phy_device = rtlgen_match_phy_device,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment