提交 77f06aac 编写于 作者: D David S. Miller

Merge branch 'aquantia-usb'

Igor Russkikh says:

====================
Add support for Aquantia AQtion USB to 5/2.5GbE devices

This patchset introduces support for new multigig ethernet to USB dongle,
developed jointly by Aquantia (Phy) and ASIX (USB MAC).

The driver has similar structure with other ASIX MAC drivers (AX88179), but
with a number of important differences:
- Driver supports both direct Phy and custom firmware interface for Phy
  programming. This is due to different firmware modules available with
  this product.
- Driver handles new 2.5G/5G link speed configuration and reporting.
- Device support all speeds from 100M up to 5G.
- Device supports MTU up to 16K.

Device supports various standard networking features, like
checksum offloads, vlan tagging/filtering, TSO.

The code of this driver is based on original ASIX sources and was extended
by Aquantia for 5G multigig support.

Patchset v2 includes following changes:
- Function variables declarions fixed to reverse xmass tree
- Improve patch layout structure
- Remove unnecessary curly braces in switch/case statements
- Use 'packed' attribute for HW structures only
- Use eth_mac_addr function in set_mac_addr callback
- Remove unnecessary 'memset' calls.
- Read MAC address from EEPROM function has now better name
- Use driver_priv field to store context. It avoids ugly cast.
- Set max_mtu field. Remove check for MTU size
- Rewrite read/write functions. Add helpers for read/write 16/32 bit values
- Use mask and shifts instead of bitfields to support BE platforms.
- Use stack allocated buffer for configuring mcast filters
- Use AUTONEG_ENABLE when go to suspend state
- Pad out wol_cfg field from context structure. Use stack allocated instead
- Remove driver version
- Check field 'duplex' in set_link_ksetting callback as well
- Use already created defines in usb matching macro
- Rename phy_ops struct to phy_cfg
- Use ether_addr_copy for copying mac address
- Add fall-through comment in switch/case for avoid checkpatch warning
- Remove match for CDC ether device
- Add ASIX's HW id-s to match this driver
- Add all HW id-s with which driver can work to blacklist of cdc_ether driver

Patchset v3 includes following changes:
- Use linkmode_copy instead of bitmap_copy
- Remove Direct PHY access code since production HW will not have this
    mode anymore
- Fix line over 80 symbols and alignments in cdc_ether patch
- Add match for ECM configuration
    On start our HW reports both ECM and vendor configs.
    Linux prefers to use ECM driver and chooses active configuration
    which is for ecm driver (not for vendor specific).
    We need to match this configuration and forcibly switch configuration
    to vendor specific.

Patchset v4 includes following changes:
- Set gso_max_size.
- Optimize accessing to descriptors
- Use SKB_TRUESIZE macro.
====================
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
......@@ -613,4 +613,16 @@ config USB_NET_CH9200
To compile this driver as a module, choose M here: the
module will be called ch9200.
config USB_NET_AQC111
tristate "Aquantia AQtion USB to 5/2.5GbE Controllers support"
depends on USB_USBNET
select CRC32
default y
help
This option adds support for Aquantia AQtion USB
Ethernet adapters based on AQC111U/AQC112 chips.
This driver should work with at least the following devices:
* Aquantia AQtion USB to 5GbE
endif # USB_NET_DRIVERS
......@@ -40,3 +40,4 @@ obj-$(CONFIG_USB_VL600) += lg-vl600.o
obj-$(CONFIG_USB_NET_QMI_WWAN) += qmi_wwan.o
obj-$(CONFIG_USB_NET_CDC_MBIM) += cdc_mbim.o
obj-$(CONFIG_USB_NET_CH9200) += ch9200.o
obj-$(CONFIG_USB_NET_AQC111) += aqc111.o
此差异已折叠。
/* SPDX-License-Identifier: GPL-2.0-or-later
* Aquantia Corp. Aquantia AQtion USB to 5GbE Controller
* Copyright (C) 2003-2005 David Hollis <dhollis@davehollis.com>
* Copyright (C) 2005 Phil Chang <pchang23@sbcglobal.net>
* Copyright (C) 2002-2003 TiVo Inc.
* Copyright (C) 2017-2018 ASIX
* Copyright (C) 2018 Aquantia Corp.
*/
#ifndef __LINUX_USBNET_AQC111_H
#define __LINUX_USBNET_AQC111_H
#define URB_SIZE (1024 * 62)
#define AQ_MCAST_FILTER_SIZE 8
#define AQ_MAX_MCAST 64
#define AQ_ACCESS_MAC 0x01
#define AQ_FLASH_PARAMETERS 0x20
#define AQ_PHY_POWER 0x31
#define AQ_WOL_CFG 0x60
#define AQ_PHY_OPS 0x61
#define AQ_USB_PHY_SET_TIMEOUT 10000
#define AQ_USB_SET_TIMEOUT 4000
/* Feature. ********************************************/
#define AQ_SUPPORT_FEATURE (NETIF_F_SG | NETIF_F_IP_CSUM |\
NETIF_F_IPV6_CSUM | NETIF_F_RXCSUM |\
NETIF_F_TSO | NETIF_F_HW_VLAN_CTAG_TX |\
NETIF_F_HW_VLAN_CTAG_RX)
#define AQ_SUPPORT_HW_FEATURE (NETIF_F_SG | NETIF_F_IP_CSUM |\
NETIF_F_IPV6_CSUM | NETIF_F_RXCSUM |\
NETIF_F_TSO | NETIF_F_HW_VLAN_CTAG_FILTER)
#define AQ_SUPPORT_VLAN_FEATURE (NETIF_F_SG | NETIF_F_IP_CSUM |\
NETIF_F_IPV6_CSUM | NETIF_F_RXCSUM |\
NETIF_F_TSO)
/* SFR Reg. ********************************************/
#define SFR_GENERAL_STATUS 0x03
#define SFR_CHIP_STATUS 0x05
#define SFR_RX_CTL 0x0B
#define SFR_RX_CTL_TXPADCRC 0x0400
#define SFR_RX_CTL_IPE 0x0200
#define SFR_RX_CTL_DROPCRCERR 0x0100
#define SFR_RX_CTL_START 0x0080
#define SFR_RX_CTL_RF_WAK 0x0040
#define SFR_RX_CTL_AP 0x0020
#define SFR_RX_CTL_AM 0x0010
#define SFR_RX_CTL_AB 0x0008
#define SFR_RX_CTL_AMALL 0x0002
#define SFR_RX_CTL_PRO 0x0001
#define SFR_RX_CTL_STOP 0x0000
#define SFR_INTER_PACKET_GAP_0 0x0D
#define SFR_NODE_ID 0x10
#define SFR_MULTI_FILTER_ARRY 0x16
#define SFR_MEDIUM_STATUS_MODE 0x22
#define SFR_MEDIUM_XGMIIMODE 0x0001
#define SFR_MEDIUM_FULL_DUPLEX 0x0002
#define SFR_MEDIUM_RXFLOW_CTRLEN 0x0010
#define SFR_MEDIUM_TXFLOW_CTRLEN 0x0020
#define SFR_MEDIUM_JUMBO_EN 0x0040
#define SFR_MEDIUM_RECEIVE_EN 0x0100
#define SFR_MONITOR_MODE 0x24
#define SFR_MONITOR_MODE_EPHYRW 0x01
#define SFR_MONITOR_MODE_RWLC 0x02
#define SFR_MONITOR_MODE_RWMP 0x04
#define SFR_MONITOR_MODE_RWWF 0x08
#define SFR_MONITOR_MODE_RW_FLAG 0x10
#define SFR_MONITOR_MODE_PMEPOL 0x20
#define SFR_MONITOR_MODE_PMETYPE 0x40
#define SFR_PHYPWR_RSTCTL 0x26
#define SFR_PHYPWR_RSTCTL_BZ 0x0010
#define SFR_PHYPWR_RSTCTL_IPRL 0x0020
#define SFR_VLAN_ID_ADDRESS 0x2A
#define SFR_VLAN_ID_CONTROL 0x2B
#define SFR_VLAN_CONTROL_WE 0x0001
#define SFR_VLAN_CONTROL_RD 0x0002
#define SFR_VLAN_CONTROL_VSO 0x0010
#define SFR_VLAN_CONTROL_VFE 0x0020
#define SFR_VLAN_ID_DATA0 0x2C
#define SFR_VLAN_ID_DATA1 0x2D
#define SFR_RX_BULKIN_QCTRL 0x2E
#define SFR_RX_BULKIN_QCTRL_TIME 0x01
#define SFR_RX_BULKIN_QCTRL_IFG 0x02
#define SFR_RX_BULKIN_QCTRL_SIZE 0x04
#define SFR_RX_BULKIN_QTIMR_LOW 0x2F
#define SFR_RX_BULKIN_QTIMR_HIGH 0x30
#define SFR_RX_BULKIN_QSIZE 0x31
#define SFR_RX_BULKIN_QIFG 0x32
#define SFR_RXCOE_CTL 0x34
#define SFR_RXCOE_IP 0x01
#define SFR_RXCOE_TCP 0x02
#define SFR_RXCOE_UDP 0x04
#define SFR_RXCOE_ICMP 0x08
#define SFR_RXCOE_IGMP 0x10
#define SFR_RXCOE_TCPV6 0x20
#define SFR_RXCOE_UDPV6 0x40
#define SFR_RXCOE_ICMV6 0x80
#define SFR_TXCOE_CTL 0x35
#define SFR_TXCOE_IP 0x01
#define SFR_TXCOE_TCP 0x02
#define SFR_TXCOE_UDP 0x04
#define SFR_TXCOE_ICMP 0x08
#define SFR_TXCOE_IGMP 0x10
#define SFR_TXCOE_TCPV6 0x20
#define SFR_TXCOE_UDPV6 0x40
#define SFR_TXCOE_ICMV6 0x80
#define SFR_BM_INT_MASK 0x41
#define SFR_BMRX_DMA_CONTROL 0x43
#define SFR_BMRX_DMA_EN 0x80
#define SFR_BMTX_DMA_CONTROL 0x46
#define SFR_PAUSE_WATERLVL_LOW 0x54
#define SFR_PAUSE_WATERLVL_HIGH 0x55
#define SFR_ARC_CTRL 0x9E
#define SFR_SWP_CTRL 0xB1
#define SFR_TX_PAUSE_RESEND_T 0xB2
#define SFR_ETH_MAC_PATH 0xB7
#define SFR_RX_PATH_READY 0x01
#define SFR_BULK_OUT_CTRL 0xB9
#define SFR_BULK_OUT_FLUSH_EN 0x01
#define SFR_BULK_OUT_EFF_EN 0x02
#define AQ_FW_VER_MAJOR 0xDA
#define AQ_FW_VER_MINOR 0xDB
#define AQ_FW_VER_REV 0xDC
/*PHY_OPS**********************************************************************/
#define AQ_ADV_100M BIT(0)
#define AQ_ADV_1G BIT(1)
#define AQ_ADV_2G5 BIT(2)
#define AQ_ADV_5G BIT(3)
#define AQ_ADV_MASK 0x0F
#define AQ_PAUSE BIT(16)
#define AQ_ASYM_PAUSE BIT(17)
#define AQ_LOW_POWER BIT(18)
#define AQ_PHY_POWER_EN BIT(19)
#define AQ_WOL BIT(20)
#define AQ_DOWNSHIFT BIT(21)
#define AQ_DSH_RETRIES_SHIFT 0x18
#define AQ_DSH_RETRIES_MASK 0xF000000
#define AQ_WOL_FLAG_MP 0x2
/******************************************************************************/
struct aqc111_wol_cfg {
u8 hw_addr[6];
u8 flags;
u8 rsvd[283];
} __packed;
#define WOL_CFG_SIZE sizeof(struct aqc111_wol_cfg)
struct aqc111_data {
u16 rxctl;
u8 rx_checksum;
u8 link_speed;
u8 link;
u8 autoneg;
u32 advertised_speed;
struct {
u8 major;
u8 minor;
u8 rev;
} fw_ver;
u32 phy_cfg;
u8 wol_flags;
};
#define AQ_LS_MASK 0x8000
#define AQ_SPEED_MASK 0x7F00
#define AQ_SPEED_SHIFT 0x0008
#define AQ_INT_SPEED_5G 0x000F
#define AQ_INT_SPEED_2_5G 0x0010
#define AQ_INT_SPEED_1G 0x0011
#define AQ_INT_SPEED_100M 0x0013
/* TX Descriptor */
#define AQ_TX_DESC_LEN_MASK 0x1FFFFF
#define AQ_TX_DESC_DROP_PADD BIT(28)
#define AQ_TX_DESC_VLAN BIT(29)
#define AQ_TX_DESC_MSS_MASK 0x7FFF
#define AQ_TX_DESC_MSS_SHIFT 0x20
#define AQ_TX_DESC_VLAN_MASK 0xFFFF
#define AQ_TX_DESC_VLAN_SHIFT 0x30
#define AQ_RX_HW_PAD 0x02
/* RX Packet Descriptor */
#define AQ_RX_PD_L4_ERR BIT(0)
#define AQ_RX_PD_L3_ERR BIT(1)
#define AQ_RX_PD_L4_TYPE_MASK 0x1C
#define AQ_RX_PD_L4_UDP 0x04
#define AQ_RX_PD_L4_TCP 0x10
#define AQ_RX_PD_L3_TYPE_MASK 0x60
#define AQ_RX_PD_L3_IP 0x20
#define AQ_RX_PD_L3_IP6 0x40
#define AQ_RX_PD_VLAN BIT(10)
#define AQ_RX_PD_RX_OK BIT(11)
#define AQ_RX_PD_DROP BIT(31)
#define AQ_RX_PD_LEN_MASK 0x7FFF0000
#define AQ_RX_PD_LEN_SHIFT 0x10
#define AQ_RX_PD_VLAN_SHIFT 0x20
/* RX Descriptor header */
#define AQ_RX_DH_PKT_CNT_MASK 0x1FFF
#define AQ_RX_DH_DESC_OFFSET_MASK 0xFFFFE000
#define AQ_RX_DH_DESC_OFFSET_SHIFT 0x0D
static struct {
unsigned char ctrl;
unsigned char timer_l;
unsigned char timer_h;
unsigned char size;
unsigned char ifg;
} AQC111_BULKIN_SIZE[] = {
/* xHCI & EHCI & OHCI */
{7, 0x00, 0x01, 0x1E, 0xFF},/* 10G, 5G, 2.5G, 1G */
{7, 0xA0, 0x00, 0x14, 0x00},/* 100M */
/* Jumbo packet */
{7, 0x00, 0x01, 0x18, 0xFF},
};
#endif /* __LINUX_USBNET_AQC111_H */
......@@ -562,6 +562,8 @@ static const struct driver_info wwan_info = {
#define MICROSOFT_VENDOR_ID 0x045e
#define UBLOX_VENDOR_ID 0x1546
#define TPLINK_VENDOR_ID 0x2357
#define AQUANTIA_VENDOR_ID 0x2eca
#define ASIX_VENDOR_ID 0x0b95
static const struct usb_device_id products[] = {
/* BLACKLIST !!
......@@ -821,6 +823,30 @@ static const struct usb_device_id products[] = {
.driver_info = 0,
},
/* Aquantia AQtion USB to 5GbE Controller (based on AQC111U) */
{
USB_DEVICE_AND_INTERFACE_INFO(AQUANTIA_VENDOR_ID, 0xc101,
USB_CLASS_COMM, USB_CDC_SUBCLASS_ETHERNET,
USB_CDC_PROTO_NONE),
.driver_info = 0,
},
/* ASIX USB 3.1 Gen1 to 5G Multi-Gigabit Ethernet Adapter(based on AQC111U) */
{
USB_DEVICE_AND_INTERFACE_INFO(ASIX_VENDOR_ID, 0x2790, USB_CLASS_COMM,
USB_CDC_SUBCLASS_ETHERNET,
USB_CDC_PROTO_NONE),
.driver_info = 0,
},
/* ASIX USB 3.1 Gen1 to 2.5G Multi-Gigabit Ethernet Adapter(based on AQC112U) */
{
USB_DEVICE_AND_INTERFACE_INFO(ASIX_VENDOR_ID, 0x2791, USB_CLASS_COMM,
USB_CDC_SUBCLASS_ETHERNET,
USB_CDC_PROTO_NONE),
.driver_info = 0,
},
/* WHITELIST!!!
*
* CDC Ether uses two interfaces, not necessarily consecutive.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册