Commit 224eb531 authored by Biju Das's avatar Biju Das Committed by Greg Kroah-Hartman

usb: host: xhci-plat: Add reset support

Add optional reset support. This is in preparation to adding USB xHCI
support for RZ/V2M SoC.
Signed-off-by: default avatarBiju Das <biju.das.jz@bp.renesas.com>
Reviewed-by: default avatarGeert Uytterhoeven <geert+renesas@glider.be>
Link: https://lore.kernel.org/r/20230121145853.4792-9-biju.das.jz@bp.renesas.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 8c6e8b09
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/acpi.h> #include <linux/acpi.h>
#include <linux/usb/of.h> #include <linux/usb/of.h>
#include <linux/reset.h>
#include "xhci.h" #include "xhci.h"
#include "xhci-plat.h" #include "xhci-plat.h"
...@@ -263,10 +264,20 @@ static int xhci_plat_probe(struct platform_device *pdev) ...@@ -263,10 +264,20 @@ static int xhci_plat_probe(struct platform_device *pdev)
goto put_hcd; 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) if (ret)
goto put_hcd; goto put_hcd;
ret = clk_prepare_enable(xhci->reg_clk);
if (ret)
goto err_reset;
ret = clk_prepare_enable(xhci->clk); ret = clk_prepare_enable(xhci->clk);
if (ret) if (ret)
goto disable_reg_clk; goto disable_reg_clk;
...@@ -377,6 +388,9 @@ static int xhci_plat_probe(struct platform_device *pdev) ...@@ -377,6 +388,9 @@ static int xhci_plat_probe(struct platform_device *pdev)
disable_reg_clk: disable_reg_clk:
clk_disable_unprepare(xhci->reg_clk); clk_disable_unprepare(xhci->reg_clk);
err_reset:
reset_control_assert(xhci->reset);
put_hcd: put_hcd:
usb_put_hcd(hcd); usb_put_hcd(hcd);
...@@ -412,6 +426,7 @@ static int xhci_plat_remove(struct platform_device *dev) ...@@ -412,6 +426,7 @@ static int xhci_plat_remove(struct platform_device *dev)
clk_disable_unprepare(clk); clk_disable_unprepare(clk);
clk_disable_unprepare(reg_clk); clk_disable_unprepare(reg_clk);
reset_control_assert(xhci->reset);
usb_put_hcd(hcd); usb_put_hcd(hcd);
pm_runtime_disable(&dev->dev); pm_runtime_disable(&dev->dev);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment