1 // SPDX-License-Identifier: GPL-2.0-only
3 * Common powerdomain framework functions
5 * Copyright (C) 2010-2011 Texas Instruments, Inc.
6 * Copyright (C) 2010 Nokia Corporation
8 * Derived from mach-omap2/powerdomain.c written by Paul Walmsley
11 #include <linux/errno.h>
12 #include <linux/kernel.h>
13 #include <linux/bug.h>
16 #include "cm-regbits-34xx.h"
17 #include "prm-regbits-34xx.h"
18 #include "prm-regbits-44xx.h"
21 * OMAP3 and OMAP4 specific register bit initialisations
22 * Notice that the names here are not according to each power
23 * domain but the bit mapping used applies to all of them
25 /* OMAP3 and OMAP4 Memory Onstate Masks (common across all power domains) */
26 #define OMAP_MEM0_ONSTATE_MASK OMAP3430_SHAREDL1CACHEFLATONSTATE_MASK
27 #define OMAP_MEM1_ONSTATE_MASK OMAP3430_L1FLATMEMONSTATE_MASK
28 #define OMAP_MEM2_ONSTATE_MASK OMAP3430_SHAREDL2CACHEFLATONSTATE_MASK
29 #define OMAP_MEM3_ONSTATE_MASK OMAP3430_L2FLATMEMONSTATE_MASK
30 #define OMAP_MEM4_ONSTATE_MASK OMAP4430_OCP_NRET_BANK_ONSTATE_MASK
32 /* OMAP3 and OMAP4 Memory Retstate Masks (common across all power domains) */
33 #define OMAP_MEM0_RETSTATE_MASK OMAP3430_SHAREDL1CACHEFLATRETSTATE_MASK
34 #define OMAP_MEM1_RETSTATE_MASK OMAP3430_L1FLATMEMRETSTATE_MASK
35 #define OMAP_MEM2_RETSTATE_MASK OMAP3430_SHAREDL2CACHEFLATRETSTATE_MASK
36 #define OMAP_MEM3_RETSTATE_MASK OMAP3430_L2FLATMEMRETSTATE_MASK
37 #define OMAP_MEM4_RETSTATE_MASK OMAP4430_OCP_NRET_BANK_RETSTATE_MASK
39 /* OMAP3 and OMAP4 Memory Status bits */
40 #define OMAP_MEM0_STATEST_MASK OMAP3430_SHAREDL1CACHEFLATSTATEST_MASK
41 #define OMAP_MEM1_STATEST_MASK OMAP3430_L1FLATMEMSTATEST_MASK
42 #define OMAP_MEM2_STATEST_MASK OMAP3430_SHAREDL2CACHEFLATSTATEST_MASK
43 #define OMAP_MEM3_STATEST_MASK OMAP3430_L2FLATMEMSTATEST_MASK
44 #define OMAP_MEM4_STATEST_MASK OMAP4430_OCP_NRET_BANK_STATEST_MASK
46 /* Common Internal functions used across OMAP rev's*/
47 u32
omap2_pwrdm_get_mem_bank_onstate_mask(u8 bank
)
51 return OMAP_MEM0_ONSTATE_MASK
;
53 return OMAP_MEM1_ONSTATE_MASK
;
55 return OMAP_MEM2_ONSTATE_MASK
;
57 return OMAP_MEM3_ONSTATE_MASK
;
59 return OMAP_MEM4_ONSTATE_MASK
;
61 WARN_ON(1); /* should never happen */
67 u32
omap2_pwrdm_get_mem_bank_retst_mask(u8 bank
)
71 return OMAP_MEM0_RETSTATE_MASK
;
73 return OMAP_MEM1_RETSTATE_MASK
;
75 return OMAP_MEM2_RETSTATE_MASK
;
77 return OMAP_MEM3_RETSTATE_MASK
;
79 return OMAP_MEM4_RETSTATE_MASK
;
81 WARN_ON(1); /* should never happen */
87 u32
omap2_pwrdm_get_mem_bank_stst_mask(u8 bank
)
91 return OMAP_MEM0_STATEST_MASK
;
93 return OMAP_MEM1_STATEST_MASK
;
95 return OMAP_MEM2_STATEST_MASK
;
97 return OMAP_MEM3_STATEST_MASK
;
99 return OMAP_MEM4_STATEST_MASK
;
101 WARN_ON(1); /* should never happen */