x86/xen: resume timer irqs early
[linux/fpc-iii.git] / arch / arm / mach-ux500 / board-mop500-regulators.c
blob0dc44c6834273ecf915b7a6a920db3bc6b565aa4
1 /*
2 * Copyright (C) ST-Ericsson SA 2010
4 * License Terms: GNU General Public License v2
6 * Authors: Sundar Iyer <sundar.iyer@stericsson.com>
7 * Bengt Jonsson <bengt.g.jonsson@stericsson.com>
8 * Daniel Willerud <daniel.willerud@stericsson.com>
10 * MOP500 board specific initialization for regulators
12 #include <linux/kernel.h>
13 #include <linux/regulator/machine.h>
14 #include <linux/regulator/ab8500.h>
15 #include "board-mop500-regulators.h"
16 #include "id.h"
18 static struct regulator_consumer_supply gpio_en_3v3_consumers[] = {
19 REGULATOR_SUPPLY("vdd33a", "smsc911x.0"),
22 struct regulator_init_data gpio_en_3v3_regulator = {
23 .constraints = {
24 .name = "EN-3V3",
25 .min_uV = 3300000,
26 .max_uV = 3300000,
27 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
29 .num_consumer_supplies = ARRAY_SIZE(gpio_en_3v3_consumers),
30 .consumer_supplies = gpio_en_3v3_consumers,
33 static struct regulator_consumer_supply sdi0_reg_consumers[] = {
34 REGULATOR_SUPPLY("vqmmc", "sdi0"),
37 struct regulator_init_data sdi0_reg_init_data = {
38 .constraints = {
39 .min_uV = 1800000,
40 .max_uV = 2900000,
41 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE|REGULATOR_CHANGE_STATUS,
43 .num_consumer_supplies = ARRAY_SIZE(sdi0_reg_consumers),
44 .consumer_supplies = sdi0_reg_consumers,
48 * TPS61052 regulator
50 static struct regulator_consumer_supply tps61052_vaudio_consumers[] = {
52 * Boost converter supply to raise voltage on audio speaker, this
53 * is actually connected to three pins, VInVhfL (left amplifier)
54 * VInVhfR (right amplifier) and VIntDClassInt - all three must
55 * be connected to the same voltage.
57 REGULATOR_SUPPLY("vintdclassint", "ab8500-codec.0"),
60 struct regulator_init_data tps61052_regulator = {
61 .constraints = {
62 .name = "vaudio-hf",
63 .min_uV = 4500000,
64 .max_uV = 4500000,
65 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
67 .num_consumer_supplies = ARRAY_SIZE(tps61052_vaudio_consumers),
68 .consumer_supplies = tps61052_vaudio_consumers,
71 static struct regulator_consumer_supply ab8500_vaux1_consumers[] = {
72 /* Main display, u8500 R3 uib */
73 REGULATOR_SUPPLY("vddi", "mcde_disp_sony_acx424akp.0"),
74 /* Main display, u8500 uib and ST uib */
75 REGULATOR_SUPPLY("vdd1", "samsung_s6d16d0.0"),
76 /* Secondary display, ST uib */
77 REGULATOR_SUPPLY("vdd1", "samsung_s6d16d0.1"),
78 /* SFH7741 proximity sensor */
79 REGULATOR_SUPPLY("vcc", "gpio-keys.0"),
80 /* BH1780GLS ambient light sensor */
81 REGULATOR_SUPPLY("vcc", "2-0029"),
82 /* lsm303dlh accelerometer */
83 REGULATOR_SUPPLY("vdd", "2-0018"),
84 /* lsm303dlhc accelerometer */
85 REGULATOR_SUPPLY("vdd", "2-0019"),
86 /* lsm303dlh magnetometer */
87 REGULATOR_SUPPLY("vdd", "2-001e"),
88 /* Rohm BU21013 Touchscreen devices */
89 REGULATOR_SUPPLY("avdd", "3-005c"),
90 REGULATOR_SUPPLY("avdd", "3-005d"),
91 /* Synaptics RMI4 Touchscreen device */
92 REGULATOR_SUPPLY("vdd", "3-004b"),
93 /* L3G4200D Gyroscope device */
94 REGULATOR_SUPPLY("vdd", "2-0068"),
95 /* Ambient light sensor device */
96 REGULATOR_SUPPLY("vdd", "3-0029"),
97 /* Pressure sensor device */
98 REGULATOR_SUPPLY("vdd", "2-005c"),
99 /* Cypress TrueTouch Touchscreen device */
100 REGULATOR_SUPPLY("vcpin", "spi8.0"),
101 /* Camera device */
102 REGULATOR_SUPPLY("vaux12v5", "mmio_camera"),
105 static struct regulator_consumer_supply ab8500_vaux2_consumers[] = {
106 /* On-board eMMC power */
107 REGULATOR_SUPPLY("vmmc", "sdi4"),
108 /* AB8500 audio codec */
109 REGULATOR_SUPPLY("vcc-N2158", "ab8500-codec.0"),
110 /* AB8500 accessory detect 1 */
111 REGULATOR_SUPPLY("vcc-N2158", "ab8500-acc-det.0"),
112 /* AB8500 Tv-out device */
113 REGULATOR_SUPPLY("vcc-N2158", "mcde_tv_ab8500.4"),
114 /* AV8100 HDMI device */
115 REGULATOR_SUPPLY("vcc-N2158", "av8100_hdmi.3"),
118 static struct regulator_consumer_supply ab8500_vaux3_consumers[] = {
119 REGULATOR_SUPPLY("v-SD-STM", "stm"),
120 /* External MMC slot power */
121 REGULATOR_SUPPLY("vmmc", "sdi0"),
124 static struct regulator_consumer_supply ab8505_vaux4_consumers[] = {
127 static struct regulator_consumer_supply ab8505_vaux5_consumers[] = {
130 static struct regulator_consumer_supply ab8505_vaux6_consumers[] = {
133 static struct regulator_consumer_supply ab8505_vaux8_consumers[] = {
134 /* AB8500 audio codec device */
135 REGULATOR_SUPPLY("v-aux8", NULL),
138 static struct regulator_consumer_supply ab8505_vadc_consumers[] = {
139 /* Internal general-purpose ADC */
140 REGULATOR_SUPPLY("vddadc", "ab8500-gpadc.0"),
141 /* ADC for charger */
142 REGULATOR_SUPPLY("vddadc", "ab8500-charger.0"),
145 static struct regulator_consumer_supply ab8500_vtvout_consumers[] = {
146 /* TV-out DENC supply */
147 REGULATOR_SUPPLY("vtvout", "ab8500-denc.0"),
148 /* Internal general-purpose ADC */
149 REGULATOR_SUPPLY("vddadc", "ab8500-gpadc.0"),
150 /* ADC for charger */
151 REGULATOR_SUPPLY("vddadc", "ab8500-charger.0"),
152 /* AB8500 Tv-out device */
153 REGULATOR_SUPPLY("vtvout", "mcde_tv_ab8500.4"),
156 static struct regulator_consumer_supply ab8500_vaud_consumers[] = {
157 /* AB8500 audio-codec main supply */
158 REGULATOR_SUPPLY("vaud", "ab8500-codec.0"),
161 static struct regulator_consumer_supply ab8500_vamic1_consumers[] = {
162 /* AB8500 audio-codec Mic1 supply */
163 REGULATOR_SUPPLY("vamic1", "ab8500-codec.0"),
166 static struct regulator_consumer_supply ab8500_vamic2_consumers[] = {
167 /* AB8500 audio-codec Mic2 supply */
168 REGULATOR_SUPPLY("vamic2", "ab8500-codec.0"),
171 static struct regulator_consumer_supply ab8500_vdmic_consumers[] = {
172 /* AB8500 audio-codec DMic supply */
173 REGULATOR_SUPPLY("vdmic", "ab8500-codec.0"),
176 static struct regulator_consumer_supply ab8500_vintcore_consumers[] = {
177 /* SoC core supply, no device */
178 REGULATOR_SUPPLY("v-intcore", NULL),
179 /* USB Transceiver */
180 REGULATOR_SUPPLY("vddulpivio18", "ab8500-usb.0"),
181 /* Handled by abx500 clk driver */
182 REGULATOR_SUPPLY("v-intcore", "abx500-clk.0"),
185 static struct regulator_consumer_supply ab8505_usb_consumers[] = {
186 /* HS USB OTG physical interface */
187 REGULATOR_SUPPLY("v-ape", NULL),
190 static struct regulator_consumer_supply ab8500_vana_consumers[] = {
191 /* DB8500 DSI */
192 REGULATOR_SUPPLY("vdddsi1v2", "mcde"),
193 REGULATOR_SUPPLY("vdddsi1v2", "b2r2_core"),
194 REGULATOR_SUPPLY("vdddsi1v2", "b2r2_1_core"),
195 REGULATOR_SUPPLY("vdddsi1v2", "dsilink.0"),
196 REGULATOR_SUPPLY("vdddsi1v2", "dsilink.1"),
197 REGULATOR_SUPPLY("vdddsi1v2", "dsilink.2"),
198 /* DB8500 CSI */
199 REGULATOR_SUPPLY("vddcsi1v2", "mmio_camera"),
202 /* ab8500 regulator register initialization */
203 static struct ab8500_regulator_reg_init ab8500_reg_init[] = {
205 * VanaRequestCtrl = HP/LP depending on VxRequest
206 * VextSupply1RequestCtrl = HP/LP depending on VxRequest
208 INIT_REGULATOR_REGISTER(AB8500_REGUREQUESTCTRL2, 0xf0, 0x00),
210 * VextSupply2RequestCtrl = HP/LP depending on VxRequest
211 * VextSupply3RequestCtrl = HP/LP depending on VxRequest
212 * Vaux1RequestCtrl = HP/LP depending on VxRequest
213 * Vaux2RequestCtrl = HP/LP depending on VxRequest
215 INIT_REGULATOR_REGISTER(AB8500_REGUREQUESTCTRL3, 0xff, 0x00),
217 * Vaux3RequestCtrl = HP/LP depending on VxRequest
218 * SwHPReq = Control through SWValid disabled
220 INIT_REGULATOR_REGISTER(AB8500_REGUREQUESTCTRL4, 0x07, 0x00),
222 * VanaSysClkReq1HPValid = disabled
223 * Vaux1SysClkReq1HPValid = disabled
224 * Vaux2SysClkReq1HPValid = disabled
225 * Vaux3SysClkReq1HPValid = disabled
227 INIT_REGULATOR_REGISTER(AB8500_REGUSYSCLKREQ1HPVALID1, 0xe8, 0x00),
229 * VextSupply1SysClkReq1HPValid = disabled
230 * VextSupply2SysClkReq1HPValid = disabled
231 * VextSupply3SysClkReq1HPValid = SysClkReq1 controlled
233 INIT_REGULATOR_REGISTER(AB8500_REGUSYSCLKREQ1HPVALID2, 0x70, 0x40),
235 * VanaHwHPReq1Valid = disabled
236 * Vaux1HwHPreq1Valid = disabled
237 * Vaux2HwHPReq1Valid = disabled
238 * Vaux3HwHPReqValid = disabled
240 INIT_REGULATOR_REGISTER(AB8500_REGUHWHPREQ1VALID1, 0xe8, 0x00),
242 * VextSupply1HwHPReq1Valid = disabled
243 * VextSupply2HwHPReq1Valid = disabled
244 * VextSupply3HwHPReq1Valid = disabled
246 INIT_REGULATOR_REGISTER(AB8500_REGUHWHPREQ1VALID2, 0x07, 0x00),
248 * VanaHwHPReq2Valid = disabled
249 * Vaux1HwHPReq2Valid = disabled
250 * Vaux2HwHPReq2Valid = disabled
251 * Vaux3HwHPReq2Valid = disabled
253 INIT_REGULATOR_REGISTER(AB8500_REGUHWHPREQ2VALID1, 0xe8, 0x00),
255 * VextSupply1HwHPReq2Valid = disabled
256 * VextSupply2HwHPReq2Valid = disabled
257 * VextSupply3HwHPReq2Valid = HWReq2 controlled
259 INIT_REGULATOR_REGISTER(AB8500_REGUHWHPREQ2VALID2, 0x07, 0x04),
261 * VanaSwHPReqValid = disabled
262 * Vaux1SwHPReqValid = disabled
264 INIT_REGULATOR_REGISTER(AB8500_REGUSWHPREQVALID1, 0xa0, 0x00),
266 * Vaux2SwHPReqValid = disabled
267 * Vaux3SwHPReqValid = disabled
268 * VextSupply1SwHPReqValid = disabled
269 * VextSupply2SwHPReqValid = disabled
270 * VextSupply3SwHPReqValid = disabled
272 INIT_REGULATOR_REGISTER(AB8500_REGUSWHPREQVALID2, 0x1f, 0x00),
274 * SysClkReq2Valid1 = SysClkReq2 controlled
275 * SysClkReq3Valid1 = disabled
276 * SysClkReq4Valid1 = SysClkReq4 controlled
277 * SysClkReq5Valid1 = disabled
278 * SysClkReq6Valid1 = SysClkReq6 controlled
279 * SysClkReq7Valid1 = disabled
280 * SysClkReq8Valid1 = disabled
282 INIT_REGULATOR_REGISTER(AB8500_REGUSYSCLKREQVALID1, 0xfe, 0x2a),
284 * SysClkReq2Valid2 = disabled
285 * SysClkReq3Valid2 = disabled
286 * SysClkReq4Valid2 = disabled
287 * SysClkReq5Valid2 = disabled
288 * SysClkReq6Valid2 = SysClkReq6 controlled
289 * SysClkReq7Valid2 = disabled
290 * SysClkReq8Valid2 = disabled
292 INIT_REGULATOR_REGISTER(AB8500_REGUSYSCLKREQVALID2, 0xfe, 0x20),
294 * VTVoutEna = disabled
295 * Vintcore12Ena = disabled
296 * Vintcore12Sel = 1.25 V
297 * Vintcore12LP = inactive (HP)
298 * VTVoutLP = inactive (HP)
300 INIT_REGULATOR_REGISTER(AB8500_REGUMISC1, 0xfe, 0x10),
302 * VaudioEna = disabled
303 * VdmicEna = disabled
304 * Vamic1Ena = disabled
305 * Vamic2Ena = disabled
307 INIT_REGULATOR_REGISTER(AB8500_VAUDIOSUPPLY, 0x1e, 0x00),
309 * Vamic1_dzout = high-Z when Vamic1 is disabled
310 * Vamic2_dzout = high-Z when Vamic2 is disabled
312 INIT_REGULATOR_REGISTER(AB8500_REGUCTRL1VAMIC, 0x03, 0x00),
314 * VPll = Hw controlled (NOTE! PRCMU bits)
315 * VanaRegu = force off
317 INIT_REGULATOR_REGISTER(AB8500_VPLLVANAREGU, 0x0f, 0x02),
319 * VrefDDREna = disabled
320 * VrefDDRSleepMode = inactive (no pulldown)
322 INIT_REGULATOR_REGISTER(AB8500_VREFDDR, 0x03, 0x00),
324 * VextSupply1Regu = force LP
325 * VextSupply2Regu = force OFF
326 * VextSupply3Regu = force HP (-> STBB2=LP and TPS=LP)
327 * ExtSupply2Bypass = ExtSupply12LPn ball is 0 when Ena is 0
328 * ExtSupply3Bypass = ExtSupply3LPn ball is 0 when Ena is 0
330 INIT_REGULATOR_REGISTER(AB8500_EXTSUPPLYREGU, 0xff, 0x13),
332 * Vaux1Regu = force HP
333 * Vaux2Regu = force off
335 INIT_REGULATOR_REGISTER(AB8500_VAUX12REGU, 0x0f, 0x01),
337 * Vaux3Regu = force off
339 INIT_REGULATOR_REGISTER(AB8500_VRF1VAUX3REGU, 0x03, 0x00),
341 * Vaux1Sel = 2.8 V
343 INIT_REGULATOR_REGISTER(AB8500_VAUX1SEL, 0x0f, 0x0C),
345 * Vaux2Sel = 2.9 V
347 INIT_REGULATOR_REGISTER(AB8500_VAUX2SEL, 0x0f, 0x0d),
349 * Vaux3Sel = 2.91 V
351 INIT_REGULATOR_REGISTER(AB8500_VRF1VAUX3SEL, 0x07, 0x07),
353 * VextSupply12LP = disabled (no LP)
355 INIT_REGULATOR_REGISTER(AB8500_REGUCTRL2SPARE, 0x01, 0x00),
357 * Vaux1Disch = short discharge time
358 * Vaux2Disch = short discharge time
359 * Vaux3Disch = short discharge time
360 * Vintcore12Disch = short discharge time
361 * VTVoutDisch = short discharge time
362 * VaudioDisch = short discharge time
364 INIT_REGULATOR_REGISTER(AB8500_REGUCTRLDISCH, 0xfc, 0x00),
366 * VanaDisch = short discharge time
367 * VdmicPullDownEna = pulldown disabled when Vdmic is disabled
368 * VdmicDisch = short discharge time
370 INIT_REGULATOR_REGISTER(AB8500_REGUCTRLDISCH2, 0x16, 0x00),
373 /* AB8500 regulators */
374 static struct regulator_init_data ab8500_regulators[AB8500_NUM_REGULATORS] = {
375 /* supplies to the display/camera */
376 [AB8500_LDO_AUX1] = {
377 .supply_regulator = "ab8500-ext-supply3",
378 .constraints = {
379 .name = "V-DISPLAY",
380 .min_uV = 2800000,
381 .max_uV = 3300000,
382 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |
383 REGULATOR_CHANGE_STATUS,
384 .boot_on = 1, /* display is on at boot */
386 .num_consumer_supplies = ARRAY_SIZE(ab8500_vaux1_consumers),
387 .consumer_supplies = ab8500_vaux1_consumers,
389 /* supplies to the on-board eMMC */
390 [AB8500_LDO_AUX2] = {
391 .supply_regulator = "ab8500-ext-supply3",
392 .constraints = {
393 .name = "V-eMMC1",
394 .min_uV = 1100000,
395 .max_uV = 3300000,
396 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |
397 REGULATOR_CHANGE_STATUS |
398 REGULATOR_CHANGE_MODE,
399 .valid_modes_mask = REGULATOR_MODE_NORMAL |
400 REGULATOR_MODE_IDLE,
402 .num_consumer_supplies = ARRAY_SIZE(ab8500_vaux2_consumers),
403 .consumer_supplies = ab8500_vaux2_consumers,
405 /* supply for VAUX3, supplies to SDcard slots */
406 [AB8500_LDO_AUX3] = {
407 .supply_regulator = "ab8500-ext-supply3",
408 .constraints = {
409 .name = "V-MMC-SD",
410 .min_uV = 1100000,
411 .max_uV = 3300000,
412 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |
413 REGULATOR_CHANGE_STATUS |
414 REGULATOR_CHANGE_MODE,
415 .valid_modes_mask = REGULATOR_MODE_NORMAL |
416 REGULATOR_MODE_IDLE,
418 .num_consumer_supplies = ARRAY_SIZE(ab8500_vaux3_consumers),
419 .consumer_supplies = ab8500_vaux3_consumers,
421 /* supply for tvout, gpadc, TVOUT LDO */
422 [AB8500_LDO_TVOUT] = {
423 .constraints = {
424 .name = "V-TVOUT",
425 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
427 .num_consumer_supplies = ARRAY_SIZE(ab8500_vtvout_consumers),
428 .consumer_supplies = ab8500_vtvout_consumers,
430 /* supply for ab8500-vaudio, VAUDIO LDO */
431 [AB8500_LDO_AUDIO] = {
432 .constraints = {
433 .name = "V-AUD",
434 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
436 .num_consumer_supplies = ARRAY_SIZE(ab8500_vaud_consumers),
437 .consumer_supplies = ab8500_vaud_consumers,
439 /* supply for v-anamic1 VAMic1-LDO */
440 [AB8500_LDO_ANAMIC1] = {
441 .constraints = {
442 .name = "V-AMIC1",
443 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
445 .num_consumer_supplies = ARRAY_SIZE(ab8500_vamic1_consumers),
446 .consumer_supplies = ab8500_vamic1_consumers,
448 /* supply for v-amic2, VAMIC2 LDO, reuse constants for AMIC1 */
449 [AB8500_LDO_ANAMIC2] = {
450 .constraints = {
451 .name = "V-AMIC2",
452 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
454 .num_consumer_supplies = ARRAY_SIZE(ab8500_vamic2_consumers),
455 .consumer_supplies = ab8500_vamic2_consumers,
457 /* supply for v-dmic, VDMIC LDO */
458 [AB8500_LDO_DMIC] = {
459 .constraints = {
460 .name = "V-DMIC",
461 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
463 .num_consumer_supplies = ARRAY_SIZE(ab8500_vdmic_consumers),
464 .consumer_supplies = ab8500_vdmic_consumers,
466 /* supply for v-intcore12, VINTCORE12 LDO */
467 [AB8500_LDO_INTCORE] = {
468 .constraints = {
469 .name = "V-INTCORE",
470 .min_uV = 1250000,
471 .max_uV = 1350000,
472 .input_uV = 1800000,
473 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |
474 REGULATOR_CHANGE_STATUS |
475 REGULATOR_CHANGE_MODE |
476 REGULATOR_CHANGE_DRMS,
477 .valid_modes_mask = REGULATOR_MODE_NORMAL |
478 REGULATOR_MODE_IDLE,
480 .num_consumer_supplies = ARRAY_SIZE(ab8500_vintcore_consumers),
481 .consumer_supplies = ab8500_vintcore_consumers,
483 /* supply for U8500 CSI-DSI, VANA LDO */
484 [AB8500_LDO_ANA] = {
485 .constraints = {
486 .name = "V-CSI-DSI",
487 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
489 .num_consumer_supplies = ARRAY_SIZE(ab8500_vana_consumers),
490 .consumer_supplies = ab8500_vana_consumers,
494 /* supply for VextSupply3 */
495 static struct regulator_consumer_supply ab8500_ext_supply3_consumers[] = {
496 /* SIM supply for 3 V SIM cards */
497 REGULATOR_SUPPLY("vinvsim", "sim-detect.0"),
500 /* extended configuration for VextSupply2, only used for HREFP_V20 boards */
501 static struct ab8500_ext_regulator_cfg ab8500_ext_supply2 = {
502 .hwreq = true,
506 * AB8500 external regulators
508 static struct regulator_init_data ab8500_ext_regulators[] = {
509 /* fixed Vbat supplies VSMPS1_EXT_1V8 */
510 [AB8500_EXT_SUPPLY1] = {
511 .constraints = {
512 .name = "ab8500-ext-supply1",
513 .min_uV = 1800000,
514 .max_uV = 1800000,
515 .initial_mode = REGULATOR_MODE_IDLE,
516 .boot_on = 1,
517 .always_on = 1,
520 /* fixed Vbat supplies VSMPS2_EXT_1V36 and VSMPS5_EXT_1V15 */
521 [AB8500_EXT_SUPPLY2] = {
522 .constraints = {
523 .name = "ab8500-ext-supply2",
524 .min_uV = 1360000,
525 .max_uV = 1360000,
528 /* fixed Vbat supplies VSMPS3_EXT_3V4 and VSMPS4_EXT_3V4 */
529 [AB8500_EXT_SUPPLY3] = {
530 .constraints = {
531 .name = "ab8500-ext-supply3",
532 .min_uV = 3400000,
533 .max_uV = 3400000,
534 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
535 .boot_on = 1,
537 .num_consumer_supplies =
538 ARRAY_SIZE(ab8500_ext_supply3_consumers),
539 .consumer_supplies = ab8500_ext_supply3_consumers,
543 /* ab8505 regulator register initialization */
544 static struct ab8500_regulator_reg_init ab8505_reg_init[] = {
546 * VarmRequestCtrl
547 * VsmpsCRequestCtrl
548 * VsmpsARequestCtrl
549 * VsmpsBRequestCtrl
551 INIT_REGULATOR_REGISTER(AB8505_REGUREQUESTCTRL1, 0x00, 0x00),
553 * VsafeRequestCtrl
554 * VpllRequestCtrl
555 * VanaRequestCtrl = HP/LP depending on VxRequest
557 INIT_REGULATOR_REGISTER(AB8505_REGUREQUESTCTRL2, 0x30, 0x00),
559 * Vaux1RequestCtrl = HP/LP depending on VxRequest
560 * Vaux2RequestCtrl = HP/LP depending on VxRequest
562 INIT_REGULATOR_REGISTER(AB8505_REGUREQUESTCTRL3, 0xf0, 0x00),
564 * Vaux3RequestCtrl = HP/LP depending on VxRequest
565 * SwHPReq = Control through SWValid disabled
567 INIT_REGULATOR_REGISTER(AB8505_REGUREQUESTCTRL4, 0x07, 0x00),
569 * VsmpsASysClkReq1HPValid
570 * VsmpsBSysClkReq1HPValid
571 * VsafeSysClkReq1HPValid
572 * VanaSysClkReq1HPValid = disabled
573 * VpllSysClkReq1HPValid
574 * Vaux1SysClkReq1HPValid = disabled
575 * Vaux2SysClkReq1HPValid = disabled
576 * Vaux3SysClkReq1HPValid = disabled
578 INIT_REGULATOR_REGISTER(AB8505_REGUSYSCLKREQ1HPVALID1, 0xe8, 0x00),
580 * VsmpsCSysClkReq1HPValid
581 * VarmSysClkReq1HPValid
582 * VbbSysClkReq1HPValid
583 * VsmpsMSysClkReq1HPValid
585 INIT_REGULATOR_REGISTER(AB8505_REGUSYSCLKREQ1HPVALID2, 0x00, 0x00),
587 * VsmpsAHwHPReq1Valid
588 * VsmpsBHwHPReq1Valid
589 * VsafeHwHPReq1Valid
590 * VanaHwHPReq1Valid = disabled
591 * VpllHwHPReq1Valid
592 * Vaux1HwHPreq1Valid = disabled
593 * Vaux2HwHPReq1Valid = disabled
594 * Vaux3HwHPReqValid = disabled
596 INIT_REGULATOR_REGISTER(AB8505_REGUHWHPREQ1VALID1, 0xe8, 0x00),
598 * VsmpsMHwHPReq1Valid
600 INIT_REGULATOR_REGISTER(AB8505_REGUHWHPREQ1VALID2, 0x00, 0x00),
602 * VsmpsAHwHPReq2Valid
603 * VsmpsBHwHPReq2Valid
604 * VsafeHwHPReq2Valid
605 * VanaHwHPReq2Valid = disabled
606 * VpllHwHPReq2Valid
607 * Vaux1HwHPReq2Valid = disabled
608 * Vaux2HwHPReq2Valid = disabled
609 * Vaux3HwHPReq2Valid = disabled
611 INIT_REGULATOR_REGISTER(AB8505_REGUHWHPREQ2VALID1, 0xe8, 0x00),
613 * VsmpsMHwHPReq2Valid
615 INIT_REGULATOR_REGISTER(AB8505_REGUHWHPREQ2VALID2, 0x00, 0x00),
617 * VsmpsCSwHPReqValid
618 * VarmSwHPReqValid
619 * VsmpsASwHPReqValid
620 * VsmpsBSwHPReqValid
621 * VsafeSwHPReqValid
622 * VanaSwHPReqValid
623 * VanaSwHPReqValid = disabled
624 * VpllSwHPReqValid
625 * Vaux1SwHPReqValid = disabled
627 INIT_REGULATOR_REGISTER(AB8505_REGUSWHPREQVALID1, 0xa0, 0x00),
629 * Vaux2SwHPReqValid = disabled
630 * Vaux3SwHPReqValid = disabled
631 * VsmpsMSwHPReqValid
633 INIT_REGULATOR_REGISTER(AB8505_REGUSWHPREQVALID2, 0x03, 0x00),
635 * SysClkReq2Valid1 = SysClkReq2 controlled
636 * SysClkReq3Valid1 = disabled
637 * SysClkReq4Valid1 = SysClkReq4 controlled
639 INIT_REGULATOR_REGISTER(AB8505_REGUSYSCLKREQVALID1, 0x0e, 0x0a),
641 * SysClkReq2Valid2 = disabled
642 * SysClkReq3Valid2 = disabled
643 * SysClkReq4Valid2 = disabled
645 INIT_REGULATOR_REGISTER(AB8505_REGUSYSCLKREQVALID2, 0x0e, 0x00),
647 * Vaux4SwHPReqValid
648 * Vaux4HwHPReq2Valid
649 * Vaux4HwHPReq1Valid
650 * Vaux4SysClkReq1HPValid
652 INIT_REGULATOR_REGISTER(AB8505_REGUVAUX4REQVALID, 0x00, 0x00),
654 * VadcEna = disabled
655 * VintCore12Ena = disabled
656 * VintCore12Sel = 1.25 V
657 * VintCore12LP = inactive (HP)
658 * VadcLP = inactive (HP)
660 INIT_REGULATOR_REGISTER(AB8505_REGUMISC1, 0xfe, 0x10),
662 * VaudioEna = disabled
663 * Vaux8Ena = disabled
664 * Vamic1Ena = disabled
665 * Vamic2Ena = disabled
667 INIT_REGULATOR_REGISTER(AB8505_VAUDIOSUPPLY, 0x1e, 0x00),
669 * Vamic1_dzout = high-Z when Vamic1 is disabled
670 * Vamic2_dzout = high-Z when Vamic2 is disabled
672 INIT_REGULATOR_REGISTER(AB8505_REGUCTRL1VAMIC, 0x03, 0x00),
674 * VsmpsARegu
675 * VsmpsASelCtrl
676 * VsmpsAAutoMode
677 * VsmpsAPWMMode
679 INIT_REGULATOR_REGISTER(AB8505_VSMPSAREGU, 0x00, 0x00),
681 * VsmpsBRegu
682 * VsmpsBSelCtrl
683 * VsmpsBAutoMode
684 * VsmpsBPWMMode
686 INIT_REGULATOR_REGISTER(AB8505_VSMPSBREGU, 0x00, 0x00),
688 * VsafeRegu
689 * VsafeSelCtrl
690 * VsafeAutoMode
691 * VsafePWMMode
693 INIT_REGULATOR_REGISTER(AB8505_VSAFEREGU, 0x00, 0x00),
695 * VPll = Hw controlled (NOTE! PRCMU bits)
696 * VanaRegu = force off
698 INIT_REGULATOR_REGISTER(AB8505_VPLLVANAREGU, 0x0f, 0x02),
700 * VextSupply1Regu = force OFF (OTP_ExtSupply12LPnPolarity 1)
701 * VextSupply2Regu = force OFF (OTP_ExtSupply12LPnPolarity 1)
702 * VextSupply3Regu = force OFF (OTP_ExtSupply3LPnPolarity 0)
703 * ExtSupply2Bypass = ExtSupply12LPn ball is 0 when Ena is 0
704 * ExtSupply3Bypass = ExtSupply3LPn ball is 0 when Ena is 0
706 INIT_REGULATOR_REGISTER(AB8505_EXTSUPPLYREGU, 0xff, 0x30),
708 * Vaux1Regu = force HP
709 * Vaux2Regu = force off
711 INIT_REGULATOR_REGISTER(AB8505_VAUX12REGU, 0x0f, 0x01),
713 * Vaux3Regu = force off
715 INIT_REGULATOR_REGISTER(AB8505_VRF1VAUX3REGU, 0x03, 0x00),
717 * VsmpsASel1
719 INIT_REGULATOR_REGISTER(AB8505_VSMPSASEL1, 0x00, 0x00),
721 * VsmpsASel2
723 INIT_REGULATOR_REGISTER(AB8505_VSMPSASEL2, 0x00, 0x00),
725 * VsmpsASel3
727 INIT_REGULATOR_REGISTER(AB8505_VSMPSASEL3, 0x00, 0x00),
729 * VsmpsBSel1
731 INIT_REGULATOR_REGISTER(AB8505_VSMPSBSEL1, 0x00, 0x00),
733 * VsmpsBSel2
735 INIT_REGULATOR_REGISTER(AB8505_VSMPSBSEL2, 0x00, 0x00),
737 * VsmpsBSel3
739 INIT_REGULATOR_REGISTER(AB8505_VSMPSBSEL3, 0x00, 0x00),
741 * VsafeSel1
743 INIT_REGULATOR_REGISTER(AB8505_VSAFESEL1, 0x00, 0x00),
745 * VsafeSel2
747 INIT_REGULATOR_REGISTER(AB8505_VSAFESEL2, 0x00, 0x00),
749 * VsafeSel3
751 INIT_REGULATOR_REGISTER(AB8505_VSAFESEL3, 0x00, 0x00),
753 * Vaux1Sel = 2.8 V
755 INIT_REGULATOR_REGISTER(AB8505_VAUX1SEL, 0x0f, 0x0C),
757 * Vaux2Sel = 2.9 V
759 INIT_REGULATOR_REGISTER(AB8505_VAUX2SEL, 0x0f, 0x0d),
761 * Vaux3Sel = 2.91 V
763 INIT_REGULATOR_REGISTER(AB8505_VRF1VAUX3SEL, 0x07, 0x07),
765 * Vaux4RequestCtrl
767 INIT_REGULATOR_REGISTER(AB8505_VAUX4REQCTRL, 0x00, 0x00),
769 * Vaux4Regu
771 INIT_REGULATOR_REGISTER(AB8505_VAUX4REGU, 0x00, 0x00),
773 * Vaux4Sel
775 INIT_REGULATOR_REGISTER(AB8505_VAUX4SEL, 0x00, 0x00),
777 * Vaux1Disch = short discharge time
778 * Vaux2Disch = short discharge time
779 * Vaux3Disch = short discharge time
780 * Vintcore12Disch = short discharge time
781 * VTVoutDisch = short discharge time
782 * VaudioDisch = short discharge time
784 INIT_REGULATOR_REGISTER(AB8505_REGUCTRLDISCH, 0xfc, 0x00),
786 * VanaDisch = short discharge time
787 * Vaux8PullDownEna = pulldown disabled when Vaux8 is disabled
788 * Vaux8Disch = short discharge time
790 INIT_REGULATOR_REGISTER(AB8505_REGUCTRLDISCH2, 0x16, 0x00),
792 * Vaux4Disch = short discharge time
794 INIT_REGULATOR_REGISTER(AB8505_REGUCTRLDISCH3, 0x01, 0x00),
796 * Vaux5Sel
797 * Vaux5LP
798 * Vaux5Ena
799 * Vaux5Disch
800 * Vaux5DisSfst
801 * Vaux5DisPulld
803 INIT_REGULATOR_REGISTER(AB8505_CTRLVAUX5, 0x00, 0x00),
805 * Vaux6Sel
806 * Vaux6LP
807 * Vaux6Ena
808 * Vaux6DisPulld
810 INIT_REGULATOR_REGISTER(AB8505_CTRLVAUX6, 0x00, 0x00),
813 struct regulator_init_data ab8505_regulators[AB8505_NUM_REGULATORS] = {
814 /* supplies to the display/camera */
815 [AB8505_LDO_AUX1] = {
816 .constraints = {
817 .name = "V-DISPLAY",
818 .min_uV = 2800000,
819 .max_uV = 3300000,
820 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |
821 REGULATOR_CHANGE_STATUS,
822 .boot_on = 1, /* display is on at boot */
824 .num_consumer_supplies = ARRAY_SIZE(ab8500_vaux1_consumers),
825 .consumer_supplies = ab8500_vaux1_consumers,
827 /* supplies to the on-board eMMC */
828 [AB8505_LDO_AUX2] = {
829 .constraints = {
830 .name = "V-eMMC1",
831 .min_uV = 1100000,
832 .max_uV = 3300000,
833 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |
834 REGULATOR_CHANGE_STATUS |
835 REGULATOR_CHANGE_MODE,
836 .valid_modes_mask = REGULATOR_MODE_NORMAL |
837 REGULATOR_MODE_IDLE,
839 .num_consumer_supplies = ARRAY_SIZE(ab8500_vaux2_consumers),
840 .consumer_supplies = ab8500_vaux2_consumers,
842 /* supply for VAUX3, supplies to SDcard slots */
843 [AB8505_LDO_AUX3] = {
844 .constraints = {
845 .name = "V-MMC-SD",
846 .min_uV = 1100000,
847 .max_uV = 3300000,
848 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |
849 REGULATOR_CHANGE_STATUS |
850 REGULATOR_CHANGE_MODE,
851 .valid_modes_mask = REGULATOR_MODE_NORMAL |
852 REGULATOR_MODE_IDLE,
854 .num_consumer_supplies = ARRAY_SIZE(ab8500_vaux3_consumers),
855 .consumer_supplies = ab8500_vaux3_consumers,
857 /* supply for VAUX4, supplies to NFC and standalone secure element */
858 [AB8505_LDO_AUX4] = {
859 .constraints = {
860 .name = "V-NFC-SE",
861 .min_uV = 1100000,
862 .max_uV = 3300000,
863 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |
864 REGULATOR_CHANGE_STATUS |
865 REGULATOR_CHANGE_MODE,
866 .valid_modes_mask = REGULATOR_MODE_NORMAL |
867 REGULATOR_MODE_IDLE,
869 .num_consumer_supplies = ARRAY_SIZE(ab8505_vaux4_consumers),
870 .consumer_supplies = ab8505_vaux4_consumers,
872 /* supply for VAUX5, supplies to TBD */
873 [AB8505_LDO_AUX5] = {
874 .constraints = {
875 .name = "V-AUX5",
876 .min_uV = 1050000,
877 .max_uV = 2790000,
878 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |
879 REGULATOR_CHANGE_STATUS |
880 REGULATOR_CHANGE_MODE,
881 .valid_modes_mask = REGULATOR_MODE_NORMAL |
882 REGULATOR_MODE_IDLE,
884 .num_consumer_supplies = ARRAY_SIZE(ab8505_vaux5_consumers),
885 .consumer_supplies = ab8505_vaux5_consumers,
887 /* supply for VAUX6, supplies to TBD */
888 [AB8505_LDO_AUX6] = {
889 .constraints = {
890 .name = "V-AUX6",
891 .min_uV = 1050000,
892 .max_uV = 2790000,
893 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |
894 REGULATOR_CHANGE_STATUS |
895 REGULATOR_CHANGE_MODE,
896 .valid_modes_mask = REGULATOR_MODE_NORMAL |
897 REGULATOR_MODE_IDLE,
899 .num_consumer_supplies = ARRAY_SIZE(ab8505_vaux6_consumers),
900 .consumer_supplies = ab8505_vaux6_consumers,
902 /* supply for gpadc, ADC LDO */
903 [AB8505_LDO_ADC] = {
904 .constraints = {
905 .name = "V-ADC",
906 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
908 .num_consumer_supplies = ARRAY_SIZE(ab8505_vadc_consumers),
909 .consumer_supplies = ab8505_vadc_consumers,
911 /* supply for ab8500-vaudio, VAUDIO LDO */
912 [AB8505_LDO_AUDIO] = {
913 .constraints = {
914 .name = "V-AUD",
915 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
917 .num_consumer_supplies = ARRAY_SIZE(ab8500_vaud_consumers),
918 .consumer_supplies = ab8500_vaud_consumers,
920 /* supply for v-anamic1 VAMic1-LDO */
921 [AB8505_LDO_ANAMIC1] = {
922 .constraints = {
923 .name = "V-AMIC1",
924 .valid_ops_mask = REGULATOR_CHANGE_STATUS |
925 REGULATOR_CHANGE_MODE,
926 .valid_modes_mask = REGULATOR_MODE_NORMAL |
927 REGULATOR_MODE_IDLE,
929 .num_consumer_supplies = ARRAY_SIZE(ab8500_vamic1_consumers),
930 .consumer_supplies = ab8500_vamic1_consumers,
932 /* supply for v-amic2, VAMIC2 LDO, reuse constants for AMIC1 */
933 [AB8505_LDO_ANAMIC2] = {
934 .constraints = {
935 .name = "V-AMIC2",
936 .valid_ops_mask = REGULATOR_CHANGE_STATUS |
937 REGULATOR_CHANGE_MODE,
938 .valid_modes_mask = REGULATOR_MODE_NORMAL |
939 REGULATOR_MODE_IDLE,
941 .num_consumer_supplies = ARRAY_SIZE(ab8500_vamic2_consumers),
942 .consumer_supplies = ab8500_vamic2_consumers,
944 /* supply for v-aux8, VAUX8 LDO */
945 [AB8505_LDO_AUX8] = {
946 .constraints = {
947 .name = "V-AUX8",
948 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
950 .num_consumer_supplies = ARRAY_SIZE(ab8505_vaux8_consumers),
951 .consumer_supplies = ab8505_vaux8_consumers,
953 /* supply for v-intcore12, VINTCORE12 LDO */
954 [AB8505_LDO_INTCORE] = {
955 .constraints = {
956 .name = "V-INTCORE",
957 .min_uV = 1250000,
958 .max_uV = 1350000,
959 .input_uV = 1800000,
960 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |
961 REGULATOR_CHANGE_STATUS |
962 REGULATOR_CHANGE_MODE |
963 REGULATOR_CHANGE_DRMS,
964 .valid_modes_mask = REGULATOR_MODE_NORMAL |
965 REGULATOR_MODE_IDLE,
967 .num_consumer_supplies = ARRAY_SIZE(ab8500_vintcore_consumers),
968 .consumer_supplies = ab8500_vintcore_consumers,
970 /* supply for LDO USB */
971 [AB8505_LDO_USB] = {
972 .constraints = {
973 .name = "V-USB",
974 .valid_ops_mask = REGULATOR_CHANGE_STATUS |
975 REGULATOR_CHANGE_MODE,
976 .valid_modes_mask = REGULATOR_MODE_NORMAL |
977 REGULATOR_MODE_IDLE,
979 .num_consumer_supplies = ARRAY_SIZE(ab8505_usb_consumers),
980 .consumer_supplies = ab8505_usb_consumers,
982 /* supply for U8500 CSI-DSI, VANA LDO */
983 [AB8505_LDO_ANA] = {
984 .constraints = {
985 .name = "V-CSI-DSI",
986 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
988 .num_consumer_supplies = ARRAY_SIZE(ab8500_vana_consumers),
989 .consumer_supplies = ab8500_vana_consumers,
993 struct ab8500_regulator_platform_data ab8500_regulator_plat_data = {
994 .reg_init = ab8500_reg_init,
995 .num_reg_init = ARRAY_SIZE(ab8500_reg_init),
996 .regulator = ab8500_regulators,
997 .num_regulator = ARRAY_SIZE(ab8500_regulators),
998 .ext_regulator = ab8500_ext_regulators,
999 .num_ext_regulator = ARRAY_SIZE(ab8500_ext_regulators),
1002 struct ab8500_regulator_platform_data ab8505_regulator_plat_data = {
1003 .reg_init = ab8505_reg_init,
1004 .num_reg_init = ARRAY_SIZE(ab8505_reg_init),
1005 .regulator = ab8505_regulators,
1006 .num_regulator = ARRAY_SIZE(ab8505_regulators),
1009 static void ab8500_modify_reg_init(int id, u8 mask, u8 value)
1011 int i;
1013 if (cpu_is_u8520()) {
1014 for (i = ARRAY_SIZE(ab8505_reg_init) - 1; i >= 0; i--) {
1015 if (ab8505_reg_init[i].id == id) {
1016 u8 initval = ab8505_reg_init[i].value;
1017 initval = (initval & ~mask) | (value & mask);
1018 ab8505_reg_init[i].value = initval;
1020 BUG_ON(mask & ~ab8505_reg_init[i].mask);
1021 return;
1024 } else {
1025 for (i = ARRAY_SIZE(ab8500_reg_init) - 1; i >= 0; i--) {
1026 if (ab8500_reg_init[i].id == id) {
1027 u8 initval = ab8500_reg_init[i].value;
1028 initval = (initval & ~mask) | (value & mask);
1029 ab8500_reg_init[i].value = initval;
1031 BUG_ON(mask & ~ab8500_reg_init[i].mask);
1032 return;
1037 BUG_ON(1);
1040 void mop500_regulator_init(void)
1042 struct regulator_init_data *regulator;
1045 * Temporarily turn on Vaux2 on 8520 machine
1047 if (cpu_is_u8520()) {
1048 /* Vaux2 initialized to be on */
1049 ab8500_modify_reg_init(AB8505_VAUX12REGU, 0x0f, 0x05);
1053 * Handle AB8500_EXT_SUPPLY2 on HREFP_V20_V50 boards (do it for
1054 * all HREFP_V20 boards)
1056 if (cpu_is_u8500v20()) {
1057 /* VextSupply2RequestCtrl = HP/OFF depending on VxRequest */
1058 ab8500_modify_reg_init(AB8500_REGUREQUESTCTRL3, 0x01, 0x01);
1060 /* VextSupply2SysClkReq1HPValid = SysClkReq1 controlled */
1061 ab8500_modify_reg_init(AB8500_REGUSYSCLKREQ1HPVALID2,
1062 0x20, 0x20);
1064 /* VextSupply2 = force HP at initialization */
1065 ab8500_modify_reg_init(AB8500_EXTSUPPLYREGU, 0x0c, 0x04);
1067 /* enable VextSupply2 during platform active */
1068 regulator = &ab8500_ext_regulators[AB8500_EXT_SUPPLY2];
1069 regulator->constraints.always_on = 1;
1071 /* disable VextSupply2 in suspend */
1072 regulator = &ab8500_ext_regulators[AB8500_EXT_SUPPLY2];
1073 regulator->constraints.state_mem.disabled = 1;
1074 regulator->constraints.state_standby.disabled = 1;
1076 /* enable VextSupply2 HW control (used in suspend) */
1077 regulator->driver_data = (void *)&ab8500_ext_supply2;