phonepad:modify tps65910 gpio base
[firefly-linux-kernel-4.4.55.git] / arch / arm / mach-rk30 / board-rk30-sdk-tps65910.c
1 #include <linux/regulator/machine.h>
2 #include <linux/i2c/twl.h>
3 #include <linux/mfd/tps65910.h>
4 #include <mach/sram.h>
5 #include <linux/platform_device.h>
6
7 #include <mach/gpio.h>
8 #include <mach/iomux.h>
9
10 #define grf_readl(offset)       readl_relaxed(RK30_GRF_BASE + offset)
11 #define grf_writel(v, offset)   do { writel_relaxed(v, RK30_GRF_BASE + offset); dsb(); } while (0)
12
13 #define CRU_CLKGATE5_CON_ADDR 0x00e4
14 #define GRF_GPIO6L_DIR_ADDR 0x0030
15 #define GRF_GPIO6L_DO_ADDR 0x0068
16 #define GRF_GPIO6L_EN_ADDR 0x00a0
17 #define GPIO6_PB3_DIR_OUT  0x08000800
18 #define GPIO6_PB3_DO_LOW  0x08000000
19 #define GPIO6_PB3_DO_HIGH  0x08000800
20 #define GPIO6_PB3_EN_MASK  0x08000800
21 #define GPIO6_PB3_UNEN_MASK  0x08000000
22 #define GPIO6_PB1_DIR_OUT  0x02000200
23 #define GPIO6_PB1_DO_LOW  0x02000000
24 #define GPIO6_PB1_DO_HIGH  0x02000200
25 #define GPIO6_PB1_EN_MASK  0x02000200
26 #define GPIO6_PB1_UNEN_MASK  0x02000000
27
28 #ifdef CONFIG_MFD_TPS65910
29 #define PMU_POWER_SLEEP RK30_PIN6_PB1   
30 extern int platform_device_register(struct platform_device *pdev);
31
32 int tps65910_pre_init(struct tps65910 *tps65910){
33
34         int val = 0;
35         int i   = 0;
36         int err = -1;
37                 
38         printk("%s,line=%d\n", __func__,__LINE__);      
39         //gpio_request(PMU_POWER_SLEEP, "NULL");
40         //gpio_direction_output(PMU_POWER_SLEEP, GPIO_HIGH);
41         
42         val = tps65910_reg_read(tps65910, TPS65910_REG_DEVCTRL2);
43         if (val<0) {
44                 printk(KERN_ERR "Unable to read TPS65910_REG_DEVCTRL2 reg\n");
45                 return val;
46         }
47         /* Set sleep state active high and allow device turn-off after PWRON long press */
48         val |= (TPS65910_DEV2_SLEEPSIG_POL | TPS65910_DEV2_PWON_LP_OFF);
49
50         err = tps65910_reg_write(tps65910, TPS65910_REG_DEVCTRL2, val);
51         if (err) {
52                 printk(KERN_ERR "Unable to write TPS65910_REG_DEVCTRL2 reg\n");
53                 return err;
54         }
55          #if 1
56         /* set PSKIP=0 */
57         val = tps65910_reg_read(tps65910, TPS65910_REG_DCDCCTRL);
58         if (val<0) {
59                 printk(KERN_ERR "Unable to read TPS65910_REG_DCDCCTRL reg\n");
60                 return val;
61         }
62         //val &= ~(1 << 4);
63                 val &= 0xFC;
64         //      val |= 0x03;
65
66         err = tps65910_reg_write(tps65910, TPS65910_REG_DCDCCTRL, val);
67         if (err) {
68                 printk(KERN_ERR "Unable to write TPS65910_REG_DCDCCTRL reg\n");
69                 return err;
70         }
71         #endif
72         /* Set the maxinum load current */
73         /* VDD1 */
74         val = tps65910_reg_read(tps65910, TPS65910_REG_VDD1);
75         if (val<0) {
76                 printk(KERN_ERR "Unable to read TPS65910_REG_VDD1 reg\n");
77                 return val;
78         }
79
80         val |= (1<<5);
81         val |= (0x07<<2);
82         err = tps65910_reg_write(tps65910, TPS65910_REG_VDD1, val);
83         if (err) {
84                 printk(KERN_ERR "Unable to write TPS65910_REG_VDD1 reg\n");
85                 return err;
86         }
87
88         /* VDD2 */
89         val = tps65910_reg_read(tps65910, TPS65910_REG_VDD2);
90         if (val<0) {
91                 printk(KERN_ERR "Unable to read TPS65910_REG_VDD2 reg\n");
92                 return val;
93         }
94
95         val |= (1<<5);
96         err = tps65910_reg_write(tps65910, TPS65910_REG_VDD2, val);
97         if (err) {
98                 printk(KERN_ERR "Unable to write TPS65910_REG_VDD2 reg\n");
99                 return err;
100         }
101
102         /* VIO */
103         val = tps65910_reg_read(tps65910, TPS65910_REG_VIO);
104         if (val<0) {
105                 printk(KERN_ERR "Unable to read TPS65910_REG_VIO reg\n");
106                 return -EIO;
107         }
108
109         val |= (1<<6);
110         err = tps65910_reg_write(tps65910, TPS65910_REG_VIO, val);
111         if (err) {
112                 printk(KERN_ERR "Unable to write TPS65910_REG_VIO reg\n");
113                 return err;
114         }
115         #if 1
116         /* Mask ALL interrupts */
117         err = tps65910_reg_write(tps65910,TPS65910_REG_INT_MSK, 0xFF);
118         if (err) {
119                 printk(KERN_ERR "Unable to write TPS65910_REG_INT_MSK reg\n");
120                 return err;
121         }
122         
123         err = tps65910_reg_write(tps65910, TPS65910_REG_INT_MSK2, 0x03);
124         if (err) {
125                 printk(KERN_ERR "Unable to write TPS65910_REG_INT_MSK2 reg\n");
126                 return err;
127         }
128
129         /* Set RTC Power, disable Smart Reflex in DEVCTRL_REG */
130         #if 1
131         val = 0;
132         val |= (TPS65910_SR_CTL_I2C_SEL);
133         err = tps65910_reg_write(tps65910, TPS65910_REG_DEVCTRL, val);
134         if (err) {
135                 printk(KERN_ERR "Unable to write TPS65910_REG_DEVCTRL reg\n");
136                 return err;
137         }
138         printk(KERN_INFO "TPS65910 Set default voltage.\n");
139         #endif
140         #if 0
141         //read sleep control register  for debug
142         for(i=0; i<6; i++)
143         {
144         err = tps65910_reg_read(tps65910, &val, TPS65910_REG_DEVCTRL+i);
145         if (err) {
146                 printk(KERN_ERR "Unable to read TPS65910_REG_DCDCCTRL reg\n");
147                 return -EIO;
148         }
149                 else
150                 printk("%s.......is  0x%04x\n",__FUNCTION__,val);
151         }
152         #endif
153
154         #if 1
155         //sleep control register
156         /*set func when in sleep mode */
157         val = tps65910_reg_read(tps65910, TPS65910_REG_DEVCTRL);
158         if (val<0) {
159                 printk(KERN_ERR "Unable to read TPS65910_REG_DCDCCTRL reg\n");
160                 return val;
161         }
162                 val |= (1 << 1);
163                 err = tps65910_reg_write(tps65910, TPS65910_REG_DEVCTRL, val);
164                 if (err) {
165                         printk(KERN_ERR "Unable to read TPS65910 Reg at offset 0x%x= \
166                                         \n", TPS65910_REG_VDIG1);
167                         return err;
168                 }
169                 /* open ldo when in sleep mode */
170         val = tps65910_reg_read(tps65910, TPS65910_REG_SLEEP_KEEP_LDO_ON);
171         if (val<0) {
172                 printk(KERN_ERR "Unable to read TPS65910_REG_DCDCCTRL reg\n");
173                 return val;
174         }
175                 val &= 0;
176                 err = tps65910_reg_write(tps65910, TPS65910_REG_SLEEP_KEEP_LDO_ON, val);
177                 if (err) {
178                         printk(KERN_ERR "Unable to read TPS65910 Reg at offset 0x%x= \
179                                         \n", TPS65910_REG_VDIG1);
180                         return err;
181                 }
182                 /*set dc mode when in sleep mode */
183         val = tps65910_reg_read(tps65910, TPS65910_REG_SLEEP_KEEP_RES_ON);
184         if (val<0) {
185                 printk(KERN_ERR "Unable to read TPS65910_REG_DCDCCTRL reg\n");
186                 return val;
187         }
188                 val  |= 0xff;
189                 err = tps65910_reg_write(tps65910, TPS65910_REG_SLEEP_KEEP_RES_ON, val);
190                 if (err) {
191                         printk(KERN_ERR "Unable to read TPS65910 Reg at offset 0x%x= \
192                                         \n", TPS65910_REG_VDIG1);
193                         return err;
194                 }
195                 /*close ldo when in sleep mode */
196         val = tps65910_reg_read(tps65910, TPS65910_REG_SLEEP_SET_LDO_OFF);
197         if (val<0) {
198                 printk(KERN_ERR "Unable to read TPS65910_REG_DCDCCTRL reg\n");
199                 return val;
200         }
201                 val |= 0x9B;
202                 err = tps65910_reg_write(tps65910, TPS65910_REG_SLEEP_SET_LDO_OFF, val);
203                 if (err) {
204                         printk(KERN_ERR "Unable to read TPS65910 Reg at offset 0x%x= \
205                                         \n", TPS65910_REG_VDIG1);
206                         return err;
207                 }
208         #endif
209         #if 0
210         //read sleep control register  for debug
211         for(i=0; i<6; i++)
212         {
213         err = tps65910_reg_read(tps65910, &val, TPS65910_REG_DEVCTRL+i);
214         if (err) {
215                 printk(KERN_ERR "Unable to read TPS65910_REG_DCDCCTRL reg\n");
216                 return -EIO;
217         }
218                 else
219                 printk("%s.......is  0x%4x\n",__FUNCTION__,val);
220         }
221         #endif
222         #endif
223         printk("%s,line=%d\n", __func__,__LINE__);
224         return 0;
225
226 }
227 int tps65910_post_init(struct tps65910 *tps65910)
228 {
229         struct regulator *dcdc;
230         struct regulator *ldo;
231         printk("%s,line=%d\n", __func__,__LINE__);
232
233         g_pmic_type = PMIC_TYPE_TPS65910;
234         printk("%s:g_pmic_type=%d\n",__func__,g_pmic_type);
235         
236         dcdc = regulator_get(NULL, "vio");      //vcc_io
237         regulator_set_voltage(dcdc, 3000000, 3000000);
238         regulator_enable(dcdc);
239         printk("%s set vio vcc_io=%dmV end\n", __func__, regulator_get_voltage(dcdc));
240         regulator_put(dcdc);
241         udelay(100);
242
243         ldo = regulator_get(NULL, "vpll");      // vcc25
244         regulator_set_voltage(ldo, 2500000, 2500000);
245         regulator_enable(ldo);
246         printk("%s set vpll vdd11=%dmV end\n", __func__, regulator_get_voltage(ldo));
247         regulator_put(ldo);
248         udelay(100);
249
250         ldo = regulator_get(NULL, "vdig2");     // vdd11
251         regulator_set_voltage(ldo, 1100000, 1100000);
252         regulator_enable(ldo);
253         printk("%s set vdig2 vdd11=%dmV end\n", __func__, regulator_get_voltage(ldo));
254         regulator_put(ldo);
255         udelay(100);
256
257         ldo = regulator_get(NULL, "vaux33");     //vcc_tp
258         regulator_set_voltage(ldo, 3300000, 3300000);
259         regulator_enable(ldo);
260         printk("%s set vaux33 vcc_tp=%dmV end\n", __func__, regulator_get_voltage(ldo));
261         regulator_put(ldo);
262         udelay(100);
263         
264         dcdc = regulator_get(NULL, "vdd_cpu");  //vdd_cpu
265         regulator_set_voltage(dcdc, 1200000, 1200000);
266         regulator_enable(dcdc);
267         printk("%s set vdd1 vdd_cpu=%dmV end\n", __func__, regulator_get_voltage(dcdc));
268         regulator_put(dcdc);
269         udelay(100);
270         
271         dcdc = regulator_get(NULL, "vdd2");     //vcc_ddr 
272         regulator_set_voltage(dcdc, 1200000, 1200000);  // 1.5*4/5 = 1.2 and Vout=1.5v
273         regulator_enable(dcdc);
274         printk("%s set vdd2 vcc_ddr=%dmV end\n", __func__, regulator_get_voltage(dcdc));
275         regulator_put(dcdc);
276         udelay(100);
277         
278         ldo = regulator_get(NULL, "vdig1");     //vcc18_cif
279         regulator_set_voltage(ldo, 1800000, 1800000);
280         regulator_enable(ldo);
281         printk("%s set vdig1 vcc18_cif=%dmV end\n", __func__, regulator_get_voltage(ldo));
282         regulator_put(ldo);
283         udelay(100);
284         
285         dcdc = regulator_get(NULL, "vaux1"); //vcc25_hdmi
286         regulator_set_voltage(dcdc,2500000,2500000);
287         regulator_enable(dcdc); 
288         printk("%s set vaux1 vcc25_hdmi=%dmV end\n", __func__, regulator_get_voltage(dcdc));
289         regulator_put(dcdc);
290         udelay(100);
291
292         ldo = regulator_get(NULL, "vaux2");     //vcca33
293         regulator_set_voltage(ldo, 3300000, 3300000);
294         regulator_enable(ldo);
295         printk("%s set vaux2 vcca33=%dmV end\n", __func__, regulator_get_voltage(ldo));
296         regulator_put(ldo);
297         udelay(100);
298
299         ldo = regulator_get(NULL, "vdac"); // vccio_wl
300         regulator_set_voltage(ldo,1800000,1800000);
301         regulator_enable(ldo); 
302         printk("%s set vdac vccio_wl=%dmV end\n", __func__, regulator_get_voltage(ldo));
303         regulator_put(ldo);
304         udelay(100);
305
306         ldo = regulator_get(NULL, "vmmc");  //vcc28_cif
307         regulator_set_voltage(ldo,2800000,2800000);
308         regulator_enable(ldo); 
309         printk("%s set vmmc vcc28_cif=%dmV end\n", __func__, regulator_get_voltage(ldo));
310         regulator_put(ldo);
311         udelay(100);
312
313         #ifdef CONFIG_RK30_PWM_REGULATOR
314         dcdc = regulator_get(NULL, "vdd_core"); // vdd_log
315         regulator_set_voltage(dcdc, 1100000, 1100000);
316         regulator_enable(dcdc);
317         printk("%s set vdd_core=%dmV end\n", __func__, regulator_get_voltage(dcdc));
318         regulator_put(dcdc);
319         udelay(100);
320         #endif
321         
322         printk("%s,line=%d END\n", __func__,__LINE__);
323         
324         return 0;
325 }
326
327 static struct regulator_consumer_supply tps65910_smps1_supply[] = {
328         {
329                 .supply = "vdd1",
330         },
331         {
332                 .supply = "vdd_cpu",
333         },
334 };
335 static struct regulator_consumer_supply tps65910_smps2_supply[] = {
336         {
337                 .supply = "vdd2",
338         },
339         
340 };
341 static struct regulator_consumer_supply tps65910_smps3_supply[] = {
342         {
343                 .supply = "vdd3",
344         },
345 };
346 static struct regulator_consumer_supply tps65910_smps4_supply[] = {
347         {
348                 .supply = "vio",
349         },
350 };
351 static struct regulator_consumer_supply tps65910_ldo1_supply[] = {
352         {
353                 .supply = "vdig1",
354         },
355 };
356 static struct regulator_consumer_supply tps65910_ldo2_supply[] = {
357         {
358                 .supply = "vdig2",
359         },
360 };
361
362 static struct regulator_consumer_supply tps65910_ldo3_supply[] = {
363         {
364                 .supply = "vaux1",
365         },
366 };
367 static struct regulator_consumer_supply tps65910_ldo4_supply[] = {
368         {
369                 .supply = "vaux2",
370         },
371 };
372 static struct regulator_consumer_supply tps65910_ldo5_supply[] = {
373         {
374                 .supply = "vaux33",
375         },
376 };
377 static struct regulator_consumer_supply tps65910_ldo6_supply[] = {
378         {
379                 .supply = "vmmc",
380         },
381 };
382 static struct regulator_consumer_supply tps65910_ldo7_supply[] = {
383         {
384                 .supply = "vdac",
385         },
386 };
387
388 static struct regulator_consumer_supply tps65910_ldo8_supply[] = {
389         {
390                 .supply = "vpll",
391         },
392 };
393
394 static struct regulator_init_data tps65910_smps1 = {
395         .constraints = {
396                 .name           = "VDD1",
397                 .min_uV                 = 600000,
398                 .max_uV                 = 1500000,
399                 .apply_uV               = 1,
400                 .always_on = 1,
401                 .valid_ops_mask = REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_VOLTAGE | REGULATOR_CHANGE_MODE,
402                 .valid_modes_mask = REGULATOR_MODE_STANDBY | REGULATOR_MODE_NORMAL,
403
404         },
405         .num_consumer_supplies = ARRAY_SIZE(tps65910_smps1_supply),
406         .consumer_supplies =  tps65910_smps1_supply,
407 };
408
409 /* */
410 static struct regulator_init_data tps65910_smps2 = {
411         .constraints = {
412                 .name           = "VDD2",
413                 .min_uV                 = 600000,
414                 .max_uV                 = 1500000,
415                 .apply_uV               = 1,
416                 .always_on = 1,
417                 .valid_ops_mask = REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_VOLTAGE | REGULATOR_CHANGE_MODE,
418                 .valid_modes_mask = REGULATOR_MODE_STANDBY | REGULATOR_MODE_NORMAL,
419
420         },
421         .num_consumer_supplies = ARRAY_SIZE(tps65910_smps2_supply),
422         .consumer_supplies =  tps65910_smps2_supply,
423 };
424
425 /* */
426 static struct regulator_init_data tps65910_smps3 = {
427         .constraints = {
428                 .name           = "VDD3",
429                 .min_uV                 = 1000000,
430                 .max_uV                 = 1400000,
431                 .apply_uV               = 1,
432                 .always_on = 1,
433                 .valid_ops_mask = REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_VOLTAGE | REGULATOR_CHANGE_MODE,
434                 .valid_modes_mask = REGULATOR_MODE_STANDBY | REGULATOR_MODE_NORMAL,
435
436         },
437         .num_consumer_supplies = ARRAY_SIZE(tps65910_smps3_supply),
438         .consumer_supplies =  tps65910_smps3_supply,
439 };
440
441 static struct regulator_init_data tps65910_smps4 = {
442         .constraints = {
443                 .name           = "VIO",
444                 .min_uV                 = 1800000,
445                 .max_uV                 = 3300000,
446                 .apply_uV               = 1,
447                 .always_on = 1,
448                 .valid_ops_mask = REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_VOLTAGE | REGULATOR_CHANGE_MODE,
449                 .valid_modes_mask = REGULATOR_MODE_STANDBY | REGULATOR_MODE_NORMAL,
450
451         },
452         .num_consumer_supplies = ARRAY_SIZE(tps65910_smps4_supply),
453         .consumer_supplies =  tps65910_smps4_supply,
454 };
455 static struct regulator_init_data tps65910_ldo1 = {
456         .constraints = {
457                 .name           = "VDIG1",
458                 .min_uV                 = 1200000,
459                 .max_uV                 = 2700000,
460                 .apply_uV               = 1,
461                 
462                 .valid_ops_mask = REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_VOLTAGE | REGULATOR_CHANGE_MODE,
463                 .valid_modes_mask = REGULATOR_MODE_STANDBY | REGULATOR_MODE_NORMAL,
464
465         },
466         .num_consumer_supplies = ARRAY_SIZE(tps65910_ldo1_supply),
467         .consumer_supplies =  tps65910_ldo1_supply,
468 };
469
470 /* */
471 static struct regulator_init_data tps65910_ldo2 = {
472         .constraints = {
473                 .name           = "VDIG2",
474                 .min_uV                 = 1000000,
475                 .max_uV                 = 1800000,
476                 .apply_uV               = 1,
477                 
478                 .valid_ops_mask = REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_VOLTAGE | REGULATOR_CHANGE_MODE,
479                 .valid_modes_mask = REGULATOR_MODE_STANDBY | REGULATOR_MODE_NORMAL,
480
481         },
482         .num_consumer_supplies = ARRAY_SIZE(tps65910_ldo2_supply),
483         .consumer_supplies =  tps65910_ldo2_supply,
484 };
485
486 /* */
487 static struct regulator_init_data tps65910_ldo3 = {
488         .constraints = {
489                 .name           = "VAUX1",
490                 .min_uV                 = 1800000,
491                 .max_uV                 = 3300000,
492                 .apply_uV               = 1,
493                 
494                 .valid_ops_mask = REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_VOLTAGE | REGULATOR_CHANGE_MODE,
495                 .valid_modes_mask = REGULATOR_MODE_STANDBY | REGULATOR_MODE_NORMAL,
496
497         },
498         .num_consumer_supplies = ARRAY_SIZE(tps65910_ldo3_supply),
499         .consumer_supplies =  tps65910_ldo3_supply,
500 };
501
502 /* */
503 static struct regulator_init_data tps65910_ldo4 = {
504         .constraints = {
505                 .name           = "VAUX2",
506                 .min_uV                 = 1800000,
507                 .max_uV                 = 3300000,
508                 .apply_uV               = 1,
509                 
510                 .valid_ops_mask = REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_VOLTAGE | REGULATOR_CHANGE_MODE,
511                 .valid_modes_mask = REGULATOR_MODE_STANDBY | REGULATOR_MODE_NORMAL,
512
513         },
514         .num_consumer_supplies = ARRAY_SIZE(tps65910_ldo4_supply),
515         .consumer_supplies =  tps65910_ldo4_supply,
516 };
517
518 /* */
519 static struct regulator_init_data tps65910_ldo5 = {
520         .constraints = {
521                 .name           = "VAUX33",
522                 .min_uV                 = 1800000,
523                 .max_uV                 = 3300000,
524                 .apply_uV               = 1,
525                 
526                 .valid_ops_mask = REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_VOLTAGE | REGULATOR_CHANGE_MODE,
527                 .valid_modes_mask = REGULATOR_MODE_STANDBY | REGULATOR_MODE_NORMAL,
528
529         },
530         .num_consumer_supplies = ARRAY_SIZE(tps65910_ldo5_supply),
531         .consumer_supplies =  tps65910_ldo5_supply,
532 };
533
534 /* */
535 static struct regulator_init_data tps65910_ldo6 = {
536         .constraints = {
537                 .name           = "VMMC",
538                 .min_uV                 = 1800000,
539                 .max_uV                 = 3300000,
540                 .apply_uV               = 1,
541                 
542                 .valid_ops_mask = REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_VOLTAGE | REGULATOR_CHANGE_MODE,
543                 .valid_modes_mask = REGULATOR_MODE_STANDBY | REGULATOR_MODE_NORMAL,
544
545         },
546         .num_consumer_supplies = ARRAY_SIZE(tps65910_ldo6_supply),
547         .consumer_supplies =  tps65910_ldo6_supply,
548 };
549
550 /* */
551 static struct regulator_init_data tps65910_ldo7 = {
552         .constraints = {
553                 .name           = "VDAC",
554                 .min_uV                 = 1800000,
555                 .max_uV                 = 2850000,
556                 .apply_uV               = 1,
557                 
558                 .valid_ops_mask = REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_VOLTAGE | REGULATOR_CHANGE_MODE,
559                 .valid_modes_mask = REGULATOR_MODE_STANDBY | REGULATOR_MODE_NORMAL,
560
561         },
562         .num_consumer_supplies = ARRAY_SIZE(tps65910_ldo7_supply),
563         .consumer_supplies =  tps65910_ldo7_supply,
564 };
565
566 /* */
567 static struct regulator_init_data tps65910_ldo8 = {
568         .constraints = {
569                 .name           = "VPLL",
570                 .min_uV                 = 1000000,
571                 .max_uV                 = 2500000,
572                 .apply_uV               = 1,
573                 .always_on = 1,
574                 .valid_ops_mask = REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_VOLTAGE | REGULATOR_CHANGE_MODE,
575                 .valid_modes_mask = REGULATOR_MODE_STANDBY | REGULATOR_MODE_NORMAL,
576
577         },
578         .num_consumer_supplies = ARRAY_SIZE(tps65910_ldo8_supply),
579         .consumer_supplies =  tps65910_ldo8_supply,
580 };
581
582 void __sramfunc board_pmu_tps65910_suspend(void)
583 {       
584         grf_writel(GPIO6_PB1_DIR_OUT, GRF_GPIO6L_DIR_ADDR);
585         grf_writel(GPIO6_PB1_DO_HIGH, GRF_GPIO6L_DO_ADDR);  //set gpio6_b1 output low
586         grf_writel(GPIO6_PB1_EN_MASK, GRF_GPIO6L_EN_ADDR);
587 }
588 void __sramfunc board_pmu_tps65910_resume(void)
589 {
590         grf_writel(GPIO6_PB1_DIR_OUT, GRF_GPIO6L_DIR_ADDR);
591         grf_writel(GPIO6_PB1_DO_LOW, GRF_GPIO6L_DO_ADDR);  //set gpio6_b1 output low
592         grf_writel(GPIO6_PB1_EN_MASK, GRF_GPIO6L_EN_ADDR);
593         #ifdef CONFIG_CLK_SWITCH_TO_32K                 //switch clk to 24M
594         sram_32k_udelay(10000);
595         #else
596         sram_udelay(2000);
597         #endif
598 }
599
600 static struct tps65910_board tps65910_data = {
601         .irq    = (unsigned)TPS65910_HOST_IRQ,          
602         .irq_base = NR_GIC_IRQS + NR_GPIO_IRQS,
603         .gpio_base = TPS65910_GPIO_EXPANDER_BASE,
604         
605         .pre_init = tps65910_pre_init,
606         .post_init = tps65910_post_init,
607
608         //TPS65910_NUM_REGS = 13
609         // Regulators
610         .tps65910_pmic_init_data[TPS65910_REG_VRTC] = NULL,             
611         .tps65910_pmic_init_data[TPS65910_REG_VIO] = &tps65910_smps4,
612         .tps65910_pmic_init_data[TPS65910_REG_VDD1] = &tps65910_smps1,
613         .tps65910_pmic_init_data[TPS65910_REG_VDD2] = &tps65910_smps2,
614         .tps65910_pmic_init_data[TPS65910_REG_VDD3] = &tps65910_smps3,
615         .tps65910_pmic_init_data[TPS65910_REG_VDIG1] = &tps65910_ldo1,
616         .tps65910_pmic_init_data[TPS65910_REG_VDIG2] = &tps65910_ldo2,
617         .tps65910_pmic_init_data[TPS65910_REG_VPLL] = &tps65910_ldo8,
618         .tps65910_pmic_init_data[TPS65910_REG_VDAC] = &tps65910_ldo7,
619         .tps65910_pmic_init_data[TPS65910_REG_VAUX1] = &tps65910_ldo3,
620         .tps65910_pmic_init_data[TPS65910_REG_VAUX2] = &tps65910_ldo4,
621         .tps65910_pmic_init_data[TPS65910_REG_VAUX33] = &tps65910_ldo5,
622         .tps65910_pmic_init_data[TPS65910_REG_VMMC] = &tps65910_ldo6,
623  
624 };
625
626 #endif
627