Skip to content

Commit 4145f00

Browse files
Krzysztof Hałasakuba-moo
authored andcommitted
usbnet: asix AX88772: leave the carrier control to phylink
ASIX AX88772B based USB 10/100 Ethernet adapter doesn't come up ("carrier off"), despite the built-in 100BASE-FX PHY positive link indication. The internal PHY is configured (using EEPROM) in fixed 100 Mbps full duplex mode. The primary problem appears to be using carrier_netif_{on,off}() while, at the same time, delegating carrier management to phylink. Use only the latter and remove "manual control" in the asix driver. I don't have any other AX88772 board here, but the problem doesn't seem specific to a particular board or settings - it's probably timing-dependent. Remove unused asix_adjust_link() as well. Signed-off-by: Krzysztof Hałasa <[email protected]> Tested-by: Oleksij Rempel <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 8127837 commit 4145f00

File tree

3 files changed

+4
-36
lines changed

3 files changed

+4
-36
lines changed

drivers/net/usb/asix.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,6 @@ int asix_write_rx_ctl(struct usbnet *dev, u16 mode, int in_pm);
224224

225225
u16 asix_read_medium_status(struct usbnet *dev, int in_pm);
226226
int asix_write_medium_mode(struct usbnet *dev, u16 mode, int in_pm);
227-
void asix_adjust_link(struct net_device *netdev);
228227

229228
int asix_write_gpio(struct usbnet *dev, u16 value, int sleep, int in_pm);
230229

drivers/net/usb/asix_common.c

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -414,28 +414,6 @@ int asix_write_medium_mode(struct usbnet *dev, u16 mode, int in_pm)
414414
return ret;
415415
}
416416

417-
/* set MAC link settings according to information from phylib */
418-
void asix_adjust_link(struct net_device *netdev)
419-
{
420-
struct phy_device *phydev = netdev->phydev;
421-
struct usbnet *dev = netdev_priv(netdev);
422-
u16 mode = 0;
423-
424-
if (phydev->link) {
425-
mode = AX88772_MEDIUM_DEFAULT;
426-
427-
if (phydev->duplex == DUPLEX_HALF)
428-
mode &= ~AX_MEDIUM_FD;
429-
430-
if (phydev->speed != SPEED_100)
431-
mode &= ~AX_MEDIUM_PS;
432-
}
433-
434-
asix_write_medium_mode(dev, mode, 0);
435-
phy_print_status(phydev);
436-
usbnet_link_change(dev, phydev->link, 0);
437-
}
438-
439417
int asix_write_gpio(struct usbnet *dev, u16 value, int sleep, int in_pm)
440418
{
441419
int ret;

drivers/net/usb/asix_devices.c

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -752,7 +752,6 @@ static void ax88772_mac_link_down(struct phylink_config *config,
752752
struct usbnet *dev = netdev_priv(to_net_dev(config->dev));
753753

754754
asix_write_medium_mode(dev, 0, 0);
755-
usbnet_link_change(dev, false, false);
756755
}
757756

758757
static void ax88772_mac_link_up(struct phylink_config *config,
@@ -783,7 +782,6 @@ static void ax88772_mac_link_up(struct phylink_config *config,
783782
m |= AX_MEDIUM_RFC;
784783

785784
asix_write_medium_mode(dev, m, 0);
786-
usbnet_link_change(dev, true, false);
787785
}
788786

789787
static const struct phylink_mac_ops ax88772_phylink_mac_ops = {
@@ -1350,10 +1348,9 @@ static const struct driver_info ax88772_info = {
13501348
.description = "ASIX AX88772 USB 2.0 Ethernet",
13511349
.bind = ax88772_bind,
13521350
.unbind = ax88772_unbind,
1353-
.status = asix_status,
13541351
.reset = ax88772_reset,
13551352
.stop = ax88772_stop,
1356-
.flags = FLAG_ETHER | FLAG_FRAMING_AX | FLAG_LINK_INTR | FLAG_MULTI_PACKET,
1353+
.flags = FLAG_ETHER | FLAG_FRAMING_AX | FLAG_MULTI_PACKET,
13571354
.rx_fixup = asix_rx_fixup_common,
13581355
.tx_fixup = asix_tx_fixup,
13591356
};
@@ -1362,11 +1359,9 @@ static const struct driver_info ax88772b_info = {
13621359
.description = "ASIX AX88772B USB 2.0 Ethernet",
13631360
.bind = ax88772_bind,
13641361
.unbind = ax88772_unbind,
1365-
.status = asix_status,
13661362
.reset = ax88772_reset,
13671363
.stop = ax88772_stop,
1368-
.flags = FLAG_ETHER | FLAG_FRAMING_AX | FLAG_LINK_INTR |
1369-
FLAG_MULTI_PACKET,
1364+
.flags = FLAG_ETHER | FLAG_FRAMING_AX | FLAG_MULTI_PACKET,
13701365
.rx_fixup = asix_rx_fixup_common,
13711366
.tx_fixup = asix_tx_fixup,
13721367
.data = FLAG_EEPROM_MAC,
@@ -1376,11 +1371,9 @@ static const struct driver_info lxausb_t1l_info = {
13761371
.description = "Linux Automation GmbH USB 10Base-T1L",
13771372
.bind = ax88772_bind,
13781373
.unbind = ax88772_unbind,
1379-
.status = asix_status,
13801374
.reset = ax88772_reset,
13811375
.stop = ax88772_stop,
1382-
.flags = FLAG_ETHER | FLAG_FRAMING_AX | FLAG_LINK_INTR |
1383-
FLAG_MULTI_PACKET,
1376+
.flags = FLAG_ETHER | FLAG_FRAMING_AX | FLAG_MULTI_PACKET,
13841377
.rx_fixup = asix_rx_fixup_common,
13851378
.tx_fixup = asix_tx_fixup,
13861379
.data = FLAG_EEPROM_MAC,
@@ -1412,10 +1405,8 @@ static const struct driver_info hg20f9_info = {
14121405
.description = "HG20F9 USB 2.0 Ethernet",
14131406
.bind = ax88772_bind,
14141407
.unbind = ax88772_unbind,
1415-
.status = asix_status,
14161408
.reset = ax88772_reset,
1417-
.flags = FLAG_ETHER | FLAG_FRAMING_AX | FLAG_LINK_INTR |
1418-
FLAG_MULTI_PACKET,
1409+
.flags = FLAG_ETHER | FLAG_FRAMING_AX | FLAG_MULTI_PACKET,
14191410
.rx_fixup = asix_rx_fixup_common,
14201411
.tx_fixup = asix_tx_fixup,
14211412
.data = FLAG_EEPROM_MAC,

0 commit comments

Comments
 (0)