build: don't drop 'user' flag when using the ImageBuilder
[openwrt/staging/jow.git] / target / linux / generic / hack-6.1 / 726-net-phy-aquantia-enable-AQR111-and-AQR111B0.patch
1 Author: Thomas Kupper <thomas.kupper@gmail.com>
2 Date: Wed May 24 21:14:17 2023 +0200
3
4 kernel: phy: add Aquantia PHY AQR111 & AQR111B0
5
6 Add the IDs for Aquantia PHY AQR111 and AQR111B0 as found in the GPL sources
7 of the Netgear RAX120v2 firmware v1.2.8.40.
8
9 This is a 5GbE chip but it reports support for 10G. Implement config_init()
10 to set max speed to 5G.
11
12 Signed-off-by: Thomas Kupper <thomas.kupper@gmail.com>
13 --- a/drivers/net/phy/aquantia/aquantia_main.c
14 +++ b/drivers/net/phy/aquantia/aquantia_main.c
15 @@ -24,6 +24,8 @@
16 #define PHY_ID_AQR405 0x03a1b4b0
17 #define PHY_ID_AQR113C 0x31c31c12
18 #define PHY_ID_AQR813 0x31c31cb2
19 +#define PHY_ID_AQR111 0x03a1b610
20 +#define PHY_ID_AQR111B0 0x03a1b612
21 #define PHY_ID_AQR112 0x03a1b662
22 #define PHY_ID_AQR412 0x03a1b712
23 #define PHY_ID_AQR113 0x31c31c40
24 @@ -674,6 +676,34 @@ static int aqcs109_config_init(struct ph
25 return aqr107_set_downshift(phydev, MDIO_AN_VEND_PROV_DOWNSHIFT_DFLT);
26 }
27
28 +static int aqr111_config_init(struct phy_device *phydev)
29 +{
30 + int ret;
31 +
32 + /* Check that the PHY interface type is compatible */
33 + if (phydev->interface != PHY_INTERFACE_MODE_SGMII &&
34 + phydev->interface != PHY_INTERFACE_MODE_1000BASEKX &&
35 + phydev->interface != PHY_INTERFACE_MODE_2500BASEX &&
36 + phydev->interface != PHY_INTERFACE_MODE_XGMII &&
37 + phydev->interface != PHY_INTERFACE_MODE_USXGMII &&
38 + phydev->interface != PHY_INTERFACE_MODE_10GKR &&
39 + phydev->interface != PHY_INTERFACE_MODE_10GBASER &&
40 + phydev->interface != PHY_INTERFACE_MODE_XAUI &&
41 + phydev->interface != PHY_INTERFACE_MODE_RXAUI)
42 + return -ENODEV;
43 +
44 + WARN(phydev->interface == PHY_INTERFACE_MODE_XGMII,
45 + "Your devicetree is out of date, please update it. The AQR107 family doesn't support XGMII, maybe you mean USXGMII.\n");
46 +
47 + ret = aqr107_wait_reset_complete(phydev);
48 + if (!ret)
49 + aqr107_chip_info(phydev);
50 +
51 + /* AQR111 reports supporting speed up to 10G, however only speeds up to 5G are supported. */
52 + phy_set_max_speed(phydev, SPEED_5000);
53 +
54 + return aqr107_set_downshift(phydev, MDIO_AN_VEND_PROV_DOWNSHIFT_DFLT);
55 +}
56 static void aqr107_link_change_notify(struct phy_device *phydev)
57 {
58 u8 fw_major, fw_minor;
59 @@ -912,6 +942,42 @@ static struct phy_driver aqr_driver[] =
60 .link_change_notify = aqr107_link_change_notify,
61 },
62 {
63 + PHY_ID_MATCH_MODEL(PHY_ID_AQR111),
64 + .name = "Aquantia AQR111",
65 + .probe = aqr107_probe,
66 + .config_init = aqr111_config_init,
67 + .config_aneg = aqr_config_aneg,
68 + .config_intr = aqr_config_intr,
69 + .handle_interrupt = aqr_handle_interrupt,
70 + .read_status = aqr107_read_status,
71 + .get_tunable = aqr107_get_tunable,
72 + .set_tunable = aqr107_set_tunable,
73 + .suspend = aqr107_suspend,
74 + .resume = aqr107_resume,
75 + .get_sset_count = aqr107_get_sset_count,
76 + .get_strings = aqr107_get_strings,
77 + .get_stats = aqr107_get_stats,
78 + .link_change_notify = aqr107_link_change_notify,
79 +},
80 +{
81 + PHY_ID_MATCH_MODEL(PHY_ID_AQR111B0),
82 + .name = "Aquantia AQR111B0",
83 + .probe = aqr107_probe,
84 + .config_init = aqr111_config_init,
85 + .config_aneg = aqr_config_aneg,
86 + .config_intr = aqr_config_intr,
87 + .handle_interrupt = aqr_handle_interrupt,
88 + .read_status = aqr107_read_status,
89 + .get_tunable = aqr107_get_tunable,
90 + .set_tunable = aqr107_set_tunable,
91 + .suspend = aqr107_suspend,
92 + .resume = aqr107_resume,
93 + .get_sset_count = aqr107_get_sset_count,
94 + .get_strings = aqr107_get_strings,
95 + .get_stats = aqr107_get_stats,
96 + .link_change_notify = aqr107_link_change_notify,
97 +},
98 +{
99 PHY_ID_MATCH_MODEL(PHY_ID_AQR112),
100 .name = "Aquantia AQR112",
101 .probe = aqr107_probe,
102 @@ -981,6 +1047,8 @@ static struct mdio_device_id __maybe_unu
103 { PHY_ID_MATCH_MODEL(PHY_ID_AQR405) },
104 { PHY_ID_MATCH_MODEL(PHY_ID_AQR113C) },
105 { PHY_ID_MATCH_MODEL(PHY_ID_AQR813) },
106 + { PHY_ID_MATCH_MODEL(PHY_ID_AQR111) },
107 + { PHY_ID_MATCH_MODEL(PHY_ID_AQR111B0) },
108 { PHY_ID_MATCH_MODEL(PHY_ID_AQR112) },
109 { PHY_ID_MATCH_MODEL(PHY_ID_AQR412) },
110 { PHY_ID_MATCH_MODEL(PHY_ID_AQR113) },