Message ID | 20221212172804.1277751-7-biju.das.jz@bp.renesas.com (mailing list archive) |
---|---|
State | Accepted |
Commit | 224eb5311d6a8c180932465873d809b48a2470bf |
Headers | show |
Series | ADD USB3.1 HOST, Peri and DRD support | expand |
Hi Biju, CC Justin On Mon, Dec 12, 2022 at 6:28 PM Biju Das <biju.das.jz@bp.renesas.com> wrote: > Add optional reset support. This is in preparation to adding USB xHCI > support for RZ/V2M SoC. > > Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>\ Thanks for your patch! > --- a/drivers/usb/host/xhci-plat.c > +++ b/drivers/usb/host/xhci-plat.c > @@ -19,6 +19,7 @@ > #include <linux/slab.h> > #include <linux/acpi.h> > #include <linux/usb/of.h> > +#include <linux/reset.h> > > #include "xhci.h" > #include "xhci-plat.h" > @@ -263,10 +264,20 @@ static int xhci_plat_probe(struct platform_device *pdev) > goto put_hcd; > } > > - ret = clk_prepare_enable(xhci->reg_clk); > + xhci->reset = devm_reset_control_array_get_optional_shared(&pdev->dev); > + if (IS_ERR(xhci->reset)) { > + ret = PTR_ERR(xhci->reset); > + goto put_hcd; > + } > + > + ret = reset_control_deassert(xhci->reset); > if (ret) > goto put_hcd; > > + ret = clk_prepare_enable(xhci->reg_clk); > + if (ret) > + goto err_reset; > + > ret = clk_prepare_enable(xhci->clk); > if (ret) > goto disable_reg_clk; > @@ -377,6 +388,9 @@ static int xhci_plat_probe(struct platform_device *pdev) > disable_reg_clk: > clk_disable_unprepare(xhci->reg_clk); > > +err_reset: > + reset_control_assert(xhci->reset); > + > put_hcd: > usb_put_hcd(hcd); > > @@ -412,6 +426,7 @@ static int xhci_plat_remove(struct platform_device *dev) > > clk_disable_unprepare(clk); > clk_disable_unprepare(reg_clk); > + reset_control_assert(xhci->reset); > usb_put_hcd(hcd); > > pm_runtime_disable(&dev->dev); LGTM, so Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be> Just wondering if the reset should be (de)asserted in the suspend/resume path, too. But that can only affect the Broadcom STB platforms, which probably don't have the resets property. I can't check as there no users in upstream DTS. Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds
diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c index 11b3a0d6722d..c5fc175a5fd1 100644 --- a/drivers/usb/host/xhci-plat.c +++ b/drivers/usb/host/xhci-plat.c @@ -19,6 +19,7 @@ #include <linux/slab.h> #include <linux/acpi.h> #include <linux/usb/of.h> +#include <linux/reset.h> #include "xhci.h" #include "xhci-plat.h" @@ -263,10 +264,20 @@ static int xhci_plat_probe(struct platform_device *pdev) goto put_hcd; } - ret = clk_prepare_enable(xhci->reg_clk); + xhci->reset = devm_reset_control_array_get_optional_shared(&pdev->dev); + if (IS_ERR(xhci->reset)) { + ret = PTR_ERR(xhci->reset); + goto put_hcd; + } + + ret = reset_control_deassert(xhci->reset); if (ret) goto put_hcd; + ret = clk_prepare_enable(xhci->reg_clk); + if (ret) + goto err_reset; + ret = clk_prepare_enable(xhci->clk); if (ret) goto disable_reg_clk; @@ -377,6 +388,9 @@ static int xhci_plat_probe(struct platform_device *pdev) disable_reg_clk: clk_disable_unprepare(xhci->reg_clk); +err_reset: + reset_control_assert(xhci->reset); + put_hcd: usb_put_hcd(hcd); @@ -412,6 +426,7 @@ static int xhci_plat_remove(struct platform_device *dev) clk_disable_unprepare(clk); clk_disable_unprepare(reg_clk); + reset_control_assert(xhci->reset); usb_put_hcd(hcd); pm_runtime_disable(&dev->dev);
Add optional reset support. This is in preparation to adding USB xHCI support for RZ/V2M SoC. Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com> --- drivers/usb/host/xhci-plat.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-)