diff options
author | Fabio Baltieri <fabio.baltieri@linaro.org> | 2013-04-03 04:45:06 -0400 |
---|---|---|
committer | Felipe Balbi <balbi@ti.com> | 2013-04-03 05:00:44 -0400 |
commit | e65b36c02613764aa703ef0be0a3c2c57ea91625 (patch) | |
tree | 1e518d95b37c8f5c8a3bb5d0ce09f25f4963cb18 | |
parent | c2a0ab6bd5ccf031f87bc678152fb70befea5786 (diff) |
usb: phy: ab8500-usb: add regulator support
Add initial regulator support to ab8500-usb by introducing necessary
devm_regulator_get().
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Fabio Baltieri <fabio.baltieri@linaro.org>
Signed-off-by: Felipe Balbi <balbi@ti.com>
-rw-r--r-- | drivers/usb/phy/phy-ab8500-usb.c | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/drivers/usb/phy/phy-ab8500-usb.c b/drivers/usb/phy/phy-ab8500-usb.c index 441b2954cffd..1bc24d4c25e7 100644 --- a/drivers/usb/phy/phy-ab8500-usb.c +++ b/drivers/usb/phy/phy-ab8500-usb.c | |||
@@ -32,6 +32,7 @@ | |||
32 | #include <linux/mfd/abx500.h> | 32 | #include <linux/mfd/abx500.h> |
33 | #include <linux/mfd/abx500/ab8500.h> | 33 | #include <linux/mfd/abx500/ab8500.h> |
34 | #include <linux/usb/musb-ux500.h> | 34 | #include <linux/usb/musb-ux500.h> |
35 | #include <linux/regulator/consumer.h> | ||
35 | 36 | ||
36 | /* Bank AB8500_SYS_CTRL2_BLOCK */ | 37 | /* Bank AB8500_SYS_CTRL2_BLOCK */ |
37 | #define AB8500_MAIN_WD_CTRL_REG 0x01 | 38 | #define AB8500_MAIN_WD_CTRL_REG 0x01 |
@@ -126,6 +127,9 @@ struct ab8500_usb { | |||
126 | struct work_struct phy_dis_work; | 127 | struct work_struct phy_dis_work; |
127 | unsigned long link_status_wait; | 128 | unsigned long link_status_wait; |
128 | enum ab8500_usb_mode mode; | 129 | enum ab8500_usb_mode mode; |
130 | struct regulator *v_ape; | ||
131 | struct regulator *v_musb; | ||
132 | struct regulator *v_ulpi; | ||
129 | int previous_link_status_state; | 133 | int previous_link_status_state; |
130 | }; | 134 | }; |
131 | 135 | ||
@@ -590,6 +594,34 @@ static int ab8500_usb_set_host(struct usb_otg *otg, struct usb_bus *host) | |||
590 | return 0; | 594 | return 0; |
591 | } | 595 | } |
592 | 596 | ||
597 | static int ab8500_usb_regulator_get(struct ab8500_usb *ab) | ||
598 | { | ||
599 | int err; | ||
600 | |||
601 | ab->v_ape = devm_regulator_get(ab->dev, "v-ape"); | ||
602 | if (IS_ERR(ab->v_ape)) { | ||
603 | dev_err(ab->dev, "Could not get v-ape supply\n"); | ||
604 | err = PTR_ERR(ab->v_ape); | ||
605 | return err; | ||
606 | } | ||
607 | |||
608 | ab->v_ulpi = devm_regulator_get(ab->dev, "vddulpivio18"); | ||
609 | if (IS_ERR(ab->v_ulpi)) { | ||
610 | dev_err(ab->dev, "Could not get vddulpivio18 supply\n"); | ||
611 | err = PTR_ERR(ab->v_ulpi); | ||
612 | return err; | ||
613 | } | ||
614 | |||
615 | ab->v_musb = devm_regulator_get(ab->dev, "musb_1v8"); | ||
616 | if (IS_ERR(ab->v_musb)) { | ||
617 | dev_err(ab->dev, "Could not get musb_1v8 supply\n"); | ||
618 | err = PTR_ERR(ab->v_musb); | ||
619 | return err; | ||
620 | } | ||
621 | |||
622 | return 0; | ||
623 | } | ||
624 | |||
593 | static int ab8500_usb_irq_setup(struct platform_device *pdev, | 625 | static int ab8500_usb_irq_setup(struct platform_device *pdev, |
594 | struct ab8500_usb *ab) | 626 | struct ab8500_usb *ab) |
595 | { | 627 | { |
@@ -687,6 +719,10 @@ static int ab8500_usb_probe(struct platform_device *pdev) | |||
687 | /* all: Disable phy when called from set_host and set_peripheral */ | 719 | /* all: Disable phy when called from set_host and set_peripheral */ |
688 | INIT_WORK(&ab->phy_dis_work, ab8500_usb_phy_disable_work); | 720 | INIT_WORK(&ab->phy_dis_work, ab8500_usb_phy_disable_work); |
689 | 721 | ||
722 | err = ab8500_usb_regulator_get(ab); | ||
723 | if (err) | ||
724 | return err; | ||
725 | |||
690 | err = ab8500_usb_irq_setup(pdev, ab); | 726 | err = ab8500_usb_irq_setup(pdev, ab); |
691 | if (err < 0) | 727 | if (err < 0) |
692 | return err; | 728 | return err; |