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: uhci: Add reset control support

Some SoCs, such as the Aspeed AST2700, require the UHCI controller
to be taken out of reset before it can operate. Add optional reset
control support to the UHCI platform driver.

The driver now acquires an optional reset line from device tree,
deasserts it during probe, and asserts it again in the error path
and shutdown.

Signed-off-by: Ryan Chen <ryan_chen@aspeedtech.com>
Reviewed-by: Alan Stern <stern@rowland.harvard.edu>
Link: https://lore.kernel.org/r/20250922052045.2421480-3-ryan_chen@aspeedtech.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Ryan Chen and committed by
Greg Kroah-Hartman
113ba427 19040e56

+16 -2
+1
drivers/usb/host/uhci-hcd.h
··· 445 445 short load[MAX_PHASE]; /* Periodic allocations */ 446 446 447 447 struct clk *clk; /* (optional) clock source */ 448 + struct reset_control *rsts; /* (optional) clock reset */ 448 449 449 450 /* Reset host controller */ 450 451 void (*reset_hc) (struct uhci_hcd *uhci);
+15 -2
drivers/usb/host/uhci-platform.c
··· 11 11 #include <linux/of.h> 12 12 #include <linux/device.h> 13 13 #include <linux/platform_device.h> 14 + #include <linux/reset.h> 14 15 15 16 static int uhci_platform_init(struct usb_hcd *hcd) 16 17 { ··· 133 132 goto err_rmr; 134 133 } 135 134 135 + uhci->rsts = devm_reset_control_array_get_optional_shared(&pdev->dev); 136 + if (IS_ERR(uhci->rsts)) { 137 + ret = PTR_ERR(uhci->rsts); 138 + goto err_clk; 139 + } 140 + ret = reset_control_deassert(uhci->rsts); 141 + if (ret) 142 + goto err_clk; 143 + 136 144 ret = platform_get_irq(pdev, 0); 137 145 if (ret < 0) 138 - goto err_clk; 146 + goto err_reset; 139 147 140 148 ret = usb_add_hcd(hcd, ret, IRQF_SHARED); 141 149 if (ret) 142 - goto err_clk; 150 + goto err_reset; 143 151 144 152 device_wakeup_enable(hcd->self.controller); 145 153 return 0; 146 154 155 + err_reset: 156 + reset_control_assert(uhci->rsts); 147 157 err_clk: 148 158 clk_disable_unprepare(uhci->clk); 149 159 err_rmr: ··· 168 156 struct usb_hcd *hcd = platform_get_drvdata(pdev); 169 157 struct uhci_hcd *uhci = hcd_to_uhci(hcd); 170 158 159 + reset_control_assert(uhci->rsts); 171 160 clk_disable_unprepare(uhci->clk); 172 161 usb_remove_hcd(hcd); 173 162 usb_put_hcd(hcd);