Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

usb: dwc3: Always deassert xilinx resets

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.

Signed-off-by: Sean Anderson <sean.anderson@linux.dev>
Acked-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
Link: https://patch.msgid.link/20260106171018.501612-1-sean.anderson@linux.dev
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Sean Anderson and committed by
Greg Kroah-Hartman
ec06c803 7a7930c0

+32 -35
+32 -35
drivers/usb/dwc3/dwc3-xilinx.c
··· 132 132 goto err; 133 133 } 134 134 135 - /* 136 - * The following core resets are not required unless a USB3 PHY 137 - * is used, and the subsequent register settings are not required 138 - * unless a core reset is performed (they should be set properly 139 - * by the first-stage boot loader, but may be reverted by a core 140 - * reset). They may also break the configuration if USB3 is actually 141 - * in use but the usb3-phy entry is missing from the device tree. 142 - * Therefore, skip these operations in this case. 143 - */ 144 - if (!priv_data->usb3_phy) { 145 - /* Deselect the PIPE Clock Select bit in FPD PIPE Clock register */ 146 - writel(PIPE_CLK_DESELECT, priv_data->regs + XLNX_USB_FPD_PIPE_CLK); 147 - goto skip_usb3_phy; 148 - } 149 - 150 135 crst = devm_reset_control_get_exclusive(dev, "usb_crst"); 151 136 if (IS_ERR(crst)) { 152 137 ret = PTR_ERR(crst); ··· 156 171 goto err; 157 172 } 158 173 159 - ret = reset_control_assert(crst); 160 - if (ret < 0) { 161 - dev_err(dev, "Failed to assert core reset\n"); 162 - goto err; 163 - } 174 + /* 175 + * Asserting the core resets is not required unless a USB3 PHY is used. 176 + * They may also break the configuration if USB3 is actually in use but 177 + * the usb3-phy entry is missing from the device tree. Therefore, skip 178 + * a full reset cycle and just deassert the resets if the phy is 179 + * absent. 180 + */ 181 + if (priv_data->usb3_phy) { 182 + ret = reset_control_assert(crst); 183 + if (ret < 0) { 184 + dev_err(dev, "Failed to assert core reset\n"); 185 + goto err; 186 + } 164 187 165 - ret = reset_control_assert(hibrst); 166 - if (ret < 0) { 167 - dev_err(dev, "Failed to assert hibernation reset\n"); 168 - goto err; 169 - } 188 + ret = reset_control_assert(hibrst); 189 + if (ret < 0) { 190 + dev_err(dev, "Failed to assert hibernation reset\n"); 191 + goto err; 192 + } 170 193 171 - ret = reset_control_assert(apbrst); 172 - if (ret < 0) { 173 - dev_err(dev, "Failed to assert APB reset\n"); 174 - goto err; 194 + ret = reset_control_assert(apbrst); 195 + if (ret < 0) { 196 + dev_err(dev, "Failed to assert APB reset\n"); 197 + goto err; 198 + } 175 199 } 176 200 177 201 ret = phy_init(priv_data->usb3_phy); ··· 195 201 goto err; 196 202 } 197 203 198 - /* Set PIPE Power Present signal in FPD Power Present Register*/ 199 - writel(FPD_POWER_PRSNT_OPTION, priv_data->regs + XLNX_USB_FPD_POWER_PRSNT); 200 - 201 - /* Set the PIPE Clock Select bit in FPD PIPE Clock register */ 202 - writel(PIPE_CLK_SELECT, priv_data->regs + XLNX_USB_FPD_PIPE_CLK); 204 + if (priv_data->usb3_phy) { 205 + /* Set PIPE Power Present signal in FPD Power Present Register*/ 206 + writel(FPD_POWER_PRSNT_OPTION, priv_data->regs + XLNX_USB_FPD_POWER_PRSNT); 207 + /* Set the PIPE Clock Select bit in FPD PIPE Clock register */ 208 + writel(PIPE_CLK_SELECT, priv_data->regs + XLNX_USB_FPD_PIPE_CLK); 209 + } else { 210 + /* Deselect the PIPE Clock Select bit in FPD PIPE Clock register */ 211 + writel(PIPE_CLK_DESELECT, priv_data->regs + XLNX_USB_FPD_PIPE_CLK); 212 + } 203 213 204 214 ret = reset_control_deassert(crst); 205 215 if (ret < 0) { ··· 223 225 goto err; 224 226 } 225 227 226 - skip_usb3_phy: 227 228 /* ulpi reset via gpio-modepin or gpio-framework driver */ 228 229 reset_gpio = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_HIGH); 229 230 if (IS_ERR(reset_gpio)) {