aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/otg/nop-usb-xceiv.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/otg/nop-usb-xceiv.c')
-rw-r--r--drivers/usb/otg/nop-usb-xceiv.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/drivers/usb/otg/nop-usb-xceiv.c b/drivers/usb/otg/nop-usb-xceiv.c
index b26b1c29194e..2b10cc969bbb 100644
--- a/drivers/usb/otg/nop-usb-xceiv.c
+++ b/drivers/usb/otg/nop-usb-xceiv.c
@@ -147,6 +147,8 @@ static int nop_usb_xceiv_probe(struct platform_device *pdev)
147 enum usb_phy_type type = USB_PHY_TYPE_USB2; 147 enum usb_phy_type type = USB_PHY_TYPE_USB2;
148 int err; 148 int err;
149 u32 clk_rate = 0; 149 u32 clk_rate = 0;
150 bool needs_vcc = false;
151 bool needs_reset = false;
150 152
151 nop = devm_kzalloc(&pdev->dev, sizeof(*nop), GFP_KERNEL); 153 nop = devm_kzalloc(&pdev->dev, sizeof(*nop), GFP_KERNEL);
152 if (!nop) 154 if (!nop)
@@ -163,9 +165,14 @@ static int nop_usb_xceiv_probe(struct platform_device *pdev)
163 if (of_property_read_u32(node, "clock-frequency", &clk_rate)) 165 if (of_property_read_u32(node, "clock-frequency", &clk_rate))
164 clk_rate = 0; 166 clk_rate = 0;
165 167
168 needs_vcc = of_property_read_bool(node, "vcc-supply");
169 needs_reset = of_property_read_bool(node, "reset-supply");
170
166 } else if (pdata) { 171 } else if (pdata) {
167 type = pdata->type; 172 type = pdata->type;
168 clk_rate = pdata->clk_rate; 173 clk_rate = pdata->clk_rate;
174 needs_vcc = pdata->needs_vcc;
175 needs_reset = pdata->needs_reset;
169 } 176 }
170 177
171 nop->clk = devm_clk_get(&pdev->dev, "main_clk"); 178 nop->clk = devm_clk_get(&pdev->dev, "main_clk");
@@ -194,12 +201,16 @@ static int nop_usb_xceiv_probe(struct platform_device *pdev)
194 if (IS_ERR(nop->vcc)) { 201 if (IS_ERR(nop->vcc)) {
195 dev_dbg(&pdev->dev, "Error getting vcc regulator: %ld\n", 202 dev_dbg(&pdev->dev, "Error getting vcc regulator: %ld\n",
196 PTR_ERR(nop->vcc)); 203 PTR_ERR(nop->vcc));
204 if (needs_vcc)
205 return -EPROBE_DEFER;
197 } 206 }
198 207
199 nop->reset = devm_regulator_get(&pdev->dev, "reset"); 208 nop->reset = devm_regulator_get(&pdev->dev, "reset");
200 if (IS_ERR(nop->reset)) { 209 if (IS_ERR(nop->reset)) {
201 dev_dbg(&pdev->dev, "Error getting reset regulator: %ld\n", 210 dev_dbg(&pdev->dev, "Error getting reset regulator: %ld\n",
202 PTR_ERR(nop->reset)); 211 PTR_ERR(nop->reset));
212 if (needs_reset)
213 return -EPROBE_DEFER;
203 } 214 }
204 215
205 nop->dev = &pdev->dev; 216 nop->dev = &pdev->dev;