Commit | Line | Data |
---|---|---|
c0718df4 PW |
1 | /* |
2 | * OMAP3/OMAP4 Voltage Management Routines | |
3 | * | |
4 | * Author: Thara Gopinath <thara@ti.com> | |
5 | * | |
6 | * Copyright (C) 2007 Texas Instruments, Inc. | |
7 | * Rajendra Nayak <rnayak@ti.com> | |
8 | * Lesly A M <x0080970@ti.com> | |
9 | * | |
10 | * Copyright (C) 2008 Nokia Corporation | |
11 | * Kalle Jokiniemi | |
12 | * | |
13 | * Copyright (C) 2010 Texas Instruments, Inc. | |
14 | * Thara Gopinath <thara@ti.com> | |
15 | * | |
16 | * This program is free software; you can redistribute it and/or modify | |
17 | * it under the terms of the GNU General Public License version 2 as | |
18 | * published by the Free Software Foundation. | |
19 | */ | |
20 | #include <linux/kernel.h> | |
21 | #include <linux/err.h> | |
22 | #include <linux/init.h> | |
23 | ||
4e65331c | 24 | #include "common.h" |
89ab216b | 25 | #include "soc.h" |
c0718df4 PW |
26 | #include "prm-regbits-44xx.h" |
27 | #include "prm44xx.h" | |
28 | #include "prcm44xx.h" | |
29 | #include "prminst44xx.h" | |
30 | #include "voltage.h" | |
31 | #include "omap_opp_data.h" | |
32 | #include "vc.h" | |
33 | #include "vp.h" | |
34 | ||
5892bb1f | 35 | static const struct omap_vfsm_instance omap4_vdd_mpu_vfsm = { |
c0718df4 | 36 | .voltsetup_reg = OMAP4_PRM_VOLTSETUP_MPU_RET_SLEEP_OFFSET, |
27c16b70 | 37 | .voltsetup_off_reg = OMAP4_PRM_VOLTSETUP_MPU_OFF_OFFSET, |
c0718df4 PW |
38 | }; |
39 | ||
5892bb1f | 40 | static const struct omap_vfsm_instance omap4_vdd_iva_vfsm = { |
c0718df4 | 41 | .voltsetup_reg = OMAP4_PRM_VOLTSETUP_IVA_RET_SLEEP_OFFSET, |
27c16b70 | 42 | .voltsetup_off_reg = OMAP4_PRM_VOLTSETUP_IVA_OFF_OFFSET, |
c0718df4 PW |
43 | }; |
44 | ||
5892bb1f | 45 | static const struct omap_vfsm_instance omap4_vdd_core_vfsm = { |
c0718df4 | 46 | .voltsetup_reg = OMAP4_PRM_VOLTSETUP_CORE_RET_SLEEP_OFFSET, |
27c16b70 | 47 | .voltsetup_off_reg = OMAP4_PRM_VOLTSETUP_CORE_OFF_OFFSET, |
c0718df4 PW |
48 | }; |
49 | ||
81a60482 KH |
50 | static struct voltagedomain omap4_voltdm_mpu = { |
51 | .name = "mpu", | |
37efca7e | 52 | .scalable = true, |
4bcc475e KH |
53 | .read = omap4_prm_vcvp_read, |
54 | .write = omap4_prm_vcvp_write, | |
55 | .rmw = omap4_prm_vcvp_rmw, | |
d84adcf4 | 56 | .vc = &omap4_vc_mpu, |
5892bb1f | 57 | .vfsm = &omap4_vdd_mpu_vfsm, |
b7ea803e | 58 | .vp = &omap4_vp_mpu, |
c0718df4 PW |
59 | }; |
60 | ||
81a60482 KH |
61 | static struct voltagedomain omap4_voltdm_iva = { |
62 | .name = "iva", | |
37efca7e | 63 | .scalable = true, |
4bcc475e KH |
64 | .read = omap4_prm_vcvp_read, |
65 | .write = omap4_prm_vcvp_write, | |
66 | .rmw = omap4_prm_vcvp_rmw, | |
d84adcf4 | 67 | .vc = &omap4_vc_iva, |
5892bb1f | 68 | .vfsm = &omap4_vdd_iva_vfsm, |
b7ea803e | 69 | .vp = &omap4_vp_iva, |
81a60482 KH |
70 | }; |
71 | ||
72 | static struct voltagedomain omap4_voltdm_core = { | |
73 | .name = "core", | |
37efca7e | 74 | .scalable = true, |
4bcc475e KH |
75 | .read = omap4_prm_vcvp_read, |
76 | .write = omap4_prm_vcvp_write, | |
77 | .rmw = omap4_prm_vcvp_rmw, | |
d84adcf4 | 78 | .vc = &omap4_vc_core, |
5892bb1f | 79 | .vfsm = &omap4_vdd_core_vfsm, |
b7ea803e | 80 | .vp = &omap4_vp_core, |
81a60482 | 81 | }; |
c0718df4 | 82 | |
7e1b9405 BC |
83 | static struct voltagedomain omap4_voltdm_wkup = { |
84 | .name = "wakeup", | |
85 | }; | |
86 | ||
81a60482 KH |
87 | static struct voltagedomain *voltagedomains_omap4[] __initdata = { |
88 | &omap4_voltdm_mpu, | |
89 | &omap4_voltdm_iva, | |
90 | &omap4_voltdm_core, | |
7e1b9405 | 91 | &omap4_voltdm_wkup, |
81a60482 KH |
92 | NULL, |
93 | }; | |
94 | ||
19c233b7 | 95 | static const char *const sys_clk_name __initconst = "sys_clkin_ck"; |
0e2f3d9c | 96 | |
81a60482 KH |
97 | void __init omap44xx_voltagedomains_init(void) |
98 | { | |
0e2f3d9c KH |
99 | struct voltagedomain *voltdm; |
100 | int i; | |
101 | ||
c0718df4 PW |
102 | /* |
103 | * XXX Will depend on the process, validation, and binning | |
104 | * for the currently-running IC | |
105 | */ | |
3ddd4d0c | 106 | #ifdef CONFIG_PM_OPP |
df7cded3 VS |
107 | if (cpu_is_omap443x()) { |
108 | omap4_voltdm_mpu.volt_data = omap443x_vdd_mpu_volt_data; | |
109 | omap4_voltdm_iva.volt_data = omap443x_vdd_iva_volt_data; | |
110 | omap4_voltdm_core.volt_data = omap443x_vdd_core_volt_data; | |
111 | } else if (cpu_is_omap446x()) { | |
112 | omap4_voltdm_mpu.volt_data = omap446x_vdd_mpu_volt_data; | |
113 | omap4_voltdm_iva.volt_data = omap446x_vdd_iva_volt_data; | |
114 | omap4_voltdm_core.volt_data = omap446x_vdd_core_volt_data; | |
115 | } | |
3ddd4d0c | 116 | #endif |
c0718df4 | 117 | |
8b5d8c0d TK |
118 | omap4_voltdm_mpu.vp_param = &omap4_mpu_vp_data; |
119 | omap4_voltdm_iva.vp_param = &omap4_iva_vp_data; | |
120 | omap4_voltdm_core.vp_param = &omap4_core_vp_data; | |
121 | ||
122 | omap4_voltdm_mpu.vc_param = &omap4_mpu_vc_data; | |
123 | omap4_voltdm_iva.vc_param = &omap4_iva_vc_data; | |
124 | omap4_voltdm_core.vc_param = &omap4_core_vc_data; | |
125 | ||
0e2f3d9c KH |
126 | for (i = 0; voltdm = voltagedomains_omap4[i], voltdm; i++) |
127 | voltdm->sys_clk.name = sys_clk_name; | |
128 | ||
81a60482 | 129 | voltdm_init(voltagedomains_omap4); |
c0718df4 | 130 | }; |