aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap2/twl-common.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mach-omap2/twl-common.c')
-rw-r--r--arch/arm/mach-omap2/twl-common.c163
1 files changed, 163 insertions, 0 deletions
diff --git a/arch/arm/mach-omap2/twl-common.c b/arch/arm/mach-omap2/twl-common.c
index 4f7b24c1a264..cf80f4cad729 100644
--- a/arch/arm/mach-omap2/twl-common.c
+++ b/arch/arm/mach-omap2/twl-common.c
@@ -23,8 +23,11 @@
23#include <linux/i2c.h> 23#include <linux/i2c.h>
24#include <linux/i2c/twl.h> 24#include <linux/i2c/twl.h>
25#include <linux/gpio.h> 25#include <linux/gpio.h>
26#include <linux/regulator/machine.h>
27#include <linux/regulator/fixed.h>
26 28
27#include <plat/i2c.h> 29#include <plat/i2c.h>
30#include <plat/usb.h>
28 31
29#include "twl-common.h" 32#include "twl-common.h"
30 33
@@ -44,3 +47,163 @@ void __init omap_pmic_init(int bus, u32 clkrate,
44 47
45 omap_register_i2c_bus(bus, clkrate, &pmic_i2c_board_info, 1); 48 omap_register_i2c_bus(bus, clkrate, &pmic_i2c_board_info, 1);
46} 49}
50
51static struct twl4030_usb_data omap4_usb_pdata = {
52 .phy_init = omap4430_phy_init,
53 .phy_exit = omap4430_phy_exit,
54 .phy_power = omap4430_phy_power,
55 .phy_set_clock = omap4430_phy_set_clk,
56 .phy_suspend = omap4430_phy_suspend,
57};
58
59static struct regulator_init_data omap4_vdac_idata = {
60 .constraints = {
61 .min_uV = 1800000,
62 .max_uV = 1800000,
63 .valid_modes_mask = REGULATOR_MODE_NORMAL
64 | REGULATOR_MODE_STANDBY,
65 .valid_ops_mask = REGULATOR_CHANGE_MODE
66 | REGULATOR_CHANGE_STATUS,
67 },
68};
69
70static struct regulator_init_data omap4_vaux2_idata = {
71 .constraints = {
72 .min_uV = 1200000,
73 .max_uV = 2800000,
74 .apply_uV = true,
75 .valid_modes_mask = REGULATOR_MODE_NORMAL
76 | REGULATOR_MODE_STANDBY,
77 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
78 | REGULATOR_CHANGE_MODE
79 | REGULATOR_CHANGE_STATUS,
80 },
81};
82
83static struct regulator_init_data omap4_vaux3_idata = {
84 .constraints = {
85 .min_uV = 1000000,
86 .max_uV = 3000000,
87 .apply_uV = true,
88 .valid_modes_mask = REGULATOR_MODE_NORMAL
89 | REGULATOR_MODE_STANDBY,
90 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
91 | REGULATOR_CHANGE_MODE
92 | REGULATOR_CHANGE_STATUS,
93 },
94};
95
96static struct regulator_consumer_supply omap4_vmmc_supply[] = {
97 REGULATOR_SUPPLY("vmmc", "omap_hsmmc.0"),
98};
99
100/* VMMC1 for MMC1 card */
101static struct regulator_init_data omap4_vmmc_idata = {
102 .constraints = {
103 .min_uV = 1200000,
104 .max_uV = 3000000,
105 .apply_uV = true,
106 .valid_modes_mask = REGULATOR_MODE_NORMAL
107 | REGULATOR_MODE_STANDBY,
108 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
109 | REGULATOR_CHANGE_MODE
110 | REGULATOR_CHANGE_STATUS,
111 },
112 .num_consumer_supplies = ARRAY_SIZE(omap4_vmmc_supply),
113 .consumer_supplies = omap4_vmmc_supply,
114};
115
116static struct regulator_init_data omap4_vpp_idata = {
117 .constraints = {
118 .min_uV = 1800000,
119 .max_uV = 2500000,
120 .apply_uV = true,
121 .valid_modes_mask = REGULATOR_MODE_NORMAL
122 | REGULATOR_MODE_STANDBY,
123 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
124 | REGULATOR_CHANGE_MODE
125 | REGULATOR_CHANGE_STATUS,
126 },
127};
128
129static struct regulator_init_data omap4_vana_idata = {
130 .constraints = {
131 .min_uV = 2100000,
132 .max_uV = 2100000,
133 .valid_modes_mask = REGULATOR_MODE_NORMAL
134 | REGULATOR_MODE_STANDBY,
135 .valid_ops_mask = REGULATOR_CHANGE_MODE
136 | REGULATOR_CHANGE_STATUS,
137 },
138};
139
140static struct regulator_init_data omap4_vcxio_idata = {
141 .constraints = {
142 .min_uV = 1800000,
143 .max_uV = 1800000,
144 .valid_modes_mask = REGULATOR_MODE_NORMAL
145 | REGULATOR_MODE_STANDBY,
146 .valid_ops_mask = REGULATOR_CHANGE_MODE
147 | REGULATOR_CHANGE_STATUS,
148 },
149};
150
151static struct regulator_init_data omap4_vusb_idata = {
152 .constraints = {
153 .min_uV = 3300000,
154 .max_uV = 3300000,
155 .apply_uV = true,
156 .valid_modes_mask = REGULATOR_MODE_NORMAL
157 | REGULATOR_MODE_STANDBY,
158 .valid_ops_mask = REGULATOR_CHANGE_MODE
159 | REGULATOR_CHANGE_STATUS,
160 },
161};
162
163static struct regulator_init_data omap4_clk32kg_idata = {
164 .constraints = {
165 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
166 },
167};
168
169void __init omap4_pmic_get_config(struct twl4030_platform_data *pmic_data,
170 u32 pdata_flags, u32 regulators_flags)
171{
172 if (!pmic_data->irq_base)
173 pmic_data->irq_base = TWL6030_IRQ_BASE;
174 if (!pmic_data->irq_end)
175 pmic_data->irq_end = TWL6030_IRQ_END;
176
177 /* Common platform data configurations */
178 if (pdata_flags & TWL_COMMON_PDATA_USB && !pmic_data->usb)
179 pmic_data->usb = &omap4_usb_pdata;
180
181 /* Common regulator configurations */
182 if (regulators_flags & TWL_COMMON_REGULATOR_VDAC && !pmic_data->vdac)
183 pmic_data->vdac = &omap4_vdac_idata;
184
185 if (regulators_flags & TWL_COMMON_REGULATOR_VAUX2 && !pmic_data->vaux2)
186 pmic_data->vaux2 = &omap4_vaux2_idata;
187
188 if (regulators_flags & TWL_COMMON_REGULATOR_VAUX3 && !pmic_data->vaux3)
189 pmic_data->vaux3 = &omap4_vaux3_idata;
190
191 if (regulators_flags & TWL_COMMON_REGULATOR_VMMC && !pmic_data->vmmc)
192 pmic_data->vmmc = &omap4_vmmc_idata;
193
194 if (regulators_flags & TWL_COMMON_REGULATOR_VPP && !pmic_data->vpp)
195 pmic_data->vpp = &omap4_vpp_idata;
196
197 if (regulators_flags & TWL_COMMON_REGULATOR_VANA && !pmic_data->vana)
198 pmic_data->vana = &omap4_vana_idata;
199
200 if (regulators_flags & TWL_COMMON_REGULATOR_VCXIO && !pmic_data->vcxio)
201 pmic_data->vcxio = &omap4_vcxio_idata;
202
203 if (regulators_flags & TWL_COMMON_REGULATOR_VUSB && !pmic_data->vusb)
204 pmic_data->vusb = &omap4_vusb_idata;
205
206 if (regulators_flags & TWL_COMMON_REGULATOR_CLK32KG &&
207 !pmic_data->clk32kg)
208 pmic_data->clk32kg = &omap4_clk32kg_idata;
209}