summaryrefslogtreecommitdiffstats
path: root/drivers/usb
diff options
context:
space:
mode:
authorPeter Chen <peter.chen@freescale.com>2013-10-30 02:19:29 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-10-30 17:41:49 +0100
commitc2ec3a732a6bb65635693f6d86d2b7bf073b6148 (patch)
treec2a553853a36eddae6409357b82667427c780711 /drivers/usb
parentUSB: ehci-atmel: add usb_clk for transition to CCF (diff)
downloadlinux-c2ec3a732a6bb65635693f6d86d2b7bf073b6148.tar.xz
linux-c2ec3a732a6bb65635693f6d86d2b7bf073b6148.zip
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.c27
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)
static int ci_get_platdata(struct device *dev,
struct ci_hdrc_platform_data *platdata)
{
- /* Get the vbus regulator */
- platdata->reg_vbus = devm_regulator_get(dev, "vbus");
- if (PTR_ERR(platdata->reg_vbus) == -EPROBE_DEFER) {
- return -EPROBE_DEFER;
- } else if (PTR_ERR(platdata->reg_vbus) == -ENODEV) {
- platdata->reg_vbus = NULL; /* no vbus regualator is needed */
- } else if (IS_ERR(platdata->reg_vbus)) {
- dev_err(dev, "Getting regulator error: %ld\n",
- PTR_ERR(platdata->reg_vbus));
- return PTR_ERR(platdata->reg_vbus);
- }
-
if (!platdata->phy_mode)
platdata->phy_mode = of_usb_get_phy_mode(dev->of_node);
@@ -413,6 +401,21 @@ static int ci_get_platdata(struct device *dev,
if (platdata->dr_mode == USB_DR_MODE_UNKNOWN)
platdata->dr_mode = USB_DR_MODE_OTG;
+ if (platdata->dr_mode != USB_DR_MODE_PERIPHERAL) {
+ /* Get the vbus regulator */
+ platdata->reg_vbus = devm_regulator_get(dev, "vbus");
+ if (PTR_ERR(platdata->reg_vbus) == -EPROBE_DEFER) {
+ return -EPROBE_DEFER;
+ } else if (PTR_ERR(platdata->reg_vbus) == -ENODEV) {
+ /* no vbus regualator is needed */
+ platdata->reg_vbus = NULL;
+ } else if (IS_ERR(platdata->reg_vbus)) {
+ dev_err(dev, "Getting regulator error: %ld\n",
+ PTR_ERR(platdata->reg_vbus));
+ return PTR_ERR(platdata->reg_vbus);
+ }
+ }
+
return 0;
}