]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - glsdk/meta-ti-glsdk.git/blob - recipes-kernel/linux/linux-3.0/pm-wip/voltdm/0023-OMAP4-Move-common-twl6030-configuration-to-twl-commo.patch
f930d58e91e5c637aa58cc49d28fb651493a5111
[glsdk/meta-ti-glsdk.git] / recipes-kernel / linux / linux-3.0 / pm-wip / voltdm / 0023-OMAP4-Move-common-twl6030-configuration-to-twl-commo.patch
1 From 4910ef6a1de6a065cee3a9d786fdb07f7f8546e6 Mon Sep 17 00:00:00 2001
2 From: Peter Ujfalusi <peter.ujfalusi@ti.com>
3 Date: Tue, 7 Jun 2011 10:26:46 +0300
4 Subject: [PATCH 023/149] OMAP4: Move common twl6030 configuration to twl-common
6 Reduce the amount of duplicated code by moving the common
7 configuration for TWL6030 (on OMAP4 platform) to the
8 twl-common file.
9 Use the omap4_pmic_get_config function from board files to
10 properly configure the PMIC with the common fields.
12 Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
13 Acked-by: Tony Lindgren <tony@atomide.com>
14 ---
15  arch/arm/mach-omap2/board-4430sdp.c    |  141 ++-------------------------
16  arch/arm/mach-omap2/board-omap4panda.c |  146 +++--------------------------
17  arch/arm/mach-omap2/twl-common.c       |  163 ++++++++++++++++++++++++++++++++
18  arch/arm/mach-omap2/twl-common.h       |   20 ++++
19  4 files changed, 205 insertions(+), 265 deletions(-)
21 diff --git a/arch/arm/mach-omap2/board-4430sdp.c b/arch/arm/mach-omap2/board-4430sdp.c
22 index d7df07e..933b25b 100644
23 --- a/arch/arm/mach-omap2/board-4430sdp.c
24 +++ b/arch/arm/mach-omap2/board-4430sdp.c
25 @@ -302,14 +302,6 @@ static struct omap_musb_board_data musb_board_data = {
26         .power                  = 100,
27  };
28  
29 -static struct twl4030_usb_data omap4_usbphy_data = {
30 -       .phy_init       = omap4430_phy_init,
31 -       .phy_exit       = omap4430_phy_exit,
32 -       .phy_power      = omap4430_phy_power,
33 -       .phy_set_clock  = omap4430_phy_set_clk,
34 -       .phy_suspend    = omap4430_phy_suspend,
35 -};
36 -
37  static struct omap2_hsmmc_info mmc[] = {
38         {
39                 .mmc            = 2,
40 @@ -332,10 +324,6 @@ static struct regulator_consumer_supply sdp4430_vaux_supply[] = {
41         REGULATOR_SUPPLY("vmmc", "omap_hsmmc.1"),
42  };
43  
44 -static struct regulator_consumer_supply sdp4430_vmmc_supply[] = {
45 -       REGULATOR_SUPPLY("vmmc", "omap_hsmmc.0"),
46 -};
47 -
48  static int omap4_twl6030_hsmmc_late_init(struct device *dev)
49  {
50         int ret = 0;
51 @@ -394,61 +382,6 @@ static struct regulator_init_data sdp4430_vaux1 = {
52         .consumer_supplies      = sdp4430_vaux_supply,
53  };
54  
55 -static struct regulator_init_data sdp4430_vaux2 = {
56 -       .constraints = {
57 -               .min_uV                 = 1200000,
58 -               .max_uV                 = 2800000,
59 -               .apply_uV               = true,
60 -               .valid_modes_mask       = REGULATOR_MODE_NORMAL
61 -                                       | REGULATOR_MODE_STANDBY,
62 -               .valid_ops_mask  = REGULATOR_CHANGE_VOLTAGE
63 -                                       | REGULATOR_CHANGE_MODE
64 -                                       | REGULATOR_CHANGE_STATUS,
65 -       },
66 -};
67 -
68 -static struct regulator_init_data sdp4430_vaux3 = {
69 -       .constraints = {
70 -               .min_uV                 = 1000000,
71 -               .max_uV                 = 3000000,
72 -               .apply_uV               = true,
73 -               .valid_modes_mask       = REGULATOR_MODE_NORMAL
74 -                                       | REGULATOR_MODE_STANDBY,
75 -               .valid_ops_mask  = REGULATOR_CHANGE_VOLTAGE
76 -                                       | REGULATOR_CHANGE_MODE
77 -                                       | REGULATOR_CHANGE_STATUS,
78 -       },
79 -};
80 -
81 -/* VMMC1 for MMC1 card */
82 -static struct regulator_init_data sdp4430_vmmc = {
83 -       .constraints = {
84 -               .min_uV                 = 1200000,
85 -               .max_uV                 = 3000000,
86 -               .apply_uV               = true,
87 -               .valid_modes_mask       = REGULATOR_MODE_NORMAL
88 -                                       | REGULATOR_MODE_STANDBY,
89 -               .valid_ops_mask  = REGULATOR_CHANGE_VOLTAGE
90 -                                       | REGULATOR_CHANGE_MODE
91 -                                       | REGULATOR_CHANGE_STATUS,
92 -       },
93 -       .num_consumer_supplies  = 1,
94 -       .consumer_supplies      = sdp4430_vmmc_supply,
95 -};
96 -
97 -static struct regulator_init_data sdp4430_vpp = {
98 -       .constraints = {
99 -               .min_uV                 = 1800000,
100 -               .max_uV                 = 2500000,
101 -               .apply_uV               = true,
102 -               .valid_modes_mask       = REGULATOR_MODE_NORMAL
103 -                                       | REGULATOR_MODE_STANDBY,
104 -               .valid_ops_mask  = REGULATOR_CHANGE_VOLTAGE
105 -                                       | REGULATOR_CHANGE_MODE
106 -                                       | REGULATOR_CHANGE_STATUS,
107 -       },
108 -};
110  static struct regulator_init_data sdp4430_vusim = {
111         .constraints = {
112                 .min_uV                 = 1200000,
113 @@ -462,74 +395,10 @@ static struct regulator_init_data sdp4430_vusim = {
114         },
115  };
116  
117 -static struct regulator_init_data sdp4430_vana = {
118 -       .constraints = {
119 -               .min_uV                 = 2100000,
120 -               .max_uV                 = 2100000,
121 -               .valid_modes_mask       = REGULATOR_MODE_NORMAL
122 -                                       | REGULATOR_MODE_STANDBY,
123 -               .valid_ops_mask  = REGULATOR_CHANGE_MODE
124 -                                       | REGULATOR_CHANGE_STATUS,
125 -       },
126 -};
128 -static struct regulator_init_data sdp4430_vcxio = {
129 -       .constraints = {
130 -               .min_uV                 = 1800000,
131 -               .max_uV                 = 1800000,
132 -               .valid_modes_mask       = REGULATOR_MODE_NORMAL
133 -                                       | REGULATOR_MODE_STANDBY,
134 -               .valid_ops_mask  = REGULATOR_CHANGE_MODE
135 -                                       | REGULATOR_CHANGE_STATUS,
136 -       },
137 -};
139 -static struct regulator_init_data sdp4430_vdac = {
140 -       .constraints = {
141 -               .min_uV                 = 1800000,
142 -               .max_uV                 = 1800000,
143 -               .valid_modes_mask       = REGULATOR_MODE_NORMAL
144 -                                       | REGULATOR_MODE_STANDBY,
145 -               .valid_ops_mask  = REGULATOR_CHANGE_MODE
146 -                                       | REGULATOR_CHANGE_STATUS,
147 -       },
148 -};
150 -static struct regulator_init_data sdp4430_vusb = {
151 -       .constraints = {
152 -               .min_uV                 = 3300000,
153 -               .max_uV                 = 3300000,
154 -               .apply_uV               = true,
155 -               .valid_modes_mask       = REGULATOR_MODE_NORMAL
156 -                                       | REGULATOR_MODE_STANDBY,
157 -               .valid_ops_mask  =      REGULATOR_CHANGE_MODE
158 -                                       | REGULATOR_CHANGE_STATUS,
159 -       },
160 -};
162 -static struct regulator_init_data sdp4430_clk32kg = {
163 -       .constraints = {
164 -               .valid_ops_mask         = REGULATOR_CHANGE_STATUS,
165 -       },
166 -};
168  static struct twl4030_platform_data sdp4430_twldata = {
169 -       .irq_base       = TWL6030_IRQ_BASE,
170 -       .irq_end        = TWL6030_IRQ_END,
172         /* Regulators */
173 -       .vmmc           = &sdp4430_vmmc,
174 -       .vpp            = &sdp4430_vpp,
175         .vusim          = &sdp4430_vusim,
176 -       .vana           = &sdp4430_vana,
177 -       .vcxio          = &sdp4430_vcxio,
178 -       .vdac           = &sdp4430_vdac,
179 -       .vusb           = &sdp4430_vusb,
180         .vaux1          = &sdp4430_vaux1,
181 -       .vaux2          = &sdp4430_vaux2,
182 -       .vaux3          = &sdp4430_vaux3,
183 -       .clk32kg        = &sdp4430_clk32kg,
184 -       .usb            = &omap4_usbphy_data
185  };
186  
187  static struct i2c_board_info __initdata sdp4430_i2c_3_boardinfo[] = {
188 @@ -547,6 +416,16 @@ static struct i2c_board_info __initdata sdp4430_i2c_4_boardinfo[] = {
189  };
190  static int __init omap4_i2c_init(void)
191  {
192 +       omap4_pmic_get_config(&sdp4430_twldata, TWL_COMMON_PDATA_USB,
193 +                       TWL_COMMON_REGULATOR_VDAC |
194 +                       TWL_COMMON_REGULATOR_VAUX2 |
195 +                       TWL_COMMON_REGULATOR_VAUX3 |
196 +                       TWL_COMMON_REGULATOR_VMMC |
197 +                       TWL_COMMON_REGULATOR_VPP |
198 +                       TWL_COMMON_REGULATOR_VANA |
199 +                       TWL_COMMON_REGULATOR_VCXIO |
200 +                       TWL_COMMON_REGULATOR_VUSB |
201 +                       TWL_COMMON_REGULATOR_CLK32KG);
202         omap4_pmic_init("twl6030", &sdp4430_twldata);
203         omap_register_i2c_bus(2, 400, NULL, 0);
204         omap_register_i2c_bus(3, 400, sdp4430_i2c_3_boardinfo,
205 diff --git a/arch/arm/mach-omap2/board-omap4panda.c b/arch/arm/mach-omap2/board-omap4panda.c
206 index ee2034e..9aaa960 100644
207 --- a/arch/arm/mach-omap2/board-omap4panda.c
208 +++ b/arch/arm/mach-omap2/board-omap4panda.c
209 @@ -154,14 +154,6 @@ static struct omap_musb_board_data musb_board_data = {
210         .power                  = 100,
211  };
212  
213 -static struct twl4030_usb_data omap4_usbphy_data = {
214 -       .phy_init       = omap4430_phy_init,
215 -       .phy_exit       = omap4430_phy_exit,
216 -       .phy_power      = omap4430_phy_power,
217 -       .phy_set_clock  = omap4430_phy_set_clk,
218 -       .phy_suspend    = omap4430_phy_suspend,
219 -};
221  static struct omap2_hsmmc_info mmc[] = {
222         {
223                 .mmc            = 1,
224 @@ -181,10 +173,6 @@ static struct omap2_hsmmc_info mmc[] = {
225         {}      /* Terminator */
226  };
227  
228 -static struct regulator_consumer_supply omap4_panda_vmmc_supply[] = {
229 -       REGULATOR_SUPPLY("vmmc", "omap_hsmmc.0"),
230 -};
232  static struct regulator_consumer_supply omap4_panda_vmmc5_supply[] = {
233         REGULATOR_SUPPLY("vmmc", "omap_hsmmc.4"),
234  };
235 @@ -269,128 +257,8 @@ static int __init omap4_twl6030_hsmmc_init(struct omap2_hsmmc_info *controllers)
236         return 0;
237  }
238  
239 -static struct regulator_init_data omap4_panda_vaux2 = {
240 -       .constraints = {
241 -               .min_uV                 = 1200000,
242 -               .max_uV                 = 2800000,
243 -               .apply_uV               = true,
244 -               .valid_modes_mask       = REGULATOR_MODE_NORMAL
245 -                                       | REGULATOR_MODE_STANDBY,
246 -               .valid_ops_mask  = REGULATOR_CHANGE_VOLTAGE
247 -                                       | REGULATOR_CHANGE_MODE
248 -                                       | REGULATOR_CHANGE_STATUS,
249 -       },
250 -};
252 -static struct regulator_init_data omap4_panda_vaux3 = {
253 -       .constraints = {
254 -               .min_uV                 = 1000000,
255 -               .max_uV                 = 3000000,
256 -               .apply_uV               = true,
257 -               .valid_modes_mask       = REGULATOR_MODE_NORMAL
258 -                                       | REGULATOR_MODE_STANDBY,
259 -               .valid_ops_mask  = REGULATOR_CHANGE_VOLTAGE
260 -                                       | REGULATOR_CHANGE_MODE
261 -                                       | REGULATOR_CHANGE_STATUS,
262 -       },
263 -};
265 -/* VMMC1 for MMC1 card */
266 -static struct regulator_init_data omap4_panda_vmmc = {
267 -       .constraints = {
268 -               .min_uV                 = 1200000,
269 -               .max_uV                 = 3000000,
270 -               .apply_uV               = true,
271 -               .valid_modes_mask       = REGULATOR_MODE_NORMAL
272 -                                       | REGULATOR_MODE_STANDBY,
273 -               .valid_ops_mask  = REGULATOR_CHANGE_VOLTAGE
274 -                                       | REGULATOR_CHANGE_MODE
275 -                                       | REGULATOR_CHANGE_STATUS,
276 -       },
277 -       .num_consumer_supplies  = ARRAY_SIZE(omap4_panda_vmmc_supply),
278 -       .consumer_supplies      = omap4_panda_vmmc_supply,
279 -};
281 -static struct regulator_init_data omap4_panda_vpp = {
282 -       .constraints = {
283 -               .min_uV                 = 1800000,
284 -               .max_uV                 = 2500000,
285 -               .apply_uV               = true,
286 -               .valid_modes_mask       = REGULATOR_MODE_NORMAL
287 -                                       | REGULATOR_MODE_STANDBY,
288 -               .valid_ops_mask  = REGULATOR_CHANGE_VOLTAGE
289 -                                       | REGULATOR_CHANGE_MODE
290 -                                       | REGULATOR_CHANGE_STATUS,
291 -       },
292 -};
294 -static struct regulator_init_data omap4_panda_vana = {
295 -       .constraints = {
296 -               .min_uV                 = 2100000,
297 -               .max_uV                 = 2100000,
298 -               .valid_modes_mask       = REGULATOR_MODE_NORMAL
299 -                                       | REGULATOR_MODE_STANDBY,
300 -               .valid_ops_mask  = REGULATOR_CHANGE_MODE
301 -                                       | REGULATOR_CHANGE_STATUS,
302 -       },
303 -};
305 -static struct regulator_init_data omap4_panda_vcxio = {
306 -       .constraints = {
307 -               .min_uV                 = 1800000,
308 -               .max_uV                 = 1800000,
309 -               .valid_modes_mask       = REGULATOR_MODE_NORMAL
310 -                                       | REGULATOR_MODE_STANDBY,
311 -               .valid_ops_mask  = REGULATOR_CHANGE_MODE
312 -                                       | REGULATOR_CHANGE_STATUS,
313 -       },
314 -};
316 -static struct regulator_init_data omap4_panda_vdac = {
317 -       .constraints = {
318 -               .min_uV                 = 1800000,
319 -               .max_uV                 = 1800000,
320 -               .valid_modes_mask       = REGULATOR_MODE_NORMAL
321 -                                       | REGULATOR_MODE_STANDBY,
322 -               .valid_ops_mask  = REGULATOR_CHANGE_MODE
323 -                                       | REGULATOR_CHANGE_STATUS,
324 -       },
325 -};
327 -static struct regulator_init_data omap4_panda_vusb = {
328 -       .constraints = {
329 -               .min_uV                 = 3300000,
330 -               .max_uV                 = 3300000,
331 -               .apply_uV               = true,
332 -               .valid_modes_mask       = REGULATOR_MODE_NORMAL
333 -                                       | REGULATOR_MODE_STANDBY,
334 -               .valid_ops_mask  =      REGULATOR_CHANGE_MODE
335 -                                       | REGULATOR_CHANGE_STATUS,
336 -       },
337 -};
339 -static struct regulator_init_data omap4_panda_clk32kg = {
340 -       .constraints = {
341 -               .valid_ops_mask         = REGULATOR_CHANGE_STATUS,
342 -       },
343 -};
345 -static struct twl4030_platform_data omap4_panda_twldata = {
346 -       .irq_base       = TWL6030_IRQ_BASE,
347 -       .irq_end        = TWL6030_IRQ_END,
349 -       /* Regulators */
350 -       .vmmc           = &omap4_panda_vmmc,
351 -       .vpp            = &omap4_panda_vpp,
352 -       .vana           = &omap4_panda_vana,
353 -       .vcxio          = &omap4_panda_vcxio,
354 -       .vdac           = &omap4_panda_vdac,
355 -       .vusb           = &omap4_panda_vusb,
356 -       .vaux2          = &omap4_panda_vaux2,
357 -       .vaux3          = &omap4_panda_vaux3,
358 -       .clk32kg        = &omap4_panda_clk32kg,
359 -       .usb            = &omap4_usbphy_data,
360 -};
361 +/* Panda board uses the common PMIC configuration */
362 +static struct twl4030_platform_data omap4_panda_twldata;
363  
364  /*
365   * Display monitor features are burnt in their EEPROM as EDID data. The EEPROM
366 @@ -404,6 +272,16 @@ static struct i2c_board_info __initdata panda_i2c_eeprom[] = {
367  
368  static int __init omap4_panda_i2c_init(void)
369  {
370 +       omap4_pmic_get_config(&omap4_panda_twldata, TWL_COMMON_PDATA_USB,
371 +                       TWL_COMMON_REGULATOR_VDAC |
372 +                       TWL_COMMON_REGULATOR_VAUX2 |
373 +                       TWL_COMMON_REGULATOR_VAUX3 |
374 +                       TWL_COMMON_REGULATOR_VMMC |
375 +                       TWL_COMMON_REGULATOR_VPP |
376 +                       TWL_COMMON_REGULATOR_VANA |
377 +                       TWL_COMMON_REGULATOR_VCXIO |
378 +                       TWL_COMMON_REGULATOR_VUSB |
379 +                       TWL_COMMON_REGULATOR_CLK32KG);
380         omap4_pmic_init("twl6030", &omap4_panda_twldata);
381         omap_register_i2c_bus(2, 400, NULL, 0);
382         /*
383 diff --git a/arch/arm/mach-omap2/twl-common.c b/arch/arm/mach-omap2/twl-common.c
384 index 4f7b24c..cf80f4c 100644
385 --- a/arch/arm/mach-omap2/twl-common.c
386 +++ b/arch/arm/mach-omap2/twl-common.c
387 @@ -23,8 +23,11 @@
388  #include <linux/i2c.h>
389  #include <linux/i2c/twl.h>
390  #include <linux/gpio.h>
391 +#include <linux/regulator/machine.h>
392 +#include <linux/regulator/fixed.h>
393  
394  #include <plat/i2c.h>
395 +#include <plat/usb.h>
396  
397  #include "twl-common.h"
398  
399 @@ -44,3 +47,163 @@ void __init omap_pmic_init(int bus, u32 clkrate,
400  
401         omap_register_i2c_bus(bus, clkrate, &pmic_i2c_board_info, 1);
402  }
404 +static struct twl4030_usb_data omap4_usb_pdata = {
405 +       .phy_init       = omap4430_phy_init,
406 +       .phy_exit       = omap4430_phy_exit,
407 +       .phy_power      = omap4430_phy_power,
408 +       .phy_set_clock  = omap4430_phy_set_clk,
409 +       .phy_suspend    = omap4430_phy_suspend,
410 +};
412 +static struct regulator_init_data omap4_vdac_idata = {
413 +       .constraints = {
414 +               .min_uV                 = 1800000,
415 +               .max_uV                 = 1800000,
416 +               .valid_modes_mask       = REGULATOR_MODE_NORMAL
417 +                                       | REGULATOR_MODE_STANDBY,
418 +               .valid_ops_mask         = REGULATOR_CHANGE_MODE
419 +                                       | REGULATOR_CHANGE_STATUS,
420 +       },
421 +};
423 +static struct regulator_init_data omap4_vaux2_idata = {
424 +       .constraints = {
425 +               .min_uV                 = 1200000,
426 +               .max_uV                 = 2800000,
427 +               .apply_uV               = true,
428 +               .valid_modes_mask       = REGULATOR_MODE_NORMAL
429 +                                       | REGULATOR_MODE_STANDBY,
430 +               .valid_ops_mask         = REGULATOR_CHANGE_VOLTAGE
431 +                                       | REGULATOR_CHANGE_MODE
432 +                                       | REGULATOR_CHANGE_STATUS,
433 +       },
434 +};
436 +static struct regulator_init_data omap4_vaux3_idata = {
437 +       .constraints = {
438 +               .min_uV                 = 1000000,
439 +               .max_uV                 = 3000000,
440 +               .apply_uV               = true,
441 +               .valid_modes_mask       = REGULATOR_MODE_NORMAL
442 +                                       | REGULATOR_MODE_STANDBY,
443 +               .valid_ops_mask         = REGULATOR_CHANGE_VOLTAGE
444 +                                       | REGULATOR_CHANGE_MODE
445 +                                       | REGULATOR_CHANGE_STATUS,
446 +       },
447 +};
449 +static struct regulator_consumer_supply omap4_vmmc_supply[] = {
450 +       REGULATOR_SUPPLY("vmmc", "omap_hsmmc.0"),
451 +};
453 +/* VMMC1 for MMC1 card */
454 +static struct regulator_init_data omap4_vmmc_idata = {
455 +       .constraints = {
456 +               .min_uV                 = 1200000,
457 +               .max_uV                 = 3000000,
458 +               .apply_uV               = true,
459 +               .valid_modes_mask       = REGULATOR_MODE_NORMAL
460 +                                       | REGULATOR_MODE_STANDBY,
461 +               .valid_ops_mask         = REGULATOR_CHANGE_VOLTAGE
462 +                                       | REGULATOR_CHANGE_MODE
463 +                                       | REGULATOR_CHANGE_STATUS,
464 +       },
465 +       .num_consumer_supplies  = ARRAY_SIZE(omap4_vmmc_supply),
466 +       .consumer_supplies      = omap4_vmmc_supply,
467 +};
469 +static struct regulator_init_data omap4_vpp_idata = {
470 +       .constraints = {
471 +               .min_uV                 = 1800000,
472 +               .max_uV                 = 2500000,
473 +               .apply_uV               = true,
474 +               .valid_modes_mask       = REGULATOR_MODE_NORMAL
475 +                                       | REGULATOR_MODE_STANDBY,
476 +               .valid_ops_mask         = REGULATOR_CHANGE_VOLTAGE
477 +                                       | REGULATOR_CHANGE_MODE
478 +                                       | REGULATOR_CHANGE_STATUS,
479 +       },
480 +};
482 +static struct regulator_init_data omap4_vana_idata = {
483 +       .constraints = {
484 +               .min_uV                 = 2100000,
485 +               .max_uV                 = 2100000,
486 +               .valid_modes_mask       = REGULATOR_MODE_NORMAL
487 +                                       | REGULATOR_MODE_STANDBY,
488 +               .valid_ops_mask         = REGULATOR_CHANGE_MODE
489 +                                       | REGULATOR_CHANGE_STATUS,
490 +       },
491 +};
493 +static struct regulator_init_data omap4_vcxio_idata = {
494 +       .constraints = {
495 +               .min_uV                 = 1800000,
496 +               .max_uV                 = 1800000,
497 +               .valid_modes_mask       = REGULATOR_MODE_NORMAL
498 +                                       | REGULATOR_MODE_STANDBY,
499 +               .valid_ops_mask         = REGULATOR_CHANGE_MODE
500 +                                       | REGULATOR_CHANGE_STATUS,
501 +       },
502 +};
504 +static struct regulator_init_data omap4_vusb_idata = {
505 +       .constraints = {
506 +               .min_uV                 = 3300000,
507 +               .max_uV                 = 3300000,
508 +               .apply_uV               = true,
509 +               .valid_modes_mask       = REGULATOR_MODE_NORMAL
510 +                                       | REGULATOR_MODE_STANDBY,
511 +               .valid_ops_mask         = REGULATOR_CHANGE_MODE
512 +                                       | REGULATOR_CHANGE_STATUS,
513 +       },
514 +};
516 +static struct regulator_init_data omap4_clk32kg_idata = {
517 +       .constraints = {
518 +               .valid_ops_mask         = REGULATOR_CHANGE_STATUS,
519 +       },
520 +};
522 +void __init omap4_pmic_get_config(struct twl4030_platform_data *pmic_data,
523 +                                 u32 pdata_flags, u32 regulators_flags)
524 +{
525 +       if (!pmic_data->irq_base)
526 +               pmic_data->irq_base = TWL6030_IRQ_BASE;
527 +       if (!pmic_data->irq_end)
528 +               pmic_data->irq_end = TWL6030_IRQ_END;
530 +       /* Common platform data configurations */
531 +       if (pdata_flags & TWL_COMMON_PDATA_USB && !pmic_data->usb)
532 +               pmic_data->usb = &omap4_usb_pdata;
534 +       /* Common regulator configurations */
535 +       if (regulators_flags & TWL_COMMON_REGULATOR_VDAC && !pmic_data->vdac)
536 +               pmic_data->vdac = &omap4_vdac_idata;
538 +       if (regulators_flags & TWL_COMMON_REGULATOR_VAUX2 && !pmic_data->vaux2)
539 +               pmic_data->vaux2 = &omap4_vaux2_idata;
541 +       if (regulators_flags & TWL_COMMON_REGULATOR_VAUX3 && !pmic_data->vaux3)
542 +               pmic_data->vaux3 = &omap4_vaux3_idata;
544 +       if (regulators_flags & TWL_COMMON_REGULATOR_VMMC && !pmic_data->vmmc)
545 +               pmic_data->vmmc = &omap4_vmmc_idata;
547 +       if (regulators_flags & TWL_COMMON_REGULATOR_VPP && !pmic_data->vpp)
548 +               pmic_data->vpp = &omap4_vpp_idata;
550 +       if (regulators_flags & TWL_COMMON_REGULATOR_VANA && !pmic_data->vana)
551 +               pmic_data->vana = &omap4_vana_idata;
553 +       if (regulators_flags & TWL_COMMON_REGULATOR_VCXIO && !pmic_data->vcxio)
554 +               pmic_data->vcxio = &omap4_vcxio_idata;
556 +       if (regulators_flags & TWL_COMMON_REGULATOR_VUSB && !pmic_data->vusb)
557 +               pmic_data->vusb = &omap4_vusb_idata;
559 +       if (regulators_flags & TWL_COMMON_REGULATOR_CLK32KG &&
560 +           !pmic_data->clk32kg)
561 +               pmic_data->clk32kg = &omap4_clk32kg_idata;
562 +}
563 diff --git a/arch/arm/mach-omap2/twl-common.h b/arch/arm/mach-omap2/twl-common.h
564 index e9fe2ab..d96c289 100644
565 --- a/arch/arm/mach-omap2/twl-common.h
566 +++ b/arch/arm/mach-omap2/twl-common.h
567 @@ -1,6 +1,23 @@
568  #ifndef __OMAP_PMIC_COMMON__
569  #define __OMAP_PMIC_COMMON__
570  
571 +#define TWL_COMMON_PDATA_USB           (1 << 0)
573 +/* Common LDO regulators for TWL4030/TWL6030 */
574 +#define TWL_COMMON_REGULATOR_VDAC      (1 << 0)
575 +#define TWL_COMMON_REGULATOR_VAUX1     (1 << 1)
576 +#define TWL_COMMON_REGULATOR_VAUX2     (1 << 2)
577 +#define TWL_COMMON_REGULATOR_VAUX3     (1 << 3)
579 +/* TWL6030 LDO regulators */
580 +#define TWL_COMMON_REGULATOR_VMMC      (1 << 4)
581 +#define TWL_COMMON_REGULATOR_VPP       (1 << 5)
582 +#define TWL_COMMON_REGULATOR_VUSIM     (1 << 6)
583 +#define TWL_COMMON_REGULATOR_VANA      (1 << 7)
584 +#define TWL_COMMON_REGULATOR_VCXIO     (1 << 8)
585 +#define TWL_COMMON_REGULATOR_VUSB      (1 << 9)
586 +#define TWL_COMMON_REGULATOR_CLK32KG   (1 << 10)
588  struct twl4030_platform_data;
589  
590  void omap_pmic_init(int bus, u32 clkrate, const char *pmic_type, int pmic_irq,
591 @@ -25,4 +42,7 @@ static inline void omap4_pmic_init(const char *pmic_type,
592         omap_pmic_init(1, 400, pmic_type, OMAP44XX_IRQ_SYS_1N, pmic_data);
593  }
594  
595 +void omap4_pmic_get_config(struct twl4030_platform_data *pmic_data,
596 +                          u32 pdata_flags, u32 regulators_flags);
598  #endif /* __OMAP_PMIC_COMMON__ */
599 -- 
600 1.6.6.1