usb: Add support for reset controller framework
The current api which performs the clock reset is moved to use the reset
framework, so support the changes in USB driver for the same. The reset
framework requires to get reset handle and perform assert/deassert of the
resets.
Change-Id: Ifcde1c6af624294cbd1944eaa9b526dd6dcc51de
Signed-off-by: Amit Nischal <anischal@codeaurora.org>
Signed-off-by: Mayank Rana <mrana@codeaurora.org>
diff --git a/drivers/usb/phy/phy-msm-qusb.c b/drivers/usb/phy/phy-msm-qusb.c
index e47f70b..76b034e 100644
--- a/drivers/usb/phy/phy-msm-qusb.c
+++ b/drivers/usb/phy/phy-msm-qusb.c
@@ -25,6 +25,7 @@
#include <linux/regulator/driver.h>
#include <linux/regulator/machine.h>
#include <linux/usb/phy.h>
+#include <linux/reset.h>
#define QUSB2PHY_PLL_STATUS 0x38
#define QUSB2PHY_PLL_LOCK BIT(5)
@@ -110,7 +111,7 @@
struct clk *ref_clk_src;
struct clk *ref_clk;
struct clk *cfg_ahb_clk;
- struct clk *phy_reset;
+ struct reset_control *phy_reset;
struct regulator *vdd;
struct regulator *vdda33;
@@ -398,9 +399,13 @@
}
/* Perform phy reset */
- clk_reset(qphy->phy_reset, CLK_RESET_ASSERT);
+ ret = reset_control_assert(qphy->phy_reset);
+ if (ret)
+ dev_err(phy->dev, "%s: phy_reset assert failed\n", __func__);
usleep_range(100, 150);
- clk_reset(qphy->phy_reset, CLK_RESET_DEASSERT);
+ ret = reset_control_deassert(qphy->phy_reset);
+ if (ret)
+ dev_err(phy->dev, "%s: phy_reset deassert failed\n", __func__);
if (qphy->emulation) {
if (qphy->emu_init_seq)
@@ -837,7 +842,7 @@
if (IS_ERR(qphy->cfg_ahb_clk))
return PTR_ERR(qphy->cfg_ahb_clk);
- qphy->phy_reset = devm_clk_get(dev, "phy_reset");
+ qphy->phy_reset = devm_reset_control_get(dev, "phy_reset");
if (IS_ERR(qphy->phy_reset))
return PTR_ERR(qphy->phy_reset);
@@ -990,8 +995,11 @@
* not used, there is leakage current seen with QUSB PHY related voltage
* rail. Hence keep QUSB PHY into reset state explicitly here.
*/
- if (hold_phy_reset)
- clk_reset(qphy->phy_reset, CLK_RESET_ASSERT);
+ if (hold_phy_reset) {
+ ret = reset_control_assert(qphy->phy_reset);
+ if (ret)
+ dev_err(dev, "%s:phy_reset assert failed\n", __func__);
+ }
ret = usb_add_phy_dev(&qphy->phy);
if (ret)