Skip to content

Commit 4a66842

Browse files
committed
Merge tag 'usb-5.13-rc2' 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 5.13-rc2. They consist of a number of resolutions for reported issues: - typec fixes for found problems - xhci fixes and quirk additions - dwc3 driver fixes - minor fixes found by Coverity - cdc-wdm fixes for reported problems All of these have been in linux-next for a few days with no reported issues" * tag 'usb-5.13-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb: (28 commits) usb: core: hub: fix race condition about TRSMRCY of resume usb: typec: tcpm: Fix SINK_DISCOVERY current limit for Rp-default xhci: Add reset resume quirk for AMD xhci controller. usb: xhci: Increase timeout for HC halt xhci: Do not use GFP_KERNEL in (potentially) atomic context xhci: Fix giving back cancelled URBs even if halted endpoint can't reset xhci-pci: Allow host runtime PM as default for Intel Alder Lake xHCI usb: musb: Fix an error message usb: typec: tcpm: Fix wrong handling for Not_Supported in VDM AMS usb: typec: tcpm: Send DISCOVER_IDENTITY from dedicated work usb: typec: ucsi: Retrieve all the PDOs instead of just the first 4 usb: fotg210-hcd: Fix an error message docs: usb: function: Modify path name usb: dwc3: omap: improve extcon initialization usb: typec: ucsi: Put fwnode in any case during ->probe() usb: typec: tcpm: Fix wrong handling in GET_SINK_CAP usb: dwc2: Remove obsolete MODULE_ constants from platform.c usb: dwc3: imx8mp: fix error return code in dwc3_imx8mp_probe() usb: dwc3: imx8mp: detect dwc3 core node via compatible string usb: dwc3: gadget: Return success always for kick transfer in ep queue ...
2 parents 8ce3648 + 975f94c commit 4a66842

File tree

22 files changed

+220
-75
lines changed

22 files changed

+220
-75
lines changed

Documentation/driver-api/usb/usb.rst

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -109,16 +109,19 @@ well as to make sure they aren't relying on some HCD-specific behavior.
109109
USB-Standard Types
110110
==================
111111

112-
In ``drivers/usb/common/common.c`` and ``drivers/usb/common/debug.c`` you
113-
will find the USB data types defined in chapter 9 of the USB specification.
114-
These data types are used throughout USB, and in APIs including this host
115-
side API, gadget APIs, usb character devices and debugfs interfaces.
112+
In ``include/uapi/linux/usb/ch9.h`` you will find the USB data types defined
113+
in chapter 9 of the USB specification. These data types are used throughout
114+
USB, and in APIs including this host side API, gadget APIs, usb character
115+
devices and debugfs interfaces. That file is itself included by
116+
``include/linux/usb/ch9.h``, which also contains declarations of a few
117+
utility routines for manipulating these data types; the implementations
118+
are in ``drivers/usb/common/common.c``.
116119

117120
.. kernel-doc:: drivers/usb/common/common.c
118121
:export:
119122

120-
.. kernel-doc:: drivers/usb/common/debug.c
121-
:export:
123+
In addition, some functions useful for creating debugging output are
124+
defined in ``drivers/usb/common/debug.c``.
122125

123126
Host-Side Data Types and Macros
124127
===============================

Documentation/usb/gadget_configfs.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ is an arbitrary string allowed in a filesystem, e.g.::
140140
Each function provides its specific set of attributes, with either read-only
141141
or read-write access. Where applicable they need to be written to as
142142
appropriate.
143-
Please refer to Documentation/ABI/*/configfs-usb-gadget* for more information.
143+
Please refer to Documentation/ABI/testing/configfs-usb-gadget for more information.
144144

145145
4. Associating the functions with their configurations
146146
------------------------------------------------------

drivers/usb/class/cdc-wdm.c

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -321,12 +321,23 @@ static void wdm_int_callback(struct urb *urb)
321321

322322
}
323323

324-
static void kill_urbs(struct wdm_device *desc)
324+
static void poison_urbs(struct wdm_device *desc)
325325
{
326326
/* the order here is essential */
327-
usb_kill_urb(desc->command);
328-
usb_kill_urb(desc->validity);
329-
usb_kill_urb(desc->response);
327+
usb_poison_urb(desc->command);
328+
usb_poison_urb(desc->validity);
329+
usb_poison_urb(desc->response);
330+
}
331+
332+
static void unpoison_urbs(struct wdm_device *desc)
333+
{
334+
/*
335+
* the order here is not essential
336+
* it is symmetrical just to be nice
337+
*/
338+
usb_unpoison_urb(desc->response);
339+
usb_unpoison_urb(desc->validity);
340+
usb_unpoison_urb(desc->command);
330341
}
331342

332343
static void free_urbs(struct wdm_device *desc)
@@ -741,11 +752,12 @@ static int wdm_release(struct inode *inode, struct file *file)
741752
if (!desc->count) {
742753
if (!test_bit(WDM_DISCONNECTING, &desc->flags)) {
743754
dev_dbg(&desc->intf->dev, "wdm_release: cleanup\n");
744-
kill_urbs(desc);
755+
poison_urbs(desc);
745756
spin_lock_irq(&desc->iuspin);
746757
desc->resp_count = 0;
747758
spin_unlock_irq(&desc->iuspin);
748759
desc->manage_power(desc->intf, 0);
760+
unpoison_urbs(desc);
749761
} else {
750762
/* must avoid dev_printk here as desc->intf is invalid */
751763
pr_debug(KBUILD_MODNAME " %s: device gone - cleaning up\n", __func__);
@@ -1037,9 +1049,9 @@ static void wdm_disconnect(struct usb_interface *intf)
10371049
wake_up_all(&desc->wait);
10381050
mutex_lock(&desc->rlock);
10391051
mutex_lock(&desc->wlock);
1052+
poison_urbs(desc);
10401053
cancel_work_sync(&desc->rxwork);
10411054
cancel_work_sync(&desc->service_outs_intr);
1042-
kill_urbs(desc);
10431055
mutex_unlock(&desc->wlock);
10441056
mutex_unlock(&desc->rlock);
10451057

@@ -1080,9 +1092,10 @@ static int wdm_suspend(struct usb_interface *intf, pm_message_t message)
10801092
set_bit(WDM_SUSPENDING, &desc->flags);
10811093
spin_unlock_irq(&desc->iuspin);
10821094
/* callback submits work - order is essential */
1083-
kill_urbs(desc);
1095+
poison_urbs(desc);
10841096
cancel_work_sync(&desc->rxwork);
10851097
cancel_work_sync(&desc->service_outs_intr);
1098+
unpoison_urbs(desc);
10861099
}
10871100
if (!PMSG_IS_AUTO(message)) {
10881101
mutex_unlock(&desc->wlock);
@@ -1140,7 +1153,7 @@ static int wdm_pre_reset(struct usb_interface *intf)
11401153
wake_up_all(&desc->wait);
11411154
mutex_lock(&desc->rlock);
11421155
mutex_lock(&desc->wlock);
1143-
kill_urbs(desc);
1156+
poison_urbs(desc);
11441157
cancel_work_sync(&desc->rxwork);
11451158
cancel_work_sync(&desc->service_outs_intr);
11461159
return 0;
@@ -1151,6 +1164,7 @@ static int wdm_post_reset(struct usb_interface *intf)
11511164
struct wdm_device *desc = wdm_find_device(intf);
11521165
int rv;
11531166

1167+
unpoison_urbs(desc);
11541168
clear_bit(WDM_OVERFLOW, &desc->flags);
11551169
clear_bit(WDM_RESETTING, &desc->flags);
11561170
rv = recover_from_urb_loss(desc);

drivers/usb/core/hub.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3642,9 +3642,6 @@ int usb_port_resume(struct usb_device *udev, pm_message_t msg)
36423642
* sequence.
36433643
*/
36443644
status = hub_port_status(hub, port1, &portstatus, &portchange);
3645-
3646-
/* TRSMRCY = 10 msec */
3647-
msleep(10);
36483645
}
36493646

36503647
SuspendCleared:
@@ -3659,6 +3656,9 @@ int usb_port_resume(struct usb_device *udev, pm_message_t msg)
36593656
usb_clear_port_feature(hub->hdev, port1,
36603657
USB_PORT_FEAT_C_SUSPEND);
36613658
}
3659+
3660+
/* TRSMRCY = 10 msec */
3661+
msleep(10);
36623662
}
36633663

36643664
if (udev->persist_enabled)

drivers/usb/dwc2/core.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ struct dwc2_hsotg_req;
113113
* @debugfs: File entry for debugfs file for this endpoint.
114114
* @dir_in: Set to true if this endpoint is of the IN direction, which
115115
* means that it is sending data to the Host.
116+
* @map_dir: Set to the value of dir_in when the DMA buffer is mapped.
116117
* @index: The index for the endpoint registers.
117118
* @mc: Multi Count - number of transactions per microframe
118119
* @interval: Interval for periodic endpoints, in frames or microframes.
@@ -162,6 +163,7 @@ struct dwc2_hsotg_ep {
162163
unsigned short fifo_index;
163164

164165
unsigned char dir_in;
166+
unsigned char map_dir;
165167
unsigned char index;
166168
unsigned char mc;
167169
u16 interval;

drivers/usb/dwc2/gadget.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,7 @@ static void dwc2_hsotg_unmap_dma(struct dwc2_hsotg *hsotg,
422422
{
423423
struct usb_request *req = &hs_req->req;
424424

425-
usb_gadget_unmap_request(&hsotg->gadget, req, hs_ep->dir_in);
425+
usb_gadget_unmap_request(&hsotg->gadget, req, hs_ep->map_dir);
426426
}
427427

428428
/*
@@ -1242,6 +1242,7 @@ static int dwc2_hsotg_map_dma(struct dwc2_hsotg *hsotg,
12421242
{
12431243
int ret;
12441244

1245+
hs_ep->map_dir = hs_ep->dir_in;
12451246
ret = usb_gadget_map_request(&hsotg->gadget, req, hs_ep->dir_in);
12461247
if (ret)
12471248
goto dma_error;

drivers/usb/dwc2/platform.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -776,7 +776,3 @@ static struct platform_driver dwc2_platform_driver = {
776776
};
777777

778778
module_platform_driver(dwc2_platform_driver);
779-
780-
MODULE_DESCRIPTION("DESIGNWARE HS OTG Platform Glue");
781-
MODULE_AUTHOR("Matthijs Kooijman <[email protected]>");
782-
MODULE_LICENSE("Dual BSD/GPL");

drivers/usb/dwc3/core.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
#define DWC3_DEVICE_EVENT_LINK_STATUS_CHANGE 3
5858
#define DWC3_DEVICE_EVENT_WAKEUP 4
5959
#define DWC3_DEVICE_EVENT_HIBER_REQ 5
60-
#define DWC3_DEVICE_EVENT_EOPF 6
60+
#define DWC3_DEVICE_EVENT_SUSPEND 6
6161
#define DWC3_DEVICE_EVENT_SOF 7
6262
#define DWC3_DEVICE_EVENT_ERRATIC_ERROR 9
6363
#define DWC3_DEVICE_EVENT_CMD_CMPL 10
@@ -460,7 +460,7 @@
460460
#define DWC3_DEVTEN_CMDCMPLTEN BIT(10)
461461
#define DWC3_DEVTEN_ERRTICERREN BIT(9)
462462
#define DWC3_DEVTEN_SOFEN BIT(7)
463-
#define DWC3_DEVTEN_EOPFEN BIT(6)
463+
#define DWC3_DEVTEN_U3L2L1SUSPEN BIT(6)
464464
#define DWC3_DEVTEN_HIBERNATIONREQEVTEN BIT(5)
465465
#define DWC3_DEVTEN_WKUPEVTEN BIT(4)
466466
#define DWC3_DEVTEN_ULSTCNGEN BIT(3)
@@ -850,6 +850,7 @@ struct dwc3_trb {
850850
* @hwparams6: GHWPARAMS6
851851
* @hwparams7: GHWPARAMS7
852852
* @hwparams8: GHWPARAMS8
853+
* @hwparams9: GHWPARAMS9
853854
*/
854855
struct dwc3_hwparams {
855856
u32 hwparams0;
@@ -1374,7 +1375,7 @@ struct dwc3_event_depevt {
13741375
* 3 - ULStChng
13751376
* 4 - WkUpEvt
13761377
* 5 - Reserved
1377-
* 6 - EOPF
1378+
* 6 - Suspend (EOPF on revisions 2.10a and prior)
13781379
* 7 - SOF
13791380
* 8 - Reserved
13801381
* 9 - ErrticErr

drivers/usb/dwc3/debug.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -221,8 +221,8 @@ static inline const char *dwc3_gadget_event_string(char *str, size_t size,
221221
snprintf(str, size, "WakeUp [%s]",
222222
dwc3_gadget_link_string(state));
223223
break;
224-
case DWC3_DEVICE_EVENT_EOPF:
225-
snprintf(str, size, "End-Of-Frame [%s]",
224+
case DWC3_DEVICE_EVENT_SUSPEND:
225+
snprintf(str, size, "Suspend [%s]",
226226
dwc3_gadget_link_string(state));
227227
break;
228228
case DWC3_DEVICE_EVENT_SOF:
@@ -353,8 +353,8 @@ static inline const char *dwc3_gadget_event_type_string(u8 event)
353353
return "Wake-Up";
354354
case DWC3_DEVICE_EVENT_HIBER_REQ:
355355
return "Hibernation";
356-
case DWC3_DEVICE_EVENT_EOPF:
357-
return "End of Periodic Frame";
356+
case DWC3_DEVICE_EVENT_SUSPEND:
357+
return "Suspend";
358358
case DWC3_DEVICE_EVENT_SOF:
359359
return "Start of Frame";
360360
case DWC3_DEVICE_EVENT_ERRATIC_ERROR:

drivers/usb/dwc3/dwc3-imx8mp.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,8 +165,9 @@ static int dwc3_imx8mp_probe(struct platform_device *pdev)
165165
if (err < 0)
166166
goto disable_rpm;
167167

168-
dwc3_np = of_get_child_by_name(node, "dwc3");
168+
dwc3_np = of_get_compatible_child(node, "snps,dwc3");
169169
if (!dwc3_np) {
170+
err = -ENODEV;
170171
dev_err(dev, "failed to find dwc3 core child\n");
171172
goto disable_rpm;
172173
}

0 commit comments

Comments
 (0)