Skip to content

Commit 85a5bac

Browse files
committed
Merge branch 'r8152'
Hayes Wang says: ==================== r8152: remove limitation Remove the limitation between ecm mode and vendor mode. v2: replace the patch #3 with "ecm and vendor modes coexist". ==================== Signed-off-by: David S. Miller <[email protected]>
2 parents 5571415 + c7de7de commit 85a5bac

File tree

4 files changed

+27
-57
lines changed

4 files changed

+27
-57
lines changed

drivers/net/usb/Kconfig

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,11 +92,12 @@ config USB_RTL8150
9292
module will be called rtl8150.
9393

9494
config USB_RTL8152
95-
tristate "Realtek RTL8152 Based USB 2.0 Ethernet Adapters"
95+
tristate "Realtek RTL8152/RTL8153 Based USB Ethernet Adapters"
9696
select MII
9797
help
9898
This option adds support for Realtek RTL8152 based USB 2.0
99-
10/100 Ethernet adapters.
99+
10/100 Ethernet adapters and RTL8153 based USB 3.0 10/100/1000
100+
Ethernet adapters.
100101

101102
To compile this driver as a module, choose M here: the
102103
module will be called r8152.

drivers/net/usb/cdc_ether.c

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -653,15 +653,6 @@ static const struct usb_device_id products[] = {
653653
.driver_info = 0,
654654
},
655655

656-
#if defined(CONFIG_USB_RTL8152) || defined(CONFIG_USB_RTL8152_MODULE)
657-
/* Samsung USB Ethernet Adapters */
658-
{
659-
USB_DEVICE_AND_INTERFACE_INFO(SAMSUNG_VENDOR_ID, 0xa101, USB_CLASS_COMM,
660-
USB_CDC_SUBCLASS_ETHERNET, USB_CDC_PROTO_NONE),
661-
.driver_info = 0,
662-
},
663-
#endif
664-
665656
/* WHITELIST!!!
666657
*
667658
* CDC Ether uses two interfaces, not necessarily consecutive.

drivers/net/usb/r8152.c

Lines changed: 24 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2013 Realtek Semiconductor Corp. All rights reserved.
2+
* Copyright (c) 2014 Realtek Semiconductor Corp. All rights reserved.
33
*
44
* This program is free software; you can redistribute it and/or
55
* modify it under the terms of the GNU General Public License
@@ -24,9 +24,9 @@
2424
#include <linux/ipv6.h>
2525

2626
/* Version Information */
27-
#define DRIVER_VERSION "v1.03.0 (2013/12/26)"
27+
#define DRIVER_VERSION "v1.04.0 (2014/01/15)"
2828
#define DRIVER_AUTHOR "Realtek linux nic maintainers <[email protected]>"
29-
#define DRIVER_DESC "Realtek RTL8152 Based USB 2.0 Ethernet Adapters"
29+
#define DRIVER_DESC "Realtek RTL8152/RTL8153 Based USB Ethernet Adapters"
3030
#define MODULENAME "r8152"
3131

3232
#define R8152_PHY_ID 32
@@ -450,6 +450,9 @@ enum rtl8152_flags {
450450
#define MCU_TYPE_PLA 0x0100
451451
#define MCU_TYPE_USB 0x0000
452452

453+
#define REALTEK_USB_DEVICE(vend, prod) \
454+
USB_DEVICE_INTERFACE_CLASS(vend, prod, USB_CLASS_VENDOR_SPEC)
455+
453456
struct rx_desc {
454457
__le32 opts1;
455458
#define RX_LEN_MASK 0x7fff
@@ -1100,40 +1103,28 @@ static void free_all_mem(struct r8152 *tp)
11001103
int i;
11011104

11021105
for (i = 0; i < RTL8152_MAX_RX; i++) {
1103-
if (tp->rx_info[i].urb) {
1104-
usb_free_urb(tp->rx_info[i].urb);
1105-
tp->rx_info[i].urb = NULL;
1106-
}
1106+
usb_free_urb(tp->rx_info[i].urb);
1107+
tp->rx_info[i].urb = NULL;
11071108

1108-
if (tp->rx_info[i].buffer) {
1109-
kfree(tp->rx_info[i].buffer);
1110-
tp->rx_info[i].buffer = NULL;
1111-
tp->rx_info[i].head = NULL;
1112-
}
1109+
kfree(tp->rx_info[i].buffer);
1110+
tp->rx_info[i].buffer = NULL;
1111+
tp->rx_info[i].head = NULL;
11131112
}
11141113

11151114
for (i = 0; i < RTL8152_MAX_TX; i++) {
1116-
if (tp->tx_info[i].urb) {
1117-
usb_free_urb(tp->tx_info[i].urb);
1118-
tp->tx_info[i].urb = NULL;
1119-
}
1115+
usb_free_urb(tp->tx_info[i].urb);
1116+
tp->tx_info[i].urb = NULL;
11201117

1121-
if (tp->tx_info[i].buffer) {
1122-
kfree(tp->tx_info[i].buffer);
1123-
tp->tx_info[i].buffer = NULL;
1124-
tp->tx_info[i].head = NULL;
1125-
}
1118+
kfree(tp->tx_info[i].buffer);
1119+
tp->tx_info[i].buffer = NULL;
1120+
tp->tx_info[i].head = NULL;
11261121
}
11271122

1128-
if (tp->intr_urb) {
1129-
usb_free_urb(tp->intr_urb);
1130-
tp->intr_urb = NULL;
1131-
}
1123+
usb_free_urb(tp->intr_urb);
1124+
tp->intr_urb = NULL;
11321125

1133-
if (tp->intr_buff) {
1134-
kfree(tp->intr_buff);
1135-
tp->intr_buff = NULL;
1136-
}
1126+
kfree(tp->intr_buff);
1127+
tp->intr_buff = NULL;
11371128
}
11381129

11391130
static int alloc_all_mem(struct r8152 *tp)
@@ -2048,7 +2039,7 @@ static void r8153_first_init(struct r8152 *tp)
20482039
/* TX share fifo free credit full threshold */
20492040
ocp_write_dword(tp, MCU_TYPE_PLA, PLA_TXFIFO_CTRL, TXFIFO_THR_NORMAL2);
20502041

2051-
// rx aggregation
2042+
/* rx aggregation */
20522043
ocp_data = ocp_read_word(tp, MCU_TYPE_USB, USB_USB_CTRL);
20532044
ocp_data &= ~RX_AGG_DISABLE;
20542045
ocp_write_word(tp, MCU_TYPE_USB, USB_USB_CTRL, ocp_data);
@@ -2750,11 +2741,6 @@ static int rtl8152_probe(struct usb_interface *intf,
27502741
struct net_device *netdev;
27512742
int ret;
27522743

2753-
if (udev->actconfig->desc.bConfigurationValue != 1) {
2754-
usb_driver_set_configuration(udev, 1);
2755-
return -ENODEV;
2756-
}
2757-
27582744
netdev = alloc_etherdev(sizeof(struct r8152));
27592745
if (!netdev) {
27602746
dev_err(&intf->dev, "Out of memory\n");
@@ -2835,9 +2821,9 @@ static void rtl8152_disconnect(struct usb_interface *intf)
28352821

28362822
/* table of devices that work with this driver */
28372823
static struct usb_device_id rtl8152_table[] = {
2838-
{USB_DEVICE(VENDOR_ID_REALTEK, PRODUCT_ID_RTL8152)},
2839-
{USB_DEVICE(VENDOR_ID_REALTEK, PRODUCT_ID_RTL8153)},
2840-
{USB_DEVICE(VENDOR_ID_SAMSUNG, PRODUCT_ID_SAMSUNG)},
2824+
{REALTEK_USB_DEVICE(VENDOR_ID_REALTEK, PRODUCT_ID_RTL8152)},
2825+
{REALTEK_USB_DEVICE(VENDOR_ID_REALTEK, PRODUCT_ID_RTL8153)},
2826+
{REALTEK_USB_DEVICE(VENDOR_ID_SAMSUNG, PRODUCT_ID_SAMSUNG)},
28412827
{}
28422828
};
28432829

drivers/net/usb/r815x.c

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -216,21 +216,13 @@ static const struct usb_device_id products[] = {
216216
{
217217
USB_DEVICE_AND_INTERFACE_INFO(REALTEK_VENDOR_ID, 0x8152, USB_CLASS_COMM,
218218
USB_CDC_SUBCLASS_ETHERNET, USB_CDC_PROTO_NONE),
219-
#if defined(CONFIG_USB_RTL8152) || defined(CONFIG_USB_RTL8152_MODULE)
220-
.driver_info = 0,
221-
#else
222219
.driver_info = (unsigned long) &r8152_info,
223-
#endif
224220
},
225221

226222
{
227223
USB_DEVICE_AND_INTERFACE_INFO(REALTEK_VENDOR_ID, 0x8153, USB_CLASS_COMM,
228224
USB_CDC_SUBCLASS_ETHERNET, USB_CDC_PROTO_NONE),
229-
#if defined(CONFIG_USB_RTL8152) || defined(CONFIG_USB_RTL8152_MODULE)
230-
.driver_info = 0,
231-
#else
232225
.driver_info = (unsigned long) &r8153_info,
233-
#endif
234226
},
235227

236228
{ }, /* END */

0 commit comments

Comments
 (0)