Commit ad63ebfc authored by Roger Quadros's avatar Roger Quadros Committed by Felipe Balbi

usb: phy: nop: Handle RESET for the PHY

We expect the RESET line to be modeled as a regulator with supply
name "reset". The regulator should be modeled such that enabling
the regulator brings the PHY device out of RESET and disabling the
regulator holds the device in RESET.

They PHY will be held in RESET in .shutdown() and brought out of
RESET in .init().
Signed-off-by: default avatarRoger Quadros <rogerq@ti.com>
Signed-off-by: default avatarFelipe Balbi <balbi@ti.com>
parent 58f735fe
...@@ -40,6 +40,7 @@ struct nop_usb_xceiv { ...@@ -40,6 +40,7 @@ struct nop_usb_xceiv {
struct device *dev; struct device *dev;
struct clk *clk; struct clk *clk;
struct regulator *vcc; struct regulator *vcc;
struct regulator *reset;
}; };
static struct platform_device *pd; static struct platform_device *pd;
...@@ -80,6 +81,12 @@ static int nop_init(struct usb_phy *phy) ...@@ -80,6 +81,12 @@ static int nop_init(struct usb_phy *phy)
if (!IS_ERR(nop->clk)) if (!IS_ERR(nop->clk))
clk_enable(nop->clk); clk_enable(nop->clk);
if (!IS_ERR(nop->reset)) {
/* De-assert RESET */
if (regulator_enable(nop->reset))
dev_err(phy->dev, "Failed to de-assert reset\n");
}
return 0; return 0;
} }
...@@ -87,6 +94,12 @@ static void nop_shutdown(struct usb_phy *phy) ...@@ -87,6 +94,12 @@ static void nop_shutdown(struct usb_phy *phy)
{ {
struct nop_usb_xceiv *nop = dev_get_drvdata(phy->dev); struct nop_usb_xceiv *nop = dev_get_drvdata(phy->dev);
if (!IS_ERR(nop->reset)) {
/* Assert RESET */
if (regulator_disable(nop->reset))
dev_err(phy->dev, "Failed to assert reset\n");
}
if (!IS_ERR(nop->clk)) if (!IS_ERR(nop->clk))
clk_disable(nop->clk); clk_disable(nop->clk);
...@@ -172,6 +185,12 @@ static int nop_usb_xceiv_probe(struct platform_device *pdev) ...@@ -172,6 +185,12 @@ static int nop_usb_xceiv_probe(struct platform_device *pdev)
PTR_ERR(nop->vcc)); PTR_ERR(nop->vcc));
} }
nop->reset = devm_regulator_get(&pdev->dev, "reset");
if (IS_ERR(nop->reset)) {
dev_dbg(&pdev->dev, "Error getting reset regulator: %ld\n",
PTR_ERR(nop->reset));
}
nop->dev = &pdev->dev; nop->dev = &pdev->dev;
nop->phy.dev = nop->dev; nop->phy.dev = nop->dev;
nop->phy.label = "nop-xceiv"; nop->phy.label = "nop-xceiv";
......
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