developer | 5d148cb | 2023-06-02 13:08:11 +0800 | [diff] [blame] | 1 | From 32950d08c99f51e88a2db8dd30c5076a4947de24 Mon Sep 17 00:00:00 2001 |
| 2 | From: Sam Shih <sam.shih@mediatek.com> |
| 3 | Date: Fri, 2 Jun 2023 13:06:27 +0800 |
| 4 | Subject: [PATCH] |
developer | 3de3aca | 2023-06-07 20:44:59 +0800 | [diff] [blame] | 5 | [high-speed-io][999-2622-usb-add-embedded-Host-feature-support.patch] |
developer | 00bd07d | 2021-06-24 09:20:42 +0800 | [diff] [blame] | 6 | |
developer | 00bd07d | 2021-06-24 09:20:42 +0800 | [diff] [blame] | 7 | --- |
| 8 | drivers/usb/core/hub.c | 9 +++++--- |
| 9 | drivers/usb/core/otg_whitelist.h | 39 ++++++++++++++++++++++++++++++++ |
developer | ba28e03 | 2021-12-07 10:40:00 +0800 | [diff] [blame] | 10 | drivers/usb/host/xhci-mtk.c | 2 ++ |
| 11 | 3 files changed, 47 insertions(+), 3 deletions(-) |
developer | 00bd07d | 2021-06-24 09:20:42 +0800 | [diff] [blame] | 12 | |
| 13 | diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c |
developer | 5d148cb | 2023-06-02 13:08:11 +0800 | [diff] [blame] | 14 | index f787e9771..7687711f1 100644 |
developer | 00bd07d | 2021-06-24 09:20:42 +0800 | [diff] [blame] | 15 | --- a/drivers/usb/core/hub.c |
| 16 | +++ b/drivers/usb/core/hub.c |
developer | 5d148cb | 2023-06-02 13:08:11 +0800 | [diff] [blame] | 17 | @@ -2424,6 +2424,8 @@ static int usb_enumerate_device(struct usb_device *udev) |
developer | 00bd07d | 2021-06-24 09:20:42 +0800 | [diff] [blame] | 18 | if (err < 0) |
| 19 | dev_dbg(&udev->dev, "HNP fail, %d\n", err); |
| 20 | } |
| 21 | + |
| 22 | + dev_info(&udev->dev, "Unsupported Device!\n"); |
| 23 | return -ENOTSUPP; |
| 24 | } |
| 25 | |
developer | 5d148cb | 2023-06-02 13:08:11 +0800 | [diff] [blame] | 26 | @@ -4781,9 +4783,10 @@ hub_port_init(struct usb_hub *hub, struct usb_device *udev, int port1, |
developer | 00bd07d | 2021-06-24 09:20:42 +0800 | [diff] [blame] | 27 | goto fail; |
| 28 | } |
| 29 | if (r) { |
| 30 | - if (r != -ENODEV) |
| 31 | - dev_err(&udev->dev, "device descriptor read/64, error %d\n", |
| 32 | - r); |
| 33 | + if (r != -ENODEV) { |
| 34 | + dev_err(&udev->dev, "device descriptor read/64, error %d\n", r); |
| 35 | + dev_info(&udev->dev, "Device No Respond\n"); |
| 36 | + } |
| 37 | retval = -EMSGSIZE; |
| 38 | continue; |
| 39 | } |
| 40 | diff --git a/drivers/usb/core/otg_whitelist.h b/drivers/usb/core/otg_whitelist.h |
developer | 5d148cb | 2023-06-02 13:08:11 +0800 | [diff] [blame] | 41 | index 2ae90158d..a8dd22133 100644 |
developer | 00bd07d | 2021-06-24 09:20:42 +0800 | [diff] [blame] | 42 | --- a/drivers/usb/core/otg_whitelist.h |
| 43 | +++ b/drivers/usb/core/otg_whitelist.h |
| 44 | @@ -39,9 +39,44 @@ static struct usb_device_id whitelist_table[] = { |
| 45 | { USB_DEVICE(0x0525, 0xa4a0), }, |
| 46 | #endif |
| 47 | |
| 48 | +/* xhci-mtk usb3 root-hub */ |
| 49 | +{ USB_DEVICE(0x1d6b, 0x0003), }, |
| 50 | + |
| 51 | +/* xhci-mtk usb2 root-hub */ |
| 52 | +{ USB_DEVICE(0x1d6b, 0x0002), }, |
| 53 | + |
| 54 | +/* */ |
| 55 | +{ USB_INTERFACE_INFO(USB_CLASS_MASS_STORAGE, 0, 0) }, |
| 56 | + |
| 57 | { } /* Terminating entry */ |
| 58 | }; |
| 59 | |
| 60 | +static bool usb_match_any_interface(struct usb_device *udev, |
| 61 | + const struct usb_device_id *id) |
| 62 | +{ |
| 63 | + unsigned int i; |
| 64 | + |
| 65 | + for (i = 0; i < udev->descriptor.bNumConfigurations; ++i) { |
| 66 | + struct usb_host_config *cfg = &udev->config[i]; |
| 67 | + unsigned int j; |
| 68 | + |
| 69 | + for (j = 0; j < cfg->desc.bNumInterfaces; ++j) { |
| 70 | + struct usb_interface_cache *cache; |
| 71 | + struct usb_host_interface *intf; |
| 72 | + |
| 73 | + cache = cfg->intf_cache[j]; |
| 74 | + if (cache->num_altsetting == 0) |
| 75 | + continue; |
| 76 | + |
| 77 | + intf = &cache->altsetting[0]; |
| 78 | + if (id->bInterfaceClass == intf->desc.bInterfaceClass) |
| 79 | + return true; |
| 80 | + } |
| 81 | + } |
| 82 | + |
| 83 | + return false; |
| 84 | +} |
| 85 | + |
| 86 | static int is_targeted(struct usb_device *dev) |
| 87 | { |
| 88 | struct usb_device_id *id = whitelist_table; |
| 89 | @@ -90,6 +125,10 @@ static int is_targeted(struct usb_device *dev) |
| 90 | (id->bDeviceProtocol != dev->descriptor.bDeviceProtocol)) |
| 91 | continue; |
| 92 | |
| 93 | + if ((id->match_flags & USB_DEVICE_ID_MATCH_INT_INFO) && |
| 94 | + !usb_match_any_interface(dev, id)) |
| 95 | + continue; |
| 96 | + |
| 97 | return 1; |
| 98 | } |
| 99 | |
| 100 | diff --git a/drivers/usb/host/xhci-mtk.c b/drivers/usb/host/xhci-mtk.c |
developer | 5d148cb | 2023-06-02 13:08:11 +0800 | [diff] [blame] | 101 | index 7a2007931..19b54c343 100644 |
developer | 00bd07d | 2021-06-24 09:20:42 +0800 | [diff] [blame] | 102 | --- a/drivers/usb/host/xhci-mtk.c |
| 103 | +++ b/drivers/usb/host/xhci-mtk.c |
developer | 5d148cb | 2023-06-02 13:08:11 +0800 | [diff] [blame] | 104 | @@ -575,6 +575,8 @@ static int xhci_mtk_probe(struct platform_device *pdev) |
developer | 00bd07d | 2021-06-24 09:20:42 +0800 | [diff] [blame] | 105 | goto disable_device_wakeup; |
| 106 | } |
| 107 | |
| 108 | + hcd->tpl_support = of_usb_host_tpl_support(node); |
| 109 | + xhci->shared_hcd->tpl_support = hcd->tpl_support; |
| 110 | ret = usb_add_hcd(hcd, irq, IRQF_SHARED); |
| 111 | if (ret) |
| 112 | goto put_usb3_hcd; |
| 113 | -- |
developer | 5d148cb | 2023-06-02 13:08:11 +0800 | [diff] [blame] | 114 | 2.34.1 |
developer | 00bd07d | 2021-06-24 09:20:42 +0800 | [diff] [blame] | 115 | |