1 | // SPDX-License-Identifier: GPL-2.0-only |
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 |
13 | */ |
14 | #include <linux/kernel.h> |
15 | #include <linux/err.h> |
16 | #include <linux/init.h> |
17 | |
18 | #include "soc.h" |
19 | #include "common.h" |
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 | |
30 | /* OMAP3-common voltagedomain data */ |
31 | |
32 | static struct voltagedomain omap3_voltdm_wkup = { |
33 | .name = "wakeup" , |
34 | }; |
35 | |
36 | /* 34xx/36xx voltagedomain data */ |
37 | |
38 | static const struct omap_vfsm_instance omap3_vdd1_vfsm = { |
39 | .voltsetup_reg = OMAP3_PRM_VOLTSETUP1_OFFSET, |
40 | .voltsetup_mask = OMAP3430_SETUP_TIME1_MASK, |
41 | }; |
42 | |
43 | static const struct omap_vfsm_instance omap3_vdd2_vfsm = { |
44 | .voltsetup_reg = OMAP3_PRM_VOLTSETUP1_OFFSET, |
45 | .voltsetup_mask = OMAP3430_SETUP_TIME2_MASK, |
46 | }; |
47 | |
48 | static struct voltagedomain omap3_voltdm_mpu = { |
49 | .name = "mpu_iva" , |
50 | .scalable = true, |
51 | .read = omap3_prm_vcvp_read, |
52 | .write = omap3_prm_vcvp_write, |
53 | .rmw = omap3_prm_vcvp_rmw, |
54 | .vc = &omap3_vc_mpu, |
55 | .vfsm = &omap3_vdd1_vfsm, |
56 | .vp = &omap3_vp_mpu, |
57 | }; |
58 | |
59 | static struct voltagedomain omap3_voltdm_core = { |
60 | .name = "core" , |
61 | .scalable = true, |
62 | .read = omap3_prm_vcvp_read, |
63 | .write = omap3_prm_vcvp_write, |
64 | .rmw = omap3_prm_vcvp_rmw, |
65 | .vc = &omap3_vc_core, |
66 | .vfsm = &omap3_vdd2_vfsm, |
67 | .vp = &omap3_vp_core, |
68 | }; |
69 | |
70 | static struct voltagedomain *voltagedomains_omap3[] __initdata = { |
71 | &omap3_voltdm_mpu, |
72 | &omap3_voltdm_core, |
73 | &omap3_voltdm_wkup, |
74 | NULL, |
75 | }; |
76 | |
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 | |
95 | static const char *const sys_clk_name __initconst = "sys_ck" ; |
96 | |
97 | void __init omap3xxx_voltagedomains_init(void) |
98 | { |
99 | struct voltagedomain *voltdm; |
100 | struct voltagedomain **voltdms; |
101 | int i; |
102 | |
103 | /* |
104 | * XXX Will depend on the process, validation, and binning |
105 | * for the currently-running IC |
106 | */ |
107 | #ifdef CONFIG_PM_OPP |
108 | if (cpu_is_omap3630()) { |
109 | omap3_voltdm_mpu.volt_data = omap36xx_vddmpu_volt_data; |
110 | omap3_voltdm_core.volt_data = omap36xx_vddcore_volt_data; |
111 | } else { |
112 | omap3_voltdm_mpu.volt_data = omap34xx_vddmpu_volt_data; |
113 | omap3_voltdm_core.volt_data = omap34xx_vddcore_volt_data; |
114 | } |
115 | #endif |
116 | |
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 | |
122 | if (soc_is_am35xx()) |
123 | voltdms = voltagedomains_am35xx; |
124 | else |
125 | voltdms = voltagedomains_omap3; |
126 | |
127 | for (i = 0; voltdm = voltdms[i], voltdm; i++) |
128 | voltdm->sys_clk.name = sys_clk_name; |
129 | |
130 | voltdm_init(voltdm_list: voltdms); |
131 | }; |
132 | |