diff options
author | Peter Chen <peter.chen@freescale.com> | 2013-10-29 21:19:29 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-10-30 12:41:49 -0400 |
commit | c2ec3a732a6bb65635693f6d86d2b7bf073b6148 (patch) | |
tree | c2a553853a36eddae6409357b82667427c780711 /drivers/usb | |
parent | 0d768fcfc01098ae0e676c78746c9f4fd8228cd7 (diff) |
usb: chipidea: only get vbus regulator for non-peripheral mode
If the user chooses peripheral mode for this controller, the vbus
regulator doesn't need to get, since the host will supply the vbus,
it can save one vbus pin for other usage.
Signed-off-by: Peter Chen <peter.chen@freescale.com>
Tested-by: Frank Li <frank.li@freescale.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb')
-rw-r--r-- | drivers/usb/chipidea/core.c | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c index 06204b77fc4c..5d8981c5235e 100644 --- a/drivers/usb/chipidea/core.c +++ b/drivers/usb/chipidea/core.c | |||
@@ -392,18 +392,6 @@ static irqreturn_t ci_irq(int irq, void *data) | |||
392 | static int ci_get_platdata(struct device *dev, | 392 | static int ci_get_platdata(struct device *dev, |
393 | struct ci_hdrc_platform_data *platdata) | 393 | struct ci_hdrc_platform_data *platdata) |
394 | { | 394 | { |
395 | /* Get the vbus regulator */ | ||
396 | platdata->reg_vbus = devm_regulator_get(dev, "vbus"); | ||
397 | if (PTR_ERR(platdata->reg_vbus) == -EPROBE_DEFER) { | ||
398 | return -EPROBE_DEFER; | ||
399 | } else if (PTR_ERR(platdata->reg_vbus) == -ENODEV) { | ||
400 | platdata->reg_vbus = NULL; /* no vbus regualator is needed */ | ||
401 | } else if (IS_ERR(platdata->reg_vbus)) { | ||
402 | dev_err(dev, "Getting regulator error: %ld\n", | ||
403 | PTR_ERR(platdata->reg_vbus)); | ||
404 | return PTR_ERR(platdata->reg_vbus); | ||
405 | } | ||
406 | |||
407 | if (!platdata->phy_mode) | 395 | if (!platdata->phy_mode) |
408 | platdata->phy_mode = of_usb_get_phy_mode(dev->of_node); | 396 | platdata->phy_mode = of_usb_get_phy_mode(dev->of_node); |
409 | 397 | ||
@@ -413,6 +401,21 @@ static int ci_get_platdata(struct device *dev, | |||
413 | if (platdata->dr_mode == USB_DR_MODE_UNKNOWN) | 401 | if (platdata->dr_mode == USB_DR_MODE_UNKNOWN) |
414 | platdata->dr_mode = USB_DR_MODE_OTG; | 402 | platdata->dr_mode = USB_DR_MODE_OTG; |
415 | 403 | ||
404 | if (platdata->dr_mode != USB_DR_MODE_PERIPHERAL) { | ||
405 | /* Get the vbus regulator */ | ||
406 | platdata->reg_vbus = devm_regulator_get(dev, "vbus"); | ||
407 | if (PTR_ERR(platdata->reg_vbus) == -EPROBE_DEFER) { | ||
408 | return -EPROBE_DEFER; | ||
409 | } else if (PTR_ERR(platdata->reg_vbus) == -ENODEV) { | ||
410 | /* no vbus regualator is needed */ | ||
411 | platdata->reg_vbus = NULL; | ||
412 | } else if (IS_ERR(platdata->reg_vbus)) { | ||
413 | dev_err(dev, "Getting regulator error: %ld\n", | ||
414 | PTR_ERR(platdata->reg_vbus)); | ||
415 | return PTR_ERR(platdata->reg_vbus); | ||
416 | } | ||
417 | } | ||
418 | |||
416 | return 0; | 419 | return 0; |
417 | } | 420 | } |
418 | 421 | ||