Skip to content

Commit 04e0149

Browse files
committed
net: usb: asix: ax88772: move embedded PHY detection as early as possible
jira LE-3201 cve CVE-2021-47101 Rebuild_History Non-Buildable kernel-rt-4.18.0-553.22.1.rt7.363.el8_10 commit-author Oleksij Rempel <[email protected]> commit 7a141e6 Empty-Commit: Cherry-Pick Conflicts during history rebuild. Will be included in final tarball splat. Ref for failed cherry-pick at: ciq/ciq_backports/kernel-rt-4.18.0-553.22.1.rt7.363.el8_10/7a141e64.failed Some HW revisions need additional MAC configuration before the embedded PHY can be enabled. If this is not done, we won't be able to get response from the internal PHY. This issue was detected on chipcode == AX_AX88772_CHIPCODE variant, where ax88772_hw_reset() was executed with missing embd_phy flag. Fixes: e532a09 ("net: usb: asix: ax88772: add phylib support") Reported-by: Jarkko Nikula <[email protected]> Tested-by: Jarkko Nikula <[email protected]> Signed-off-by: Oleksij Rempel <[email protected]> Signed-off-by: David S. Miller <[email protected]> (cherry picked from commit 7a141e6) Signed-off-by: Jonathan Maple <[email protected]> # Conflicts: # drivers/net/usb/asix.h # drivers/net/usb/asix_devices.c
1 parent 4e3046c commit 04e0149

File tree

1 file changed

+139
-0
lines changed

1 file changed

+139
-0
lines changed
Lines changed: 139 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
1+
net: usb: asix: ax88772: move embedded PHY detection as early as possible
2+
3+
jira LE-3201
4+
cve CVE-2021-47101
5+
Rebuild_History Non-Buildable kernel-rt-4.18.0-553.22.1.rt7.363.el8_10
6+
commit-author Oleksij Rempel <[email protected]>
7+
commit 7a141e64cf14099d84e530db0e86fcb2c489e341
8+
Empty-Commit: Cherry-Pick Conflicts during history rebuild.
9+
Will be included in final tarball splat. Ref for failed cherry-pick at:
10+
ciq/ciq_backports/kernel-rt-4.18.0-553.22.1.rt7.363.el8_10/7a141e64.failed
11+
12+
Some HW revisions need additional MAC configuration before the embedded PHY
13+
can be enabled. If this is not done, we won't be able to get response
14+
from the internal PHY.
15+
16+
This issue was detected on chipcode == AX_AX88772_CHIPCODE variant,
17+
where ax88772_hw_reset() was executed with missing embd_phy flag.
18+
19+
Fixes: e532a096be0e ("net: usb: asix: ax88772: add phylib support")
20+
Reported-by: Jarkko Nikula <[email protected]>
21+
Tested-by: Jarkko Nikula <[email protected]>
22+
Signed-off-by: Oleksij Rempel <[email protected]>
23+
Signed-off-by: David S. Miller <[email protected]>
24+
(cherry picked from commit 7a141e64cf14099d84e530db0e86fcb2c489e341)
25+
Signed-off-by: Jonathan Maple <[email protected]>
26+
27+
# Conflicts:
28+
# drivers/net/usb/asix.h
29+
# drivers/net/usb/asix_devices.c
30+
diff --cc drivers/net/usb/asix.h
31+
index a337c5c1945f,2a1e31defe71..000000000000
32+
--- a/drivers/net/usb/asix.h
33+
+++ b/drivers/net/usb/asix.h
34+
@@@ -190,6 -180,11 +190,14 @@@ struct asix_common_private
35+
u16 presvd_phy_advertise;
36+
u16 presvd_phy_bmcr;
37+
struct asix_rx_fixup_info rx_fixup_info;
38+
++<<<<<<< HEAD
39+
++=======
40+
+ struct mii_bus *mdio;
41+
+ struct phy_device *phydev;
42+
+ u16 phy_addr;
43+
+ char phy_name[20];
44+
+ bool embd_phy;
45+
++>>>>>>> 7a141e64cf14 (net: usb: asix: ax88772: move embedded PHY detection as early as possible)
46+
};
47+
48+
extern const struct driver_info ax88172a_info;
49+
diff --cc drivers/net/usb/asix_devices.c
50+
index 08e5168f1e5f,15460d419e3f..000000000000
51+
--- a/drivers/net/usb/asix_devices.c
52+
+++ b/drivers/net/usb/asix_devices.c
53+
@@@ -689,13 -657,63 +687,66 @@@ static int asix_resume(struct usb_inter
54+
return usbnet_resume(intf);
55+
}
56+
57+
++<<<<<<< HEAD
58+
++=======
59+
+ static int ax88772_init_mdio(struct usbnet *dev)
60+
+ {
61+
+ struct asix_common_private *priv = dev->driver_priv;
62+
+
63+
+ priv->mdio = devm_mdiobus_alloc(&dev->udev->dev);
64+
+ if (!priv->mdio)
65+
+ return -ENOMEM;
66+
+
67+
+ priv->mdio->priv = dev;
68+
+ priv->mdio->read = &asix_mdio_bus_read;
69+
+ priv->mdio->write = &asix_mdio_bus_write;
70+
+ priv->mdio->name = "Asix MDIO Bus";
71+
+ /* mii bus name is usb-<usb bus number>-<usb device number> */
72+
+ snprintf(priv->mdio->id, MII_BUS_ID_SIZE, "usb-%03d:%03d",
73+
+ dev->udev->bus->busnum, dev->udev->devnum);
74+
+
75+
+ return devm_mdiobus_register(&dev->udev->dev, priv->mdio);
76+
+ }
77+
+
78+
+ static int ax88772_init_phy(struct usbnet *dev)
79+
+ {
80+
+ struct asix_common_private *priv = dev->driver_priv;
81+
+ int ret;
82+
+
83+
+ snprintf(priv->phy_name, sizeof(priv->phy_name), PHY_ID_FMT,
84+
+ priv->mdio->id, priv->phy_addr);
85+
+
86+
+ priv->phydev = phy_connect(dev->net, priv->phy_name, &asix_adjust_link,
87+
+ PHY_INTERFACE_MODE_INTERNAL);
88+
+ if (IS_ERR(priv->phydev)) {
89+
+ netdev_err(dev->net, "Could not connect to PHY device %s\n",
90+
+ priv->phy_name);
91+
+ ret = PTR_ERR(priv->phydev);
92+
+ return ret;
93+
+ }
94+
+
95+
+ phy_suspend(priv->phydev);
96+
+ priv->phydev->mac_managed_pm = 1;
97+
+
98+
+ phy_attached_info(priv->phydev);
99+
+
100+
+ return 0;
101+
+ }
102+
+
103+
++>>>>>>> 7a141e64cf14 (net: usb: asix: ax88772: move embedded PHY detection as early as possible)
104+
static int ax88772_bind(struct usbnet *dev, struct usb_interface *intf)
105+
{
106+
- u8 buf[ETH_ALEN] = {0}, chipcode = 0;
107+
- struct asix_common_private *priv;
108+
int ret, i;
109+
+ u8 buf[ETH_ALEN] = {0}, chipcode = 0;
110+
u32 phyid;
111+
+ struct asix_common_private *priv;
112+
113+
+ priv = devm_kzalloc(&dev->udev->dev, sizeof(*priv), GFP_KERNEL);
114+
+ if (!priv)
115+
+ return -ENOMEM;
116+
+
117+
+ dev->driver_priv = priv;
118+
+
119+
usbnet_get_endpoints(dev, intf);
120+
121+
/* Maybe the boot loader passed the MAC address via device tree */
122+
@@@ -764,12 -778,6 +822,15 @@@
123+
dev->rx_urb_size = 2048;
124+
}
125+
126+
++<<<<<<< HEAD
127+
+ dev->driver_priv = kzalloc(sizeof(struct asix_common_private), GFP_KERNEL);
128+
+ if (!dev->driver_priv)
129+
+ return -ENOMEM;
130+
+
131+
+ priv = dev->driver_priv;
132+
+
133+
++=======
134+
++>>>>>>> 7a141e64cf14 (net: usb: asix: ax88772: move embedded PHY detection as early as possible)
135+
priv->presvd_phy_bmcr = 0;
136+
priv->presvd_phy_advertise = 0;
137+
if (chipcode == AX_AX88772_CHIPCODE) {
138+
* Unmerged path drivers/net/usb/asix.h
139+
* Unmerged path drivers/net/usb/asix_devices.c

0 commit comments

Comments
 (0)