regulator, mc13xxx: Remove pointless test for unsigned less than zero
[zen-stable.git] / arch / arm / mach-omap2 / powerdomain-common.c
blob171fccd208c730e7f003f06de576c6f2a166694c
1 /*
2 * linux/arch/arm/mach-omap2/powerdomain-common.c
3 * Contains common powerdomain framework functions
5 * Copyright (C) 2010 Texas Instruments, Inc.
6 * Copyright (C) 2010 Nokia Corporation
8 * Derived from mach-omap2/powerdomain.c written by Paul Walmsley
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
15 #include <linux/errno.h>
16 #include <linux/kernel.h>
17 #include "pm.h"
18 #include "cm.h"
19 #include "cm-regbits-34xx.h"
20 #include "cm-regbits-44xx.h"
21 #include "prm-regbits-34xx.h"
22 #include "prm-regbits-44xx.h"
25 * OMAP3 and OMAP4 specific register bit initialisations
26 * Notice that the names here are not according to each power
27 * domain but the bit mapping used applies to all of them
29 /* OMAP3 and OMAP4 Memory Onstate Masks (common across all power domains) */
30 #define OMAP_MEM0_ONSTATE_MASK OMAP3430_SHAREDL1CACHEFLATONSTATE_MASK
31 #define OMAP_MEM1_ONSTATE_MASK OMAP3430_L1FLATMEMONSTATE_MASK
32 #define OMAP_MEM2_ONSTATE_MASK OMAP3430_SHAREDL2CACHEFLATONSTATE_MASK
33 #define OMAP_MEM3_ONSTATE_MASK OMAP3430_L2FLATMEMONSTATE_MASK
34 #define OMAP_MEM4_ONSTATE_MASK OMAP4430_OCP_NRET_BANK_ONSTATE_MASK
36 /* OMAP3 and OMAP4 Memory Retstate Masks (common across all power domains) */
37 #define OMAP_MEM0_RETSTATE_MASK OMAP3430_SHAREDL1CACHEFLATRETSTATE_MASK
38 #define OMAP_MEM1_RETSTATE_MASK OMAP3430_L1FLATMEMRETSTATE_MASK
39 #define OMAP_MEM2_RETSTATE_MASK OMAP3430_SHAREDL2CACHEFLATRETSTATE_MASK
40 #define OMAP_MEM3_RETSTATE_MASK OMAP3430_L2FLATMEMRETSTATE_MASK
41 #define OMAP_MEM4_RETSTATE_MASK OMAP4430_OCP_NRET_BANK_RETSTATE_MASK
43 /* OMAP3 and OMAP4 Memory Status bits */
44 #define OMAP_MEM0_STATEST_MASK OMAP3430_SHAREDL1CACHEFLATSTATEST_MASK
45 #define OMAP_MEM1_STATEST_MASK OMAP3430_L1FLATMEMSTATEST_MASK
46 #define OMAP_MEM2_STATEST_MASK OMAP3430_SHAREDL2CACHEFLATSTATEST_MASK
47 #define OMAP_MEM3_STATEST_MASK OMAP3430_L2FLATMEMSTATEST_MASK
48 #define OMAP_MEM4_STATEST_MASK OMAP4430_OCP_NRET_BANK_STATEST_MASK
50 /* Common Internal functions used across OMAP rev's*/
51 u32 omap2_pwrdm_get_mem_bank_onstate_mask(u8 bank)
53 switch (bank) {
54 case 0:
55 return OMAP_MEM0_ONSTATE_MASK;
56 case 1:
57 return OMAP_MEM1_ONSTATE_MASK;
58 case 2:
59 return OMAP_MEM2_ONSTATE_MASK;
60 case 3:
61 return OMAP_MEM3_ONSTATE_MASK;
62 case 4:
63 return OMAP_MEM4_ONSTATE_MASK;
64 default:
65 WARN_ON(1); /* should never happen */
66 return -EEXIST;
68 return 0;
71 u32 omap2_pwrdm_get_mem_bank_retst_mask(u8 bank)
73 switch (bank) {
74 case 0:
75 return OMAP_MEM0_RETSTATE_MASK;
76 case 1:
77 return OMAP_MEM1_RETSTATE_MASK;
78 case 2:
79 return OMAP_MEM2_RETSTATE_MASK;
80 case 3:
81 return OMAP_MEM3_RETSTATE_MASK;
82 case 4:
83 return OMAP_MEM4_RETSTATE_MASK;
84 default:
85 WARN_ON(1); /* should never happen */
86 return -EEXIST;
88 return 0;
91 u32 omap2_pwrdm_get_mem_bank_stst_mask(u8 bank)
93 switch (bank) {
94 case 0:
95 return OMAP_MEM0_STATEST_MASK;
96 case 1:
97 return OMAP_MEM1_STATEST_MASK;
98 case 2:
99 return OMAP_MEM2_STATEST_MASK;
100 case 3:
101 return OMAP_MEM3_STATEST_MASK;
102 case 4:
103 return OMAP_MEM4_STATEST_MASK;
104 default:
105 WARN_ON(1); /* should never happen */
106 return -EEXIST;
108 return 0;