]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
5.4-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 6 Sep 2022 11:41:18 +0000 (13:41 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 6 Sep 2022 11:41:18 +0000 (13:41 +0200)
added patches:
driver-core-don-t-probe-devices-after-bus_type.match-probe-deferral.patch
s390-fix-nospec-table-alignments.patch
s390-hugetlb-fix-prepare_hugepage_range-check-for-2-gb-hugepages.patch
usb-cdc-acm-add-icom-pmr-f3400-support-0c26-0020.patch
usb-core-prevent-nested-device-reset-calls.patch
usb-dwc2-fix-wrong-order-of-phy_power_on-and-phy_init.patch
usb-gadget-mass_storage-fix-cdrom-data-transfers-on-mac-os.patch
usb-serial-cp210x-add-decagon-uca-device-id.patch
usb-serial-option-add-quectel-em060k-modem.patch
usb-serial-option-add-support-for-cinterion-mv32-wa-wb-rmnet-mode.patch
usb-serial-option-add-support-for-oppo-r11-diag-port.patch
usb-storage-add-ignore-residue-quirk-for-nxp-pn7462au.patch
usb-typec-altmodes-displayport-correct-pin-assignment-for-ufp-receptacles.patch

14 files changed:
queue-5.4/driver-core-don-t-probe-devices-after-bus_type.match-probe-deferral.patch [new file with mode: 0644]
queue-5.4/s390-fix-nospec-table-alignments.patch [new file with mode: 0644]
queue-5.4/s390-hugetlb-fix-prepare_hugepage_range-check-for-2-gb-hugepages.patch [new file with mode: 0644]
queue-5.4/series
queue-5.4/usb-cdc-acm-add-icom-pmr-f3400-support-0c26-0020.patch [new file with mode: 0644]
queue-5.4/usb-core-prevent-nested-device-reset-calls.patch [new file with mode: 0644]
queue-5.4/usb-dwc2-fix-wrong-order-of-phy_power_on-and-phy_init.patch [new file with mode: 0644]
queue-5.4/usb-gadget-mass_storage-fix-cdrom-data-transfers-on-mac-os.patch [new file with mode: 0644]
queue-5.4/usb-serial-cp210x-add-decagon-uca-device-id.patch [new file with mode: 0644]
queue-5.4/usb-serial-option-add-quectel-em060k-modem.patch [new file with mode: 0644]
queue-5.4/usb-serial-option-add-support-for-cinterion-mv32-wa-wb-rmnet-mode.patch [new file with mode: 0644]
queue-5.4/usb-serial-option-add-support-for-oppo-r11-diag-port.patch [new file with mode: 0644]
queue-5.4/usb-storage-add-ignore-residue-quirk-for-nxp-pn7462au.patch [new file with mode: 0644]
queue-5.4/usb-typec-altmodes-displayport-correct-pin-assignment-for-ufp-receptacles.patch [new file with mode: 0644]

diff --git a/queue-5.4/driver-core-don-t-probe-devices-after-bus_type.match-probe-deferral.patch b/queue-5.4/driver-core-don-t-probe-devices-after-bus_type.match-probe-deferral.patch
new file mode 100644 (file)
index 0000000..edeb927
--- /dev/null
@@ -0,0 +1,67 @@
+From 25e9fbf0fd38868a429feabc38abebfc6dbf6542 Mon Sep 17 00:00:00 2001
+From: "Isaac J. Manjarres" <isaacmanjarres@google.com>
+Date: Wed, 17 Aug 2022 11:40:26 -0700
+Subject: driver core: Don't probe devices after bus_type.match() probe deferral
+
+From: Isaac J. Manjarres <isaacmanjarres@google.com>
+
+commit 25e9fbf0fd38868a429feabc38abebfc6dbf6542 upstream.
+
+Both __device_attach_driver() and __driver_attach() check the return
+code of the bus_type.match() function to see if the device needs to be
+added to the deferred probe list. After adding the device to the list,
+the logic attempts to bind the device to the driver anyway, as if the
+device had matched with the driver, which is not correct.
+
+If __device_attach_driver() detects that the device in question is not
+ready to match with a driver on the bus, then it doesn't make sense for
+the device to attempt to bind with the current driver or continue
+attempting to match with any of the other drivers on the bus. So, update
+the logic in __device_attach_driver() to reflect this.
+
+If __driver_attach() detects that a driver tried to match with a device
+that is not ready to match yet, then the driver should not attempt to bind
+with the device. However, the driver can still attempt to match and bind
+with other devices on the bus, as drivers can be bound to multiple
+devices. So, update the logic in __driver_attach() to reflect this.
+
+Fixes: 656b8035b0ee ("ARM: 8524/1: driver cohandle -EPROBE_DEFER from bus_type.match()")
+Cc: stable@vger.kernel.org
+Cc: Saravana Kannan <saravanak@google.com>
+Reported-by: Guenter Roeck <linux@roeck-us.net>
+Tested-by: Guenter Roeck <linux@roeck-us.net>
+Tested-by: Linus Walleij <linus.walleij@linaro.org>
+Reviewed-by: Saravana Kannan <saravanak@google.com>
+Signed-off-by: Isaac J. Manjarres <isaacmanjarres@google.com>
+Link: https://lore.kernel.org/r/20220817184026.3468620-1-isaacmanjarres@google.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/base/dd.c |   10 ++++++++++
+ 1 file changed, 10 insertions(+)
+
+--- a/drivers/base/dd.c
++++ b/drivers/base/dd.c
+@@ -818,6 +818,11 @@ static int __device_attach_driver(struct
+       } else if (ret == -EPROBE_DEFER) {
+               dev_dbg(dev, "Device match requests probe deferral\n");
+               driver_deferred_probe_add(dev);
++              /*
++               * Device can't match with a driver right now, so don't attempt
++               * to match or bind with other drivers on the bus.
++               */
++              return ret;
+       } else if (ret < 0) {
+               dev_dbg(dev, "Bus failed to match device: %d", ret);
+               return ret;
+@@ -1057,6 +1062,11 @@ static int __driver_attach(struct device
+       } else if (ret == -EPROBE_DEFER) {
+               dev_dbg(dev, "Device match requests probe deferral\n");
+               driver_deferred_probe_add(dev);
++              /*
++               * Driver could not match with device, but may match with
++               * another device on the bus.
++               */
++              return 0;
+       } else if (ret < 0) {
+               dev_dbg(dev, "Bus failed to match device: %d", ret);
+               return ret;
diff --git a/queue-5.4/s390-fix-nospec-table-alignments.patch b/queue-5.4/s390-fix-nospec-table-alignments.patch
new file mode 100644 (file)
index 0000000..dfc6162
--- /dev/null
@@ -0,0 +1,53 @@
+From c9305b6c1f52060377c72aebe3a701389e9f3172 Mon Sep 17 00:00:00 2001
+From: Josh Poimboeuf <jpoimboe@kernel.org>
+Date: Fri, 26 Aug 2022 16:55:44 -0700
+Subject: s390: fix nospec table alignments
+
+From: Josh Poimboeuf <jpoimboe@kernel.org>
+
+commit c9305b6c1f52060377c72aebe3a701389e9f3172 upstream.
+
+Add proper alignment for .nospec_call_table and .nospec_return_table in
+vmlinux.
+
+[hca@linux.ibm.com]: The problem with the missing alignment of the nospec
+tables exist since a long time, however only since commit e6ed91fd0768
+("s390/alternatives: remove padding generation code") and with
+CONFIG_RELOCATABLE=n the kernel may also crash at boot time.
+
+The above named commit reduced the size of struct alt_instr by one byte,
+so its new size is 11 bytes. Therefore depending on the number of cpu
+alternatives the size of the __alt_instructions array maybe odd, which
+again also causes that the addresses of the nospec tables will be odd.
+
+If the address of __nospec_call_start is odd and the kernel is compiled
+With CONFIG_RELOCATABLE=n the compiler may generate code that loads the
+address of __nospec_call_start with a 'larl' instruction.
+
+This will generate incorrect code since the 'larl' instruction only works
+with even addresses. In result the members of the nospec tables will be
+accessed with an off-by-one offset, which subsequently may lead to
+addressing exceptions within __nospec_revert().
+
+Fixes: f19fbd5ed642 ("s390: introduce execute-trampolines for branches")
+Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
+Link: https://lore.kernel.org/r/8719bf1ce4a72ebdeb575200290094e9ce047bcc.1661557333.git.jpoimboe@kernel.org
+Cc: <stable@vger.kernel.org> # 4.16
+Reviewed-by: Heiko Carstens <hca@linux.ibm.com>
+Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
+Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ arch/s390/kernel/vmlinux.lds.S |    1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/arch/s390/kernel/vmlinux.lds.S
++++ b/arch/s390/kernel/vmlinux.lds.S
+@@ -124,6 +124,7 @@ SECTIONS
+       /*
+        * Table with the patch locations to undo expolines
+       */
++      . = ALIGN(4);
+       .nospec_call_table : {
+               __nospec_call_start = . ;
+               *(.s390_indirect*)
diff --git a/queue-5.4/s390-hugetlb-fix-prepare_hugepage_range-check-for-2-gb-hugepages.patch b/queue-5.4/s390-hugetlb-fix-prepare_hugepage_range-check-for-2-gb-hugepages.patch
new file mode 100644 (file)
index 0000000..f25594a
--- /dev/null
@@ -0,0 +1,45 @@
+From 7c8d42fdf1a84b1a0dd60d6528309c8ec127e87c Mon Sep 17 00:00:00 2001
+From: Gerald Schaefer <gerald.schaefer@linux.ibm.com>
+Date: Fri, 19 Aug 2022 18:53:43 +0200
+Subject: s390/hugetlb: fix prepare_hugepage_range() check for 2 GB hugepages
+
+From: Gerald Schaefer <gerald.schaefer@linux.ibm.com>
+
+commit 7c8d42fdf1a84b1a0dd60d6528309c8ec127e87c upstream.
+
+The alignment check in prepare_hugepage_range() is wrong for 2 GB
+hugepages, it only checks for 1 MB hugepage alignment.
+
+This can result in kernel crash in __unmap_hugepage_range() at the
+BUG_ON(start & ~huge_page_mask(h)) alignment check, for mappings
+created with MAP_FIXED at unaligned address.
+
+Fix this by correctly handling multiple hugepage sizes, similar to the
+generic version of prepare_hugepage_range().
+
+Fixes: d08de8e2d867 ("s390/mm: add support for 2GB hugepages")
+Cc: <stable@vger.kernel.org> # 4.8+
+Acked-by: Alexander Gordeev <agordeev@linux.ibm.com>
+Signed-off-by: Gerald Schaefer <gerald.schaefer@linux.ibm.com>
+Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ arch/s390/include/asm/hugetlb.h |    6 ++++--
+ 1 file changed, 4 insertions(+), 2 deletions(-)
+
+--- a/arch/s390/include/asm/hugetlb.h
++++ b/arch/s390/include/asm/hugetlb.h
+@@ -35,9 +35,11 @@ static inline bool is_hugepage_only_rang
+ static inline int prepare_hugepage_range(struct file *file,
+                       unsigned long addr, unsigned long len)
+ {
+-      if (len & ~HPAGE_MASK)
++      struct hstate *h = hstate_file(file);
++
++      if (len & ~huge_page_mask(h))
+               return -EINVAL;
+-      if (addr & ~HPAGE_MASK)
++      if (addr & ~huge_page_mask(h))
+               return -EINVAL;
+       return 0;
+ }
index 79f087e1961d073ca30912cdbe537493585cb4af..f655c44db24b94ad35296b2da7b660606ce159c3 100644 (file)
@@ -34,3 +34,16 @@ hwmon-gpio-fan-fix-array-out-of-bounds-access.patch
 gpio-pca953x-add-mutex_lock-for-regcache-sync-in-pm.patch
 thunderbolt-use-the-actual-buffer-in-tb_async_error.patch
 xhci-add-grace-period-after-xhc-start-to-prevent-premature-runtime-suspend.patch
+usb-serial-cp210x-add-decagon-uca-device-id.patch
+usb-serial-option-add-support-for-oppo-r11-diag-port.patch
+usb-serial-option-add-quectel-em060k-modem.patch
+usb-serial-option-add-support-for-cinterion-mv32-wa-wb-rmnet-mode.patch
+usb-typec-altmodes-displayport-correct-pin-assignment-for-ufp-receptacles.patch
+usb-dwc2-fix-wrong-order-of-phy_power_on-and-phy_init.patch
+usb-cdc-acm-add-icom-pmr-f3400-support-0c26-0020.patch
+usb-storage-add-ignore-residue-quirk-for-nxp-pn7462au.patch
+s390-hugetlb-fix-prepare_hugepage_range-check-for-2-gb-hugepages.patch
+s390-fix-nospec-table-alignments.patch
+usb-core-prevent-nested-device-reset-calls.patch
+usb-gadget-mass_storage-fix-cdrom-data-transfers-on-mac-os.patch
+driver-core-don-t-probe-devices-after-bus_type.match-probe-deferral.patch
diff --git a/queue-5.4/usb-cdc-acm-add-icom-pmr-f3400-support-0c26-0020.patch b/queue-5.4/usb-cdc-acm-add-icom-pmr-f3400-support-0c26-0020.patch
new file mode 100644 (file)
index 0000000..ae9d33c
--- /dev/null
@@ -0,0 +1,113 @@
+From a10bc71729b236fe36de0d8e4d35c959fd8dec3a Mon Sep 17 00:00:00 2001
+From: Thierry GUIBERT <thierry.guibert@croix-rouge.fr>
+Date: Fri, 19 Aug 2022 10:17:02 +0200
+Subject: USB: cdc-acm: Add Icom PMR F3400 support (0c26:0020)
+
+From: Thierry GUIBERT <thierry.guibert@croix-rouge.fr>
+
+commit a10bc71729b236fe36de0d8e4d35c959fd8dec3a upstream.
+
+Supports for ICOM F3400 and ICOM F4400 PMR radios in CDC-ACM driver
+enabling the AT serial port.
+The Vendor Id is 0x0C26
+The Product ID is 0x0020
+
+Output of lsusb :
+Bus 001 Device 009: ID 0c26:0020 Prolific Technology Inc. ICOM Radio
+Couldn't open device, some information will be missing
+Device Descriptor:
+  bLength                18
+  bDescriptorType         1
+  bcdUSB               2.00
+  bDeviceClass            2 Communications
+  bDeviceSubClass         0
+  bDeviceProtocol         0
+  bMaxPacketSize0        64
+  idVendor           0x0c26 Prolific Technology Inc.
+  idProduct          0x0020
+  bcdDevice            0.00
+  iManufacturer           1 ICOM Inc.
+  iProduct                2 ICOM Radio
+  iSerial                 3 *obfuscated*
+  bNumConfigurations      1
+  Configuration Descriptor:
+    bLength                 9
+    bDescriptorType         2
+    wTotalLength       0x0030
+    bNumInterfaces          2
+    bConfigurationValue     1
+    iConfiguration          0
+    bmAttributes         0xc0
+      Self Powered
+    MaxPower                0mA
+    Interface Descriptor:
+      bLength                 9
+      bDescriptorType         4
+      bInterfaceNumber        0
+      bAlternateSetting       0
+      bNumEndpoints           1
+      bInterfaceClass         2 Communications
+      bInterfaceSubClass      2 Abstract (modem)
+      bInterfaceProtocol      1 AT-commands (v.25ter)
+      iInterface              0
+      Endpoint Descriptor:
+        bLength                 7
+        bDescriptorType         5
+        bEndpointAddress     0x83  EP 3 IN
+        bmAttributes            3
+          Transfer Type            Interrupt
+          Synch Type               None
+          Usage Type               Data
+        wMaxPacketSize     0x0040  1x 64 bytes
+        bInterval              12
+    Interface Descriptor:
+      bLength                 9
+      bDescriptorType         4
+      bInterfaceNumber        1
+      bAlternateSetting       0
+      bNumEndpoints           2
+      bInterfaceClass        10 CDC Data
+      bInterfaceSubClass      0
+      bInterfaceProtocol      0
+      iInterface              0
+      Endpoint Descriptor:
+        bLength                 7
+        bDescriptorType         5
+        bEndpointAddress     0x82  EP 2 IN
+        bmAttributes            2
+          Transfer Type            Bulk
+          Synch Type               None
+          Usage Type               Data
+        wMaxPacketSize     0x0200  1x 512 bytes
+        bInterval               0
+      Endpoint Descriptor:
+        bLength                 7
+        bDescriptorType         5
+        bEndpointAddress     0x02  EP 2 OUT
+        bmAttributes            2
+          Transfer Type            Bulk
+          Synch Type               None
+          Usage Type               Data
+        wMaxPacketSize     0x0200  1x 512 bytes
+        bInterval               0
+
+Signed-off-by: Thierry GUIBERT <thierry.guibert@croix-rouge.fr>
+Cc: stable <stable@kernel.org>
+Link: https://lore.kernel.org/r/20220819081702.84118-1-thierry.guibert@croix-rouge.fr
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/usb/class/cdc-acm.c |    3 +++
+ 1 file changed, 3 insertions(+)
+
+--- a/drivers/usb/class/cdc-acm.c
++++ b/drivers/usb/class/cdc-acm.c
+@@ -1843,6 +1843,9 @@ static const struct usb_device_id acm_id
+       { USB_DEVICE(0x09d8, 0x0320), /* Elatec GmbH TWN3 */
+       .driver_info = NO_UNION_NORMAL, /* has misplaced union descriptor */
+       },
++      { USB_DEVICE(0x0c26, 0x0020), /* Icom ICF3400 Serie */
++      .driver_info = NO_UNION_NORMAL, /* reports zero length descriptor */
++      },
+       { USB_DEVICE(0x0ca6, 0xa050), /* Castles VEGA3000 */
+       .driver_info = NO_UNION_NORMAL, /* reports zero length descriptor */
+       },
diff --git a/queue-5.4/usb-core-prevent-nested-device-reset-calls.patch b/queue-5.4/usb-core-prevent-nested-device-reset-calls.patch
new file mode 100644 (file)
index 0000000..7fd0d2a
--- /dev/null
@@ -0,0 +1,130 @@
+From 9c6d778800b921bde3bff3cff5003d1650f942d1 Mon Sep 17 00:00:00 2001
+From: Alan Stern <stern@rowland.harvard.edu>
+Date: Fri, 26 Aug 2022 15:31:32 -0400
+Subject: USB: core: Prevent nested device-reset calls
+
+From: Alan Stern <stern@rowland.harvard.edu>
+
+commit 9c6d778800b921bde3bff3cff5003d1650f942d1 upstream.
+
+Automatic kernel fuzzing revealed a recursive locking violation in
+usb-storage:
+
+============================================
+WARNING: possible recursive locking detected
+5.18.0 #3 Not tainted
+--------------------------------------------
+kworker/1:3/1205 is trying to acquire lock:
+ffff888018638db8 (&us_interface_key[i]){+.+.}-{3:3}, at:
+usb_stor_pre_reset+0x35/0x40 drivers/usb/storage/usb.c:230
+
+but task is already holding lock:
+ffff888018638db8 (&us_interface_key[i]){+.+.}-{3:3}, at:
+usb_stor_pre_reset+0x35/0x40 drivers/usb/storage/usb.c:230
+
+...
+
+stack backtrace:
+CPU: 1 PID: 1205 Comm: kworker/1:3 Not tainted 5.18.0 #3
+Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS
+1.13.0-1ubuntu1.1 04/01/2014
+Workqueue: usb_hub_wq hub_event
+Call Trace:
+<TASK>
+__dump_stack lib/dump_stack.c:88 [inline]
+dump_stack_lvl+0xcd/0x134 lib/dump_stack.c:106
+print_deadlock_bug kernel/locking/lockdep.c:2988 [inline]
+check_deadlock kernel/locking/lockdep.c:3031 [inline]
+validate_chain kernel/locking/lockdep.c:3816 [inline]
+__lock_acquire.cold+0x152/0x3ca kernel/locking/lockdep.c:5053
+lock_acquire kernel/locking/lockdep.c:5665 [inline]
+lock_acquire+0x1ab/0x520 kernel/locking/lockdep.c:5630
+__mutex_lock_common kernel/locking/mutex.c:603 [inline]
+__mutex_lock+0x14f/0x1610 kernel/locking/mutex.c:747
+usb_stor_pre_reset+0x35/0x40 drivers/usb/storage/usb.c:230
+usb_reset_device+0x37d/0x9a0 drivers/usb/core/hub.c:6109
+r871xu_dev_remove+0x21a/0x270 drivers/staging/rtl8712/usb_intf.c:622
+usb_unbind_interface+0x1bd/0x890 drivers/usb/core/driver.c:458
+device_remove drivers/base/dd.c:545 [inline]
+device_remove+0x11f/0x170 drivers/base/dd.c:537
+__device_release_driver drivers/base/dd.c:1222 [inline]
+device_release_driver_internal+0x1a7/0x2f0 drivers/base/dd.c:1248
+usb_driver_release_interface+0x102/0x180 drivers/usb/core/driver.c:627
+usb_forced_unbind_intf+0x4d/0xa0 drivers/usb/core/driver.c:1118
+usb_reset_device+0x39b/0x9a0 drivers/usb/core/hub.c:6114
+
+This turned out not to be an error in usb-storage but rather a nested
+device reset attempt.  That is, as the rtl8712 driver was being
+unbound from a composite device in preparation for an unrelated USB
+reset (that driver does not have pre_reset or post_reset callbacks),
+its ->remove routine called usb_reset_device() -- thus nesting one
+reset call within another.
+
+Performing a reset as part of disconnect processing is a questionable
+practice at best.  However, the bug report points out that the USB
+core does not have any protection against nested resets.  Adding a
+reset_in_progress flag and testing it will prevent such errors in the
+future.
+
+Link: https://lore.kernel.org/all/CAB7eexKUpvX-JNiLzhXBDWgfg2T9e9_0Tw4HQ6keN==voRbP0g@mail.gmail.com/
+Cc: stable@vger.kernel.org
+Reported-and-tested-by: Rondreis <linhaoguo86@gmail.com>
+Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
+Link: https://lore.kernel.org/r/YwkflDxvg0KWqyZK@rowland.harvard.edu
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/usb/core/hub.c |   10 ++++++++++
+ include/linux/usb.h    |    2 ++
+ 2 files changed, 12 insertions(+)
+
+--- a/drivers/usb/core/hub.c
++++ b/drivers/usb/core/hub.c
+@@ -5923,6 +5923,11 @@ re_enumerate_no_bos:
+  * the reset is over (using their post_reset method).
+  *
+  * Return: The same as for usb_reset_and_verify_device().
++ * However, if a reset is already in progress (for instance, if a
++ * driver doesn't have pre_ or post_reset() callbacks, and while
++ * being unbound or re-bound during the ongoing reset its disconnect()
++ * or probe() routine tries to perform a second, nested reset), the
++ * routine returns -EINPROGRESS.
+  *
+  * Note:
+  * The caller must own the device lock.  For example, it's safe to use
+@@ -5956,6 +5961,10 @@ int usb_reset_device(struct usb_device *
+               return -EISDIR;
+       }
++      if (udev->reset_in_progress)
++              return -EINPROGRESS;
++      udev->reset_in_progress = 1;
++
+       port_dev = hub->ports[udev->portnum - 1];
+       /*
+@@ -6020,6 +6029,7 @@ int usb_reset_device(struct usb_device *
+       usb_autosuspend_device(udev);
+       memalloc_noio_restore(noio_flag);
++      udev->reset_in_progress = 0;
+       return ret;
+ }
+ EXPORT_SYMBOL_GPL(usb_reset_device);
+--- a/include/linux/usb.h
++++ b/include/linux/usb.h
+@@ -580,6 +580,7 @@ struct usb3_lpm_parameters {
+  * @devaddr: device address, XHCI: assigned by HW, others: same as devnum
+  * @can_submit: URBs may be submitted
+  * @persist_enabled:  USB_PERSIST enabled for this device
++ * @reset_in_progress: the device is being reset
+  * @have_langid: whether string_langid is valid
+  * @authorized: policy has said we can use it;
+  *    (user space) policy determines if we authorize this device to be
+@@ -665,6 +666,7 @@ struct usb_device {
+       unsigned can_submit:1;
+       unsigned persist_enabled:1;
++      unsigned reset_in_progress:1;
+       unsigned have_langid:1;
+       unsigned authorized:1;
+       unsigned authenticated:1;
diff --git a/queue-5.4/usb-dwc2-fix-wrong-order-of-phy_power_on-and-phy_init.patch b/queue-5.4/usb-dwc2-fix-wrong-order-of-phy_power_on-and-phy_init.patch
new file mode 100644 (file)
index 0000000..53036da
--- /dev/null
@@ -0,0 +1,52 @@
+From f9b995b49a07bd0d43b0e490f59be84415c745ae Mon Sep 17 00:00:00 2001
+From: Heiner Kallweit <hkallweit1@gmail.com>
+Date: Tue, 23 Aug 2022 19:58:42 +0200
+Subject: usb: dwc2: fix wrong order of phy_power_on and phy_init
+
+From: Heiner Kallweit <hkallweit1@gmail.com>
+
+commit f9b995b49a07bd0d43b0e490f59be84415c745ae upstream.
+
+Since 1599069a62c6 ("phy: core: Warn when phy_power_on is called before
+phy_init") the driver complains. In my case (Amlogic SoC) the warning
+is: phy phy-fe03e000.phy.2: phy_power_on was called before phy_init
+So change the order of the two calls. The same change has to be done
+to the order of phy_exit() and phy_power_off().
+
+Fixes: 09a75e857790 ("usb: dwc2: refactor common low-level hw code to platform.c")
+Cc: stable@vger.kernel.org
+Acked-by: Minas Harutyunyan <hminas@synopsys.com>
+Acked-by: Marek Szyprowski <m.szyprowski@samsung.com>
+Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
+Link: https://lore.kernel.org/r/dfcc6b40-2274-4e86-e73c-5c5e6aa3e046@gmail.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/usb/dwc2/platform.c |    8 ++++----
+ 1 file changed, 4 insertions(+), 4 deletions(-)
+
+--- a/drivers/usb/dwc2/platform.c
++++ b/drivers/usb/dwc2/platform.c
+@@ -142,9 +142,9 @@ static int __dwc2_lowlevel_hw_enable(str
+       } else if (hsotg->plat && hsotg->plat->phy_init) {
+               ret = hsotg->plat->phy_init(pdev, hsotg->plat->phy_type);
+       } else {
+-              ret = phy_power_on(hsotg->phy);
++              ret = phy_init(hsotg->phy);
+               if (ret == 0)
+-                      ret = phy_init(hsotg->phy);
++                      ret = phy_power_on(hsotg->phy);
+       }
+       return ret;
+@@ -176,9 +176,9 @@ static int __dwc2_lowlevel_hw_disable(st
+       } else if (hsotg->plat && hsotg->plat->phy_exit) {
+               ret = hsotg->plat->phy_exit(pdev, hsotg->plat->phy_type);
+       } else {
+-              ret = phy_exit(hsotg->phy);
++              ret = phy_power_off(hsotg->phy);
+               if (ret == 0)
+-                      ret = phy_power_off(hsotg->phy);
++                      ret = phy_exit(hsotg->phy);
+       }
+       if (ret)
+               return ret;
diff --git a/queue-5.4/usb-gadget-mass_storage-fix-cdrom-data-transfers-on-mac-os.patch b/queue-5.4/usb-gadget-mass_storage-fix-cdrom-data-transfers-on-mac-os.patch
new file mode 100644 (file)
index 0000000..61f37f9
--- /dev/null
@@ -0,0 +1,48 @@
+From 9d4dc16ec71bd6368548e9743223e449b4377fc7 Mon Sep 17 00:00:00 2001
+From: Krishna Kurapati <quic_kriskura@quicinc.com>
+Date: Sat, 27 Aug 2022 08:45:10 +0530
+Subject: usb: gadget: mass_storage: Fix cdrom data transfers on MAC-OS
+
+From: Krishna Kurapati <quic_kriskura@quicinc.com>
+
+commit 9d4dc16ec71bd6368548e9743223e449b4377fc7 upstream.
+
+During cdrom emulation, the response to read_toc command must contain
+the cdrom address as the number of sectors (2048 byte sized blocks)
+represented either as an absolute value (when MSF bit is '0') or in
+terms of PMin/PSec/PFrame (when MSF bit is set to '1'). Incase of
+cdrom, the fsg_lun_open call sets the sector size to 2048 bytes.
+
+When MAC OS sends a read_toc request with MSF set to '1', the
+store_cdrom_address assumes that the address being provided is the
+LUN size represented in 512 byte sized blocks instead of 2048. It
+tries to modify the address further to convert it to 2048 byte sized
+blocks and store it in MSF format. This results in data transfer
+failures as the cdrom address being provided in the read_toc response
+is incorrect.
+
+Fixes: 3f565a363cee ("usb: gadget: storage: adapt logic block size to bound block devices")
+Cc: stable@vger.kernel.org
+Acked-by: Alan Stern <stern@rowland.harvard.edu>
+Signed-off-by: Krishna Kurapati <quic_kriskura@quicinc.com>
+Link: https://lore.kernel.org/r/1661570110-19127-1-git-send-email-quic_kriskura@quicinc.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/usb/gadget/function/storage_common.c |    6 ++++--
+ 1 file changed, 4 insertions(+), 2 deletions(-)
+
+--- a/drivers/usb/gadget/function/storage_common.c
++++ b/drivers/usb/gadget/function/storage_common.c
+@@ -294,8 +294,10 @@ EXPORT_SYMBOL_GPL(fsg_lun_fsync_sub);
+ void store_cdrom_address(u8 *dest, int msf, u32 addr)
+ {
+       if (msf) {
+-              /* Convert to Minutes-Seconds-Frames */
+-              addr >>= 2;             /* Convert to 2048-byte frames */
++              /*
++               * Convert to Minutes-Seconds-Frames.
++               * Sector size is already set to 2048 bytes.
++               */
+               addr += 2*75;           /* Lead-in occupies 2 seconds */
+               dest[3] = addr % 75;    /* Frames */
+               addr /= 75;
diff --git a/queue-5.4/usb-serial-cp210x-add-decagon-uca-device-id.patch b/queue-5.4/usb-serial-cp210x-add-decagon-uca-device-id.patch
new file mode 100644 (file)
index 0000000..1775ed1
--- /dev/null
@@ -0,0 +1,29 @@
+From ceb4038472a4803e7046ed488b03d11551991514 Mon Sep 17 00:00:00 2001
+From: Johan Hovold <johan@kernel.org>
+Date: Mon, 29 Aug 2022 16:25:50 +0200
+Subject: USB: serial: cp210x: add Decagon UCA device id
+
+From: Johan Hovold <johan@kernel.org>
+
+commit ceb4038472a4803e7046ed488b03d11551991514 upstream.
+
+Add the device id for Decagon Devices USB Cable Adapter.
+
+Link: https://lore.kernel.org/r/trinity-819f9db2-d3e1-40e9-a669-9c245817c046-1661523546680@msvc-mesg-web108
+Cc: stable@vger.kernel.org
+Signed-off-by: Johan Hovold <johan@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/usb/serial/cp210x.c |    1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/drivers/usb/serial/cp210x.c
++++ b/drivers/usb/serial/cp210x.c
+@@ -131,6 +131,7 @@ static const struct usb_device_id id_tab
+       { USB_DEVICE(0x10C4, 0x83AA) }, /* Mark-10 Digital Force Gauge */
+       { USB_DEVICE(0x10C4, 0x83D8) }, /* DekTec DTA Plus VHF/UHF Booster/Attenuator */
+       { USB_DEVICE(0x10C4, 0x8411) }, /* Kyocera GPS Module */
++      { USB_DEVICE(0x10C4, 0x8414) }, /* Decagon USB Cable Adapter */
+       { USB_DEVICE(0x10C4, 0x8418) }, /* IRZ Automation Teleport SG-10 GSM/GPRS Modem */
+       { USB_DEVICE(0x10C4, 0x846E) }, /* BEI USB Sensor Interface (VCP) */
+       { USB_DEVICE(0x10C4, 0x8470) }, /* Juniper Networks BX Series System Console */
diff --git a/queue-5.4/usb-serial-option-add-quectel-em060k-modem.patch b/queue-5.4/usb-serial-option-add-quectel-em060k-modem.patch
new file mode 100644 (file)
index 0000000..6d5daa4
--- /dev/null
@@ -0,0 +1,74 @@
+From f766f3abe6dbc9bf8b56a5d53c87e5a17942c154 Mon Sep 17 00:00:00 2001
+From: Yonglin Tan <yonglin.tan@outlook.com>
+Date: Tue, 19 Jul 2022 19:28:00 +0800
+Subject: USB: serial: option: add Quectel EM060K modem
+
+From: Yonglin Tan <yonglin.tan@outlook.com>
+
+commit f766f3abe6dbc9bf8b56a5d53c87e5a17942c154 upstream.
+
+Add usb product id entry for the Quectel EM060K module.
+
+"MBIM mode": DIAG + NMEA + AT + MODEM + MBIM + QDSS
+
+T:  Bus=01 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#=  8 Spd=480  MxCh= 0
+D:  Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
+P:  Vendor=2c7c ProdID=030b Rev= 5.04
+S:  Manufacturer=Quectel
+S:  Product=EM060K-GL
+S:  SerialNumber=89fb57db
+C:* #Ifs= 7 Cfg#= 1 Atr=a0 MxPwr=500mA
+A:  FirstIf#= 8 IfCount= 2 Cls=02(comm.) Sub=0e Prot=00
+I:* If#= 0 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=30 Driver=option
+E:  Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
+E:  Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
+I:* If#= 1 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=40 Driver=option
+E:  Ad=83(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
+E:  Ad=82(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
+E:  Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
+I:* If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option
+E:  Ad=85(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
+E:  Ad=84(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
+E:  Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
+I:* If#= 3 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option
+E:  Ad=87(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
+E:  Ad=86(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
+E:  Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
+I:* If#= 8 Alt= 0 #EPs= 1 Cls=02(comm.) Sub=0e Prot=00 Driver=cdc_mbim
+E:  Ad=88(I) Atr=03(Int.) MxPS=  64 Ivl=32ms
+I:  If#= 9 Alt= 0 #EPs= 0 Cls=0a(data ) Sub=00 Prot=02 Driver=cdc_mbim
+I:* If#= 9 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=02 Driver=cdc_mbim
+E:  Ad=8e(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
+E:  Ad=0f(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
+I:* If#=12 Alt= 0 #EPs= 1 Cls=ff(vend.) Sub=ff Prot=70 Driver=(none)
+E:  Ad=89(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
+
+Signed-off-by: Yonglin Tan <yonglin.tan@outlook.com>
+[ johan: mention QDSS port and sort entries ]
+Cc: stable@vger.kernel.org
+Signed-off-by: Johan Hovold <johan@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/usb/serial/option.c |    4 ++++
+ 1 file changed, 4 insertions(+)
+
+--- a/drivers/usb/serial/option.c
++++ b/drivers/usb/serial/option.c
+@@ -253,6 +253,7 @@ static void option_instat_callback(struc
+ #define QUECTEL_PRODUCT_BG96                  0x0296
+ #define QUECTEL_PRODUCT_EP06                  0x0306
+ #define QUECTEL_PRODUCT_EM05G                 0x030a
++#define QUECTEL_PRODUCT_EM060K                        0x030b
+ #define QUECTEL_PRODUCT_EM12                  0x0512
+ #define QUECTEL_PRODUCT_RM500Q                        0x0800
+ #define QUECTEL_PRODUCT_EC200S_CN             0x6002
+@@ -1142,6 +1143,9 @@ static const struct usb_device_id option
+       { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EP06, 0xff, 0, 0) },
+       { USB_DEVICE_INTERFACE_CLASS(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EM05G, 0xff),
+         .driver_info = RSVD(6) | ZLP },
++      { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EM060K, 0xff, 0x00, 0x40) },
++      { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EM060K, 0xff, 0xff, 0x30) },
++      { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EM060K, 0xff, 0xff, 0x40) },
+       { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EM12, 0xff, 0xff, 0xff),
+         .driver_info = RSVD(1) | RSVD(2) | RSVD(3) | RSVD(4) | NUMEP2 },
+       { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EM12, 0xff, 0, 0) },
diff --git a/queue-5.4/usb-serial-option-add-support-for-cinterion-mv32-wa-wb-rmnet-mode.patch b/queue-5.4/usb-serial-option-add-support-for-cinterion-mv32-wa-wb-rmnet-mode.patch
new file mode 100644 (file)
index 0000000..f9088a3
--- /dev/null
@@ -0,0 +1,70 @@
+From 8ffe20d08f2c95d702c453020d03a4c568a988f0 Mon Sep 17 00:00:00 2001
+From: Slark Xiao <slark_xiao@163.com>
+Date: Wed, 10 Aug 2022 11:30:50 +0800
+Subject: USB: serial: option: add support for Cinterion MV32-WA/WB RmNet mode
+
+From: Slark Xiao <slark_xiao@163.com>
+
+commit 8ffe20d08f2c95d702c453020d03a4c568a988f0 upstream.
+
+We added PIDs for MV32-WA/WB MBIM mode before, now we need to add
+support for RmNet mode.
+
+Test evidence as below:
+T:  Bus=03 Lev=01 Prnt=01 Port=02 Cnt=03 Dev#=  3 Spd=480 MxCh= 0
+D:  Ver= 2.10 Cls=ef(misc ) Sub=02 Prot=01 MxPS=64 #Cfgs=  1
+P:  Vendor=1e2d ProdID=00f3 Rev=05.04
+S:  Manufacturer=Cinterion
+S:  Product=Cinterion PID 0x00F3 USB Mobile Broadband
+S:  SerialNumber=d7b4be8d
+C:  #Ifs= 4 Cfg#= 1 Atr=a0 MxPwr=500mA
+I:  If#=0x0 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=50 Driver=qmi_wwan
+I:  If#=0x1 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option
+I:  If#=0x2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option
+I:  If#=0x3 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=30 Driver=option
+
+T:  Bus=03 Lev=01 Prnt=01 Port=02 Cnt=03 Dev#= 10 Spd=480 MxCh= 0
+D:  Ver= 2.10 Cls=ef(misc ) Sub=02 Prot=01 MxPS=64 #Cfgs=  1
+P:  Vendor=1e2d ProdID=00f4 Rev=05.04
+S:  Manufacturer=Cinterion
+S:  Product=Cinterion PID 0x00F4 USB Mobile Broadband
+S:  SerialNumber=d095087d
+C:  #Ifs= 4 Cfg#= 1 Atr=a0 MxPwr=500mA
+I:  If#=0x0 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=50 Driver=qmi_wwan
+I:  If#=0x1 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option
+I:  If#=0x2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option
+I:  If#=0x3 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=30 Driver=option
+
+Signed-off-by: Slark Xiao <slark_xiao@163.com>
+[ johan: sort entries ]
+Cc: stable@vger.kernel.org
+Signed-off-by: Johan Hovold <johan@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/usb/serial/option.c |    6 ++++++
+ 1 file changed, 6 insertions(+)
+
+--- a/drivers/usb/serial/option.c
++++ b/drivers/usb/serial/option.c
+@@ -439,6 +439,8 @@ static void option_instat_callback(struc
+ #define CINTERION_PRODUCT_MV31_2_RMNET                0x00b9
+ #define CINTERION_PRODUCT_MV32_WA             0x00f1
+ #define CINTERION_PRODUCT_MV32_WB             0x00f2
++#define CINTERION_PRODUCT_MV32_WA_RMNET               0x00f3
++#define CINTERION_PRODUCT_MV32_WB_RMNET               0x00f4
+ /* Olivetti products */
+ #define OLIVETTI_VENDOR_ID                    0x0b3c
+@@ -2001,8 +2003,12 @@ static const struct usb_device_id option
+         .driver_info = RSVD(0)},
+       { USB_DEVICE_INTERFACE_CLASS(CINTERION_VENDOR_ID, CINTERION_PRODUCT_MV32_WA, 0xff),
+         .driver_info = RSVD(3)},
++      { USB_DEVICE_INTERFACE_CLASS(CINTERION_VENDOR_ID, CINTERION_PRODUCT_MV32_WA_RMNET, 0xff),
++        .driver_info = RSVD(0) },
+       { USB_DEVICE_INTERFACE_CLASS(CINTERION_VENDOR_ID, CINTERION_PRODUCT_MV32_WB, 0xff),
+         .driver_info = RSVD(3)},
++      { USB_DEVICE_INTERFACE_CLASS(CINTERION_VENDOR_ID, CINTERION_PRODUCT_MV32_WB_RMNET, 0xff),
++        .driver_info = RSVD(0) },
+       { USB_DEVICE(OLIVETTI_VENDOR_ID, OLIVETTI_PRODUCT_OLICARD100),
+         .driver_info = RSVD(4) },
+       { USB_DEVICE(OLIVETTI_VENDOR_ID, OLIVETTI_PRODUCT_OLICARD120),
diff --git a/queue-5.4/usb-serial-option-add-support-for-oppo-r11-diag-port.patch b/queue-5.4/usb-serial-option-add-support-for-oppo-r11-diag-port.patch
new file mode 100644 (file)
index 0000000..4826d7d
--- /dev/null
@@ -0,0 +1,54 @@
+From 8d5fc280392735e4441b35de14f2f4860fa8d83c Mon Sep 17 00:00:00 2001
+From: Yan Xinyu <sdlyyxy@bupt.edu.cn>
+Date: Thu, 14 Jul 2022 18:20:37 +0800
+Subject: USB: serial: option: add support for OPPO R11 diag port
+
+From: Yan Xinyu <sdlyyxy@bupt.edu.cn>
+
+commit 8d5fc280392735e4441b35de14f2f4860fa8d83c upstream.
+
+Add support for OPPO R11 USB diag serial port to option driver. This
+phone uses Qualcomm Snapdragon 660 SoC.
+
+usb-devices output:
+T:  Bus=03 Lev=01 Prnt=01 Port=01 Cnt=01 Dev#= 10 Spd=480 MxCh= 0
+D:  Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
+P:  Vendor=22d9 ProdID=276c Rev=04.04
+S:  Manufacturer=OPPO
+S:  Product=SDM660-MTP _SN:09C6BCA7
+S:  SerialNumber=beb2c403
+C:  #Ifs= 2 Cfg#= 1 Atr=80 MxPwr=500mA
+I:  If#=0x0 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=30 Driver=option
+I:  If#=0x1 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=42 Prot=01 Driver=usbfs
+
+Signed-off-by: Yan Xinyu <sdlyyxy@bupt.edu.cn>
+Link: https://lore.kernel.org/r/20220714102037.4113889-1-sdlyyxy@bupt.edu.cn
+Link: https://lore.kernel.org/r/Yt1WfSZk03Plpnan@hovoldconsulting.com
+Cc: stable@vger.kernel.org
+Signed-off-by: Johan Hovold <johan@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/usb/serial/option.c |    5 +++++
+ 1 file changed, 5 insertions(+)
+
+--- a/drivers/usb/serial/option.c
++++ b/drivers/usb/serial/option.c
+@@ -573,6 +573,10 @@ static void option_instat_callback(struc
+ #define WETELECOM_PRODUCT_6802                        0x6802
+ #define WETELECOM_PRODUCT_WMD300              0x6803
++/* OPPO products */
++#define OPPO_VENDOR_ID                                0x22d9
++#define OPPO_PRODUCT_R11                      0x276c
++
+ /* Device flags */
+@@ -2155,6 +2159,7 @@ static const struct usb_device_id option
+       { USB_DEVICE_INTERFACE_CLASS(0x305a, 0x1404, 0xff) },                   /* GosunCn GM500 RNDIS */
+       { USB_DEVICE_INTERFACE_CLASS(0x305a, 0x1405, 0xff) },                   /* GosunCn GM500 MBIM */
+       { USB_DEVICE_INTERFACE_CLASS(0x305a, 0x1406, 0xff) },                   /* GosunCn GM500 ECM/NCM */
++      { USB_DEVICE_AND_INTERFACE_INFO(OPPO_VENDOR_ID, OPPO_PRODUCT_R11, 0xff, 0xff, 0x30) },
+       { } /* Terminating entry */
+ };
+ MODULE_DEVICE_TABLE(usb, option_ids);
diff --git a/queue-5.4/usb-storage-add-ignore-residue-quirk-for-nxp-pn7462au.patch b/queue-5.4/usb-storage-add-ignore-residue-quirk-for-nxp-pn7462au.patch
new file mode 100644 (file)
index 0000000..cb3fbbd
--- /dev/null
@@ -0,0 +1,40 @@
+From 2aa48857ad52236a9564c71183d6cc8893becd41 Mon Sep 17 00:00:00 2001
+From: Witold Lipieta <witold.lipieta@thaumatec.com>
+Date: Tue, 9 Aug 2022 13:29:11 +0200
+Subject: usb-storage: Add ignore-residue quirk for NXP PN7462AU
+
+From: Witold Lipieta <witold.lipieta@thaumatec.com>
+
+commit 2aa48857ad52236a9564c71183d6cc8893becd41 upstream.
+
+This is USB mass storage primary boot loader for code download on
+NXP PN7462AU.
+
+Without the quirk it is impossible to write whole memory at once as
+device restarts during the write due to bogus residue values reported.
+
+Acked-by: Alan Stern <stern@rowland.harvard.edu>
+Cc: stable <stable@kernel.org>
+Signed-off-by: Witold Lipieta <witold.lipieta@thaumatec.com>
+Link: https://lore.kernel.org/r/20220809112911.462776-1-witold.lipieta@thaumatec.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/usb/storage/unusual_devs.h |    7 +++++++
+ 1 file changed, 7 insertions(+)
+
+--- a/drivers/usb/storage/unusual_devs.h
++++ b/drivers/usb/storage/unusual_devs.h
+@@ -2294,6 +2294,13 @@ UNUSUAL_DEV( 0x1e74, 0x4621, 0x0000, 0x0
+               USB_SC_DEVICE, USB_PR_DEVICE, NULL,
+               US_FL_BULK_IGNORE_TAG | US_FL_MAX_SECTORS_64 ),
++/* Reported by Witold Lipieta <witold.lipieta@thaumatec.com> */
++UNUSUAL_DEV( 0x1fc9, 0x0117, 0x0100, 0x0100,
++              "NXP Semiconductors",
++              "PN7462AU",
++              USB_SC_DEVICE, USB_PR_DEVICE, NULL,
++              US_FL_IGNORE_RESIDUE ),
++
+ /* Supplied with some Castlewood ORB removable drives */
+ UNUSUAL_DEV(  0x2027, 0xa001, 0x0000, 0x9999,
+               "Double-H Technology",
diff --git a/queue-5.4/usb-typec-altmodes-displayport-correct-pin-assignment-for-ufp-receptacles.patch b/queue-5.4/usb-typec-altmodes-displayport-correct-pin-assignment-for-ufp-receptacles.patch
new file mode 100644 (file)
index 0000000..17c7fa5
--- /dev/null
@@ -0,0 +1,74 @@
+From c1e5c2f0cb8a22ec2e14af92afc7006491bebabb Mon Sep 17 00:00:00 2001
+From: Pablo Sun <pablo.sun@mediatek.com>
+Date: Thu, 4 Aug 2022 11:48:03 +0800
+Subject: usb: typec: altmodes/displayport: correct pin assignment for UFP receptacles
+
+From: Pablo Sun <pablo.sun@mediatek.com>
+
+commit c1e5c2f0cb8a22ec2e14af92afc7006491bebabb upstream.
+
+Fix incorrect pin assignment values when connecting to a monitor with
+Type-C receptacle instead of a plug.
+
+According to specification, an UFP_D receptacle's pin assignment
+should came from the UFP_D pin assignments field (bit 23:16), while
+an UFP_D plug's assignments are described in the DFP_D pin assignments
+(bit 15:8) during Mode Discovery.
+
+For example the LG 27 UL850-W is a monitor with Type-C receptacle.
+The monitor responds to MODE DISCOVERY command with following
+DisplayPort Capability flag:
+
+        dp->alt->vdo=0x140045
+
+The existing logic only take cares of UPF_D plug case,
+and would take the bit 15:8 for this 0x140045 case.
+
+This results in an non-existing pin assignment 0x0 in
+dp_altmode_configure.
+
+To fix this problem a new set of macros are introduced
+to take plug/receptacle differences into consideration.
+
+Fixes: 0e3bb7d6894d ("usb: typec: Add driver for DisplayPort alternate mode")
+Cc: stable@vger.kernel.org
+Co-developed-by: Pablo Sun <pablo.sun@mediatek.com>
+Co-developed-by: Macpaul Lin <macpaul.lin@mediatek.com>
+Reviewed-by: Guillaume Ranquet <granquet@baylibre.com>
+Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
+Signed-off-by: Pablo Sun <pablo.sun@mediatek.com>
+Signed-off-by: Macpaul Lin <macpaul.lin@mediatek.com>
+Link: https://lore.kernel.org/r/20220804034803.19486-1-macpaul.lin@mediatek.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/usb/typec/altmodes/displayport.c |    4 ++--
+ include/linux/usb/typec_dp.h             |    5 +++++
+ 2 files changed, 7 insertions(+), 2 deletions(-)
+
+--- a/drivers/usb/typec/altmodes/displayport.c
++++ b/drivers/usb/typec/altmodes/displayport.c
+@@ -87,8 +87,8 @@ static int dp_altmode_configure(struct d
+       case DP_STATUS_CON_UFP_D:
+       case DP_STATUS_CON_BOTH: /* NOTE: First acting as DP source */
+               conf |= DP_CONF_UFP_U_AS_UFP_D;
+-              pin_assign = DP_CAP_DFP_D_PIN_ASSIGN(dp->alt->vdo) &
+-                           DP_CAP_UFP_D_PIN_ASSIGN(dp->port->vdo);
++              pin_assign = DP_CAP_PIN_ASSIGN_UFP_D(dp->alt->vdo) &
++                               DP_CAP_PIN_ASSIGN_DFP_D(dp->port->vdo);
+               break;
+       default:
+               break;
+--- a/include/linux/usb/typec_dp.h
++++ b/include/linux/usb/typec_dp.h
+@@ -73,6 +73,11 @@ enum {
+ #define DP_CAP_USB                    BIT(7)
+ #define DP_CAP_DFP_D_PIN_ASSIGN(_cap_)        (((_cap_) & GENMASK(15, 8)) >> 8)
+ #define DP_CAP_UFP_D_PIN_ASSIGN(_cap_)        (((_cap_) & GENMASK(23, 16)) >> 16)
++/* Get pin assignment taking plug & receptacle into consideration */
++#define DP_CAP_PIN_ASSIGN_UFP_D(_cap_) ((_cap_ & DP_CAP_RECEPTACLE) ? \
++                      DP_CAP_UFP_D_PIN_ASSIGN(_cap_) : DP_CAP_DFP_D_PIN_ASSIGN(_cap_))
++#define DP_CAP_PIN_ASSIGN_DFP_D(_cap_) ((_cap_ & DP_CAP_RECEPTACLE) ? \
++                      DP_CAP_DFP_D_PIN_ASSIGN(_cap_) : DP_CAP_UFP_D_PIN_ASSIGN(_cap_))
+ /* DisplayPort Status Update VDO bits */
+ #define DP_STATUS_CONNECTION(_status_)        ((_status_) & 3)