Skip to content

Commit ba01565

Browse files
committed
Merge tag 'usb-6.12-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb
Pull USB fixes from Greg KH: "Here are some small USB fixes for some reported problems for 6.12-rc3. Include in here is: - fix for yurex driver that was caused in -rc1 - build error fix for usbg network filesystem code - onboard_usb_dev build fix - dwc3 driver fixes for reported errors - gadget driver fix - new USB storage driver quirk - xhci resume bugfix All of these have been in linux-next for a while with no reported issues" * tag 'usb-6.12-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb: net/9p/usbg: Fix build error USB: yurex: kill needless initialization in yurex_read Revert "usb: yurex: Replace snprintf() with the safer scnprintf() variant" usb: xhci: Fix problem with xhci resume from suspend usb: misc: onboard_usb_dev: introduce new config symbol for usb5744 SMBus support usb: dwc3: core: Stop processing of pending events if controller is halted usb: dwc3: re-enable runtime PM after failed resume usb: storage: ignore bogus device raised by JieLi BR21 USB sound chip usb: gadget: core: force synchronous registration
2 parents f683c9b + faa3415 commit ba01565

File tree

10 files changed

+66
-37
lines changed

10 files changed

+66
-37
lines changed

drivers/usb/dwc3/core.c

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -544,6 +544,7 @@ static int dwc3_alloc_event_buffers(struct dwc3 *dwc, unsigned int length)
544544
int dwc3_event_buffers_setup(struct dwc3 *dwc)
545545
{
546546
struct dwc3_event_buffer *evt;
547+
u32 reg;
547548

548549
if (!dwc->ev_buf)
549550
return 0;
@@ -556,8 +557,10 @@ int dwc3_event_buffers_setup(struct dwc3 *dwc)
556557
upper_32_bits(evt->dma));
557558
dwc3_writel(dwc->regs, DWC3_GEVNTSIZ(0),
558559
DWC3_GEVNTSIZ_SIZE(evt->length));
559-
dwc3_writel(dwc->regs, DWC3_GEVNTCOUNT(0), 0);
560560

561+
/* Clear any stale event */
562+
reg = dwc3_readl(dwc->regs, DWC3_GEVNTCOUNT(0));
563+
dwc3_writel(dwc->regs, DWC3_GEVNTCOUNT(0), reg);
561564
return 0;
562565
}
563566

@@ -584,7 +587,10 @@ void dwc3_event_buffers_cleanup(struct dwc3 *dwc)
584587
dwc3_writel(dwc->regs, DWC3_GEVNTADRHI(0), 0);
585588
dwc3_writel(dwc->regs, DWC3_GEVNTSIZ(0), DWC3_GEVNTSIZ_INTMASK
586589
| DWC3_GEVNTSIZ_SIZE(0));
587-
dwc3_writel(dwc->regs, DWC3_GEVNTCOUNT(0), 0);
590+
591+
/* Clear any stale event */
592+
reg = dwc3_readl(dwc->regs, DWC3_GEVNTCOUNT(0));
593+
dwc3_writel(dwc->regs, DWC3_GEVNTCOUNT(0), reg);
588594
}
589595

590596
static void dwc3_core_num_eps(struct dwc3 *dwc)
@@ -2499,7 +2505,11 @@ static int dwc3_runtime_resume(struct device *dev)
24992505

25002506
switch (dwc->current_dr_role) {
25012507
case DWC3_GCTL_PRTCAP_DEVICE:
2502-
dwc3_gadget_process_pending_events(dwc);
2508+
if (dwc->pending_events) {
2509+
pm_runtime_put(dwc->dev);
2510+
dwc->pending_events = false;
2511+
enable_irq(dwc->irq_gadget);
2512+
}
25032513
break;
25042514
case DWC3_GCTL_PRTCAP_HOST:
25052515
default:
@@ -2552,22 +2562,20 @@ static int dwc3_suspend(struct device *dev)
25522562
static int dwc3_resume(struct device *dev)
25532563
{
25542564
struct dwc3 *dwc = dev_get_drvdata(dev);
2555-
int ret;
2565+
int ret = 0;
25562566

25572567
pinctrl_pm_select_default_state(dev);
25582568

25592569
pm_runtime_disable(dev);
25602570
pm_runtime_set_active(dev);
25612571

25622572
ret = dwc3_resume_common(dwc, PMSG_RESUME);
2563-
if (ret) {
2573+
if (ret)
25642574
pm_runtime_set_suspended(dev);
2565-
return ret;
2566-
}
25672575

25682576
pm_runtime_enable(dev);
25692577

2570-
return 0;
2578+
return ret;
25712579
}
25722580

25732581
static void dwc3_complete(struct device *dev)
@@ -2589,6 +2597,12 @@ static void dwc3_complete(struct device *dev)
25892597
static const struct dev_pm_ops dwc3_dev_pm_ops = {
25902598
SET_SYSTEM_SLEEP_PM_OPS(dwc3_suspend, dwc3_resume)
25912599
.complete = dwc3_complete,
2600+
2601+
/*
2602+
* Runtime suspend halts the controller on disconnection. It relies on
2603+
* platforms with custom connection notification to start the controller
2604+
* again.
2605+
*/
25922606
SET_RUNTIME_PM_OPS(dwc3_runtime_suspend, dwc3_runtime_resume,
25932607
dwc3_runtime_idle)
25942608
};

drivers/usb/dwc3/core.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1675,7 +1675,6 @@ static inline void dwc3_otg_host_init(struct dwc3 *dwc)
16751675
#if !IS_ENABLED(CONFIG_USB_DWC3_HOST)
16761676
int dwc3_gadget_suspend(struct dwc3 *dwc);
16771677
int dwc3_gadget_resume(struct dwc3 *dwc);
1678-
void dwc3_gadget_process_pending_events(struct dwc3 *dwc);
16791678
#else
16801679
static inline int dwc3_gadget_suspend(struct dwc3 *dwc)
16811680
{
@@ -1687,9 +1686,6 @@ static inline int dwc3_gadget_resume(struct dwc3 *dwc)
16871686
return 0;
16881687
}
16891688

1690-
static inline void dwc3_gadget_process_pending_events(struct dwc3 *dwc)
1691-
{
1692-
}
16931689
#endif /* !IS_ENABLED(CONFIG_USB_DWC3_HOST) */
16941690

16951691
#if IS_ENABLED(CONFIG_USB_DWC3_ULPI)

drivers/usb/dwc3/gadget.c

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4728,14 +4728,3 @@ int dwc3_gadget_resume(struct dwc3 *dwc)
47284728

47294729
return dwc3_gadget_soft_connect(dwc);
47304730
}
4731-
4732-
void dwc3_gadget_process_pending_events(struct dwc3 *dwc)
4733-
{
4734-
if (dwc->pending_events) {
4735-
dwc3_interrupt(dwc->irq_gadget, dwc->ev_buf);
4736-
dwc3_thread_interrupt(dwc->irq_gadget, dwc->ev_buf);
4737-
pm_runtime_put(dwc->dev);
4738-
dwc->pending_events = false;
4739-
enable_irq(dwc->irq_gadget);
4740-
}
4741-
}

drivers/usb/gadget/udc/core.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1696,6 +1696,7 @@ int usb_gadget_register_driver_owner(struct usb_gadget_driver *driver,
16961696
driver->driver.bus = &gadget_bus_type;
16971697
driver->driver.owner = owner;
16981698
driver->driver.mod_name = mod_name;
1699+
driver->driver.probe_type = PROBE_FORCE_SYNCHRONOUS;
16991700
ret = driver_register(&driver->driver);
17001701
if (ret) {
17011702
pr_warn("%s: driver registration failed: %d\n",

drivers/usb/host/xhci-pci.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@
7979
#define PCI_DEVICE_ID_ASMEDIA_1042A_XHCI 0x1142
8080
#define PCI_DEVICE_ID_ASMEDIA_1142_XHCI 0x1242
8181
#define PCI_DEVICE_ID_ASMEDIA_2142_XHCI 0x2142
82+
#define PCI_DEVICE_ID_ASMEDIA_3042_XHCI 0x3042
8283
#define PCI_DEVICE_ID_ASMEDIA_3242_XHCI 0x3242
8384

8485
#define PCI_DEVICE_ID_CADENCE 0x17CD
@@ -451,6 +452,10 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci)
451452
pdev->device == PCI_DEVICE_ID_ASMEDIA_1042A_XHCI)
452453
xhci->quirks |= XHCI_ASMEDIA_MODIFY_FLOWCONTROL;
453454

455+
if (pdev->vendor == PCI_VENDOR_ID_ASMEDIA &&
456+
pdev->device == PCI_DEVICE_ID_ASMEDIA_3042_XHCI)
457+
xhci->quirks |= XHCI_RESET_ON_RESUME;
458+
454459
if (pdev->vendor == PCI_VENDOR_ID_TI && pdev->device == 0x8241)
455460
xhci->quirks |= XHCI_LIMIT_ENDPOINT_INTERVAL_7;
456461

drivers/usb/misc/Kconfig

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -331,3 +331,15 @@ config USB_ONBOARD_DEV
331331
this config will enable the driver and it will automatically
332332
match the state of the USB subsystem. If this driver is a
333333
module it will be called onboard_usb_dev.
334+
335+
config USB_ONBOARD_DEV_USB5744
336+
bool "Onboard USB Microchip usb5744 hub with SMBus support"
337+
depends on (USB_ONBOARD_DEV && I2C=y) || (USB_ONBOARD_DEV=m && I2C=m)
338+
help
339+
Say Y here if you want to support onboard USB Microchip usb5744
340+
hub that requires SMBus initialization.
341+
342+
This options enables usb5744 i2c default initialization sequence
343+
during hub start-up configuration stage. It is must to enable this
344+
option on AMD Kria KR260 Robotics Starter Kit as this hub is
345+
connected to USB-SD converter which mounts the root filesystem.

drivers/usb/misc/onboard_usb_dev.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ static void onboard_dev_attach_usb_driver(struct work_struct *work)
311311

312312
static int onboard_dev_5744_i2c_init(struct i2c_client *client)
313313
{
314-
#if IS_ENABLED(CONFIG_I2C)
314+
#if IS_ENABLED(CONFIG_USB_ONBOARD_DEV_USB5744)
315315
struct device *dev = &client->dev;
316316
int ret;
317317

@@ -394,9 +394,11 @@ static int onboard_dev_probe(struct platform_device *pdev)
394394

395395
i2c_node = of_parse_phandle(pdev->dev.of_node, "i2c-bus", 0);
396396
if (i2c_node) {
397-
struct i2c_client *client;
397+
struct i2c_client *client = NULL;
398398

399+
#if IS_ENABLED(CONFIG_USB_ONBOARD_DEV_USB5744)
399400
client = of_find_i2c_device_by_node(i2c_node);
401+
#endif
400402
of_node_put(i2c_node);
401403

402404
if (!client) {

drivers/usb/misc/yurex.c

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,6 @@
3434
#define YUREX_BUF_SIZE 8
3535
#define YUREX_WRITE_TIMEOUT (HZ*2)
3636

37-
#define MAX_S64_STRLEN 20 /* {-}922337203685477580{7,8} */
38-
3937
/* table of devices that work with this driver */
4038
static struct usb_device_id yurex_table[] = {
4139
{ USB_DEVICE(YUREX_VENDOR_ID, YUREX_PRODUCT_ID) },
@@ -402,8 +400,9 @@ static ssize_t yurex_read(struct file *file, char __user *buffer, size_t count,
402400
loff_t *ppos)
403401
{
404402
struct usb_yurex *dev;
405-
int len = 0;
406-
char in_buffer[MAX_S64_STRLEN];
403+
int len;
404+
char in_buffer[20];
405+
unsigned long flags;
407406

408407
dev = file->private_data;
409408

@@ -413,16 +412,14 @@ static ssize_t yurex_read(struct file *file, char __user *buffer, size_t count,
413412
return -ENODEV;
414413
}
415414

416-
if (WARN_ON_ONCE(dev->bbu > S64_MAX || dev->bbu < S64_MIN)) {
417-
mutex_unlock(&dev->io_mutex);
418-
return -EIO;
419-
}
420-
421-
spin_lock_irq(&dev->lock);
422-
scnprintf(in_buffer, MAX_S64_STRLEN, "%lld\n", dev->bbu);
423-
spin_unlock_irq(&dev->lock);
415+
spin_lock_irqsave(&dev->lock, flags);
416+
len = snprintf(in_buffer, 20, "%lld\n", dev->bbu);
417+
spin_unlock_irqrestore(&dev->lock, flags);
424418
mutex_unlock(&dev->io_mutex);
425419

420+
if (WARN_ON_ONCE(len >= sizeof(in_buffer)))
421+
return -EIO;
422+
426423
return simple_read_from_buffer(buffer, count, ppos, in_buffer, len);
427424
}
428425

drivers/usb/storage/unusual_devs.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2423,6 +2423,17 @@ UNUSUAL_DEV( 0xc251, 0x4003, 0x0100, 0x0100,
24232423
USB_SC_DEVICE, USB_PR_DEVICE, NULL,
24242424
US_FL_NOT_LOCKABLE),
24252425

2426+
/*
2427+
* Reported by Icenowy Zheng <[email protected]>
2428+
* This is an interface for vendor-specific cryptic commands instead
2429+
* of real USB storage device.
2430+
*/
2431+
UNUSUAL_DEV( 0xe5b7, 0x0811, 0x0100, 0x0100,
2432+
"ZhuHai JieLi Technology",
2433+
"JieLi BR21",
2434+
USB_SC_DEVICE, USB_PR_DEVICE, NULL,
2435+
US_FL_IGNORE_DEVICE),
2436+
24262437
/* Reported by Andrew Simmons <[email protected]> */
24272438
UNUSUAL_DEV( 0xed06, 0x4500, 0x0001, 0x0001,
24282439
"DataStor",

net/9p/Kconfig

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ config NET_9P_XEN
4343
config NET_9P_USBG
4444
bool "9P USB Gadget Transport"
4545
depends on USB_GADGET=y || USB_GADGET=NET_9P
46+
select CONFIGFS_FS
47+
select USB_LIBCOMPOSITE
4648
help
4749
This builds support for a transport for 9pfs over
4850
usb gadget.

0 commit comments

Comments
 (0)