USB: fixes for v5.8-rc3

Adding support for recent Intel devices (Tiger Lake and Jasper Lake)
 on dwc3. We have some endianess fixes in cdns3, a memleak fix in
 gr_udc and lock API usage fix in the legacy f_uac1
 
 Signed-off-by: Felipe Balbi <balbi@kernel.org>
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEElLzh7wn96CXwjh2IzL64meEamQYFAl8IKSMACgkQzL64meEa
 mQa26w/7BZdPUxY69eq947b/Qbb0r6KBXwx6tFEwQ51aBhAdv8KYnIAueloh98+k
 56y7QjCvgfWtVZZsy8y/Et8kcfT32XfzlLoPMa+4wShSzD5hZfSWI43xQP3xfQs8
 D65Yxy74Y4sbygI/Fs/VmaWLSSFxZkuKohwSVWNsRGu+FMDkhFu+D6TvDEnyK8Vm
 bUpRj+qWDZJkuc0XQgiA7AlRaD5AegqsALLx4Hd2YaiLXWrFfwv9RZDAvg9fWCyQ
 wocxqgW6JDysiA7okUiarv15u7MUcU+8czdNbhJjJK5N/tipWUH6lROZdKBHcLhn
 V6tucOnlc/ArDWbLgAxZ6DnAOdDuCSPqPVUjVlh7zf0ZMmElKly2RRxHg7E0zhNs
 e4mGrJGgYKCu+xLT+wpKLWhDKEMi9FH11pOBGdP5nqBWM9wOin11jU+hiRUa78FA
 bMxktM2hjQtpJq9iGvIhVO10WRUHmbjs7VBEFOgvKxEc9uPWAAbjxoPI80FOhZmQ
 oG3kCwwAme0HHUL4O+35F7LLnssYncD5YIExKU8PaQeMWXUkOe8H1oqNDxUcpj5J
 rdNu+lBd1hP7AghSfynuQQkTdinJaiCP8KNOjk8BujL8O4pq4s83HfIMmv3haDMe
 0N/MkKSnNQI7OmJJMDKoJpG+oRA41v0qgPCUHpoe+WZqV16xfrs=
 =jf3f
 -----END PGP SIGNATURE-----

Merge tag 'fixes-for-v5.8-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb into usb-linus

Felipe writes:

USB: fixes for v5.8-rc3

Adding support for recent Intel devices (Tiger Lake and Jasper Lake)
on dwc3. We have some endianess fixes in cdns3, a memleak fix in
gr_udc and lock API usage fix in the legacy f_uac1

Signed-off-by: Felipe Balbi <balbi@kernel.org>

* tag 'fixes-for-v5.8-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb:
  usb: gadget: function: fix missing spinlock in f_uac1_legacy
  usb: gadget: udc: atmel: fix uninitialized read in debug printk
  usb: gadget: udc: atmel: remove outdated comment in usba_ep_disable()
  usb: dwc2: Fix shutdown callback in platform
  usb: cdns3: trace: fix some endian issues
  usb: cdns3: ep0: fix some endian issues
  usb: gadget: udc: gr_udc: fix memleak on error handling path in gr_ep_init()
  usb: gadget: fix langid kernel-doc warning in usbstring.c
  usb: dwc3: pci: add support for the Intel Jasper Lake
  usb: dwc3: pci: add support for the Intel Tiger Lake PCH -H variant
This commit is contained in:
Greg Kroah-Hartman 2020-07-10 12:40:04 +02:00
commit d1c0d96535
8 changed files with 38 additions and 30 deletions

View File

@ -37,18 +37,18 @@ static void cdns3_ep0_run_transfer(struct cdns3_device *priv_dev,
struct cdns3_usb_regs __iomem *regs = priv_dev->regs;
struct cdns3_endpoint *priv_ep = priv_dev->eps[0];
priv_ep->trb_pool[0].buffer = TRB_BUFFER(dma_addr);
priv_ep->trb_pool[0].length = TRB_LEN(length);
priv_ep->trb_pool[0].buffer = cpu_to_le32(TRB_BUFFER(dma_addr));
priv_ep->trb_pool[0].length = cpu_to_le32(TRB_LEN(length));
if (zlp) {
priv_ep->trb_pool[0].control = TRB_CYCLE | TRB_TYPE(TRB_NORMAL);
priv_ep->trb_pool[1].buffer = TRB_BUFFER(dma_addr);
priv_ep->trb_pool[1].length = TRB_LEN(0);
priv_ep->trb_pool[1].control = TRB_CYCLE | TRB_IOC |
TRB_TYPE(TRB_NORMAL);
priv_ep->trb_pool[0].control = cpu_to_le32(TRB_CYCLE | TRB_TYPE(TRB_NORMAL));
priv_ep->trb_pool[1].buffer = cpu_to_le32(TRB_BUFFER(dma_addr));
priv_ep->trb_pool[1].length = cpu_to_le32(TRB_LEN(0));
priv_ep->trb_pool[1].control = cpu_to_le32(TRB_CYCLE | TRB_IOC |
TRB_TYPE(TRB_NORMAL));
} else {
priv_ep->trb_pool[0].control = TRB_CYCLE | TRB_IOC |
TRB_TYPE(TRB_NORMAL);
priv_ep->trb_pool[0].control = cpu_to_le32(TRB_CYCLE | TRB_IOC |
TRB_TYPE(TRB_NORMAL));
priv_ep->trb_pool[1].control = 0;
}
@ -264,11 +264,11 @@ static int cdns3_req_ep0_get_status(struct cdns3_device *priv_dev,
case USB_RECIP_INTERFACE:
return cdns3_ep0_delegate_req(priv_dev, ctrl);
case USB_RECIP_ENDPOINT:
index = cdns3_ep_addr_to_index(ctrl->wIndex);
index = cdns3_ep_addr_to_index(le16_to_cpu(ctrl->wIndex));
priv_ep = priv_dev->eps[index];
/* check if endpoint is stalled or stall is pending */
cdns3_select_ep(priv_dev, ctrl->wIndex);
cdns3_select_ep(priv_dev, le16_to_cpu(ctrl->wIndex));
if (EP_STS_STALL(readl(&priv_dev->regs->ep_sts)) ||
(priv_ep->flags & EP_STALL_PENDING))
usb_status = BIT(USB_ENDPOINT_HALT);
@ -381,10 +381,10 @@ static int cdns3_ep0_feature_handle_endpoint(struct cdns3_device *priv_dev,
if (!(ctrl->wIndex & ~USB_DIR_IN))
return 0;
index = cdns3_ep_addr_to_index(ctrl->wIndex);
index = cdns3_ep_addr_to_index(le16_to_cpu(ctrl->wIndex));
priv_ep = priv_dev->eps[index];
cdns3_select_ep(priv_dev, ctrl->wIndex);
cdns3_select_ep(priv_dev, le16_to_cpu(ctrl->wIndex));
if (set)
__cdns3_gadget_ep_set_halt(priv_ep);
@ -445,7 +445,7 @@ static int cdns3_req_ep0_set_sel(struct cdns3_device *priv_dev,
if (priv_dev->gadget.state < USB_STATE_ADDRESS)
return -EINVAL;
if (ctrl_req->wLength != 6) {
if (le16_to_cpu(ctrl_req->wLength) != 6) {
dev_err(priv_dev->dev, "Set SEL should be 6 bytes, got %d\n",
ctrl_req->wLength);
return -EINVAL;
@ -469,7 +469,7 @@ static int cdns3_req_ep0_set_isoch_delay(struct cdns3_device *priv_dev,
if (ctrl_req->wIndex || ctrl_req->wLength)
return -EINVAL;
priv_dev->isoch_delay = ctrl_req->wValue;
priv_dev->isoch_delay = le16_to_cpu(ctrl_req->wValue);
return 0;
}

View File

@ -404,9 +404,9 @@ DECLARE_EVENT_CLASS(cdns3_log_trb,
TP_fast_assign(
__assign_str(name, priv_ep->name);
__entry->trb = trb;
__entry->buffer = trb->buffer;
__entry->length = trb->length;
__entry->control = trb->control;
__entry->buffer = le32_to_cpu(trb->buffer);
__entry->length = le32_to_cpu(trb->length);
__entry->control = le32_to_cpu(trb->control);
__entry->type = usb_endpoint_type(priv_ep->endpoint.desc);
__entry->last_stream_id = priv_ep->last_stream_id;
),

View File

@ -342,7 +342,8 @@ static void dwc2_driver_shutdown(struct platform_device *dev)
{
struct dwc2_hsotg *hsotg = platform_get_drvdata(dev);
disable_irq(hsotg->irq);
dwc2_disable_global_interrupts(hsotg);
synchronize_irq(hsotg->irq);
}
/**

View File

@ -38,6 +38,8 @@
#define PCI_DEVICE_ID_INTEL_ICLLP 0x34ee
#define PCI_DEVICE_ID_INTEL_EHLLP 0x4b7e
#define PCI_DEVICE_ID_INTEL_TGPLP 0xa0ee
#define PCI_DEVICE_ID_INTEL_TGPH 0x43ee
#define PCI_DEVICE_ID_INTEL_JSP 0x4dee
#define PCI_INTEL_BXT_DSM_GUID "732b85d5-b7a7-4a1b-9ba0-4bbd00ffd511"
#define PCI_INTEL_BXT_FUNC_PMU_PWR 4
@ -358,6 +360,12 @@ static const struct pci_device_id dwc3_pci_id_table[] = {
{ PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_TGPLP),
(kernel_ulong_t) &dwc3_pci_intel_properties, },
{ PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_TGPH),
(kernel_ulong_t) &dwc3_pci_intel_properties, },
{ PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_JSP),
(kernel_ulong_t) &dwc3_pci_intel_properties, },
{ PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_NL_USB),
(kernel_ulong_t) &dwc3_pci_amd_properties, },
{ } /* Terminating Entry */

View File

@ -336,7 +336,9 @@ static int f_audio_out_ep_complete(struct usb_ep *ep, struct usb_request *req)
/* Copy buffer is full, add it to the play_queue */
if (audio_buf_size - copy_buf->actual < req->actual) {
spin_lock_irq(&audio->lock);
list_add_tail(&copy_buf->list, &audio->play_queue);
spin_unlock_irq(&audio->lock);
schedule_work(&audio->playback_work);
copy_buf = f_audio_buffer_alloc(audio_buf_size);
if (IS_ERR(copy_buf))

View File

@ -676,13 +676,7 @@ static int usba_ep_disable(struct usb_ep *_ep)
if (!ep->ep.desc) {
spin_unlock_irqrestore(&udc->lock, flags);
/* REVISIT because this driver disables endpoints in
* reset_all_endpoints() before calling disconnect(),
* most gadget drivers would trigger this non-error ...
*/
if (udc->gadget.speed != USB_SPEED_UNKNOWN)
DBG(DBG_ERR, "ep_disable: %s not enabled\n",
ep->ep.name);
DBG(DBG_ERR, "ep_disable: %s not enabled\n", ep->ep.name);
return -EINVAL;
}
ep->ep.desc = NULL;
@ -871,7 +865,7 @@ static int usba_ep_dequeue(struct usb_ep *_ep, struct usb_request *_req)
u32 status;
DBG(DBG_GADGET | DBG_QUEUE, "ep_dequeue: %s, req %p\n",
ep->ep.name, req);
ep->ep.name, _req);
spin_lock_irqsave(&udc->lock, flags);

View File

@ -1980,9 +1980,12 @@ static int gr_ep_init(struct gr_udc *dev, int num, int is_in, u32 maxplimit)
if (num == 0) {
_req = gr_alloc_request(&ep->ep, GFP_ATOMIC);
if (!_req)
return -ENOMEM;
buf = devm_kzalloc(dev->dev, PAGE_SIZE, GFP_DMA | GFP_ATOMIC);
if (!_req || !buf) {
/* possible _req freed by gr_probe via gr_remove */
if (!buf) {
gr_free_request(&ep->ep, _req);
return -ENOMEM;
}

View File

@ -68,7 +68,7 @@ EXPORT_SYMBOL_GPL(usb_gadget_get_string);
/**
* usb_validate_langid - validate usb language identifiers
* @lang: usb language identifier
* @langid: usb language identifier
*
* Returns true for valid language identifier, otherwise false.
*/