aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/plat-samsung
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2011-01-15 15:33:40 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2011-01-15 15:33:40 -0500
commit16c1020362083b320868c0deef492249089c3cd3 (patch)
treeff200df3502e6010745713275d69fd0a07e399cf /arch/arm/plat-samsung
parent65e5d002b5ad220db2bf9557f53de5a98f7dab86 (diff)
parentbbba75606963c82febf7bd2761ea848ac5d1a1bb (diff)
Merge branch 'devel-stable' of master.kernel.org:/home/rmk/linux-2.6-arm
* 'devel-stable' of master.kernel.org:/home/rmk/linux-2.6-arm: (161 commits) ARM: pxa: fix building issue of missing physmap.h ARM: mmp: PXA910 drive strength FAST using wrong value ARM: mmp: MMP2 drive strength FAST using wrong value ARM: pxa: fix recursive calls in pxa_low_gpio_chip AT91: Support for gsia18s board AT91: Acme Systems FOX Board G20 board files AT91: board-sam9m10g45ek.c: Remove duplicate inclusion of mach/hardware.h ARM: pxa: fix suspend/resume array index miscalculation ARM: pxa: use cpu_has_ipr() consistently in irq.c ARM: pxa: remove unused variable in clock-pxa3xx.c ARM: pxa: fix warning in zeus.c ARM: sa1111: fix typo in sa1111_retrigger_lowirq() ARM mxs: clkdev related compile fixes ARM i.MX mx31_3ds: Fix MC13783 regulator names ARM: plat-stmp3xxx: irq_data conversion. ARM: plat-spear: irq_data conversion. ARM: plat-orion: irq_data conversion. ARM: plat-omap: irq_data conversion. ARM: plat-nomadik: irq_data conversion. ARM: plat-mxc: irq_data conversion. ... Fix up trivial conflict in arch/arm/plat-omap/gpio.c (Lennert Buytenhek's irq_data conversion clashing with some omap irq updates)
Diffstat (limited to 'arch/arm/plat-samsung')
-rw-r--r--arch/arm/plat-samsung/Kconfig14
-rw-r--r--arch/arm/plat-samsung/Makefile4
-rw-r--r--arch/arm/plat-samsung/clock.c92
-rw-r--r--arch/arm/plat-samsung/dev-nand.c2
-rw-r--r--arch/arm/plat-samsung/gpio-config.c42
-rw-r--r--arch/arm/plat-samsung/gpiolib.c7
-rw-r--r--arch/arm/plat-samsung/include/plat/clock.h3
-rw-r--r--arch/arm/plat-samsung/include/plat/devs.h8
-rw-r--r--arch/arm/plat-samsung/include/plat/gpio-cfg-helpers.h2
-rw-r--r--arch/arm/plat-samsung/include/plat/gpio-core.h2
-rw-r--r--arch/arm/plat-samsung/include/plat/pd.h30
-rw-r--r--arch/arm/plat-samsung/include/plat/pm.h4
-rw-r--r--arch/arm/plat-samsung/include/plat/sdhci.h35
-rw-r--r--arch/arm/plat-samsung/irq-uart.c40
-rw-r--r--arch/arm/plat-samsung/irq-vic-timer.c26
-rw-r--r--arch/arm/plat-samsung/pd.c95
-rw-r--r--arch/arm/plat-samsung/pm.c6
17 files changed, 374 insertions, 38 deletions
diff --git a/arch/arm/plat-samsung/Kconfig b/arch/arm/plat-samsung/Kconfig
index dcd6eff4ee53..32be05cf82a3 100644
--- a/arch/arm/plat-samsung/Kconfig
+++ b/arch/arm/plat-samsung/Kconfig
@@ -95,6 +95,12 @@ config S3C_GPIO_PULL_UPDOWN
95 help 95 help
96 Internal configuration to enable the correct GPIO pull helper 96 Internal configuration to enable the correct GPIO pull helper
97 97
98config S3C_GPIO_PULL_S3C2443
99 bool
100 select S3C_GPIO_PULL_UPDOWN
101 help
102 Internal configuration to enable the correct GPIO pull helper for S3C2443-style GPIO
103
98config S3C_GPIO_PULL_DOWN 104config S3C_GPIO_PULL_DOWN
99 bool 105 bool
100 help 106 help
@@ -333,4 +339,12 @@ config SAMSUNG_WAKEMASK
333 and above. This code allows a set of interrupt to wakeup-mask 339 and above. This code allows a set of interrupt to wakeup-mask
334 mappings. See <plat/wakeup-mask.h> 340 mappings. See <plat/wakeup-mask.h>
335 341
342comment "Power Domain"
343
344config SAMSUNG_PD
345 bool "Samsung Power Domain"
346 depends on PM_RUNTIME
347 help
348 Say Y here if you want to control Power Domain by Runtime PM.
349
336endif 350endif
diff --git a/arch/arm/plat-samsung/Makefile b/arch/arm/plat-samsung/Makefile
index 19d8a16c3066..29932f88a8d6 100644
--- a/arch/arm/plat-samsung/Makefile
+++ b/arch/arm/plat-samsung/Makefile
@@ -74,6 +74,10 @@ obj-$(CONFIG_SAMSUNG_PM_CHECK) += pm-check.o
74 74
75obj-$(CONFIG_SAMSUNG_WAKEMASK) += wakeup-mask.o 75obj-$(CONFIG_SAMSUNG_WAKEMASK) += wakeup-mask.o
76 76
77# PD support
78
79obj-$(CONFIG_SAMSUNG_PD) += pd.o
80
77# PWM support 81# PWM support
78 82
79obj-$(CONFIG_HAVE_PWM) += pwm.o 83obj-$(CONFIG_HAVE_PWM) += pwm.o
diff --git a/arch/arm/plat-samsung/clock.c b/arch/arm/plat-samsung/clock.c
index e8d20b0bc50e..772892826ffc 100644
--- a/arch/arm/plat-samsung/clock.c
+++ b/arch/arm/plat-samsung/clock.c
@@ -39,6 +39,9 @@
39#include <linux/clk.h> 39#include <linux/clk.h>
40#include <linux/spinlock.h> 40#include <linux/spinlock.h>
41#include <linux/io.h> 41#include <linux/io.h>
42#if defined(CONFIG_DEBUG_FS)
43#include <linux/debugfs.h>
44#endif
42 45
43#include <mach/hardware.h> 46#include <mach/hardware.h>
44#include <asm/irq.h> 47#include <asm/irq.h>
@@ -447,3 +450,92 @@ int __init s3c24xx_register_baseclocks(unsigned long xtal)
447 return 0; 450 return 0;
448} 451}
449 452
453#if defined(CONFIG_PM_DEBUG) && defined(CONFIG_DEBUG_FS)
454/* debugfs support to trace clock tree hierarchy and attributes */
455
456static struct dentry *clk_debugfs_root;
457
458static int clk_debugfs_register_one(struct clk *c)
459{
460 int err;
461 struct dentry *d, *child, *child_tmp;
462 struct clk *pa = c->parent;
463 char s[255];
464 char *p = s;
465
466 p += sprintf(p, "%s", c->name);
467
468 if (c->id >= 0)
469 sprintf(p, ":%d", c->id);
470
471 d = debugfs_create_dir(s, pa ? pa->dent : clk_debugfs_root);
472 if (!d)
473 return -ENOMEM;
474
475 c->dent = d;
476
477 d = debugfs_create_u8("usecount", S_IRUGO, c->dent, (u8 *)&c->usage);
478 if (!d) {
479 err = -ENOMEM;
480 goto err_out;
481 }
482
483 d = debugfs_create_u32("rate", S_IRUGO, c->dent, (u32 *)&c->rate);
484 if (!d) {
485 err = -ENOMEM;
486 goto err_out;
487 }
488 return 0;
489
490err_out:
491 d = c->dent;
492 list_for_each_entry_safe(child, child_tmp, &d->d_subdirs, d_u.d_child)
493 debugfs_remove(child);
494 debugfs_remove(c->dent);
495 return err;
496}
497
498static int clk_debugfs_register(struct clk *c)
499{
500 int err;
501 struct clk *pa = c->parent;
502
503 if (pa && !pa->dent) {
504 err = clk_debugfs_register(pa);
505 if (err)
506 return err;
507 }
508
509 if (!c->dent) {
510 err = clk_debugfs_register_one(c);
511 if (err)
512 return err;
513 }
514 return 0;
515}
516
517static int __init clk_debugfs_init(void)
518{
519 struct clk *c;
520 struct dentry *d;
521 int err;
522
523 d = debugfs_create_dir("clock", NULL);
524 if (!d)
525 return -ENOMEM;
526 clk_debugfs_root = d;
527
528 list_for_each_entry(c, &clocks, list) {
529 err = clk_debugfs_register(c);
530 if (err)
531 goto err_out;
532 }
533 return 0;
534
535err_out:
536 debugfs_remove_recursive(clk_debugfs_root);
537 return err;
538}
539late_initcall(clk_debugfs_init);
540
541#endif /* defined(CONFIG_PM_DEBUG) && defined(CONFIG_DEBUG_FS) */
diff --git a/arch/arm/plat-samsung/dev-nand.c b/arch/arm/plat-samsung/dev-nand.c
index 3a7b8891ba4f..6927ae8fd118 100644
--- a/arch/arm/plat-samsung/dev-nand.c
+++ b/arch/arm/plat-samsung/dev-nand.c
@@ -126,5 +126,3 @@ void __init s3c_nand_set_platdata(struct s3c2410_platform_nand *nand)
126 126
127 s3c_device_nand.dev.platform_data = npd; 127 s3c_device_nand.dev.platform_data = npd;
128} 128}
129
130EXPORT_SYMBOL_GPL(s3c_nand_set_platdata);
diff --git a/arch/arm/plat-samsung/gpio-config.c b/arch/arm/plat-samsung/gpio-config.c
index 0aa32f242ee4..1c0b0401594b 100644
--- a/arch/arm/plat-samsung/gpio-config.c
+++ b/arch/arm/plat-samsung/gpio-config.c
@@ -278,6 +278,48 @@ s3c_gpio_pull_t s3c_gpio_getpull_updown(struct s3c_gpio_chip *chip,
278 pup &= 0x3; 278 pup &= 0x3;
279 return (__force s3c_gpio_pull_t)pup; 279 return (__force s3c_gpio_pull_t)pup;
280} 280}
281
282#ifdef CONFIG_S3C_GPIO_PULL_S3C2443
283int s3c_gpio_setpull_s3c2443(struct s3c_gpio_chip *chip,
284 unsigned int off, s3c_gpio_pull_t pull)
285{
286 switch (pull) {
287 case S3C_GPIO_PULL_NONE:
288 pull = 0x01;
289 break;
290 case S3C_GPIO_PULL_UP:
291 pull = 0x00;
292 break;
293 case S3C_GPIO_PULL_DOWN:
294 pull = 0x02;
295 break;
296 }
297 return s3c_gpio_setpull_updown(chip, off, pull);
298}
299
300s3c_gpio_pull_t s3c_gpio_getpull_s3c2443(struct s3c_gpio_chip *chip,
301 unsigned int off)
302{
303 s3c_gpio_pull_t pull;
304
305 pull = s3c_gpio_getpull_updown(chip, off);
306
307 switch (pull) {
308 case 0x00:
309 pull = S3C_GPIO_PULL_UP;
310 break;
311 case 0x01:
312 case 0x03:
313 pull = S3C_GPIO_PULL_NONE;
314 break;
315 case 0x02:
316 pull = S3C_GPIO_PULL_DOWN;
317 break;
318 }
319
320 return pull;
321}
322#endif
281#endif 323#endif
282 324
283#if defined(CONFIG_S3C_GPIO_PULL_UP) || defined(CONFIG_S3C_GPIO_PULL_DOWN) 325#if defined(CONFIG_S3C_GPIO_PULL_UP) || defined(CONFIG_S3C_GPIO_PULL_DOWN)
diff --git a/arch/arm/plat-samsung/gpiolib.c b/arch/arm/plat-samsung/gpiolib.c
index c354089254fc..ea37c0461788 100644
--- a/arch/arm/plat-samsung/gpiolib.c
+++ b/arch/arm/plat-samsung/gpiolib.c
@@ -197,3 +197,10 @@ void __init samsung_gpiolib_add_4bit2_chips(struct s3c_gpio_chip *chip,
197 s3c_gpiolib_add(chip); 197 s3c_gpiolib_add(chip);
198 } 198 }
199} 199}
200
201void __init samsung_gpiolib_add_2bit_chips(struct s3c_gpio_chip *chip,
202 int nr_chips)
203{
204 for (; nr_chips > 0; nr_chips--, chip++)
205 s3c_gpiolib_add(chip);
206}
diff --git a/arch/arm/plat-samsung/include/plat/clock.h b/arch/arm/plat-samsung/include/plat/clock.h
index 0fbcd0effd8e..9a82b8874918 100644
--- a/arch/arm/plat-samsung/include/plat/clock.h
+++ b/arch/arm/plat-samsung/include/plat/clock.h
@@ -47,6 +47,9 @@ struct clk {
47 47
48 struct clk_ops *ops; 48 struct clk_ops *ops;
49 int (*enable)(struct clk *, int enable); 49 int (*enable)(struct clk *, int enable);
50#if defined(CONFIG_PM_DEBUG) && defined(CONFIG_DEBUG_FS)
51 struct dentry *dent; /* For visible tree hierarchy */
52#endif
50}; 53};
51 54
52/* other clocks which may be registered by board support */ 55/* other clocks which may be registered by board support */
diff --git a/arch/arm/plat-samsung/include/plat/devs.h b/arch/arm/plat-samsung/include/plat/devs.h
index e9e3b6e3ec74..b4d208b42957 100644
--- a/arch/arm/plat-samsung/include/plat/devs.h
+++ b/arch/arm/plat-samsung/include/plat/devs.h
@@ -104,6 +104,7 @@ extern struct platform_device s5pv310_device_i2s0;
104extern struct platform_device s5pv310_device_i2s1; 104extern struct platform_device s5pv310_device_i2s1;
105extern struct platform_device s5pv310_device_i2s2; 105extern struct platform_device s5pv310_device_i2s2;
106extern struct platform_device s5pv310_device_spdif; 106extern struct platform_device s5pv310_device_spdif;
107extern struct platform_device s5pv310_device_pd[];
107 108
108extern struct platform_device s5p6442_device_pcm0; 109extern struct platform_device s5p6442_device_pcm0;
109extern struct platform_device s5p6442_device_pcm1; 110extern struct platform_device s5p6442_device_pcm1;
@@ -115,6 +116,8 @@ extern struct platform_device s5p6440_device_pcm;
115extern struct platform_device s5p6440_device_iis; 116extern struct platform_device s5p6440_device_iis;
116 117
117extern struct platform_device s5p6450_device_iis0; 118extern struct platform_device s5p6450_device_iis0;
119extern struct platform_device s5p6450_device_iis1;
120extern struct platform_device s5p6450_device_iis2;
118extern struct platform_device s5p6450_device_pcm0; 121extern struct platform_device s5p6450_device_pcm0;
119 122
120extern struct platform_device s5pc100_device_ac97; 123extern struct platform_device s5pc100_device_ac97;
@@ -131,6 +134,11 @@ extern struct platform_device s5p_device_fimc0;
131extern struct platform_device s5p_device_fimc1; 134extern struct platform_device s5p_device_fimc1;
132extern struct platform_device s5p_device_fimc2; 135extern struct platform_device s5p_device_fimc2;
133 136
137extern struct platform_device s5p_device_mipi_csis0;
138extern struct platform_device s5p_device_mipi_csis1;
139
140extern struct platform_device s5pv310_device_sysmmu;
141
134/* s3c2440 specific devices */ 142/* s3c2440 specific devices */
135 143
136#ifdef CONFIG_CPU_S3C2440 144#ifdef CONFIG_CPU_S3C2440
diff --git a/arch/arm/plat-samsung/include/plat/gpio-cfg-helpers.h b/arch/arm/plat-samsung/include/plat/gpio-cfg-helpers.h
index 0d2c5703f1ee..5603db0b79bc 100644
--- a/arch/arm/plat-samsung/include/plat/gpio-cfg-helpers.h
+++ b/arch/arm/plat-samsung/include/plat/gpio-cfg-helpers.h
@@ -244,7 +244,7 @@ extern int s3c_gpio_setpull_s3c2443(struct s3c_gpio_chip *chip,
244 * This helper function reads the state of the pull-{up,down} resistor for the 244 * This helper function reads the state of the pull-{up,down} resistor for the
245 * given GPIO in the same case as s3c_gpio_setpull_upown. 245 * given GPIO in the same case as s3c_gpio_setpull_upown.
246*/ 246*/
247extern s3c_gpio_pull_t s3c_gpio_getpull_s3c24xx(struct s3c_gpio_chip *chip, 247extern s3c_gpio_pull_t s3c_gpio_getpull_s3c2443(struct s3c_gpio_chip *chip,
248 unsigned int off); 248 unsigned int off);
249 249
250#endif /* __PLAT_GPIO_CFG_HELPERS_H */ 250#endif /* __PLAT_GPIO_CFG_HELPERS_H */
diff --git a/arch/arm/plat-samsung/include/plat/gpio-core.h b/arch/arm/plat-samsung/include/plat/gpio-core.h
index 13a22b8861ef..dac35d0a711d 100644
--- a/arch/arm/plat-samsung/include/plat/gpio-core.h
+++ b/arch/arm/plat-samsung/include/plat/gpio-core.h
@@ -118,6 +118,8 @@ extern void samsung_gpiolib_add_4bit_chips(struct s3c_gpio_chip *chip,
118 int nr_chips); 118 int nr_chips);
119extern void samsung_gpiolib_add_4bit2_chips(struct s3c_gpio_chip *chip, 119extern void samsung_gpiolib_add_4bit2_chips(struct s3c_gpio_chip *chip,
120 int nr_chips); 120 int nr_chips);
121extern void samsung_gpiolib_add_2bit_chips(struct s3c_gpio_chip *chip,
122 int nr_chips);
121 123
122extern void samsung_gpiolib_add_4bit(struct s3c_gpio_chip *chip); 124extern void samsung_gpiolib_add_4bit(struct s3c_gpio_chip *chip);
123extern void samsung_gpiolib_add_4bit2(struct s3c_gpio_chip *chip); 125extern void samsung_gpiolib_add_4bit2(struct s3c_gpio_chip *chip);
diff --git a/arch/arm/plat-samsung/include/plat/pd.h b/arch/arm/plat-samsung/include/plat/pd.h
new file mode 100644
index 000000000000..5f0ad85783db
--- /dev/null
+++ b/arch/arm/plat-samsung/include/plat/pd.h
@@ -0,0 +1,30 @@
1/* linux/arch/arm/plat-samsung/include/plat/pd.h
2 *
3 * Copyright (c) 2010 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9*/
10
11#ifndef __ASM_PLAT_SAMSUNG_PD_H
12#define __ASM_PLAT_SAMSUNG_PD_H __FILE__
13
14struct samsung_pd_info {
15 int (*enable)(struct device *dev);
16 int (*disable)(struct device *dev);
17 void __iomem *base;
18};
19
20enum s5pv310_pd_block {
21 PD_MFC,
22 PD_G3D,
23 PD_LCD0,
24 PD_LCD1,
25 PD_TV,
26 PD_CAM,
27 PD_GPS
28};
29
30#endif /* __ASM_PLAT_SAMSUNG_PD_H */
diff --git a/arch/arm/plat-samsung/include/plat/pm.h b/arch/arm/plat-samsung/include/plat/pm.h
index 245836d91931..d9025e377675 100644
--- a/arch/arm/plat-samsung/include/plat/pm.h
+++ b/arch/arm/plat-samsung/include/plat/pm.h
@@ -15,6 +15,8 @@
15 * management 15 * management
16*/ 16*/
17 17
18#include <linux/irq.h>
19
18#ifdef CONFIG_PM 20#ifdef CONFIG_PM
19 21
20extern __init int s3c_pm_init(void); 22extern __init int s3c_pm_init(void);
@@ -100,7 +102,7 @@ extern void s3c_pm_do_restore(struct sleep_save *ptr, int count);
100extern void s3c_pm_do_restore_core(struct sleep_save *ptr, int count); 102extern void s3c_pm_do_restore_core(struct sleep_save *ptr, int count);
101 103
102#ifdef CONFIG_PM 104#ifdef CONFIG_PM
103extern int s3c_irqext_wake(unsigned int irqno, unsigned int state); 105extern int s3c_irqext_wake(struct irq_data *data, unsigned int state);
104extern int s3c24xx_irq_suspend(struct sys_device *dev, pm_message_t state); 106extern int s3c24xx_irq_suspend(struct sys_device *dev, pm_message_t state);
105extern int s3c24xx_irq_resume(struct sys_device *dev); 107extern int s3c24xx_irq_resume(struct sys_device *dev);
106#else 108#else
diff --git a/arch/arm/plat-samsung/include/plat/sdhci.h b/arch/arm/plat-samsung/include/plat/sdhci.h
index 85853f8c4c5d..5a41a0b69eec 100644
--- a/arch/arm/plat-samsung/include/plat/sdhci.h
+++ b/arch/arm/plat-samsung/include/plat/sdhci.h
@@ -107,6 +107,8 @@ extern struct s3c_sdhci_platdata s3c_hsmmc3_def_platdata;
107 107
108/* Helper function availablity */ 108/* Helper function availablity */
109 109
110extern void s3c2416_setup_sdhci0_cfg_gpio(struct platform_device *, int w);
111extern void s3c2416_setup_sdhci1_cfg_gpio(struct platform_device *, int w);
110extern void s3c64xx_setup_sdhci0_cfg_gpio(struct platform_device *, int w); 112extern void s3c64xx_setup_sdhci0_cfg_gpio(struct platform_device *, int w);
111extern void s3c64xx_setup_sdhci1_cfg_gpio(struct platform_device *, int w); 113extern void s3c64xx_setup_sdhci1_cfg_gpio(struct platform_device *, int w);
112extern void s5pc100_setup_sdhci0_cfg_gpio(struct platform_device *, int w); 114extern void s5pc100_setup_sdhci0_cfg_gpio(struct platform_device *, int w);
@@ -122,6 +124,39 @@ extern void s5pv310_setup_sdhci1_cfg_gpio(struct platform_device *, int w);
122extern void s5pv310_setup_sdhci2_cfg_gpio(struct platform_device *, int w); 124extern void s5pv310_setup_sdhci2_cfg_gpio(struct platform_device *, int w);
123extern void s5pv310_setup_sdhci3_cfg_gpio(struct platform_device *, int w); 125extern void s5pv310_setup_sdhci3_cfg_gpio(struct platform_device *, int w);
124 126
127/* S3C2416 SDHCI setup */
128
129#ifdef CONFIG_S3C2416_SETUP_SDHCI
130extern char *s3c2416_hsmmc_clksrcs[4];
131
132extern void s3c2416_setup_sdhci_cfg_card(struct platform_device *dev,
133 void __iomem *r,
134 struct mmc_ios *ios,
135 struct mmc_card *card);
136
137static inline void s3c2416_default_sdhci0(void)
138{
139#ifdef CONFIG_S3C_DEV_HSMMC
140 s3c_hsmmc0_def_platdata.clocks = s3c2416_hsmmc_clksrcs;
141 s3c_hsmmc0_def_platdata.cfg_gpio = s3c2416_setup_sdhci0_cfg_gpio;
142 s3c_hsmmc0_def_platdata.cfg_card = s3c2416_setup_sdhci_cfg_card;
143#endif /* CONFIG_S3C_DEV_HSMMC */
144}
145
146static inline void s3c2416_default_sdhci1(void)
147{
148#ifdef CONFIG_S3C_DEV_HSMMC1
149 s3c_hsmmc1_def_platdata.clocks = s3c2416_hsmmc_clksrcs;
150 s3c_hsmmc1_def_platdata.cfg_gpio = s3c2416_setup_sdhci1_cfg_gpio;
151 s3c_hsmmc1_def_platdata.cfg_card = s3c2416_setup_sdhci_cfg_card;
152#endif /* CONFIG_S3C_DEV_HSMMC1 */
153}
154
155#else
156static inline void s3c2416_default_sdhci0(void) { }
157static inline void s3c2416_default_sdhci1(void) { }
158
159#endif /* CONFIG_S3C2416_SETUP_SDHCI */
125/* S3C64XX SDHCI setup */ 160/* S3C64XX SDHCI setup */
126 161
127#ifdef CONFIG_S3C64XX_SETUP_SDHCI 162#ifdef CONFIG_S3C64XX_SETUP_SDHCI
diff --git a/arch/arm/plat-samsung/irq-uart.c b/arch/arm/plat-samsung/irq-uart.c
index 4f8c102674ae..4e770355ccbc 100644
--- a/arch/arm/plat-samsung/irq-uart.c
+++ b/arch/arm/plat-samsung/irq-uart.c
@@ -28,9 +28,9 @@
28 * are consecutive when looking up the interrupt in the demux routines. 28 * are consecutive when looking up the interrupt in the demux routines.
29 */ 29 */
30 30
31static inline void __iomem *s3c_irq_uart_base(unsigned int irq) 31static inline void __iomem *s3c_irq_uart_base(struct irq_data *data)
32{ 32{
33 struct s3c_uart_irq *uirq = get_irq_chip_data(irq); 33 struct s3c_uart_irq *uirq = irq_data_get_irq_chip_data(data);
34 return uirq->regs; 34 return uirq->regs;
35} 35}
36 36
@@ -39,10 +39,10 @@ static inline unsigned int s3c_irq_uart_bit(unsigned int irq)
39 return irq & 3; 39 return irq & 3;
40} 40}
41 41
42static void s3c_irq_uart_mask(unsigned int irq) 42static void s3c_irq_uart_mask(struct irq_data *data)
43{ 43{
44 void __iomem *regs = s3c_irq_uart_base(irq); 44 void __iomem *regs = s3c_irq_uart_base(data);
45 unsigned int bit = s3c_irq_uart_bit(irq); 45 unsigned int bit = s3c_irq_uart_bit(data->irq);
46 u32 reg; 46 u32 reg;
47 47
48 reg = __raw_readl(regs + S3C64XX_UINTM); 48 reg = __raw_readl(regs + S3C64XX_UINTM);
@@ -50,10 +50,10 @@ static void s3c_irq_uart_mask(unsigned int irq)
50 __raw_writel(reg, regs + S3C64XX_UINTM); 50 __raw_writel(reg, regs + S3C64XX_UINTM);
51} 51}
52 52
53static void s3c_irq_uart_maskack(unsigned int irq) 53static void s3c_irq_uart_maskack(struct irq_data *data)
54{ 54{
55 void __iomem *regs = s3c_irq_uart_base(irq); 55 void __iomem *regs = s3c_irq_uart_base(data);
56 unsigned int bit = s3c_irq_uart_bit(irq); 56 unsigned int bit = s3c_irq_uart_bit(data->irq);
57 u32 reg; 57 u32 reg;
58 58
59 reg = __raw_readl(regs + S3C64XX_UINTM); 59 reg = __raw_readl(regs + S3C64XX_UINTM);
@@ -62,10 +62,10 @@ static void s3c_irq_uart_maskack(unsigned int irq)
62 __raw_writel(1 << bit, regs + S3C64XX_UINTP); 62 __raw_writel(1 << bit, regs + S3C64XX_UINTP);
63} 63}
64 64
65static void s3c_irq_uart_unmask(unsigned int irq) 65static void s3c_irq_uart_unmask(struct irq_data *data)
66{ 66{
67 void __iomem *regs = s3c_irq_uart_base(irq); 67 void __iomem *regs = s3c_irq_uart_base(data);
68 unsigned int bit = s3c_irq_uart_bit(irq); 68 unsigned int bit = s3c_irq_uart_bit(data->irq);
69 u32 reg; 69 u32 reg;
70 70
71 reg = __raw_readl(regs + S3C64XX_UINTM); 71 reg = __raw_readl(regs + S3C64XX_UINTM);
@@ -73,17 +73,17 @@ static void s3c_irq_uart_unmask(unsigned int irq)
73 __raw_writel(reg, regs + S3C64XX_UINTM); 73 __raw_writel(reg, regs + S3C64XX_UINTM);
74} 74}
75 75
76static void s3c_irq_uart_ack(unsigned int irq) 76static void s3c_irq_uart_ack(struct irq_data *data)
77{ 77{
78 void __iomem *regs = s3c_irq_uart_base(irq); 78 void __iomem *regs = s3c_irq_uart_base(data);
79 unsigned int bit = s3c_irq_uart_bit(irq); 79 unsigned int bit = s3c_irq_uart_bit(data->irq);
80 80
81 __raw_writel(1 << bit, regs + S3C64XX_UINTP); 81 __raw_writel(1 << bit, regs + S3C64XX_UINTP);
82} 82}
83 83
84static void s3c_irq_demux_uart(unsigned int irq, struct irq_desc *desc) 84static void s3c_irq_demux_uart(unsigned int irq, struct irq_desc *desc)
85{ 85{
86 struct s3c_uart_irq *uirq = desc->handler_data; 86 struct s3c_uart_irq *uirq = desc->irq_data.handler_data;
87 u32 pend = __raw_readl(uirq->regs + S3C64XX_UINTP); 87 u32 pend = __raw_readl(uirq->regs + S3C64XX_UINTP);
88 int base = uirq->base_irq; 88 int base = uirq->base_irq;
89 89
@@ -99,10 +99,10 @@ static void s3c_irq_demux_uart(unsigned int irq, struct irq_desc *desc)
99 99
100static struct irq_chip s3c_irq_uart = { 100static struct irq_chip s3c_irq_uart = {
101 .name = "s3c-uart", 101 .name = "s3c-uart",
102 .mask = s3c_irq_uart_mask, 102 .irq_mask = s3c_irq_uart_mask,
103 .unmask = s3c_irq_uart_unmask, 103 .irq_unmask = s3c_irq_uart_unmask,
104 .mask_ack = s3c_irq_uart_maskack, 104 .irq_mask_ack = s3c_irq_uart_maskack,
105 .ack = s3c_irq_uart_ack, 105 .irq_ack = s3c_irq_uart_ack,
106}; 106};
107 107
108static void __init s3c_init_uart_irq(struct s3c_uart_irq *uirq) 108static void __init s3c_init_uart_irq(struct s3c_uart_irq *uirq)
@@ -124,7 +124,7 @@ static void __init s3c_init_uart_irq(struct s3c_uart_irq *uirq)
124 set_irq_flags(irq, IRQF_VALID); 124 set_irq_flags(irq, IRQF_VALID);
125 } 125 }
126 126
127 desc->handler_data = uirq; 127 desc->irq_data.handler_data = uirq;
128 set_irq_chained_handler(uirq->parent_irq, s3c_irq_demux_uart); 128 set_irq_chained_handler(uirq->parent_irq, s3c_irq_demux_uart);
129} 129}
130 130
diff --git a/arch/arm/plat-samsung/irq-vic-timer.c b/arch/arm/plat-samsung/irq-vic-timer.c
index 0270519fcabc..dd8692ae5c4c 100644
--- a/arch/arm/plat-samsung/irq-vic-timer.c
+++ b/arch/arm/plat-samsung/irq-vic-timer.c
@@ -24,43 +24,46 @@
24 24
25static void s3c_irq_demux_vic_timer(unsigned int irq, struct irq_desc *desc) 25static void s3c_irq_demux_vic_timer(unsigned int irq, struct irq_desc *desc)
26{ 26{
27 generic_handle_irq((int)desc->handler_data); 27 generic_handle_irq((int)desc->irq_data.handler_data);
28} 28}
29 29
30/* We assume the IRQ_TIMER0..IRQ_TIMER4 range is continuous. */ 30/* We assume the IRQ_TIMER0..IRQ_TIMER4 range is continuous. */
31 31
32static void s3c_irq_timer_mask(unsigned int irq) 32static void s3c_irq_timer_mask(struct irq_data *data)
33{ 33{
34 u32 reg = __raw_readl(S3C64XX_TINT_CSTAT); 34 u32 reg = __raw_readl(S3C64XX_TINT_CSTAT);
35 u32 mask = (u32)data->chip_data;
35 36
36 reg &= 0x1f; /* mask out pending interrupts */ 37 reg &= 0x1f; /* mask out pending interrupts */
37 reg &= ~(1 << (irq - IRQ_TIMER0)); 38 reg &= ~mask;
38 __raw_writel(reg, S3C64XX_TINT_CSTAT); 39 __raw_writel(reg, S3C64XX_TINT_CSTAT);
39} 40}
40 41
41static void s3c_irq_timer_unmask(unsigned int irq) 42static void s3c_irq_timer_unmask(struct irq_data *data)
42{ 43{
43 u32 reg = __raw_readl(S3C64XX_TINT_CSTAT); 44 u32 reg = __raw_readl(S3C64XX_TINT_CSTAT);
45 u32 mask = (u32)data->chip_data;
44 46
45 reg &= 0x1f; /* mask out pending interrupts */ 47 reg &= 0x1f; /* mask out pending interrupts */
46 reg |= 1 << (irq - IRQ_TIMER0); 48 reg |= mask;
47 __raw_writel(reg, S3C64XX_TINT_CSTAT); 49 __raw_writel(reg, S3C64XX_TINT_CSTAT);
48} 50}
49 51
50static void s3c_irq_timer_ack(unsigned int irq) 52static void s3c_irq_timer_ack(struct irq_data *data)
51{ 53{
52 u32 reg = __raw_readl(S3C64XX_TINT_CSTAT); 54 u32 reg = __raw_readl(S3C64XX_TINT_CSTAT);
55 u32 mask = (u32)data->chip_data;
53 56
54 reg &= 0x1f; 57 reg &= 0x1f;
55 reg |= (1 << 5) << (irq - IRQ_TIMER0); 58 reg |= mask << 5;
56 __raw_writel(reg, S3C64XX_TINT_CSTAT); 59 __raw_writel(reg, S3C64XX_TINT_CSTAT);
57} 60}
58 61
59static struct irq_chip s3c_irq_timer = { 62static struct irq_chip s3c_irq_timer = {
60 .name = "s3c-timer", 63 .name = "s3c-timer",
61 .mask = s3c_irq_timer_mask, 64 .irq_mask = s3c_irq_timer_mask,
62 .unmask = s3c_irq_timer_unmask, 65 .irq_unmask = s3c_irq_timer_unmask,
63 .ack = s3c_irq_timer_ack, 66 .irq_ack = s3c_irq_timer_ack,
64}; 67};
65 68
66/** 69/**
@@ -79,8 +82,9 @@ void __init s3c_init_vic_timer_irq(unsigned int parent_irq,
79 set_irq_chained_handler(parent_irq, s3c_irq_demux_vic_timer); 82 set_irq_chained_handler(parent_irq, s3c_irq_demux_vic_timer);
80 83
81 set_irq_chip(timer_irq, &s3c_irq_timer); 84 set_irq_chip(timer_irq, &s3c_irq_timer);
85 set_irq_chip_data(timer_irq, (void *)(1 << (timer_irq - IRQ_TIMER0)));
82 set_irq_handler(timer_irq, handle_level_irq); 86 set_irq_handler(timer_irq, handle_level_irq);
83 set_irq_flags(timer_irq, IRQF_VALID); 87 set_irq_flags(timer_irq, IRQF_VALID);
84 88
85 desc->handler_data = (void *)timer_irq; 89 desc->irq_data.handler_data = (void *)timer_irq;
86} 90}
diff --git a/arch/arm/plat-samsung/pd.c b/arch/arm/plat-samsung/pd.c
new file mode 100644
index 000000000000..efe1d564473e
--- /dev/null
+++ b/arch/arm/plat-samsung/pd.c
@@ -0,0 +1,95 @@
1/* linux/arch/arm/plat-samsung/pd.c
2 *
3 * Copyright (c) 2010 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com
5 *
6 * Samsung 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/init.h>
14#include <linux/module.h>
15#include <linux/platform_device.h>
16#include <linux/err.h>
17#include <linux/pm_runtime.h>
18
19#include <plat/pd.h>
20
21static int samsung_pd_probe(struct platform_device *pdev)
22{
23 struct samsung_pd_info *pdata = pdev->dev.platform_data;
24 struct device *dev = &pdev->dev;
25
26 if (!pdata) {
27 dev_err(dev, "no device data specified\n");
28 return -ENOENT;
29 }
30
31 pm_runtime_set_active(dev);
32 pm_runtime_enable(dev);
33
34 dev_info(dev, "power domain registered\n");
35 return 0;
36}
37
38static int __devexit samsung_pd_remove(struct platform_device *pdev)
39{
40 struct device *dev = &pdev->dev;
41
42 pm_runtime_disable(dev);
43 return 0;
44}
45
46static int samsung_pd_runtime_suspend(struct device *dev)
47{
48 struct samsung_pd_info *pdata = dev->platform_data;
49 int ret = 0;
50
51 if (pdata->disable)
52 ret = pdata->disable(dev);
53
54 dev_dbg(dev, "suspended\n");
55 return ret;
56}
57
58static int samsung_pd_runtime_resume(struct device *dev)
59{
60 struct samsung_pd_info *pdata = dev->platform_data;
61 int ret = 0;
62
63 if (pdata->enable)
64 ret = pdata->enable(dev);
65
66 dev_dbg(dev, "resumed\n");
67 return ret;
68}
69
70static const struct dev_pm_ops samsung_pd_pm_ops = {
71 .runtime_suspend = samsung_pd_runtime_suspend,
72 .runtime_resume = samsung_pd_runtime_resume,
73};
74
75static struct platform_driver samsung_pd_driver = {
76 .driver = {
77 .name = "samsung-pd",
78 .owner = THIS_MODULE,
79 .pm = &samsung_pd_pm_ops,
80 },
81 .probe = samsung_pd_probe,
82 .remove = __devexit_p(samsung_pd_remove),
83};
84
85static int __init samsung_pd_init(void)
86{
87 int ret;
88
89 ret = platform_driver_register(&samsung_pd_driver);
90 if (ret)
91 printk(KERN_ERR "%s: failed to add PD driver\n", __func__);
92
93 return ret;
94}
95arch_initcall(samsung_pd_init);
diff --git a/arch/arm/plat-samsung/pm.c b/arch/arm/plat-samsung/pm.c
index 5bf3f2f09e74..02d531fb3f81 100644
--- a/arch/arm/plat-samsung/pm.c
+++ b/arch/arm/plat-samsung/pm.c
@@ -136,15 +136,15 @@ static void s3c_pm_restore_uarts(void) { }
136unsigned long s3c_irqwake_intmask = 0xffffffffL; 136unsigned long s3c_irqwake_intmask = 0xffffffffL;
137unsigned long s3c_irqwake_eintmask = 0xffffffffL; 137unsigned long s3c_irqwake_eintmask = 0xffffffffL;
138 138
139int s3c_irqext_wake(unsigned int irqno, unsigned int state) 139int s3c_irqext_wake(struct irq_data *data, unsigned int state)
140{ 140{
141 unsigned long bit = 1L << IRQ_EINT_BIT(irqno); 141 unsigned long bit = 1L << IRQ_EINT_BIT(data->irq);
142 142
143 if (!(s3c_irqwake_eintallow & bit)) 143 if (!(s3c_irqwake_eintallow & bit))
144 return -ENOENT; 144 return -ENOENT;
145 145
146 printk(KERN_INFO "wake %s for irq %d\n", 146 printk(KERN_INFO "wake %s for irq %d\n",
147 state ? "enabled" : "disabled", irqno); 147 state ? "enabled" : "disabled", data->irq);
148 148
149 if (!state) 149 if (!state)
150 s3c_irqwake_eintmask |= bit; 150 s3c_irqwake_eintmask |= bit;