1*b2441318SGreg Kroah-Hartman // SPDX-License-Identifier: GPL-2.0
2a5ffef6aSPaul Walmsley /*
3a5ffef6aSPaul Walmsley * OMAP3xxx clockdomains
4a5ffef6aSPaul Walmsley *
5a5ffef6aSPaul Walmsley * Copyright (C) 2008-2011 Texas Instruments, Inc.
6a5ffef6aSPaul Walmsley * Copyright (C) 2008-2010 Nokia Corporation
7a5ffef6aSPaul Walmsley *
8a5ffef6aSPaul Walmsley * Paul Walmsley, Jouni Högander
9a5ffef6aSPaul Walmsley *
10a5ffef6aSPaul Walmsley * This file contains clockdomains and clockdomain wakeup/sleep
11a5ffef6aSPaul Walmsley * dependencies for the OMAP3xxx chips. Some notes:
12a5ffef6aSPaul Walmsley *
13a5ffef6aSPaul Walmsley * A useful validation rule for struct clockdomain: Any clockdomain
14a5ffef6aSPaul Walmsley * referenced by a wkdep_srcs or sleepdep_srcs array must have a
15a5ffef6aSPaul Walmsley * dep_bit assigned. So wkdep_srcs/sleepdep_srcs are really just
16a5ffef6aSPaul Walmsley * software-controllable dependencies. Non-software-controllable
17a5ffef6aSPaul Walmsley * dependencies do exist, but they are not encoded below (yet).
18a5ffef6aSPaul Walmsley *
19a5ffef6aSPaul Walmsley * The overly-specific dep_bit names are due to a bit name collision
20a5ffef6aSPaul Walmsley * with CM_FCLKEN_{DSP,IVA2}. The DSP/IVA2 PM_WKDEP and CM_SLEEPDEP shift
21a5ffef6aSPaul Walmsley * value are the same for all powerdomains: 2
22a5ffef6aSPaul Walmsley *
23a5ffef6aSPaul Walmsley * XXX should dep_bit be a mask, so we can test to see if it is 0 as a
24a5ffef6aSPaul Walmsley * sanity check?
25a5ffef6aSPaul Walmsley * XXX encode hardware fixed wakeup dependencies -- esp. for 3430 CORE
26a5ffef6aSPaul Walmsley */
27a5ffef6aSPaul Walmsley
28a5ffef6aSPaul Walmsley /*
29a5ffef6aSPaul Walmsley * To-Do List
30a5ffef6aSPaul Walmsley * -> Port the Sleep/Wakeup dependencies for the domains
31a5ffef6aSPaul Walmsley * from the Power domain framework
32a5ffef6aSPaul Walmsley */
33a5ffef6aSPaul Walmsley
34a5ffef6aSPaul Walmsley #include <linux/kernel.h>
35a5ffef6aSPaul Walmsley #include <linux/io.h>
36a5ffef6aSPaul Walmsley
37e4c060dbSTony Lindgren #include "soc.h"
38a5ffef6aSPaul Walmsley #include "clockdomain.h"
39a5ffef6aSPaul Walmsley #include "prm2xxx_3xxx.h"
40a5ffef6aSPaul Walmsley #include "cm2xxx_3xxx.h"
41a5ffef6aSPaul Walmsley #include "cm-regbits-34xx.h"
42a5ffef6aSPaul Walmsley #include "prm-regbits-34xx.h"
43a5ffef6aSPaul Walmsley
44a5ffef6aSPaul Walmsley /*
45a5ffef6aSPaul Walmsley * Clockdomain dependencies for wkdeps/sleepdeps
46a5ffef6aSPaul Walmsley *
47a5ffef6aSPaul Walmsley * XXX Hardware dependencies (e.g., dependencies that cannot be
48a5ffef6aSPaul Walmsley * changed in software) are not included here yet, but should be.
49a5ffef6aSPaul Walmsley */
50a5ffef6aSPaul Walmsley
51a5ffef6aSPaul Walmsley /* OMAP3-specific possible dependencies */
52a5ffef6aSPaul Walmsley
53a5ffef6aSPaul Walmsley /*
54a5ffef6aSPaul Walmsley * 3430ES1 PM_WKDEP_GFX: adds IVA2, removes CORE
55a5ffef6aSPaul Walmsley * 3430ES2 PM_WKDEP_SGX: adds IVA2, removes CORE
56a5ffef6aSPaul Walmsley */
57a5ffef6aSPaul Walmsley static struct clkdm_dep gfx_sgx_3xxx_wkdeps[] = {
5848a6884fSMark A. Greer { .clkdm_name = "iva2_clkdm" },
5948a6884fSMark A. Greer { .clkdm_name = "mpu_clkdm" },
6048a6884fSMark A. Greer { .clkdm_name = "wkup_clkdm" },
61a5ffef6aSPaul Walmsley { NULL },
62a5ffef6aSPaul Walmsley };
63a5ffef6aSPaul Walmsley
6416e5e2c4SMark A. Greer static struct clkdm_dep gfx_sgx_am35x_wkdeps[] = {
6516e5e2c4SMark A. Greer { .clkdm_name = "mpu_clkdm" },
6616e5e2c4SMark A. Greer { .clkdm_name = "wkup_clkdm" },
6716e5e2c4SMark A. Greer { NULL },
6816e5e2c4SMark A. Greer };
6916e5e2c4SMark A. Greer
70a5ffef6aSPaul Walmsley /* 3430: PM_WKDEP_PER: CORE, IVA2, MPU, WKUP */
71a5ffef6aSPaul Walmsley static struct clkdm_dep per_wkdeps[] = {
72a5ffef6aSPaul Walmsley { .clkdm_name = "core_l3_clkdm" },
73a5ffef6aSPaul Walmsley { .clkdm_name = "core_l4_clkdm" },
74a5ffef6aSPaul Walmsley { .clkdm_name = "iva2_clkdm" },
75a5ffef6aSPaul Walmsley { .clkdm_name = "mpu_clkdm" },
76a5ffef6aSPaul Walmsley { .clkdm_name = "wkup_clkdm" },
77a5ffef6aSPaul Walmsley { NULL },
78a5ffef6aSPaul Walmsley };
79a5ffef6aSPaul Walmsley
8016e5e2c4SMark A. Greer static struct clkdm_dep per_am35x_wkdeps[] = {
8116e5e2c4SMark A. Greer { .clkdm_name = "core_l3_clkdm" },
8216e5e2c4SMark A. Greer { .clkdm_name = "core_l4_clkdm" },
8316e5e2c4SMark A. Greer { .clkdm_name = "mpu_clkdm" },
8416e5e2c4SMark A. Greer { .clkdm_name = "wkup_clkdm" },
8516e5e2c4SMark A. Greer { NULL },
8616e5e2c4SMark A. Greer };
8716e5e2c4SMark A. Greer
88a5ffef6aSPaul Walmsley /* 3430ES2: PM_WKDEP_USBHOST: CORE, IVA2, MPU, WKUP */
89a5ffef6aSPaul Walmsley static struct clkdm_dep usbhost_wkdeps[] = {
90a5ffef6aSPaul Walmsley { .clkdm_name = "core_l3_clkdm" },
91a5ffef6aSPaul Walmsley { .clkdm_name = "core_l4_clkdm" },
92a5ffef6aSPaul Walmsley { .clkdm_name = "iva2_clkdm" },
93a5ffef6aSPaul Walmsley { .clkdm_name = "mpu_clkdm" },
94a5ffef6aSPaul Walmsley { .clkdm_name = "wkup_clkdm" },
95a5ffef6aSPaul Walmsley { NULL },
96a5ffef6aSPaul Walmsley };
97a5ffef6aSPaul Walmsley
9816e5e2c4SMark A. Greer static struct clkdm_dep usbhost_am35x_wkdeps[] = {
9916e5e2c4SMark A. Greer { .clkdm_name = "core_l3_clkdm" },
10016e5e2c4SMark A. Greer { .clkdm_name = "core_l4_clkdm" },
10116e5e2c4SMark A. Greer { .clkdm_name = "mpu_clkdm" },
10216e5e2c4SMark A. Greer { .clkdm_name = "wkup_clkdm" },
10316e5e2c4SMark A. Greer { NULL },
10416e5e2c4SMark A. Greer };
10516e5e2c4SMark A. Greer
106a5ffef6aSPaul Walmsley /* 3430 PM_WKDEP_MPU: CORE, IVA2, DSS, PER */
107a5ffef6aSPaul Walmsley static struct clkdm_dep mpu_3xxx_wkdeps[] = {
108a5ffef6aSPaul Walmsley { .clkdm_name = "core_l3_clkdm" },
109a5ffef6aSPaul Walmsley { .clkdm_name = "core_l4_clkdm" },
110a5ffef6aSPaul Walmsley { .clkdm_name = "iva2_clkdm" },
111a5ffef6aSPaul Walmsley { .clkdm_name = "dss_clkdm" },
112a5ffef6aSPaul Walmsley { .clkdm_name = "per_clkdm" },
113a5ffef6aSPaul Walmsley { NULL },
114a5ffef6aSPaul Walmsley };
115a5ffef6aSPaul Walmsley
11616e5e2c4SMark A. Greer static struct clkdm_dep mpu_am35x_wkdeps[] = {
11716e5e2c4SMark A. Greer { .clkdm_name = "core_l3_clkdm" },
11816e5e2c4SMark A. Greer { .clkdm_name = "core_l4_clkdm" },
11916e5e2c4SMark A. Greer { .clkdm_name = "dss_clkdm" },
12016e5e2c4SMark A. Greer { .clkdm_name = "per_clkdm" },
12116e5e2c4SMark A. Greer { NULL },
12216e5e2c4SMark A. Greer };
12316e5e2c4SMark A. Greer
124a5ffef6aSPaul Walmsley /* 3430 PM_WKDEP_IVA2: CORE, MPU, WKUP, DSS, PER */
125a5ffef6aSPaul Walmsley static struct clkdm_dep iva2_wkdeps[] = {
126a5ffef6aSPaul Walmsley { .clkdm_name = "core_l3_clkdm" },
127a5ffef6aSPaul Walmsley { .clkdm_name = "core_l4_clkdm" },
128a5ffef6aSPaul Walmsley { .clkdm_name = "mpu_clkdm" },
129a5ffef6aSPaul Walmsley { .clkdm_name = "wkup_clkdm" },
130a5ffef6aSPaul Walmsley { .clkdm_name = "dss_clkdm" },
131a5ffef6aSPaul Walmsley { .clkdm_name = "per_clkdm" },
132a5ffef6aSPaul Walmsley { NULL },
133a5ffef6aSPaul Walmsley };
134a5ffef6aSPaul Walmsley
135a5ffef6aSPaul Walmsley /* 3430 PM_WKDEP_CAM: IVA2, MPU, WKUP */
136a5ffef6aSPaul Walmsley static struct clkdm_dep cam_wkdeps[] = {
137a5ffef6aSPaul Walmsley { .clkdm_name = "iva2_clkdm" },
138a5ffef6aSPaul Walmsley { .clkdm_name = "mpu_clkdm" },
139a5ffef6aSPaul Walmsley { .clkdm_name = "wkup_clkdm" },
140a5ffef6aSPaul Walmsley { NULL },
141a5ffef6aSPaul Walmsley };
142a5ffef6aSPaul Walmsley
143a5ffef6aSPaul Walmsley /* 3430 PM_WKDEP_DSS: IVA2, MPU, WKUP */
144a5ffef6aSPaul Walmsley static struct clkdm_dep dss_wkdeps[] = {
145a5ffef6aSPaul Walmsley { .clkdm_name = "iva2_clkdm" },
146a5ffef6aSPaul Walmsley { .clkdm_name = "mpu_clkdm" },
147a5ffef6aSPaul Walmsley { .clkdm_name = "wkup_clkdm" },
148a5ffef6aSPaul Walmsley { NULL },
149a5ffef6aSPaul Walmsley };
150a5ffef6aSPaul Walmsley
15116e5e2c4SMark A. Greer static struct clkdm_dep dss_am35x_wkdeps[] = {
15216e5e2c4SMark A. Greer { .clkdm_name = "mpu_clkdm" },
15316e5e2c4SMark A. Greer { .clkdm_name = "wkup_clkdm" },
15416e5e2c4SMark A. Greer { NULL },
15516e5e2c4SMark A. Greer };
15616e5e2c4SMark A. Greer
157a5ffef6aSPaul Walmsley /* 3430: PM_WKDEP_NEON: MPU */
158a5ffef6aSPaul Walmsley static struct clkdm_dep neon_wkdeps[] = {
159a5ffef6aSPaul Walmsley { .clkdm_name = "mpu_clkdm" },
160a5ffef6aSPaul Walmsley { NULL },
161a5ffef6aSPaul Walmsley };
162a5ffef6aSPaul Walmsley
163a5ffef6aSPaul Walmsley /* Sleep dependency source arrays for OMAP3-specific clkdms */
164a5ffef6aSPaul Walmsley
165a5ffef6aSPaul Walmsley /* 3430: CM_SLEEPDEP_DSS: MPU, IVA */
166a5ffef6aSPaul Walmsley static struct clkdm_dep dss_sleepdeps[] = {
167a5ffef6aSPaul Walmsley { .clkdm_name = "mpu_clkdm" },
168a5ffef6aSPaul Walmsley { .clkdm_name = "iva2_clkdm" },
169a5ffef6aSPaul Walmsley { NULL },
170a5ffef6aSPaul Walmsley };
171a5ffef6aSPaul Walmsley
17216e5e2c4SMark A. Greer static struct clkdm_dep dss_am35x_sleepdeps[] = {
17316e5e2c4SMark A. Greer { .clkdm_name = "mpu_clkdm" },
17416e5e2c4SMark A. Greer { NULL },
17516e5e2c4SMark A. Greer };
17616e5e2c4SMark A. Greer
177a5ffef6aSPaul Walmsley /* 3430: CM_SLEEPDEP_PER: MPU, IVA */
178a5ffef6aSPaul Walmsley static struct clkdm_dep per_sleepdeps[] = {
179a5ffef6aSPaul Walmsley { .clkdm_name = "mpu_clkdm" },
180a5ffef6aSPaul Walmsley { .clkdm_name = "iva2_clkdm" },
181a5ffef6aSPaul Walmsley { NULL },
182a5ffef6aSPaul Walmsley };
183a5ffef6aSPaul Walmsley
18416e5e2c4SMark A. Greer static struct clkdm_dep per_am35x_sleepdeps[] = {
18516e5e2c4SMark A. Greer { .clkdm_name = "mpu_clkdm" },
18616e5e2c4SMark A. Greer { NULL },
18716e5e2c4SMark A. Greer };
18816e5e2c4SMark A. Greer
189a5ffef6aSPaul Walmsley /* 3430ES2: CM_SLEEPDEP_USBHOST: MPU, IVA */
190a5ffef6aSPaul Walmsley static struct clkdm_dep usbhost_sleepdeps[] = {
191a5ffef6aSPaul Walmsley { .clkdm_name = "mpu_clkdm" },
192a5ffef6aSPaul Walmsley { .clkdm_name = "iva2_clkdm" },
193a5ffef6aSPaul Walmsley { NULL },
194a5ffef6aSPaul Walmsley };
195a5ffef6aSPaul Walmsley
19616e5e2c4SMark A. Greer static struct clkdm_dep usbhost_am35x_sleepdeps[] = {
19716e5e2c4SMark A. Greer { .clkdm_name = "mpu_clkdm" },
19816e5e2c4SMark A. Greer { NULL },
19916e5e2c4SMark A. Greer };
20016e5e2c4SMark A. Greer
201a5ffef6aSPaul Walmsley /* 3430: CM_SLEEPDEP_CAM: MPU */
202a5ffef6aSPaul Walmsley static struct clkdm_dep cam_sleepdeps[] = {
203a5ffef6aSPaul Walmsley { .clkdm_name = "mpu_clkdm" },
204a5ffef6aSPaul Walmsley { NULL },
205a5ffef6aSPaul Walmsley };
206a5ffef6aSPaul Walmsley
207a5ffef6aSPaul Walmsley /*
208a5ffef6aSPaul Walmsley * 3430ES1: CM_SLEEPDEP_GFX: MPU
209a5ffef6aSPaul Walmsley * 3430ES2: CM_SLEEPDEP_SGX: MPU
210a5ffef6aSPaul Walmsley * These can share data since they will never be present simultaneously
211a5ffef6aSPaul Walmsley * on the same device.
212a5ffef6aSPaul Walmsley */
213a5ffef6aSPaul Walmsley static struct clkdm_dep gfx_sgx_sleepdeps[] = {
214a5ffef6aSPaul Walmsley { .clkdm_name = "mpu_clkdm" },
215a5ffef6aSPaul Walmsley { NULL },
216a5ffef6aSPaul Walmsley };
217a5ffef6aSPaul Walmsley
218a5ffef6aSPaul Walmsley /*
219a5ffef6aSPaul Walmsley * OMAP3 clockdomains
220a5ffef6aSPaul Walmsley */
221a5ffef6aSPaul Walmsley
222a5ffef6aSPaul Walmsley static struct clockdomain mpu_3xxx_clkdm = {
223a5ffef6aSPaul Walmsley .name = "mpu_clkdm",
224a5ffef6aSPaul Walmsley .pwrdm = { .name = "mpu_pwrdm" },
225a5ffef6aSPaul Walmsley .flags = CLKDM_CAN_HWSUP | CLKDM_CAN_FORCE_WAKEUP,
226a5ffef6aSPaul Walmsley .dep_bit = OMAP3430_EN_MPU_SHIFT,
227a5ffef6aSPaul Walmsley .wkdep_srcs = mpu_3xxx_wkdeps,
228a5ffef6aSPaul Walmsley .clktrctrl_mask = OMAP3430_CLKTRCTRL_MPU_MASK,
229a5ffef6aSPaul Walmsley };
230a5ffef6aSPaul Walmsley
23116e5e2c4SMark A. Greer static struct clockdomain mpu_am35x_clkdm = {
23216e5e2c4SMark A. Greer .name = "mpu_clkdm",
23316e5e2c4SMark A. Greer .pwrdm = { .name = "mpu_pwrdm" },
23416e5e2c4SMark A. Greer .flags = CLKDM_CAN_HWSUP | CLKDM_CAN_FORCE_WAKEUP,
23516e5e2c4SMark A. Greer .dep_bit = OMAP3430_EN_MPU_SHIFT,
23616e5e2c4SMark A. Greer .wkdep_srcs = mpu_am35x_wkdeps,
23716e5e2c4SMark A. Greer .clktrctrl_mask = OMAP3430_CLKTRCTRL_MPU_MASK,
23816e5e2c4SMark A. Greer };
23916e5e2c4SMark A. Greer
240a5ffef6aSPaul Walmsley static struct clockdomain neon_clkdm = {
241a5ffef6aSPaul Walmsley .name = "neon_clkdm",
242a5ffef6aSPaul Walmsley .pwrdm = { .name = "neon_pwrdm" },
243a5ffef6aSPaul Walmsley .flags = CLKDM_CAN_HWSUP_SWSUP,
244a5ffef6aSPaul Walmsley .wkdep_srcs = neon_wkdeps,
245a5ffef6aSPaul Walmsley .clktrctrl_mask = OMAP3430_CLKTRCTRL_NEON_MASK,
246a5ffef6aSPaul Walmsley };
247a5ffef6aSPaul Walmsley
248a5ffef6aSPaul Walmsley static struct clockdomain iva2_clkdm = {
249a5ffef6aSPaul Walmsley .name = "iva2_clkdm",
250a5ffef6aSPaul Walmsley .pwrdm = { .name = "iva2_pwrdm" },
251200a274fSSuman Anna .flags = CLKDM_CAN_SWSUP,
252a5ffef6aSPaul Walmsley .dep_bit = OMAP3430_PM_WKDEP_MPU_EN_IVA2_SHIFT,
253a5ffef6aSPaul Walmsley .wkdep_srcs = iva2_wkdeps,
254a5ffef6aSPaul Walmsley .clktrctrl_mask = OMAP3430_CLKTRCTRL_IVA2_MASK,
255a5ffef6aSPaul Walmsley };
256a5ffef6aSPaul Walmsley
257a5ffef6aSPaul Walmsley static struct clockdomain gfx_3430es1_clkdm = {
258a5ffef6aSPaul Walmsley .name = "gfx_clkdm",
259a5ffef6aSPaul Walmsley .pwrdm = { .name = "gfx_pwrdm" },
260a5ffef6aSPaul Walmsley .flags = CLKDM_CAN_HWSUP_SWSUP,
261a5ffef6aSPaul Walmsley .wkdep_srcs = gfx_sgx_3xxx_wkdeps,
262a5ffef6aSPaul Walmsley .sleepdep_srcs = gfx_sgx_sleepdeps,
263a5ffef6aSPaul Walmsley .clktrctrl_mask = OMAP3430ES1_CLKTRCTRL_GFX_MASK,
264a5ffef6aSPaul Walmsley };
265a5ffef6aSPaul Walmsley
266a5ffef6aSPaul Walmsley static struct clockdomain sgx_clkdm = {
267a5ffef6aSPaul Walmsley .name = "sgx_clkdm",
268a5ffef6aSPaul Walmsley .pwrdm = { .name = "sgx_pwrdm" },
269a5ffef6aSPaul Walmsley .flags = CLKDM_CAN_HWSUP_SWSUP,
270a5ffef6aSPaul Walmsley .wkdep_srcs = gfx_sgx_3xxx_wkdeps,
271a5ffef6aSPaul Walmsley .sleepdep_srcs = gfx_sgx_sleepdeps,
272a5ffef6aSPaul Walmsley .clktrctrl_mask = OMAP3430ES2_CLKTRCTRL_SGX_MASK,
273a5ffef6aSPaul Walmsley };
274a5ffef6aSPaul Walmsley
27516e5e2c4SMark A. Greer static struct clockdomain sgx_am35x_clkdm = {
27616e5e2c4SMark A. Greer .name = "sgx_clkdm",
27716e5e2c4SMark A. Greer .pwrdm = { .name = "sgx_pwrdm" },
27816e5e2c4SMark A. Greer .flags = CLKDM_CAN_HWSUP_SWSUP,
27916e5e2c4SMark A. Greer .wkdep_srcs = gfx_sgx_am35x_wkdeps,
28016e5e2c4SMark A. Greer .sleepdep_srcs = gfx_sgx_sleepdeps,
28116e5e2c4SMark A. Greer .clktrctrl_mask = OMAP3430ES2_CLKTRCTRL_SGX_MASK,
28216e5e2c4SMark A. Greer };
28316e5e2c4SMark A. Greer
284a5ffef6aSPaul Walmsley /*
285a5ffef6aSPaul Walmsley * The die-to-die clockdomain was documented in the 34xx ES1 TRM, but
286a5ffef6aSPaul Walmsley * then that information was removed from the 34xx ES2+ TRM. It is
287a5ffef6aSPaul Walmsley * unclear whether the core is still there, but the clockdomain logic
288a5ffef6aSPaul Walmsley * is there, and must be programmed to an appropriate state if the
289a5ffef6aSPaul Walmsley * CORE clockdomain is to become inactive.
290a5ffef6aSPaul Walmsley */
291a5ffef6aSPaul Walmsley static struct clockdomain d2d_clkdm = {
292a5ffef6aSPaul Walmsley .name = "d2d_clkdm",
293a5ffef6aSPaul Walmsley .pwrdm = { .name = "core_pwrdm" },
294a5ffef6aSPaul Walmsley .flags = CLKDM_CAN_HWSUP_SWSUP,
295a5ffef6aSPaul Walmsley .clktrctrl_mask = OMAP3430ES1_CLKTRCTRL_D2D_MASK,
296a5ffef6aSPaul Walmsley };
297a5ffef6aSPaul Walmsley
298a5ffef6aSPaul Walmsley /*
299a5ffef6aSPaul Walmsley * XXX add usecounting for clkdm dependencies, otherwise the presence
300a5ffef6aSPaul Walmsley * of a single dep bit for core_l3_3xxx_clkdm and core_l4_3xxx_clkdm
301a5ffef6aSPaul Walmsley * could cause trouble
302a5ffef6aSPaul Walmsley */
303a5ffef6aSPaul Walmsley static struct clockdomain core_l3_3xxx_clkdm = {
304a5ffef6aSPaul Walmsley .name = "core_l3_clkdm",
305a5ffef6aSPaul Walmsley .pwrdm = { .name = "core_pwrdm" },
306a5ffef6aSPaul Walmsley .flags = CLKDM_CAN_HWSUP,
307a5ffef6aSPaul Walmsley .dep_bit = OMAP3430_EN_CORE_SHIFT,
308a5ffef6aSPaul Walmsley .clktrctrl_mask = OMAP3430_CLKTRCTRL_L3_MASK,
309a5ffef6aSPaul Walmsley };
310a5ffef6aSPaul Walmsley
311a5ffef6aSPaul Walmsley /*
312a5ffef6aSPaul Walmsley * XXX add usecounting for clkdm dependencies, otherwise the presence
313a5ffef6aSPaul Walmsley * of a single dep bit for core_l3_3xxx_clkdm and core_l4_3xxx_clkdm
314a5ffef6aSPaul Walmsley * could cause trouble
315a5ffef6aSPaul Walmsley */
316a5ffef6aSPaul Walmsley static struct clockdomain core_l4_3xxx_clkdm = {
317a5ffef6aSPaul Walmsley .name = "core_l4_clkdm",
318a5ffef6aSPaul Walmsley .pwrdm = { .name = "core_pwrdm" },
319a5ffef6aSPaul Walmsley .flags = CLKDM_CAN_HWSUP,
320a5ffef6aSPaul Walmsley .dep_bit = OMAP3430_EN_CORE_SHIFT,
321a5ffef6aSPaul Walmsley .clktrctrl_mask = OMAP3430_CLKTRCTRL_L4_MASK,
322a5ffef6aSPaul Walmsley };
323a5ffef6aSPaul Walmsley
324a5ffef6aSPaul Walmsley /* Another case of bit name collisions between several registers: EN_DSS */
325a5ffef6aSPaul Walmsley static struct clockdomain dss_3xxx_clkdm = {
326a5ffef6aSPaul Walmsley .name = "dss_clkdm",
327a5ffef6aSPaul Walmsley .pwrdm = { .name = "dss_pwrdm" },
328a5ffef6aSPaul Walmsley .flags = CLKDM_CAN_HWSUP_SWSUP,
329a5ffef6aSPaul Walmsley .dep_bit = OMAP3430_PM_WKDEP_MPU_EN_DSS_SHIFT,
330a5ffef6aSPaul Walmsley .wkdep_srcs = dss_wkdeps,
331a5ffef6aSPaul Walmsley .sleepdep_srcs = dss_sleepdeps,
332a5ffef6aSPaul Walmsley .clktrctrl_mask = OMAP3430_CLKTRCTRL_DSS_MASK,
333a5ffef6aSPaul Walmsley };
334a5ffef6aSPaul Walmsley
33516e5e2c4SMark A. Greer static struct clockdomain dss_am35x_clkdm = {
33616e5e2c4SMark A. Greer .name = "dss_clkdm",
33716e5e2c4SMark A. Greer .pwrdm = { .name = "dss_pwrdm" },
33816e5e2c4SMark A. Greer .flags = CLKDM_CAN_HWSUP_SWSUP,
33916e5e2c4SMark A. Greer .dep_bit = OMAP3430_PM_WKDEP_MPU_EN_DSS_SHIFT,
34016e5e2c4SMark A. Greer .wkdep_srcs = dss_am35x_wkdeps,
34116e5e2c4SMark A. Greer .sleepdep_srcs = dss_am35x_sleepdeps,
34216e5e2c4SMark A. Greer .clktrctrl_mask = OMAP3430_CLKTRCTRL_DSS_MASK,
34316e5e2c4SMark A. Greer };
34416e5e2c4SMark A. Greer
345a5ffef6aSPaul Walmsley static struct clockdomain cam_clkdm = {
346a5ffef6aSPaul Walmsley .name = "cam_clkdm",
347a5ffef6aSPaul Walmsley .pwrdm = { .name = "cam_pwrdm" },
348a5ffef6aSPaul Walmsley .flags = CLKDM_CAN_HWSUP_SWSUP,
349a5ffef6aSPaul Walmsley .wkdep_srcs = cam_wkdeps,
350a5ffef6aSPaul Walmsley .sleepdep_srcs = cam_sleepdeps,
351a5ffef6aSPaul Walmsley .clktrctrl_mask = OMAP3430_CLKTRCTRL_CAM_MASK,
352a5ffef6aSPaul Walmsley };
353a5ffef6aSPaul Walmsley
354a5ffef6aSPaul Walmsley static struct clockdomain usbhost_clkdm = {
355a5ffef6aSPaul Walmsley .name = "usbhost_clkdm",
356a5ffef6aSPaul Walmsley .pwrdm = { .name = "usbhost_pwrdm" },
357a5ffef6aSPaul Walmsley .flags = CLKDM_CAN_HWSUP_SWSUP,
358a5ffef6aSPaul Walmsley .wkdep_srcs = usbhost_wkdeps,
359a5ffef6aSPaul Walmsley .sleepdep_srcs = usbhost_sleepdeps,
360a5ffef6aSPaul Walmsley .clktrctrl_mask = OMAP3430ES2_CLKTRCTRL_USBHOST_MASK,
361a5ffef6aSPaul Walmsley };
362a5ffef6aSPaul Walmsley
36316e5e2c4SMark A. Greer static struct clockdomain usbhost_am35x_clkdm = {
36416e5e2c4SMark A. Greer .name = "usbhost_clkdm",
36516e5e2c4SMark A. Greer .pwrdm = { .name = "core_pwrdm" },
36616e5e2c4SMark A. Greer .flags = CLKDM_CAN_HWSUP_SWSUP,
36716e5e2c4SMark A. Greer .wkdep_srcs = usbhost_am35x_wkdeps,
36816e5e2c4SMark A. Greer .sleepdep_srcs = usbhost_am35x_sleepdeps,
36916e5e2c4SMark A. Greer .clktrctrl_mask = OMAP3430ES2_CLKTRCTRL_USBHOST_MASK,
37016e5e2c4SMark A. Greer };
37116e5e2c4SMark A. Greer
372a5ffef6aSPaul Walmsley static struct clockdomain per_clkdm = {
373a5ffef6aSPaul Walmsley .name = "per_clkdm",
374a5ffef6aSPaul Walmsley .pwrdm = { .name = "per_pwrdm" },
375a5ffef6aSPaul Walmsley .flags = CLKDM_CAN_HWSUP_SWSUP,
376a5ffef6aSPaul Walmsley .dep_bit = OMAP3430_EN_PER_SHIFT,
377a5ffef6aSPaul Walmsley .wkdep_srcs = per_wkdeps,
378a5ffef6aSPaul Walmsley .sleepdep_srcs = per_sleepdeps,
379a5ffef6aSPaul Walmsley .clktrctrl_mask = OMAP3430_CLKTRCTRL_PER_MASK,
380a5ffef6aSPaul Walmsley };
381a5ffef6aSPaul Walmsley
38216e5e2c4SMark A. Greer static struct clockdomain per_am35x_clkdm = {
38316e5e2c4SMark A. Greer .name = "per_clkdm",
38416e5e2c4SMark A. Greer .pwrdm = { .name = "per_pwrdm" },
38516e5e2c4SMark A. Greer .flags = CLKDM_CAN_HWSUP_SWSUP,
38616e5e2c4SMark A. Greer .dep_bit = OMAP3430_EN_PER_SHIFT,
38716e5e2c4SMark A. Greer .wkdep_srcs = per_am35x_wkdeps,
38816e5e2c4SMark A. Greer .sleepdep_srcs = per_am35x_sleepdeps,
38916e5e2c4SMark A. Greer .clktrctrl_mask = OMAP3430_CLKTRCTRL_PER_MASK,
39016e5e2c4SMark A. Greer };
39116e5e2c4SMark A. Greer
392a5ffef6aSPaul Walmsley static struct clockdomain emu_clkdm = {
393a5ffef6aSPaul Walmsley .name = "emu_clkdm",
394a5ffef6aSPaul Walmsley .pwrdm = { .name = "emu_pwrdm" },
395b71c7217SPaul Walmsley .flags = (CLKDM_CAN_ENABLE_AUTO | CLKDM_CAN_SWSUP |
396b71c7217SPaul Walmsley CLKDM_MISSING_IDLE_REPORTING),
397a5ffef6aSPaul Walmsley .clktrctrl_mask = OMAP3430_CLKTRCTRL_EMU_MASK,
398a5ffef6aSPaul Walmsley };
399a5ffef6aSPaul Walmsley
400a5ffef6aSPaul Walmsley static struct clockdomain dpll1_clkdm = {
401a5ffef6aSPaul Walmsley .name = "dpll1_clkdm",
402a5ffef6aSPaul Walmsley .pwrdm = { .name = "dpll1_pwrdm" },
403a5ffef6aSPaul Walmsley };
404a5ffef6aSPaul Walmsley
405a5ffef6aSPaul Walmsley static struct clockdomain dpll2_clkdm = {
406a5ffef6aSPaul Walmsley .name = "dpll2_clkdm",
407a5ffef6aSPaul Walmsley .pwrdm = { .name = "dpll2_pwrdm" },
408a5ffef6aSPaul Walmsley };
409a5ffef6aSPaul Walmsley
410a5ffef6aSPaul Walmsley static struct clockdomain dpll3_clkdm = {
411a5ffef6aSPaul Walmsley .name = "dpll3_clkdm",
412a5ffef6aSPaul Walmsley .pwrdm = { .name = "dpll3_pwrdm" },
413a5ffef6aSPaul Walmsley };
414a5ffef6aSPaul Walmsley
415a5ffef6aSPaul Walmsley static struct clockdomain dpll4_clkdm = {
416a5ffef6aSPaul Walmsley .name = "dpll4_clkdm",
417a5ffef6aSPaul Walmsley .pwrdm = { .name = "dpll4_pwrdm" },
418a5ffef6aSPaul Walmsley };
419a5ffef6aSPaul Walmsley
420a5ffef6aSPaul Walmsley static struct clockdomain dpll5_clkdm = {
421a5ffef6aSPaul Walmsley .name = "dpll5_clkdm",
422a5ffef6aSPaul Walmsley .pwrdm = { .name = "dpll5_pwrdm" },
423a5ffef6aSPaul Walmsley };
424a5ffef6aSPaul Walmsley
425a5ffef6aSPaul Walmsley /*
426a5ffef6aSPaul Walmsley * Clockdomain hwsup dependencies
427a5ffef6aSPaul Walmsley */
428a5ffef6aSPaul Walmsley
429a5ffef6aSPaul Walmsley static struct clkdm_autodep clkdm_autodeps[] = {
430a5ffef6aSPaul Walmsley {
431a5ffef6aSPaul Walmsley .clkdm = { .name = "mpu_clkdm" },
432a5ffef6aSPaul Walmsley },
433a5ffef6aSPaul Walmsley {
434a5ffef6aSPaul Walmsley .clkdm = { .name = "iva2_clkdm" },
435a5ffef6aSPaul Walmsley },
436a5ffef6aSPaul Walmsley {
437a5ffef6aSPaul Walmsley .clkdm = { .name = NULL },
438a5ffef6aSPaul Walmsley }
439a5ffef6aSPaul Walmsley };
440a5ffef6aSPaul Walmsley
44116e5e2c4SMark A. Greer static struct clkdm_autodep clkdm_am35x_autodeps[] = {
44216e5e2c4SMark A. Greer {
44316e5e2c4SMark A. Greer .clkdm = { .name = "mpu_clkdm" },
44416e5e2c4SMark A. Greer },
44516e5e2c4SMark A. Greer {
44616e5e2c4SMark A. Greer .clkdm = { .name = NULL },
44716e5e2c4SMark A. Greer }
44816e5e2c4SMark A. Greer };
44916e5e2c4SMark A. Greer
450a5ffef6aSPaul Walmsley /*
451a5ffef6aSPaul Walmsley *
452a5ffef6aSPaul Walmsley */
453a5ffef6aSPaul Walmsley
45416e5e2c4SMark A. Greer static struct clockdomain *clockdomains_common[] __initdata = {
455a5ffef6aSPaul Walmsley &wkup_common_clkdm,
456a5ffef6aSPaul Walmsley &neon_clkdm,
457a5ffef6aSPaul Walmsley &core_l3_3xxx_clkdm,
458a5ffef6aSPaul Walmsley &core_l4_3xxx_clkdm,
45916e5e2c4SMark A. Greer &emu_clkdm,
46016e5e2c4SMark A. Greer &dpll1_clkdm,
46116e5e2c4SMark A. Greer &dpll3_clkdm,
46216e5e2c4SMark A. Greer &dpll4_clkdm,
46316e5e2c4SMark A. Greer NULL
46416e5e2c4SMark A. Greer };
46516e5e2c4SMark A. Greer
46616e5e2c4SMark A. Greer static struct clockdomain *clockdomains_omap3430[] __initdata = {
46716e5e2c4SMark A. Greer &mpu_3xxx_clkdm,
46816e5e2c4SMark A. Greer &iva2_clkdm,
46916e5e2c4SMark A. Greer &d2d_clkdm,
470a5ffef6aSPaul Walmsley &dss_3xxx_clkdm,
471a5ffef6aSPaul Walmsley &cam_clkdm,
472a5ffef6aSPaul Walmsley &per_clkdm,
473a5ffef6aSPaul Walmsley &dpll2_clkdm,
474a5ffef6aSPaul Walmsley NULL
475a5ffef6aSPaul Walmsley };
476a5ffef6aSPaul Walmsley
477a5ffef6aSPaul Walmsley static struct clockdomain *clockdomains_omap3430es1[] __initdata = {
478a5ffef6aSPaul Walmsley &gfx_3430es1_clkdm,
479a5ffef6aSPaul Walmsley NULL,
480a5ffef6aSPaul Walmsley };
481a5ffef6aSPaul Walmsley
482a5ffef6aSPaul Walmsley static struct clockdomain *clockdomains_omap3430es2plus[] __initdata = {
483a5ffef6aSPaul Walmsley &sgx_clkdm,
484a5ffef6aSPaul Walmsley &dpll5_clkdm,
485a5ffef6aSPaul Walmsley &usbhost_clkdm,
486a5ffef6aSPaul Walmsley NULL,
487a5ffef6aSPaul Walmsley };
488a5ffef6aSPaul Walmsley
48916e5e2c4SMark A. Greer static struct clockdomain *clockdomains_am35x[] __initdata = {
49016e5e2c4SMark A. Greer &mpu_am35x_clkdm,
49116e5e2c4SMark A. Greer &sgx_am35x_clkdm,
49216e5e2c4SMark A. Greer &dss_am35x_clkdm,
49316e5e2c4SMark A. Greer &per_am35x_clkdm,
49416e5e2c4SMark A. Greer &usbhost_am35x_clkdm,
49516e5e2c4SMark A. Greer &dpll5_clkdm,
49616e5e2c4SMark A. Greer NULL
49716e5e2c4SMark A. Greer };
49816e5e2c4SMark A. Greer
omap3xxx_clockdomains_init(void)499a5ffef6aSPaul Walmsley void __init omap3xxx_clockdomains_init(void)
500a5ffef6aSPaul Walmsley {
501a5ffef6aSPaul Walmsley struct clockdomain **sc;
50216e5e2c4SMark A. Greer unsigned int rev;
503a5ffef6aSPaul Walmsley
504a5ffef6aSPaul Walmsley if (!cpu_is_omap34xx())
505a5ffef6aSPaul Walmsley return;
506a5ffef6aSPaul Walmsley
507a5ffef6aSPaul Walmsley clkdm_register_platform_funcs(&omap3_clkdm_operations);
50816e5e2c4SMark A. Greer clkdm_register_clkdms(clockdomains_common);
509a5ffef6aSPaul Walmsley
51016e5e2c4SMark A. Greer rev = omap_rev();
51116e5e2c4SMark A. Greer
51216e5e2c4SMark A. Greer if (rev == AM35XX_REV_ES1_0 || rev == AM35XX_REV_ES1_1) {
51316e5e2c4SMark A. Greer clkdm_register_clkdms(clockdomains_am35x);
51416e5e2c4SMark A. Greer clkdm_register_autodeps(clkdm_am35x_autodeps);
51516e5e2c4SMark A. Greer } else {
51616e5e2c4SMark A. Greer clkdm_register_clkdms(clockdomains_omap3430);
51716e5e2c4SMark A. Greer
51816e5e2c4SMark A. Greer sc = (rev == OMAP3430_REV_ES1_0) ?
51916e5e2c4SMark A. Greer clockdomains_omap3430es1 : clockdomains_omap3430es2plus;
520a5ffef6aSPaul Walmsley
521a5ffef6aSPaul Walmsley clkdm_register_clkdms(sc);
522a5ffef6aSPaul Walmsley clkdm_register_autodeps(clkdm_autodeps);
52316e5e2c4SMark A. Greer }
52416e5e2c4SMark A. Greer
525a5ffef6aSPaul Walmsley clkdm_complete_init();
526a5ffef6aSPaul Walmsley }
527