aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/dwc3
diff options
context:
space:
mode:
authorVivek Gautam <gautam.vivek@samsung.com>2014-04-21 08:16:44 -0400
committerFelipe Balbi <balbi@ti.com>2014-04-21 15:07:30 -0400
commitbd8ce544ec35ff362489a7e3c059cf496c06c68e (patch)
tree36fad657368041c05f254218ff47b475ece34458 /drivers/usb/dwc3
parent5b7839836109a802b144a05cfbd4f57e6564d8e5 (diff)
usb: dwc3: exynos: Make provision for vdd regulators
Facilitate getting required 3.3V and 1.0V VDD supply for DWC3 controller on Exynos. With patches for regulators' nodes merged in 3.15: c8c253f ARM: dts: Add regulator entries to smdk5420 275dcd2 ARM: dts: add max77686 pmic node for smdk5250, certain perripherals will now need to ensure that, they request VDD regulators in their drivers, and enable them so as to make them working. Signed-off-by: Vivek Gautam <gautam.vivek@samsung.com> Cc: Anton Tikhomirov <av.tikhomirov@samsung.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers/usb/dwc3')
-rw-r--r--drivers/usb/dwc3/dwc3-exynos.c51
1 files changed, 49 insertions, 2 deletions
diff --git a/drivers/usb/dwc3/dwc3-exynos.c b/drivers/usb/dwc3/dwc3-exynos.c
index ed22d722884e..0ed85834bfec 100644
--- a/drivers/usb/dwc3/dwc3-exynos.c
+++ b/drivers/usb/dwc3/dwc3-exynos.c
@@ -27,6 +27,7 @@
27#include <linux/usb/usb_phy_generic.h> 27#include <linux/usb/usb_phy_generic.h>
28#include <linux/of.h> 28#include <linux/of.h>
29#include <linux/of_platform.h> 29#include <linux/of_platform.h>
30#include <linux/regulator/consumer.h>
30 31
31struct dwc3_exynos { 32struct dwc3_exynos {
32 struct platform_device *usb2_phy; 33 struct platform_device *usb2_phy;
@@ -34,6 +35,8 @@ struct dwc3_exynos {
34 struct device *dev; 35 struct device *dev;
35 36
36 struct clk *clk; 37 struct clk *clk;
38 struct regulator *vdd33;
39 struct regulator *vdd10;
37}; 40};
38 41
39static int dwc3_exynos_register_phys(struct dwc3_exynos *exynos) 42static int dwc3_exynos_register_phys(struct dwc3_exynos *exynos)
@@ -144,20 +147,46 @@ static int dwc3_exynos_probe(struct platform_device *pdev)
144 147
145 clk_prepare_enable(exynos->clk); 148 clk_prepare_enable(exynos->clk);
146 149
150 exynos->vdd33 = devm_regulator_get(dev, "vdd33");
151 if (IS_ERR(exynos->vdd33)) {
152 ret = PTR_ERR(exynos->vdd33);
153 goto err2;
154 }
155 ret = regulator_enable(exynos->vdd33);
156 if (ret) {
157 dev_err(dev, "Failed to enable VDD33 supply\n");
158 goto err2;
159 }
160
161 exynos->vdd10 = devm_regulator_get(dev, "vdd10");
162 if (IS_ERR(exynos->vdd10)) {
163 ret = PTR_ERR(exynos->vdd10);
164 goto err3;
165 }
166 ret = regulator_enable(exynos->vdd10);
167 if (ret) {
168 dev_err(dev, "Failed to enable VDD10 supply\n");
169 goto err3;
170 }
171
147 if (node) { 172 if (node) {
148 ret = of_platform_populate(node, NULL, NULL, dev); 173 ret = of_platform_populate(node, NULL, NULL, dev);
149 if (ret) { 174 if (ret) {
150 dev_err(dev, "failed to add dwc3 core\n"); 175 dev_err(dev, "failed to add dwc3 core\n");
151 goto err2; 176 goto err4;
152 } 177 }
153 } else { 178 } else {
154 dev_err(dev, "no device node, failed to add dwc3 core\n"); 179 dev_err(dev, "no device node, failed to add dwc3 core\n");
155 ret = -ENODEV; 180 ret = -ENODEV;
156 goto err2; 181 goto err4;
157 } 182 }
158 183
159 return 0; 184 return 0;
160 185
186err4:
187 regulator_disable(exynos->vdd10);
188err3:
189 regulator_disable(exynos->vdd33);
161err2: 190err2:
162 clk_disable_unprepare(clk); 191 clk_disable_unprepare(clk);
163err1: 192err1:
@@ -174,6 +203,9 @@ static int dwc3_exynos_remove(struct platform_device *pdev)
174 203
175 clk_disable_unprepare(exynos->clk); 204 clk_disable_unprepare(exynos->clk);
176 205
206 regulator_disable(exynos->vdd33);
207 regulator_disable(exynos->vdd10);
208
177 return 0; 209 return 0;
178} 210}
179 211
@@ -192,12 +224,27 @@ static int dwc3_exynos_suspend(struct device *dev)
192 224
193 clk_disable(exynos->clk); 225 clk_disable(exynos->clk);
194 226
227 regulator_disable(exynos->vdd33);
228 regulator_disable(exynos->vdd10);
229
195 return 0; 230 return 0;
196} 231}
197 232
198static int dwc3_exynos_resume(struct device *dev) 233static int dwc3_exynos_resume(struct device *dev)
199{ 234{
200 struct dwc3_exynos *exynos = dev_get_drvdata(dev); 235 struct dwc3_exynos *exynos = dev_get_drvdata(dev);
236 int ret;
237
238 ret = regulator_enable(exynos->vdd33);
239 if (ret) {
240 dev_err(dev, "Failed to enable VDD33 supply\n");
241 return ret;
242 }
243 ret = regulator_enable(exynos->vdd10);
244 if (ret) {
245 dev_err(dev, "Failed to enable VDD10 supply\n");
246 return ret;
247 }
201 248
202 clk_enable(exynos->clk); 249 clk_enable(exynos->clk);
203 250