Skip to content

Commit 10c3271

Browse files
hayesorzdavem330
authored andcommitted
r8152: disable the ECM mode
There are known issues for switching the drivers between ECM mode and vendor mode. The interrup transfer may become abnormal. The hardware may have the opportunity to die if you change the configuration without unloading the current driver first, because all the control transfers of the current driver would fail after the command of switching the configuration. Although to use the ecm driver and vendor driver independently is fine, it may have problems to change the driver from one to the other by switching the configuration. Additionally, now the vendor mode driver is more powerful than the ECM driver. Thus, disable the ECM mode driver, and let r8152 to set the configuration to vendor mode and reset the device automatically. Signed-off-by: Hayes Wang <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 367d56f commit 10c3271

File tree

4 files changed

+17
-255
lines changed

4 files changed

+17
-255
lines changed

drivers/net/usb/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ obj-$(CONFIG_USB_HSO) += hso.o
1111
obj-$(CONFIG_USB_NET_AX8817X) += asix.o
1212
asix-y := asix_devices.o asix_common.o ax88172a.o
1313
obj-$(CONFIG_USB_NET_AX88179_178A) += ax88179_178a.o
14-
obj-$(CONFIG_USB_NET_CDCETHER) += cdc_ether.o r815x.o
14+
obj-$(CONFIG_USB_NET_CDCETHER) += cdc_ether.o
1515
obj-$(CONFIG_USB_NET_CDC_EEM) += cdc_eem.o
1616
obj-$(CONFIG_USB_NET_DM9601) += dm9601.o
1717
obj-$(CONFIG_USB_NET_SR9700) += sr9700.o

drivers/net/usb/cdc_ether.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -652,6 +652,13 @@ static const struct usb_device_id products[] = {
652652
.driver_info = 0,
653653
},
654654

655+
/* Samsung USB Ethernet Adapters */
656+
{
657+
USB_DEVICE_AND_INTERFACE_INFO(SAMSUNG_VENDOR_ID, 0xa101, USB_CLASS_COMM,
658+
USB_CDC_SUBCLASS_ETHERNET, USB_CDC_PROTO_NONE),
659+
.driver_info = 0,
660+
},
661+
655662
/* WHITELIST!!!
656663
*
657664
* CDC Ether uses two interfaces, not necessarily consecutive.

drivers/net/usb/r8152.c

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -449,9 +449,6 @@ enum rtl8152_flags {
449449
#define MCU_TYPE_PLA 0x0100
450450
#define MCU_TYPE_USB 0x0000
451451

452-
#define REALTEK_USB_DEVICE(vend, prod) \
453-
USB_DEVICE_INTERFACE_CLASS(vend, prod, USB_CLASS_VENDOR_SPEC)
454-
455452
struct rx_desc {
456453
__le32 opts1;
457454
#define RX_LEN_MASK 0x7fff
@@ -2739,6 +2736,12 @@ static int rtl8152_probe(struct usb_interface *intf,
27392736
struct net_device *netdev;
27402737
int ret;
27412738

2739+
if (udev->actconfig->desc.bConfigurationValue != 1) {
2740+
usb_driver_set_configuration(udev, 1);
2741+
return -ENODEV;
2742+
}
2743+
2744+
usb_reset_device(udev);
27422745
netdev = alloc_etherdev(sizeof(struct r8152));
27432746
if (!netdev) {
27442747
dev_err(&intf->dev, "Out of memory\n");
@@ -2819,9 +2822,9 @@ static void rtl8152_disconnect(struct usb_interface *intf)
28192822

28202823
/* table of devices that work with this driver */
28212824
static struct usb_device_id rtl8152_table[] = {
2822-
{REALTEK_USB_DEVICE(VENDOR_ID_REALTEK, PRODUCT_ID_RTL8152)},
2823-
{REALTEK_USB_DEVICE(VENDOR_ID_REALTEK, PRODUCT_ID_RTL8153)},
2824-
{REALTEK_USB_DEVICE(VENDOR_ID_SAMSUNG, PRODUCT_ID_SAMSUNG)},
2825+
{USB_DEVICE(VENDOR_ID_REALTEK, PRODUCT_ID_RTL8152)},
2826+
{USB_DEVICE(VENDOR_ID_REALTEK, PRODUCT_ID_RTL8153)},
2827+
{USB_DEVICE(VENDOR_ID_SAMSUNG, PRODUCT_ID_SAMSUNG)},
28252828
{}
28262829
};
28272830

drivers/net/usb/r815x.c

Lines changed: 0 additions & 248 deletions
This file was deleted.

0 commit comments

Comments
 (0)