Commit | Line | Data |
---|---|---|
d2912cb1 | 1 | // SPDX-License-Identifier: GPL-2.0-only |
c0718df4 PW |
2 | /* |
3 | * OMAP3 voltage domain data | |
4 | * | |
5 | * Copyright (C) 2007, 2010 Texas Instruments, Inc. | |
6 | * Rajendra Nayak <rnayak@ti.com> | |
7 | * Lesly A M <x0080970@ti.com> | |
8 | * Thara Gopinath <thara@ti.com> | |
9 | * | |
10 | * Copyright (C) 2008, 2011 Nokia Corporation | |
11 | * Kalle Jokiniemi | |
12 | * Paul Walmsley | |
c0718df4 PW |
13 | */ |
14 | #include <linux/kernel.h> | |
15 | #include <linux/err.h> | |
16 | #include <linux/init.h> | |
17 | ||
dbc04161 | 18 | #include "soc.h" |
4e65331c | 19 | #include "common.h" |
c0718df4 PW |
20 | #include "prm-regbits-34xx.h" |
21 | #include "omap_opp_data.h" | |
22 | #include "voltage.h" | |
23 | #include "vc.h" | |
24 | #include "vp.h" | |
25 | ||
26 | /* | |
27 | * VDD data | |
28 | */ | |
29 | ||
ddf536d0 PW |
30 | /* OMAP3-common voltagedomain data */ |
31 | ||
32 | static struct voltagedomain omap3_voltdm_wkup = { | |
33 | .name = "wakeup", | |
34 | }; | |
35 | ||
36 | /* 34xx/36xx voltagedomain data */ | |
37 | ||
5892bb1f | 38 | static const struct omap_vfsm_instance omap3_vdd1_vfsm = { |
c0718df4 | 39 | .voltsetup_reg = OMAP3_PRM_VOLTSETUP1_OFFSET, |
c0718df4 PW |
40 | .voltsetup_mask = OMAP3430_SETUP_TIME1_MASK, |
41 | }; | |
42 | ||
5892bb1f | 43 | static const struct omap_vfsm_instance omap3_vdd2_vfsm = { |
c0718df4 | 44 | .voltsetup_reg = OMAP3_PRM_VOLTSETUP1_OFFSET, |
c0718df4 PW |
45 | .voltsetup_mask = OMAP3430_SETUP_TIME2_MASK, |
46 | }; | |
47 | ||
81a60482 | 48 | static struct voltagedomain omap3_voltdm_mpu = { |
280a7275 | 49 | .name = "mpu_iva", |
37efca7e | 50 | .scalable = true, |
4bcc475e KH |
51 | .read = omap3_prm_vcvp_read, |
52 | .write = omap3_prm_vcvp_write, | |
53 | .rmw = omap3_prm_vcvp_rmw, | |
d84adcf4 | 54 | .vc = &omap3_vc_mpu, |
5892bb1f | 55 | .vfsm = &omap3_vdd1_vfsm, |
b7ea803e | 56 | .vp = &omap3_vp_mpu, |
c0718df4 PW |
57 | }; |
58 | ||
81a60482 KH |
59 | static struct voltagedomain omap3_voltdm_core = { |
60 | .name = "core", | |
37efca7e | 61 | .scalable = true, |
4bcc475e KH |
62 | .read = omap3_prm_vcvp_read, |
63 | .write = omap3_prm_vcvp_write, | |
64 | .rmw = omap3_prm_vcvp_rmw, | |
d84adcf4 | 65 | .vc = &omap3_vc_core, |
5892bb1f | 66 | .vfsm = &omap3_vdd2_vfsm, |
b7ea803e | 67 | .vp = &omap3_vp_core, |
81a60482 | 68 | }; |
c0718df4 | 69 | |
81a60482 KH |
70 | static struct voltagedomain *voltagedomains_omap3[] __initdata = { |
71 | &omap3_voltdm_mpu, | |
72 | &omap3_voltdm_core, | |
ace19ffa | 73 | &omap3_voltdm_wkup, |
81a60482 KH |
74 | NULL, |
75 | }; | |
76 | ||
ddf536d0 PW |
77 | /* AM35xx voltagedomain data */ |
78 | ||
79 | static struct voltagedomain am35xx_voltdm_mpu = { | |
80 | .name = "mpu_iva", | |
81 | }; | |
82 | ||
83 | static struct voltagedomain am35xx_voltdm_core = { | |
84 | .name = "core", | |
85 | }; | |
86 | ||
87 | static struct voltagedomain *voltagedomains_am35xx[] __initdata = { | |
88 | &am35xx_voltdm_mpu, | |
89 | &am35xx_voltdm_core, | |
90 | &omap3_voltdm_wkup, | |
91 | NULL, | |
92 | }; | |
93 | ||
94 | ||
19c233b7 | 95 | static const char *const sys_clk_name __initconst = "sys_ck"; |
0e2f3d9c | 96 | |
81a60482 KH |
97 | void __init omap3xxx_voltagedomains_init(void) |
98 | { | |
0e2f3d9c | 99 | struct voltagedomain *voltdm; |
ddf536d0 | 100 | struct voltagedomain **voltdms; |
0e2f3d9c KH |
101 | int i; |
102 | ||
c0718df4 PW |
103 | /* |
104 | * XXX Will depend on the process, validation, and binning | |
105 | * for the currently-running IC | |
106 | */ | |
3ddd4d0c | 107 | #ifdef CONFIG_PM_OPP |
c0718df4 | 108 | if (cpu_is_omap3630()) { |
e3277880 KH |
109 | omap3_voltdm_mpu.volt_data = omap36xx_vddmpu_volt_data; |
110 | omap3_voltdm_core.volt_data = omap36xx_vddcore_volt_data; | |
c0718df4 | 111 | } else { |
e3277880 KH |
112 | omap3_voltdm_mpu.volt_data = omap34xx_vddmpu_volt_data; |
113 | omap3_voltdm_core.volt_data = omap34xx_vddcore_volt_data; | |
c0718df4 | 114 | } |
3ddd4d0c | 115 | #endif |
c0718df4 | 116 | |
8b5d8c0d TK |
117 | omap3_voltdm_mpu.vp_param = &omap3_mpu_vp_data; |
118 | omap3_voltdm_core.vp_param = &omap3_core_vp_data; | |
119 | omap3_voltdm_mpu.vc_param = &omap3_mpu_vc_data; | |
120 | omap3_voltdm_core.vc_param = &omap3_core_vc_data; | |
121 | ||
68a88b98 | 122 | if (soc_is_am35xx()) |
ddf536d0 PW |
123 | voltdms = voltagedomains_am35xx; |
124 | else | |
125 | voltdms = voltagedomains_omap3; | |
126 | ||
127 | for (i = 0; voltdm = voltdms[i], voltdm; i++) | |
0e2f3d9c KH |
128 | voltdm->sys_clk.name = sys_clk_name; |
129 | ||
ddf536d0 | 130 | voltdm_init(voltdms); |
c0718df4 | 131 | }; |