[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <d9bb2855-e9a1-239f-b1cd-2be8294f357a@gmail.com>
Date: Fri, 25 Dec 2020 18:08:24 +0100
From: Heiner Kallweit <hkallweit1@...il.com>
To: Yuusuke Ashizuka <ashiduka@...itsu.com>, andrew@...n.ch,
linux@...linux.org.uk, davem@...emloft.net, kuba@...nel.org
Cc: netdev@...r.kernel.org, torii.ken1@...itsu.com
Subject: Re: [PATCH] net: phy: realtek: Add support for RTL9000AA/AN
On 25.12.2020 01:47, Yuusuke Ashizuka wrote:
> 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",
Better don't use a slash in the name. This breaks usage of sysfs:
/sys/bus/mdio_bus/drivers/<driver_name>
> + .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,
> },
> };
>
>
Powered by blists - more mailing lists