1
2
3
4
5
6
7
8
9
10
11 #ifndef __ARCH_ARM_MACH_OMAP2_VOLTAGE_H
12 #define __ARCH_ARM_MACH_OMAP2_VOLTAGE_H
13
14 #include <linux/err.h>
15
16 #include <linux/platform_data/voltage-omap.h>
17
18 #include "vc.h"
19 #include "vp.h"
20
21 struct powerdomain;
22
23
24
25
26
27 #define OMAP3_CLKSETUP 0xff
28 #define OMAP3_VOLTOFFSET 0xff
29 #define OMAP3_VOLTSETUP2 0xff
30
31
32
33
34
35
36
37
38
39
40 struct omap_vfsm_instance {
41 u32 voltsetup_mask;
42 u8 voltsetup_reg;
43 u8 voltsetup_off_reg;
44 };
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62 struct voltagedomain {
63 char *name;
64 bool scalable;
65 struct list_head node;
66 struct omap_vc_channel *vc;
67 const struct omap_vfsm_instance *vfsm;
68 struct omap_vp_instance *vp;
69 struct omap_voltdm_pmic *pmic;
70 struct omap_vp_param *vp_param;
71 struct omap_vc_param *vc_param;
72
73
74 u32 (*read) (u8 offset);
75 void (*write) (u32 val, u8 offset);
76 u32 (*rmw)(u32 mask, u32 bits, u8 offset);
77
78 union {
79 const char *name;
80 u32 rate;
81 } sys_clk;
82
83 int (*scale) (struct voltagedomain *voltdm,
84 unsigned long target_volt);
85
86 u32 nominal_volt;
87 struct omap_volt_data *volt_data;
88 };
89
90
91 #define OMAP3430_VP1_VLIMITTO_VDDMIN 850000
92 #define OMAP3430_VP1_VLIMITTO_VDDMAX 1425000
93 #define OMAP3430_VP2_VLIMITTO_VDDMIN 900000
94 #define OMAP3430_VP2_VLIMITTO_VDDMAX 1150000
95
96 #define OMAP3630_VP1_VLIMITTO_VDDMIN 900000
97 #define OMAP3630_VP1_VLIMITTO_VDDMAX 1350000
98 #define OMAP3630_VP2_VLIMITTO_VDDMIN 900000
99 #define OMAP3630_VP2_VLIMITTO_VDDMAX 1200000
100
101 #define OMAP4_VP_MPU_VLIMITTO_VDDMIN 830000
102 #define OMAP4_VP_MPU_VLIMITTO_VDDMAX 1410000
103 #define OMAP4_VP_IVA_VLIMITTO_VDDMIN 830000
104 #define OMAP4_VP_IVA_VLIMITTO_VDDMAX 1260000
105 #define OMAP4_VP_CORE_VLIMITTO_VDDMIN 830000
106 #define OMAP4_VP_CORE_VLIMITTO_VDDMAX 1200000
107
108
109
110
111
112
113
114
115
116
117
118
119
120 struct omap_voltdm_pmic {
121 int slew_rate;
122 int step_size;
123 u16 i2c_slave_addr;
124 u16 volt_reg_addr;
125 u16 cmd_reg_addr;
126 u8 vp_erroroffset;
127 u8 vp_vstepmin;
128 u8 vp_vstepmax;
129 u32 vddmin;
130 u32 vddmax;
131 u8 vp_timeout_us;
132 bool i2c_high_speed;
133 u32 i2c_pad_load;
134 u8 i2c_mcode;
135 unsigned long (*vsel_to_uv) (const u8 vsel);
136 u8 (*uv_to_vsel) (unsigned long uV);
137 };
138
139 struct omap_vp_param {
140 u32 vddmax;
141 u32 vddmin;
142 };
143
144 struct omap_vc_param {
145 u32 on;
146 u32 onlp;
147 u32 ret;
148 u32 off;
149 };
150
151 void omap_voltage_get_volttable(struct voltagedomain *voltdm,
152 struct omap_volt_data **volt_data);
153 struct omap_volt_data *omap_voltage_get_voltdata(struct voltagedomain *voltdm,
154 unsigned long volt);
155 int omap_voltage_register_pmic(struct voltagedomain *voltdm,
156 struct omap_voltdm_pmic *pmic);
157 int omap_voltage_late_init(void);
158
159 extern void omap2xxx_voltagedomains_init(void);
160 extern void omap3xxx_voltagedomains_init(void);
161 extern void omap44xx_voltagedomains_init(void);
162 extern void omap54xx_voltagedomains_init(void);
163
164 struct voltagedomain *voltdm_lookup(const char *name);
165 void voltdm_init(struct voltagedomain **voltdm_list);
166 int voltdm_add_pwrdm(struct voltagedomain *voltdm, struct powerdomain *pwrdm);
167 int voltdm_scale(struct voltagedomain *voltdm, unsigned long target_volt);
168 void voltdm_reset(struct voltagedomain *voltdm);
169 unsigned long voltdm_get_voltage(struct voltagedomain *voltdm);
170 #endif