Skip to content

Commit 548b1af

Browse files
committed
Merge tag 'usb-5.17-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb
Pull USB fixes from Greg KH: "Here are a number of small USB driver fixes for 5.17-rc6 to resolve reported problems and add new device ids. They include: - dwc3: - device mapping fix - new device ids - driver fixes - xhci driver fixes - gadget driver fixes - usb-serial driver device id updates All of these have been in linux-next with no reported problems" * tag 'usb-5.17-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb: usb: gadget: rndis: add spinlock for rndis response list usb: dwc3: gadget: Let the interrupt handler disable bottom halves. USB: gadget: validate endpoint index for xilinx udc USB: serial: option: add Telit LE910R1 compositions USB: serial: option: add support for DW5829e Revert "USB: serial: ch341: add new Product ID for CH341A" usb: dwc2: drd: fix soft connect when gadget is unconfigured usb: dwc3: pci: Fix Bay Trail phy GPIO mappings tps6598x: clear int mask on probe failure xhci: Prevent futile URB re-submissions due to incorrect return value. xhci: re-initialize the HC during resume if HCE was set usb: dwc3: pci: Add "snps,dis_u2_susphy_quirk" for Intel Bay Trail usb: dwc3: pci: add support for the Intel Raptor Lake-S
2 parents 7808159 + 19eae24 commit 548b1af

11 files changed

Lines changed: 76 additions & 18 deletions

File tree

drivers/usb/dwc2/core.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1418,6 +1418,7 @@ void dwc2_hsotg_core_connect(struct dwc2_hsotg *hsotg);
14181418
void dwc2_hsotg_disconnect(struct dwc2_hsotg *dwc2);
14191419
int dwc2_hsotg_set_test_mode(struct dwc2_hsotg *hsotg, int testmode);
14201420
#define dwc2_is_device_connected(hsotg) (hsotg->connected)
1421+
#define dwc2_is_device_enabled(hsotg) (hsotg->enabled)
14211422
int dwc2_backup_device_registers(struct dwc2_hsotg *hsotg);
14221423
int dwc2_restore_device_registers(struct dwc2_hsotg *hsotg, int remote_wakeup);
14231424
int dwc2_gadget_enter_hibernation(struct dwc2_hsotg *hsotg);
@@ -1454,6 +1455,7 @@ static inline int dwc2_hsotg_set_test_mode(struct dwc2_hsotg *hsotg,
14541455
int testmode)
14551456
{ return 0; }
14561457
#define dwc2_is_device_connected(hsotg) (0)
1458+
#define dwc2_is_device_enabled(hsotg) (0)
14571459
static inline int dwc2_backup_device_registers(struct dwc2_hsotg *hsotg)
14581460
{ return 0; }
14591461
static inline int dwc2_restore_device_registers(struct dwc2_hsotg *hsotg,

drivers/usb/dwc2/drd.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,10 @@ static int dwc2_drd_role_sw_set(struct usb_role_switch *sw, enum usb_role role)
130130
already = dwc2_ovr_avalid(hsotg, true);
131131
} else if (role == USB_ROLE_DEVICE) {
132132
already = dwc2_ovr_bvalid(hsotg, true);
133-
/* This clear DCTL.SFTDISCON bit */
134-
dwc2_hsotg_core_connect(hsotg);
133+
if (dwc2_is_device_enabled(hsotg)) {
134+
/* This clear DCTL.SFTDISCON bit */
135+
dwc2_hsotg_core_connect(hsotg);
136+
}
135137
} else {
136138
if (dwc2_is_device_mode(hsotg)) {
137139
if (!dwc2_ovr_bvalid(hsotg, false))

drivers/usb/dwc3/dwc3-pci.c

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
#define PCI_DEVICE_ID_INTEL_ADLP 0x51ee
4444
#define PCI_DEVICE_ID_INTEL_ADLM 0x54ee
4545
#define PCI_DEVICE_ID_INTEL_ADLS 0x7ae1
46+
#define PCI_DEVICE_ID_INTEL_RPLS 0x7a61
4647
#define PCI_DEVICE_ID_INTEL_TGL 0x9a15
4748
#define PCI_DEVICE_ID_AMD_MR 0x163a
4849

@@ -85,8 +86,8 @@ static const struct acpi_gpio_mapping acpi_dwc3_byt_gpios[] = {
8586
static struct gpiod_lookup_table platform_bytcr_gpios = {
8687
.dev_id = "0000:00:16.0",
8788
.table = {
88-
GPIO_LOOKUP("INT33FC:00", 54, "reset", GPIO_ACTIVE_HIGH),
89-
GPIO_LOOKUP("INT33FC:02", 14, "cs", GPIO_ACTIVE_HIGH),
89+
GPIO_LOOKUP("INT33FC:00", 54, "cs", GPIO_ACTIVE_HIGH),
90+
GPIO_LOOKUP("INT33FC:02", 14, "reset", GPIO_ACTIVE_HIGH),
9091
{}
9192
},
9293
};
@@ -119,6 +120,13 @@ static const struct property_entry dwc3_pci_intel_properties[] = {
119120
{}
120121
};
121122

123+
static const struct property_entry dwc3_pci_intel_byt_properties[] = {
124+
PROPERTY_ENTRY_STRING("dr_mode", "peripheral"),
125+
PROPERTY_ENTRY_BOOL("snps,dis_u2_susphy_quirk"),
126+
PROPERTY_ENTRY_BOOL("linux,sysdev_is_parent"),
127+
{}
128+
};
129+
122130
static const struct property_entry dwc3_pci_mrfld_properties[] = {
123131
PROPERTY_ENTRY_STRING("dr_mode", "otg"),
124132
PROPERTY_ENTRY_STRING("linux,extcon-name", "mrfld_bcove_pwrsrc"),
@@ -161,6 +169,10 @@ static const struct software_node dwc3_pci_intel_swnode = {
161169
.properties = dwc3_pci_intel_properties,
162170
};
163171

172+
static const struct software_node dwc3_pci_intel_byt_swnode = {
173+
.properties = dwc3_pci_intel_byt_properties,
174+
};
175+
164176
static const struct software_node dwc3_pci_intel_mrfld_swnode = {
165177
.properties = dwc3_pci_mrfld_properties,
166178
};
@@ -344,7 +356,7 @@ static const struct pci_device_id dwc3_pci_id_table[] = {
344356
(kernel_ulong_t) &dwc3_pci_intel_swnode, },
345357

346358
{ PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_BYT),
347-
(kernel_ulong_t) &dwc3_pci_intel_swnode, },
359+
(kernel_ulong_t) &dwc3_pci_intel_byt_swnode, },
348360

349361
{ PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_MRFLD),
350362
(kernel_ulong_t) &dwc3_pci_intel_mrfld_swnode, },
@@ -409,6 +421,9 @@ static const struct pci_device_id dwc3_pci_id_table[] = {
409421
{ PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_ADLS),
410422
(kernel_ulong_t) &dwc3_pci_intel_swnode, },
411423

424+
{ PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_RPLS),
425+
(kernel_ulong_t) &dwc3_pci_intel_swnode, },
426+
412427
{ PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_TGL),
413428
(kernel_ulong_t) &dwc3_pci_intel_swnode, },
414429

drivers/usb/dwc3/gadget.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4160,9 +4160,11 @@ static irqreturn_t dwc3_thread_interrupt(int irq, void *_evt)
41604160
unsigned long flags;
41614161
irqreturn_t ret = IRQ_NONE;
41624162

4163+
local_bh_disable();
41634164
spin_lock_irqsave(&dwc->lock, flags);
41644165
ret = dwc3_process_event_buf(evt);
41654166
spin_unlock_irqrestore(&dwc->lock, flags);
4167+
local_bh_enable();
41664168

41674169
return ret;
41684170
}

drivers/usb/gadget/function/rndis.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -922,6 +922,7 @@ struct rndis_params *rndis_register(void (*resp_avail)(void *v), void *v)
922922
params->resp_avail = resp_avail;
923923
params->v = v;
924924
INIT_LIST_HEAD(&params->resp_queue);
925+
spin_lock_init(&params->resp_lock);
925926
pr_debug("%s: configNr = %d\n", __func__, i);
926927

927928
return params;
@@ -1015,12 +1016,14 @@ void rndis_free_response(struct rndis_params *params, u8 *buf)
10151016
{
10161017
rndis_resp_t *r, *n;
10171018

1019+
spin_lock(&params->resp_lock);
10181020
list_for_each_entry_safe(r, n, &params->resp_queue, list) {
10191021
if (r->buf == buf) {
10201022
list_del(&r->list);
10211023
kfree(r);
10221024
}
10231025
}
1026+
spin_unlock(&params->resp_lock);
10241027
}
10251028
EXPORT_SYMBOL_GPL(rndis_free_response);
10261029

@@ -1030,14 +1033,17 @@ u8 *rndis_get_next_response(struct rndis_params *params, u32 *length)
10301033

10311034
if (!length) return NULL;
10321035

1036+
spin_lock(&params->resp_lock);
10331037
list_for_each_entry_safe(r, n, &params->resp_queue, list) {
10341038
if (!r->send) {
10351039
r->send = 1;
10361040
*length = r->length;
1041+
spin_unlock(&params->resp_lock);
10371042
return r->buf;
10381043
}
10391044
}
10401045

1046+
spin_unlock(&params->resp_lock);
10411047
return NULL;
10421048
}
10431049
EXPORT_SYMBOL_GPL(rndis_get_next_response);
@@ -1054,7 +1060,9 @@ static rndis_resp_t *rndis_add_response(struct rndis_params *params, u32 length)
10541060
r->length = length;
10551061
r->send = 0;
10561062

1063+
spin_lock(&params->resp_lock);
10571064
list_add_tail(&r->list, &params->resp_queue);
1065+
spin_unlock(&params->resp_lock);
10581066
return r;
10591067
}
10601068

drivers/usb/gadget/function/rndis.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,7 @@ typedef struct rndis_params {
174174
void (*resp_avail)(void *v);
175175
void *v;
176176
struct list_head resp_queue;
177+
spinlock_t resp_lock;
177178
} rndis_params;
178179

179180
/* RNDIS Message parser and other useless functions */

drivers/usb/gadget/udc/udc-xilinx.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1615,6 +1615,8 @@ static void xudc_getstatus(struct xusb_udc *udc)
16151615
break;
16161616
case USB_RECIP_ENDPOINT:
16171617
epnum = udc->setup.wIndex & USB_ENDPOINT_NUMBER_MASK;
1618+
if (epnum >= XUSB_MAX_ENDPOINTS)
1619+
goto stall;
16181620
target_ep = &udc->ep[epnum];
16191621
epcfgreg = udc->read_fn(udc->addr + target_ep->offset);
16201622
halt = epcfgreg & XUSB_EP_CFG_STALL_MASK;
@@ -1682,6 +1684,10 @@ static void xudc_set_clear_feature(struct xusb_udc *udc)
16821684
case USB_RECIP_ENDPOINT:
16831685
if (!udc->setup.wValue) {
16841686
endpoint = udc->setup.wIndex & USB_ENDPOINT_NUMBER_MASK;
1687+
if (endpoint >= XUSB_MAX_ENDPOINTS) {
1688+
xudc_ep0_stall(udc);
1689+
return;
1690+
}
16851691
target_ep = &udc->ep[endpoint];
16861692
outinbit = udc->setup.wIndex & USB_ENDPOINT_DIR_MASK;
16871693
outinbit = outinbit >> 7;

drivers/usb/host/xhci.c

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1091,6 +1091,7 @@ int xhci_resume(struct xhci_hcd *xhci, bool hibernated)
10911091
int retval = 0;
10921092
bool comp_timer_running = false;
10931093
bool pending_portevent = false;
1094+
bool reinit_xhc = false;
10941095

10951096
if (!hcd->state)
10961097
return 0;
@@ -1107,10 +1108,11 @@ int xhci_resume(struct xhci_hcd *xhci, bool hibernated)
11071108
set_bit(HCD_FLAG_HW_ACCESSIBLE, &xhci->shared_hcd->flags);
11081109

11091110
spin_lock_irq(&xhci->lock);
1110-
if ((xhci->quirks & XHCI_RESET_ON_RESUME) || xhci->broken_suspend)
1111-
hibernated = true;
11121111

1113-
if (!hibernated) {
1112+
if (hibernated || xhci->quirks & XHCI_RESET_ON_RESUME || xhci->broken_suspend)
1113+
reinit_xhc = true;
1114+
1115+
if (!reinit_xhc) {
11141116
/*
11151117
* Some controllers might lose power during suspend, so wait
11161118
* for controller not ready bit to clear, just as in xHC init.
@@ -1143,12 +1145,17 @@ int xhci_resume(struct xhci_hcd *xhci, bool hibernated)
11431145
spin_unlock_irq(&xhci->lock);
11441146
return -ETIMEDOUT;
11451147
}
1146-
temp = readl(&xhci->op_regs->status);
11471148
}
11481149

1149-
/* If restore operation fails, re-initialize the HC during resume */
1150-
if ((temp & STS_SRE) || hibernated) {
1150+
temp = readl(&xhci->op_regs->status);
11511151

1152+
/* re-initialize the HC on Restore Error, or Host Controller Error */
1153+
if (temp & (STS_SRE | STS_HCE)) {
1154+
reinit_xhc = true;
1155+
xhci_warn(xhci, "xHC error in resume, USBSTS 0x%x, Reinit\n", temp);
1156+
}
1157+
1158+
if (reinit_xhc) {
11521159
if ((xhci->quirks & XHCI_COMP_MODE_QUIRK) &&
11531160
!(xhci_all_ports_seen_u0(xhci))) {
11541161
del_timer_sync(&xhci->comp_mode_recovery_timer);
@@ -1604,9 +1611,12 @@ static int xhci_urb_enqueue(struct usb_hcd *hcd, struct urb *urb, gfp_t mem_flag
16041611
struct urb_priv *urb_priv;
16051612
int num_tds;
16061613

1607-
if (!urb || xhci_check_args(hcd, urb->dev, urb->ep,
1608-
true, true, __func__) <= 0)
1614+
if (!urb)
16091615
return -EINVAL;
1616+
ret = xhci_check_args(hcd, urb->dev, urb->ep,
1617+
true, true, __func__);
1618+
if (ret <= 0)
1619+
return ret ? ret : -EINVAL;
16101620

16111621
slot_id = urb->dev->slot_id;
16121622
ep_index = xhci_get_endpoint_index(&urb->ep->desc);
@@ -3323,7 +3333,7 @@ static int xhci_check_streams_endpoint(struct xhci_hcd *xhci,
33233333
return -EINVAL;
33243334
ret = xhci_check_args(xhci_to_hcd(xhci), udev, ep, 1, true, __func__);
33253335
if (ret <= 0)
3326-
return -EINVAL;
3336+
return ret ? ret : -EINVAL;
33273337
if (usb_ss_max_streams(&ep->ss_ep_comp) == 0) {
33283338
xhci_warn(xhci, "WARN: SuperSpeed Endpoint Companion"
33293339
" descriptor for ep 0x%x does not support streams\n",

drivers/usb/serial/ch341.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,6 @@
8181
#define CH341_QUIRK_SIMULATE_BREAK BIT(1)
8282

8383
static const struct usb_device_id id_table[] = {
84-
{ USB_DEVICE(0x1a86, 0x5512) },
8584
{ USB_DEVICE(0x1a86, 0x5523) },
8685
{ USB_DEVICE(0x1a86, 0x7522) },
8786
{ USB_DEVICE(0x1a86, 0x7523) },

drivers/usb/serial/option.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,8 @@ static void option_instat_callback(struct urb *urb);
198198

199199
#define DELL_PRODUCT_5821E 0x81d7
200200
#define DELL_PRODUCT_5821E_ESIM 0x81e0
201+
#define DELL_PRODUCT_5829E_ESIM 0x81e4
202+
#define DELL_PRODUCT_5829E 0x81e6
201203

202204
#define KYOCERA_VENDOR_ID 0x0c88
203205
#define KYOCERA_PRODUCT_KPC650 0x17da
@@ -1063,6 +1065,10 @@ static const struct usb_device_id option_ids[] = {
10631065
.driver_info = RSVD(0) | RSVD(1) | RSVD(6) },
10641066
{ USB_DEVICE(DELL_VENDOR_ID, DELL_PRODUCT_5821E_ESIM),
10651067
.driver_info = RSVD(0) | RSVD(1) | RSVD(6) },
1068+
{ USB_DEVICE(DELL_VENDOR_ID, DELL_PRODUCT_5829E),
1069+
.driver_info = RSVD(0) | RSVD(6) },
1070+
{ USB_DEVICE(DELL_VENDOR_ID, DELL_PRODUCT_5829E_ESIM),
1071+
.driver_info = RSVD(0) | RSVD(6) },
10661072
{ USB_DEVICE(ANYDATA_VENDOR_ID, ANYDATA_PRODUCT_ADU_E100A) }, /* ADU-E100, ADU-310 */
10671073
{ USB_DEVICE(ANYDATA_VENDOR_ID, ANYDATA_PRODUCT_ADU_500A) },
10681074
{ USB_DEVICE(ANYDATA_VENDOR_ID, ANYDATA_PRODUCT_ADU_620UW) },
@@ -1273,10 +1279,16 @@ static const struct usb_device_id option_ids[] = {
12731279
.driver_info = NCTRL(2) },
12741280
{ USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x7011, 0xff), /* Telit LE910-S1 (ECM) */
12751281
.driver_info = NCTRL(2) },
1282+
{ USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x701a, 0xff), /* Telit LE910R1 (RNDIS) */
1283+
.driver_info = NCTRL(2) },
1284+
{ USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x701b, 0xff), /* Telit LE910R1 (ECM) */
1285+
.driver_info = NCTRL(2) },
12761286
{ USB_DEVICE(TELIT_VENDOR_ID, 0x9010), /* Telit SBL FN980 flashing device */
12771287
.driver_info = NCTRL(0) | ZLP },
12781288
{ USB_DEVICE(TELIT_VENDOR_ID, 0x9200), /* Telit LE910S1 flashing device */
12791289
.driver_info = NCTRL(0) | ZLP },
1290+
{ USB_DEVICE(TELIT_VENDOR_ID, 0x9201), /* Telit LE910R1 flashing device */
1291+
.driver_info = NCTRL(0) | ZLP },
12801292
{ USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_MF622, 0xff, 0xff, 0xff) }, /* ZTE WCDMA products */
12811293
{ USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0002, 0xff, 0xff, 0xff),
12821294
.driver_info = RSVD(1) },

0 commit comments

Comments
 (0)