[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20201225004751.26075-1-ashiduka@fujitsu.com>
Date: Fri, 25 Dec 2020 09:47:51 +0900
From: Yuusuke Ashizuka <ashiduka@...itsu.com>
To: andrew@...n.ch, hkallweit1@...il.com, linux@...linux.org.uk,
davem@...emloft.net, kuba@...nel.org
Cc: netdev@...r.kernel.org, ashiduka@...itsu.com,
torii.ken1@...itsu.com
Subject: [PATCH] net: phy: realtek: Add support for RTL9000AA/AN
RTL9000AA/AN as 100BASE-T1 is following:
- 100 Mbps
- Full duplex
- Link Status Change Interrupt
Signed-off-by: Yuusuke Ashizuka <ashiduka@...itsu.com>
Signed-off-by: Torii Kenichi <torii.ken1@...itsu.com>
---
drivers/net/phy/realtek.c | 51 +++++++++++++++++++++++++++++++++++++++
1 file changed, 51 insertions(+)
diff --git a/drivers/net/phy/realtek.c b/drivers/net/phy/realtek.c
index 575580d3ffe0..ccd3368ba14e 100644
--- a/drivers/net/phy/realtek.c
+++ b/drivers/net/phy/realtek.c
@@ -54,6 +54,9 @@
#define RTL_LPADV_5000FULL BIT(6)
#define RTL_LPADV_2500FULL BIT(5)
+#define RTL9000A_GINMR 0x14
+#define RTL9000A_GINMR_LINK_STATUS BIT(4)
+
#define RTLGEN_SPEED_MASK 0x0630
#define RTL_GENERIC_PHYID 0x001cc800
@@ -547,6 +550,41 @@ static int rtlgen_resume(struct phy_device *phydev)
return ret;
}
+static int rtl9000a_config_init(struct phy_device *phydev)
+{
+ phydev->autoneg = AUTONEG_DISABLE;
+ phydev->speed = SPEED_100;
+ phydev->duplex = DUPLEX_FULL;
+
+ return 0;
+}
+
+static int rtl9000a_config_aneg(struct phy_device *phydev)
+{
+ return 0;
+}
+
+static int rtl9000a_ack_interrupt(struct phy_device *phydev)
+{
+ int err;
+
+ err = phy_read(phydev, RTL8211F_INSR);
+
+ return (err < 0) ? err : 0;
+}
+
+static int rtl9000a_config_intr(struct phy_device *phydev)
+{
+ u16 val;
+
+ if (phydev->interrupts == PHY_INTERRUPT_ENABLED)
+ val = (u16)~RTL9000A_GINMR_LINK_STATUS;
+ else
+ val = ~0;
+
+ return phy_write_paged(phydev, 0xa42, RTL9000A_GINMR, val);
+}
+
static struct phy_driver realtek_drvs[] = {
{
PHY_ID_MATCH_EXACT(0x00008201),
@@ -674,6 +712,19 @@ static struct phy_driver realtek_drvs[] = {
.config_intr = genphy_no_config_intr,
.suspend = genphy_suspend,
.resume = genphy_resume,
+ }, {
+ PHY_ID_MATCH_EXACT(0x001ccb00),
+ .name = "RTL9000AA/AN Ethernet",
+ .features = PHY_BASIC_T1_FEATURES,
+ .config_init = rtl9000a_config_init,
+ .config_aneg = rtl9000a_config_aneg,
+ .read_status = genphy_update_link,
+ .ack_interrupt = rtl9000a_ack_interrupt,
+ .config_intr = rtl9000a_config_intr,
+ .suspend = genphy_suspend,
+ .resume = genphy_resume,
+ .read_page = rtl821x_read_page,
+ .write_page = rtl821x_write_page,
},
};
--
2.29.2
Powered by blists - more mailing lists