1
2/*
3 * Copyright (c) 2012, ETH Zurich. All rights reserved.
4 *
5 * This file is distributed under the terms in the attached LICENSE file.
6 * If you do not find this file, copies can be found by writing to:
7 * ETH Zurich D-INFK, Universitaetstrasse 6, CH-8092 Zurich. Attn: Systems Group.
8 */
9
10/*
11 * ti_twl6030.dev
12 *
13 * DESCRIPTION: TI TWL6030 Power Companion IC
14 * 
15 * Section numbers refer to TWL6030 Register Map
16 * (Literature Number: SWCU084)
17 *
18 * Talking to this device will usually go over I2C, but it's still helpful to
19 * have the register definitions
20 *
21 * TODO: need to add everything other than VMMC -SG
22 */
23
24device ti_twl6030 msbfirst (addr b) "TI TWL6030 Power Companion (via I2C)" {
25    // dummy set of constants representing the I2C addresses of the different
26    // register groups
27    constants i2c_addrs "Physical (I2C) addresses" {
28        i2c_addr_vmmc = 0x48 "VMMC I2C address";
29    };
30
31    // address spaces for I2C physical adresses
32    // id1 == i2c addr 0x48
33    space id1(i) valuewise "Registers accessed via I2C addr 0x48";
34
35    regtype cfg_grp "Group Configuration" {
36        _       5 rsvd;
37        grp_mod 1 "Modem Power Group";
38        grp_con 1 "Connectivity Power Group";
39        grp_app 1 "Application Power Group";
40    };
41
42    constants transition_cmd width(2) "Transition Command" {
43        tcmd_off = 0b00 "Off";
44        tcmd_ams = 0b01 "Sleep/Active";
45        // 0b10 is reserved
46        tcmd_act = 0b11 "Active";
47    };
48    regtype cfg_trans "Transition Configuration" { // not sure about name, guessing -SG
49        _      2 rsvd;
50        off    2 type(transition_cmd) "off state";
51        sleep  2 type(transition_cmd) "sleep state";
52        active 2 type(transition_cmd) "active state";
53    };
54
55    constants pwrstate width(2) "Power State" {
56        pwr_off   = 0b00 "Off";
57        pwr_on    = 0b01 "On";
58        pwr_off_2 = 0b10 "Off";
59        pwr_sleep = 0b11 "Sleep";
60    };
61
62    regtype cfg_state_w "State configuration (write)" {
63        grp_mod 1 "Set if apply state to modem power group";
64        grp_con 1 "Set if apply state to connectivity power group";
65        grp_app 1 "Set if apply state to application power group";
66        _       3 rsvd;
67        state   2 type(pwrstate) "Resource state to apply";
68    };
69
70    regtype cfg_state_r "State configuration (read)" {
71        mod_state 2 type(pwrstate) "Resource state for modem power group";
72        con_state 2 type(pwrstate) "Resource state for connectivity power group";
73        app_state 2 type(pwrstate) "Resource state for application power group";
74        state     2 type(pwrstate) "Resource state after power group arbitration";
75    };
76
77    constants wr width(1) "Warm reset" {
78        wr_reload_dflt = 0b0 "Reload default VSEL value on warm reset";
79        wr_keep        = 0b1 "Keep voltage configuration settings on warm reset";
80    };
81    // Table 121
82    constants vsel width(5) "Voltage selector" {
83        v0v0 = 0b00000 "0.0V";
84        v1v0 = 0b00001 "1.0V";
85        v1v1 = 0b00010 "1.1V";
86        v1v2 = 0b00011 "1.2V";
87        v1v3 = 0b00100 "1.3V";
88        v1v4 = 0b00101 "1.4V";
89        v1v5 = 0b00110 "1.5V";
90        v1v6 = 0b00111 "1.6V";
91        v1v7 = 0b01000 "1.7V";
92        v1v8 = 0b01001 "1.8V";
93        v1v9 = 0b01010 "1.9V";
94        v2v0 = 0b01011 "2.0V";
95        v2v1 = 0b01100 "2.1V";
96        v2v2 = 0b01101 "2.2V";
97        v2v3 = 0b01110 "2.3V";
98        v2v4 = 0b01111 "2.4V";
99        v2v5 = 0b10000 "2.5V";
100        v2v6 = 0b10001 "2.6V";
101        v2v7 = 0b10010 "2.7V";
102        v2v8 = 0b10011 "2.8V";
103        v2v9 = 0b10100 "2.9V";
104        v3v0 = 0b10101 "3.0V";
105        v3v1 = 0b10110 "3.1V";
106        v3v2 = 0b10111 "3.2V";
107        v3v3 = 0b11000 "3.3V";
108        // 0b11001 - 0b11110 reserved
109        v2v75 = 0b11111 "2.75V";
110    };
111    regtype cfg_voltage "Voltage configuration" {
112        wr_s 1 type(wr) "Warm reset sensitivity";
113        _    2 rsvd;
114        vsel 5 type(vsel) "Voltage to apply";
115    };
116
117    regtype cfg_voltage2 "Voltage configuration" {
118        wr_s 1 type(wr) "Warm reset sensitivity";
119        _    1 rsvd;
120        vsel 6 "Voltage to apply";
121    };
122
123    register mmcctrl id1(0xEE) "MMCCTRL" {
124        _               4 rsvd;
125        vmmc_auto_off   1 "Is the regulator turned off automatically in case card is extracted?";
126        sw_fc           1 "Configure the external receptable mechanical contact";
127        _               1 rsvd;
128        sts_mmc         1 "Is card present?";
129    };
130
131    register mmcdebouncing id1(0xED) "MMC Debouncing" {
132        mmc_dev_bypass  1 "Is MMC debouncing bypassed?";
133        mins_deb        4 "Card insertion debouncing time";
134        mext_deb        3 "Card extraction debouncing time";
135    };
136
137    register vcore_cfg_voltage id1(0x62) "VCORE3 Config Voltage" type(cfg_voltage2);
138
139    // VMMC registers
140    // Table 152
141    //register vmmc_cfg_grp addr(b, 0x98) "VMMC Group Configuration" type(cfg_grp);
142    register vmmc_cfg_grp id1(0x98) "VMMC Group Configuration" type(cfg_grp);
143
144    // Table 153
145    //register vmmc_cfg_trans addr(b, 0x99) "VMMC Transition Configuration" type(cfg_trans);
146    register vmmc_cfg_trans id1(0x99) "VMMC Transition Configuration" type(cfg_trans);
147
148    // Table 154
149    //register vmmc_cfg_state_w wo addr(b, 0x9A) "VMMC State Configuration (write format)" type(cfg_state_w);
150    register vmmc_cfg_state_w wo id1(0x9A) "VMMC State Configuration (write format)" type(cfg_state_w);
151
152    // Table 155
153    //register vmmc_cfg_state_r ro also addr(b, 0x9A) "VMMC State Configuration (read format)" type(cfg_state_r);
154    register vmmc_cfg_state_r ro also id1(0x9A) "VMMC State Configuration (read format)" type(cfg_state_r);
155
156    // Table 156
157    //register vmmc_cfg_voltage addr(b, 0x9B) "VMMC Voltage Configuration" type(cfg_voltage);
158    register vmmc_cfg_voltage id1(0x9B) "VMMC Voltage Configuration" type(cfg_voltage);
159};
160