1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40#include <twl4030.h>
41
42
43
44
45void twl4030_power_reset_init(void)
46{
47 u8 val = 0;
48 if (twl4030_i2c_read_u8(TWL4030_CHIP_PM_MASTER, &val,
49 TWL4030_PM_MASTER_P1_SW_EVENTS)) {
50 printf("Error:TWL4030: failed to read the power register\n");
51 printf("Could not initialize hardware reset\n");
52 } else {
53 val |= TWL4030_PM_MASTER_SW_EVENTS_STOPON_PWRON;
54 if (twl4030_i2c_write_u8(TWL4030_CHIP_PM_MASTER, val,
55 TWL4030_PM_MASTER_P1_SW_EVENTS)) {
56 printf("Error:TWL4030: failed to write the power register\n");
57 printf("Could not initialize hardware reset\n");
58 }
59 }
60}
61
62
63
64
65void twl4030_pmrecv_vsel_cfg(u8 vsel_reg, u8 vsel_val,
66 u8 dev_grp, u8 dev_grp_sel)
67{
68
69 twl4030_i2c_write_u8(TWL4030_CHIP_PM_RECEIVER, dev_grp_sel,
70 dev_grp);
71
72
73 twl4030_i2c_write_u8(TWL4030_CHIP_PM_RECEIVER, vsel_val,
74 vsel_reg);
75}
76
77void twl4030_power_init(void)
78{
79
80 twl4030_pmrecv_vsel_cfg(TWL4030_PM_RECEIVER_VAUX3_DEDICATED,
81 TWL4030_PM_RECEIVER_VAUX3_VSEL_28,
82 TWL4030_PM_RECEIVER_VAUX3_DEV_GRP,
83 TWL4030_PM_RECEIVER_DEV_GRP_P1);
84
85
86 twl4030_pmrecv_vsel_cfg(TWL4030_PM_RECEIVER_VPLL2_DEDICATED,
87 TWL4030_PM_RECEIVER_VPLL2_VSEL_18,
88 TWL4030_PM_RECEIVER_VPLL2_DEV_GRP,
89 TWL4030_PM_RECEIVER_DEV_GRP_ALL);
90
91
92 twl4030_pmrecv_vsel_cfg(TWL4030_PM_RECEIVER_VDAC_DEDICATED,
93 TWL4030_PM_RECEIVER_VDAC_VSEL_18,
94 TWL4030_PM_RECEIVER_VDAC_DEV_GRP,
95 TWL4030_PM_RECEIVER_DEV_GRP_P1);
96}
97
98void twl4030_power_mmc_init(void)
99{
100
101 twl4030_pmrecv_vsel_cfg(TWL4030_PM_RECEIVER_VMMC1_DEDICATED,
102 TWL4030_PM_RECEIVER_VMMC1_VSEL_30,
103 TWL4030_PM_RECEIVER_VMMC1_DEV_GRP,
104 TWL4030_PM_RECEIVER_DEV_GRP_P1);
105}
106