From: Greg Kroah-Hartman Date: Sun, 9 Mar 2025 20:31:27 +0000 (+0100) Subject: 5.15-stable patches X-Git-Tag: v5.4.291~85 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=14efaa9d61184963bd00697430ad5a64324945bc;p=thirdparty%2Fkernel%2Fstable-queue.git 5.15-stable patches added patches: kbuild-userprogs-use-correct-lld-when-linking-through-clang.patch revert-drivers-card_reader-rtsx_usb-restore-interrupt-based-detection.patch usb-atm-cxacru-fix-a-flaw-in-existing-endpoint-checks.patch usb-dwc3-gadget-prevent-irq-storm-when-th-re-executes.patch usb-dwc3-set-suspendenable-soon-after-phy-init.patch usb-gadget-check-bmattributes-only-if-configuration-is-valid.patch usb-gadget-fix-setting-self-powered-state-on-suspend.patch usb-gadget-set-self-powered-based-on-maxpower-and-bmattributes.patch usb-hub-lack-of-clearing-xhc-resources.patch usb-quirks-add-delay_init-and-no_lpm-for-prolific-mass-storage-card-reader.patch usb-renesas_usbhs-call-clk_put.patch usb-renesas_usbhs-flush-the-notify_hotplug_work.patch usb-renesas_usbhs-use-devm_usb_get_phy.patch usb-typec-tcpci_rt1711h-unmask-alert-interrupts-to-fix-functionality.patch usb-typec-ucsi-increase-timeout-for-ppm-reset-operations.patch --- diff --git a/queue-5.15/kbuild-userprogs-use-correct-lld-when-linking-through-clang.patch b/queue-5.15/kbuild-userprogs-use-correct-lld-when-linking-through-clang.patch new file mode 100644 index 0000000000..1d62655da9 --- /dev/null +++ b/queue-5.15/kbuild-userprogs-use-correct-lld-when-linking-through-clang.patch @@ -0,0 +1,50 @@ +From dfc1b168a8c4b376fa222b27b97c2c4ad4b786e1 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Thomas=20Wei=C3=9Fschuh?= +Date: Mon, 17 Feb 2025 08:27:54 +0100 +Subject: kbuild: userprogs: use correct lld when linking through clang +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Thomas Weißschuh + +commit dfc1b168a8c4b376fa222b27b97c2c4ad4b786e1 upstream. + +The userprog infrastructure links objects files through $(CC). +Either explicitly by manually calling $(CC) on multiple object files or +implicitly by directly compiling a source file to an executable. +The documentation at Documentation/kbuild/llvm.rst indicates that ld.lld +would be used for linking if LLVM=1 is specified. +However clang instead will use either a globally installed cross linker +from $PATH called ${target}-ld or fall back to the system linker, which +probably does not support crosslinking. +For the normal kernel build this is not an issue because the linker is +always executed directly, without the compiler being involved. + +Explicitly pass --ld-path to clang so $(LD) is respected. +As clang 13.0.1 is required to build the kernel, this option is available. + +Fixes: 7f3a59db274c ("kbuild: add infrastructure to build userspace programs") +Cc: stable@vger.kernel.org # needs wrapping in $(cc-option) for < 6.9 +Signed-off-by: Thomas Weißschuh +Reviewed-by: Nathan Chancellor +Signed-off-by: Masahiro Yamada +Signed-off-by: Greg Kroah-Hartman +--- + Makefile | 5 +++++ + 1 file changed, 5 insertions(+) + +--- a/Makefile ++++ b/Makefile +@@ -1114,6 +1114,11 @@ endif + KBUILD_USERCFLAGS += $(filter -m32 -m64 --target=%, $(KBUILD_CFLAGS)) + KBUILD_USERLDFLAGS += $(filter -m32 -m64 --target=%, $(KBUILD_CFLAGS)) + ++# userspace programs are linked via the compiler, use the correct linker ++ifeq ($(CONFIG_CC_IS_CLANG)$(CONFIG_LD_IS_LLD),yy) ++KBUILD_USERLDFLAGS += --ld-path=$(LD) ++endif ++ + # make the checker run with the right architecture + CHECKFLAGS += --arch=$(ARCH) + diff --git a/queue-5.15/revert-drivers-card_reader-rtsx_usb-restore-interrupt-based-detection.patch b/queue-5.15/revert-drivers-card_reader-rtsx_usb-restore-interrupt-based-detection.patch new file mode 100644 index 0000000000..2685345d88 --- /dev/null +++ b/queue-5.15/revert-drivers-card_reader-rtsx_usb-restore-interrupt-based-detection.patch @@ -0,0 +1,59 @@ +From 2397d61ee45cddb8f3bd3a3a9840ef0f0b5aa843 Mon Sep 17 00:00:00 2001 +From: Christian Heusel +Date: Mon, 24 Feb 2025 09:32:59 +0100 +Subject: Revert "drivers/card_reader/rtsx_usb: Restore interrupt based detection" + +From: Christian Heusel + +commit 2397d61ee45cddb8f3bd3a3a9840ef0f0b5aa843 upstream. + +This reverts commit 235b630eda072d7e7b102ab346d6b8a2c028a772. + +This commit was found responsible for issues with SD card recognition, +as users had to re-insert their cards in the readers and wait for a +while. As for some people the SD card was involved in the boot process +it also caused boot failures. + +Cc: stable@vger.kernel.org +Link: https://bbs.archlinux.org/viewtopic.php?id=303321 +Fixes: 235b630eda07 ("drivers/card_reader/rtsx_usb: Restore interrupt based detection") +Reported-by: qf +Closes: https://lore.kernel.org/all/1de87dfa-1e81-45b7-8dcb-ad86c21d5352@heusel.eu +Signed-off-by: Christian Heusel +Link: https://lore.kernel.org/r/20250224-revert-sdcard-patch-v1-1-d1a457fbb796@heusel.eu +Signed-off-by: Greg Kroah-Hartman +--- + drivers/misc/cardreader/rtsx_usb.c | 15 --------------- + 1 file changed, 15 deletions(-) + +--- a/drivers/misc/cardreader/rtsx_usb.c ++++ b/drivers/misc/cardreader/rtsx_usb.c +@@ -286,7 +286,6 @@ static int rtsx_usb_get_status_with_bulk + int rtsx_usb_get_card_status(struct rtsx_ucr *ucr, u16 *status) + { + int ret; +- u8 interrupt_val = 0; + u16 *buf; + + if (!status) +@@ -309,20 +308,6 @@ int rtsx_usb_get_card_status(struct rtsx + ret = rtsx_usb_get_status_with_bulk(ucr, status); + } + +- rtsx_usb_read_register(ucr, CARD_INT_PEND, &interrupt_val); +- /* Cross check presence with interrupts */ +- if (*status & XD_CD) +- if (!(interrupt_val & XD_INT)) +- *status &= ~XD_CD; +- +- if (*status & SD_CD) +- if (!(interrupt_val & SD_INT)) +- *status &= ~SD_CD; +- +- if (*status & MS_CD) +- if (!(interrupt_val & MS_INT)) +- *status &= ~MS_CD; +- + /* usb_control_msg may return positive when success */ + if (ret < 0) + return ret; diff --git a/queue-5.15/series b/queue-5.15/series index 5720c492c6..a8bb042b4b 100644 --- a/queue-5.15/series +++ b/queue-5.15/series @@ -588,3 +588,18 @@ fs-pipe-fix-pipe_occupancy-with-16-bit-indexes.patch net-ipv6-fix-dst-ref-loop-in-ila-lwtunnel.patch net-ipv6-fix-missing-dst-ref-drop-in-ila-lwtunnel.patch gpio-rcar-fix-missing-of_node_put-call.patch +revert-drivers-card_reader-rtsx_usb-restore-interrupt-based-detection.patch +usb-renesas_usbhs-call-clk_put.patch +usb-renesas_usbhs-use-devm_usb_get_phy.patch +usb-hub-lack-of-clearing-xhc-resources.patch +usb-quirks-add-delay_init-and-no_lpm-for-prolific-mass-storage-card-reader.patch +usb-renesas_usbhs-flush-the-notify_hotplug_work.patch +usb-atm-cxacru-fix-a-flaw-in-existing-endpoint-checks.patch +usb-dwc3-set-suspendenable-soon-after-phy-init.patch +usb-dwc3-gadget-prevent-irq-storm-when-th-re-executes.patch +usb-typec-ucsi-increase-timeout-for-ppm-reset-operations.patch +usb-typec-tcpci_rt1711h-unmask-alert-interrupts-to-fix-functionality.patch +usb-gadget-set-self-powered-based-on-maxpower-and-bmattributes.patch +usb-gadget-fix-setting-self-powered-state-on-suspend.patch +usb-gadget-check-bmattributes-only-if-configuration-is-valid.patch +kbuild-userprogs-use-correct-lld-when-linking-through-clang.patch diff --git a/queue-5.15/usb-atm-cxacru-fix-a-flaw-in-existing-endpoint-checks.patch b/queue-5.15/usb-atm-cxacru-fix-a-flaw-in-existing-endpoint-checks.patch new file mode 100644 index 0000000000..8364b6c7ba --- /dev/null +++ b/queue-5.15/usb-atm-cxacru-fix-a-flaw-in-existing-endpoint-checks.patch @@ -0,0 +1,83 @@ +From c90aad369899a607cfbc002bebeafd51e31900cd Mon Sep 17 00:00:00 2001 +From: Nikita Zhandarovich +Date: Thu, 13 Feb 2025 15:22:57 +0300 +Subject: usb: atm: cxacru: fix a flaw in existing endpoint checks + +From: Nikita Zhandarovich + +commit c90aad369899a607cfbc002bebeafd51e31900cd upstream. + +Syzbot once again identified a flaw in usb endpoint checking, see [1]. +This time the issue stems from a commit authored by me (2eabb655a968 +("usb: atm: cxacru: fix endpoint checking in cxacru_bind()")). + +While using usb_find_common_endpoints() may usually be enough to +discard devices with wrong endpoints, in this case one needs more +than just finding and identifying the sufficient number of endpoints +of correct types - one needs to check the endpoint's address as well. + +Since cxacru_bind() fills URBs with CXACRU_EP_CMD address in mind, +switch the endpoint verification approach to usb_check_XXX_endpoints() +instead to fix incomplete ep testing. + +[1] Syzbot report: +usb 5-1: BOGUS urb xfer, pipe 3 != type 1 +WARNING: CPU: 0 PID: 1378 at drivers/usb/core/urb.c:504 usb_submit_urb+0xc4e/0x18c0 drivers/usb/core/urb.c:503 +... +RIP: 0010:usb_submit_urb+0xc4e/0x18c0 drivers/usb/core/urb.c:503 +... +Call Trace: + + cxacru_cm+0x3c8/0xe50 drivers/usb/atm/cxacru.c:649 + cxacru_card_status drivers/usb/atm/cxacru.c:760 [inline] + cxacru_bind+0xcf9/0x1150 drivers/usb/atm/cxacru.c:1223 + usbatm_usb_probe+0x314/0x1d30 drivers/usb/atm/usbatm.c:1058 + cxacru_usb_probe+0x184/0x220 drivers/usb/atm/cxacru.c:1377 + usb_probe_interface+0x641/0xbb0 drivers/usb/core/driver.c:396 + really_probe+0x2b9/0xad0 drivers/base/dd.c:658 + __driver_probe_device+0x1a2/0x390 drivers/base/dd.c:800 + driver_probe_device+0x50/0x430 drivers/base/dd.c:830 +... + +Reported-and-tested-by: syzbot+ccbbc229a024fa3e13b5@syzkaller.appspotmail.com +Closes: https://syzkaller.appspot.com/bug?extid=ccbbc229a024fa3e13b5 +Fixes: 2eabb655a968 ("usb: atm: cxacru: fix endpoint checking in cxacru_bind()") +Cc: stable@kernel.org +Signed-off-by: Nikita Zhandarovich +Link: https://lore.kernel.org/r/20250213122259.730772-1-n.zhandarovich@fintech.ru +Signed-off-by: Greg Kroah-Hartman +--- + drivers/usb/atm/cxacru.c | 13 +++++++------ + 1 file changed, 7 insertions(+), 6 deletions(-) + +--- a/drivers/usb/atm/cxacru.c ++++ b/drivers/usb/atm/cxacru.c +@@ -1131,7 +1131,10 @@ static int cxacru_bind(struct usbatm_dat + struct cxacru_data *instance; + struct usb_device *usb_dev = interface_to_usbdev(intf); + struct usb_host_endpoint *cmd_ep = usb_dev->ep_in[CXACRU_EP_CMD]; +- struct usb_endpoint_descriptor *in, *out; ++ static const u8 ep_addrs[] = { ++ CXACRU_EP_CMD + USB_DIR_IN, ++ CXACRU_EP_CMD + USB_DIR_OUT, ++ 0}; + int ret; + + /* instance init */ +@@ -1179,13 +1182,11 @@ static int cxacru_bind(struct usbatm_dat + } + + if (usb_endpoint_xfer_int(&cmd_ep->desc)) +- ret = usb_find_common_endpoints(intf->cur_altsetting, +- NULL, NULL, &in, &out); ++ ret = usb_check_int_endpoints(intf, ep_addrs); + else +- ret = usb_find_common_endpoints(intf->cur_altsetting, +- &in, &out, NULL, NULL); ++ ret = usb_check_bulk_endpoints(intf, ep_addrs); + +- if (ret) { ++ if (!ret) { + usb_err(usbatm_instance, "cxacru_bind: interface has incorrect endpoints\n"); + ret = -ENODEV; + goto fail; diff --git a/queue-5.15/usb-dwc3-gadget-prevent-irq-storm-when-th-re-executes.patch b/queue-5.15/usb-dwc3-gadget-prevent-irq-storm-when-th-re-executes.patch new file mode 100644 index 0000000000..32719f35df --- /dev/null +++ b/queue-5.15/usb-dwc3-gadget-prevent-irq-storm-when-th-re-executes.patch @@ -0,0 +1,112 @@ +From 69c58deec19628c8a686030102176484eb94fed4 Mon Sep 17 00:00:00 2001 +From: Badhri Jagan Sridharan +Date: Sun, 16 Feb 2025 22:30:02 +0000 +Subject: usb: dwc3: gadget: Prevent irq storm when TH re-executes + +From: Badhri Jagan Sridharan + +commit 69c58deec19628c8a686030102176484eb94fed4 upstream. + +While commit d325a1de49d6 ("usb: dwc3: gadget: Prevent losing events in +event cache") makes sure that top half(TH) does not end up overwriting the +cached events before processing them when the TH gets invoked more than one +time, returning IRQ_HANDLED results in occasional irq storm where the TH +hogs the CPU. The irq storm can be prevented by the flag before event +handler busy is cleared. Default enable interrupt moderation in all +versions which support them. + +ftrace event stub during dwc3 irq storm: + irq/504_dwc3-1111 ( 1111) [000] .... 70.000866: irq_handler_exit: irq=14 ret=handled + irq/504_dwc3-1111 ( 1111) [000] .... 70.000872: irq_handler_entry: irq=504 name=dwc3 + irq/504_dwc3-1111 ( 1111) [000] .... 70.000874: irq_handler_exit: irq=504 ret=handled + irq/504_dwc3-1111 ( 1111) [000] .... 70.000881: irq_handler_entry: irq=504 name=dwc3 + irq/504_dwc3-1111 ( 1111) [000] .... 70.000883: irq_handler_exit: irq=504 ret=handled + irq/504_dwc3-1111 ( 1111) [000] .... 70.000889: irq_handler_entry: irq=504 name=dwc3 + irq/504_dwc3-1111 ( 1111) [000] .... 70.000892: irq_handler_exit: irq=504 ret=handled + irq/504_dwc3-1111 ( 1111) [000] .... 70.000898: irq_handler_entry: irq=504 name=dwc3 + irq/504_dwc3-1111 ( 1111) [000] .... 70.000901: irq_handler_exit: irq=504 ret=handled + irq/504_dwc3-1111 ( 1111) [000] .... 70.000907: irq_handler_entry: irq=504 name=dwc3 + irq/504_dwc3-1111 ( 1111) [000] .... 70.000909: irq_handler_exit: irq=504 ret=handled + irq/504_dwc3-1111 ( 1111) [000] .... 70.000915: irq_handler_entry: irq=504 name=dwc3 + irq/504_dwc3-1111 ( 1111) [000] .... 70.000918: irq_handler_exit: irq=504 ret=handled + irq/504_dwc3-1111 ( 1111) [000] .... 70.000924: irq_handler_entry: irq=504 name=dwc3 + irq/504_dwc3-1111 ( 1111) [000] .... 70.000927: irq_handler_exit: irq=504 ret=handled + irq/504_dwc3-1111 ( 1111) [000] .... 70.000933: irq_handler_entry: irq=504 name=dwc3 + irq/504_dwc3-1111 ( 1111) [000] .... 70.000935: irq_handler_exit: irq=504 ret=handled + .... + +Cc: stable +Suggested-by: Thinh Nguyen +Fixes: d325a1de49d6 ("usb: dwc3: gadget: Prevent losing events in event cache") +Signed-off-by: Badhri Jagan Sridharan +Acked-by: Thinh Nguyen +Link: https://lore.kernel.org/r/20250216223003.3568039-1-badhri@google.com +Signed-off-by: Greg Kroah-Hartman +--- + drivers/usb/dwc3/core.c | 16 ++++++---------- + drivers/usb/dwc3/gadget.c | 10 +++++++--- + 2 files changed, 13 insertions(+), 13 deletions(-) + +--- a/drivers/usb/dwc3/core.c ++++ b/drivers/usb/dwc3/core.c +@@ -1456,8 +1456,6 @@ static void dwc3_get_properties(struct d + dwc->tx_thr_num_pkt_prd = tx_thr_num_pkt_prd; + dwc->tx_max_burst_prd = tx_max_burst_prd; + +- dwc->imod_interval = 0; +- + dwc->tx_fifo_resize_max_num = tx_fifo_resize_max_num; + } + +@@ -1475,21 +1473,19 @@ static void dwc3_check_params(struct dwc + unsigned int hwparam_gen = + DWC3_GHWPARAMS3_SSPHY_IFC(dwc->hwparams.hwparams3); + +- /* Check for proper value of imod_interval */ +- if (dwc->imod_interval && !dwc3_has_imod(dwc)) { +- dev_warn(dwc->dev, "Interrupt moderation not supported\n"); +- dwc->imod_interval = 0; +- } +- + /* ++ * Enable IMOD for all supporting controllers. ++ * ++ * Particularly, DWC_usb3 v3.00a must enable this feature for ++ * the following reason: ++ * + * Workaround for STAR 9000961433 which affects only version + * 3.00a of the DWC_usb3 core. This prevents the controller + * interrupt from being masked while handling events. IMOD + * allows us to work around this issue. Enable it for the + * affected version. + */ +- if (!dwc->imod_interval && +- DWC3_VER_IS(DWC3, 300A)) ++ if (dwc3_has_imod((dwc))) + dwc->imod_interval = 1; + + /* Check the maximum_speed parameter */ +--- a/drivers/usb/dwc3/gadget.c ++++ b/drivers/usb/dwc3/gadget.c +@@ -4297,14 +4297,18 @@ static irqreturn_t dwc3_process_event_bu + reg &= ~DWC3_GEVNTSIZ_INTMASK; + dwc3_writel(dwc->regs, DWC3_GEVNTSIZ(0), reg); + ++ evt->flags &= ~DWC3_EVENT_PENDING; ++ /* ++ * Add an explicit write memory barrier to make sure that the update of ++ * clearing DWC3_EVENT_PENDING is observed in dwc3_check_event_buf() ++ */ ++ wmb(); ++ + if (dwc->imod_interval) { + dwc3_writel(dwc->regs, DWC3_GEVNTCOUNT(0), DWC3_GEVNTCOUNT_EHB); + dwc3_writel(dwc->regs, DWC3_DEV_IMOD(0), dwc->imod_interval); + } + +- /* Keep the clearing of DWC3_EVENT_PENDING at the end */ +- evt->flags &= ~DWC3_EVENT_PENDING; +- + return ret; + } + diff --git a/queue-5.15/usb-dwc3-set-suspendenable-soon-after-phy-init.patch b/queue-5.15/usb-dwc3-set-suspendenable-soon-after-phy-init.patch new file mode 100644 index 0000000000..636721925c --- /dev/null +++ b/queue-5.15/usb-dwc3-set-suspendenable-soon-after-phy-init.patch @@ -0,0 +1,213 @@ +From cc5bfc4e16fc1d1c520cd7bb28646e82b6e69217 Mon Sep 17 00:00:00 2001 +From: Thinh Nguyen +Date: Thu, 30 Jan 2025 23:49:31 +0000 +Subject: usb: dwc3: Set SUSPENDENABLE soon after phy init + +From: Thinh Nguyen + +commit cc5bfc4e16fc1d1c520cd7bb28646e82b6e69217 upstream. + +After phy initialization, some phy operations can only be executed while +in lower P states. Ensure GUSB3PIPECTL.SUSPENDENABLE and +GUSB2PHYCFG.SUSPHY are set soon after initialization to avoid blocking +phy ops. + +Previously the SUSPENDENABLE bits are only set after the controller +initialization, which may not happen right away if there's no gadget +driver or xhci driver bound. Revise this to clear SUSPENDENABLE bits +only when there's mode switching (change in GCTL.PRTCAPDIR). + +Fixes: 6d735722063a ("usb: dwc3: core: Prevent phy suspend during init") +Cc: stable +Signed-off-by: Thinh Nguyen +Link: https://lore.kernel.org/r/633aef0afee7d56d2316f7cc3e1b2a6d518a8cc9.1738280911.git.Thinh.Nguyen@synopsys.com +Signed-off-by: Greg Kroah-Hartman +--- + drivers/usb/dwc3/core.c | 69 +++++++++++++++++++++++++++++------------------- + drivers/usb/dwc3/core.h | 2 - + drivers/usb/dwc3/drd.c | 4 +- + 3 files changed, 45 insertions(+), 30 deletions(-) + +--- a/drivers/usb/dwc3/core.c ++++ b/drivers/usb/dwc3/core.c +@@ -123,11 +123,24 @@ void dwc3_enable_susphy(struct dwc3 *dwc + dwc3_writel(dwc->regs, DWC3_GUSB2PHYCFG(0), reg); + } + +-void dwc3_set_prtcap(struct dwc3 *dwc, u32 mode) ++void dwc3_set_prtcap(struct dwc3 *dwc, u32 mode, bool ignore_susphy) + { ++ unsigned int hw_mode; + u32 reg; + + reg = dwc3_readl(dwc->regs, DWC3_GCTL); ++ ++ /* ++ * For DRD controllers, GUSB3PIPECTL.SUSPENDENABLE and ++ * GUSB2PHYCFG.SUSPHY should be cleared during mode switching, ++ * and they can be set after core initialization. ++ */ ++ hw_mode = DWC3_GHWPARAMS0_MODE(dwc->hwparams.hwparams0); ++ if (hw_mode == DWC3_GHWPARAMS0_MODE_DRD && !ignore_susphy) { ++ if (DWC3_GCTL_PRTCAP(reg) != mode) ++ dwc3_enable_susphy(dwc, false); ++ } ++ + reg &= ~(DWC3_GCTL_PRTCAPDIR(DWC3_GCTL_PRTCAP_OTG)); + reg |= DWC3_GCTL_PRTCAPDIR(mode); + dwc3_writel(dwc->regs, DWC3_GCTL, reg); +@@ -207,7 +220,7 @@ static void __dwc3_set_mode(struct work_ + + spin_lock_irqsave(&dwc->lock, flags); + +- dwc3_set_prtcap(dwc, desired_dr_role); ++ dwc3_set_prtcap(dwc, desired_dr_role, false); + + spin_unlock_irqrestore(&dwc->lock, flags); + +@@ -651,16 +664,7 @@ static int dwc3_phy_setup(struct dwc3 *d + */ + reg &= ~DWC3_GUSB3PIPECTL_UX_EXIT_PX; + +- /* +- * Above DWC_usb3.0 1.94a, it is recommended to set +- * DWC3_GUSB3PIPECTL_SUSPHY to '0' during coreConsultant configuration. +- * So default value will be '0' when the core is reset. Application +- * needs to set it to '1' after the core initialization is completed. +- * +- * Similarly for DRD controllers, GUSB3PIPECTL.SUSPENDENABLE must be +- * cleared after power-on reset, and it can be set after core +- * initialization. +- */ ++ /* Ensure the GUSB3PIPECTL.SUSPENDENABLE is cleared prior to phy init. */ + reg &= ~DWC3_GUSB3PIPECTL_SUSPHY; + + if (dwc->u2ss_inp3_quirk) +@@ -733,15 +737,7 @@ static int dwc3_phy_setup(struct dwc3 *d + break; + } + +- /* +- * Above DWC_usb3.0 1.94a, it is recommended to set +- * DWC3_GUSB2PHYCFG_SUSPHY to '0' during coreConsultant configuration. +- * So default value will be '0' when the core is reset. Application +- * needs to set it to '1' after the core initialization is completed. +- * +- * Similarly for DRD controllers, GUSB2PHYCFG.SUSPHY must be cleared +- * after power-on reset, and it can be set after core initialization. +- */ ++ /* Ensure the GUSB2PHYCFG.SUSPHY is cleared prior to phy init. */ + reg &= ~DWC3_GUSB2PHYCFG_SUSPHY; + + if (dwc->dis_enblslpm_quirk) +@@ -1158,6 +1154,25 @@ static int dwc3_core_init(struct dwc3 *d + } + } + ++ /* ++ * Above DWC_usb3.0 1.94a, it is recommended to set ++ * DWC3_GUSB3PIPECTL_SUSPHY and DWC3_GUSB2PHYCFG_SUSPHY to '0' during ++ * coreConsultant configuration. So default value will be '0' when the ++ * core is reset. Application needs to set it to '1' after the core ++ * initialization is completed. ++ * ++ * Certain phy requires to be in P0 power state during initialization. ++ * Make sure GUSB3PIPECTL.SUSPENDENABLE and GUSB2PHYCFG.SUSPHY are clear ++ * prior to phy init to maintain in the P0 state. ++ * ++ * After phy initialization, some phy operations can only be executed ++ * while in lower P states. Ensure GUSB3PIPECTL.SUSPENDENABLE and ++ * GUSB2PHYCFG.SUSPHY are set soon after initialization to avoid ++ * blocking phy ops. ++ */ ++ if (!DWC3_VER_IS_WITHIN(DWC3, ANY, 194A)) ++ dwc3_enable_susphy(dwc, true); ++ + return 0; + + err4: +@@ -1245,7 +1260,7 @@ static int dwc3_core_init_mode(struct dw + + switch (dwc->dr_mode) { + case USB_DR_MODE_PERIPHERAL: +- dwc3_set_prtcap(dwc, DWC3_GCTL_PRTCAP_DEVICE); ++ dwc3_set_prtcap(dwc, DWC3_GCTL_PRTCAP_DEVICE, false); + + if (dwc->usb2_phy) + otg_set_vbus(dwc->usb2_phy->otg, false); +@@ -1257,7 +1272,7 @@ static int dwc3_core_init_mode(struct dw + return dev_err_probe(dev, ret, "failed to initialize gadget\n"); + break; + case USB_DR_MODE_HOST: +- dwc3_set_prtcap(dwc, DWC3_GCTL_PRTCAP_HOST); ++ dwc3_set_prtcap(dwc, DWC3_GCTL_PRTCAP_HOST, false); + + if (dwc->usb2_phy) + otg_set_vbus(dwc->usb2_phy->otg, true); +@@ -1300,7 +1315,7 @@ static void dwc3_core_exit_mode(struct d + } + + /* de-assert DRVVBUS for HOST and OTG mode */ +- dwc3_set_prtcap(dwc, DWC3_GCTL_PRTCAP_DEVICE); ++ dwc3_set_prtcap(dwc, DWC3_GCTL_PRTCAP_DEVICE, true); + } + + static void dwc3_get_properties(struct dwc3 *dwc) +@@ -1882,7 +1897,7 @@ static int dwc3_resume_common(struct dwc + if (ret) + return ret; + +- dwc3_set_prtcap(dwc, DWC3_GCTL_PRTCAP_DEVICE); ++ dwc3_set_prtcap(dwc, DWC3_GCTL_PRTCAP_DEVICE, true); + dwc3_gadget_resume(dwc); + break; + case DWC3_GCTL_PRTCAP_HOST: +@@ -1890,7 +1905,7 @@ static int dwc3_resume_common(struct dwc + ret = dwc3_core_init_for_resume(dwc); + if (ret) + return ret; +- dwc3_set_prtcap(dwc, DWC3_GCTL_PRTCAP_HOST); ++ dwc3_set_prtcap(dwc, DWC3_GCTL_PRTCAP_HOST, true); + break; + } + /* Restore GUSB2PHYCFG bits that were modified in suspend */ +@@ -1915,7 +1930,7 @@ static int dwc3_resume_common(struct dwc + if (ret) + return ret; + +- dwc3_set_prtcap(dwc, dwc->current_dr_role); ++ dwc3_set_prtcap(dwc, dwc->current_dr_role, true); + + dwc3_otg_init(dwc); + if (dwc->current_otg_role == DWC3_OTG_ROLE_HOST) { +--- a/drivers/usb/dwc3/core.h ++++ b/drivers/usb/dwc3/core.h +@@ -1475,7 +1475,7 @@ struct dwc3_gadget_ep_cmd_params { + #define DWC3_HAS_OTG BIT(3) + + /* prototypes */ +-void dwc3_set_prtcap(struct dwc3 *dwc, u32 mode); ++void dwc3_set_prtcap(struct dwc3 *dwc, u32 mode, bool ignore_susphy); + void dwc3_set_mode(struct dwc3 *dwc, u32 mode); + u32 dwc3_core_fifo_space(struct dwc3_ep *dep, u8 type); + +--- a/drivers/usb/dwc3/drd.c ++++ b/drivers/usb/dwc3/drd.c +@@ -173,7 +173,7 @@ void dwc3_otg_init(struct dwc3 *dwc) + * block "Initialize GCTL for OTG operation". + */ + /* GCTL.PrtCapDir=2'b11 */ +- dwc3_set_prtcap(dwc, DWC3_GCTL_PRTCAP_OTG); ++ dwc3_set_prtcap(dwc, DWC3_GCTL_PRTCAP_OTG, true); + /* GUSB2PHYCFG0.SusPHY=0 */ + reg = dwc3_readl(dwc->regs, DWC3_GUSB2PHYCFG(0)); + reg &= ~DWC3_GUSB2PHYCFG_SUSPHY; +@@ -585,7 +585,7 @@ int dwc3_drd_init(struct dwc3 *dwc) + + dwc3_drd_update(dwc); + } else { +- dwc3_set_prtcap(dwc, DWC3_GCTL_PRTCAP_OTG); ++ dwc3_set_prtcap(dwc, DWC3_GCTL_PRTCAP_OTG, true); + + /* use OTG block to get ID event */ + irq = dwc3_otg_get_irq(dwc); diff --git a/queue-5.15/usb-gadget-check-bmattributes-only-if-configuration-is-valid.patch b/queue-5.15/usb-gadget-check-bmattributes-only-if-configuration-is-valid.patch new file mode 100644 index 0000000000..c8612d9e02 --- /dev/null +++ b/queue-5.15/usb-gadget-check-bmattributes-only-if-configuration-is-valid.patch @@ -0,0 +1,32 @@ +From 8e812e9355a6f14dffd54a33d951ca403b9732f5 Mon Sep 17 00:00:00 2001 +From: Prashanth K +Date: Mon, 24 Feb 2025 14:26:04 +0530 +Subject: usb: gadget: Check bmAttributes only if configuration is valid + +From: Prashanth K + +commit 8e812e9355a6f14dffd54a33d951ca403b9732f5 upstream. + +If the USB configuration is not valid, then avoid checking for +bmAttributes to prevent null pointer deference. + +Cc: stable +Fixes: 40e89ff5750f ("usb: gadget: Set self-powered based on MaxPower and bmAttributes") +Signed-off-by: Prashanth K +Link: https://lore.kernel.org/r/20250224085604.417327-1-prashanth.k@oss.qualcomm.com +Signed-off-by: Greg Kroah-Hartman +--- + drivers/usb/gadget/composite.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/usb/gadget/composite.c ++++ b/drivers/usb/gadget/composite.c +@@ -1005,7 +1005,7 @@ static int set_config(struct usb_composi + usb_gadget_set_remote_wakeup(gadget, 0); + done: + if (power > USB_SELF_POWER_VBUS_MAX_DRAW || +- !(c->bmAttributes & USB_CONFIG_ATT_SELFPOWER)) ++ (c && !(c->bmAttributes & USB_CONFIG_ATT_SELFPOWER))) + usb_gadget_clear_selfpowered(gadget); + else + usb_gadget_set_selfpowered(gadget); diff --git a/queue-5.15/usb-gadget-fix-setting-self-powered-state-on-suspend.patch b/queue-5.15/usb-gadget-fix-setting-self-powered-state-on-suspend.patch new file mode 100644 index 0000000000..5b3d0bf897 --- /dev/null +++ b/queue-5.15/usb-gadget-fix-setting-self-powered-state-on-suspend.patch @@ -0,0 +1,32 @@ +From c783e1258f29c5caac9eea0aea6b172870f1baf8 Mon Sep 17 00:00:00 2001 +From: Marek Szyprowski +Date: Thu, 20 Feb 2025 13:03:14 +0100 +Subject: usb: gadget: Fix setting self-powered state on suspend + +From: Marek Szyprowski + +commit c783e1258f29c5caac9eea0aea6b172870f1baf8 upstream. + +cdev->config might be NULL, so check it before dereferencing. + +CC: stable +Fixes: 40e89ff5750f ("usb: gadget: Set self-powered based on MaxPower and bmAttributes") +Signed-off-by: Marek Szyprowski +Link: https://lore.kernel.org/r/20250220120314.3614330-1-m.szyprowski@samsung.com +Signed-off-by: Greg Kroah-Hartman +--- + drivers/usb/gadget/composite.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +--- a/drivers/usb/gadget/composite.c ++++ b/drivers/usb/gadget/composite.c +@@ -2476,7 +2476,8 @@ void composite_suspend(struct usb_gadget + + cdev->suspended = 1; + +- if (cdev->config->bmAttributes & USB_CONFIG_ATT_SELFPOWER) ++ if (cdev->config && ++ cdev->config->bmAttributes & USB_CONFIG_ATT_SELFPOWER) + usb_gadget_set_selfpowered(gadget); + + usb_gadget_vbus_draw(gadget, 2); diff --git a/queue-5.15/usb-gadget-set-self-powered-based-on-maxpower-and-bmattributes.patch b/queue-5.15/usb-gadget-set-self-powered-based-on-maxpower-and-bmattributes.patch new file mode 100644 index 0000000000..98b06d8f21 --- /dev/null +++ b/queue-5.15/usb-gadget-set-self-powered-based-on-maxpower-and-bmattributes.patch @@ -0,0 +1,68 @@ +From 40e89ff5750fca2c1d6da93f98a2038716bba86c Mon Sep 17 00:00:00 2001 +From: Prashanth K +Date: Mon, 17 Feb 2025 17:33:28 +0530 +Subject: usb: gadget: Set self-powered based on MaxPower and bmAttributes + +From: Prashanth K + +commit 40e89ff5750fca2c1d6da93f98a2038716bba86c upstream. + +Currently the USB gadget will be set as bus-powered based solely +on whether its bMaxPower is greater than 100mA, but this may miss +devices that may legitimately draw less than 100mA but still want +to report as bus-powered. Similarly during suspend & resume, USB +gadget is incorrectly marked as bus/self powered without checking +the bmAttributes field. Fix these by configuring the USB gadget +as self or bus powered based on bmAttributes, and explicitly set +it as bus-powered if it draws more than 100mA. + +Cc: stable +Fixes: 5e5caf4fa8d3 ("usb: gadget: composite: Inform controller driver of self-powered") +Signed-off-by: Prashanth K +Link: https://lore.kernel.org/r/20250217120328.2446639-1-prashanth.k@oss.qualcomm.com +Signed-off-by: Greg Kroah-Hartman +--- + drivers/usb/gadget/composite.c | 16 +++++++++++----- + 1 file changed, 11 insertions(+), 5 deletions(-) + +--- a/drivers/usb/gadget/composite.c ++++ b/drivers/usb/gadget/composite.c +@@ -1004,10 +1004,11 @@ static int set_config(struct usb_composi + else + usb_gadget_set_remote_wakeup(gadget, 0); + done: +- if (power <= USB_SELF_POWER_VBUS_MAX_DRAW) +- usb_gadget_set_selfpowered(gadget); +- else ++ if (power > USB_SELF_POWER_VBUS_MAX_DRAW || ++ !(c->bmAttributes & USB_CONFIG_ATT_SELFPOWER)) + usb_gadget_clear_selfpowered(gadget); ++ else ++ usb_gadget_set_selfpowered(gadget); + + usb_gadget_vbus_draw(gadget, power); + if (result >= 0 && cdev->delayed_status) +@@ -2475,7 +2476,9 @@ void composite_suspend(struct usb_gadget + + cdev->suspended = 1; + +- usb_gadget_set_selfpowered(gadget); ++ if (cdev->config->bmAttributes & USB_CONFIG_ATT_SELFPOWER) ++ usb_gadget_set_selfpowered(gadget); ++ + usb_gadget_vbus_draw(gadget, 2); + } + +@@ -2504,8 +2507,11 @@ void composite_resume(struct usb_gadget + else + maxpower = min(maxpower, 900U); + +- if (maxpower > USB_SELF_POWER_VBUS_MAX_DRAW) ++ if (maxpower > USB_SELF_POWER_VBUS_MAX_DRAW || ++ !(cdev->config->bmAttributes & USB_CONFIG_ATT_SELFPOWER)) + usb_gadget_clear_selfpowered(gadget); ++ else ++ usb_gadget_set_selfpowered(gadget); + + usb_gadget_vbus_draw(gadget, maxpower); + } diff --git a/queue-5.15/usb-hub-lack-of-clearing-xhc-resources.patch b/queue-5.15/usb-hub-lack-of-clearing-xhc-resources.patch new file mode 100644 index 0000000000..fca3114f47 --- /dev/null +++ b/queue-5.15/usb-hub-lack-of-clearing-xhc-resources.patch @@ -0,0 +1,90 @@ +From 2b66ef84d0d2a0ea955b40bd306f5e3abbc5cf9c Mon Sep 17 00:00:00 2001 +From: Pawel Laszczak +Date: Fri, 28 Feb 2025 07:50:25 +0000 +Subject: usb: hub: lack of clearing xHC resources + +From: Pawel Laszczak + +commit 2b66ef84d0d2a0ea955b40bd306f5e3abbc5cf9c upstream. + +The xHC resources allocated for USB devices are not released in correct +order after resuming in case when while suspend device was reconnected. + +This issue has been detected during the fallowing scenario: +- connect hub HS to root port +- connect LS/FS device to hub port +- wait for enumeration to finish +- force host to suspend +- reconnect hub attached to root port +- wake host + +For this scenario during enumeration of USB LS/FS device the Cadence xHC +reports completion error code for xHC commands because the xHC resources +used for devices has not been properly released. +XHCI specification doesn't mention that device can be reset in any order +so, we should not treat this issue as Cadence xHC controller bug. +Similar as during disconnecting in this case the device resources should +be cleared starting form the last usb device in tree toward the root hub. +To fix this issue usbcore driver should call hcd->driver->reset_device +for all USB devices connected to hub which was reconnected while +suspending. + +Fixes: 3d82904559f4 ("usb: cdnsp: cdns3 Add main part of Cadence USBSSP DRD Driver") +Cc: stable +Signed-off-by: Pawel Laszczak +Reviewed-by: Alan Stern +Link: https://lore.kernel.org/r/PH7PR07MB953841E38C088678ACDCF6EEDDCC2@PH7PR07MB9538.namprd07.prod.outlook.com +Signed-off-by: Greg Kroah-Hartman +--- + drivers/usb/core/hub.c | 33 +++++++++++++++++++++++++++++++++ + 1 file changed, 33 insertions(+) + +--- a/drivers/usb/core/hub.c ++++ b/drivers/usb/core/hub.c +@@ -5971,6 +5971,36 @@ void usb_hub_cleanup(void) + } /* usb_hub_cleanup() */ + + /** ++ * hub_hc_release_resources - clear resources used by host controller ++ * @udev: pointer to device being released ++ * ++ * Context: task context, might sleep ++ * ++ * Function releases the host controller resources in correct order before ++ * making any operation on resuming usb device. The host controller resources ++ * allocated for devices in tree should be released starting from the last ++ * usb device in tree toward the root hub. This function is used only during ++ * resuming device when usb device require reinitialization – that is, when ++ * flag udev->reset_resume is set. ++ * ++ * This call is synchronous, and may not be used in an interrupt context. ++ */ ++static void hub_hc_release_resources(struct usb_device *udev) ++{ ++ struct usb_hub *hub = usb_hub_to_struct_hub(udev); ++ struct usb_hcd *hcd = bus_to_hcd(udev->bus); ++ int i; ++ ++ /* Release up resources for all children before this device */ ++ for (i = 0; i < udev->maxchild; i++) ++ if (hub->ports[i]->child) ++ hub_hc_release_resources(hub->ports[i]->child); ++ ++ if (hcd->driver->reset_device) ++ hcd->driver->reset_device(hcd, udev); ++} ++ ++/** + * usb_reset_and_verify_device - perform a USB port reset to reinitialize a device + * @udev: device to reset (not in SUSPENDED or NOTATTACHED state) + * +@@ -6044,6 +6074,9 @@ static int usb_reset_and_verify_device(s + bos = udev->bos; + udev->bos = NULL; + ++ if (udev->reset_resume) ++ hub_hc_release_resources(udev); ++ + mutex_lock(hcd->address0_mutex); + + for (i = 0; i < PORT_INIT_TRIES; ++i) { diff --git a/queue-5.15/usb-quirks-add-delay_init-and-no_lpm-for-prolific-mass-storage-card-reader.patch b/queue-5.15/usb-quirks-add-delay_init-and-no_lpm-for-prolific-mass-storage-card-reader.patch new file mode 100644 index 0000000000..7e08068f31 --- /dev/null +++ b/queue-5.15/usb-quirks-add-delay_init-and-no_lpm-for-prolific-mass-storage-card-reader.patch @@ -0,0 +1,36 @@ +From ff712188daa3fe3ce7e11e530b4dca3826dae14a Mon Sep 17 00:00:00 2001 +From: Miao Li +Date: Tue, 4 Mar 2025 15:07:57 +0800 +Subject: usb: quirks: Add DELAY_INIT and NO_LPM for Prolific Mass Storage Card Reader + +From: Miao Li + +commit ff712188daa3fe3ce7e11e530b4dca3826dae14a upstream. + +When used on Huawei hisi platforms, Prolific Mass Storage Card Reader +which the VID:PID is in 067b:2731 might fail to enumerate at boot time +and doesn't work well with LPM enabled, combination quirks: + USB_QUIRK_DELAY_INIT + USB_QUIRK_NO_LPM +fixed the problems. + +Signed-off-by: Miao Li +Cc: stable +Link: https://lore.kernel.org/r/20250304070757.139473-1-limiao870622@163.com +Signed-off-by: Greg Kroah-Hartman +--- + drivers/usb/core/quirks.c | 4 ++++ + 1 file changed, 4 insertions(+) + +--- a/drivers/usb/core/quirks.c ++++ b/drivers/usb/core/quirks.c +@@ -338,6 +338,10 @@ static const struct usb_device_id usb_qu + { USB_DEVICE(0x0638, 0x0a13), .driver_info = + USB_QUIRK_STRING_FETCH_255 }, + ++ /* Prolific Single-LUN Mass Storage Card Reader */ ++ { USB_DEVICE(0x067b, 0x2731), .driver_info = USB_QUIRK_DELAY_INIT | ++ USB_QUIRK_NO_LPM }, ++ + /* Saitek Cyborg Gold Joystick */ + { USB_DEVICE(0x06a3, 0x0006), .driver_info = + USB_QUIRK_CONFIG_INTF_STRINGS }, diff --git a/queue-5.15/usb-renesas_usbhs-call-clk_put.patch b/queue-5.15/usb-renesas_usbhs-call-clk_put.patch new file mode 100644 index 0000000000..329be3bebb --- /dev/null +++ b/queue-5.15/usb-renesas_usbhs-call-clk_put.patch @@ -0,0 +1,37 @@ +From b5ea08aa883da05106fcc683d12489a4292d1122 Mon Sep 17 00:00:00 2001 +From: Claudiu Beznea +Date: Tue, 25 Feb 2025 13:02:46 +0200 +Subject: usb: renesas_usbhs: Call clk_put() + +From: Claudiu Beznea + +commit b5ea08aa883da05106fcc683d12489a4292d1122 upstream. + +Clocks acquired with of_clk_get() need to be freed with clk_put(). Call +clk_put() on priv->clks[0] on error path. + +Fixes: 3df0e240caba ("usb: renesas_usbhs: Add multiple clocks management") +Cc: stable +Reviewed-by: Yoshihiro Shimoda +Tested-by: Yoshihiro Shimoda +Signed-off-by: Claudiu Beznea +Link: https://lore.kernel.org/r/20250225110248.870417-2-claudiu.beznea.uj@bp.renesas.com +Signed-off-by: Greg Kroah-Hartman +--- + drivers/usb/renesas_usbhs/common.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +--- a/drivers/usb/renesas_usbhs/common.c ++++ b/drivers/usb/renesas_usbhs/common.c +@@ -312,8 +312,10 @@ static int usbhsc_clk_get(struct device + priv->clks[1] = of_clk_get(dev_of_node(dev), 1); + if (PTR_ERR(priv->clks[1]) == -ENOENT) + priv->clks[1] = NULL; +- else if (IS_ERR(priv->clks[1])) ++ else if (IS_ERR(priv->clks[1])) { ++ clk_put(priv->clks[0]); + return PTR_ERR(priv->clks[1]); ++ } + + return 0; + } diff --git a/queue-5.15/usb-renesas_usbhs-flush-the-notify_hotplug_work.patch b/queue-5.15/usb-renesas_usbhs-flush-the-notify_hotplug_work.patch new file mode 100644 index 0000000000..6a23a46a40 --- /dev/null +++ b/queue-5.15/usb-renesas_usbhs-flush-the-notify_hotplug_work.patch @@ -0,0 +1,39 @@ +From 552ca6b87e3778f3dd5b87842f95138162e16c82 Mon Sep 17 00:00:00 2001 +From: Claudiu Beznea +Date: Tue, 25 Feb 2025 13:02:48 +0200 +Subject: usb: renesas_usbhs: Flush the notify_hotplug_work + +From: Claudiu Beznea + +commit 552ca6b87e3778f3dd5b87842f95138162e16c82 upstream. + +When performing continuous unbind/bind operations on the USB drivers +available on the Renesas RZ/G2L SoC, a kernel crash with the message +"Unable to handle kernel NULL pointer dereference at virtual address" +may occur. This issue points to the usbhsc_notify_hotplug() function. + +Flush the delayed work to avoid its execution when driver resources are +unavailable. + +Fixes: bc57381e6347 ("usb: renesas_usbhs: use delayed_work instead of work_struct") +Cc: stable +Reviewed-by: Yoshihiro Shimoda +Tested-by: Yoshihiro Shimoda +Signed-off-by: Claudiu Beznea +Link: https://lore.kernel.org/r/20250225110248.870417-4-claudiu.beznea.uj@bp.renesas.com +Signed-off-by: Greg Kroah-Hartman +--- + drivers/usb/renesas_usbhs/common.c | 2 ++ + 1 file changed, 2 insertions(+) + +--- a/drivers/usb/renesas_usbhs/common.c ++++ b/drivers/usb/renesas_usbhs/common.c +@@ -774,6 +774,8 @@ static int usbhs_remove(struct platform_ + + dev_dbg(&pdev->dev, "usb remove\n"); + ++ flush_delayed_work(&priv->notify_hotplug_work); ++ + /* power off */ + if (!usbhs_get_dparam(priv, runtime_pwctrl)) + usbhsc_power_ctrl(priv, 0); diff --git a/queue-5.15/usb-renesas_usbhs-use-devm_usb_get_phy.patch b/queue-5.15/usb-renesas_usbhs-use-devm_usb_get_phy.patch new file mode 100644 index 0000000000..d082afd190 --- /dev/null +++ b/queue-5.15/usb-renesas_usbhs-use-devm_usb_get_phy.patch @@ -0,0 +1,37 @@ +From e0c92440938930e7fa7aa6362780d39cdea34449 Mon Sep 17 00:00:00 2001 +From: Claudiu Beznea +Date: Tue, 25 Feb 2025 13:02:47 +0200 +Subject: usb: renesas_usbhs: Use devm_usb_get_phy() + +From: Claudiu Beznea + +commit e0c92440938930e7fa7aa6362780d39cdea34449 upstream. + +The gpriv->transceiver is retrieved in probe() through usb_get_phy() but +never released. Use devm_usb_get_phy() to handle this scenario. + +This issue was identified through code investigation. No issue was found +without this change. + +Fixes: b5a2875605ca ("usb: renesas_usbhs: Allow an OTG PHY driver to provide VBUS") +Cc: stable +Reviewed-by: Yoshihiro Shimoda +Tested-by: Yoshihiro Shimoda +Signed-off-by: Claudiu Beznea +Link: https://lore.kernel.org/r/20250225110248.870417-3-claudiu.beznea.uj@bp.renesas.com +Signed-off-by: Greg Kroah-Hartman +--- + drivers/usb/renesas_usbhs/mod_gadget.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/usb/renesas_usbhs/mod_gadget.c ++++ b/drivers/usb/renesas_usbhs/mod_gadget.c +@@ -1094,7 +1094,7 @@ int usbhs_mod_gadget_probe(struct usbhs_ + goto usbhs_mod_gadget_probe_err_gpriv; + } + +- gpriv->transceiver = usb_get_phy(USB_PHY_TYPE_UNDEFINED); ++ gpriv->transceiver = devm_usb_get_phy(dev, USB_PHY_TYPE_UNDEFINED); + dev_info(dev, "%stransceiver found\n", + !IS_ERR(gpriv->transceiver) ? "" : "no "); + diff --git a/queue-5.15/usb-typec-tcpci_rt1711h-unmask-alert-interrupts-to-fix-functionality.patch b/queue-5.15/usb-typec-tcpci_rt1711h-unmask-alert-interrupts-to-fix-functionality.patch new file mode 100644 index 0000000000..90bfd5aa08 --- /dev/null +++ b/queue-5.15/usb-typec-tcpci_rt1711h-unmask-alert-interrupts-to-fix-functionality.patch @@ -0,0 +1,55 @@ +From d6b82dafd17db0658f089b9cdec573982ca82bc5 Mon Sep 17 00:00:00 2001 +From: AngeloGioacchino Del Regno +Date: Wed, 19 Feb 2025 12:47:00 +0100 +Subject: usb: typec: tcpci_rt1711h: Unmask alert interrupts to fix functionality + +From: AngeloGioacchino Del Regno + +commit d6b82dafd17db0658f089b9cdec573982ca82bc5 upstream. + +During probe, the TCPC alert interrupts are getting masked to +avoid unwanted interrupts during chip setup: this is ok to do +but there is no unmasking happening at any later time, which +means that the chip will not raise any interrupt, essentially +making it not functional as, while internally it does perform +all of the intended functions, it won't signal anything to the +outside. + +Unmask the alert interrupts to fix functionality. + +Fixes: ce08eaeb6388 ("staging: typec: rt1711h typec chip driver") +Cc: stable +Signed-off-by: AngeloGioacchino Del Regno +Link: https://lore.kernel.org/r/20250219114700.41700-1-angelogioacchino.delregno@collabora.com +Signed-off-by: Greg Kroah-Hartman +--- + drivers/usb/typec/tcpm/tcpci_rt1711h.c | 11 +++++++++++ + 1 file changed, 11 insertions(+) + +--- a/drivers/usb/typec/tcpm/tcpci_rt1711h.c ++++ b/drivers/usb/typec/tcpm/tcpci_rt1711h.c +@@ -217,6 +217,11 @@ static int rt1711h_probe(struct i2c_clie + { + int ret; + struct rt1711h_chip *chip; ++ const u16 alert_mask = TCPC_ALERT_TX_SUCCESS | TCPC_ALERT_TX_DISCARDED | ++ TCPC_ALERT_TX_FAILED | TCPC_ALERT_RX_HARD_RST | ++ TCPC_ALERT_RX_STATUS | TCPC_ALERT_POWER_STATUS | ++ TCPC_ALERT_CC_STATUS | TCPC_ALERT_RX_BUF_OVF | ++ TCPC_ALERT_FAULT; + + ret = rt1711h_check_revision(client); + if (ret < 0) { +@@ -258,6 +263,12 @@ static int rt1711h_probe(struct i2c_clie + dev_name(chip->dev), chip); + if (ret < 0) + return ret; ++ ++ /* Enable alert interrupts */ ++ ret = rt1711h_write16(chip, TCPC_ALERT_MASK, alert_mask); ++ if (ret < 0) ++ return ret; ++ + enable_irq_wake(client->irq); + + return 0; diff --git a/queue-5.15/usb-typec-ucsi-increase-timeout-for-ppm-reset-operations.patch b/queue-5.15/usb-typec-ucsi-increase-timeout-for-ppm-reset-operations.patch new file mode 100644 index 0000000000..f1f50a6497 --- /dev/null +++ b/queue-5.15/usb-typec-ucsi-increase-timeout-for-ppm-reset-operations.patch @@ -0,0 +1,51 @@ +From bf4f9ae1cb08ccaafbe6874be6c46f59b83ae778 Mon Sep 17 00:00:00 2001 +From: Fedor Pchelkin +Date: Mon, 17 Feb 2025 13:54:40 +0300 +Subject: usb: typec: ucsi: increase timeout for PPM reset operations + +From: Fedor Pchelkin + +commit bf4f9ae1cb08ccaafbe6874be6c46f59b83ae778 upstream. + +It is observed that on some systems an initial PPM reset during the boot +phase can trigger a timeout: + +[ 6.482546] ucsi_acpi USBC000:00: failed to reset PPM! +[ 6.482551] ucsi_acpi USBC000:00: error -ETIMEDOUT: PPM init failed + +Still, increasing the timeout value, albeit being the most straightforward +solution, eliminates the problem: the initial PPM reset may take up to +~8000-10000ms on some Lenovo laptops. When it is reset after the above +period of time (or even if ucsi_reset_ppm() is not called overall), UCSI +works as expected. + +Moreover, if the ucsi_acpi module is loaded/unloaded manually after the +system has booted, reading the CCI values and resetting the PPM works +perfectly, without any timeout. Thus it's only a boot-time issue. + +The reason for this behavior is not clear but it may be the consequence +of some tricks that the firmware performs or be an actual firmware bug. +As a workaround, increase the timeout to avoid failing the UCSI +initialization prematurely. + +Fixes: b1b59e16075f ("usb: typec: ucsi: Increase command completion timeout value") +Cc: stable +Signed-off-by: Fedor Pchelkin +Reviewed-by: Heikki Krogerus +Link: https://lore.kernel.org/r/20250217105442.113486-3-boddah8794@gmail.com +Signed-off-by: Greg Kroah-Hartman +--- + drivers/usb/typec/ucsi/ucsi.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/usb/typec/ucsi/ucsi.c ++++ b/drivers/usb/typec/ucsi/ucsi.c +@@ -25,7 +25,7 @@ + * difficult to estimate the time it takes for the system to process the command + * before it is actually passed to the PPM. + */ +-#define UCSI_TIMEOUT_MS 5000 ++#define UCSI_TIMEOUT_MS 10000 + + /* + * UCSI_SWAP_TIMEOUT_MS - Timeout for role swap requests