f6bc97a60bd808db04e0523d7a6a460b5f4b4956
[openwrt/staging/xback.git] /
1 From 225990c487c1023e7b3aa89beb6a68011fbc0461 Mon Sep 17 00:00:00 2001
2 From: Mark Mentovai <mark@mentovai.com>
3 Date: Thu, 25 Jul 2024 16:41:44 -0400
4 Subject: [PATCH] net: phy: realtek: add support for RTL8366S Gigabit PHY
5
6 The PHY built in to the Realtek RTL8366S switch controller was
7 previously supported by genphy_driver. This PHY does not implement MMD
8 operations. Since commit 9b01c885be36 ("net: phy: c22: migrate to
9 genphy_c45_write_eee_adv()"), MMD register reads have been made during
10 phy_probe to determine EEE support. For genphy_driver, these reads are
11 transformed into 802.3 annex 22D clause 45-over-clause 22
12 mmd_phy_indirect operations that perform MII register writes to
13 MII_MMD_CTRL and MII_MMD_DATA. This overwrites those two MII registers,
14 which on this PHY are reserved and have another function, rendering the
15 PHY unusable while so configured.
16
17 Proper support for this PHY is restored by providing a phy_driver that
18 declares MMD operations as unsupported by using the helper functions
19 provided for that purpose, while remaining otherwise identical to
20 genphy_driver.
21
22 Fixes: 9b01c885be36 ("net: phy: c22: migrate to genphy_c45_write_eee_adv()")
23 Reported-by: Russell Senior <russell@personaltelco.net>
24 Closes: https://github.com/openwrt/openwrt/issues/15981
25 Link: https://github.com/openwrt/openwrt/issues/15739
26 Signed-off-by: Mark Mentovai <mark@mentovai.com>
27 Reviewed-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
28 Signed-off-by: David S. Miller <davem@davemloft.net>
29 ---
30 drivers/net/phy/realtek.c | 7 +++++++
31 1 file changed, 7 insertions(+)
32
33 --- a/drivers/net/phy/realtek.c
34 +++ b/drivers/net/phy/realtek.c
35 @@ -1083,6 +1083,13 @@ static struct phy_driver realtek_drvs[]
36 .handle_interrupt = genphy_handle_interrupt_no_ack,
37 .suspend = genphy_suspend,
38 .resume = genphy_resume,
39 + }, {
40 + PHY_ID_MATCH_EXACT(0x001cc960),
41 + .name = "RTL8366S Gigabit Ethernet",
42 + .suspend = genphy_suspend,
43 + .resume = genphy_resume,
44 + .read_mmd = genphy_read_mmd_unsupported,
45 + .write_mmd = genphy_write_mmd_unsupported,
46 },
47 };
48