aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPraneeth Bajjuri2016-11-22 14:25:50 -0600
committerPraneeth Bajjuri2016-11-22 14:25:50 -0600
commit0863d506697a18c6fdbe62a185d5238582f2dcf8 (patch)
tree67d4d0bf99dd1c0a4e373c42cbbb7275f1b0fd84
parentc8daf57ae0f7c53a5f8c292d53472985a4521ca1 (diff)
parent6c5519b6fc09274d28d653a9a3cabf7dc74883ca (diff)
downloadu-boot-0863d506697a18c6fdbe62a185d5238582f2dcf8.tar.gz
u-boot-0863d506697a18c6fdbe62a185d5238582f2dcf8.tar.xz
u-boot-0863d506697a18c6fdbe62a185d5238582f2dcf8.zip
Merge branch 'ti-u-boot-2016.05' of git://git.ti.com/ti-u-boot/ti-u-boot into p-ti-u-boot-2016.05
* 'ti-u-boot-2016.05' of git://git.ti.com/ti-u-boot/ti-u-boot: Revert "power: regulator: pbias: Add pbias regulator support" Revert "ARM: dts: dra7xx: Fix broken pbias device creation" Revert "mmc: power off the IO regulator during power cycle" Revert "drivers: mmc: omap_hsmmc: use regulator APIs to program pbias" Revert "configs: enable misc and pbias options on configs for dra7 based boards" Revert "mmc: disable the mmc clock during power off" Signed-off-by: Praneeth Bajjuri <praneeth@ti.com>
-rw-r--r--arch/arm/dts/dra7.dtsi2
-rw-r--r--configs/am57xx_evm_defconfig2
-rw-r--r--configs/am57xx_hs_evm_defconfig2
-rw-r--r--configs/dra7xx_evm_defconfig2
-rw-r--r--configs/dra7xx_hs_evm_defconfig2
-rw-r--r--drivers/mmc/mmc.c2
-rw-r--r--drivers/mmc/omap_hsmmc.c30
-rw-r--r--drivers/power/regulator/Kconfig8
-rw-r--r--drivers/power/regulator/Makefile1
-rw-r--r--drivers/power/regulator/pbias_regulator.c220
10 files changed, 2 insertions, 269 deletions
diff --git a/arch/arm/dts/dra7.dtsi b/arch/arm/dts/dra7.dtsi
index 5d91eb5865..ec8de7a116 100644
--- a/arch/arm/dts/dra7.dtsi
+++ b/arch/arm/dts/dra7.dtsi
@@ -117,7 +117,7 @@
117 ranges = <0 0x2000 0x2000>; 117 ranges = <0 0x2000 0x2000>;
118 118
119 scm_conf: scm_conf@0 { 119 scm_conf: scm_conf@0 {
120 compatible = "syscon", "simple-bus"; 120 compatible = "syscon";
121 reg = <0x0 0x1400>; 121 reg = <0x0 0x1400>;
122 #address-cells = <1>; 122 #address-cells = <1>;
123 #size-cells = <1>; 123 #size-cells = <1>;
diff --git a/configs/am57xx_evm_defconfig b/configs/am57xx_evm_defconfig
index 0872b993b7..9ee8312790 100644
--- a/configs/am57xx_evm_defconfig
+++ b/configs/am57xx_evm_defconfig
@@ -56,13 +56,11 @@ CONFIG_DRA7_IVA_OPP_HIGH=y
56CONFIG_DRA7_GPU_OPP_HIGH=y 56CONFIG_DRA7_GPU_OPP_HIGH=y
57CONFIG_DISK=y 57CONFIG_DISK=y
58CONFIG_DWC_AHCI=y 58CONFIG_DWC_AHCI=y
59CONFIG_MISC=y
60CONFIG_DM_ETH=y 59CONFIG_DM_ETH=y
61CONFIG_DM_PMIC=y 60CONFIG_DM_PMIC=y
62CONFIG_PMIC_PALMAS=y 61CONFIG_PMIC_PALMAS=y
63CONFIG_DM_REGULATOR=y 62CONFIG_DM_REGULATOR=y
64CONFIG_DM_REGULATOR_PALMAS=y 63CONFIG_DM_REGULATOR_PALMAS=y
65CONFIG_DM_REGULATOR_PBIAS=y
66CONFIG_CMD_TIME=y 64CONFIG_CMD_TIME=y
67CONFIG_USB=y 65CONFIG_USB=y
68CONFIG_USB_DWC3=y 66CONFIG_USB_DWC3=y
diff --git a/configs/am57xx_hs_evm_defconfig b/configs/am57xx_hs_evm_defconfig
index cd824d1b3c..8376f30da6 100644
--- a/configs/am57xx_hs_evm_defconfig
+++ b/configs/am57xx_hs_evm_defconfig
@@ -61,14 +61,12 @@ CONFIG_DRA7_IVA_OPP_HIGH=y
61CONFIG_DRA7_GPU_OPP_HIGH=y 61CONFIG_DRA7_GPU_OPP_HIGH=y
62CONFIG_DISK=y 62CONFIG_DISK=y
63CONFIG_DWC_AHCI=y 63CONFIG_DWC_AHCI=y
64CONFIG_MISC=y
65CONFIG_DM_ETH=y 64CONFIG_DM_ETH=y
66CONFIG_DM_PMIC=y 65CONFIG_DM_PMIC=y
67CONFIG_PMIC_PALMAS=y 66CONFIG_PMIC_PALMAS=y
68CONFIG_DM_REGULATOR=y 67CONFIG_DM_REGULATOR=y
69CONFIG_DM_REGULATOR_GPIO=y 68CONFIG_DM_REGULATOR_GPIO=y
70CONFIG_DM_REGULATOR_PALMAS=y 69CONFIG_DM_REGULATOR_PALMAS=y
71CONFIG_DM_REGULATOR_PBIAS=y
72CONFIG_CMD_TIME=y 70CONFIG_CMD_TIME=y
73CONFIG_CMD_PMIC=y 71CONFIG_CMD_PMIC=y
74CONFIG_CMD_REGULATOR=y 72CONFIG_CMD_REGULATOR=y
diff --git a/configs/dra7xx_evm_defconfig b/configs/dra7xx_evm_defconfig
index 44c148d97b..28f0339790 100644
--- a/configs/dra7xx_evm_defconfig
+++ b/configs/dra7xx_evm_defconfig
@@ -55,7 +55,6 @@ CONFIG_PMIC_PALMAS=y
55CONFIG_PMIC_LP873X=y 55CONFIG_PMIC_LP873X=y
56CONFIG_DISK=y 56CONFIG_DISK=y
57CONFIG_DWC_AHCI=y 57CONFIG_DWC_AHCI=y
58CONFIG_MISC=y
59CONFIG_DM_MMC=y 58CONFIG_DM_MMC=y
60CONFIG_USB_GADGET_DOWNLOAD=y 59CONFIG_USB_GADGET_DOWNLOAD=y
61CONFIG_G_DNL_MANUFACTURER="Texas Instruments" 60CONFIG_G_DNL_MANUFACTURER="Texas Instruments"
@@ -75,4 +74,3 @@ CONFIG_LATE_ATTACH_GPT_PART=n
75CONFIG_DM_REGULATOR_GPIO=y 74CONFIG_DM_REGULATOR_GPIO=y
76CONFIG_DM_REGULATOR_PALMAS=y 75CONFIG_DM_REGULATOR_PALMAS=y
77CONFIG_DM_REGULATOR_LP873X=y 76CONFIG_DM_REGULATOR_LP873X=y
78CONFIG_DM_REGULATOR_PBIAS=y
diff --git a/configs/dra7xx_hs_evm_defconfig b/configs/dra7xx_hs_evm_defconfig
index a62dfcf416..d5b8e30b3b 100644
--- a/configs/dra7xx_hs_evm_defconfig
+++ b/configs/dra7xx_hs_evm_defconfig
@@ -61,7 +61,6 @@ CONFIG_PMIC_PALMAS=y
61CONFIG_PMIC_LP873X=y 61CONFIG_PMIC_LP873X=y
62CONFIG_DISK=y 62CONFIG_DISK=y
63CONFIG_DWC_AHCI=y 63CONFIG_DWC_AHCI=y
64CONFIG_MISC=y
65CONFIG_USB_GADGET_DOWNLOAD=y 64CONFIG_USB_GADGET_DOWNLOAD=y
66CONFIG_G_DNL_MANUFACTURER="Texas Instruments" 65CONFIG_G_DNL_MANUFACTURER="Texas Instruments"
67CONFIG_G_DNL_VENDOR_NUM=0x0451 66CONFIG_G_DNL_VENDOR_NUM=0x0451
@@ -80,6 +79,5 @@ CONFIG_DM_REGULATOR_FIXED=y
80CONFIG_DM_REGULATOR_GPIO=y 79CONFIG_DM_REGULATOR_GPIO=y
81CONFIG_DM_REGULATOR_PALMAS=y 80CONFIG_DM_REGULATOR_PALMAS=y
82CONFIG_DM_REGULATOR_LP873X=y 81CONFIG_DM_REGULATOR_LP873X=y
83CONFIG_DM_REGULATOR_PBIAS=y
84CONFIG_SPL_FIT_IMAGE_POST_PROCESS=y 82CONFIG_SPL_FIT_IMAGE_POST_PROCESS=y
85CONFIG_FIT_IMAGE_POST_PROCESS=y 83CONFIG_FIT_IMAGE_POST_PROCESS=y
diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
index 84515a7183..1255abcf78 100644
--- a/drivers/mmc/mmc.c
+++ b/drivers/mmc/mmc.c
@@ -2056,9 +2056,7 @@ static void mmc_power_up(struct mmc *mmc)
2056 2056
2057static void mmc_power_off(struct mmc *mmc) 2057static void mmc_power_off(struct mmc *mmc)
2058{ 2058{
2059 mmc_set_signal_voltage(mmc, 0);
2060 mmc_set_vdd(mmc, false); 2059 mmc_set_vdd(mmc, false);
2061 mmc_set_clock(mmc, 1, true);
2062} 2060}
2063 2061
2064static void mmc_power_cycle(struct mmc *mmc) 2062static void mmc_power_cycle(struct mmc *mmc)
diff --git a/drivers/mmc/omap_hsmmc.c b/drivers/mmc/omap_hsmmc.c
index ecd51e08cb..e3c64bb05b 100644
--- a/drivers/mmc/omap_hsmmc.c
+++ b/drivers/mmc/omap_hsmmc.c
@@ -93,7 +93,6 @@ struct omap_hsmmc_data {
93 char *version; 93 char *version;
94 struct udevice *vmmc_supply; 94 struct udevice *vmmc_supply;
95 struct udevice *vmmc_aux_supply; 95 struct udevice *vmmc_aux_supply;
96 struct udevice *pbias_supply;
97 ushort last_cmd; 96 ushort last_cmd;
98 uint signal_voltage; 97 uint signal_voltage;
99#ifdef CONFIG_IODELAY_RECALIBRATION 98#ifdef CONFIG_IODELAY_RECALIBRATION
@@ -438,30 +437,18 @@ static int omap_hsmmc_set_io_regulator(struct mmc *mmc, int uV)
438 if (!priv->vmmc_aux_supply) 437 if (!priv->vmmc_aux_supply)
439 return 0; 438 return 0;
440 439
441 ret = regulator_set_enable(priv->pbias_supply, false);
442 if (ret && ret != -ENOSYS)
443 return ret;
444
445 ret = regulator_set_enable(priv->vmmc_aux_supply, false); 440 ret = regulator_set_enable(priv->vmmc_aux_supply, false);
446 if (ret && ret != -ENOSYS) 441 if (ret && ret != -ENOSYS)
447 return ret; 442 return ret;
448 443
449 ret = regulator_set_value(priv->vmmc_aux_supply, uV); 444 ret = regulator_set_value(priv->vmmc_aux_supply, uV);
450 if (ret && ret != -ENOSYS) 445 if (ret)
451 return ret;
452
453 ret = regulator_set_value(priv->pbias_supply, uV);
454 if (ret && ret != -ENOSYS)
455 return ret; 446 return ret;
456 447
457 ret = regulator_set_enable(priv->vmmc_aux_supply, true); 448 ret = regulator_set_enable(priv->vmmc_aux_supply, true);
458 if (ret && ret != -ENOSYS) 449 if (ret && ret != -ENOSYS)
459 return ret; 450 return ret;
460 451
461 ret = regulator_set_enable(priv->pbias_supply, true);
462 if (ret && ret != -ENOSYS)
463 return ret;
464
465 return 0; 452 return 0;
466} 453}
467#endif 454#endif
@@ -469,9 +456,6 @@ static int omap_hsmmc_set_io_regulator(struct mmc *mmc, int uV)
469static int omap_hsmmc_set_signal_voltage(struct mmc *mmc) 456static int omap_hsmmc_set_signal_voltage(struct mmc *mmc)
470{ 457{
471 u32 val; 458 u32 val;
472#ifdef CONFIG_DM_REGULATOR
473 int ret;
474#endif
475 struct hsmmc *mmc_base; 459 struct hsmmc *mmc_base;
476 struct omap_hsmmc_data *priv = (struct omap_hsmmc_data *)mmc->priv; 460 struct omap_hsmmc_data *priv = (struct omap_hsmmc_data *)mmc->priv;
477 461
@@ -514,16 +498,6 @@ static int omap_hsmmc_set_signal_voltage(struct mmc *mmc)
514 vmmc_pbias_config(LDO_VOLT_1V8); 498 vmmc_pbias_config(LDO_VOLT_1V8);
515#endif 499#endif
516#endif 500#endif
517#ifdef CONFIG_DM_REGULATOR
518 } else if (mmc->signal_voltage == 0) {
519 ret = regulator_set_enable(priv->pbias_supply, false);
520 if (ret && ret != -ENOSYS)
521 return ret;
522
523 ret = regulator_set_enable(priv->vmmc_aux_supply, false);
524 if (ret && ret != -ENOSYS)
525 return ret;
526#endif
527 } else { 501 } else {
528 return -EOPNOTSUPP; 502 return -EOPNOTSUPP;
529 } 503 }
@@ -1825,13 +1799,11 @@ static int omap_hsmmc_probe(struct udevice *dev)
1825 return -1; 1799 return -1;
1826 1800
1827 omap_hsmmc_platform_fixup(mmc); 1801 omap_hsmmc_platform_fixup(mmc);
1828 priv->signal_voltage = -EINVAL;
1829 1802
1830#ifdef CONFIG_DM_REGULATOR 1803#ifdef CONFIG_DM_REGULATOR
1831 device_get_supply_regulator(dev, "vmmc-supply", &priv->vmmc_supply); 1804 device_get_supply_regulator(dev, "vmmc-supply", &priv->vmmc_supply);
1832 device_get_supply_regulator(dev, "vmmc_aux-supply", 1805 device_get_supply_regulator(dev, "vmmc_aux-supply",
1833 &priv->vmmc_aux_supply); 1806 &priv->vmmc_aux_supply);
1834 device_get_supply_regulator(dev, "pbias-supply", &priv->pbias_supply);
1835#endif 1807#endif
1836#ifdef OMAP_HSMMC_USE_GPIO 1808#ifdef OMAP_HSMMC_USE_GPIO
1837 gpio_request_by_name(dev, "cd-gpios", 0, &priv->cd_gpio, GPIOD_IS_IN); 1809 gpio_request_by_name(dev, "cd-gpios", 0, &priv->cd_gpio, GPIOD_IS_IN);
diff --git a/drivers/power/regulator/Kconfig b/drivers/power/regulator/Kconfig
index 235543c0f9..35af579cba 100644
--- a/drivers/power/regulator/Kconfig
+++ b/drivers/power/regulator/Kconfig
@@ -139,11 +139,3 @@ config DM_REGULATOR_LP873X
139 This enables implementation of driver-model regulator uclass 139 This enables implementation of driver-model regulator uclass
140 features for REGULATOR LP873X and the family of LP873X PMICs. 140 features for REGULATOR LP873X and the family of LP873X PMICs.
141 The driver implements get/set api for: value and enable. 141 The driver implements get/set api for: value and enable.
142
143config DM_REGULATOR_PBIAS
144 bool "Enable driver for PBIAS regulator"
145 depends on MISC
146 ---help---
147 This enables implementation of driver-model regulator uclass
148 features for REGULATOR PBIAS.
149 The driver implements regulator API for set voltage and enable.
diff --git a/drivers/power/regulator/Makefile b/drivers/power/regulator/Makefile
index 8a9c0fe392..2d350cb2fe 100644
--- a/drivers/power/regulator/Makefile
+++ b/drivers/power/regulator/Makefile
@@ -17,4 +17,3 @@ obj-$(CONFIG_DM_REGULATOR_SANDBOX) += sandbox.o
17obj-$(CONFIG_REGULATOR_TPS65090) += tps65090_regulator.o 17obj-$(CONFIG_REGULATOR_TPS65090) += tps65090_regulator.o
18obj-$(CONFIG_$(SPL_)DM_REGULATOR_PALMAS) += palmas_regulator.o 18obj-$(CONFIG_$(SPL_)DM_REGULATOR_PALMAS) += palmas_regulator.o
19obj-$(CONFIG_$(SPL_)DM_REGULATOR_LP873X) += lp873x_regulator.o 19obj-$(CONFIG_$(SPL_)DM_REGULATOR_LP873X) += lp873x_regulator.o
20obj-$(CONFIG_$(SPL_)DM_REGULATOR_PBIAS) += pbias_regulator.o
diff --git a/drivers/power/regulator/pbias_regulator.c b/drivers/power/regulator/pbias_regulator.c
deleted file mode 100644
index 9ca8acd49d..0000000000
--- a/drivers/power/regulator/pbias_regulator.c
+++ /dev/null
@@ -1,220 +0,0 @@
1/*
2 * PBIAS regulator driver
3 *
4 * Copyright (C) 2016 Texas Instruments Incorporated - http://www.ti.com/
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License as
8 * published by the Free Software Foundation version 2.
9 *
10 * This program is distributed "as is" WITHOUT ANY WARRANTY of any
11 * kind, whether express or implied; without even the implied warranty
12 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * SPDX-License-Identifier: GPL-2.0
16 */
17
18#include <config.h>
19#include <asm/io.h>
20#include <common.h>
21#include <dm.h>
22#include <dm/lists.h>
23#include <power/regulator.h>
24
25DECLARE_GLOBAL_DATA_PTR;
26
27struct pbias_reg_info {
28 u32 enable;
29 u32 enable_mask;
30 u32 disable_val;
31 u32 vmode;
32 unsigned int enable_time;
33 char *name;
34};
35
36struct pbias_regulator_data {
37 void *base;
38 struct pbias_reg_info *reg_info;
39};
40
41struct of_regulator_match {
42 const char *name;
43 void *driver_data;
44};
45
46static const struct pbias_reg_info pbias_mmc_omap2430 = {
47 .enable = BIT(1),
48 .enable_mask = BIT(1),
49 .vmode = BIT(0),
50 .disable_val = 0,
51 .enable_time = 100,
52 .name = "pbias_mmc_omap2430"
53};
54
55static const struct pbias_reg_info pbias_sim_omap3 = {
56 .enable = BIT(9),
57 .enable_mask = BIT(9),
58 .vmode = BIT(8),
59 .enable_time = 100,
60 .name = "pbias_sim_omap3"
61};
62
63static const struct pbias_reg_info pbias_mmc_omap4 = {
64 .enable = BIT(26) | BIT(22),
65 .enable_mask = BIT(26) | BIT(25) | BIT(22),
66 .disable_val = BIT(25),
67 .vmode = BIT(21),
68 .enable_time = 100,
69 .name = "pbias_mmc_omap4"
70};
71
72static const struct pbias_reg_info pbias_mmc_omap5 = {
73 .enable = BIT(27) | BIT(26),
74 .enable_mask = BIT(27) | BIT(25) | BIT(26),
75 .disable_val = BIT(25),
76 .vmode = BIT(21),
77 .enable_time = 100,
78 .name = "pbias_mmc_omap5"
79};
80
81static struct of_regulator_match pbias_matches[] = {
82 {
83 .name = "pbias_mmc_omap2430",
84 .driver_data = (void *)&pbias_mmc_omap2430
85 },
86 {
87 .name = "pbias_sim_omap3",
88 .driver_data = (void *)&pbias_sim_omap3
89 },
90 {
91 .name = "pbias_mmc_omap4",
92 .driver_data = (void *)&pbias_mmc_omap4
93 },
94 {
95 .name = "pbias_mmc_omap5",
96 .driver_data = (void *)&pbias_mmc_omap5
97 },
98};
99
100static int pbias_regulator_ofdata_to_platdata(struct udevice *dev)
101{
102 struct pbias_regulator_data *priv = dev_get_priv(dev);
103
104 priv->base = map_physmem(dev_get_addr(dev->parent), 0x4, MAP_NOCACHE);
105 if (!priv->base)
106 return -ENOMEM;
107
108 return 0;
109}
110
111static int pbias_regulator_probe(struct udevice *dev)
112{
113 int i;
114 struct dm_regulator_uclass_platdata *uc_pdata;
115 int num_matches = ARRAY_SIZE(pbias_matches);
116 struct pbias_regulator_data *priv = dev_get_priv(dev);
117
118 uc_pdata = dev_get_uclass_platdata(dev);
119
120 for (i = 0; i < num_matches; i++) {
121 struct of_regulator_match *match = &pbias_matches[i];
122 if (strcmp(match->name, uc_pdata->name))
123 continue;
124
125 priv->reg_info = match->driver_data;
126 }
127
128 return 0;
129}
130
131static int pbias_regulator_set_value(struct udevice *dev, int uV)
132{
133 u32 value = 0;
134 struct pbias_regulator_data *priv = dev_get_priv(dev);
135 struct pbias_reg_info *reg_info = priv->reg_info;
136
137 value = readl(priv->base);
138 if (uV >= 3000000)
139 value |= reg_info->vmode;
140 else
141 value &= ~reg_info->vmode;
142 writel(value, priv->base);
143
144 return 0;
145}
146
147static int pbias_regulator_set_enable(struct udevice *dev, bool enable)
148{
149 u32 value = 0;
150 struct pbias_regulator_data *priv = dev_get_priv(dev);
151 struct pbias_reg_info *reg_info = priv->reg_info;
152
153 value = readl(priv->base);
154 value &= ~reg_info->enable_mask;
155 if (enable)
156 value |= reg_info->enable;
157 else
158 value |= reg_info->disable_val;
159 writel(value, priv->base);
160 udelay(150);
161
162 return 0;
163}
164
165static const struct dm_regulator_ops pbias_regulator_ops = {
166 .set_value = pbias_regulator_set_value,
167 .set_enable = pbias_regulator_set_enable,
168};
169
170static const struct udevice_id pbias_regulator_ids[] = {
171 { .compatible = "ti,pbias-omap" },
172 { }
173};
174
175U_BOOT_DRIVER(pbias_regulator) = {
176 .name = "pbias-regulator",
177 .id = UCLASS_REGULATOR,
178 .ops = &pbias_regulator_ops,
179 .of_match = pbias_regulator_ids,
180 .probe = pbias_regulator_probe,
181 .ofdata_to_platdata = pbias_regulator_ofdata_to_platdata,
182 .priv_auto_alloc_size = sizeof(struct pbias_regulator_data),
183};
184
185static int pbias_bind(struct udevice *parent)
186{
187 int ret;
188 int node;
189 const void *fdt = gd->fdt_blob;
190 const char *name;
191 struct udevice *dev;
192
193 node = fdt_first_subnode(fdt, parent->of_offset);
194 if (node < 0) {
195 error("pbias regulator not found\n");
196 return -ENODEV;
197 }
198
199 name = fdt_get_name(fdt, node, NULL);
200 ret = device_bind_driver_to_node(parent, "pbias-regulator", name, node,
201 &dev);
202 if (ret) {
203 error("pbias regulator not bound to driver\n");
204 return ret;
205 }
206
207 return 0;
208}
209
210static const struct udevice_id pbias_ids[] = {
211 { .compatible = "ti,pbias-omap" },
212 { }
213};
214
215U_BOOT_DRIVER(pbias) = {
216 .name = "pbias",
217 .id = UCLASS_MISC,
218 .of_match = pbias_ids,
219 .bind = pbias_bind,
220};