diff options
Diffstat (limited to 'drivers/net/usb/ax88179_178a.c')
| -rw-r--r-- | drivers/net/usb/ax88179_178a.c | 83 | 
1 files changed, 64 insertions, 19 deletions
diff --git a/drivers/net/usb/ax88179_178a.c b/drivers/net/usb/ax88179_178a.c index 3569293df87..054e59ca694 100644 --- a/drivers/net/usb/ax88179_178a.c +++ b/drivers/net/usb/ax88179_178a.c @@ -14,8 +14,7 @@   * GNU General Public License for more details.   *   * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA. + * along with this program; if not, see <http://www.gnu.org/licenses/>.   */  #include <linux/module.h> @@ -36,8 +35,8 @@  #define AX_RXHDR_L4_TYPE_TCP			16  #define AX_RXHDR_L3CSUM_ERR			2  #define AX_RXHDR_L4CSUM_ERR			1 -#define AX_RXHDR_CRC_ERR			((u32)BIT(31)) -#define AX_RXHDR_DROP_ERR			((u32)BIT(30)) +#define AX_RXHDR_CRC_ERR			((u32)BIT(29)) +#define AX_RXHDR_DROP_ERR			((u32)BIT(31))  #define AX_ACCESS_MAC				0x01  #define AX_ACCESS_PHY				0x02  #define AX_ACCESS_EEPROM			0x04 @@ -78,7 +77,6 @@  #define AX_MEDIUM_STATUS_MODE			0x22  	#define AX_MEDIUM_GIGAMODE	0x01  	#define AX_MEDIUM_FULL_DUPLEX	0x02 -	#define AX_MEDIUM_ALWAYS_ONE	0x04  	#define AX_MEDIUM_EN_125MHZ	0x08  	#define AX_MEDIUM_RXFLOW_CTRLEN	0x10  	#define AX_MEDIUM_TXFLOW_CTRLEN	0x20 @@ -1031,20 +1029,12 @@ static int ax88179_bind(struct usbnet *dev, struct usb_interface *intf)  	dev->mii.phy_id = 0x03;  	dev->mii.supports_gmii = 1; -	if (usb_device_no_sg_constraint(dev->udev)) -		dev->can_dma_sg = 1; -  	dev->net->features |= NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM |  			      NETIF_F_RXCSUM;  	dev->net->hw_features |= NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM |  				 NETIF_F_RXCSUM; -	if (dev->can_dma_sg) { -		dev->net->features |= NETIF_F_SG | NETIF_F_TSO; -		dev->net->hw_features |= NETIF_F_SG | NETIF_F_TSO; -	} -  	/* Enable checksum offload */  	*tmp = AX_RXCOE_IP | AX_RXCOE_TCP | AX_RXCOE_UDP |  	       AX_RXCOE_TCPV6 | AX_RXCOE_UDPV6; @@ -1065,8 +1055,8 @@ static int ax88179_bind(struct usbnet *dev, struct usb_interface *intf)  	/* Configure default medium type => giga */  	*tmp16 = AX_MEDIUM_RECEIVE_EN | AX_MEDIUM_TXFLOW_CTRLEN | -		 AX_MEDIUM_RXFLOW_CTRLEN | AX_MEDIUM_ALWAYS_ONE | -		 AX_MEDIUM_FULL_DUPLEX | AX_MEDIUM_GIGAMODE; +		 AX_MEDIUM_RXFLOW_CTRLEN | AX_MEDIUM_FULL_DUPLEX | +		 AX_MEDIUM_GIGAMODE;  	ax88179_write_cmd(dev, AX_ACCESS_MAC, AX_MEDIUM_STATUS_MODE,  			  2, 2, tmp16); @@ -1120,6 +1110,10 @@ static int ax88179_rx_fixup(struct usbnet *dev, struct sk_buff *skb)  	u16 hdr_off;  	u32 *pkt_hdr; +	/* This check is no longer done by usbnet */ +	if (skb->len < dev->net->hard_header_len) +		return 0; +  	skb_trim(skb, skb->len - 4);  	memcpy(&rx_hdr, skb_tail_pointer(skb), 4);  	le32_to_cpus(&rx_hdr); @@ -1225,7 +1219,7 @@ static int ax88179_link_reset(struct usbnet *dev)  	}  	mode = AX_MEDIUM_RECEIVE_EN | AX_MEDIUM_TXFLOW_CTRLEN | -	       AX_MEDIUM_RXFLOW_CTRLEN | AX_MEDIUM_ALWAYS_ONE; +	       AX_MEDIUM_RXFLOW_CTRLEN;  	ax88179_read_cmd(dev, AX_ACCESS_MAC, PHYSICAL_LINK_STATUS,  			 1, 1, &link_sts); @@ -1339,8 +1333,8 @@ static int ax88179_reset(struct usbnet *dev)  	/* Configure default medium type => giga */  	*tmp16 = AX_MEDIUM_RECEIVE_EN | AX_MEDIUM_TXFLOW_CTRLEN | -		 AX_MEDIUM_RXFLOW_CTRLEN | AX_MEDIUM_ALWAYS_ONE | -		 AX_MEDIUM_FULL_DUPLEX | AX_MEDIUM_GIGAMODE; +		 AX_MEDIUM_RXFLOW_CTRLEN | AX_MEDIUM_FULL_DUPLEX | +		 AX_MEDIUM_GIGAMODE;  	ax88179_write_cmd(dev, AX_ACCESS_MAC, AX_MEDIUM_STATUS_MODE,  			  2, 2, tmp16); @@ -1393,6 +1387,19 @@ static const struct driver_info ax88178a_info = {  	.tx_fixup = ax88179_tx_fixup,  }; +static const struct driver_info dlink_dub1312_info = { +	.description = "D-Link DUB-1312 USB 3.0 to Gigabit Ethernet Adapter", +	.bind = ax88179_bind, +	.unbind = ax88179_unbind, +	.status = ax88179_status, +	.link_reset = ax88179_link_reset, +	.reset = ax88179_reset, +	.stop = ax88179_stop, +	.flags = FLAG_ETHER | FLAG_FRAMING_AX, +	.rx_fixup = ax88179_rx_fixup, +	.tx_fixup = ax88179_tx_fixup, +}; +  static const struct driver_info sitecom_info = {  	.description = "Sitecom USB 3.0 to Gigabit Adapter",  	.bind = ax88179_bind, @@ -1406,6 +1413,32 @@ static const struct driver_info sitecom_info = {  	.tx_fixup = ax88179_tx_fixup,  }; +static const struct driver_info samsung_info = { +	.description = "Samsung USB Ethernet Adapter", +	.bind = ax88179_bind, +	.unbind = ax88179_unbind, +	.status = ax88179_status, +	.link_reset = ax88179_link_reset, +	.reset = ax88179_reset, +	.stop = ax88179_stop, +	.flags = FLAG_ETHER | FLAG_FRAMING_AX, +	.rx_fixup = ax88179_rx_fixup, +	.tx_fixup = ax88179_tx_fixup, +}; + +static const struct driver_info lenovo_info = { +	.description = "Lenovo OneLinkDock Gigabit LAN", +	.bind = ax88179_bind, +	.unbind = ax88179_unbind, +	.status = ax88179_status, +	.link_reset = ax88179_link_reset, +	.reset = ax88179_reset, +	.stop = ax88179_stop, +	.flags = FLAG_ETHER | FLAG_FRAMING_AX, +	.rx_fixup = ax88179_rx_fixup, +	.tx_fixup = ax88179_tx_fixup, +}; +  static const struct usb_device_id products[] = {  {  	/* ASIX AX88179 10/100/1000 */ @@ -1416,9 +1449,21 @@ static const struct usb_device_id products[] = {  	USB_DEVICE(0x0b95, 0x178a),  	.driver_info = (unsigned long)&ax88178a_info,  }, { +	/* D-Link DUB-1312 USB 3.0 to Gigabit Ethernet Adapter */ +	USB_DEVICE(0x2001, 0x4a00), +	.driver_info = (unsigned long)&dlink_dub1312_info, +}, {  	/* Sitecom USB 3.0 to Gigabit Adapter */  	USB_DEVICE(0x0df6, 0x0072), -	.driver_info = (unsigned long) &sitecom_info, +	.driver_info = (unsigned long)&sitecom_info, +}, { +	/* Samsung USB Ethernet Adapter */ +	USB_DEVICE(0x04e8, 0xa100), +	.driver_info = (unsigned long)&samsung_info, +}, { +	/* Lenovo OneLinkDock Gigabit LAN */ +	USB_DEVICE(0x17ef, 0x304b), +	.driver_info = (unsigned long)&lenovo_info,  },  	{ },  };  | 
