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

USB: phy: nop: Defer probe if device needs VCC/RESET

Add 2 flags, needs_vcc and needs_reset to platform data.
If the flag is set and the regulator couldn't be found
then we bail out with -EPROBE_DEFER.

For device tree boot we depend on presensce of vcc-supply/
reset-supply properties to decide if we should bail out
with -EPROBE_DEFER or just continue in case the regulator
can't be found.

This is required for proper functionality in cases where the
regulator is needed but is probed later than the PHY device.
Signed-off-by: default avatarRoger Quadros <rogerq@ti.com>
Signed-off-by: default avatarFelipe Balbi <balbi@ti.com>
parent 0eba3879
...@@ -147,6 +147,8 @@ static int nop_usb_xceiv_probe(struct platform_device *pdev) ...@@ -147,6 +147,8 @@ static int nop_usb_xceiv_probe(struct platform_device *pdev)
enum usb_phy_type type = USB_PHY_TYPE_USB2; enum usb_phy_type type = USB_PHY_TYPE_USB2;
int err; int err;
u32 clk_rate = 0; u32 clk_rate = 0;
bool needs_vcc = false;
bool needs_reset = false;
nop = devm_kzalloc(&pdev->dev, sizeof(*nop), GFP_KERNEL); nop = devm_kzalloc(&pdev->dev, sizeof(*nop), GFP_KERNEL);
if (!nop) if (!nop)
...@@ -163,9 +165,14 @@ static int nop_usb_xceiv_probe(struct platform_device *pdev) ...@@ -163,9 +165,14 @@ static int nop_usb_xceiv_probe(struct platform_device *pdev)
if (of_property_read_u32(node, "clock-frequency", &clk_rate)) if (of_property_read_u32(node, "clock-frequency", &clk_rate))
clk_rate = 0; clk_rate = 0;
needs_vcc = of_property_read_bool(node, "vcc-supply");
needs_reset = of_property_read_bool(node, "reset-supply");
} else if (pdata) { } else if (pdata) {
type = pdata->type; type = pdata->type;
clk_rate = pdata->clk_rate; clk_rate = pdata->clk_rate;
needs_vcc = pdata->needs_vcc;
needs_reset = pdata->needs_reset;
} }
nop->clk = devm_clk_get(&pdev->dev, "main_clk"); nop->clk = devm_clk_get(&pdev->dev, "main_clk");
...@@ -194,12 +201,16 @@ static int nop_usb_xceiv_probe(struct platform_device *pdev) ...@@ -194,12 +201,16 @@ static int nop_usb_xceiv_probe(struct platform_device *pdev)
if (IS_ERR(nop->vcc)) { if (IS_ERR(nop->vcc)) {
dev_dbg(&pdev->dev, "Error getting vcc regulator: %ld\n", dev_dbg(&pdev->dev, "Error getting vcc regulator: %ld\n",
PTR_ERR(nop->vcc)); PTR_ERR(nop->vcc));
if (needs_vcc)
return -EPROBE_DEFER;
} }
nop->reset = devm_regulator_get(&pdev->dev, "reset"); nop->reset = devm_regulator_get(&pdev->dev, "reset");
if (IS_ERR(nop->reset)) { if (IS_ERR(nop->reset)) {
dev_dbg(&pdev->dev, "Error getting reset regulator: %ld\n", dev_dbg(&pdev->dev, "Error getting reset regulator: %ld\n",
PTR_ERR(nop->reset)); PTR_ERR(nop->reset));
if (needs_reset)
return -EPROBE_DEFER;
} }
nop->dev = &pdev->dev; nop->dev = &pdev->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