1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * ASIX AX88179/178A USB 3.0/2.0 to Gigabit Ethernet Devices
5 * Copyright (C) 2011-2013 ASIX
8 #include <linux/module.h>
9 #include <linux/etherdevice.h>
10 #include <linux/mii.h>
11 #include <linux/usb.h>
12 #include <linux/crc32.h>
13 #include <linux/usb/usbnet.h>
14 #include <uapi/linux/mdio.h>
15 #include <linux/mdio.h>
17 #define AX88179_PHY_ID 0x03
18 #define AX_EEPROM_LEN 0x100
19 #define AX88179_EEPROM_MAGIC 0x17900b95
20 #define AX_MCAST_FLTSIZE 8
21 #define AX_MAX_MCAST 64
22 #define AX_INT_PPLS_LINK ((u32)BIT(16))
23 #define AX_RXHDR_L4_TYPE_MASK 0x1c
24 #define AX_RXHDR_L4_TYPE_UDP 4
25 #define AX_RXHDR_L4_TYPE_TCP 16
26 #define AX_RXHDR_L3CSUM_ERR 2
27 #define AX_RXHDR_L4CSUM_ERR 1
28 #define AX_RXHDR_CRC_ERR ((u32)BIT(29))
29 #define AX_RXHDR_DROP_ERR ((u32)BIT(31))
30 #define AX_ACCESS_MAC 0x01
31 #define AX_ACCESS_PHY 0x02
32 #define AX_ACCESS_EEPROM 0x04
33 #define AX_ACCESS_EFUS 0x05
34 #define AX_RELOAD_EEPROM_EFUSE 0x06
35 #define AX_PAUSE_WATERLVL_HIGH 0x54
36 #define AX_PAUSE_WATERLVL_LOW 0x55
38 #define PHYSICAL_LINK_STATUS 0x02
39 #define AX_USB_SS 0x04
40 #define AX_USB_HS 0x02
42 #define GENERAL_STATUS 0x03
43 /* Check AX88179 version. UA1:Bit2 = 0, UA2:Bit2 = 1 */
46 #define AX_SROM_ADDR 0x07
47 #define AX_SROM_CMD 0x0a
51 #define AX_SROM_DATA_LOW 0x08
52 #define AX_SROM_DATA_HIGH 0x09
54 #define AX_RX_CTL 0x0b
55 #define AX_RX_CTL_DROPCRCERR 0x0100
56 #define AX_RX_CTL_IPE 0x0200
57 #define AX_RX_CTL_START 0x0080
58 #define AX_RX_CTL_AP 0x0020
59 #define AX_RX_CTL_AM 0x0010
60 #define AX_RX_CTL_AB 0x0008
61 #define AX_RX_CTL_AMALL 0x0002
62 #define AX_RX_CTL_PRO 0x0001
63 #define AX_RX_CTL_STOP 0x0000
65 #define AX_NODE_ID 0x10
66 #define AX_MULFLTARY 0x16
68 #define AX_MEDIUM_STATUS_MODE 0x22
69 #define AX_MEDIUM_GIGAMODE 0x01
70 #define AX_MEDIUM_FULL_DUPLEX 0x02
71 #define AX_MEDIUM_EN_125MHZ 0x08
72 #define AX_MEDIUM_RXFLOW_CTRLEN 0x10
73 #define AX_MEDIUM_TXFLOW_CTRLEN 0x20
74 #define AX_MEDIUM_RECEIVE_EN 0x100
75 #define AX_MEDIUM_PS 0x200
76 #define AX_MEDIUM_JUMBO_EN 0x8040
78 #define AX_MONITOR_MOD 0x24
79 #define AX_MONITOR_MODE_RWLC 0x02
80 #define AX_MONITOR_MODE_RWMP 0x04
81 #define AX_MONITOR_MODE_PMEPOL 0x20
82 #define AX_MONITOR_MODE_PMETYPE 0x40
84 #define AX_GPIO_CTRL 0x25
85 #define AX_GPIO_CTRL_GPIO3EN 0x80
86 #define AX_GPIO_CTRL_GPIO2EN 0x40
87 #define AX_GPIO_CTRL_GPIO1EN 0x20
89 #define AX_PHYPWR_RSTCTL 0x26
90 #define AX_PHYPWR_RSTCTL_BZ 0x0010
91 #define AX_PHYPWR_RSTCTL_IPRL 0x0020
92 #define AX_PHYPWR_RSTCTL_AT 0x1000
94 #define AX_RX_BULKIN_QCTRL 0x2e
95 #define AX_CLK_SELECT 0x33
96 #define AX_CLK_SELECT_BCS 0x01
97 #define AX_CLK_SELECT_ACS 0x02
98 #define AX_CLK_SELECT_ULR 0x08
100 #define AX_RXCOE_CTL 0x34
101 #define AX_RXCOE_IP 0x01
102 #define AX_RXCOE_TCP 0x02
103 #define AX_RXCOE_UDP 0x04
104 #define AX_RXCOE_TCPV6 0x20
105 #define AX_RXCOE_UDPV6 0x40
107 #define AX_TXCOE_CTL 0x35
108 #define AX_TXCOE_IP 0x01
109 #define AX_TXCOE_TCP 0x02
110 #define AX_TXCOE_UDP 0x04
111 #define AX_TXCOE_TCPV6 0x20
112 #define AX_TXCOE_UDPV6 0x40
114 #define AX_LEDCTRL 0x73
116 #define GMII_PHY_PHYSR 0x11
117 #define GMII_PHY_PHYSR_SMASK 0xc000
118 #define GMII_PHY_PHYSR_GIGA 0x8000
119 #define GMII_PHY_PHYSR_100 0x4000
120 #define GMII_PHY_PHYSR_FULL 0x2000
121 #define GMII_PHY_PHYSR_LINK 0x400
123 #define GMII_LED_ACT 0x1a
124 #define GMII_LED_ACTIVE_MASK 0xff8f
125 #define GMII_LED0_ACTIVE BIT(4)
126 #define GMII_LED1_ACTIVE BIT(5)
127 #define GMII_LED2_ACTIVE BIT(6)
129 #define GMII_LED_LINK 0x1c
130 #define GMII_LED_LINK_MASK 0xf888
131 #define GMII_LED0_LINK_10 BIT(0)
132 #define GMII_LED0_LINK_100 BIT(1)
133 #define GMII_LED0_LINK_1000 BIT(2)
134 #define GMII_LED1_LINK_10 BIT(4)
135 #define GMII_LED1_LINK_100 BIT(5)
136 #define GMII_LED1_LINK_1000 BIT(6)
137 #define GMII_LED2_LINK_10 BIT(8)
138 #define GMII_LED2_LINK_100 BIT(9)
139 #define GMII_LED2_LINK_1000 BIT(10)
140 #define LED0_ACTIVE BIT(0)
141 #define LED0_LINK_10 BIT(1)
142 #define LED0_LINK_100 BIT(2)
143 #define LED0_LINK_1000 BIT(3)
144 #define LED0_FD BIT(4)
145 #define LED0_USB3_MASK 0x001f
146 #define LED1_ACTIVE BIT(5)
147 #define LED1_LINK_10 BIT(6)
148 #define LED1_LINK_100 BIT(7)
149 #define LED1_LINK_1000 BIT(8)
150 #define LED1_FD BIT(9)
151 #define LED1_USB3_MASK 0x03e0
152 #define LED2_ACTIVE BIT(10)
153 #define LED2_LINK_1000 BIT(13)
154 #define LED2_LINK_100 BIT(12)
155 #define LED2_LINK_10 BIT(11)
156 #define LED2_FD BIT(14)
157 #define LED_VALID BIT(15)
158 #define LED2_USB3_MASK 0x7c00
160 #define GMII_PHYPAGE 0x1e
161 #define GMII_PHY_PAGE_SELECT 0x1f
162 #define GMII_PHY_PGSEL_EXT 0x0007
163 #define GMII_PHY_PGSEL_PAGE0 0x0000
164 #define GMII_PHY_PGSEL_PAGE3 0x0003
165 #define GMII_PHY_PGSEL_PAGE5 0x0005
167 static int ax88179_reset(struct usbnet
*dev
);
169 struct ax88179_data
{
179 struct ax88179_int_data
{
184 static const struct {
185 unsigned char ctrl
, timer_l
, timer_h
, size
, ifg
;
186 } AX88179_BULKIN_SIZE
[] = {
187 {7, 0x4f, 0, 0x12, 0xff},
188 {7, 0x20, 3, 0x16, 0xff},
189 {7, 0xae, 7, 0x18, 0xff},
190 {7, 0xcc, 0x4c, 0x18, 8},
193 static void ax88179_set_pm_mode(struct usbnet
*dev
, bool pm_mode
)
195 struct ax88179_data
*ax179_data
= dev
->driver_priv
;
197 ax179_data
->in_pm
= pm_mode
;
200 static int ax88179_in_pm(struct usbnet
*dev
)
202 struct ax88179_data
*ax179_data
= dev
->driver_priv
;
204 return ax179_data
->in_pm
;
207 static int __ax88179_read_cmd(struct usbnet
*dev
, u8 cmd
, u16 value
, u16 index
,
208 u16 size
, void *data
)
211 int (*fn
)(struct usbnet
*, u8
, u8
, u16
, u16
, void *, u16
);
212 struct ax88179_data
*ax179_data
= dev
->driver_priv
;
216 if (!ax88179_in_pm(dev
))
217 fn
= usbnet_read_cmd
;
219 fn
= usbnet_read_cmd_nopm
;
221 ret
= fn(dev
, cmd
, USB_DIR_IN
| USB_TYPE_VENDOR
| USB_RECIP_DEVICE
,
222 value
, index
, data
, size
);
224 if (unlikely((ret
< 0) && !(ret
== -ENODEV
&& ax179_data
->disconnecting
)))
225 netdev_warn(dev
->net
, "Failed to read reg index 0x%04x: %d\n",
231 static int __ax88179_write_cmd(struct usbnet
*dev
, u8 cmd
, u16 value
, u16 index
,
232 u16 size
, const void *data
)
235 int (*fn
)(struct usbnet
*, u8
, u8
, u16
, u16
, const void *, u16
);
236 struct ax88179_data
*ax179_data
= dev
->driver_priv
;
240 if (!ax88179_in_pm(dev
))
241 fn
= usbnet_write_cmd
;
243 fn
= usbnet_write_cmd_nopm
;
245 ret
= fn(dev
, cmd
, USB_DIR_OUT
| USB_TYPE_VENDOR
| USB_RECIP_DEVICE
,
246 value
, index
, data
, size
);
248 if (unlikely((ret
< 0) && !(ret
== -ENODEV
&& ax179_data
->disconnecting
)))
249 netdev_warn(dev
->net
, "Failed to write reg index 0x%04x: %d\n",
255 static void ax88179_write_cmd_async(struct usbnet
*dev
, u8 cmd
, u16 value
,
256 u16 index
, u16 size
, void *data
)
261 buf
= *((u16
*)data
);
263 usbnet_write_cmd_async(dev
, cmd
, USB_DIR_OUT
| USB_TYPE_VENDOR
|
264 USB_RECIP_DEVICE
, value
, index
, &buf
,
267 usbnet_write_cmd_async(dev
, cmd
, USB_DIR_OUT
| USB_TYPE_VENDOR
|
268 USB_RECIP_DEVICE
, value
, index
, data
,
273 static int ax88179_read_cmd(struct usbnet
*dev
, u8 cmd
, u16 value
, u16 index
,
274 u16 size
, void *data
)
280 ret
= __ax88179_read_cmd(dev
, cmd
, value
, index
, size
, &buf
);
282 *((u16
*)data
) = buf
;
283 } else if (4 == size
) {
285 ret
= __ax88179_read_cmd(dev
, cmd
, value
, index
, size
, &buf
);
287 *((u32
*)data
) = buf
;
289 ret
= __ax88179_read_cmd(dev
, cmd
, value
, index
, size
, data
);
295 static int ax88179_write_cmd(struct usbnet
*dev
, u8 cmd
, u16 value
, u16 index
,
296 u16 size
, const void *data
)
302 buf
= *((u16
*)data
);
304 ret
= __ax88179_write_cmd(dev
, cmd
, value
, index
,
307 ret
= __ax88179_write_cmd(dev
, cmd
, value
, index
,
314 static void ax88179_status(struct usbnet
*dev
, struct urb
*urb
)
316 struct ax88179_int_data
*event
;
319 if (urb
->actual_length
< 8)
322 event
= urb
->transfer_buffer
;
323 le32_to_cpus((void *)&event
->intdata1
);
325 link
= (((__force u32
)event
->intdata1
) & AX_INT_PPLS_LINK
) >> 16;
327 if (netif_carrier_ok(dev
->net
) != link
) {
328 usbnet_link_change(dev
, link
, 1);
330 netdev_info(dev
->net
, "ax88179 - Link status is: 0\n");
334 static int ax88179_mdio_read(struct net_device
*netdev
, int phy_id
, int loc
)
336 struct usbnet
*dev
= netdev_priv(netdev
);
339 ax88179_read_cmd(dev
, AX_ACCESS_PHY
, phy_id
, (__u16
)loc
, 2, &res
);
343 static void ax88179_mdio_write(struct net_device
*netdev
, int phy_id
, int loc
,
346 struct usbnet
*dev
= netdev_priv(netdev
);
349 ax88179_write_cmd(dev
, AX_ACCESS_PHY
, phy_id
, (__u16
)loc
, 2, &res
);
352 static inline int ax88179_phy_mmd_indirect(struct usbnet
*dev
, u16 prtad
,
359 ret
= ax88179_write_cmd(dev
, AX_ACCESS_PHY
, AX88179_PHY_ID
,
360 MII_MMD_CTRL
, 2, &tmp16
);
363 ret
= ax88179_write_cmd(dev
, AX_ACCESS_PHY
, AX88179_PHY_ID
,
364 MII_MMD_DATA
, 2, &tmp16
);
366 tmp16
= devad
| MII_MMD_CTRL_NOINCR
;
367 ret
= ax88179_write_cmd(dev
, AX_ACCESS_PHY
, AX88179_PHY_ID
,
368 MII_MMD_CTRL
, 2, &tmp16
);
374 ax88179_phy_read_mmd_indirect(struct usbnet
*dev
, u16 prtad
, u16 devad
)
379 ax88179_phy_mmd_indirect(dev
, prtad
, devad
);
381 ret
= ax88179_read_cmd(dev
, AX_ACCESS_PHY
, AX88179_PHY_ID
,
382 MII_MMD_DATA
, 2, &tmp16
);
390 ax88179_phy_write_mmd_indirect(struct usbnet
*dev
, u16 prtad
, u16 devad
,
395 ax88179_phy_mmd_indirect(dev
, prtad
, devad
);
397 ret
= ax88179_write_cmd(dev
, AX_ACCESS_PHY
, AX88179_PHY_ID
,
398 MII_MMD_DATA
, 2, &data
);
406 static int ax88179_suspend(struct usb_interface
*intf
, pm_message_t message
)
408 struct usbnet
*dev
= usb_get_intfdata(intf
);
409 struct ax88179_data
*priv
= dev
->driver_priv
;
413 ax88179_set_pm_mode(dev
, true);
415 usbnet_suspend(intf
, message
);
419 ax88179_read_cmd(dev
, AX_ACCESS_MAC
, AX_MONITOR_MOD
,
421 if (priv
->wolopts
& WAKE_PHY
)
422 tmp8
|= AX_MONITOR_MODE_RWLC
;
423 if (priv
->wolopts
& WAKE_MAGIC
)
424 tmp8
|= AX_MONITOR_MODE_RWMP
;
426 ax88179_write_cmd(dev
, AX_ACCESS_MAC
, AX_MONITOR_MOD
,
430 /* Disable RX path */
431 ax88179_read_cmd(dev
, AX_ACCESS_MAC
, AX_MEDIUM_STATUS_MODE
,
433 tmp16
&= ~AX_MEDIUM_RECEIVE_EN
;
434 ax88179_write_cmd(dev
, AX_ACCESS_MAC
, AX_MEDIUM_STATUS_MODE
,
437 /* Force bulk-in zero length */
438 ax88179_read_cmd(dev
, AX_ACCESS_MAC
, AX_PHYPWR_RSTCTL
,
441 tmp16
|= AX_PHYPWR_RSTCTL_BZ
| AX_PHYPWR_RSTCTL_IPRL
;
442 ax88179_write_cmd(dev
, AX_ACCESS_MAC
, AX_PHYPWR_RSTCTL
,
447 ax88179_write_cmd(dev
, AX_ACCESS_MAC
, AX_CLK_SELECT
, 1, 1, &tmp8
);
449 /* Configure RX control register => stop operation */
450 tmp16
= AX_RX_CTL_STOP
;
451 ax88179_write_cmd(dev
, AX_ACCESS_MAC
, AX_RX_CTL
, 2, 2, &tmp16
);
453 ax88179_set_pm_mode(dev
, false);
458 /* This function is used to enable the autodetach function. */
459 /* This function is determined by offset 0x43 of EEPROM */
460 static int ax88179_auto_detach(struct usbnet
*dev
)
465 if (ax88179_read_cmd(dev
, AX_ACCESS_EEPROM
, 0x43, 1, 2, &tmp16
) < 0)
468 if ((tmp16
== 0xFFFF) || (!(tmp16
& 0x0100)))
471 /* Enable Auto Detach bit */
473 ax88179_read_cmd(dev
, AX_ACCESS_MAC
, AX_CLK_SELECT
, 1, 1, &tmp8
);
474 tmp8
|= AX_CLK_SELECT_ULR
;
475 ax88179_write_cmd(dev
, AX_ACCESS_MAC
, AX_CLK_SELECT
, 1, 1, &tmp8
);
477 ax88179_read_cmd(dev
, AX_ACCESS_MAC
, AX_PHYPWR_RSTCTL
, 2, 2, &tmp16
);
478 tmp16
|= AX_PHYPWR_RSTCTL_AT
;
479 ax88179_write_cmd(dev
, AX_ACCESS_MAC
, AX_PHYPWR_RSTCTL
, 2, 2, &tmp16
);
484 static int ax88179_resume(struct usb_interface
*intf
)
486 struct usbnet
*dev
= usb_get_intfdata(intf
);
488 ax88179_set_pm_mode(dev
, true);
490 usbnet_link_change(dev
, 0, 0);
494 ax88179_set_pm_mode(dev
, false);
496 return usbnet_resume(intf
);
499 static void ax88179_disconnect(struct usb_interface
*intf
)
501 struct usbnet
*dev
= usb_get_intfdata(intf
);
502 struct ax88179_data
*ax179_data
;
507 ax179_data
= dev
->driver_priv
;
508 ax179_data
->disconnecting
= 1;
510 usbnet_disconnect(intf
);
514 ax88179_get_wol(struct net_device
*net
, struct ethtool_wolinfo
*wolinfo
)
516 struct usbnet
*dev
= netdev_priv(net
);
517 struct ax88179_data
*priv
= dev
->driver_priv
;
519 wolinfo
->supported
= priv
->wol_supported
;
520 wolinfo
->wolopts
= priv
->wolopts
;
524 ax88179_set_wol(struct net_device
*net
, struct ethtool_wolinfo
*wolinfo
)
526 struct usbnet
*dev
= netdev_priv(net
);
527 struct ax88179_data
*priv
= dev
->driver_priv
;
529 if (wolinfo
->wolopts
& ~(priv
->wol_supported
))
532 priv
->wolopts
= wolinfo
->wolopts
;
537 static int ax88179_get_eeprom_len(struct net_device
*net
)
539 return AX_EEPROM_LEN
;
543 ax88179_get_eeprom(struct net_device
*net
, struct ethtool_eeprom
*eeprom
,
546 struct usbnet
*dev
= netdev_priv(net
);
548 int first_word
, last_word
;
551 if (eeprom
->len
== 0)
554 eeprom
->magic
= AX88179_EEPROM_MAGIC
;
556 first_word
= eeprom
->offset
>> 1;
557 last_word
= (eeprom
->offset
+ eeprom
->len
- 1) >> 1;
558 eeprom_buff
= kmalloc_array(last_word
- first_word
+ 1, sizeof(u16
),
563 /* ax88179/178A returns 2 bytes from eeprom on read */
564 for (i
= first_word
; i
<= last_word
; i
++) {
565 ret
= __ax88179_read_cmd(dev
, AX_ACCESS_EEPROM
, i
, 1, 2,
566 &eeprom_buff
[i
- first_word
]);
573 memcpy(data
, (u8
*)eeprom_buff
+ (eeprom
->offset
& 1), eeprom
->len
);
579 ax88179_set_eeprom(struct net_device
*net
, struct ethtool_eeprom
*eeprom
,
582 struct usbnet
*dev
= netdev_priv(net
);
589 netdev_dbg(net
, "write EEPROM len %d, offset %d, magic 0x%x\n",
590 eeprom
->len
, eeprom
->offset
, eeprom
->magic
);
592 if (eeprom
->len
== 0)
595 if (eeprom
->magic
!= AX88179_EEPROM_MAGIC
)
598 first_word
= eeprom
->offset
>> 1;
599 last_word
= (eeprom
->offset
+ eeprom
->len
- 1) >> 1;
601 eeprom_buff
= kmalloc_array(last_word
- first_word
+ 1, sizeof(u16
),
606 /* align data to 16 bit boundaries, read the missing data from
608 if (eeprom
->offset
& 1) {
609 ret
= ax88179_read_cmd(dev
, AX_ACCESS_EEPROM
, first_word
, 1, 2,
612 netdev_err(net
, "Failed to read EEPROM at offset 0x%02x.\n", first_word
);
617 if ((eeprom
->offset
+ eeprom
->len
) & 1) {
618 ret
= ax88179_read_cmd(dev
, AX_ACCESS_EEPROM
, last_word
, 1, 2,
619 &eeprom_buff
[last_word
- first_word
]);
621 netdev_err(net
, "Failed to read EEPROM at offset 0x%02x.\n", last_word
);
626 memcpy((u8
*)eeprom_buff
+ (eeprom
->offset
& 1), data
, eeprom
->len
);
628 for (i
= first_word
; i
<= last_word
; i
++) {
629 netdev_dbg(net
, "write to EEPROM at offset 0x%02x, data 0x%04x\n",
630 i
, eeprom_buff
[i
- first_word
]);
631 ret
= ax88179_write_cmd(dev
, AX_ACCESS_EEPROM
, i
, 1, 2,
632 &eeprom_buff
[i
- first_word
]);
634 netdev_err(net
, "Failed to write EEPROM at offset 0x%02x.\n", i
);
640 /* reload EEPROM data */
641 ret
= ax88179_write_cmd(dev
, AX_RELOAD_EEPROM_EFUSE
, 0x0000, 0, 0, NULL
);
643 netdev_err(net
, "Failed to reload EEPROM data\n");
653 static int ax88179_get_link_ksettings(struct net_device
*net
,
654 struct ethtool_link_ksettings
*cmd
)
656 struct usbnet
*dev
= netdev_priv(net
);
658 mii_ethtool_get_link_ksettings(&dev
->mii
, cmd
);
663 static int ax88179_set_link_ksettings(struct net_device
*net
,
664 const struct ethtool_link_ksettings
*cmd
)
666 struct usbnet
*dev
= netdev_priv(net
);
667 return mii_ethtool_set_link_ksettings(&dev
->mii
, cmd
);
671 ax88179_ethtool_get_eee(struct usbnet
*dev
, struct ethtool_keee
*data
)
675 /* Get Supported EEE */
676 val
= ax88179_phy_read_mmd_indirect(dev
, MDIO_PCS_EEE_ABLE
,
680 mii_eee_cap1_mod_linkmode_t(data
->supported
, val
);
682 /* Get advertisement EEE */
683 val
= ax88179_phy_read_mmd_indirect(dev
, MDIO_AN_EEE_ADV
,
687 mii_eee_cap1_mod_linkmode_t(data
->advertised
, val
);
689 /* Get LP advertisement EEE */
690 val
= ax88179_phy_read_mmd_indirect(dev
, MDIO_AN_EEE_LPABLE
,
694 mii_eee_cap1_mod_linkmode_t(data
->lp_advertised
, val
);
700 ax88179_ethtool_set_eee(struct usbnet
*dev
, struct ethtool_keee
*data
)
702 u16 tmp16
= linkmode_to_mii_eee_cap1_t(data
->advertised
);
704 return ax88179_phy_write_mmd_indirect(dev
, MDIO_AN_EEE_ADV
,
708 static int ax88179_chk_eee(struct usbnet
*dev
)
710 struct ethtool_cmd ecmd
= { .cmd
= ETHTOOL_GSET
};
711 struct ax88179_data
*priv
= dev
->driver_priv
;
713 mii_ethtool_gset(&dev
->mii
, &ecmd
);
715 if (ecmd
.duplex
& DUPLEX_FULL
) {
716 int eee_lp
, eee_cap
, eee_adv
;
717 u32 lp
, cap
, adv
, supported
= 0;
719 eee_cap
= ax88179_phy_read_mmd_indirect(dev
,
723 priv
->eee_active
= 0;
727 cap
= mmd_eee_cap_to_ethtool_sup_t(eee_cap
);
729 priv
->eee_active
= 0;
733 eee_lp
= ax88179_phy_read_mmd_indirect(dev
,
737 priv
->eee_active
= 0;
741 eee_adv
= ax88179_phy_read_mmd_indirect(dev
,
746 priv
->eee_active
= 0;
750 adv
= mmd_eee_adv_to_ethtool_adv_t(eee_adv
);
751 lp
= mmd_eee_adv_to_ethtool_adv_t(eee_lp
);
752 supported
= (ecmd
.speed
== SPEED_1000
) ?
753 SUPPORTED_1000baseT_Full
:
754 SUPPORTED_100baseT_Full
;
756 if (!(lp
& adv
& supported
)) {
757 priv
->eee_active
= 0;
761 priv
->eee_active
= 1;
765 priv
->eee_active
= 0;
769 static void ax88179_disable_eee(struct usbnet
*dev
)
773 tmp16
= GMII_PHY_PGSEL_PAGE3
;
774 ax88179_write_cmd(dev
, AX_ACCESS_PHY
, AX88179_PHY_ID
,
775 GMII_PHY_PAGE_SELECT
, 2, &tmp16
);
778 ax88179_write_cmd(dev
, AX_ACCESS_PHY
, AX88179_PHY_ID
,
779 MII_PHYADDR
, 2, &tmp16
);
781 tmp16
= GMII_PHY_PGSEL_PAGE0
;
782 ax88179_write_cmd(dev
, AX_ACCESS_PHY
, AX88179_PHY_ID
,
783 GMII_PHY_PAGE_SELECT
, 2, &tmp16
);
786 static void ax88179_enable_eee(struct usbnet
*dev
)
790 tmp16
= GMII_PHY_PGSEL_PAGE3
;
791 ax88179_write_cmd(dev
, AX_ACCESS_PHY
, AX88179_PHY_ID
,
792 GMII_PHY_PAGE_SELECT
, 2, &tmp16
);
795 ax88179_write_cmd(dev
, AX_ACCESS_PHY
, AX88179_PHY_ID
,
796 MII_PHYADDR
, 2, &tmp16
);
798 tmp16
= GMII_PHY_PGSEL_PAGE5
;
799 ax88179_write_cmd(dev
, AX_ACCESS_PHY
, AX88179_PHY_ID
,
800 GMII_PHY_PAGE_SELECT
, 2, &tmp16
);
803 ax88179_write_cmd(dev
, AX_ACCESS_PHY
, AX88179_PHY_ID
,
804 MII_BMSR
, 2, &tmp16
);
806 tmp16
= GMII_PHY_PGSEL_PAGE0
;
807 ax88179_write_cmd(dev
, AX_ACCESS_PHY
, AX88179_PHY_ID
,
808 GMII_PHY_PAGE_SELECT
, 2, &tmp16
);
811 static int ax88179_get_eee(struct net_device
*net
, struct ethtool_keee
*edata
)
813 struct usbnet
*dev
= netdev_priv(net
);
814 struct ax88179_data
*priv
= dev
->driver_priv
;
816 edata
->eee_enabled
= priv
->eee_enabled
;
817 edata
->eee_active
= priv
->eee_active
;
819 return ax88179_ethtool_get_eee(dev
, edata
);
822 static int ax88179_set_eee(struct net_device
*net
, struct ethtool_keee
*edata
)
824 struct usbnet
*dev
= netdev_priv(net
);
825 struct ax88179_data
*priv
= dev
->driver_priv
;
828 priv
->eee_enabled
= edata
->eee_enabled
;
829 if (!priv
->eee_enabled
) {
830 ax88179_disable_eee(dev
);
832 priv
->eee_enabled
= ax88179_chk_eee(dev
);
833 if (!priv
->eee_enabled
)
836 ax88179_enable_eee(dev
);
839 ret
= ax88179_ethtool_set_eee(dev
, edata
);
843 mii_nway_restart(&dev
->mii
);
845 usbnet_link_change(dev
, 0, 0);
850 static int ax88179_ioctl(struct net_device
*net
, struct ifreq
*rq
, int cmd
)
852 struct usbnet
*dev
= netdev_priv(net
);
853 return generic_mii_ioctl(&dev
->mii
, if_mii(rq
), cmd
, NULL
);
856 static const struct ethtool_ops ax88179_ethtool_ops
= {
857 .get_link
= ethtool_op_get_link
,
858 .get_msglevel
= usbnet_get_msglevel
,
859 .set_msglevel
= usbnet_set_msglevel
,
860 .get_wol
= ax88179_get_wol
,
861 .set_wol
= ax88179_set_wol
,
862 .get_eeprom_len
= ax88179_get_eeprom_len
,
863 .get_eeprom
= ax88179_get_eeprom
,
864 .set_eeprom
= ax88179_set_eeprom
,
865 .get_eee
= ax88179_get_eee
,
866 .set_eee
= ax88179_set_eee
,
867 .nway_reset
= usbnet_nway_reset
,
868 .get_link_ksettings
= ax88179_get_link_ksettings
,
869 .set_link_ksettings
= ax88179_set_link_ksettings
,
870 .get_ts_info
= ethtool_op_get_ts_info
,
873 static void ax88179_set_multicast(struct net_device
*net
)
875 struct usbnet
*dev
= netdev_priv(net
);
876 struct ax88179_data
*data
= dev
->driver_priv
;
877 u8
*m_filter
= ((u8
*)dev
->data
);
879 data
->rxctl
= (AX_RX_CTL_START
| AX_RX_CTL_AB
| AX_RX_CTL_IPE
);
881 if (net
->flags
& IFF_PROMISC
) {
882 data
->rxctl
|= AX_RX_CTL_PRO
;
883 } else if (net
->flags
& IFF_ALLMULTI
||
884 netdev_mc_count(net
) > AX_MAX_MCAST
) {
885 data
->rxctl
|= AX_RX_CTL_AMALL
;
886 } else if (netdev_mc_empty(net
)) {
887 /* just broadcast and directed */
889 /* We use dev->data for our 8 byte filter buffer
890 * to avoid allocating memory that is tricky to free later
893 struct netdev_hw_addr
*ha
;
895 memset(m_filter
, 0, AX_MCAST_FLTSIZE
);
897 netdev_for_each_mc_addr(ha
, net
) {
898 crc_bits
= ether_crc(ETH_ALEN
, ha
->addr
) >> 26;
899 *(m_filter
+ (crc_bits
>> 3)) |= (1 << (crc_bits
& 7));
902 ax88179_write_cmd_async(dev
, AX_ACCESS_MAC
, AX_MULFLTARY
,
903 AX_MCAST_FLTSIZE
, AX_MCAST_FLTSIZE
,
906 data
->rxctl
|= AX_RX_CTL_AM
;
909 ax88179_write_cmd_async(dev
, AX_ACCESS_MAC
, AX_RX_CTL
,
914 ax88179_set_features(struct net_device
*net
, netdev_features_t features
)
917 struct usbnet
*dev
= netdev_priv(net
);
918 netdev_features_t changed
= net
->features
^ features
;
920 if (changed
& NETIF_F_IP_CSUM
) {
921 ax88179_read_cmd(dev
, AX_ACCESS_MAC
, AX_TXCOE_CTL
, 1, 1, &tmp
);
922 tmp
^= AX_TXCOE_TCP
| AX_TXCOE_UDP
;
923 ax88179_write_cmd(dev
, AX_ACCESS_MAC
, AX_TXCOE_CTL
, 1, 1, &tmp
);
926 if (changed
& NETIF_F_IPV6_CSUM
) {
927 ax88179_read_cmd(dev
, AX_ACCESS_MAC
, AX_TXCOE_CTL
, 1, 1, &tmp
);
928 tmp
^= AX_TXCOE_TCPV6
| AX_TXCOE_UDPV6
;
929 ax88179_write_cmd(dev
, AX_ACCESS_MAC
, AX_TXCOE_CTL
, 1, 1, &tmp
);
932 if (changed
& NETIF_F_RXCSUM
) {
933 ax88179_read_cmd(dev
, AX_ACCESS_MAC
, AX_RXCOE_CTL
, 1, 1, &tmp
);
934 tmp
^= AX_RXCOE_IP
| AX_RXCOE_TCP
| AX_RXCOE_UDP
|
935 AX_RXCOE_TCPV6
| AX_RXCOE_UDPV6
;
936 ax88179_write_cmd(dev
, AX_ACCESS_MAC
, AX_RXCOE_CTL
, 1, 1, &tmp
);
942 static int ax88179_change_mtu(struct net_device
*net
, int new_mtu
)
944 struct usbnet
*dev
= netdev_priv(net
);
947 WRITE_ONCE(net
->mtu
, new_mtu
);
948 dev
->hard_mtu
= net
->mtu
+ net
->hard_header_len
;
950 if (net
->mtu
> 1500) {
951 ax88179_read_cmd(dev
, AX_ACCESS_MAC
, AX_MEDIUM_STATUS_MODE
,
953 tmp16
|= AX_MEDIUM_JUMBO_EN
;
954 ax88179_write_cmd(dev
, AX_ACCESS_MAC
, AX_MEDIUM_STATUS_MODE
,
957 ax88179_read_cmd(dev
, AX_ACCESS_MAC
, AX_MEDIUM_STATUS_MODE
,
959 tmp16
&= ~AX_MEDIUM_JUMBO_EN
;
960 ax88179_write_cmd(dev
, AX_ACCESS_MAC
, AX_MEDIUM_STATUS_MODE
,
964 /* max qlen depend on hard_mtu and rx_urb_size */
965 usbnet_update_max_qlen(dev
);
970 static int ax88179_set_mac_addr(struct net_device
*net
, void *p
)
972 struct usbnet
*dev
= netdev_priv(net
);
973 struct sockaddr
*addr
= p
;
976 if (netif_running(net
))
978 if (!is_valid_ether_addr(addr
->sa_data
))
979 return -EADDRNOTAVAIL
;
981 eth_hw_addr_set(net
, addr
->sa_data
);
983 /* Set the MAC address */
984 ret
= ax88179_write_cmd(dev
, AX_ACCESS_MAC
, AX_NODE_ID
, ETH_ALEN
,
985 ETH_ALEN
, net
->dev_addr
);
992 static const struct net_device_ops ax88179_netdev_ops
= {
993 .ndo_open
= usbnet_open
,
994 .ndo_stop
= usbnet_stop
,
995 .ndo_start_xmit
= usbnet_start_xmit
,
996 .ndo_tx_timeout
= usbnet_tx_timeout
,
997 .ndo_get_stats64
= dev_get_tstats64
,
998 .ndo_change_mtu
= ax88179_change_mtu
,
999 .ndo_set_mac_address
= ax88179_set_mac_addr
,
1000 .ndo_validate_addr
= eth_validate_addr
,
1001 .ndo_eth_ioctl
= ax88179_ioctl
,
1002 .ndo_set_rx_mode
= ax88179_set_multicast
,
1003 .ndo_set_features
= ax88179_set_features
,
1006 static int ax88179_check_eeprom(struct usbnet
*dev
)
1008 u8 i
, buf
, eeprom
[20];
1009 u16 csum
, delay
= HZ
/ 10;
1010 unsigned long jtimeout
;
1012 /* Read EEPROM content */
1013 for (i
= 0; i
< 6; i
++) {
1015 if (ax88179_write_cmd(dev
, AX_ACCESS_MAC
, AX_SROM_ADDR
,
1020 if (ax88179_write_cmd(dev
, AX_ACCESS_MAC
, AX_SROM_CMD
,
1024 jtimeout
= jiffies
+ delay
;
1026 ax88179_read_cmd(dev
, AX_ACCESS_MAC
, AX_SROM_CMD
,
1029 if (time_after(jiffies
, jtimeout
))
1032 } while (buf
& EEP_BUSY
);
1034 __ax88179_read_cmd(dev
, AX_ACCESS_MAC
, AX_SROM_DATA_LOW
,
1035 2, 2, &eeprom
[i
* 2]);
1037 if ((i
== 0) && (eeprom
[0] == 0xFF))
1041 csum
= eeprom
[6] + eeprom
[7] + eeprom
[8] + eeprom
[9];
1042 csum
= (csum
>> 8) + (csum
& 0xff);
1043 if ((csum
+ eeprom
[10]) != 0xff)
1049 static int ax88179_check_efuse(struct usbnet
*dev
, u16
*ledmode
)
1055 if (ax88179_read_cmd(dev
, AX_ACCESS_EFUS
, 0, 64, 64, efuse
) < 0)
1061 for (i
= 0; i
< 64; i
++)
1062 csum
= csum
+ efuse
[i
];
1065 csum
= (csum
& 0x00FF) + ((csum
>> 8) & 0x00FF);
1070 *ledmode
= (efuse
[51] << 8) | efuse
[52];
1075 static int ax88179_convert_old_led(struct usbnet
*dev
, u16
*ledvalue
)
1079 /* Loaded the old eFuse LED Mode */
1080 if (ax88179_read_cmd(dev
, AX_ACCESS_EEPROM
, 0x3C, 1, 2, &led
) < 0)
1086 led
= LED0_ACTIVE
| LED1_LINK_10
| LED1_LINK_100
|
1087 LED1_LINK_1000
| LED2_ACTIVE
| LED2_LINK_10
|
1088 LED2_LINK_100
| LED2_LINK_1000
| LED_VALID
;
1091 led
= LED0_ACTIVE
| LED1_LINK_1000
| LED2_LINK_100
| LED_VALID
;
1094 led
= LED0_ACTIVE
| LED1_LINK_1000
| LED2_LINK_100
|
1095 LED2_LINK_10
| LED_VALID
;
1098 led
= LED0_ACTIVE
| LED1_ACTIVE
| LED1_LINK_1000
| LED2_ACTIVE
|
1099 LED2_LINK_100
| LED2_LINK_10
| LED_VALID
;
1102 led
= LED0_ACTIVE
| LED1_LINK_10
| LED1_LINK_100
|
1103 LED1_LINK_1000
| LED2_ACTIVE
| LED2_LINK_10
|
1104 LED2_LINK_100
| LED2_LINK_1000
| LED_VALID
;
1113 static int ax88179_led_setting(struct usbnet
*dev
)
1115 u8 ledfd
, value
= 0;
1116 u16 tmp
, ledact
, ledlink
, ledvalue
= 0, delay
= HZ
/ 10;
1117 unsigned long jtimeout
;
1119 /* Check AX88179 version. UA1 or UA2*/
1120 ax88179_read_cmd(dev
, AX_ACCESS_MAC
, GENERAL_STATUS
, 1, 1, &value
);
1122 if (!(value
& AX_SECLD
)) { /* UA1 */
1123 value
= AX_GPIO_CTRL_GPIO3EN
| AX_GPIO_CTRL_GPIO2EN
|
1124 AX_GPIO_CTRL_GPIO1EN
;
1125 if (ax88179_write_cmd(dev
, AX_ACCESS_MAC
, AX_GPIO_CTRL
,
1131 if (!ax88179_check_eeprom(dev
)) {
1133 if (ax88179_write_cmd(dev
, AX_ACCESS_MAC
, AX_SROM_ADDR
,
1138 if (ax88179_write_cmd(dev
, AX_ACCESS_MAC
, AX_SROM_CMD
,
1142 jtimeout
= jiffies
+ delay
;
1144 ax88179_read_cmd(dev
, AX_ACCESS_MAC
, AX_SROM_CMD
,
1147 if (time_after(jiffies
, jtimeout
))
1150 } while (value
& EEP_BUSY
);
1152 ax88179_read_cmd(dev
, AX_ACCESS_MAC
, AX_SROM_DATA_HIGH
,
1154 ledvalue
= (value
<< 8);
1156 ax88179_read_cmd(dev
, AX_ACCESS_MAC
, AX_SROM_DATA_LOW
,
1160 /* load internal ROM for defaule setting */
1161 if ((ledvalue
== 0xFFFF) || ((ledvalue
& LED_VALID
) == 0))
1162 ax88179_convert_old_led(dev
, &ledvalue
);
1164 } else if (!ax88179_check_efuse(dev
, &ledvalue
)) {
1165 if ((ledvalue
== 0xFFFF) || ((ledvalue
& LED_VALID
) == 0))
1166 ax88179_convert_old_led(dev
, &ledvalue
);
1168 ax88179_convert_old_led(dev
, &ledvalue
);
1171 tmp
= GMII_PHY_PGSEL_EXT
;
1172 ax88179_write_cmd(dev
, AX_ACCESS_PHY
, AX88179_PHY_ID
,
1173 GMII_PHY_PAGE_SELECT
, 2, &tmp
);
1176 ax88179_write_cmd(dev
, AX_ACCESS_PHY
, AX88179_PHY_ID
,
1177 GMII_PHYPAGE
, 2, &tmp
);
1179 ax88179_read_cmd(dev
, AX_ACCESS_PHY
, AX88179_PHY_ID
,
1180 GMII_LED_ACT
, 2, &ledact
);
1182 ax88179_read_cmd(dev
, AX_ACCESS_PHY
, AX88179_PHY_ID
,
1183 GMII_LED_LINK
, 2, &ledlink
);
1185 ledact
&= GMII_LED_ACTIVE_MASK
;
1186 ledlink
&= GMII_LED_LINK_MASK
;
1188 if (ledvalue
& LED0_ACTIVE
)
1189 ledact
|= GMII_LED0_ACTIVE
;
1191 if (ledvalue
& LED1_ACTIVE
)
1192 ledact
|= GMII_LED1_ACTIVE
;
1194 if (ledvalue
& LED2_ACTIVE
)
1195 ledact
|= GMII_LED2_ACTIVE
;
1197 if (ledvalue
& LED0_LINK_10
)
1198 ledlink
|= GMII_LED0_LINK_10
;
1200 if (ledvalue
& LED1_LINK_10
)
1201 ledlink
|= GMII_LED1_LINK_10
;
1203 if (ledvalue
& LED2_LINK_10
)
1204 ledlink
|= GMII_LED2_LINK_10
;
1206 if (ledvalue
& LED0_LINK_100
)
1207 ledlink
|= GMII_LED0_LINK_100
;
1209 if (ledvalue
& LED1_LINK_100
)
1210 ledlink
|= GMII_LED1_LINK_100
;
1212 if (ledvalue
& LED2_LINK_100
)
1213 ledlink
|= GMII_LED2_LINK_100
;
1215 if (ledvalue
& LED0_LINK_1000
)
1216 ledlink
|= GMII_LED0_LINK_1000
;
1218 if (ledvalue
& LED1_LINK_1000
)
1219 ledlink
|= GMII_LED1_LINK_1000
;
1221 if (ledvalue
& LED2_LINK_1000
)
1222 ledlink
|= GMII_LED2_LINK_1000
;
1225 ax88179_write_cmd(dev
, AX_ACCESS_PHY
, AX88179_PHY_ID
,
1226 GMII_LED_ACT
, 2, &tmp
);
1229 ax88179_write_cmd(dev
, AX_ACCESS_PHY
, AX88179_PHY_ID
,
1230 GMII_LED_LINK
, 2, &tmp
);
1232 tmp
= GMII_PHY_PGSEL_PAGE0
;
1233 ax88179_write_cmd(dev
, AX_ACCESS_PHY
, AX88179_PHY_ID
,
1234 GMII_PHY_PAGE_SELECT
, 2, &tmp
);
1236 /* LED full duplex setting */
1238 if (ledvalue
& LED0_FD
)
1240 else if ((ledvalue
& LED0_USB3_MASK
) == 0)
1243 if (ledvalue
& LED1_FD
)
1245 else if ((ledvalue
& LED1_USB3_MASK
) == 0)
1248 if (ledvalue
& LED2_FD
)
1250 else if ((ledvalue
& LED2_USB3_MASK
) == 0)
1253 ax88179_write_cmd(dev
, AX_ACCESS_MAC
, AX_LEDCTRL
, 1, 1, &ledfd
);
1258 static void ax88179_get_mac_addr(struct usbnet
*dev
)
1262 memset(mac
, 0, sizeof(mac
));
1264 /* Maybe the boot loader passed the MAC address via device tree */
1265 if (!eth_platform_get_mac_address(&dev
->udev
->dev
, mac
)) {
1266 netif_dbg(dev
, ifup
, dev
->net
,
1267 "MAC address read from device tree");
1269 ax88179_read_cmd(dev
, AX_ACCESS_MAC
, AX_NODE_ID
, ETH_ALEN
,
1271 netif_dbg(dev
, ifup
, dev
->net
,
1272 "MAC address read from ASIX chip");
1275 if (is_valid_ether_addr(mac
)) {
1276 eth_hw_addr_set(dev
->net
, mac
);
1277 if (!is_local_ether_addr(mac
))
1278 dev
->net
->addr_assign_type
= NET_ADDR_PERM
;
1280 netdev_info(dev
->net
, "invalid MAC address, using random\n");
1283 ax88179_write_cmd(dev
, AX_ACCESS_MAC
, AX_NODE_ID
, ETH_ALEN
, ETH_ALEN
,
1284 dev
->net
->dev_addr
);
1287 static int ax88179_bind(struct usbnet
*dev
, struct usb_interface
*intf
)
1289 struct ax88179_data
*ax179_data
;
1292 ret
= usbnet_get_endpoints(dev
, intf
);
1296 ax179_data
= kzalloc(sizeof(*ax179_data
), GFP_KERNEL
);
1300 dev
->driver_priv
= ax179_data
;
1302 dev
->net
->netdev_ops
= &ax88179_netdev_ops
;
1303 dev
->net
->ethtool_ops
= &ax88179_ethtool_ops
;
1304 dev
->net
->needed_headroom
= 8;
1305 dev
->net
->max_mtu
= 4088;
1307 /* Initialize MII structure */
1308 dev
->mii
.dev
= dev
->net
;
1309 dev
->mii
.mdio_read
= ax88179_mdio_read
;
1310 dev
->mii
.mdio_write
= ax88179_mdio_write
;
1311 dev
->mii
.phy_id_mask
= 0xff;
1312 dev
->mii
.reg_num_mask
= 0xff;
1313 dev
->mii
.phy_id
= 0x03;
1314 dev
->mii
.supports_gmii
= 1;
1316 dev
->net
->features
|= NETIF_F_SG
| NETIF_F_IP_CSUM
|
1317 NETIF_F_IPV6_CSUM
| NETIF_F_RXCSUM
| NETIF_F_TSO
;
1319 dev
->net
->hw_features
|= dev
->net
->features
;
1321 netif_set_tso_max_size(dev
->net
, 16384);
1328 static void ax88179_unbind(struct usbnet
*dev
, struct usb_interface
*intf
)
1330 struct ax88179_data
*ax179_data
= dev
->driver_priv
;
1333 /* Configure RX control register => stop operation */
1334 tmp16
= AX_RX_CTL_STOP
;
1335 ax88179_write_cmd(dev
, AX_ACCESS_MAC
, AX_RX_CTL
, 2, 2, &tmp16
);
1338 ax88179_write_cmd(dev
, AX_ACCESS_MAC
, AX_CLK_SELECT
, 1, 1, &tmp16
);
1340 /* Power down ethernet PHY */
1342 ax88179_write_cmd(dev
, AX_ACCESS_MAC
, AX_PHYPWR_RSTCTL
, 2, 2, &tmp16
);
1348 ax88179_rx_checksum(struct sk_buff
*skb
, u32
*pkt_hdr
)
1350 skb
->ip_summed
= CHECKSUM_NONE
;
1352 /* checksum error bit is set */
1353 if ((*pkt_hdr
& AX_RXHDR_L3CSUM_ERR
) ||
1354 (*pkt_hdr
& AX_RXHDR_L4CSUM_ERR
))
1357 /* It must be a TCP or UDP packet with a valid checksum */
1358 if (((*pkt_hdr
& AX_RXHDR_L4_TYPE_MASK
) == AX_RXHDR_L4_TYPE_TCP
) ||
1359 ((*pkt_hdr
& AX_RXHDR_L4_TYPE_MASK
) == AX_RXHDR_L4_TYPE_UDP
))
1360 skb
->ip_summed
= CHECKSUM_UNNECESSARY
;
1363 static int ax88179_rx_fixup(struct usbnet
*dev
, struct sk_buff
*skb
)
1365 struct sk_buff
*ax_skb
;
1371 /* At the end of the SKB, there's a header telling us how many packets
1372 * are bundled into this buffer and where we can find an array of
1373 * per-packet metadata (which contains elements encoded into u16).
1376 /* SKB contents for current firmware:
1377 * <packet 1> <padding>
1379 * <packet N> <padding>
1380 * <per-packet metadata entry 1> <dummy header>
1382 * <per-packet metadata entry N> <dummy header>
1383 * <padding2> <rx_hdr>
1386 * <packet N> contains pkt_len bytes:
1387 * 2 bytes of IP alignment pseudo header
1389 * <per-packet metadata entry N> contains 4 bytes:
1390 * pkt_len and fields AX_RXHDR_*
1391 * <padding> 0-7 bytes to terminate at
1392 * 8 bytes boundary (64-bit).
1393 * <padding2> 4 bytes to make rx_hdr terminate at
1394 * 8 bytes boundary (64-bit)
1395 * <dummy-header> contains 4 bytes:
1396 * pkt_len=0 and AX_RXHDR_DROP_ERR
1397 * <rx-hdr> contains 4 bytes:
1398 * pkt_cnt and hdr_off (offset of
1399 * <per-packet metadata entry 1>)
1401 * pkt_cnt is number of entrys in the per-packet metadata.
1402 * In current firmware there is 2 entrys per packet.
1403 * The first points to the packet and the
1404 * second is a dummy header.
1405 * This was done probably to align fields in 64-bit and
1406 * maintain compatibility with old firmware.
1407 * This code assumes that <dummy header> and <padding2> are
1413 skb_trim(skb
, skb
->len
- 4);
1414 rx_hdr
= get_unaligned_le32(skb_tail_pointer(skb
));
1415 pkt_cnt
= (u16
)rx_hdr
;
1416 hdr_off
= (u16
)(rx_hdr
>> 16);
1421 /* Make sure that the bounds of the metadata array are inside the SKB
1422 * (and in front of the counter at the end).
1424 if (pkt_cnt
* 4 + hdr_off
> skb
->len
)
1426 pkt_hdr
= (u32
*)(skb
->data
+ hdr_off
);
1428 /* Packets must not overlap the metadata array */
1429 skb_trim(skb
, hdr_off
);
1431 for (; pkt_cnt
> 0; pkt_cnt
--, pkt_hdr
++) {
1432 u16 pkt_len_plus_padd
;
1435 le32_to_cpus(pkt_hdr
);
1436 pkt_len
= (*pkt_hdr
>> 16) & 0x1fff;
1437 pkt_len_plus_padd
= (pkt_len
+ 7) & 0xfff8;
1439 /* Skip dummy header used for alignment
1444 if (pkt_len_plus_padd
> skb
->len
)
1447 /* Check CRC or runt packet */
1448 if ((*pkt_hdr
& (AX_RXHDR_CRC_ERR
| AX_RXHDR_DROP_ERR
)) ||
1449 pkt_len
< 2 + ETH_HLEN
) {
1450 dev
->net
->stats
.rx_errors
++;
1451 skb_pull(skb
, pkt_len_plus_padd
);
1456 if (pkt_len_plus_padd
== skb
->len
) {
1457 skb_trim(skb
, pkt_len
);
1459 /* Skip IP alignment pseudo header */
1462 ax88179_rx_checksum(skb
, pkt_hdr
);
1466 ax_skb
= netdev_alloc_skb_ip_align(dev
->net
, pkt_len
);
1469 skb_put(ax_skb
, pkt_len
);
1470 memcpy(ax_skb
->data
, skb
->data
+ 2, pkt_len
);
1472 ax88179_rx_checksum(ax_skb
, pkt_hdr
);
1473 usbnet_skb_return(dev
, ax_skb
);
1475 skb_pull(skb
, pkt_len_plus_padd
);
1481 static struct sk_buff
*
1482 ax88179_tx_fixup(struct usbnet
*dev
, struct sk_buff
*skb
, gfp_t flags
)
1484 u32 tx_hdr1
, tx_hdr2
;
1485 int frame_size
= dev
->maxpacket
;
1490 tx_hdr2
= skb_shinfo(skb
)->gso_size
; /* Set TSO mss */
1491 if (((skb
->len
+ 8) % frame_size
) == 0)
1492 tx_hdr2
|= 0x80008000; /* Enable padding */
1494 headroom
= skb_headroom(skb
) - 8;
1496 if ((dev
->net
->features
& NETIF_F_SG
) && skb_linearize(skb
))
1499 if ((skb_header_cloned(skb
) || headroom
< 0) &&
1500 pskb_expand_head(skb
, headroom
< 0 ? 8 : 0, 0, GFP_ATOMIC
)) {
1501 dev_kfree_skb_any(skb
);
1505 ptr
= skb_push(skb
, 8);
1506 put_unaligned_le32(tx_hdr1
, ptr
);
1507 put_unaligned_le32(tx_hdr2
, ptr
+ 4);
1509 usbnet_set_skb_tx_stats(skb
, (skb_shinfo(skb
)->gso_segs
?: 1), 0);
1514 static int ax88179_link_reset(struct usbnet
*dev
)
1516 struct ax88179_data
*ax179_data
= dev
->driver_priv
;
1517 u8 tmp
[5], link_sts
;
1518 u16 mode
, tmp16
, delay
= HZ
/ 10;
1519 u32 tmp32
= 0x40000000;
1520 unsigned long jtimeout
;
1522 jtimeout
= jiffies
+ delay
;
1523 while (tmp32
& 0x40000000) {
1525 ax88179_write_cmd(dev
, AX_ACCESS_MAC
, AX_RX_CTL
, 2, 2, &mode
);
1526 ax88179_write_cmd(dev
, AX_ACCESS_MAC
, AX_RX_CTL
, 2, 2,
1527 &ax179_data
->rxctl
);
1529 /*link up, check the usb device control TX FIFO full or empty*/
1530 ax88179_read_cmd(dev
, 0x81, 0x8c, 0, 4, &tmp32
);
1532 if (time_after(jiffies
, jtimeout
))
1536 mode
= AX_MEDIUM_RECEIVE_EN
| AX_MEDIUM_TXFLOW_CTRLEN
|
1537 AX_MEDIUM_RXFLOW_CTRLEN
;
1539 ax88179_read_cmd(dev
, AX_ACCESS_MAC
, PHYSICAL_LINK_STATUS
,
1542 ax88179_read_cmd(dev
, AX_ACCESS_PHY
, AX88179_PHY_ID
,
1543 GMII_PHY_PHYSR
, 2, &tmp16
);
1545 if (!(tmp16
& GMII_PHY_PHYSR_LINK
)) {
1546 netdev_info(dev
->net
, "ax88179 - Link status is: 0\n");
1548 } else if (GMII_PHY_PHYSR_GIGA
== (tmp16
& GMII_PHY_PHYSR_SMASK
)) {
1549 mode
|= AX_MEDIUM_GIGAMODE
| AX_MEDIUM_EN_125MHZ
;
1550 if (dev
->net
->mtu
> 1500)
1551 mode
|= AX_MEDIUM_JUMBO_EN
;
1553 if (link_sts
& AX_USB_SS
)
1554 memcpy(tmp
, &AX88179_BULKIN_SIZE
[0], 5);
1555 else if (link_sts
& AX_USB_HS
)
1556 memcpy(tmp
, &AX88179_BULKIN_SIZE
[1], 5);
1558 memcpy(tmp
, &AX88179_BULKIN_SIZE
[3], 5);
1559 } else if (GMII_PHY_PHYSR_100
== (tmp16
& GMII_PHY_PHYSR_SMASK
)) {
1560 mode
|= AX_MEDIUM_PS
;
1562 if (link_sts
& (AX_USB_SS
| AX_USB_HS
))
1563 memcpy(tmp
, &AX88179_BULKIN_SIZE
[2], 5);
1565 memcpy(tmp
, &AX88179_BULKIN_SIZE
[3], 5);
1567 memcpy(tmp
, &AX88179_BULKIN_SIZE
[3], 5);
1570 /* RX bulk configuration */
1571 ax88179_write_cmd(dev
, AX_ACCESS_MAC
, AX_RX_BULKIN_QCTRL
, 5, 5, tmp
);
1573 dev
->rx_urb_size
= (1024 * (tmp
[3] + 2));
1575 if (tmp16
& GMII_PHY_PHYSR_FULL
)
1576 mode
|= AX_MEDIUM_FULL_DUPLEX
;
1577 ax88179_write_cmd(dev
, AX_ACCESS_MAC
, AX_MEDIUM_STATUS_MODE
,
1580 ax179_data
->eee_enabled
= ax88179_chk_eee(dev
);
1582 netif_carrier_on(dev
->net
);
1584 netdev_info(dev
->net
, "ax88179 - Link status is: 1\n");
1589 static int ax88179_reset(struct usbnet
*dev
)
1594 struct ax88179_data
*ax179_data
= dev
->driver_priv
;
1595 struct ethtool_keee eee_data
;
1600 /* Power up ethernet PHY */
1602 ax88179_write_cmd(dev
, AX_ACCESS_MAC
, AX_PHYPWR_RSTCTL
, 2, 2, tmp16
);
1604 *tmp16
= AX_PHYPWR_RSTCTL_IPRL
;
1605 ax88179_write_cmd(dev
, AX_ACCESS_MAC
, AX_PHYPWR_RSTCTL
, 2, 2, tmp16
);
1608 *tmp
= AX_CLK_SELECT_ACS
| AX_CLK_SELECT_BCS
;
1609 ax88179_write_cmd(dev
, AX_ACCESS_MAC
, AX_CLK_SELECT
, 1, 1, tmp
);
1612 /* Ethernet PHY Auto Detach*/
1613 ax88179_auto_detach(dev
);
1615 /* Read MAC address from DTB or asix chip */
1616 ax88179_get_mac_addr(dev
);
1617 memcpy(dev
->net
->perm_addr
, dev
->net
->dev_addr
, ETH_ALEN
);
1619 /* RX bulk configuration */
1620 memcpy(tmp
, &AX88179_BULKIN_SIZE
[0], 5);
1621 ax88179_write_cmd(dev
, AX_ACCESS_MAC
, AX_RX_BULKIN_QCTRL
, 5, 5, tmp
);
1623 dev
->rx_urb_size
= 1024 * 20;
1626 ax88179_write_cmd(dev
, AX_ACCESS_MAC
, AX_PAUSE_WATERLVL_LOW
, 1, 1, tmp
);
1629 ax88179_write_cmd(dev
, AX_ACCESS_MAC
, AX_PAUSE_WATERLVL_HIGH
,
1632 /* Enable checksum offload */
1633 *tmp
= AX_RXCOE_IP
| AX_RXCOE_TCP
| AX_RXCOE_UDP
|
1634 AX_RXCOE_TCPV6
| AX_RXCOE_UDPV6
;
1635 ax88179_write_cmd(dev
, AX_ACCESS_MAC
, AX_RXCOE_CTL
, 1, 1, tmp
);
1637 *tmp
= AX_TXCOE_IP
| AX_TXCOE_TCP
| AX_TXCOE_UDP
|
1638 AX_TXCOE_TCPV6
| AX_TXCOE_UDPV6
;
1639 ax88179_write_cmd(dev
, AX_ACCESS_MAC
, AX_TXCOE_CTL
, 1, 1, tmp
);
1641 /* Configure RX control register => start operation */
1642 *tmp16
= AX_RX_CTL_DROPCRCERR
| AX_RX_CTL_IPE
| AX_RX_CTL_START
|
1643 AX_RX_CTL_AP
| AX_RX_CTL_AMALL
| AX_RX_CTL_AB
;
1644 ax88179_write_cmd(dev
, AX_ACCESS_MAC
, AX_RX_CTL
, 2, 2, tmp16
);
1646 *tmp
= AX_MONITOR_MODE_PMETYPE
| AX_MONITOR_MODE_PMEPOL
|
1647 AX_MONITOR_MODE_RWMP
;
1648 ax88179_write_cmd(dev
, AX_ACCESS_MAC
, AX_MONITOR_MOD
, 1, 1, tmp
);
1650 /* Configure default medium type => giga */
1651 *tmp16
= AX_MEDIUM_RECEIVE_EN
| AX_MEDIUM_TXFLOW_CTRLEN
|
1652 AX_MEDIUM_RXFLOW_CTRLEN
| AX_MEDIUM_FULL_DUPLEX
|
1654 ax88179_write_cmd(dev
, AX_ACCESS_MAC
, AX_MEDIUM_STATUS_MODE
,
1657 /* Check if WoL is supported */
1658 ax179_data
->wol_supported
= 0;
1659 if (ax88179_read_cmd(dev
, AX_ACCESS_MAC
, AX_MONITOR_MOD
,
1661 ax179_data
->wol_supported
= WAKE_MAGIC
| WAKE_PHY
;
1663 ax88179_led_setting(dev
);
1665 ax179_data
->eee_enabled
= 0;
1666 ax179_data
->eee_active
= 0;
1668 ax88179_disable_eee(dev
);
1670 ax88179_ethtool_get_eee(dev
, &eee_data
);
1671 linkmode_zero(eee_data
.advertised
);
1672 ax88179_ethtool_set_eee(dev
, &eee_data
);
1674 /* Restart autoneg */
1675 mii_nway_restart(&dev
->mii
);
1677 usbnet_link_change(dev
, 0, 0);
1682 static int ax88179_net_reset(struct usbnet
*dev
)
1686 ax88179_read_cmd(dev
, AX_ACCESS_PHY
, AX88179_PHY_ID
, GMII_PHY_PHYSR
,
1689 ax88179_read_cmd(dev
, AX_ACCESS_MAC
, AX_MEDIUM_STATUS_MODE
,
1691 if (!(tmp16
& AX_MEDIUM_RECEIVE_EN
)) {
1692 tmp16
|= AX_MEDIUM_RECEIVE_EN
;
1693 ax88179_write_cmd(dev
, AX_ACCESS_MAC
, AX_MEDIUM_STATUS_MODE
,
1703 static int ax88179_stop(struct usbnet
*dev
)
1707 ax88179_read_cmd(dev
, AX_ACCESS_MAC
, AX_MEDIUM_STATUS_MODE
,
1709 tmp16
&= ~AX_MEDIUM_RECEIVE_EN
;
1710 ax88179_write_cmd(dev
, AX_ACCESS_MAC
, AX_MEDIUM_STATUS_MODE
,
1716 static const struct driver_info ax88179_info
= {
1717 .description
= "ASIX AX88179 USB 3.0 Gigabit Ethernet",
1718 .bind
= ax88179_bind
,
1719 .unbind
= ax88179_unbind
,
1720 .status
= ax88179_status
,
1721 .link_reset
= ax88179_link_reset
,
1722 .reset
= ax88179_net_reset
,
1723 .stop
= ax88179_stop
,
1724 .flags
= FLAG_ETHER
| FLAG_FRAMING_AX
,
1725 .rx_fixup
= ax88179_rx_fixup
,
1726 .tx_fixup
= ax88179_tx_fixup
,
1729 static const struct driver_info ax88178a_info
= {
1730 .description
= "ASIX AX88178A USB 2.0 Gigabit Ethernet",
1731 .bind
= ax88179_bind
,
1732 .unbind
= ax88179_unbind
,
1733 .status
= ax88179_status
,
1734 .link_reset
= ax88179_link_reset
,
1735 .reset
= ax88179_net_reset
,
1736 .stop
= ax88179_stop
,
1737 .flags
= FLAG_ETHER
| FLAG_FRAMING_AX
,
1738 .rx_fixup
= ax88179_rx_fixup
,
1739 .tx_fixup
= ax88179_tx_fixup
,
1742 static const struct driver_info cypress_GX3_info
= {
1743 .description
= "Cypress GX3 SuperSpeed to Gigabit Ethernet Controller",
1744 .bind
= ax88179_bind
,
1745 .unbind
= ax88179_unbind
,
1746 .status
= ax88179_status
,
1747 .link_reset
= ax88179_link_reset
,
1748 .reset
= ax88179_net_reset
,
1749 .stop
= ax88179_stop
,
1750 .flags
= FLAG_ETHER
| FLAG_FRAMING_AX
,
1751 .rx_fixup
= ax88179_rx_fixup
,
1752 .tx_fixup
= ax88179_tx_fixup
,
1755 static const struct driver_info dlink_dub1312_info
= {
1756 .description
= "D-Link DUB-1312 USB 3.0 to Gigabit Ethernet Adapter",
1757 .bind
= ax88179_bind
,
1758 .unbind
= ax88179_unbind
,
1759 .status
= ax88179_status
,
1760 .link_reset
= ax88179_link_reset
,
1761 .reset
= ax88179_net_reset
,
1762 .stop
= ax88179_stop
,
1763 .flags
= FLAG_ETHER
| FLAG_FRAMING_AX
,
1764 .rx_fixup
= ax88179_rx_fixup
,
1765 .tx_fixup
= ax88179_tx_fixup
,
1768 static const struct driver_info sitecom_info
= {
1769 .description
= "Sitecom USB 3.0 to Gigabit Adapter",
1770 .bind
= ax88179_bind
,
1771 .unbind
= ax88179_unbind
,
1772 .status
= ax88179_status
,
1773 .link_reset
= ax88179_link_reset
,
1774 .reset
= ax88179_net_reset
,
1775 .stop
= ax88179_stop
,
1776 .flags
= FLAG_ETHER
| FLAG_FRAMING_AX
,
1777 .rx_fixup
= ax88179_rx_fixup
,
1778 .tx_fixup
= ax88179_tx_fixup
,
1781 static const struct driver_info samsung_info
= {
1782 .description
= "Samsung USB Ethernet Adapter",
1783 .bind
= ax88179_bind
,
1784 .unbind
= ax88179_unbind
,
1785 .status
= ax88179_status
,
1786 .link_reset
= ax88179_link_reset
,
1787 .reset
= ax88179_net_reset
,
1788 .stop
= ax88179_stop
,
1789 .flags
= FLAG_ETHER
| FLAG_FRAMING_AX
,
1790 .rx_fixup
= ax88179_rx_fixup
,
1791 .tx_fixup
= ax88179_tx_fixup
,
1794 static const struct driver_info lenovo_info
= {
1795 .description
= "Lenovo OneLinkDock Gigabit LAN",
1796 .bind
= ax88179_bind
,
1797 .unbind
= ax88179_unbind
,
1798 .status
= ax88179_status
,
1799 .link_reset
= ax88179_link_reset
,
1800 .reset
= ax88179_net_reset
,
1801 .stop
= ax88179_stop
,
1802 .flags
= FLAG_ETHER
| FLAG_FRAMING_AX
,
1803 .rx_fixup
= ax88179_rx_fixup
,
1804 .tx_fixup
= ax88179_tx_fixup
,
1807 static const struct driver_info belkin_info
= {
1808 .description
= "Belkin USB Ethernet Adapter",
1809 .bind
= ax88179_bind
,
1810 .unbind
= ax88179_unbind
,
1811 .status
= ax88179_status
,
1812 .link_reset
= ax88179_link_reset
,
1813 .reset
= ax88179_net_reset
,
1814 .stop
= ax88179_stop
,
1815 .flags
= FLAG_ETHER
| FLAG_FRAMING_AX
,
1816 .rx_fixup
= ax88179_rx_fixup
,
1817 .tx_fixup
= ax88179_tx_fixup
,
1820 static const struct driver_info toshiba_info
= {
1821 .description
= "Toshiba USB Ethernet Adapter",
1822 .bind
= ax88179_bind
,
1823 .unbind
= ax88179_unbind
,
1824 .status
= ax88179_status
,
1825 .link_reset
= ax88179_link_reset
,
1826 .reset
= ax88179_net_reset
,
1827 .stop
= ax88179_stop
,
1828 .flags
= FLAG_ETHER
| FLAG_FRAMING_AX
,
1829 .rx_fixup
= ax88179_rx_fixup
,
1830 .tx_fixup
= ax88179_tx_fixup
,
1833 static const struct driver_info mct_info
= {
1834 .description
= "MCT USB 3.0 Gigabit Ethernet Adapter",
1835 .bind
= ax88179_bind
,
1836 .unbind
= ax88179_unbind
,
1837 .status
= ax88179_status
,
1838 .link_reset
= ax88179_link_reset
,
1839 .reset
= ax88179_net_reset
,
1840 .stop
= ax88179_stop
,
1841 .flags
= FLAG_ETHER
| FLAG_FRAMING_AX
,
1842 .rx_fixup
= ax88179_rx_fixup
,
1843 .tx_fixup
= ax88179_tx_fixup
,
1846 static const struct driver_info at_umc2000_info
= {
1847 .description
= "AT-UMC2000 USB 3.0/USB 3.1 Gen 1 to Gigabit Ethernet Adapter",
1848 .bind
= ax88179_bind
,
1849 .unbind
= ax88179_unbind
,
1850 .status
= ax88179_status
,
1851 .link_reset
= ax88179_link_reset
,
1852 .reset
= ax88179_net_reset
,
1853 .stop
= ax88179_stop
,
1854 .flags
= FLAG_ETHER
| FLAG_FRAMING_AX
,
1855 .rx_fixup
= ax88179_rx_fixup
,
1856 .tx_fixup
= ax88179_tx_fixup
,
1859 static const struct driver_info at_umc200_info
= {
1860 .description
= "AT-UMC200 USB 3.0/USB 3.1 Gen 1 to Fast Ethernet Adapter",
1861 .bind
= ax88179_bind
,
1862 .unbind
= ax88179_unbind
,
1863 .status
= ax88179_status
,
1864 .link_reset
= ax88179_link_reset
,
1865 .reset
= ax88179_net_reset
,
1866 .stop
= ax88179_stop
,
1867 .flags
= FLAG_ETHER
| FLAG_FRAMING_AX
,
1868 .rx_fixup
= ax88179_rx_fixup
,
1869 .tx_fixup
= ax88179_tx_fixup
,
1872 static const struct driver_info at_umc2000sp_info
= {
1873 .description
= "AT-UMC2000/SP USB 3.0/USB 3.1 Gen 1 to Gigabit Ethernet Adapter",
1874 .bind
= ax88179_bind
,
1875 .unbind
= ax88179_unbind
,
1876 .status
= ax88179_status
,
1877 .link_reset
= ax88179_link_reset
,
1878 .reset
= ax88179_net_reset
,
1879 .stop
= ax88179_stop
,
1880 .flags
= FLAG_ETHER
| FLAG_FRAMING_AX
,
1881 .rx_fixup
= ax88179_rx_fixup
,
1882 .tx_fixup
= ax88179_tx_fixup
,
1885 static const struct usb_device_id products
[] = {
1887 /* ASIX AX88179 10/100/1000 */
1888 USB_DEVICE_AND_INTERFACE_INFO(0x0b95, 0x1790, 0xff, 0xff, 0),
1889 .driver_info
= (unsigned long)&ax88179_info
,
1891 /* ASIX AX88178A 10/100/1000 */
1892 USB_DEVICE_AND_INTERFACE_INFO(0x0b95, 0x178a, 0xff, 0xff, 0),
1893 .driver_info
= (unsigned long)&ax88178a_info
,
1895 /* Cypress GX3 SuperSpeed to Gigabit Ethernet Bridge Controller */
1896 USB_DEVICE_AND_INTERFACE_INFO(0x04b4, 0x3610, 0xff, 0xff, 0),
1897 .driver_info
= (unsigned long)&cypress_GX3_info
,
1899 /* D-Link DUB-1312 USB 3.0 to Gigabit Ethernet Adapter */
1900 USB_DEVICE_AND_INTERFACE_INFO(0x2001, 0x4a00, 0xff, 0xff, 0),
1901 .driver_info
= (unsigned long)&dlink_dub1312_info
,
1903 /* Sitecom USB 3.0 to Gigabit Adapter */
1904 USB_DEVICE_AND_INTERFACE_INFO(0x0df6, 0x0072, 0xff, 0xff, 0),
1905 .driver_info
= (unsigned long)&sitecom_info
,
1907 /* Samsung USB Ethernet Adapter */
1908 USB_DEVICE_AND_INTERFACE_INFO(0x04e8, 0xa100, 0xff, 0xff, 0),
1909 .driver_info
= (unsigned long)&samsung_info
,
1911 /* Lenovo OneLinkDock Gigabit LAN */
1912 USB_DEVICE_AND_INTERFACE_INFO(0x17ef, 0x304b, 0xff, 0xff, 0),
1913 .driver_info
= (unsigned long)&lenovo_info
,
1915 /* Belkin B2B128 USB 3.0 Hub + Gigabit Ethernet Adapter */
1916 USB_DEVICE_AND_INTERFACE_INFO(0x050d, 0x0128, 0xff, 0xff, 0),
1917 .driver_info
= (unsigned long)&belkin_info
,
1919 /* Toshiba USB 3.0 GBit Ethernet Adapter */
1920 USB_DEVICE_AND_INTERFACE_INFO(0x0930, 0x0a13, 0xff, 0xff, 0),
1921 .driver_info
= (unsigned long)&toshiba_info
,
1923 /* Magic Control Technology U3-A9003 USB 3.0 Gigabit Ethernet Adapter */
1924 USB_DEVICE_AND_INTERFACE_INFO(0x0711, 0x0179, 0xff, 0xff, 0),
1925 .driver_info
= (unsigned long)&mct_info
,
1927 /* Allied Telesis AT-UMC2000 USB 3.0/USB 3.1 Gen 1 to Gigabit Ethernet Adapter */
1928 USB_DEVICE_AND_INTERFACE_INFO(0x07c9, 0x000e, 0xff, 0xff, 0),
1929 .driver_info
= (unsigned long)&at_umc2000_info
,
1931 /* Allied Telesis AT-UMC200 USB 3.0/USB 3.1 Gen 1 to Fast Ethernet Adapter */
1932 USB_DEVICE_AND_INTERFACE_INFO(0x07c9, 0x000f, 0xff, 0xff, 0),
1933 .driver_info
= (unsigned long)&at_umc200_info
,
1935 /* Allied Telesis AT-UMC2000/SP USB 3.0/USB 3.1 Gen 1 to Gigabit Ethernet Adapter */
1936 USB_DEVICE_AND_INTERFACE_INFO(0x07c9, 0x0010, 0xff, 0xff, 0),
1937 .driver_info
= (unsigned long)&at_umc2000sp_info
,
1941 MODULE_DEVICE_TABLE(usb
, products
);
1943 static struct usb_driver ax88179_178a_driver
= {
1944 .name
= "ax88179_178a",
1945 .id_table
= products
,
1946 .probe
= usbnet_probe
,
1947 .suspend
= ax88179_suspend
,
1948 .resume
= ax88179_resume
,
1949 .reset_resume
= ax88179_resume
,
1950 .disconnect
= ax88179_disconnect
,
1951 .supports_autosuspend
= 1,
1952 .disable_hub_initiated_lpm
= 1,
1955 module_usb_driver(ax88179_178a_driver
);
1957 MODULE_DESCRIPTION("ASIX AX88179/178A based USB 3.0/2.0 Gigabit Ethernet Devices");
1958 MODULE_LICENSE("GPL");