aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/layerscape/patches-5.4/820-usb-0012-MLK-11340-40-usb-whitelist-update-otg-eh-s-TPL-for-f.patch
diff options
context:
space:
mode:
Diffstat (limited to 'target/linux/layerscape/patches-5.4/820-usb-0012-MLK-11340-40-usb-whitelist-update-otg-eh-s-TPL-for-f.patch')
-rw-r--r--target/linux/layerscape/patches-5.4/820-usb-0012-MLK-11340-40-usb-whitelist-update-otg-eh-s-TPL-for-f.patch117
1 files changed, 117 insertions, 0 deletions
diff --git a/target/linux/layerscape/patches-5.4/820-usb-0012-MLK-11340-40-usb-whitelist-update-otg-eh-s-TPL-for-f.patch b/target/linux/layerscape/patches-5.4/820-usb-0012-MLK-11340-40-usb-whitelist-update-otg-eh-s-TPL-for-f.patch
new file mode 100644
index 0000000000..259af8ecbc
--- /dev/null
+++ b/target/linux/layerscape/patches-5.4/820-usb-0012-MLK-11340-40-usb-whitelist-update-otg-eh-s-TPL-for-f.patch
@@ -0,0 +1,117 @@
+From 93cd22091be5d549fb5b0ec78955c2ec272a52e5 Mon Sep 17 00:00:00 2001
+From: Peter Chen <peter.chen@freescale.com>
+Date: Fri, 8 Aug 2014 09:12:52 +0800
+Subject: [PATCH] MLK-11340-40 usb: whitelist: update otg & eh's TPL for fsl
+ i.mx
+
+The default TPL is for USB OTG & EH compliance test, the supported
+class is: mass storage, hub, and hid.
+
+Besides, we add one match criterion that matching targeted device
+through class at interface descriptor.
+
+Tested-by: Li Jun <b47624@freescale.com>
+Signed-off-by: Peter Chen <peter.chen@freescale.com>
+(cherry picked from commit 483c071d989ceb36cacf76e1e3e779c67e5b8280)
+(cherry picked from commit defcf3883f60f8ea913481f16411752cb0132a74)
+---
+ drivers/usb/core/otg_whitelist.h | 73 ++++++++++++++++++++++++++++------------
+ 1 file changed, 52 insertions(+), 21 deletions(-)
+
+--- a/drivers/usb/core/otg_whitelist.h
++++ b/drivers/usb/core/otg_whitelist.h
+@@ -13,35 +13,62 @@
+ */
+
+ static struct usb_device_id whitelist_table[] = {
+-
+-/* hubs are optional in OTG, but very handy ... */
+-{ USB_DEVICE_INFO(USB_CLASS_HUB, 0, 0), },
+-{ USB_DEVICE_INFO(USB_CLASS_HUB, 0, 1), },
+-
+-#ifdef CONFIG_USB_PRINTER /* ignoring nonstatic linkage! */
+-/* FIXME actually, printers are NOT supposed to use device classes;
+- * they're supposed to use interface classes...
+- */
+-{ USB_DEVICE_INFO(7, 1, 1) },
+-{ USB_DEVICE_INFO(7, 1, 2) },
+-{ USB_DEVICE_INFO(7, 1, 3) },
++/* Add FSL i.mx whitelist, the default list is for USB Compliance Test */
++#if defined(CONFIG_USB_EHSET_TEST_FIXTURE) \
++ || defined(CONFIG_USB_EHSET_TEST_FIXTURE_MODULE)
++#define TEST_SE0_NAK_PID 0x0101
++#define TEST_J_PID 0x0102
++#define TEST_K_PID 0x0103
++#define TEST_PACKET_PID 0x0104
++#define TEST_HS_HOST_PORT_SUSPEND_RESUME 0x0106
++#define TEST_SINGLE_STEP_GET_DEV_DESC 0x0107
++#define TEST_SINGLE_STEP_SET_FEATURE 0x0108
++{ USB_DEVICE(0x1a0a, TEST_SE0_NAK_PID) },
++{ USB_DEVICE(0x1a0a, TEST_J_PID) },
++{ USB_DEVICE(0x1a0a, TEST_K_PID) },
++{ USB_DEVICE(0x1a0a, TEST_PACKET_PID) },
++{ USB_DEVICE(0x1a0a, TEST_HS_HOST_PORT_SUSPEND_RESUME) },
++{ USB_DEVICE(0x1a0a, TEST_SINGLE_STEP_GET_DEV_DESC) },
++{ USB_DEVICE(0x1a0a, TEST_SINGLE_STEP_SET_FEATURE) },
+ #endif
+
+-#ifdef CONFIG_USB_NET_CDCETHER
+-/* Linux-USB CDC Ethernet gadget */
+-{ USB_DEVICE(0x0525, 0xa4a1), },
+-/* Linux-USB CDC Ethernet + RNDIS gadget */
+-{ USB_DEVICE(0x0525, 0xa4a2), },
++#define USB_INTERFACE_CLASS_INFO(cl) \
++ .match_flags = USB_DEVICE_ID_MATCH_INT_CLASS, \
++ .bInterfaceClass = (cl)
++
++{USB_INTERFACE_CLASS_INFO(USB_CLASS_HUB) },
++#if defined(CONFIG_USB_STORAGE) || defined(CONFIG_USB_STORAGE_MODULE)
++{USB_INTERFACE_CLASS_INFO(USB_CLASS_MASS_STORAGE) },
+ #endif
+-
+-#if IS_ENABLED(CONFIG_USB_TEST)
+-/* gadget zero, for testing */
+-{ USB_DEVICE(0x0525, 0xa4a0), },
++#if defined(CONFIG_USB_HID) || defined(CONFIG_USB_HID_MODULE)
++{USB_INTERFACE_CLASS_INFO(USB_CLASS_HID) },
+ #endif
+
+ { } /* Terminating entry */
+ };
+
++static bool match_int_class(struct usb_device_id *id, struct usb_device *udev)
++{
++ struct usb_host_config *c;
++ int num_configs, i;
++
++ /* Copy the code from generic.c */
++ c = udev->config;
++ num_configs = udev->descriptor.bNumConfigurations;
++ for (i = 0; i < num_configs; (i++, c++)) {
++ struct usb_interface_descriptor *desc = NULL;
++
++ /* It's possible that a config has no interfaces! */
++ if (c->desc.bNumInterfaces > 0)
++ desc = &c->intf_cache[0]->altsetting->desc;
++
++ if (desc && (desc->bInterfaceClass == id->bInterfaceClass))
++ return true;
++ }
++
++ return false;
++}
++
+ static int is_targeted(struct usb_device *dev)
+ {
+ struct usb_device_id *id = whitelist_table;
+@@ -90,6 +117,10 @@ static int is_targeted(struct usb_device
+ (id->bDeviceProtocol != dev->descriptor.bDeviceProtocol))
+ continue;
+
++ if ((id->match_flags & USB_DEVICE_ID_MATCH_INT_CLASS) &&
++ (!match_int_class(id, dev)))
++ continue;
++
+ return 1;
+ }
+