FAILED: patch "[PATCH] usb: dwc3: xilinx: re-assert resets on ZynqMP init error" failed to apply to 6.12-stable tree
Subsystems (4)
[email protected]
maintainerThe patch below does not apply to the 6.12-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.12.y
git checkout FETCH_HEAD
git cherry-pick -x f33f0dd2eb014bffda02ecfd182de3ddab058596
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2026112502-trailing-living-e804@gregkh' --subject-prefix 'PATCH 6.12.y' 'HEAD^..'
Possible dependencies:
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From f33f0dd2eb014bffda02ecfd182de3ddab058596 Mon Sep 17 00:00:00 2001
From: Radhey Shyam Pandey <[email protected]>
Date: Mon, 28 Sep 2026 17:30:14 +0530
Subject: [PATCH] usb: dwc3: xilinx: re-assert resets on ZynqMP init error
paths
If reset deassert or PHY setup fails partway through dwc3_xlnx_init_zynqmp(), re-assert the resets that were already released before unwinding the PHY.
Only undo the reset cycle the function actually performed. The cycle is skipped when no usb3-phy is present, because asserting the core resets can break a USB3 configuration that is live but missing from the device tree, so the error path skips it for the same reason. Asserting an already asserted reset is harmless, so one block covers however far the deasserts progressed.
Save the ZynqMP reset handles in driver private data so later probe teardown can re-assert released resets.
drivers/usb/dwc3/dwc3-xilinx.c +36 -19
@@ -48,6 +48,9 @@ struct dwc3_xlnx {void __iomem *regs;int (*pltfm_init)(struct dwc3_xlnx *data);struct phy *usb3_phy; +struct reset_control *usb_crst; +struct reset_control *usb_hibrst; +struct reset_control *usb_apbrst; };static void dwc3_xlnx_mask_phy_rst (struct dwc3_xlnx *priv_data,bool mask)
@@ -112,7 +115,6 @@ static int dwc3_xlnx_init_versal(struct dwc3_xlnx *priv_data)static int dwc3_xlnx_init_zynqmp (struct dwc3_xlnx *priv_data) {struct device *dev = priv_data->dev; -struct reset_control *crst, *hibrst, *apbrst;struct gpio_desc *reset_gpio;int ret =0 ;
@@ -124,25 +126,25 @@ static int dwc3_xlnx_init_zynqmp(struct dwc3_xlnx *priv_data) goto err; } - crst =devm_reset_control_get_exclusive (dev,"usb_crst" ); -if (IS_ERR (crst)) { - ret =PTR_ERR (crst); + priv_data->usb_crst =devm_reset_control_get_exclusive (dev,"usb_crst" ); +if (IS_ERR (priv_data->usb_crst)) { + ret =PTR_ERR (priv_data->usb_crst);dev_err_probe (dev, ret,"failed to get core reset signal\n" ); goto err; } - hibrst =devm_reset_control_get_exclusive (dev,"usb_hibrst" ); -if (IS_ERR (hibrst)) { - ret =PTR_ERR (hibrst); + priv_data->usb_hibrst =devm_reset_control_get_exclusive (dev,"usb_hibrst" ); +if (IS_ERR (priv_data->usb_hibrst)) { + ret =PTR_ERR (priv_data->usb_hibrst);dev_err_probe (dev, ret,"failed to get hibernation reset signal\n" ); goto err; } - apbrst =devm_reset_control_get_exclusive (dev,"usb_apbrst" ); -if (IS_ERR (apbrst)) { - ret =PTR_ERR (apbrst); + priv_data->usb_apbrst =devm_reset_control_get_exclusive (dev,"usb_apbrst" ); +if (IS_ERR (priv_data->usb_apbrst)) { + ret =PTR_ERR (priv_data->usb_apbrst);dev_err_probe (dev, ret,"failed to get APB reset signal\n" ); goto err;
@@ -156,19 +158,19 @@ static int dwc3_xlnx_init_zynqmp(struct dwc3_xlnx *priv_data)* absent. */ if (priv_data->usb3_phy) { - ret =reset_control_assert (crst); + ret =reset_control_assert (priv_data->usb_crst);if (ret <0 ) {dev_err (dev,"Failed to assert core reset\n" ); goto err; } - ret =reset_control_assert (hibrst); + ret =reset_control_assert (priv_data->usb_hibrst);if (ret <0 ) {dev_err (dev,"Failed to assert hibernation reset\n" ); goto err; } - ret =reset_control_assert (apbrst); + ret =reset_control_assert (priv_data->usb_apbrst);if (ret <0 ) {dev_err (dev,"Failed to assert APB reset\n" ); goto err;
@@ -179,7 +181,7 @@ static int dwc3_xlnx_init_zynqmp(struct dwc3_xlnx *priv_data)if (ret <0 ) goto err; - ret =reset_control_deassert (apbrst); + ret =reset_control_deassert (priv_data->usb_apbrst);if (ret <0 ) {dev_err (dev,"Failed to release APB reset\n" ); goto err_phy_exit;
@@ -195,21 +197,21 @@ static int dwc3_xlnx_init_zynqmp(struct dwc3_xlnx *priv_data)writel (PIPE_CLK_DESELECT , priv_data->regs +XLNX_USB_FPD_PIPE_CLK ); } - ret =reset_control_deassert (crst); + ret =reset_control_deassert (priv_data->usb_crst);if (ret <0 ) {dev_err (dev,"Failed to release core reset\n" ); - goto err_phy_exit; + goto err_reset_assert; } - ret =reset_control_deassert (hibrst); + ret =reset_control_deassert (priv_data->usb_hibrst);if (ret <0 ) {dev_err (dev,"Failed to release hibernation reset\n" ); - goto err_phy_exit; + goto err_reset_assert; } ret =phy_power_on (priv_data->usb3_phy);if (ret <0 ) - goto err_phy_exit; + goto err_reset_assert;/* ulpi reset via gpio-modepin or gpio-framework driver */ reset_gpio =devm_gpiod_get_optional (dev,"reset" ,GPIOD_OUT_HIGH );
@@ -230,6 +232,21 @@ static int dwc3_xlnx_init_zynqmp(struct dwc3_xlnx *priv_data) err_phy_power_off:phy_power_off (priv_data->usb3_phy); +err_reset_assert: +/* +* Undo only the reset cycle performed above. That cycle is skipped +* when there is no usb3-phy. The deasserts stay unconditional so a +* core the bootloader left in reset still comes up, but they are +* deliberately not paired with an assert here: resetting a USB3 +* configuration that is live but missing from the device tree could +* break it. Asserting an already asserted reset is harmless, so one +* block covers however far the cycle's deasserts got. +*/ +if (priv_data->usb3_phy) { +reset_control_assert (priv_data->usb_hibrst); +reset_control_assert (priv_data->usb_crst); +reset_control_assert (priv_data->usb_apbrst); + } err_phy_exit:phy_exit (priv_data->usb3_phy); err:
Sasha Levin
maintainerPATCH 1/2 usb: dwc3: Always deassert xilinx resets
From: Sean Anderson <[email protected]>
[ Upstream commit ec06c8039d396a1b558cc138f5c5aba17698e175 ]
If we don't have a usb3 phy we don't need to assert the core resets. Deassert them even if we didn't assert them to support booting when the bootloader never released the core from reset.
Stable-dep-of: f33f0dd2eb01 ("usb: dwc3: xilinx: re-assert resets on ZynqMP init error paths")
--- drivers/usb/dwc3/dwc3-xilinx.c | 71 ++++++++++++++++------------------ 1 file changed, 34 insertions(+), 37 deletions(-)
drivers/usb/dwc3/dwc3-xilinx.c +34 -37
@@ -112,21 +112,6 @@ static int dwc3_xlnx_init_zynqmp(struct dwc3_xlnx *priv_data) goto err; } -/* -* The following core resets are not required unless a USB3 PHY -* is used, and the subsequent register settings are not required -* unless a core reset is performed (they should be set properly -* by the first-stage boot loader, but may be reverted by a core -* reset). They may also break the configuration if USB3 is actually -* in use but the usb3-phy entry is missing from the device tree. -* Therefore, skip these operations in this case. -*/ -if (!priv_data->usb3_phy) { -/* Deselect the PIPE Clock Select bit in FPD PIPE Clock register */ -writel (PIPE_CLK_DESELECT , priv_data->regs +XLNX_USB_FPD_PIPE_CLK ); - goto skip_usb3_phy; - } - crst =devm_reset_control_get_exclusive (dev,"usb_crst" );if (IS_ERR (crst)) { ret =PTR_ERR (crst);
@@ -151,22 +136,31 @@ static int dwc3_xlnx_init_zynqmp(struct dwc3_xlnx *priv_data) goto err; } - ret =reset_control_assert (crst); -if (ret <0 ) { -dev_err (dev,"Failed to assert core reset\n" ); - goto err; - } - - ret =reset_control_assert (hibrst); -if (ret <0 ) { -dev_err (dev,"Failed to assert hibernation reset\n" ); - goto err; - } - - ret =reset_control_assert (apbrst); -if (ret <0 ) { -dev_err (dev,"Failed to assert APB reset\n" ); - goto err; +/* +* Asserting the core resets is not required unless a USB3 PHY is used. +* They may also break the configuration if USB3 is actually in use but +* the usb3-phy entry is missing from the device tree. Therefore, skip +* a full reset cycle and just deassert the resets if the phy is +* absent. +*/ +if (priv_data->usb3_phy) { + ret =reset_control_assert (crst); +if (ret <0 ) { +dev_err (dev,"Failed to assert core reset\n" ); + goto err; + } + + ret =reset_control_assert (hibrst); +if (ret <0 ) { +dev_err (dev,"Failed to assert hibernation reset\n" ); + goto err; + } + + ret =reset_control_assert (apbrst); +if (ret <0 ) { +dev_err (dev,"Failed to assert APB reset\n" ); + goto err; + } } ret =phy_init (priv_data->usb3_phy);
@@ -179,11 +173,15 @@ static int dwc3_xlnx_init_zynqmp(struct dwc3_xlnx *priv_data) goto err_phy_exit; } -/* Set PIPE Power Present signal in FPD Power Present Register*/ -writel (FPD_POWER_PRSNT_OPTION , priv_data->regs +XLNX_USB_FPD_POWER_PRSNT ); - -/* Set the PIPE Clock Select bit in FPD PIPE Clock register */ -writel (PIPE_CLK_SELECT , priv_data->regs +XLNX_USB_FPD_PIPE_CLK ); +if (priv_data->usb3_phy) { +/* Set PIPE Power Present signal in FPD Power Present Register*/ +writel (FPD_POWER_PRSNT_OPTION , priv_data->regs +XLNX_USB_FPD_POWER_PRSNT ); +/* Set the PIPE Clock Select bit in FPD PIPE Clock register */ +writel (PIPE_CLK_SELECT , priv_data->regs +XLNX_USB_FPD_PIPE_CLK ); + }else { +/* Deselect the PIPE Clock Select bit in FPD PIPE Clock register */ +writel (PIPE_CLK_DESELECT , priv_data->regs +XLNX_USB_FPD_PIPE_CLK ); + } ret =reset_control_deassert (crst);if (ret <0 ) {
@@ -201,7 +199,6 @@ static int dwc3_xlnx_init_zynqmp(struct dwc3_xlnx *priv_data)if (ret <0 ) goto err_phy_exit; -skip_usb3_phy:/* ulpi reset via gpio-modepin or gpio-framework driver */ reset_gpio =devm_gpiod_get_optional (dev,"reset" ,GPIOD_OUT_HIGH );if (IS_ERR (reset_gpio)) {
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 2/2 usb: dwc3: xilinx: re-assert resets on ZynqMP init error paths
From: Radhey Shyam Pandey <[email protected]>
[ Upstream commit f33f0dd2eb014bffda02ecfd182de3ddab058596 ]
If reset deassert or PHY setup fails partway through dwc3_xlnx_init_zynqmp(), re-assert the resets that were already released before unwinding the PHY.
Only undo the reset cycle the function actually performed. The cycle is skipped when no usb3-phy is present, because asserting the core resets can break a USB3 configuration that is live but missing from the device tree, so the error path skips it for the same reason. Asserting an already asserted reset is harmless, so one block covers however far the deasserts progressed.
Save the ZynqMP reset handles in driver private data so later probe teardown can re-assert released resets.
--- drivers/usb/dwc3/dwc3-xilinx.c | 55 ++++++++++++++++++++++------------ 1 file changed, 36 insertions(+), 19 deletions(-)
drivers/usb/dwc3/dwc3-xilinx.c +36 -19
@@ -45,6 +45,9 @@ struct dwc3_xlnx {void __iomem *regs;int (*pltfm_init)(struct dwc3_xlnx *data);struct phy *usb3_phy; +struct reset_control *usb_crst; +struct reset_control *usb_hibrst; +struct reset_control *usb_apbrst; };static void dwc3_xlnx_mask_phy_rst (struct dwc3_xlnx *priv_data,bool mask)
@@ -99,7 +102,6 @@ static int dwc3_xlnx_init_versal(struct dwc3_xlnx *priv_data)static int dwc3_xlnx_init_zynqmp (struct dwc3_xlnx *priv_data) {struct device *dev = priv_data->dev; -struct reset_control *crst, *hibrst, *apbrst;struct gpio_desc *reset_gpio;int ret =0 ;u32 reg;
@@ -112,25 +114,25 @@ static int dwc3_xlnx_init_zynqmp(struct dwc3_xlnx *priv_data) goto err; } - crst =devm_reset_control_get_exclusive (dev,"usb_crst" ); -if (IS_ERR (crst)) { - ret =PTR_ERR (crst); + priv_data->usb_crst =devm_reset_control_get_exclusive (dev,"usb_crst" ); +if (IS_ERR (priv_data->usb_crst)) { + ret =PTR_ERR (priv_data->usb_crst);dev_err_probe (dev, ret,"failed to get core reset signal\n" ); goto err; } - hibrst =devm_reset_control_get_exclusive (dev,"usb_hibrst" ); -if (IS_ERR (hibrst)) { - ret =PTR_ERR (hibrst); + priv_data->usb_hibrst =devm_reset_control_get_exclusive (dev,"usb_hibrst" ); +if (IS_ERR (priv_data->usb_hibrst)) { + ret =PTR_ERR (priv_data->usb_hibrst);dev_err_probe (dev, ret,"failed to get hibernation reset signal\n" ); goto err; } - apbrst =devm_reset_control_get_exclusive (dev,"usb_apbrst" ); -if (IS_ERR (apbrst)) { - ret =PTR_ERR (apbrst); + priv_data->usb_apbrst =devm_reset_control_get_exclusive (dev,"usb_apbrst" ); +if (IS_ERR (priv_data->usb_apbrst)) { + ret =PTR_ERR (priv_data->usb_apbrst);dev_err_probe (dev, ret,"failed to get APB reset signal\n" ); goto err;
@@ -144,19 +146,19 @@ static int dwc3_xlnx_init_zynqmp(struct dwc3_xlnx *priv_data)* absent. */ if (priv_data->usb3_phy) { - ret =reset_control_assert (crst); + ret =reset_control_assert (priv_data->usb_crst);if (ret <0 ) {dev_err (dev,"Failed to assert core reset\n" ); goto err; } - ret =reset_control_assert (hibrst); + ret =reset_control_assert (priv_data->usb_hibrst);if (ret <0 ) {dev_err (dev,"Failed to assert hibernation reset\n" ); goto err; } - ret =reset_control_assert (apbrst); + ret =reset_control_assert (priv_data->usb_apbrst);if (ret <0 ) {dev_err (dev,"Failed to assert APB reset\n" ); goto err;
@@ -167,7 +169,7 @@ static int dwc3_xlnx_init_zynqmp(struct dwc3_xlnx *priv_data)if (ret <0 ) goto err; - ret =reset_control_deassert (apbrst); + ret =reset_control_deassert (priv_data->usb_apbrst);if (ret <0 ) {dev_err (dev,"Failed to release APB reset\n" ); goto err_phy_exit;
@@ -183,21 +185,21 @@ static int dwc3_xlnx_init_zynqmp(struct dwc3_xlnx *priv_data)writel (PIPE_CLK_DESELECT , priv_data->regs +XLNX_USB_FPD_PIPE_CLK ); } - ret =reset_control_deassert (crst); + ret =reset_control_deassert (priv_data->usb_crst);if (ret <0 ) {dev_err (dev,"Failed to release core reset\n" ); - goto err_phy_exit; + goto err_reset_assert; } - ret =reset_control_deassert (hibrst); + ret =reset_control_deassert (priv_data->usb_hibrst);if (ret <0 ) {dev_err (dev,"Failed to release hibernation reset\n" ); - goto err_phy_exit; + goto err_reset_assert; } ret =phy_power_on (priv_data->usb3_phy);if (ret <0 ) - goto err_phy_exit; + goto err_reset_assert;/* ulpi reset via gpio-modepin or gpio-framework driver */ reset_gpio =devm_gpiod_get_optional (dev,"reset" ,GPIOD_OUT_HIGH );
@@ -227,6 +229,21 @@ static int dwc3_xlnx_init_zynqmp(struct dwc3_xlnx *priv_data) err_phy_power_off:phy_power_off (priv_data->usb3_phy); +err_reset_assert: +/* +* Undo only the reset cycle performed above. That cycle is skipped +* when there is no usb3-phy. The deasserts stay unconditional so a +* core the bootloader left in reset still comes up, but they are +* deliberately not paired with an assert here: resetting a USB3 +* configuration that is live but missing from the device tree could +* break it. Asserting an already asserted reset is harmless, so one +* block covers however far the cycle's deasserts got. +*/ +if (priv_data->usb3_phy) { +reset_control_assert (priv_data->usb_hibrst); +reset_control_assert (priv_data->usb_crst); +reset_control_assert (priv_data->usb_apbrst); + } err_phy_exit:phy_exit (priv_data->usb3_phy); err:
Signature · 1 line
2.53.0