diff options
author | Thara Gopinath <thara@ti.com> | 2010-05-29 12:32:21 -0400 |
---|---|---|
committer | Kevin Hilman <khilman@deeprootsystems.com> | 2010-12-22 17:31:02 -0500 |
commit | 2f34ce81b8c05c900e45bd88595cc154f7bb5957 (patch) | |
tree | 9bd5793ea11fef37439cd9a369d22d38ce30b268 /arch/arm/plat-omap | |
parent | f17f9726c27c3921e00a5750e85070e6dd7e1ff7 (diff) |
OMAP3: PM: Adding voltage driver support.
This patch adds voltage driver support for OMAP3. The driver
allows configuring the voltage controller and voltage
processors during init and exports APIs to enable/disable
voltage processors, scale voltage and reset voltage.
The driver maintains the global voltage table on a per
VDD basis which contains the various voltages supported by the
VDD along with per voltage dependent data like smartreflex
efuse offset, errminlimit and voltage processor errorgain.
The driver also allows the voltage parameters dependent on the
PMIC to be passed from the PMIC file through an API.
The driver allows scaling of VDD voltages either through
"vc bypass method" or through "vp forceupdate method" the
choice being configurable through the board file.
This patch contains code originally in linux omap pm branch
smartreflex driver. Major contributors to this driver are
Lesly A M, Rajendra Nayak, Kalle Jokiniemi, Paul Walmsley,
Nishant Menon, Kevin Hilman. The separation of PMIC parameters
into a separate structure which can be populated from
the PMIC file is based on the work of Lun Chang from Motorola
in an internal tree.
Signed-off-by: Thara Gopinath <thara@ti.com>
[khilman: fixed link error for OMAP2-only defconfig]
Signed-off-by: Kevin Hilman <khilman@deeprootsystems.com>
Diffstat (limited to 'arch/arm/plat-omap')
-rw-r--r-- | arch/arm/plat-omap/include/plat/voltage.h | 134 |
1 files changed, 134 insertions, 0 deletions
diff --git a/arch/arm/plat-omap/include/plat/voltage.h b/arch/arm/plat-omap/include/plat/voltage.h new file mode 100644 index 000000000000..2f4f59abd19f --- /dev/null +++ b/arch/arm/plat-omap/include/plat/voltage.h | |||
@@ -0,0 +1,134 @@ | |||
1 | /* | ||
2 | * OMAP Voltage Management Routines | ||
3 | * | ||
4 | * Author: Thara Gopinath <thara@ti.com> | ||
5 | * | ||
6 | * Copyright (C) 2009 Texas Instruments, Inc. | ||
7 | * Thara Gopinath <thara@ti.com> | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or modify | ||
10 | * it under the terms of the GNU General Public License version 2 as | ||
11 | * published by the Free Software Foundation. | ||
12 | */ | ||
13 | |||
14 | #ifndef __ARCH_ARM_MACH_OMAP2_VOLTAGE_H | ||
15 | #define __ARCH_ARM_MACH_OMAP2_VOLTAGE_H | ||
16 | |||
17 | #define VOLTSCALE_VPFORCEUPDATE 1 | ||
18 | #define VOLTSCALE_VCBYPASS 2 | ||
19 | |||
20 | /* | ||
21 | * OMAP3 GENERIC setup times. Revisit to see if these needs to be | ||
22 | * passed from board or PMIC file | ||
23 | */ | ||
24 | #define OMAP3_CLKSETUP 0xff | ||
25 | #define OMAP3_VOLTOFFSET 0xff | ||
26 | #define OMAP3_VOLTSETUP2 0xff | ||
27 | |||
28 | /* Voltage value defines */ | ||
29 | #define OMAP3430_VDD_MPU_OPP1_UV 975000 | ||
30 | #define OMAP3430_VDD_MPU_OPP2_UV 1075000 | ||
31 | #define OMAP3430_VDD_MPU_OPP3_UV 1200000 | ||
32 | #define OMAP3430_VDD_MPU_OPP4_UV 1270000 | ||
33 | #define OMAP3430_VDD_MPU_OPP5_UV 1350000 | ||
34 | |||
35 | #define OMAP3430_VDD_CORE_OPP1_UV 975000 | ||
36 | #define OMAP3430_VDD_CORE_OPP2_UV 1050000 | ||
37 | #define OMAP3430_VDD_CORE_OPP3_UV 1150000 | ||
38 | |||
39 | #define OMAP3630_VDD_MPU_OPP50_UV 1012500 | ||
40 | #define OMAP3630_VDD_MPU_OPP100_UV 1200000 | ||
41 | #define OMAP3630_VDD_MPU_OPP120_UV 1325000 | ||
42 | #define OMAP3630_VDD_MPU_OPP1G_UV 1375000 | ||
43 | |||
44 | #define OMAP3630_VDD_CORE_OPP50_UV 1000000 | ||
45 | #define OMAP3630_VDD_CORE_OPP100_UV 1200000 | ||
46 | |||
47 | /** | ||
48 | * struct voltagedomain - omap voltage domain global structure. | ||
49 | * @name: Name of the voltage domain which can be used as a unique | ||
50 | * identifier. | ||
51 | */ | ||
52 | struct voltagedomain { | ||
53 | char *name; | ||
54 | }; | ||
55 | |||
56 | /* API to get the voltagedomain pointer */ | ||
57 | struct voltagedomain *omap_voltage_domain_lookup(char *name); | ||
58 | |||
59 | /** | ||
60 | * struct omap_volt_data - Omap voltage specific data. | ||
61 | * @voltage_nominal: The possible voltage value in uV | ||
62 | * @sr_efuse_offs: The offset of the efuse register(from system | ||
63 | * control module base address) from where to read | ||
64 | * the n-target value for the smartreflex module. | ||
65 | * @sr_errminlimit: Error min limit value for smartreflex. This value | ||
66 | * differs at differnet opp and thus is linked | ||
67 | * with voltage. | ||
68 | * @vp_errorgain: Error gain value for the voltage processor. This | ||
69 | * field also differs according to the voltage/opp. | ||
70 | */ | ||
71 | struct omap_volt_data { | ||
72 | u32 volt_nominal; | ||
73 | u32 sr_efuse_offs; | ||
74 | u8 sr_errminlimit; | ||
75 | u8 vp_errgain; | ||
76 | }; | ||
77 | |||
78 | /** | ||
79 | * struct omap_volt_pmic_info - PMIC specific data required by voltage driver. | ||
80 | * @slew_rate: PMIC slew rate (in uv/us) | ||
81 | * @step_size: PMIC voltage step size (in uv) | ||
82 | * @vsel_to_uv: PMIC API to convert vsel value to actual voltage in uV. | ||
83 | * @uv_to_vsel: PMIC API to convert voltage in uV to vsel value. | ||
84 | */ | ||
85 | struct omap_volt_pmic_info { | ||
86 | int slew_rate; | ||
87 | int step_size; | ||
88 | u32 on_volt; | ||
89 | u32 onlp_volt; | ||
90 | u32 ret_volt; | ||
91 | u32 off_volt; | ||
92 | u16 volt_setup_time; | ||
93 | u8 vp_erroroffset; | ||
94 | u8 vp_vstepmin; | ||
95 | u8 vp_vstepmax; | ||
96 | u8 vp_vddmin; | ||
97 | u8 vp_vddmax; | ||
98 | u8 vp_timeout_us; | ||
99 | u8 i2c_slave_addr; | ||
100 | u8 pmic_reg; | ||
101 | unsigned long (*vsel_to_uv) (const u8 vsel); | ||
102 | u8 (*uv_to_vsel) (unsigned long uV); | ||
103 | }; | ||
104 | |||
105 | unsigned long omap_vp_get_curr_volt(struct voltagedomain *voltdm); | ||
106 | void omap_vp_enable(struct voltagedomain *voltdm); | ||
107 | void omap_vp_disable(struct voltagedomain *voltdm); | ||
108 | int omap_voltage_scale_vdd(struct voltagedomain *voltdm, | ||
109 | unsigned long target_volt); | ||
110 | void omap_voltage_reset(struct voltagedomain *voltdm); | ||
111 | void omap_voltage_get_volttable(struct voltagedomain *voltdm, | ||
112 | struct omap_volt_data **volt_data); | ||
113 | struct omap_volt_data *omap_voltage_get_voltdata(struct voltagedomain *voltdm, | ||
114 | unsigned long volt); | ||
115 | unsigned long omap_voltage_get_nom_volt(struct voltagedomain *voltdm); | ||
116 | struct dentry *omap_voltage_get_dbgdir(struct voltagedomain *voltdm); | ||
117 | #ifdef CONFIG_PM | ||
118 | int omap_voltage_register_pmic(struct voltagedomain *voltdm, | ||
119 | struct omap_volt_pmic_info *pmic_info); | ||
120 | void omap_change_voltscale_method(struct voltagedomain *voltdm, | ||
121 | int voltscale_method); | ||
122 | int omap_voltage_late_init(void); | ||
123 | #else | ||
124 | static inline int omap_voltage_register_pmic(struct voltagedomain *voltdm, | ||
125 | struct omap_volt_pmic_info *pmic_info) {} | ||
126 | static inline void omap_change_voltscale_method(struct voltagedomain *voltdm, | ||
127 | int voltscale_method) {} | ||
128 | static inline int omap_voltage_late_init(void) | ||
129 | { | ||
130 | return -EINVAL; | ||
131 | } | ||
132 | #endif | ||
133 | |||
134 | #endif | ||