aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChanghwan Youn <chaos.youn@samsung.com>2010-12-03 03:15:40 -0500
committerKukjin Kim <kgene.kim@samsung.com>2010-12-29 19:37:02 -0500
commitd6d8b481999507a20012b7ee924bdaf5bfb52a05 (patch)
tree760ceb5112102e565af60c675ae610b9692e86b0
parenta50eb1c7680973f5441ca20ac4da0af2055d0d87 (diff)
ARM: S5PV310: Add support Power Domain
This patch adds support Power Domain for S5PV310 and S5PC210. Signed-off-by: Changhwan Youn <chaos.youn at samsung.com> Signed-off-by: Kukjin Kim <kgene.kim@samsung.com>
-rw-r--r--arch/arm/mach-s5pv310/Kconfig7
-rw-r--r--arch/arm/mach-s5pv310/Makefile3
-rw-r--r--arch/arm/mach-s5pv310/cpu.c5
-rw-r--r--arch/arm/mach-s5pv310/dev-pd.c139
-rw-r--r--arch/arm/mach-s5pv310/include/mach/map.h2
-rw-r--r--arch/arm/mach-s5pv310/include/mach/regs-pmu.h30
-rw-r--r--arch/arm/mach-s5pv310/mach-smdkc210.c8
-rw-r--r--arch/arm/mach-s5pv310/mach-smdkv310.c8
-rw-r--r--arch/arm/plat-s5p/include/plat/map-s5p.h1
-rw-r--r--arch/arm/plat-samsung/include/plat/devs.h2
10 files changed, 205 insertions, 0 deletions
diff --git a/arch/arm/mach-s5pv310/Kconfig b/arch/arm/mach-s5pv310/Kconfig
index 1150b360f38..3bf72a60bf5 100644
--- a/arch/arm/mach-s5pv310/Kconfig
+++ b/arch/arm/mach-s5pv310/Kconfig
@@ -14,6 +14,11 @@ config CPU_S5PV310
14 help 14 help
15 Enable S5PV310 CPU support 15 Enable S5PV310 CPU support
16 16
17config S5PV310_DEV_PD
18 bool
19 help
20 Compile in platform device definitions for Power Domain
21
17config S5PV310_SETUP_I2C1 22config S5PV310_SETUP_I2C1
18 bool 23 bool
19 help 24 help
@@ -73,6 +78,7 @@ config MACH_SMDKC210
73 select S3C_DEV_HSMMC1 78 select S3C_DEV_HSMMC1
74 select S3C_DEV_HSMMC2 79 select S3C_DEV_HSMMC2
75 select S3C_DEV_HSMMC3 80 select S3C_DEV_HSMMC3
81 select S5PV310_DEV_PD
76 select S5PV310_SETUP_SDHCI 82 select S5PV310_SETUP_SDHCI
77 help 83 help
78 Machine support for Samsung SMDKC210 84 Machine support for Samsung SMDKC210
@@ -101,6 +107,7 @@ config MACH_SMDKV310
101 select S3C_DEV_HSMMC1 107 select S3C_DEV_HSMMC1
102 select S3C_DEV_HSMMC2 108 select S3C_DEV_HSMMC2
103 select S3C_DEV_HSMMC3 109 select S3C_DEV_HSMMC3
110 select S5PV310_DEV_PD
104 select S5PV310_SETUP_SDHCI 111 select S5PV310_SETUP_SDHCI
105 help 112 help
106 Machine support for Samsung SMDKV310 113 Machine support for Samsung SMDKV310
diff --git a/arch/arm/mach-s5pv310/Makefile b/arch/arm/mach-s5pv310/Makefile
index 84afc64e7c0..e310609d626 100644
--- a/arch/arm/mach-s5pv310/Makefile
+++ b/arch/arm/mach-s5pv310/Makefile
@@ -27,6 +27,9 @@ obj-$(CONFIG_MACH_UNIVERSAL_C210) += mach-universal_c210.o
27 27
28# device support 28# device support
29 29
30obj-y += dev-audio.o
31obj-$(CONFIG_S5PV310_DEV_PD) += dev-pd.o
32
30obj-$(CONFIG_S5PV310_SETUP_I2C1) += setup-i2c1.o 33obj-$(CONFIG_S5PV310_SETUP_I2C1) += setup-i2c1.o
31obj-$(CONFIG_S5PV310_SETUP_I2C2) += setup-i2c2.o 34obj-$(CONFIG_S5PV310_SETUP_I2C2) += setup-i2c2.o
32obj-$(CONFIG_S5PV310_SETUP_I2C3) += setup-i2c3.o 35obj-$(CONFIG_S5PV310_SETUP_I2C3) += setup-i2c3.o
diff --git a/arch/arm/mach-s5pv310/cpu.c b/arch/arm/mach-s5pv310/cpu.c
index b2a37d0f9d7..7b6e066e227 100644
--- a/arch/arm/mach-s5pv310/cpu.c
+++ b/arch/arm/mach-s5pv310/cpu.c
@@ -43,6 +43,11 @@ static struct map_desc s5pv310_iodesc[] __initdata = {
43 .length = SZ_128K, 43 .length = SZ_128K,
44 .type = MT_DEVICE, 44 .type = MT_DEVICE,
45 }, { 45 }, {
46 .virtual = (unsigned long)S5P_VA_PMU,
47 .pfn = __phys_to_pfn(S5PV310_PA_PMU),
48 .length = SZ_64K,
49 .type = MT_DEVICE,
50 }, {
46 .virtual = (unsigned long)S5P_VA_COMBINER_BASE, 51 .virtual = (unsigned long)S5P_VA_COMBINER_BASE,
47 .pfn = __phys_to_pfn(S5PV310_PA_COMBINER), 52 .pfn = __phys_to_pfn(S5PV310_PA_COMBINER),
48 .length = SZ_4K, 53 .length = SZ_4K,
diff --git a/arch/arm/mach-s5pv310/dev-pd.c b/arch/arm/mach-s5pv310/dev-pd.c
new file mode 100644
index 00000000000..58a50c2d0b6
--- /dev/null
+++ b/arch/arm/mach-s5pv310/dev-pd.c
@@ -0,0 +1,139 @@
1/* linux/arch/arm/mach-s5pv310/dev-pd.c
2 *
3 * Copyright (c) 2010 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com
5 *
6 * S5PV310 - Power Domain support
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11*/
12
13#include <linux/io.h>
14#include <linux/kernel.h>
15#include <linux/platform_device.h>
16#include <linux/delay.h>
17
18#include <mach/regs-pmu.h>
19
20#include <plat/pd.h>
21
22static int s5pv310_pd_enable(struct device *dev)
23{
24 struct samsung_pd_info *pdata = dev->platform_data;
25 u32 timeout;
26
27 __raw_writel(S5P_INT_LOCAL_PWR_EN, pdata->base);
28
29 /* Wait max 1ms */
30 timeout = 10;
31 while ((__raw_readl(pdata->base + 0x4) & S5P_INT_LOCAL_PWR_EN)
32 != S5P_INT_LOCAL_PWR_EN) {
33 if (timeout == 0) {
34 printk(KERN_ERR "Power domain %s enable failed.\n",
35 dev_name(dev));
36 return -ETIMEDOUT;
37 }
38 timeout--;
39 udelay(100);
40 }
41
42 return 0;
43}
44
45static int s5pv310_pd_disable(struct device *dev)
46{
47 struct samsung_pd_info *pdata = dev->platform_data;
48 u32 timeout;
49
50 __raw_writel(0, pdata->base);
51
52 /* Wait max 1ms */
53 timeout = 10;
54 while (__raw_readl(pdata->base + 0x4) & S5P_INT_LOCAL_PWR_EN) {
55 if (timeout == 0) {
56 printk(KERN_ERR "Power domain %s disable failed.\n",
57 dev_name(dev));
58 return -ETIMEDOUT;
59 }
60 timeout--;
61 udelay(100);
62 }
63
64 return 0;
65}
66
67struct platform_device s5pv310_device_pd[] = {
68 {
69 .name = "samsung-pd",
70 .id = 0,
71 .dev = {
72 .platform_data = &(struct samsung_pd_info) {
73 .enable = s5pv310_pd_enable,
74 .disable = s5pv310_pd_disable,
75 .base = S5P_PMU_MFC_CONF,
76 },
77 },
78 }, {
79 .name = "samsung-pd",
80 .id = 1,
81 .dev = {
82 .platform_data = &(struct samsung_pd_info) {
83 .enable = s5pv310_pd_enable,
84 .disable = s5pv310_pd_disable,
85 .base = S5P_PMU_G3D_CONF,
86 },
87 },
88 }, {
89 .name = "samsung-pd",
90 .id = 2,
91 .dev = {
92 .platform_data = &(struct samsung_pd_info) {
93 .enable = s5pv310_pd_enable,
94 .disable = s5pv310_pd_disable,
95 .base = S5P_PMU_LCD0_CONF,
96 },
97 },
98 }, {
99 .name = "samsung-pd",
100 .id = 3,
101 .dev = {
102 .platform_data = &(struct samsung_pd_info) {
103 .enable = s5pv310_pd_enable,
104 .disable = s5pv310_pd_disable,
105 .base = S5P_PMU_LCD1_CONF,
106 },
107 },
108 }, {
109 .name = "samsung-pd",
110 .id = 4,
111 .dev = {
112 .platform_data = &(struct samsung_pd_info) {
113 .enable = s5pv310_pd_enable,
114 .disable = s5pv310_pd_disable,
115 .base = S5P_PMU_TV_CONF,
116 },
117 },
118 }, {
119 .name = "samsung-pd",
120 .id = 5,
121 .dev = {
122 .platform_data = &(struct samsung_pd_info) {
123 .enable = s5pv310_pd_enable,
124 .disable = s5pv310_pd_disable,
125 .base = S5P_PMU_CAM_CONF,
126 },
127 },
128 }, {
129 .name = "samsung-pd",
130 .id = 6,
131 .dev = {
132 .platform_data = &(struct samsung_pd_info) {
133 .enable = s5pv310_pd_enable,
134 .disable = s5pv310_pd_disable,
135 .base = S5P_PMU_GPS_CONF,
136 },
137 },
138 },
139};
diff --git a/arch/arm/mach-s5pv310/include/mach/map.h b/arch/arm/mach-s5pv310/include/mach/map.h
index 7acf4e77e92..a16d0c9c27b 100644
--- a/arch/arm/mach-s5pv310/include/mach/map.h
+++ b/arch/arm/mach-s5pv310/include/mach/map.h
@@ -39,6 +39,8 @@
39#define S5PV310_PA_SYSCON (0x10010000) 39#define S5PV310_PA_SYSCON (0x10010000)
40#define S5P_PA_SYSCON S5PV310_PA_SYSCON 40#define S5P_PA_SYSCON S5PV310_PA_SYSCON
41 41
42#define S5PV310_PA_PMU (0x10020000)
43
42#define S5PV310_PA_CMU (0x10030000) 44#define S5PV310_PA_CMU (0x10030000)
43 45
44#define S5PV310_PA_WATCHDOG (0x10060000) 46#define S5PV310_PA_WATCHDOG (0x10060000)
diff --git a/arch/arm/mach-s5pv310/include/mach/regs-pmu.h b/arch/arm/mach-s5pv310/include/mach/regs-pmu.h
new file mode 100644
index 00000000000..fb333d0f607
--- /dev/null
+++ b/arch/arm/mach-s5pv310/include/mach/regs-pmu.h
@@ -0,0 +1,30 @@
1/* linux/arch/arm/mach-s5pv310/include/mach/regs-pmu.h
2 *
3 * Copyright (c) 2010 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com
5 *
6 * S5PV310 - Power management unit definition
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11*/
12
13#ifndef __ASM_ARCH_REGS_PMU_H
14#define __ASM_ARCH_REGS_PMU_H __FILE__
15
16#include <mach/map.h>
17
18#define S5P_PMUREG(x) (S5P_VA_PMU + (x))
19
20#define S5P_PMU_CAM_CONF S5P_PMUREG(0x3C00)
21#define S5P_PMU_TV_CONF S5P_PMUREG(0x3C20)
22#define S5P_PMU_MFC_CONF S5P_PMUREG(0x3C40)
23#define S5P_PMU_G3D_CONF S5P_PMUREG(0x3C60)
24#define S5P_PMU_LCD0_CONF S5P_PMUREG(0x3C80)
25#define S5P_PMU_LCD1_CONF S5P_PMUREG(0x3CA0)
26#define S5P_PMU_GPS_CONF S5P_PMUREG(0x3CE0)
27
28#define S5P_INT_LOCAL_PWR_EN 0x7
29
30#endif /* __ASM_ARCH_REGS_PMU_H */
diff --git a/arch/arm/mach-s5pv310/mach-smdkc210.c b/arch/arm/mach-s5pv310/mach-smdkc210.c
index 2b8d4fc52d7..f65e668ceae 100644
--- a/arch/arm/mach-s5pv310/mach-smdkc210.c
+++ b/arch/arm/mach-s5pv310/mach-smdkc210.c
@@ -23,6 +23,7 @@
23#include <plat/cpu.h> 23#include <plat/cpu.h>
24#include <plat/devs.h> 24#include <plat/devs.h>
25#include <plat/sdhci.h> 25#include <plat/sdhci.h>
26#include <plat/pd.h>
26 27
27#include <mach/map.h> 28#include <mach/map.h>
28#include <mach/regs-srom.h> 29#include <mach/regs-srom.h>
@@ -147,6 +148,13 @@ static struct platform_device *smdkc210_devices[] __initdata = {
147 &s3c_device_rtc, 148 &s3c_device_rtc,
148 &s3c_device_wdt, 149 &s3c_device_wdt,
149 &smdkc210_smsc911x, 150 &smdkc210_smsc911x,
151 &s5pv310_device_pd[PD_MFC],
152 &s5pv310_device_pd[PD_G3D],
153 &s5pv310_device_pd[PD_LCD0],
154 &s5pv310_device_pd[PD_LCD1],
155 &s5pv310_device_pd[PD_CAM],
156 &s5pv310_device_pd[PD_TV],
157 &s5pv310_device_pd[PD_GPS],
150}; 158};
151 159
152static void __init smdkc210_smsc911x_init(void) 160static void __init smdkc210_smsc911x_init(void)
diff --git a/arch/arm/mach-s5pv310/mach-smdkv310.c b/arch/arm/mach-s5pv310/mach-smdkv310.c
index 35826d66632..19aa3e3c011 100644
--- a/arch/arm/mach-s5pv310/mach-smdkv310.c
+++ b/arch/arm/mach-s5pv310/mach-smdkv310.c
@@ -23,6 +23,7 @@
23#include <plat/cpu.h> 23#include <plat/cpu.h>
24#include <plat/devs.h> 24#include <plat/devs.h>
25#include <plat/sdhci.h> 25#include <plat/sdhci.h>
26#include <plat/pd.h>
26 27
27#include <mach/map.h> 28#include <mach/map.h>
28#include <mach/regs-srom.h> 29#include <mach/regs-srom.h>
@@ -147,6 +148,13 @@ static struct platform_device *smdkv310_devices[] __initdata = {
147 &s3c_device_rtc, 148 &s3c_device_rtc,
148 &s3c_device_wdt, 149 &s3c_device_wdt,
149 &smdkv310_smsc911x, 150 &smdkv310_smsc911x,
151 &s5pv310_device_pd[PD_MFC],
152 &s5pv310_device_pd[PD_G3D],
153 &s5pv310_device_pd[PD_LCD0],
154 &s5pv310_device_pd[PD_LCD1],
155 &s5pv310_device_pd[PD_CAM],
156 &s5pv310_device_pd[PD_TV],
157 &s5pv310_device_pd[PD_GPS],
150}; 158};
151 159
152static void __init smdkv310_smsc911x_init(void) 160static void __init smdkv310_smsc911x_init(void)
diff --git a/arch/arm/plat-s5p/include/plat/map-s5p.h b/arch/arm/plat-s5p/include/plat/map-s5p.h
index fef353d4451..d973d39666a 100644
--- a/arch/arm/plat-s5p/include/plat/map-s5p.h
+++ b/arch/arm/plat-s5p/include/plat/map-s5p.h
@@ -15,6 +15,7 @@
15 15
16#define S5P_VA_CHIPID S3C_ADDR(0x02000000) 16#define S5P_VA_CHIPID S3C_ADDR(0x02000000)
17#define S5P_VA_CMU S3C_ADDR(0x02100000) 17#define S5P_VA_CMU S3C_ADDR(0x02100000)
18#define S5P_VA_PMU S3C_ADDR(0x02180000)
18#define S5P_VA_GPIO S3C_ADDR(0x02200000) 19#define S5P_VA_GPIO S3C_ADDR(0x02200000)
19#define S5P_VA_GPIO1 S5P_VA_GPIO 20#define S5P_VA_GPIO1 S5P_VA_GPIO
20#define S5P_VA_GPIO2 S3C_ADDR(0x02240000) 21#define S5P_VA_GPIO2 S3C_ADDR(0x02240000)
diff --git a/arch/arm/plat-samsung/include/plat/devs.h b/arch/arm/plat-samsung/include/plat/devs.h
index 2d82a6cb144..4dad6e24e97 100644
--- a/arch/arm/plat-samsung/include/plat/devs.h
+++ b/arch/arm/plat-samsung/include/plat/devs.h
@@ -122,6 +122,8 @@ extern struct platform_device s5p_device_fimc0;
122extern struct platform_device s5p_device_fimc1; 122extern struct platform_device s5p_device_fimc1;
123extern struct platform_device s5p_device_fimc2; 123extern struct platform_device s5p_device_fimc2;
124 124
125extern struct platform_device s5pv310_device_pd[];
126
125/* s3c2440 specific devices */ 127/* s3c2440 specific devices */
126 128
127#ifdef CONFIG_CPU_S3C2440 129#ifdef CONFIG_CPU_S3C2440