Commit ba01565c authored by Linus Torvalds's avatar Linus Torvalds

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
parents f683c9b1 faa34159
...@@ -544,6 +544,7 @@ static int dwc3_alloc_event_buffers(struct dwc3 *dwc, unsigned int length) ...@@ -544,6 +544,7 @@ static int dwc3_alloc_event_buffers(struct dwc3 *dwc, unsigned int length)
int dwc3_event_buffers_setup(struct dwc3 *dwc) int dwc3_event_buffers_setup(struct dwc3 *dwc)
{ {
struct dwc3_event_buffer *evt; struct dwc3_event_buffer *evt;
u32 reg;
if (!dwc->ev_buf) if (!dwc->ev_buf)
return 0; return 0;
...@@ -556,8 +557,10 @@ int dwc3_event_buffers_setup(struct dwc3 *dwc) ...@@ -556,8 +557,10 @@ int dwc3_event_buffers_setup(struct dwc3 *dwc)
upper_32_bits(evt->dma)); upper_32_bits(evt->dma));
dwc3_writel(dwc->regs, DWC3_GEVNTSIZ(0), dwc3_writel(dwc->regs, DWC3_GEVNTSIZ(0),
DWC3_GEVNTSIZ_SIZE(evt->length)); DWC3_GEVNTSIZ_SIZE(evt->length));
dwc3_writel(dwc->regs, DWC3_GEVNTCOUNT(0), 0);
/* Clear any stale event */
reg = dwc3_readl(dwc->regs, DWC3_GEVNTCOUNT(0));
dwc3_writel(dwc->regs, DWC3_GEVNTCOUNT(0), reg);
return 0; return 0;
} }
...@@ -584,7 +587,10 @@ void dwc3_event_buffers_cleanup(struct dwc3 *dwc) ...@@ -584,7 +587,10 @@ void dwc3_event_buffers_cleanup(struct dwc3 *dwc)
dwc3_writel(dwc->regs, DWC3_GEVNTADRHI(0), 0); dwc3_writel(dwc->regs, DWC3_GEVNTADRHI(0), 0);
dwc3_writel(dwc->regs, DWC3_GEVNTSIZ(0), DWC3_GEVNTSIZ_INTMASK dwc3_writel(dwc->regs, DWC3_GEVNTSIZ(0), DWC3_GEVNTSIZ_INTMASK
| DWC3_GEVNTSIZ_SIZE(0)); | DWC3_GEVNTSIZ_SIZE(0));
dwc3_writel(dwc->regs, DWC3_GEVNTCOUNT(0), 0);
/* Clear any stale event */
reg = dwc3_readl(dwc->regs, DWC3_GEVNTCOUNT(0));
dwc3_writel(dwc->regs, DWC3_GEVNTCOUNT(0), reg);
} }
static void dwc3_core_num_eps(struct dwc3 *dwc) static void dwc3_core_num_eps(struct dwc3 *dwc)
...@@ -2499,7 +2505,11 @@ static int dwc3_runtime_resume(struct device *dev) ...@@ -2499,7 +2505,11 @@ static int dwc3_runtime_resume(struct device *dev)
switch (dwc->current_dr_role) { switch (dwc->current_dr_role) {
case DWC3_GCTL_PRTCAP_DEVICE: case DWC3_GCTL_PRTCAP_DEVICE:
dwc3_gadget_process_pending_events(dwc); if (dwc->pending_events) {
pm_runtime_put(dwc->dev);
dwc->pending_events = false;
enable_irq(dwc->irq_gadget);
}
break; break;
case DWC3_GCTL_PRTCAP_HOST: case DWC3_GCTL_PRTCAP_HOST:
default: default:
...@@ -2552,7 +2562,7 @@ static int dwc3_suspend(struct device *dev) ...@@ -2552,7 +2562,7 @@ static int dwc3_suspend(struct device *dev)
static int dwc3_resume(struct device *dev) static int dwc3_resume(struct device *dev)
{ {
struct dwc3 *dwc = dev_get_drvdata(dev); struct dwc3 *dwc = dev_get_drvdata(dev);
int ret; int ret = 0;
pinctrl_pm_select_default_state(dev); pinctrl_pm_select_default_state(dev);
...@@ -2560,14 +2570,12 @@ static int dwc3_resume(struct device *dev) ...@@ -2560,14 +2570,12 @@ static int dwc3_resume(struct device *dev)
pm_runtime_set_active(dev); pm_runtime_set_active(dev);
ret = dwc3_resume_common(dwc, PMSG_RESUME); ret = dwc3_resume_common(dwc, PMSG_RESUME);
if (ret) { if (ret)
pm_runtime_set_suspended(dev); pm_runtime_set_suspended(dev);
return ret;
}
pm_runtime_enable(dev); pm_runtime_enable(dev);
return 0; return ret;
} }
static void dwc3_complete(struct device *dev) static void dwc3_complete(struct device *dev)
...@@ -2589,6 +2597,12 @@ static void dwc3_complete(struct device *dev) ...@@ -2589,6 +2597,12 @@ static void dwc3_complete(struct device *dev)
static const struct dev_pm_ops dwc3_dev_pm_ops = { static const struct dev_pm_ops dwc3_dev_pm_ops = {
SET_SYSTEM_SLEEP_PM_OPS(dwc3_suspend, dwc3_resume) SET_SYSTEM_SLEEP_PM_OPS(dwc3_suspend, dwc3_resume)
.complete = dwc3_complete, .complete = dwc3_complete,
/*
* Runtime suspend halts the controller on disconnection. It relies on
* platforms with custom connection notification to start the controller
* again.
*/
SET_RUNTIME_PM_OPS(dwc3_runtime_suspend, dwc3_runtime_resume, SET_RUNTIME_PM_OPS(dwc3_runtime_suspend, dwc3_runtime_resume,
dwc3_runtime_idle) dwc3_runtime_idle)
}; };
......
...@@ -1675,7 +1675,6 @@ static inline void dwc3_otg_host_init(struct dwc3 *dwc) ...@@ -1675,7 +1675,6 @@ static inline void dwc3_otg_host_init(struct dwc3 *dwc)
#if !IS_ENABLED(CONFIG_USB_DWC3_HOST) #if !IS_ENABLED(CONFIG_USB_DWC3_HOST)
int dwc3_gadget_suspend(struct dwc3 *dwc); int dwc3_gadget_suspend(struct dwc3 *dwc);
int dwc3_gadget_resume(struct dwc3 *dwc); int dwc3_gadget_resume(struct dwc3 *dwc);
void dwc3_gadget_process_pending_events(struct dwc3 *dwc);
#else #else
static inline int dwc3_gadget_suspend(struct dwc3 *dwc) static inline int dwc3_gadget_suspend(struct dwc3 *dwc)
{ {
...@@ -1687,9 +1686,6 @@ static inline int dwc3_gadget_resume(struct dwc3 *dwc) ...@@ -1687,9 +1686,6 @@ static inline int dwc3_gadget_resume(struct dwc3 *dwc)
return 0; return 0;
} }
static inline void dwc3_gadget_process_pending_events(struct dwc3 *dwc)
{
}
#endif /* !IS_ENABLED(CONFIG_USB_DWC3_HOST) */ #endif /* !IS_ENABLED(CONFIG_USB_DWC3_HOST) */
#if IS_ENABLED(CONFIG_USB_DWC3_ULPI) #if IS_ENABLED(CONFIG_USB_DWC3_ULPI)
......
...@@ -4728,14 +4728,3 @@ int dwc3_gadget_resume(struct dwc3 *dwc) ...@@ -4728,14 +4728,3 @@ int dwc3_gadget_resume(struct dwc3 *dwc)
return dwc3_gadget_soft_connect(dwc); return dwc3_gadget_soft_connect(dwc);
} }
void dwc3_gadget_process_pending_events(struct dwc3 *dwc)
{
if (dwc->pending_events) {
dwc3_interrupt(dwc->irq_gadget, dwc->ev_buf);
dwc3_thread_interrupt(dwc->irq_gadget, dwc->ev_buf);
pm_runtime_put(dwc->dev);
dwc->pending_events = false;
enable_irq(dwc->irq_gadget);
}
}
...@@ -1696,6 +1696,7 @@ int usb_gadget_register_driver_owner(struct usb_gadget_driver *driver, ...@@ -1696,6 +1696,7 @@ int usb_gadget_register_driver_owner(struct usb_gadget_driver *driver,
driver->driver.bus = &gadget_bus_type; driver->driver.bus = &gadget_bus_type;
driver->driver.owner = owner; driver->driver.owner = owner;
driver->driver.mod_name = mod_name; driver->driver.mod_name = mod_name;
driver->driver.probe_type = PROBE_FORCE_SYNCHRONOUS;
ret = driver_register(&driver->driver); ret = driver_register(&driver->driver);
if (ret) { if (ret) {
pr_warn("%s: driver registration failed: %d\n", pr_warn("%s: driver registration failed: %d\n",
......
...@@ -79,6 +79,7 @@ ...@@ -79,6 +79,7 @@
#define PCI_DEVICE_ID_ASMEDIA_1042A_XHCI 0x1142 #define PCI_DEVICE_ID_ASMEDIA_1042A_XHCI 0x1142
#define PCI_DEVICE_ID_ASMEDIA_1142_XHCI 0x1242 #define PCI_DEVICE_ID_ASMEDIA_1142_XHCI 0x1242
#define PCI_DEVICE_ID_ASMEDIA_2142_XHCI 0x2142 #define PCI_DEVICE_ID_ASMEDIA_2142_XHCI 0x2142
#define PCI_DEVICE_ID_ASMEDIA_3042_XHCI 0x3042
#define PCI_DEVICE_ID_ASMEDIA_3242_XHCI 0x3242 #define PCI_DEVICE_ID_ASMEDIA_3242_XHCI 0x3242
#define PCI_DEVICE_ID_CADENCE 0x17CD #define PCI_DEVICE_ID_CADENCE 0x17CD
...@@ -451,6 +452,10 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci) ...@@ -451,6 +452,10 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci)
pdev->device == PCI_DEVICE_ID_ASMEDIA_1042A_XHCI) pdev->device == PCI_DEVICE_ID_ASMEDIA_1042A_XHCI)
xhci->quirks |= XHCI_ASMEDIA_MODIFY_FLOWCONTROL; xhci->quirks |= XHCI_ASMEDIA_MODIFY_FLOWCONTROL;
if (pdev->vendor == PCI_VENDOR_ID_ASMEDIA &&
pdev->device == PCI_DEVICE_ID_ASMEDIA_3042_XHCI)
xhci->quirks |= XHCI_RESET_ON_RESUME;
if (pdev->vendor == PCI_VENDOR_ID_TI && pdev->device == 0x8241) if (pdev->vendor == PCI_VENDOR_ID_TI && pdev->device == 0x8241)
xhci->quirks |= XHCI_LIMIT_ENDPOINT_INTERVAL_7; xhci->quirks |= XHCI_LIMIT_ENDPOINT_INTERVAL_7;
......
...@@ -331,3 +331,15 @@ config USB_ONBOARD_DEV ...@@ -331,3 +331,15 @@ config USB_ONBOARD_DEV
this config will enable the driver and it will automatically this config will enable the driver and it will automatically
match the state of the USB subsystem. If this driver is a match the state of the USB subsystem. If this driver is a
module it will be called onboard_usb_dev. module it will be called onboard_usb_dev.
config USB_ONBOARD_DEV_USB5744
bool "Onboard USB Microchip usb5744 hub with SMBus support"
depends on (USB_ONBOARD_DEV && I2C=y) || (USB_ONBOARD_DEV=m && I2C=m)
help
Say Y here if you want to support onboard USB Microchip usb5744
hub that requires SMBus initialization.
This options enables usb5744 i2c default initialization sequence
during hub start-up configuration stage. It is must to enable this
option on AMD Kria KR260 Robotics Starter Kit as this hub is
connected to USB-SD converter which mounts the root filesystem.
...@@ -311,7 +311,7 @@ static void onboard_dev_attach_usb_driver(struct work_struct *work) ...@@ -311,7 +311,7 @@ static void onboard_dev_attach_usb_driver(struct work_struct *work)
static int onboard_dev_5744_i2c_init(struct i2c_client *client) static int onboard_dev_5744_i2c_init(struct i2c_client *client)
{ {
#if IS_ENABLED(CONFIG_I2C) #if IS_ENABLED(CONFIG_USB_ONBOARD_DEV_USB5744)
struct device *dev = &client->dev; struct device *dev = &client->dev;
int ret; int ret;
...@@ -394,9 +394,11 @@ static int onboard_dev_probe(struct platform_device *pdev) ...@@ -394,9 +394,11 @@ static int onboard_dev_probe(struct platform_device *pdev)
i2c_node = of_parse_phandle(pdev->dev.of_node, "i2c-bus", 0); i2c_node = of_parse_phandle(pdev->dev.of_node, "i2c-bus", 0);
if (i2c_node) { if (i2c_node) {
struct i2c_client *client; struct i2c_client *client = NULL;
#if IS_ENABLED(CONFIG_USB_ONBOARD_DEV_USB5744)
client = of_find_i2c_device_by_node(i2c_node); client = of_find_i2c_device_by_node(i2c_node);
#endif
of_node_put(i2c_node); of_node_put(i2c_node);
if (!client) { if (!client) {
......
...@@ -34,8 +34,6 @@ ...@@ -34,8 +34,6 @@
#define YUREX_BUF_SIZE 8 #define YUREX_BUF_SIZE 8
#define YUREX_WRITE_TIMEOUT (HZ*2) #define YUREX_WRITE_TIMEOUT (HZ*2)
#define MAX_S64_STRLEN 20 /* {-}922337203685477580{7,8} */
/* table of devices that work with this driver */ /* table of devices that work with this driver */
static struct usb_device_id yurex_table[] = { static struct usb_device_id yurex_table[] = {
{ USB_DEVICE(YUREX_VENDOR_ID, YUREX_PRODUCT_ID) }, { 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, ...@@ -402,8 +400,9 @@ static ssize_t yurex_read(struct file *file, char __user *buffer, size_t count,
loff_t *ppos) loff_t *ppos)
{ {
struct usb_yurex *dev; struct usb_yurex *dev;
int len = 0; int len;
char in_buffer[MAX_S64_STRLEN]; char in_buffer[20];
unsigned long flags;
dev = file->private_data; dev = file->private_data;
...@@ -413,15 +412,13 @@ static ssize_t yurex_read(struct file *file, char __user *buffer, size_t count, ...@@ -413,15 +412,13 @@ static ssize_t yurex_read(struct file *file, char __user *buffer, size_t count,
return -ENODEV; return -ENODEV;
} }
if (WARN_ON_ONCE(dev->bbu > S64_MAX || dev->bbu < S64_MIN)) { spin_lock_irqsave(&dev->lock, flags);
len = snprintf(in_buffer, 20, "%lld\n", dev->bbu);
spin_unlock_irqrestore(&dev->lock, flags);
mutex_unlock(&dev->io_mutex); mutex_unlock(&dev->io_mutex);
return -EIO;
}
spin_lock_irq(&dev->lock); if (WARN_ON_ONCE(len >= sizeof(in_buffer)))
scnprintf(in_buffer, MAX_S64_STRLEN, "%lld\n", dev->bbu); return -EIO;
spin_unlock_irq(&dev->lock);
mutex_unlock(&dev->io_mutex);
return simple_read_from_buffer(buffer, count, ppos, in_buffer, len); return simple_read_from_buffer(buffer, count, ppos, in_buffer, len);
} }
......
...@@ -2423,6 +2423,17 @@ UNUSUAL_DEV( 0xc251, 0x4003, 0x0100, 0x0100, ...@@ -2423,6 +2423,17 @@ UNUSUAL_DEV( 0xc251, 0x4003, 0x0100, 0x0100,
USB_SC_DEVICE, USB_PR_DEVICE, NULL, USB_SC_DEVICE, USB_PR_DEVICE, NULL,
US_FL_NOT_LOCKABLE), US_FL_NOT_LOCKABLE),
/*
* Reported by Icenowy Zheng <uwu@icenowy.me>
* This is an interface for vendor-specific cryptic commands instead
* of real USB storage device.
*/
UNUSUAL_DEV( 0xe5b7, 0x0811, 0x0100, 0x0100,
"ZhuHai JieLi Technology",
"JieLi BR21",
USB_SC_DEVICE, USB_PR_DEVICE, NULL,
US_FL_IGNORE_DEVICE),
/* Reported by Andrew Simmons <andrew.simmons@gmail.com> */ /* Reported by Andrew Simmons <andrew.simmons@gmail.com> */
UNUSUAL_DEV( 0xed06, 0x4500, 0x0001, 0x0001, UNUSUAL_DEV( 0xed06, 0x4500, 0x0001, 0x0001,
"DataStor", "DataStor",
......
...@@ -43,6 +43,8 @@ config NET_9P_XEN ...@@ -43,6 +43,8 @@ config NET_9P_XEN
config NET_9P_USBG config NET_9P_USBG
bool "9P USB Gadget Transport" bool "9P USB Gadget Transport"
depends on USB_GADGET=y || USB_GADGET=NET_9P depends on USB_GADGET=y || USB_GADGET=NET_9P
select CONFIGFS_FS
select USB_LIBCOMPOSITE
help help
This builds support for a transport for 9pfs over This builds support for a transport for 9pfs over
usb gadget. usb gadget.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment