Skip to contentSkip to conversation

ARM: S5P64X0: Add Power Management Support

PATCH New Sangbeom Kim 1 participant 5 messages Dec 9, 2010

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover ARM: S5P64X0: Add Power Management Support

This patch adds suspend-to-ram support for S5P64X0 Note. This patch is confirmed on SMDK6440 and SMDK6450 board.
S5P64X0 EINT patch is needed for this patch

[PATCH 1/4] ARM: S5P: Make the common S5P PM code conditionally compile [PATCH 2/4] ARM: S5P64X0: Add Power Management support
[PATCH 3/4] ARM: S5P64X0: Fix incorrect serial clock name [PATCH 4/4] ARM: S5P64X0: Enable pm save/restore functions for GPIO banks

#1 lore raw

PATCH 1/4 ARM: S5P: Make the common S5P PM code conditionally compile

From: Abhilash Kesavan <[email protected]>

Pave the way for adding PM support on S5P64X0, which is more similar to the S3C64XX series than the S5P series. Hence, the common pm code should not be used for S5P64X0.

---
 arch/arm/mach-s5pv210/Kconfig |    1 +
 arch/arm/plat-s5p/Kconfig     |    7 +++++++
 arch/arm/plat-s5p/Makefile    |    4 ++--
 3 files changed, 10 insertions(+), 2 deletions(-)
arch/arm/mach-s5pv210/Kconfig +1 -0
index 862f239..eb60e10 100644
@@ -13,6 +13,7 @@ config CPU_S5PV210
 	bool
 	select S3C_PL330_DMA
 	select S5P_EXT_INT
+	select S5P_PM if PM
 	select S5PV210_PM if PM
 	help
 	  Enable S5PV210 CPU support
arch/arm/plat-s5p/Kconfig +7 -0
index 65dbfa8..eeac91d 100644
@@ -37,6 +37,13 @@ config S5P_GPIO_INT
 	help
 	  Common code for the GPIO interrupts (other than external interrupts.)
 
+config S5P_PM
+	bool
+	help
+	  Common code for power management support on S5P series (includes irq
+	  suspend/resume)
+	  Note: Do not choose this S5P6440 and S5P6450.
+
 config S5P_DEV_FIMC0
 	bool
 	help
arch/arm/plat-s5p/Makefile +2 -2
index de65238..bfdf304 100644
@@ -19,8 +19,8 @@ obj-y				+= clock.o
 obj-y				+= irq.o
 obj-$(CONFIG_S5P_EXT_INT)	+= irq-eint.o
 obj-$(CONFIG_S5P_GPIO_INT)	+= irq-gpioint.o
-obj-$(CONFIG_PM)		+= pm.o
-obj-$(CONFIG_PM)		+= irq-pm.o
+obj-$(CONFIG_S5P_PM)		+= pm.o
+obj-$(CONFIG_S5P_PM)		+= irq-pm.o
 
 # devices
 
Signature · 1 line
1.6.6.1
#2 lore raw

PATCH 2/4 ARM: S5P64X0: Add Power Management support

In reply to Sangbeom Kim

From: Abhilash Kesavan <[email protected]>

Add suspend-to-ram support for SMDK6440/50

---
 arch/arm/mach-s5p64x0/Kconfig                   |    2 +
 arch/arm/mach-s5p64x0/Makefile                  |    1 +
 arch/arm/mach-s5p64x0/include/mach/map.h        |    1 +
 arch/arm/mach-s5p64x0/include/mach/pm-core.h    |   92 ++++++++++++
 arch/arm/mach-s5p64x0/include/mach/regs-clock.h |   31 ++++
 arch/arm/mach-s5p64x0/include/mach/regs-gpio.h  |   12 ++
 arch/arm/mach-s5p64x0/irq-pm.c                  |   93 ++++++++++++
 arch/arm/mach-s5p64x0/mach-smdk6440.c           |    4 +
 arch/arm/mach-s5p64x0/mach-smdk6450.c           |    4 +
 arch/arm/mach-s5p64x0/pm.c                      |  181 +++++++++++++++++++++++
 arch/arm/mach-s5p64x0/sleep.S                   |  129 ++++++++++++++++
 11 files changed, 550 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/mach-s5p64x0/include/mach/pm-core.h
 create mode 100644 arch/arm/mach-s5p64x0/irq-pm.c
 create mode 100644 arch/arm/mach-s5p64x0/pm.c
 create mode 100644 arch/arm/mach-s5p64x0/sleep.S
arch/arm/mach-s5p64x0/Kconfig +2 -0
index 164d278..f9532dd 100644
@@ -36,6 +36,7 @@ config MACH_SMDK6440
 	select SAMSUNG_DEV_ADC
 	select SAMSUNG_DEV_TS
 	select S5P64X0_SETUP_I2C1
+	select SAMSUNG_WAKEMASK if PM
 	help
 	  Machine support for the Samsung SMDK6440
 
@@ -49,6 +50,7 @@ config MACH_SMDK6450
 	select SAMSUNG_DEV_ADC
 	select SAMSUNG_DEV_TS
 	select S5P64X0_SETUP_I2C1
+	select SAMSUNG_WAKEMASK if PM
 	help
 	  Machine support for the Samsung SMDK6450
 
arch/arm/mach-s5p64x0/Makefile +1 -0
index 669f470..44b563c 100644
@@ -17,6 +17,7 @@ obj-$(CONFIG_ARCH_S5P64X0)	+= setup-i2c0.o
 obj-$(CONFIG_ARCH_S5P64X0)	+= irq-eint.o
 obj-$(CONFIG_CPU_S5P6440)	+= clock-s5p6440.o
 obj-$(CONFIG_CPU_S5P6450)	+= clock-s5p6450.o
+obj-$(CONFIG_PM)		+= pm.o sleep.o irq-pm.o
 
 # machine support
 
arch/arm/mach-s5p64x0/include/mach/map.h +1 -0
index 31e5341..c961025 100644
@@ -49,6 +49,7 @@
 #define S5P_PA_UART5		S5P6450_PA_UART(5)
 
 #define S5P_SZ_UART		SZ_256
+#define S3C_VA_UARTx(x)		(S3C_VA_UART + ((x) * S3C_UART_OFFSET))
 
 #define S5P6440_PA_IIC0		(0xEC104000)
 #define S5P6440_PA_IIC1		(0xEC20F000)
arch/arm/mach-s5p64x0/include/mach/pm-core.h new file +92 -0

92 lines not on this page · raw message

arch/arm/mach-s5p64x0/include/mach/regs-clock.h +31 -0
index a133f22..1d23f9a 100644
@@ -41,17 +41,48 @@
 #define S5P6450_DPLL_CON		S5P_CLKREG(0x50)
 #define S5P6450_DPLL_CON_K		S5P_CLKREG(0x54)
 
+#define S5P64X0_AHB_CON0		S5P_CLKREG(0x100)
 #define S5P64X0_CLK_SRC1		S5P_CLKREG(0x10C)
 
 #define S5P64X0_SYS_ID			S5P_CLKREG(0x118)
 #define S5P64X0_SYS_OTHERS		S5P_CLKREG(0x11C)
+#define S5P64X0_WAKEUP_STAT		S5P_CLKREG(0x908)
 
 #define S5P64X0_PWR_CFG			S5P_CLKREG(0x804)
+#define S5P64X0_EINT_WAKEUP_MASK	S5P_CLKREG(0x808)
+#define S5P64X0_SLEEP_CFG		S5P_CLKREG(0x818)
+#define S5P64X0_PWR_STABLE		S5P_CLKREG(0x828)
+
 #define S5P64X0_OTHERS			S5P_CLKREG(0x900)
+#define S5P64X0_INFORM0			S5P_CLKREG(0xA00)
 
 #define S5P64X0_CLKDIV0_HCLK_SHIFT	(8)
 #define S5P64X0_CLKDIV0_HCLK_MASK	(0xF << S5P64X0_CLKDIV0_HCLK_SHIFT)
 
+/* HCLK GATE Registers */
+#define S5P64X0_CLKCON_HCLK1_FIMGVG	(1<<2)
+#define S5P64X0_CLKCON_SCLK1_FIMGVG	(1<<2)
+
+/* PCLK GATE Registers */
+#define S5P64X0_CLKCON_PCLK_UART3	(1<<4)
+#define S5P64X0_CLKCON_PCLK_UART2	(1<<3)
+#define S5P64X0_CLKCON_PCLK_UART1	(1<<2)
+#define S5P64X0_CLKCON_PCLK_UART0	(1<<1)
+
+#define S5P64X0_PWRCFG_MMC1_DISABLE	(1 << 15)
+#define S5P64X0_PWRCFG_MMC0_DISABLE	(1 << 14)
+#define S5P64X0_PWRCFG_RTC_TICK_DISABLE	(1 << 11)
+#define S5P64X0_PWRCFG_RTC_ALRM_DISABLE	(1 << 10)
+#define S5P64X0_PWRCFG_CFG_WFI_MASK	(3 << 5)
+#define S5P64X0_PWRCFG_CFG_WFI_SLEEP	(3 << 5)
+
+#define S5P64X0_SLEEP_CFG_OSC_EN	(1 << 0)
+#define S5P64X0_PWR_STABLE_CNT_VAL_4	(4 << 0)
+
+#define S5P6450_OTHERS_DISABLE_INT	(1 << 31)
+#define S5P6450_OTHERS_RET_UART		(1 << 26)
+#define S5P6450_OTHERS_RET_MMC1		(1 << 25)
+#define S5P6450_OTHERS_RET_MMC0		(1 << 24)
 #define S5P64X0_OTHERS_USB_SIG_MASK	(1 << 16)
 
 /* Compatibility defines */
arch/arm/mach-s5p64x0/include/mach/regs-gpio.h +12 -0
index ce64863..eeb539d 100644
@@ -52,6 +52,18 @@
 #define S5P64X0_EINT12FLTCON		(S5P_VA_GPIO + 0x220)
 #define S5P64X0_EINT12MASK		(S5P_VA_GPIO + 0x240)
 
+#define S5P64X0_SPCON0			(S5P_VA_GPIO + 0x1A0)
+#define S5P64X0_SPCON1			(S5P_VA_GPIO + 0x2B0)
+
+#define S5P64X0_MEM0CONSLP0		(S5P_VA_GPIO + 0x1C0)
+#define S5P64X0_MEM0CONSLP1		(S5P_VA_GPIO + 0x1C4)
+#define S5P64X0_MEM0DRVCON		(S5P_VA_GPIO + 0x1D0)
+#define S5P64X0_MEM1DRVCON		(S5P_VA_GPIO + 0x1D4)
+
+#define S5P64X0_EINT12CON		(S5P_VA_GPIO + 0x200)
+#define S5P64X0_EINT12FLTCON		(S5P_VA_GPIO + 0x220)
+#define S5P64X0_EINT12MASK		(S5P_VA_GPIO + 0x240)
+
 /* for LCD */
 
 #define S5P64X0_SPCON_LCD_SEL_RGB	(1 << 0)
arch/arm/mach-s5p64x0/irq-pm.c new file +93 -0

93 lines not on this page · raw message

arch/arm/mach-s5p64x0/mach-smdk6440.c +4 -0
index 87c3f03..ddf1898 100644
@@ -22,6 +22,7 @@
 #include <linux/module.h>
 #include <linux/clk.h>
 #include <linux/gpio.h>
+#include <linux/sysdev.h>
 
 #include <asm/mach/arch.h>
 #include <asm/mach/map.h>
@@ -43,6 +44,7 @@
 #include <plat/pll.h>
 #include <plat/adc.h>
 #include <plat/ts.h>
+#include <plat/pm.h>
 
 #define SMDK6440_UCON_DEFAULT	(S3C2410_UCON_TXILEVEL |	\
 				S3C2410_UCON_RXILEVEL |		\
@@ -147,6 +149,8 @@ static void __init smdk6440_machine_init(void)
 	i2c_register_board_info(1, smdk6440_i2c_devs1,
 			ARRAY_SIZE(smdk6440_i2c_devs1));
 
+	s3c_pm_init();
+
 	platform_add_devices(smdk6440_devices, ARRAY_SIZE(smdk6440_devices));
 }
 
arch/arm/mach-s5p64x0/mach-smdk6450.c +4 -0
index d609f5a..969b6c3 100644
@@ -22,6 +22,7 @@
 #include <linux/module.h>
 #include <linux/clk.h>
 #include <linux/gpio.h>
+#include <linux/sysdev.h>
 
 #include <asm/mach/arch.h>
 #include <asm/mach/map.h>
@@ -43,6 +44,7 @@
 #include <plat/pll.h>
 #include <plat/adc.h>
 #include <plat/ts.h>
+#include <plat/pm.h>
 
 #define SMDK6450_UCON_DEFAULT	(S3C2410_UCON_TXILEVEL |	\
 				S3C2410_UCON_RXILEVEL |		\
@@ -166,6 +168,8 @@ static void __init smdk6450_machine_init(void)
 	i2c_register_board_info(1, smdk6450_i2c_devs1,
 			ARRAY_SIZE(smdk6450_i2c_devs1));
 
+	s3c_pm_init();
+
 	platform_add_devices(smdk6450_devices, ARRAY_SIZE(smdk6450_devices));
 }
 
arch/arm/mach-s5p64x0/pm.c new file +181 -0

181 lines not on this page · raw message

arch/arm/mach-s5p64x0/sleep.S new file +129 -0

129 lines not on this page · raw message

Signature · 1 line
1.6.6.1
#3 lore raw

PATCH 3/4 ARM: S5P64X0: Fix incorrect serial clock name

In reply to Sangbeom Kim

From: Abhilash Kesavan <[email protected]>

The 6400 serial glue driver needs the clock name to be pclk or uclk1. Correct the clock name in init.c to pclk and source pclk from pclk_low to get the correct rate.

---
 arch/arm/mach-s5p64x0/clock-s5p6440.c |    2 +-
 arch/arm/mach-s5p64x0/clock-s5p6450.c |    2 +-
 arch/arm/mach-s5p64x0/init.c          |    2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)
arch/arm/mach-s5p64x0/clock-s5p6440.c +1 -1
index e4883dc..90ac68d 100644
@@ -588,7 +588,7 @@ void __init_or_cpufreq s5p6440_setup_clocks(void)
 
 	clk_f.rate = fclk;
 	clk_h.rate = hclk;
-	clk_p.rate = pclk;
+	clk_p.rate = pclk_low;
 
 	for (ptr = 0; ptr < ARRAY_SIZE(clksrcs); ptr++)
 		s3c_set_clksrc(&clksrcs[ptr], true);
arch/arm/mach-s5p64x0/clock-s5p6450.c +1 -1
index 7dbf3c9..2026317 100644
@@ -625,7 +625,7 @@ void __init_or_cpufreq s5p6450_setup_clocks(void)
 
 	clk_f.rate = fclk;
 	clk_h.rate = hclk;
-	clk_p.rate = pclk;
+	clk_p.rate = pclk_low;
 
 	for (ptr = 0; ptr < ARRAY_SIZE(clksrcs); ptr++)
 		s3c_set_clksrc(&clksrcs[ptr], true);
arch/arm/mach-s5p64x0/init.c +1 -1
index 79833ca..ee25e28 100644
@@ -25,7 +25,7 @@
 
 static struct s3c24xx_uart_clksrc s5p64x0_serial_clocks[] = {
 	[0] = {
-		.name		= "pclk_low",
+		.name		= "pclk",
 		.divisor	= 1,
 		.min_baud	= 0,
 		.max_baud	= 0,
Signature · 1 line
1.6.6.1
#4 lore raw

PATCH 4/4 ARM: S5P64X0: Enable pm save/restore functions for GPIO banks

In reply to Sangbeom Kim

From: Abhilash Kesavan <[email protected]>

Fix the "no pm for GPIOXX" messages appearing during bootup due to the lack of save/restore functions for those GPIO banks.

---
 arch/arm/mach-s5p64x0/gpiolib.c |   14 ++++++++++++--
 1 files changed, 12 insertions(+), 2 deletions(-)
arch/arm/mach-s5p64x0/gpiolib.c +12 -2
index 072668a..9302d86 100644
@@ -460,6 +460,15 @@ void __init s5p64x0_gpiolib_set_cfg(struct s3c_gpio_cfg *chipcfg, int nr_chips)
 	}
 }
 
+static void __init s5p64x0_gpio_add_2bit(struct s3c_gpio_chip *chip,
+						int nr_chips)
+{
+	for (; nr_chips > 0; nr_chips--, chip++) {
+		chip->pm = __gpio_pm(&s3c_gpio_pm_2bit);
+		s3c_gpiolib_add(chip);
+	}
+}
+
 static void __init s5p64x0_gpio_add_rbank_4bit2(struct s3c_gpio_chip *chip,
 						int nr_chips)
 {
@@ -467,6 +476,7 @@ static void __init s5p64x0_gpio_add_rbank_4bit2(struct s3c_gpio_chip *chip,
 		chip->chip.direction_input = s5p64x0_gpiolib_rbank_4bit2_input;
 		chip->chip.direction_output =
 					s5p64x0_gpiolib_rbank_4bit2_output;
+		chip->pm = __gpio_pm(&s3c_gpio_pm_4bit);
 		s3c_gpiolib_add(chip);
 	}
 }
@@ -481,7 +491,7 @@ static int __init s5p64x0_gpiolib_init(void)
 				ARRAY_SIZE(s5p64x0_gpio_cfgs));
 
 	if ((chipid & 0xff000) == 0x50000) {
-		samsung_gpiolib_add_2bit_chips(s5p6450_gpio_2bit,
+		s5p64x0_gpio_add_2bit(s5p6450_gpio_2bit,
 					ARRAY_SIZE(s5p6450_gpio_2bit));
 
 		samsung_gpiolib_add_4bit_chips(s5p6450_gpio_4bit,
@@ -493,7 +503,7 @@ static int __init s5p64x0_gpiolib_init(void)
 		s5p64x0_gpio_add_rbank_4bit2(s5p6450_gpio_rbank_4bit2,
 					ARRAY_SIZE(s5p6450_gpio_rbank_4bit2));
 	} else {
-		samsung_gpiolib_add_2bit_chips(s5p6440_gpio_2bit,
+		s5p64x0_gpio_add_2bit(s5p6440_gpio_2bit,
 					ARRAY_SIZE(s5p6440_gpio_2bit));
 
 		samsung_gpiolib_add_4bit_chips(s5p6440_gpio_4bit,
Signature · 1 line
1.6.6.1