gpio-nct5104d: fix compilation with kernel 6.6
[openwrt/openwrt.git] / target / linux / generic / backport-5.15 / 738-v6.9-net-phy-aquantia-add-AQR111-and-AQR111B0-PHY-ID.patch
1 From 038ba1dc4e54d51d953f5618d8eb5dd39bd9de25 Mon Sep 17 00:00:00 2001
2 From: Christian Marangi <ansuelsmth@gmail.com>
3 Date: Tue, 13 Feb 2024 14:35:51 +0100
4 Subject: [PATCH] net: phy: aquantia: add AQR111 and AQR111B0 PHY ID
5
6 Add Aquantia AQR111 and AQR111B0 PHY ID. These PHY advertise 10G speed
7 but actually supports up to 5G speed, hence some manual fixup is needed.
8
9 The Aquantia AQR111B0 PHY is just a variant of the AQR111 with smaller
10 chip size.
11
12 Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
13 Reviewed-by: Andrew Lunn <andrew@lunn.ch>
14 Reviewed-by: Andrew Lunn <andrew@lunn.ch>
15 Link: https://lore.kernel.org/r/20240213133558.1836-1-ansuelsmth@gmail.com
16 Signed-off-by: Paolo Abeni <pabeni@redhat.com>
17 ---
18 drivers/net/phy/aquantia/aquantia_main.c | 52 ++++++++++++++++++++++++
19 1 file changed, 52 insertions(+)
20
21 --- a/drivers/net/phy/aquantia/aquantia_main.c
22 +++ b/drivers/net/phy/aquantia/aquantia_main.c
23 @@ -22,6 +22,8 @@
24 #define PHY_ID_AQR107 0x03a1b4e0
25 #define PHY_ID_AQCS109 0x03a1b5c2
26 #define PHY_ID_AQR405 0x03a1b4b0
27 +#define PHY_ID_AQR111 0x03a1b610
28 +#define PHY_ID_AQR111B0 0x03a1b612
29 #define PHY_ID_AQR113C 0x31c31c12
30
31 #define MDIO_PHYXS_VEND_IF_STATUS 0xe812
32 @@ -672,6 +674,16 @@ static int aqr107_probe(struct phy_devic
33 return aqr_hwmon_probe(phydev);
34 }
35
36 +static int aqr111_config_init(struct phy_device *phydev)
37 +{
38 + /* AQR111 reports supporting speed up to 10G,
39 + * however only speeds up to 5G are supported.
40 + */
41 + phy_set_max_speed(phydev, SPEED_5000);
42 +
43 + return aqr107_config_init(phydev);
44 +}
45 +
46 static struct phy_driver aqr_driver[] = {
47 {
48 PHY_ID_MATCH_MODEL(PHY_ID_AQ1202),
49 @@ -746,6 +758,42 @@ static struct phy_driver aqr_driver[] =
50 .link_change_notify = aqr107_link_change_notify,
51 },
52 {
53 + PHY_ID_MATCH_MODEL(PHY_ID_AQR111),
54 + .name = "Aquantia AQR111",
55 + .probe = aqr107_probe,
56 + .config_init = aqr111_config_init,
57 + .config_aneg = aqr_config_aneg,
58 + .config_intr = aqr_config_intr,
59 + .handle_interrupt = aqr_handle_interrupt,
60 + .read_status = aqr107_read_status,
61 + .get_tunable = aqr107_get_tunable,
62 + .set_tunable = aqr107_set_tunable,
63 + .suspend = aqr107_suspend,
64 + .resume = aqr107_resume,
65 + .get_sset_count = aqr107_get_sset_count,
66 + .get_strings = aqr107_get_strings,
67 + .get_stats = aqr107_get_stats,
68 + .link_change_notify = aqr107_link_change_notify,
69 +},
70 +{
71 + PHY_ID_MATCH_MODEL(PHY_ID_AQR111B0),
72 + .name = "Aquantia AQR111B0",
73 + .probe = aqr107_probe,
74 + .config_init = aqr111_config_init,
75 + .config_aneg = aqr_config_aneg,
76 + .config_intr = aqr_config_intr,
77 + .handle_interrupt = aqr_handle_interrupt,
78 + .read_status = aqr107_read_status,
79 + .get_tunable = aqr107_get_tunable,
80 + .set_tunable = aqr107_set_tunable,
81 + .suspend = aqr107_suspend,
82 + .resume = aqr107_resume,
83 + .get_sset_count = aqr107_get_sset_count,
84 + .get_strings = aqr107_get_strings,
85 + .get_stats = aqr107_get_stats,
86 + .link_change_notify = aqr107_link_change_notify,
87 +},
88 +{
89 PHY_ID_MATCH_MODEL(PHY_ID_AQR405),
90 .name = "Aquantia AQR405",
91 .config_aneg = aqr_config_aneg,
92 @@ -784,6 +832,8 @@ static struct mdio_device_id __maybe_unu
93 { PHY_ID_MATCH_MODEL(PHY_ID_AQR107) },
94 { PHY_ID_MATCH_MODEL(PHY_ID_AQCS109) },
95 { PHY_ID_MATCH_MODEL(PHY_ID_AQR405) },
96 + { PHY_ID_MATCH_MODEL(PHY_ID_AQR111) },
97 + { PHY_ID_MATCH_MODEL(PHY_ID_AQR111B0) },
98 { PHY_ID_MATCH_MODEL(PHY_ID_AQR113C) },
99 { }
100 };