diff options
author | Abhilash Kesavan <a.kesavan@samsung.com> | 2011-10-04 07:30:22 -0400 |
---|---|---|
committer | Kukjin Kim <kgene.kim@samsung.com> | 2011-10-04 07:31:24 -0400 |
commit | 6b6844dd54e4196dd9818bc63b319f93c37a08be (patch) | |
tree | c01749ce969969da4273a51cc054a089d60eb83b /arch/arm/mach-s5p64x0/include | |
parent | e2e13621b267f88f69917780e107725d2c0ecad9 (diff) |
ARM: S5P64X0: Add Power Management support
Add suspend-to-ram support for SMDK6440/50
Signed-off-by: Abhilash Kesavan <a.kesavan@samsung.com>
Signed-off-by: Kukjin Kim <kgene.kim@samsung.com>
Diffstat (limited to 'arch/arm/mach-s5p64x0/include')
-rw-r--r-- | arch/arm/mach-s5p64x0/include/mach/map.h | 1 | ||||
-rw-r--r-- | arch/arm/mach-s5p64x0/include/mach/pm-core.h | 117 | ||||
-rw-r--r-- | arch/arm/mach-s5p64x0/include/mach/regs-clock.h | 33 | ||||
-rw-r--r-- | arch/arm/mach-s5p64x0/include/mach/regs-gpio.h | 17 |
4 files changed, 168 insertions, 0 deletions
diff --git a/arch/arm/mach-s5p64x0/include/mach/map.h b/arch/arm/mach-s5p64x0/include/mach/map.h index c5ef50c26291..4d3ac8a3709d 100644 --- a/arch/arm/mach-s5p64x0/include/mach/map.h +++ b/arch/arm/mach-s5p64x0/include/mach/map.h | |||
@@ -88,5 +88,6 @@ | |||
88 | #define S5P_PA_UART5 S5P6450_PA_UART(5) | 88 | #define S5P_PA_UART5 S5P6450_PA_UART(5) |
89 | 89 | ||
90 | #define S5P_SZ_UART SZ_256 | 90 | #define S5P_SZ_UART SZ_256 |
91 | #define S3C_VA_UARTx(x) (S3C_VA_UART + ((x) * S3C_UART_OFFSET)) | ||
91 | 92 | ||
92 | #endif /* __ASM_ARCH_MAP_H */ | 93 | #endif /* __ASM_ARCH_MAP_H */ |
diff --git a/arch/arm/mach-s5p64x0/include/mach/pm-core.h b/arch/arm/mach-s5p64x0/include/mach/pm-core.h new file mode 100644 index 000000000000..e52f7545d3aa --- /dev/null +++ b/arch/arm/mach-s5p64x0/include/mach/pm-core.h | |||
@@ -0,0 +1,117 @@ | |||
1 | /* linux/arch/arm/mach-s5p64x0/include/mach/pm-core.h | ||
2 | * | ||
3 | * Copyright (c) 2011 Samsung Electronics Co., Ltd. | ||
4 | * http://www.samsung.com | ||
5 | * | ||
6 | * S5P64X0 - PM core support for arch/arm/plat-samsung/pm.c | ||
7 | * | ||
8 | * Based on PM core support for S3C64XX by Ben Dooks | ||
9 | * | ||
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. | ||
13 | */ | ||
14 | |||
15 | #include <mach/regs-gpio.h> | ||
16 | |||
17 | static inline void s3c_pm_debug_init_uart(void) | ||
18 | { | ||
19 | u32 tmp = __raw_readl(S5P64X0_CLK_GATE_PCLK); | ||
20 | |||
21 | /* | ||
22 | * As a note, since the S5P64X0 UARTs generally have multiple | ||
23 | * clock sources, we simply enable PCLK at the moment and hope | ||
24 | * that the resume settings for the UART are suitable for the | ||
25 | * use with PCLK. | ||
26 | */ | ||
27 | tmp |= S5P64X0_CLK_GATE_PCLK_UART0; | ||
28 | tmp |= S5P64X0_CLK_GATE_PCLK_UART1; | ||
29 | tmp |= S5P64X0_CLK_GATE_PCLK_UART2; | ||
30 | tmp |= S5P64X0_CLK_GATE_PCLK_UART3; | ||
31 | |||
32 | __raw_writel(tmp, S5P64X0_CLK_GATE_PCLK); | ||
33 | udelay(10); | ||
34 | } | ||
35 | |||
36 | static inline void s3c_pm_arch_prepare_irqs(void) | ||
37 | { | ||
38 | /* VIC should have already been taken care of */ | ||
39 | |||
40 | /* clear any pending EINT0 interrupts */ | ||
41 | __raw_writel(__raw_readl(S5P64X0_EINT0PEND), S5P64X0_EINT0PEND); | ||
42 | } | ||
43 | |||
44 | static inline void s3c_pm_arch_stop_clocks(void) { } | ||
45 | static inline void s3c_pm_arch_show_resume_irqs(void) { } | ||
46 | |||
47 | /* | ||
48 | * make these defines, we currently do not have any need to change | ||
49 | * the IRQ wake controls depending on the CPU we are running on | ||
50 | */ | ||
51 | #define s3c_irqwake_eintallow ((1 << 16) - 1) | ||
52 | #define s3c_irqwake_intallow (~0) | ||
53 | |||
54 | static inline void s3c_pm_arch_update_uart(void __iomem *regs, | ||
55 | struct pm_uart_save *save) | ||
56 | { | ||
57 | u32 ucon = __raw_readl(regs + S3C2410_UCON); | ||
58 | u32 ucon_clk = ucon & S3C6400_UCON_CLKMASK; | ||
59 | u32 save_clk = save->ucon & S3C6400_UCON_CLKMASK; | ||
60 | u32 new_ucon; | ||
61 | u32 delta; | ||
62 | |||
63 | /* | ||
64 | * S5P64X0 UART blocks only support level interrupts, so ensure that | ||
65 | * when we restore unused UART blocks we force the level interrupt | ||
66 | * settings. | ||
67 | */ | ||
68 | save->ucon |= S3C2410_UCON_TXILEVEL | S3C2410_UCON_RXILEVEL; | ||
69 | |||
70 | /* | ||
71 | * We have a constraint on changing the clock type of the UART | ||
72 | * between UCLKx and PCLK, so ensure that when we restore UCON | ||
73 | * that the CLK field is correctly modified if the bootloader | ||
74 | * has changed anything. | ||
75 | */ | ||
76 | if (ucon_clk != save_clk) { | ||
77 | new_ucon = save->ucon; | ||
78 | delta = ucon_clk ^ save_clk; | ||
79 | |||
80 | /* | ||
81 | * change from UCLKx => wrong PCLK, | ||
82 | * either UCLK can be tested for by a bit-test | ||
83 | * with UCLK0 | ||
84 | */ | ||
85 | if (ucon_clk & S3C6400_UCON_UCLK0 && | ||
86 | !(save_clk & S3C6400_UCON_UCLK0) && | ||
87 | delta & S3C6400_UCON_PCLK2) { | ||
88 | new_ucon &= ~S3C6400_UCON_UCLK0; | ||
89 | } else if (delta == S3C6400_UCON_PCLK2) { | ||
90 | /* | ||
91 | * as a precaution, don't change from | ||
92 | * PCLK2 => PCLK or vice-versa | ||
93 | */ | ||
94 | new_ucon ^= S3C6400_UCON_PCLK2; | ||
95 | } | ||
96 | |||
97 | S3C_PMDBG("ucon change %04x => %04x (save=%04x)\n", | ||
98 | ucon, new_ucon, save->ucon); | ||
99 | save->ucon = new_ucon; | ||
100 | } | ||
101 | } | ||
102 | |||
103 | static inline void s3c_pm_restored_gpios(void) | ||
104 | { | ||
105 | /* ensure sleep mode has been cleared from the system */ | ||
106 | __raw_writel(0, S5P64X0_SLPEN); | ||
107 | } | ||
108 | |||
109 | static inline void samsung_pm_saved_gpios(void) | ||
110 | { | ||
111 | /* | ||
112 | * turn on the sleep mode and keep it there, as it seems that during | ||
113 | * suspend the xCON registers get re-set and thus you can end up with | ||
114 | * problems between going to sleep and resuming. | ||
115 | */ | ||
116 | __raw_writel(S5P64X0_SLPEN_USE_xSLP, S5P64X0_SLPEN); | ||
117 | } | ||
diff --git a/arch/arm/mach-s5p64x0/include/mach/regs-clock.h b/arch/arm/mach-s5p64x0/include/mach/regs-clock.h index a133f22fa155..bd91112c813c 100644 --- a/arch/arm/mach-s5p64x0/include/mach/regs-clock.h +++ b/arch/arm/mach-s5p64x0/include/mach/regs-clock.h | |||
@@ -41,17 +41,50 @@ | |||
41 | #define S5P6450_DPLL_CON S5P_CLKREG(0x50) | 41 | #define S5P6450_DPLL_CON S5P_CLKREG(0x50) |
42 | #define S5P6450_DPLL_CON_K S5P_CLKREG(0x54) | 42 | #define S5P6450_DPLL_CON_K S5P_CLKREG(0x54) |
43 | 43 | ||
44 | #define S5P64X0_AHB_CON0 S5P_CLKREG(0x100) | ||
44 | #define S5P64X0_CLK_SRC1 S5P_CLKREG(0x10C) | 45 | #define S5P64X0_CLK_SRC1 S5P_CLKREG(0x10C) |
45 | 46 | ||
46 | #define S5P64X0_SYS_ID S5P_CLKREG(0x118) | 47 | #define S5P64X0_SYS_ID S5P_CLKREG(0x118) |
47 | #define S5P64X0_SYS_OTHERS S5P_CLKREG(0x11C) | 48 | #define S5P64X0_SYS_OTHERS S5P_CLKREG(0x11C) |
48 | 49 | ||
49 | #define S5P64X0_PWR_CFG S5P_CLKREG(0x804) | 50 | #define S5P64X0_PWR_CFG S5P_CLKREG(0x804) |
51 | #define S5P64X0_EINT_WAKEUP_MASK S5P_CLKREG(0x808) | ||
52 | #define S5P64X0_SLEEP_CFG S5P_CLKREG(0x818) | ||
53 | #define S5P64X0_PWR_STABLE S5P_CLKREG(0x828) | ||
54 | |||
50 | #define S5P64X0_OTHERS S5P_CLKREG(0x900) | 55 | #define S5P64X0_OTHERS S5P_CLKREG(0x900) |
56 | #define S5P64X0_WAKEUP_STAT S5P_CLKREG(0x908) | ||
57 | |||
58 | #define S5P64X0_INFORM0 S5P_CLKREG(0xA00) | ||
51 | 59 | ||
52 | #define S5P64X0_CLKDIV0_HCLK_SHIFT (8) | 60 | #define S5P64X0_CLKDIV0_HCLK_SHIFT (8) |
53 | #define S5P64X0_CLKDIV0_HCLK_MASK (0xF << S5P64X0_CLKDIV0_HCLK_SHIFT) | 61 | #define S5P64X0_CLKDIV0_HCLK_MASK (0xF << S5P64X0_CLKDIV0_HCLK_SHIFT) |
54 | 62 | ||
63 | /* HCLK GATE Registers */ | ||
64 | #define S5P64X0_CLK_GATE_HCLK1_FIMGVG (1 << 2) | ||
65 | #define S5P64X0_CLK_GATE_SCLK1_FIMGVG (1 << 2) | ||
66 | |||
67 | /* PCLK GATE Registers */ | ||
68 | #define S5P64X0_CLK_GATE_PCLK_UART3 (1 << 4) | ||
69 | #define S5P64X0_CLK_GATE_PCLK_UART2 (1 << 3) | ||
70 | #define S5P64X0_CLK_GATE_PCLK_UART1 (1 << 2) | ||
71 | #define S5P64X0_CLK_GATE_PCLK_UART0 (1 << 1) | ||
72 | |||
73 | #define S5P64X0_PWR_CFG_MMC1_DISABLE (1 << 15) | ||
74 | #define S5P64X0_PWR_CFG_MMC0_DISABLE (1 << 14) | ||
75 | #define S5P64X0_PWR_CFG_RTC_TICK_DISABLE (1 << 11) | ||
76 | #define S5P64X0_PWR_CFG_RTC_ALRM_DISABLE (1 << 10) | ||
77 | #define S5P64X0_PWR_CFG_WFI_MASK (3 << 5) | ||
78 | #define S5P64X0_PWR_CFG_WFI_SLEEP (3 << 5) | ||
79 | |||
80 | #define S5P64X0_SLEEP_CFG_OSC_EN (1 << 0) | ||
81 | |||
82 | #define S5P64X0_PWR_STABLE_PWR_CNT_VAL4 (4 << 0) | ||
83 | |||
84 | #define S5P6450_OTHERS_DISABLE_INT (1 << 31) | ||
85 | #define S5P64X0_OTHERS_RET_UART (1 << 26) | ||
86 | #define S5P64X0_OTHERS_RET_MMC1 (1 << 25) | ||
87 | #define S5P64X0_OTHERS_RET_MMC0 (1 << 24) | ||
55 | #define S5P64X0_OTHERS_USB_SIG_MASK (1 << 16) | 88 | #define S5P64X0_OTHERS_USB_SIG_MASK (1 << 16) |
56 | 89 | ||
57 | /* Compatibility defines */ | 90 | /* Compatibility defines */ |
diff --git a/arch/arm/mach-s5p64x0/include/mach/regs-gpio.h b/arch/arm/mach-s5p64x0/include/mach/regs-gpio.h index 88269ec70a38..cfdfa4fdadf2 100644 --- a/arch/arm/mach-s5p64x0/include/mach/regs-gpio.h +++ b/arch/arm/mach-s5p64x0/include/mach/regs-gpio.h | |||
@@ -37,15 +37,32 @@ | |||
37 | #define S5P64X0_SPCON0 (S5P_VA_GPIO + 0x1A0) | 37 | #define S5P64X0_SPCON0 (S5P_VA_GPIO + 0x1A0) |
38 | #define S5P64X0_SPCON0_LCD_SEL_MASK (0x3 << 0) | 38 | #define S5P64X0_SPCON0_LCD_SEL_MASK (0x3 << 0) |
39 | #define S5P64X0_SPCON0_LCD_SEL_RGB (0x1 << 0) | 39 | #define S5P64X0_SPCON0_LCD_SEL_RGB (0x1 << 0) |
40 | #define S5P64X0_SPCON1 (S5P_VA_GPIO + 0x2B0) | ||
41 | |||
42 | #define S5P64X0_MEM0CONSLP0 (S5P_VA_GPIO + 0x1C0) | ||
43 | #define S5P64X0_MEM0CONSLP1 (S5P_VA_GPIO + 0x1C4) | ||
44 | #define S5P64X0_MEM0DRVCON (S5P_VA_GPIO + 0x1D0) | ||
45 | #define S5P64X0_MEM1DRVCON (S5P_VA_GPIO + 0x1D4) | ||
46 | |||
47 | #define S5P64X0_EINT12CON (S5P_VA_GPIO + 0x200) | ||
48 | #define S5P64X0_EINT12FLTCON (S5P_VA_GPIO + 0x220) | ||
49 | #define S5P64X0_EINT12MASK (S5P_VA_GPIO + 0x240) | ||
40 | 50 | ||
41 | /* External interrupt control registers for group0 */ | 51 | /* External interrupt control registers for group0 */ |
42 | 52 | ||
43 | #define EINT0CON0_OFFSET (0x900) | 53 | #define EINT0CON0_OFFSET (0x900) |
54 | #define EINT0FLTCON0_OFFSET (0x910) | ||
55 | #define EINT0FLTCON1_OFFSET (0x914) | ||
44 | #define EINT0MASK_OFFSET (0x920) | 56 | #define EINT0MASK_OFFSET (0x920) |
45 | #define EINT0PEND_OFFSET (0x924) | 57 | #define EINT0PEND_OFFSET (0x924) |
46 | 58 | ||
47 | #define S5P64X0_EINT0CON0 (S5P_VA_GPIO + EINT0CON0_OFFSET) | 59 | #define S5P64X0_EINT0CON0 (S5P_VA_GPIO + EINT0CON0_OFFSET) |
60 | #define S5P64X0_EINT0FLTCON0 (S5P_VA_GPIO + EINT0FLTCON0_OFFSET) | ||
61 | #define S5P64X0_EINT0FLTCON1 (S5P_VA_GPIO + EINT0FLTCON1_OFFSET) | ||
48 | #define S5P64X0_EINT0MASK (S5P_VA_GPIO + EINT0MASK_OFFSET) | 62 | #define S5P64X0_EINT0MASK (S5P_VA_GPIO + EINT0MASK_OFFSET) |
49 | #define S5P64X0_EINT0PEND (S5P_VA_GPIO + EINT0PEND_OFFSET) | 63 | #define S5P64X0_EINT0PEND (S5P_VA_GPIO + EINT0PEND_OFFSET) |
50 | 64 | ||
65 | #define S5P64X0_SLPEN (S5P_VA_GPIO + 0x930) | ||
66 | #define S5P64X0_SLPEN_USE_xSLP (1 << 0) | ||
67 | |||
51 | #endif /* __ASM_ARCH_REGS_GPIO_H */ | 68 | #endif /* __ASM_ARCH_REGS_GPIO_H */ |