aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorRussell King <rmk+kernel@arm.linux.org.uk>2009-12-04 12:33:54 -0500
committerRussell King <rmk+kernel@arm.linux.org.uk>2009-12-04 12:33:54 -0500
commit602fd7c36728a04e61a442c9755e7d454501266c (patch)
tree6be77464bd07934a40959d68e5d08d75829bdc49 /arch
parentd7931d9f7ab9de9158c6905caae979999134ad4d (diff)
parent88d27041cf4d36e499e2c54b6c44d9115ccf124a (diff)
Merge branch 'for-rmk' of git://git.fluff.org/bjdooks/linux into devel-stable
Conflicts: arch/arm/Kconfig
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/Kconfig1
-rw-r--r--arch/arm/Makefile6
-rw-r--r--arch/arm/mach-s3c2400/include/mach/map.h2
-rw-r--r--arch/arm/mach-s3c2410/Kconfig8
-rw-r--r--arch/arm/mach-s3c2410/Makefile3
-rw-r--r--arch/arm/mach-s3c2410/bast-irq.c4
-rw-r--r--arch/arm/mach-s3c2410/cpu-freq.c2
-rw-r--r--arch/arm/mach-s3c2410/h1940-bluetooth.c88
-rw-r--r--arch/arm/mach-s3c2410/include/mach/bast-cpld.h2
-rw-r--r--arch/arm/mach-s3c2410/include/mach/bast-irq.h2
-rw-r--r--arch/arm/mach-s3c2410/include/mach/bast-map.h2
-rw-r--r--arch/arm/mach-s3c2410/include/mach/bast-pmu.h2
-rw-r--r--arch/arm/mach-s3c2410/include/mach/dma.h2
-rw-r--r--arch/arm/mach-s3c2410/include/mach/gpio-fns.h2
-rw-r--r--arch/arm/mach-s3c2410/include/mach/osiris-map.h2
-rw-r--r--arch/arm/mach-s3c2410/include/mach/regs-clock.h4
-rw-r--r--arch/arm/mach-s3c2410/include/mach/regs-gpio.h4
-rw-r--r--arch/arm/mach-s3c2410/include/mach/regs-power.h4
-rw-r--r--arch/arm/mach-s3c2410/include/mach/uncompress.h3
-rw-r--r--arch/arm/mach-s3c2410/include/mach/vr1000-irq.h2
-rw-r--r--arch/arm/mach-s3c2410/mach-bast.c19
-rw-r--r--arch/arm/mach-s3c2410/mach-h1940.c105
-rw-r--r--arch/arm/mach-s3c2410/mach-n30.c4
-rw-r--r--arch/arm/mach-s3c2410/mach-qt2410.c8
-rw-r--r--arch/arm/mach-s3c2410/mach-vr1000.c4
-rw-r--r--arch/arm/mach-s3c2410/pll.c2
-rw-r--r--arch/arm/mach-s3c2410/usb-simtec.c4
-rw-r--r--arch/arm/mach-s3c2412/mach-jive.c11
-rw-r--r--arch/arm/mach-s3c2412/mach-vstms.c10
-rw-r--r--arch/arm/mach-s3c2440/Kconfig13
-rw-r--r--arch/arm/mach-s3c2440/Makefile4
-rw-r--r--arch/arm/mach-s3c2440/irq.c2
-rw-r--r--arch/arm/mach-s3c2440/mach-anubis.c29
-rw-r--r--arch/arm/mach-s3c2440/mach-at2440evb.c9
-rw-r--r--arch/arm/mach-s3c2440/mach-mini2440.c4
-rw-r--r--arch/arm/mach-s3c2440/mach-osiris-dvs.c194
-rw-r--r--arch/arm/mach-s3c2440/mach-osiris.c47
-rw-r--r--arch/arm/mach-s3c2440/mach-rx3715.c11
-rw-r--r--arch/arm/mach-s3c2440/mach-smdk2440.c2
-rw-r--r--arch/arm/mach-s3c2442/mach-gta02.c6
-rw-r--r--arch/arm/mach-s3c24a0/include/mach/map.h2
-rw-r--r--arch/arm/mach-s3c24a0/include/mach/regs-clock.h4
-rw-r--r--arch/arm/mach-s3c6400/include/mach/map.h4
-rw-r--r--arch/arm/mach-s3c6400/include/mach/regs-fb.h236
-rw-r--r--arch/arm/mach-s3c6400/s3c6400.c1
-rw-r--r--arch/arm/mach-s3c6410/cpu.c1
-rw-r--r--arch/arm/mach-s3c6410/mach-hmt.c2
-rw-r--r--arch/arm/mach-s3c6410/mach-smdk6410.c52
-rw-r--r--arch/arm/mach-s5pc100/Kconfig14
-rw-r--r--arch/arm/mach-s5pc100/Makefile4
-rw-r--r--arch/arm/mach-s5pc100/cpu.c29
-rw-r--r--arch/arm/mach-s5pc100/include/mach/gpio.h230
-rw-r--r--arch/arm/mach-s5pc100/include/mach/irqs.h5
-rw-r--r--arch/arm/mach-s5pc100/include/mach/map.h87
-rw-r--r--arch/arm/mach-s5pc100/include/mach/regs-fb.h139
-rw-r--r--arch/arm/mach-s5pc100/include/mach/system.h13
-rw-r--r--arch/arm/mach-s5pc100/mach-smdkc100.c89
-rw-r--r--arch/arm/mach-s5pc100/setup-sdhci.c65
-rw-r--r--arch/arm/plat-s3c/Kconfig11
-rw-r--r--arch/arm/plat-s3c/Makefile1
-rw-r--r--arch/arm/plat-s3c/clock.c4
-rw-r--r--arch/arm/plat-s3c/dev-hsmmc2.c69
-rw-r--r--arch/arm/plat-s3c/dev-i2c0.c2
-rw-r--r--arch/arm/plat-s3c/dev-i2c1.c2
-rw-r--r--arch/arm/plat-s3c/dev-nand.c97
-rw-r--r--arch/arm/plat-s3c/dma.c2
-rw-r--r--arch/arm/plat-s3c/include/plat/audio-simtec.h2
-rw-r--r--arch/arm/plat-s3c/include/plat/cpu-freq.h2
-rw-r--r--arch/arm/plat-s3c/include/plat/cpu.h6
-rw-r--r--arch/arm/plat-s3c/include/plat/dma.h2
-rw-r--r--arch/arm/plat-s3c/include/plat/fb.h7
-rw-r--r--arch/arm/plat-s3c/include/plat/iic.h2
-rw-r--r--arch/arm/plat-s3c/include/plat/nand.h8
-rw-r--r--arch/arm/plat-s3c/include/plat/regs-fb-v4.h235
-rw-r--r--arch/arm/plat-s3c/include/plat/regs-nand.h4
-rw-r--r--arch/arm/plat-s3c/include/plat/regs-serial.h2
-rw-r--r--arch/arm/plat-s3c/include/plat/sdhci.h78
-rw-r--r--arch/arm/plat-s3c/pm-check.c2
-rw-r--r--arch/arm/plat-s3c/pm.c2
-rw-r--r--arch/arm/plat-s3c24xx/Kconfig7
-rw-r--r--arch/arm/plat-s3c24xx/Makefile1
-rw-r--r--arch/arm/plat-s3c24xx/clock-dclk.c2
-rw-r--r--arch/arm/plat-s3c24xx/common-smdk.c2
-rw-r--r--arch/arm/plat-s3c24xx/cpu-freq.c2
-rw-r--r--arch/arm/plat-s3c24xx/dma.c4
-rw-r--r--arch/arm/plat-s3c24xx/include/plat/cpu-freq-core.h2
-rw-r--r--arch/arm/plat-s3c24xx/include/plat/mci.h25
-rw-r--r--arch/arm/plat-s3c24xx/include/plat/regs-dma.h2
-rw-r--r--arch/arm/plat-s3c24xx/irq-pm.c2
-rw-r--r--arch/arm/plat-s3c24xx/irq.c2
-rw-r--r--arch/arm/plat-s3c24xx/pm-simtec.c4
-rw-r--r--arch/arm/plat-s3c24xx/pm.c2
-rw-r--r--arch/arm/plat-s3c24xx/s3c2410-iotiming.c2
-rw-r--r--arch/arm/plat-s3c24xx/s3c2412-iotiming.c2
-rw-r--r--arch/arm/plat-s3c24xx/s3c2440-cpufreq.c2
-rw-r--r--arch/arm/plat-s3c24xx/s3c2440-pll-12000000.c2
-rw-r--r--arch/arm/plat-s3c24xx/s3c244x-clock.c2
-rw-r--r--arch/arm/plat-s3c24xx/s3c244x-irq.c2
-rw-r--r--arch/arm/plat-s3c24xx/simtec-audio.c77
-rw-r--r--arch/arm/plat-s3c64xx/cpu.c5
-rw-r--r--arch/arm/plat-s3c64xx/cpufreq.c40
-rw-r--r--arch/arm/plat-s3c64xx/gpiolib.c12
-rw-r--r--arch/arm/plat-s3c64xx/include/plat/gpio-bank-c.h6
-rw-r--r--arch/arm/plat-s3c64xx/irq-eint.c19
-rw-r--r--arch/arm/plat-s3c64xx/setup-sdhci-gpio.c20
-rw-r--r--arch/arm/plat-s5pc1xx/Kconfig18
-rw-r--r--arch/arm/plat-s5pc1xx/Makefile11
-rw-r--r--arch/arm/plat-s5pc1xx/clock.c728
-rw-r--r--arch/arm/plat-s5pc1xx/cpu.c10
-rw-r--r--arch/arm/plat-s5pc1xx/gpio-config.c62
-rw-r--r--arch/arm/plat-s5pc1xx/gpiolib.c503
-rw-r--r--arch/arm/plat-s5pc1xx/include/plat/gpio-cfg-s5pc1xx.h32
-rw-r--r--arch/arm/plat-s5pc1xx/include/plat/gpio-ext.h44
-rw-r--r--arch/arm/plat-s5pc1xx/include/plat/irqs.h15
-rw-r--r--arch/arm/plat-s5pc1xx/include/plat/regs-clock.h212
-rw-r--r--arch/arm/plat-s5pc1xx/include/plat/regs-gpio.h70
-rw-r--r--arch/arm/plat-s5pc1xx/include/plat/regs-power.h84
-rw-r--r--arch/arm/plat-s5pc1xx/include/plat/s5pc100.h5
-rw-r--r--arch/arm/plat-s5pc1xx/irq-eint.c281
-rw-r--r--arch/arm/plat-s5pc1xx/irq-gpio.c266
-rw-r--r--arch/arm/plat-s5pc1xx/irq.c2
-rw-r--r--arch/arm/plat-s5pc1xx/s5pc100-clock.c1555
-rw-r--r--arch/arm/plat-s5pc1xx/setup-fb-24bpp.c49
-rw-r--r--arch/arm/plat-s5pc1xx/setup-i2c0.c7
-rw-r--r--arch/arm/plat-s5pc1xx/setup-i2c1.c7
-rw-r--r--arch/arm/plat-s5pc1xx/setup-sdhci-gpio.c86
-rw-r--r--arch/arm/plat-samsung/Kconfig17
-rw-r--r--arch/arm/plat-samsung/Makefile11
128 files changed, 5010 insertions, 1463 deletions
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 62152ae34758..7d0818797c85 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -760,6 +760,7 @@ source "arch/arm/mach-kirkwood/Kconfig"
760 760
761source "arch/arm/mach-dove/Kconfig" 761source "arch/arm/mach-dove/Kconfig"
762 762
763source "arch/arm/plat-samsung/Kconfig"
763source "arch/arm/plat-s3c24xx/Kconfig" 764source "arch/arm/plat-s3c24xx/Kconfig"
764source "arch/arm/plat-s3c64xx/Kconfig" 765source "arch/arm/plat-s3c64xx/Kconfig"
765source "arch/arm/plat-s3c/Kconfig" 766source "arch/arm/plat-s3c/Kconfig"
diff --git a/arch/arm/Makefile b/arch/arm/Makefile
index 2ddc323b1c6a..8c0d08fbd991 100644
--- a/arch/arm/Makefile
+++ b/arch/arm/Makefile
@@ -179,9 +179,9 @@ plat-$(CONFIG_ARCH_OMAP) := omap
179plat-$(CONFIG_PLAT_IOP) := iop 179plat-$(CONFIG_PLAT_IOP) := iop
180plat-$(CONFIG_PLAT_ORION) := orion 180plat-$(CONFIG_PLAT_ORION) := orion
181plat-$(CONFIG_PLAT_PXA) := pxa 181plat-$(CONFIG_PLAT_PXA) := pxa
182plat-$(CONFIG_PLAT_S3C24XX) := s3c24xx s3c 182plat-$(CONFIG_PLAT_S3C24XX) := s3c24xx s3c samsung
183plat-$(CONFIG_PLAT_S3C64XX) := s3c64xx s3c 183plat-$(CONFIG_PLAT_S3C64XX) := s3c64xx s3c samsung
184plat-$(CONFIG_PLAT_S5PC1XX) := s5pc1xx s3c 184plat-$(CONFIG_PLAT_S5PC1XX) := s5pc1xx s3c samsung
185plat-$(CONFIG_ARCH_STMP3XXX) := stmp3xxx 185plat-$(CONFIG_ARCH_STMP3XXX) := stmp3xxx
186 186
187ifeq ($(CONFIG_ARCH_EBSA110),y) 187ifeq ($(CONFIG_ARCH_EBSA110),y)
diff --git a/arch/arm/mach-s3c2400/include/mach/map.h b/arch/arm/mach-s3c2400/include/mach/map.h
index 1535540edc82..3fd889200e99 100644
--- a/arch/arm/mach-s3c2400/include/mach/map.h
+++ b/arch/arm/mach-s3c2400/include/mach/map.h
@@ -1,6 +1,6 @@
1/* arch/arm/mach-s3c2400/include/mach/map.h 1/* arch/arm/mach-s3c2400/include/mach/map.h
2 * 2 *
3 * Copyright 2003,2007 Simtec Electronics 3 * Copyright 2003-2007 Simtec Electronics
4 * http://armlinux.simtec.co.uk/ 4 * http://armlinux.simtec.co.uk/
5 * Ben Dooks <ben@simtec.co.uk> 5 * Ben Dooks <ben@simtec.co.uk>
6 * 6 *
diff --git a/arch/arm/mach-s3c2410/Kconfig b/arch/arm/mach-s3c2410/Kconfig
index 3d4e9da3fa52..dd1fcc7e6708 100644
--- a/arch/arm/mach-s3c2410/Kconfig
+++ b/arch/arm/mach-s3c2410/Kconfig
@@ -81,6 +81,14 @@ config ARCH_H1940
81 help 81 help
82 Say Y here if you are using the HP IPAQ H1940 82 Say Y here if you are using the HP IPAQ H1940
83 83
84config H1940BT
85 tristate "Control the state of H1940 bluetooth chip"
86 depends on ARCH_H1940
87 select RFKILL
88 help
89 This is a simple driver that is able to control
90 the state of built in bluetooth chip on h1940.
91
84config PM_H1940 92config PM_H1940
85 bool 93 bool
86 help 94 help
diff --git a/arch/arm/mach-s3c2410/Makefile b/arch/arm/mach-s3c2410/Makefile
index 2ab5ba4b266f..0d468e96e83e 100644
--- a/arch/arm/mach-s3c2410/Makefile
+++ b/arch/arm/mach-s3c2410/Makefile
@@ -21,7 +21,8 @@ obj-$(CONFIG_S3C2410_PLLTABLE) += pll.o
21# Machine support 21# Machine support
22 22
23obj-$(CONFIG_ARCH_SMDK2410) += mach-smdk2410.o 23obj-$(CONFIG_ARCH_SMDK2410) += mach-smdk2410.o
24obj-$(CONFIG_ARCH_H1940) += mach-h1940.o h1940-bluetooth.o 24obj-$(CONFIG_ARCH_H1940) += mach-h1940.o
25obj-$(CONFIG_H1940BT) += h1940-bluetooth.o
25obj-$(CONFIG_PM_H1940) += pm-h1940.o 26obj-$(CONFIG_PM_H1940) += pm-h1940.o
26obj-$(CONFIG_MACH_N30) += mach-n30.o 27obj-$(CONFIG_MACH_N30) += mach-n30.o
27obj-$(CONFIG_ARCH_BAST) += mach-bast.o usb-simtec.o 28obj-$(CONFIG_ARCH_BAST) += mach-bast.o usb-simtec.o
diff --git a/arch/arm/mach-s3c2410/bast-irq.c b/arch/arm/mach-s3c2410/bast-irq.c
index 9a37c87152b0..217b102866d0 100644
--- a/arch/arm/mach-s3c2410/bast-irq.c
+++ b/arch/arm/mach-s3c2410/bast-irq.c
@@ -1,6 +1,6 @@
1/* linux/arch/arm/mach-s3c2410/bast-irq.c 1/* linux/arch/arm/mach-s3c2410/bast-irq.c
2 * 2 *
3 * Copyright (c) 2003,2005 Simtec Electronics 3 * Copyright 2003-2005 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk> 4 * Ben Dooks <ben@simtec.co.uk>
5 * 5 *
6 * http://www.simtec.co.uk/products/EB2410ITX/ 6 * http://www.simtec.co.uk/products/EB2410ITX/
@@ -141,7 +141,7 @@ static __init int bast_irq_init(void)
141 unsigned int i; 141 unsigned int i;
142 142
143 if (machine_is_bast()) { 143 if (machine_is_bast()) {
144 printk(KERN_INFO "BAST PC104 IRQ routing, (c) 2005 Simtec Electronics\n"); 144 printk(KERN_INFO "BAST PC104 IRQ routing, Copyright 2005 Simtec Electronics\n");
145 145
146 /* zap all the IRQs */ 146 /* zap all the IRQs */
147 147
diff --git a/arch/arm/mach-s3c2410/cpu-freq.c b/arch/arm/mach-s3c2410/cpu-freq.c
index 9d1186877d08..75189df995ae 100644
--- a/arch/arm/mach-s3c2410/cpu-freq.c
+++ b/arch/arm/mach-s3c2410/cpu-freq.c
@@ -1,6 +1,6 @@
1/* linux/arch/arm/mach-s3c2410/cpu-freq.c 1/* linux/arch/arm/mach-s3c2410/cpu-freq.c
2 * 2 *
3 * Copyright (c) 2006,2008 Simtec Electronics 3 * Copyright (c) 2006-2008 Simtec Electronics
4 * http://armlinux.simtec.co.uk/ 4 * http://armlinux.simtec.co.uk/
5 * Ben Dooks <ben@simtec.co.uk> 5 * Ben Dooks <ben@simtec.co.uk>
6 * 6 *
diff --git a/arch/arm/mach-s3c2410/h1940-bluetooth.c b/arch/arm/mach-s3c2410/h1940-bluetooth.c
index 5aabf117cbb0..b7d1f8d27bc2 100644
--- a/arch/arm/mach-s3c2410/h1940-bluetooth.c
+++ b/arch/arm/mach-s3c2410/h1940-bluetooth.c
@@ -17,6 +17,7 @@
17#include <linux/ctype.h> 17#include <linux/ctype.h>
18#include <linux/leds.h> 18#include <linux/leds.h>
19#include <linux/gpio.h> 19#include <linux/gpio.h>
20#include <linux/rfkill.h>
20 21
21#include <mach/regs-gpio.h> 22#include <mach/regs-gpio.h>
22#include <mach/hardware.h> 23#include <mach/hardware.h>
@@ -24,21 +25,10 @@
24 25
25#define DRV_NAME "h1940-bt" 26#define DRV_NAME "h1940-bt"
26 27
27#ifdef CONFIG_LEDS_H1940
28DEFINE_LED_TRIGGER(bt_led_trigger);
29#endif
30
31static int state;
32
33/* Bluetooth control */ 28/* Bluetooth control */
34static void h1940bt_enable(int on) 29static void h1940bt_enable(int on)
35{ 30{
36 if (on) { 31 if (on) {
37#ifdef CONFIG_LEDS_H1940
38 /* flashing Blue */
39 led_trigger_event(bt_led_trigger, LED_HALF);
40#endif
41
42 /* Power on the chip */ 32 /* Power on the chip */
43 h1940_latch_control(0, H1940_LATCH_BLUETOOTH_POWER); 33 h1940_latch_control(0, H1940_LATCH_BLUETOOTH_POWER);
44 /* Reset the chip */ 34 /* Reset the chip */
@@ -46,48 +36,31 @@ static void h1940bt_enable(int on)
46 s3c2410_gpio_setpin(S3C2410_GPH(1), 1); 36 s3c2410_gpio_setpin(S3C2410_GPH(1), 1);
47 mdelay(10); 37 mdelay(10);
48 s3c2410_gpio_setpin(S3C2410_GPH(1), 0); 38 s3c2410_gpio_setpin(S3C2410_GPH(1), 0);
49
50 state = 1;
51 } 39 }
52 else { 40 else {
53#ifdef CONFIG_LEDS_H1940
54 led_trigger_event(bt_led_trigger, 0);
55#endif
56
57 s3c2410_gpio_setpin(S3C2410_GPH(1), 1); 41 s3c2410_gpio_setpin(S3C2410_GPH(1), 1);
58 mdelay(10); 42 mdelay(10);
59 s3c2410_gpio_setpin(S3C2410_GPH(1), 0); 43 s3c2410_gpio_setpin(S3C2410_GPH(1), 0);
60 mdelay(10); 44 mdelay(10);
61 h1940_latch_control(H1940_LATCH_BLUETOOTH_POWER, 0); 45 h1940_latch_control(H1940_LATCH_BLUETOOTH_POWER, 0);
62
63 state = 0;
64 } 46 }
65} 47}
66 48
67static ssize_t h1940bt_show(struct device *dev, struct device_attribute *attr, char *buf) 49static int h1940bt_set_block(void *data, bool blocked)
68{ 50{
69 return snprintf(buf, PAGE_SIZE, "%d\n", state); 51 h1940bt_enable(!blocked);
52 return 0;
70} 53}
71 54
72static ssize_t h1940bt_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) 55static const struct rfkill_ops h1940bt_rfkill_ops = {
73{ 56 .set_block = h1940bt_set_block,
74 int new_state; 57};
75 char *endp;
76
77 new_state = simple_strtoul(buf, &endp, 0);
78 if (*endp && !isspace(*endp))
79 return -EINVAL;
80
81 h1940bt_enable(new_state);
82
83 return count;
84}
85static DEVICE_ATTR(enable, 0644,
86 h1940bt_show,
87 h1940bt_store);
88 58
89static int __init h1940bt_probe(struct platform_device *pdev) 59static int __init h1940bt_probe(struct platform_device *pdev)
90{ 60{
61 struct rfkill *rfk;
62 int ret = 0;
63
91 /* Configures BT serial port GPIOs */ 64 /* Configures BT serial port GPIOs */
92 s3c2410_gpio_cfgpin(S3C2410_GPH(0), S3C2410_GPH0_nCTS0); 65 s3c2410_gpio_cfgpin(S3C2410_GPH(0), S3C2410_GPH0_nCTS0);
93 s3c2410_gpio_pullup(S3C2410_GPH(0), 1); 66 s3c2410_gpio_pullup(S3C2410_GPH(0), 1);
@@ -98,21 +71,44 @@ static int __init h1940bt_probe(struct platform_device *pdev)
98 s3c2410_gpio_cfgpin(S3C2410_GPH(3), S3C2410_GPH3_RXD0); 71 s3c2410_gpio_cfgpin(S3C2410_GPH(3), S3C2410_GPH3_RXD0);
99 s3c2410_gpio_pullup(S3C2410_GPH(3), 1); 72 s3c2410_gpio_pullup(S3C2410_GPH(3), 1);
100 73
101#ifdef CONFIG_LEDS_H1940
102 led_trigger_register_simple("h1940-bluetooth", &bt_led_trigger);
103#endif
104 74
105 /* disable BT by default */ 75 rfk = rfkill_alloc(DRV_NAME, &pdev->dev, RFKILL_TYPE_BLUETOOTH,
106 h1940bt_enable(0); 76 &h1940bt_rfkill_ops, NULL);
77 if (!rfk) {
78 ret = -ENOMEM;
79 goto err_rfk_alloc;
80 }
81
82 rfkill_set_led_trigger_name(rfk, "h1940-bluetooth");
83
84 ret = rfkill_register(rfk);
85 if (ret)
86 goto err_rfkill;
87
88 platform_set_drvdata(pdev, rfk);
89
90 return 0;
107 91
108 return device_create_file(&pdev->dev, &dev_attr_enable); 92err_rfkill:
93 rfkill_destroy(rfk);
94err_rfk_alloc:
95 return ret;
109} 96}
110 97
111static int h1940bt_remove(struct platform_device *pdev) 98static int h1940bt_remove(struct platform_device *pdev)
112{ 99{
113#ifdef CONFIG_LEDS_H1940 100 struct rfkill *rfk = platform_get_drvdata(pdev);
114 led_trigger_unregister_simple(bt_led_trigger); 101
115#endif 102 platform_set_drvdata(pdev, NULL);
103
104 if (rfk) {
105 rfkill_unregister(rfk);
106 rfkill_destroy(rfk);
107 }
108 rfk = NULL;
109
110 h1940bt_enable(0);
111
116 return 0; 112 return 0;
117} 113}
118 114
diff --git a/arch/arm/mach-s3c2410/include/mach/bast-cpld.h b/arch/arm/mach-s3c2410/include/mach/bast-cpld.h
index 20493b048360..bee2a7a932a0 100644
--- a/arch/arm/mach-s3c2410/include/mach/bast-cpld.h
+++ b/arch/arm/mach-s3c2410/include/mach/bast-cpld.h
@@ -1,6 +1,6 @@
1/* arch/arm/mach-s3c2410/include/mach/bast-cpld.h 1/* arch/arm/mach-s3c2410/include/mach/bast-cpld.h
2 * 2 *
3 * Copyright (c) 2003,2004 Simtec Electronics 3 * Copyright (c) 2003-2004 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk> 4 * Ben Dooks <ben@simtec.co.uk>
5 * 5 *
6 * BAST - CPLD control constants 6 * BAST - CPLD control constants
diff --git a/arch/arm/mach-s3c2410/include/mach/bast-irq.h b/arch/arm/mach-s3c2410/include/mach/bast-irq.h
index 501c202b53cf..cac428c42e7f 100644
--- a/arch/arm/mach-s3c2410/include/mach/bast-irq.h
+++ b/arch/arm/mach-s3c2410/include/mach/bast-irq.h
@@ -1,6 +1,6 @@
1/* arch/arm/mach-s3c2410/include/mach/bast-irq.h 1/* arch/arm/mach-s3c2410/include/mach/bast-irq.h
2 * 2 *
3 * Copyright (c) 2003,2004 Simtec Electronics 3 * Copyright (c) 2003-2004 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk> 4 * Ben Dooks <ben@simtec.co.uk>
5 * 5 *
6 * Machine BAST - IRQ Number definitions 6 * Machine BAST - IRQ Number definitions
diff --git a/arch/arm/mach-s3c2410/include/mach/bast-map.h b/arch/arm/mach-s3c2410/include/mach/bast-map.h
index c2c5baf07345..6e7dc9d0cf0e 100644
--- a/arch/arm/mach-s3c2410/include/mach/bast-map.h
+++ b/arch/arm/mach-s3c2410/include/mach/bast-map.h
@@ -1,6 +1,6 @@
1/* arch/arm/mach-s3c2410/include/mach/bast-map.h 1/* arch/arm/mach-s3c2410/include/mach/bast-map.h
2 * 2 *
3 * Copyright (c) 2003,2004 Simtec Electronics 3 * Copyright (c) 2003-2004 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk> 4 * Ben Dooks <ben@simtec.co.uk>
5 * 5 *
6 * Machine BAST - Memory map definitions 6 * Machine BAST - Memory map definitions
diff --git a/arch/arm/mach-s3c2410/include/mach/bast-pmu.h b/arch/arm/mach-s3c2410/include/mach/bast-pmu.h
index 61684cb8ce59..4c38b39b741d 100644
--- a/arch/arm/mach-s3c2410/include/mach/bast-pmu.h
+++ b/arch/arm/mach-s3c2410/include/mach/bast-pmu.h
@@ -1,6 +1,6 @@
1/* arch/arm/mach-s3c2410/include/mach/bast-pmu.h 1/* arch/arm/mach-s3c2410/include/mach/bast-pmu.h
2 * 2 *
3 * Copyright (c) 2003,2004 Simtec Electronics 3 * Copyright (c) 2003-2004 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk> 4 * Ben Dooks <ben@simtec.co.uk>
5 * Vincent Sanders <vince@simtec.co.uk> 5 * Vincent Sanders <vince@simtec.co.uk>
6 * 6 *
diff --git a/arch/arm/mach-s3c2410/include/mach/dma.h b/arch/arm/mach-s3c2410/include/mach/dma.h
index 92e2687009ea..08ac5f96c012 100644
--- a/arch/arm/mach-s3c2410/include/mach/dma.h
+++ b/arch/arm/mach-s3c2410/include/mach/dma.h
@@ -1,6 +1,6 @@
1/* arch/arm/mach-s3c2410/include/mach/dma.h 1/* arch/arm/mach-s3c2410/include/mach/dma.h
2 * 2 *
3 * Copyright (C) 2003,2004,2006 Simtec Electronics 3 * Copyright (C) 2003-2006 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk> 4 * Ben Dooks <ben@simtec.co.uk>
5 * 5 *
6 * Samsung S3C24XX DMA support 6 * Samsung S3C24XX DMA support
diff --git a/arch/arm/mach-s3c2410/include/mach/gpio-fns.h b/arch/arm/mach-s3c2410/include/mach/gpio-fns.h
index 801dff13858d..035a493952db 100644
--- a/arch/arm/mach-s3c2410/include/mach/gpio-fns.h
+++ b/arch/arm/mach-s3c2410/include/mach/gpio-fns.h
@@ -1,6 +1,6 @@
1/* arch/arm/mach-s3c2410/include/mach/gpio-fns.h 1/* arch/arm/mach-s3c2410/include/mach/gpio-fns.h
2 * 2 *
3 * Copyright (c) 2003,2009 Simtec Electronics 3 * Copyright (c) 2003-2009 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk> 4 * Ben Dooks <ben@simtec.co.uk>
5 * 5 *
6 * S3C2410 - hardware 6 * S3C2410 - hardware
diff --git a/arch/arm/mach-s3c2410/include/mach/osiris-map.h b/arch/arm/mach-s3c2410/include/mach/osiris-map.h
index 639eff523d4e..17380f848428 100644
--- a/arch/arm/mach-s3c2410/include/mach/osiris-map.h
+++ b/arch/arm/mach-s3c2410/include/mach/osiris-map.h
@@ -1,6 +1,6 @@
1/* arch/arm/mach-s3c2410/include/mach/osiris-map.h 1/* arch/arm/mach-s3c2410/include/mach/osiris-map.h
2 * 2 *
3 * (c) 2005 Simtec Electronics 3 * Copyright 2005 Simtec Electronics
4 * http://www.simtec.co.uk/products/ 4 * http://www.simtec.co.uk/products/
5 * Ben Dooks <ben@simtec.co.uk> 5 * Ben Dooks <ben@simtec.co.uk>
6 * 6 *
diff --git a/arch/arm/mach-s3c2410/include/mach/regs-clock.h b/arch/arm/mach-s3c2410/include/mach/regs-clock.h
index 2a5d90e957fb..9a0d169be137 100644
--- a/arch/arm/mach-s3c2410/include/mach/regs-clock.h
+++ b/arch/arm/mach-s3c2410/include/mach/regs-clock.h
@@ -1,7 +1,7 @@
1/* arch/arm/mach-s3c2410/include/mach/regs-clock.h 1/* arch/arm/mach-s3c2410/include/mach/regs-clock.h
2 * 2 *
3 * Copyright (c) 2003,2004,2005,2006 Simtec Electronics <linux@simtec.co.uk> 3 * Copyright (c) 2003-2006 Simtec Electronics <linux@simtec.co.uk>
4 * http://armlinux.simtec.co.uk/ 4 * http://armlinux.simtec.co.uk/
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify 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 7 * it under the terms of the GNU General Public License version 2 as
diff --git a/arch/arm/mach-s3c2410/include/mach/regs-gpio.h b/arch/arm/mach-s3c2410/include/mach/regs-gpio.h
index f6e8eec879c8..ebc85c6dadbf 100644
--- a/arch/arm/mach-s3c2410/include/mach/regs-gpio.h
+++ b/arch/arm/mach-s3c2410/include/mach/regs-gpio.h
@@ -1,7 +1,7 @@
1/* arch/arm/mach-s3c2410/include/mach/regs-gpio.h 1/* arch/arm/mach-s3c2410/include/mach/regs-gpio.h
2 * 2 *
3 * Copyright (c) 2003,2004 Simtec Electronics <linux@simtec.co.uk> 3 * Copyright (c) 2003-2004 Simtec Electronics <linux@simtec.co.uk>
4 * http://www.simtec.co.uk/products/SWLINUX/ 4 * http://www.simtec.co.uk/products/SWLINUX/
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify 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 7 * it under the terms of the GNU General Public License version 2 as
diff --git a/arch/arm/mach-s3c2410/include/mach/regs-power.h b/arch/arm/mach-s3c2410/include/mach/regs-power.h
index 2d36353f57d7..4932b87bdf3d 100644
--- a/arch/arm/mach-s3c2410/include/mach/regs-power.h
+++ b/arch/arm/mach-s3c2410/include/mach/regs-power.h
@@ -1,7 +1,7 @@
1/* arch/arm/mach-s3c2410/include/mach/regs-power.h 1/* arch/arm/mach-s3c2410/include/mach/regs-power.h
2 * 2 *
3 * Copyright (c) 2003,2004,2005,2006 Simtec Electronics <linux@simtec.co.uk> 3 * Copyright (c) 2003-2006 Simtec Electronics <linux@simtec.co.uk>
4 * http://armlinux.simtec.co.uk/ 4 * http://armlinux.simtec.co.uk/
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify 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 7 * it under the terms of the GNU General Public License version 2 as
diff --git a/arch/arm/mach-s3c2410/include/mach/uncompress.h b/arch/arm/mach-s3c2410/include/mach/uncompress.h
index c9432103750d..72f756c5e504 100644
--- a/arch/arm/mach-s3c2410/include/mach/uncompress.h
+++ b/arch/arm/mach-s3c2410/include/mach/uncompress.h
@@ -1,7 +1,6 @@
1
2/* arch/arm/mach-s3c2410/include/mach/uncompress.h 1/* arch/arm/mach-s3c2410/include/mach/uncompress.h
3 * 2 *
4 * Copyright (c) 2003, 2007 Simtec Electronics 3 * Copyright (c) 2003-2007 Simtec Electronics
5 * http://armlinux.simtec.co.uk/ 4 * http://armlinux.simtec.co.uk/
6 * Ben Dooks <ben@simtec.co.uk> 5 * Ben Dooks <ben@simtec.co.uk>
7 * 6 *
diff --git a/arch/arm/mach-s3c2410/include/mach/vr1000-irq.h b/arch/arm/mach-s3c2410/include/mach/vr1000-irq.h
index f53f85b4ad8b..47add133b8ee 100644
--- a/arch/arm/mach-s3c2410/include/mach/vr1000-irq.h
+++ b/arch/arm/mach-s3c2410/include/mach/vr1000-irq.h
@@ -1,6 +1,6 @@
1/* arch/arm/mach-s3c2410/include/mach/vr1000-irq.h 1/* arch/arm/mach-s3c2410/include/mach/vr1000-irq.h
2 * 2 *
3 * Copyright (c) 2003,2004 Simtec Electronics 3 * Copyright (c) 2003-2004 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk> 4 * Ben Dooks <ben@simtec.co.uk>
5 * 5 *
6 * Machine VR1000 - IRQ Number definitions 6 * Machine VR1000 - IRQ Number definitions
diff --git a/arch/arm/mach-s3c2410/mach-bast.c b/arch/arm/mach-s3c2410/mach-bast.c
index 647c9adb018f..4c79ac8a6c33 100644
--- a/arch/arm/mach-s3c2410/mach-bast.c
+++ b/arch/arm/mach-s3c2410/mach-bast.c
@@ -1,6 +1,6 @@
1/* linux/arch/arm/mach-s3c2410/mach-bast.c 1/* linux/arch/arm/mach-s3c2410/mach-bast.c
2 * 2 *
3 * Copyright (c) 2003-2005,2008 Simtec Electronics 3 * Copyright 2003-2008 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk> 4 * Ben Dooks <ben@simtec.co.uk>
5 * 5 *
6 * http://www.simtec.co.uk/products/EB2410ITX/ 6 * http://www.simtec.co.uk/products/EB2410ITX/
@@ -61,11 +61,12 @@
61#include <plat/devs.h> 61#include <plat/devs.h>
62#include <plat/cpu.h> 62#include <plat/cpu.h>
63#include <plat/cpu-freq.h> 63#include <plat/cpu-freq.h>
64#include <plat/audio-simtec.h>
64 65
65#include "usb-simtec.h" 66#include "usb-simtec.h"
66#include "nor-simtec.h" 67#include "nor-simtec.h"
67 68
68#define COPYRIGHT ", (c) 2004-2005 Simtec Electronics" 69#define COPYRIGHT ", Copyright 2004-2008 Simtec Electronics"
69 70
70/* macros for virtual address mods for the io space entries */ 71/* macros for virtual address mods for the io space entries */
71#define VA_C5(item) ((unsigned long)(item) + BAST_VAM_CS5) 72#define VA_C5(item) ((unsigned long)(item) + BAST_VAM_CS5)
@@ -247,7 +248,7 @@ static int chip0_map[] = { 1 };
247static int chip1_map[] = { 2 }; 248static int chip1_map[] = { 2 };
248static int chip2_map[] = { 3 }; 249static int chip2_map[] = { 3 };
249 250
250static struct mtd_partition bast_default_nand_part[] = { 251static struct mtd_partition __initdata bast_default_nand_part[] = {
251 [0] = { 252 [0] = {
252 .name = "Boot Agent", 253 .name = "Boot Agent",
253 .size = SZ_16K, 254 .size = SZ_16K,
@@ -273,7 +274,7 @@ static struct mtd_partition bast_default_nand_part[] = {
273 * socket. 274 * socket.
274*/ 275*/
275 276
276static struct s3c2410_nand_set bast_nand_sets[] = { 277static struct s3c2410_nand_set __initdata bast_nand_sets[] = {
277 [0] = { 278 [0] = {
278 .name = "SmartMedia", 279 .name = "SmartMedia",
279 .nr_chips = 1, 280 .nr_chips = 1,
@@ -323,7 +324,7 @@ static void bast_nand_select(struct s3c2410_nand_set *set, int slot)
323 __raw_writeb(tmp, BAST_VA_CTRL2); 324 __raw_writeb(tmp, BAST_VA_CTRL2);
324} 325}
325 326
326static struct s3c2410_platform_nand bast_nand_info = { 327static struct s3c2410_platform_nand __initdata bast_nand_info = {
327 .tacls = 30, 328 .tacls = 30,
328 .twrph0 = 60, 329 .twrph0 = 60,
329 .twrph1 = 60, 330 .twrph1 = 60,
@@ -608,6 +609,11 @@ static struct s3c_cpufreq_board __initdata bast_cpufreq = {
608 .need_io = 1, 609 .need_io = 1,
609}; 610};
610 611
612static struct s3c24xx_audio_simtec_pdata __initdata bast_audio = {
613 .have_mic = 1,
614 .have_lout = 1,
615};
616
611static void __init bast_map_io(void) 617static void __init bast_map_io(void)
612{ 618{
613 /* initialise the clocks */ 619 /* initialise the clocks */
@@ -625,7 +631,6 @@ static void __init bast_map_io(void)
625 631
626 s3c24xx_register_clocks(bast_clocks, ARRAY_SIZE(bast_clocks)); 632 s3c24xx_register_clocks(bast_clocks, ARRAY_SIZE(bast_clocks));
627 633
628 s3c_device_nand.dev.platform_data = &bast_nand_info;
629 s3c_device_hwmon.dev.platform_data = &bast_hwmon_info; 634 s3c_device_hwmon.dev.platform_data = &bast_hwmon_info;
630 635
631 s3c24xx_init_io(bast_iodesc, ARRAY_SIZE(bast_iodesc)); 636 s3c24xx_init_io(bast_iodesc, ARRAY_SIZE(bast_iodesc));
@@ -639,6 +644,7 @@ static void __init bast_init(void)
639 sysdev_register(&bast_pm_sysdev); 644 sysdev_register(&bast_pm_sysdev);
640 645
641 s3c_i2c0_set_platdata(&bast_i2c_info); 646 s3c_i2c0_set_platdata(&bast_i2c_info);
647 s3c_nand_set_platdata(&bast_nand_info);
642 s3c24xx_fb_set_platdata(&bast_fb_info); 648 s3c24xx_fb_set_platdata(&bast_fb_info);
643 platform_add_devices(bast_devices, ARRAY_SIZE(bast_devices)); 649 platform_add_devices(bast_devices, ARRAY_SIZE(bast_devices));
644 650
@@ -647,6 +653,7 @@ static void __init bast_init(void)
647 653
648 usb_simtec_init(); 654 usb_simtec_init();
649 nor_simtec_init(); 655 nor_simtec_init();
656 simtec_audio_add(NULL, true, &bast_audio);
650 657
651 s3c_cpufreq_setboard(&bast_cpufreq); 658 s3c_cpufreq_setboard(&bast_cpufreq);
652} 659}
diff --git a/arch/arm/mach-s3c2410/mach-h1940.c b/arch/arm/mach-s3c2410/mach-h1940.c
index d9cd5ddecf4a..49053254c98d 100644
--- a/arch/arm/mach-s3c2410/mach-h1940.c
+++ b/arch/arm/mach-s3c2410/mach-h1940.c
@@ -21,6 +21,11 @@
21#include <linux/serial_core.h> 21#include <linux/serial_core.h>
22#include <linux/platform_device.h> 22#include <linux/platform_device.h>
23#include <linux/io.h> 23#include <linux/io.h>
24#include <linux/gpio.h>
25#include <linux/pwm_backlight.h>
26#include <video/platform_lcd.h>
27
28#include <linux/mmc/host.h>
24 29
25#include <asm/mach/arch.h> 30#include <asm/mach/arch.h>
26#include <asm/mach/map.h> 31#include <asm/mach/map.h>
@@ -32,9 +37,12 @@
32 37
33#include <plat/regs-serial.h> 38#include <plat/regs-serial.h>
34#include <mach/regs-lcd.h> 39#include <mach/regs-lcd.h>
35#include <mach/regs-gpio.h>
36#include <mach/regs-clock.h> 40#include <mach/regs-clock.h>
37 41
42#include <mach/regs-gpio.h>
43#include <mach/gpio-fns.h>
44#include <mach/gpio-nrs.h>
45
38#include <mach/h1940.h> 46#include <mach/h1940.h>
39#include <mach/h1940-latch.h> 47#include <mach/h1940-latch.h>
40#include <mach/fb.h> 48#include <mach/fb.h>
@@ -46,6 +54,7 @@
46#include <plat/cpu.h> 54#include <plat/cpu.h>
47#include <plat/pll.h> 55#include <plat/pll.h>
48#include <plat/pm.h> 56#include <plat/pm.h>
57#include <plat/mci.h>
49 58
50static struct map_desc h1940_iodesc[] __initdata = { 59static struct map_desc h1940_iodesc[] __initdata = {
51 [0] = { 60 [0] = {
@@ -171,16 +180,90 @@ static struct s3c2410fb_mach_info h1940_fb_info __initdata = {
171 .gpdup_mask= 0xffffffff, 180 .gpdup_mask= 0xffffffff,
172}; 181};
173 182
174static struct platform_device s3c_device_leds = { 183static struct platform_device h1940_device_leds = {
175 .name = "h1940-leds", 184 .name = "h1940-leds",
176 .id = -1, 185 .id = -1,
177}; 186};
178 187
179static struct platform_device s3c_device_bluetooth = { 188static struct platform_device h1940_device_bluetooth = {
180 .name = "h1940-bt", 189 .name = "h1940-bt",
181 .id = -1, 190 .id = -1,
182}; 191};
183 192
193static struct s3c24xx_mci_pdata h1940_mmc_cfg = {
194 .gpio_detect = S3C2410_GPF(5),
195 .gpio_wprotect = S3C2410_GPH(8),
196 .set_power = NULL,
197 .ocr_avail = MMC_VDD_32_33,
198};
199
200static int h1940_backlight_init(struct device *dev)
201{
202 gpio_request(S3C2410_GPB(0), "Backlight");
203
204 s3c2410_gpio_setpin(S3C2410_GPB(0), 0);
205 s3c2410_gpio_pullup(S3C2410_GPB(0), 0);
206 s3c2410_gpio_cfgpin(S3C2410_GPB(0), S3C2410_GPB0_TOUT0);
207
208 return 0;
209}
210
211static void h1940_backlight_exit(struct device *dev)
212{
213 s3c2410_gpio_cfgpin(S3C2410_GPB(0), 1/*S3C2410_GPB0_OUTP*/);
214}
215
216static struct platform_pwm_backlight_data backlight_data = {
217 .pwm_id = 0,
218 .max_brightness = 100,
219 .dft_brightness = 50,
220 /* tcnt = 0x31 */
221 .pwm_period_ns = 36296,
222 .init = h1940_backlight_init,
223 .exit = h1940_backlight_exit,
224};
225
226static struct platform_device h1940_backlight = {
227 .name = "pwm-backlight",
228 .dev = {
229 .parent = &s3c_device_timer[0].dev,
230 .platform_data = &backlight_data,
231 },
232 .id = -1,
233};
234
235static void h1940_lcd_power_set(struct plat_lcd_data *pd,
236 unsigned int power)
237{
238 int value;
239
240 if (!power) {
241 /* set to 3ec */
242 s3c2410_gpio_setpin(S3C2410_GPC(0), 0);
243 /* wait for 3ac */
244 do {
245 value = s3c2410_gpio_getpin(S3C2410_GPC(6));
246 } while (value);
247 /* set to 38c */
248 s3c2410_gpio_setpin(S3C2410_GPC(5), 0);
249 } else {
250 /* Set to 3ac */
251 s3c2410_gpio_setpin(S3C2410_GPC(5), 1);
252 /* Set to 3ad */
253 s3c2410_gpio_setpin(S3C2410_GPC(0), 1);
254 }
255}
256
257static struct plat_lcd_data h1940_lcd_power_data = {
258 .set_power = h1940_lcd_power_set,
259};
260
261static struct platform_device h1940_lcd_powerdev = {
262 .name = "platform-lcd",
263 .dev.parent = &s3c_device_lcd.dev,
264 .dev.platform_data = &h1940_lcd_power_data,
265};
266
184static struct platform_device *h1940_devices[] __initdata = { 267static struct platform_device *h1940_devices[] __initdata = {
185 &s3c_device_usb, 268 &s3c_device_usb,
186 &s3c_device_lcd, 269 &s3c_device_lcd,
@@ -188,8 +271,13 @@ static struct platform_device *h1940_devices[] __initdata = {
188 &s3c_device_i2c0, 271 &s3c_device_i2c0,
189 &s3c_device_iis, 272 &s3c_device_iis,
190 &s3c_device_usbgadget, 273 &s3c_device_usbgadget,
191 &s3c_device_leds, 274 &h1940_device_leds,
192 &s3c_device_bluetooth, 275 &h1940_device_bluetooth,
276 &s3c_device_sdi,
277 &s3c_device_rtc,
278 &s3c_device_timer[0],
279 &h1940_backlight,
280 &h1940_lcd_powerdev,
193}; 281};
194 282
195static void __init h1940_map_io(void) 283static void __init h1940_map_io(void)
@@ -219,6 +307,8 @@ static void __init h1940_init(void)
219 s3c24xx_udc_set_platdata(&h1940_udc_cfg); 307 s3c24xx_udc_set_platdata(&h1940_udc_cfg);
220 s3c_i2c0_set_platdata(NULL); 308 s3c_i2c0_set_platdata(NULL);
221 309
310 s3c_device_sdi.dev.platform_data = &h1940_mmc_cfg;
311
222 /* Turn off suspend on both USB ports, and switch the 312 /* Turn off suspend on both USB ports, and switch the
223 * selectable USB port to USB device mode. */ 313 * selectable USB port to USB device mode. */
224 314
@@ -231,6 +321,11 @@ static void __init h1940_init(void)
231 | (0x03 << S3C24XX_PLLCON_SDIVSHIFT); 321 | (0x03 << S3C24XX_PLLCON_SDIVSHIFT);
232 writel(tmp, S3C2410_UPLLCON); 322 writel(tmp, S3C2410_UPLLCON);
233 323
324 gpio_request(S3C2410_GPC(0), "LCD power");
325 gpio_request(S3C2410_GPC(5), "LCD power");
326 gpio_request(S3C2410_GPC(6), "LCD power");
327
328
234 platform_add_devices(h1940_devices, ARRAY_SIZE(h1940_devices)); 329 platform_add_devices(h1940_devices, ARRAY_SIZE(h1940_devices));
235} 330}
236 331
diff --git a/arch/arm/mach-s3c2410/mach-n30.c b/arch/arm/mach-s3c2410/mach-n30.c
index 0f6ed61af415..0405712c2263 100644
--- a/arch/arm/mach-s3c2410/mach-n30.c
+++ b/arch/arm/mach-s3c2410/mach-n30.c
@@ -338,7 +338,7 @@ static struct platform_device *n35_devices[] __initdata = {
338 &n35_button_device, 338 &n35_button_device,
339}; 339};
340 340
341static struct s3c2410_platform_i2c n30_i2ccfg = { 341static struct s3c2410_platform_i2c __initdata n30_i2ccfg = {
342 .flags = 0, 342 .flags = 0,
343 .slave_addr = 0x10, 343 .slave_addr = 0x10,
344 .frequency = 10*1000, 344 .frequency = 10*1000,
@@ -500,8 +500,8 @@ static void __init n30_init_irq(void)
500static void __init n30_init(void) 500static void __init n30_init(void)
501{ 501{
502 s3c24xx_fb_set_platdata(&n30_fb_info); 502 s3c24xx_fb_set_platdata(&n30_fb_info);
503 s3c_device_i2c0.dev.platform_data = &n30_i2ccfg;
504 s3c24xx_udc_set_platdata(&n30_udc_cfg); 503 s3c24xx_udc_set_platdata(&n30_udc_cfg);
504 s3c_i2c0_set_platdata(&n30_i2ccfg);
505 505
506 /* Turn off suspend on both USB ports, and switch the 506 /* Turn off suspend on both USB ports, and switch the
507 * selectable USB port to USB device mode. */ 507 * selectable USB port to USB device mode. */
diff --git a/arch/arm/mach-s3c2410/mach-qt2410.c b/arch/arm/mach-s3c2410/mach-qt2410.c
index 2cc9849eb448..ab092bcda393 100644
--- a/arch/arm/mach-s3c2410/mach-qt2410.c
+++ b/arch/arm/mach-s3c2410/mach-qt2410.c
@@ -258,7 +258,7 @@ static struct platform_device *qt2410_devices[] __initdata = {
258 &qt2410_led, 258 &qt2410_led,
259}; 259};
260 260
261static struct mtd_partition qt2410_nand_part[] = { 261static struct mtd_partition __initdata qt2410_nand_part[] = {
262 [0] = { 262 [0] = {
263 .name = "U-Boot", 263 .name = "U-Boot",
264 .size = 0x30000, 264 .size = 0x30000,
@@ -286,7 +286,7 @@ static struct mtd_partition qt2410_nand_part[] = {
286 }, 286 },
287}; 287};
288 288
289static struct s3c2410_nand_set qt2410_nand_sets[] = { 289static struct s3c2410_nand_set __initdata qt2410_nand_sets[] = {
290 [0] = { 290 [0] = {
291 .name = "NAND", 291 .name = "NAND",
292 .nr_chips = 1, 292 .nr_chips = 1,
@@ -299,7 +299,7 @@ static struct s3c2410_nand_set qt2410_nand_sets[] = {
299 * chips and beyond. 299 * chips and beyond.
300 */ 300 */
301 301
302static struct s3c2410_platform_nand qt2410_nand_info = { 302static struct s3c2410_platform_nand __initdata qt2410_nand_info = {
303 .tacls = 20, 303 .tacls = 20,
304 .twrph0 = 60, 304 .twrph0 = 60,
305 .twrph1 = 20, 305 .twrph1 = 20,
@@ -331,7 +331,7 @@ static void __init qt2410_map_io(void)
331 331
332static void __init qt2410_machine_init(void) 332static void __init qt2410_machine_init(void)
333{ 333{
334 s3c_device_nand.dev.platform_data = &qt2410_nand_info; 334 s3c_nand_set_platdata(&qt2410_nand_info);
335 335
336 switch (tft_type) { 336 switch (tft_type) {
337 case 'p': /* production */ 337 case 'p': /* production */
diff --git a/arch/arm/mach-s3c2410/mach-vr1000.c b/arch/arm/mach-s3c2410/mach-vr1000.c
index 1628cc773a2c..0d61fb577170 100644
--- a/arch/arm/mach-s3c2410/mach-vr1000.c
+++ b/arch/arm/mach-s3c2410/mach-vr1000.c
@@ -1,6 +1,6 @@
1/* linux/arch/arm/mach-s3c2410/mach-vr1000.c 1/* linux/arch/arm/mach-s3c2410/mach-vr1000.c
2 * 2 *
3 * Copyright (c) 2003-2005,2008 Simtec Electronics 3 * Copyright (c) 2003-2008 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk> 4 * Ben Dooks <ben@simtec.co.uk>
5 * 5 *
6 * Machine support for Thorcom VR1000 board. Designed for Thorcom by 6 * Machine support for Thorcom VR1000 board. Designed for Thorcom by
@@ -49,6 +49,7 @@
49#include <plat/devs.h> 49#include <plat/devs.h>
50#include <plat/cpu.h> 50#include <plat/cpu.h>
51#include <plat/iic.h> 51#include <plat/iic.h>
52#include <plat/audio-simtec.h>
52 53
53#include "usb-simtec.h" 54#include "usb-simtec.h"
54#include "nor-simtec.h" 55#include "nor-simtec.h"
@@ -393,6 +394,7 @@ static void __init vr1000_init(void)
393 ARRAY_SIZE(vr1000_i2c_devs)); 394 ARRAY_SIZE(vr1000_i2c_devs));
394 395
395 nor_simtec_init(); 396 nor_simtec_init();
397 simtec_audio_add(NULL, true, NULL);
396} 398}
397 399
398MACHINE_START(VR1000, "Thorcom-VR1000") 400MACHINE_START(VR1000, "Thorcom-VR1000")
diff --git a/arch/arm/mach-s3c2410/pll.c b/arch/arm/mach-s3c2410/pll.c
index f178c2fd9d85..8338865e11c0 100644
--- a/arch/arm/mach-s3c2410/pll.c
+++ b/arch/arm/mach-s3c2410/pll.c
@@ -1,6 +1,6 @@
1/* arch/arm/mach-s3c2410/pll.c 1/* arch/arm/mach-s3c2410/pll.c
2 * 2 *
3 * Copyright (c) 2006,2007 Simtec Electronics 3 * Copyright (c) 2006-2007 Simtec Electronics
4 * http://armlinux.simtec.co.uk/ 4 * http://armlinux.simtec.co.uk/
5 * Ben Dooks <ben@simtec.co.uk> 5 * Ben Dooks <ben@simtec.co.uk>
6 * Vincent Sanders <vince@arm.linux.org.uk> 6 * Vincent Sanders <vince@arm.linux.org.uk>
diff --git a/arch/arm/mach-s3c2410/usb-simtec.c b/arch/arm/mach-s3c2410/usb-simtec.c
index 50e25fc5f8ab..6b9d0d83a6f9 100644
--- a/arch/arm/mach-s3c2410/usb-simtec.c
+++ b/arch/arm/mach-s3c2410/usb-simtec.c
@@ -1,6 +1,6 @@
1/* linux/arch/arm/mach-s3c2410/usb-simtec.c 1/* linux/arch/arm/mach-s3c2410/usb-simtec.c
2 * 2 *
3 * Copyright (c) 2004,2005 Simtec Electronics 3 * Copyright 2004-2005 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk> 4 * Ben Dooks <ben@simtec.co.uk>
5 * 5 *
6 * http://www.simtec.co.uk/products/EB2410ITX/ 6 * http://www.simtec.co.uk/products/EB2410ITX/
@@ -108,7 +108,7 @@ int usb_simtec_init(void)
108{ 108{
109 int ret; 109 int ret;
110 110
111 printk("USB Power Control, (c) 2004 Simtec Electronics\n"); 111 printk("USB Power Control, Copyright 2004 Simtec Electronics\n");
112 112
113 ret = gpio_request(S3C2410_GPB(4), "USB power control"); 113 ret = gpio_request(S3C2410_GPB(4), "USB power control");
114 if (ret < 0) { 114 if (ret < 0) {
diff --git a/arch/arm/mach-s3c2412/mach-jive.c b/arch/arm/mach-s3c2412/mach-jive.c
index 8df506eac903..c9fa3fca486c 100644
--- a/arch/arm/mach-s3c2412/mach-jive.c
+++ b/arch/arm/mach-s3c2412/mach-jive.c
@@ -96,7 +96,7 @@ static struct s3c2410_uartcfg jive_uartcfgs[] = {
96 * 0x017d0000-0x02bd0000 : cramfs B 96 * 0x017d0000-0x02bd0000 : cramfs B
97 * 0x02bd0000-0x03fd0000 : yaffs 97 * 0x02bd0000-0x03fd0000 : yaffs
98 */ 98 */
99static struct mtd_partition jive_imageA_nand_part[] = { 99static struct mtd_partition __initdata jive_imageA_nand_part[] = {
100 100
101#ifdef CONFIG_MACH_JIVE_SHOW_BOOTLOADER 101#ifdef CONFIG_MACH_JIVE_SHOW_BOOTLOADER
102 /* Don't allow access to the bootloader from linux */ 102 /* Don't allow access to the bootloader from linux */
@@ -154,7 +154,7 @@ static struct mtd_partition jive_imageA_nand_part[] = {
154 }, 154 },
155}; 155};
156 156
157static struct mtd_partition jive_imageB_nand_part[] = { 157static struct mtd_partition __initdata jive_imageB_nand_part[] = {
158 158
159#ifdef CONFIG_MACH_JIVE_SHOW_BOOTLOADER 159#ifdef CONFIG_MACH_JIVE_SHOW_BOOTLOADER
160 /* Don't allow access to the bootloader from linux */ 160 /* Don't allow access to the bootloader from linux */
@@ -213,7 +213,7 @@ static struct mtd_partition jive_imageB_nand_part[] = {
213 }, 213 },
214}; 214};
215 215
216static struct s3c2410_nand_set jive_nand_sets[] = { 216static struct s3c2410_nand_set __initdata jive_nand_sets[] = {
217 [0] = { 217 [0] = {
218 .name = "flash", 218 .name = "flash",
219 .nr_chips = 1, 219 .nr_chips = 1,
@@ -222,7 +222,7 @@ static struct s3c2410_nand_set jive_nand_sets[] = {
222 }, 222 },
223}; 223};
224 224
225static struct s3c2410_platform_nand jive_nand_info = { 225static struct s3c2410_platform_nand __initdata jive_nand_info = {
226 /* set taken from osiris nand timings, possibly still conservative */ 226 /* set taken from osiris nand timings, possibly still conservative */
227 .tacls = 30, 227 .tacls = 30,
228 .twrph0 = 55, 228 .twrph0 = 55,
@@ -631,7 +631,8 @@ static void __init jive_machine_init(void)
631 631
632 s3c_pm_init(); 632 s3c_pm_init();
633 633
634 s3c_device_nand.dev.platform_data = &jive_nand_info; 634 /** TODO - check that this is after the cmdline option! */
635 s3c_nand_set_platdata(&jive_nand_info);
635 636
636 /* initialise the spi */ 637 /* initialise the spi */
637 638
diff --git a/arch/arm/mach-s3c2412/mach-vstms.c b/arch/arm/mach-s3c2412/mach-vstms.c
index 11e8ad49fc7b..a6ba591b26bb 100644
--- a/arch/arm/mach-s3c2412/mach-vstms.c
+++ b/arch/arm/mach-s3c2412/mach-vstms.c
@@ -76,7 +76,7 @@ static struct s3c2410_uartcfg vstms_uartcfgs[] __initdata = {
76 } 76 }
77}; 77};
78 78
79static struct mtd_partition vstms_nand_part[] = { 79static struct mtd_partition __initdata vstms_nand_part[] = {
80 [0] = { 80 [0] = {
81 .name = "Boot Agent", 81 .name = "Boot Agent",
82 .size = 0x7C000, 82 .size = 0x7C000,
@@ -99,7 +99,7 @@ static struct mtd_partition vstms_nand_part[] = {
99 }, 99 },
100}; 100};
101 101
102static struct s3c2410_nand_set vstms_nand_sets[] = { 102static struct s3c2410_nand_set __initdata vstms_nand_sets[] = {
103 [0] = { 103 [0] = {
104 .name = "NAND", 104 .name = "NAND",
105 .nr_chips = 1, 105 .nr_chips = 1,
@@ -112,7 +112,7 @@ static struct s3c2410_nand_set vstms_nand_sets[] = {
112 * chips and beyond. 112 * chips and beyond.
113*/ 113*/
114 114
115static struct s3c2410_platform_nand vstms_nand_info = { 115static struct s3c2410_platform_nand __initdata vstms_nand_info = {
116 .tacls = 20, 116 .tacls = 20,
117 .twrph0 = 60, 117 .twrph0 = 60,
118 .twrph1 = 20, 118 .twrph1 = 20,
@@ -143,8 +143,6 @@ static void __init vstms_fixup(struct machine_desc *desc,
143 143
144static void __init vstms_map_io(void) 144static void __init vstms_map_io(void)
145{ 145{
146 s3c_device_nand.dev.platform_data = &vstms_nand_info;
147
148 s3c24xx_init_io(vstms_iodesc, ARRAY_SIZE(vstms_iodesc)); 146 s3c24xx_init_io(vstms_iodesc, ARRAY_SIZE(vstms_iodesc));
149 s3c24xx_init_clocks(12000000); 147 s3c24xx_init_clocks(12000000);
150 s3c24xx_init_uarts(vstms_uartcfgs, ARRAY_SIZE(vstms_uartcfgs)); 148 s3c24xx_init_uarts(vstms_uartcfgs, ARRAY_SIZE(vstms_uartcfgs));
@@ -153,6 +151,8 @@ static void __init vstms_map_io(void)
153static void __init vstms_init(void) 151static void __init vstms_init(void)
154{ 152{
155 s3c_i2c0_set_platdata(NULL); 153 s3c_i2c0_set_platdata(NULL);
154 s3c_nand_set_platdata(&vstms_nand_info);
155
156 platform_add_devices(vstms_devices, ARRAY_SIZE(vstms_devices)); 156 platform_add_devices(vstms_devices, ARRAY_SIZE(vstms_devices));
157} 157}
158 158
diff --git a/arch/arm/mach-s3c2440/Kconfig b/arch/arm/mach-s3c2440/Kconfig
index a8b69d77571b..cf10e14b7b49 100644
--- a/arch/arm/mach-s3c2440/Kconfig
+++ b/arch/arm/mach-s3c2440/Kconfig
@@ -53,6 +53,19 @@ config MACH_OSIRIS
53 Say Y here if you are using the Simtec IM2440D20 module, also 53 Say Y here if you are using the Simtec IM2440D20 module, also
54 known as the Osiris. 54 known as the Osiris.
55 55
56config MACH_OSIRIS_DVS
57 tristate "Simtec IM2440D20 (OSIRIS) Dynamic Voltage Scaling driver"
58 depends on MACH_OSIRIS
59 select TPS65010
60 help
61 Say Y/M here if you want to have dynamic voltage scaling support
62 on the Simtec IM2440D20 (OSIRIS) module via the TPS65011.
63
64 The DVS driver alters the voltage supplied to the ARM core
65 depending on the frequency it is running at. The driver itself
66 does not do any of the frequency alteration, which is left up
67 to the cpufreq driver.
68
56config MACH_RX3715 69config MACH_RX3715
57 bool "HP iPAQ rx3715" 70 bool "HP iPAQ rx3715"
58 select CPU_S3C2440 71 select CPU_S3C2440
diff --git a/arch/arm/mach-s3c2440/Makefile b/arch/arm/mach-s3c2440/Makefile
index bfadcf684a2a..5f3224531885 100644
--- a/arch/arm/mach-s3c2440/Makefile
+++ b/arch/arm/mach-s3c2440/Makefile
@@ -23,3 +23,7 @@ obj-$(CONFIG_ARCH_S3C2440) += mach-smdk2440.o
23obj-$(CONFIG_MACH_NEXCODER_2440) += mach-nexcoder.o 23obj-$(CONFIG_MACH_NEXCODER_2440) += mach-nexcoder.o
24obj-$(CONFIG_MACH_AT2440EVB) += mach-at2440evb.o 24obj-$(CONFIG_MACH_AT2440EVB) += mach-at2440evb.o
25obj-$(CONFIG_MACH_MINI2440) += mach-mini2440.o 25obj-$(CONFIG_MACH_MINI2440) += mach-mini2440.o
26
27# extra machine support
28
29obj-$(CONFIG_MACH_OSIRIS_DVS) += mach-osiris-dvs.o
diff --git a/arch/arm/mach-s3c2440/irq.c b/arch/arm/mach-s3c2440/irq.c
index 63c5ab65727f..0c049b95c378 100644
--- a/arch/arm/mach-s3c2440/irq.c
+++ b/arch/arm/mach-s3c2440/irq.c
@@ -1,6 +1,6 @@
1/* linux/arch/arm/mach-s3c2440/irq.c 1/* linux/arch/arm/mach-s3c2440/irq.c
2 * 2 *
3 * Copyright (c) 2003,2004 Simtec Electronics 3 * Copyright (c) 2003-2004 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk> 4 * Ben Dooks <ben@simtec.co.uk>
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify 6 * This program is free software; you can redistribute it and/or modify
diff --git a/arch/arm/mach-s3c2440/mach-anubis.c b/arch/arm/mach-s3c2440/mach-anubis.c
index 68f3870991bf..62a4c3eba97f 100644
--- a/arch/arm/mach-s3c2440/mach-anubis.c
+++ b/arch/arm/mach-s3c2440/mach-anubis.c
@@ -1,6 +1,6 @@
1/* linux/arch/arm/mach-s3c2440/mach-anubis.c 1/* linux/arch/arm/mach-s3c2440/mach-anubis.c
2 * 2 *
3 * Copyright (c) 2003-2005,2008 Simtec Electronics 3 * Copyright 2003-2009 Simtec Electronics
4 * http://armlinux.simtec.co.uk/ 4 * http://armlinux.simtec.co.uk/
5 * Ben Dooks <ben@simtec.co.uk> 5 * Ben Dooks <ben@simtec.co.uk>
6 * 6 *
@@ -53,8 +53,9 @@
53#include <plat/clock.h> 53#include <plat/clock.h>
54#include <plat/devs.h> 54#include <plat/devs.h>
55#include <plat/cpu.h> 55#include <plat/cpu.h>
56#include <plat/audio-simtec.h>
56 57
57#define COPYRIGHT ", (c) 2005 Simtec Electronics" 58#define COPYRIGHT ", Copyright 2005-2009 Simtec Electronics"
58 59
59static struct map_desc anubis_iodesc[] __initdata = { 60static struct map_desc anubis_iodesc[] __initdata = {
60 /* ISA IO areas */ 61 /* ISA IO areas */
@@ -138,7 +139,7 @@ static int external_map[] = { 2 };
138static int chip0_map[] = { 0 }; 139static int chip0_map[] = { 0 };
139static int chip1_map[] = { 1 }; 140static int chip1_map[] = { 1 };
140 141
141static struct mtd_partition anubis_default_nand_part[] = { 142static struct mtd_partition __initdata anubis_default_nand_part[] = {
142 [0] = { 143 [0] = {
143 .name = "Boot Agent", 144 .name = "Boot Agent",
144 .size = SZ_16K, 145 .size = SZ_16K,
@@ -161,7 +162,7 @@ static struct mtd_partition anubis_default_nand_part[] = {
161 } 162 }
162}; 163};
163 164
164static struct mtd_partition anubis_default_nand_part_large[] = { 165static struct mtd_partition __initdata anubis_default_nand_part_large[] = {
165 [0] = { 166 [0] = {
166 .name = "Boot Agent", 167 .name = "Boot Agent",
167 .size = SZ_128K, 168 .size = SZ_128K,
@@ -191,7 +192,7 @@ static struct mtd_partition anubis_default_nand_part_large[] = {
191 * socket. 192 * socket.
192*/ 193*/
193 194
194static struct s3c2410_nand_set anubis_nand_sets[] = { 195static struct s3c2410_nand_set __initdata anubis_nand_sets[] = {
195 [1] = { 196 [1] = {
196 .name = "External", 197 .name = "External",
197 .nr_chips = 1, 198 .nr_chips = 1,
@@ -233,7 +234,7 @@ static void anubis_nand_select(struct s3c2410_nand_set *set, int slot)
233 __raw_writeb(tmp, ANUBIS_VA_CTRL1); 234 __raw_writeb(tmp, ANUBIS_VA_CTRL1);
234} 235}
235 236
236static struct s3c2410_platform_nand anubis_nand_info = { 237static struct s3c2410_platform_nand __initdata anubis_nand_info = {
237 .tacls = 25, 238 .tacls = 25,
238 .twrph0 = 55, 239 .twrph0 = 55,
239 .twrph1 = 40, 240 .twrph1 = 40,
@@ -437,6 +438,17 @@ static struct i2c_board_info anubis_i2c_devs[] __initdata = {
437 } 438 }
438}; 439};
439 440
441/* Audio setup */
442static struct s3c24xx_audio_simtec_pdata __initdata anubis_audio = {
443 .have_mic = 1,
444 .have_lout = 1,
445 .output_cdclk = 1,
446 .use_mpllin = 1,
447 .amp_gpio = S3C2410_GPB(2),
448 .amp_gain[0] = S3C2410_GPD(10),
449 .amp_gain[1] = S3C2410_GPD(11),
450};
451
440static void __init anubis_map_io(void) 452static void __init anubis_map_io(void)
441{ 453{
442 /* initialise the clocks */ 454 /* initialise the clocks */
@@ -454,8 +466,6 @@ static void __init anubis_map_io(void)
454 466
455 s3c24xx_register_clocks(anubis_clocks, ARRAY_SIZE(anubis_clocks)); 467 s3c24xx_register_clocks(anubis_clocks, ARRAY_SIZE(anubis_clocks));
456 468
457 s3c_device_nand.dev.platform_data = &anubis_nand_info;
458
459 s3c24xx_init_io(anubis_iodesc, ARRAY_SIZE(anubis_iodesc)); 469 s3c24xx_init_io(anubis_iodesc, ARRAY_SIZE(anubis_iodesc));
460 s3c24xx_init_clocks(0); 470 s3c24xx_init_clocks(0);
461 s3c24xx_init_uarts(anubis_uartcfgs, ARRAY_SIZE(anubis_uartcfgs)); 471 s3c24xx_init_uarts(anubis_uartcfgs, ARRAY_SIZE(anubis_uartcfgs));
@@ -476,6 +486,9 @@ static void __init anubis_map_io(void)
476static void __init anubis_init(void) 486static void __init anubis_init(void)
477{ 487{
478 s3c_i2c0_set_platdata(NULL); 488 s3c_i2c0_set_platdata(NULL);
489 s3c_nand_set_platdata(&anubis_nand_info);
490 simtec_audio_add(NULL, false, &anubis_audio);
491
479 platform_add_devices(anubis_devices, ARRAY_SIZE(anubis_devices)); 492 platform_add_devices(anubis_devices, ARRAY_SIZE(anubis_devices));
480 493
481 i2c_register_board_info(0, anubis_i2c_devs, 494 i2c_register_board_info(0, anubis_i2c_devs,
diff --git a/arch/arm/mach-s3c2440/mach-at2440evb.c b/arch/arm/mach-s3c2440/mach-at2440evb.c
index dfc7010935da..aa69290e04c6 100644
--- a/arch/arm/mach-s3c2440/mach-at2440evb.c
+++ b/arch/arm/mach-s3c2440/mach-at2440evb.c
@@ -96,7 +96,7 @@ static struct s3c2410_uartcfg at2440evb_uartcfgs[] __initdata = {
96 96
97/* NAND Flash on AT2440EVB board */ 97/* NAND Flash on AT2440EVB board */
98 98
99static struct mtd_partition at2440evb_default_nand_part[] = { 99static struct mtd_partition __initdata at2440evb_default_nand_part[] = {
100 [0] = { 100 [0] = {
101 .name = "Boot Agent", 101 .name = "Boot Agent",
102 .size = SZ_256K, 102 .size = SZ_256K,
@@ -114,7 +114,7 @@ static struct mtd_partition at2440evb_default_nand_part[] = {
114 }, 114 },
115}; 115};
116 116
117static struct s3c2410_nand_set at2440evb_nand_sets[] = { 117static struct s3c2410_nand_set __initdata at2440evb_nand_sets[] = {
118 [0] = { 118 [0] = {
119 .name = "nand", 119 .name = "nand",
120 .nr_chips = 1, 120 .nr_chips = 1,
@@ -123,7 +123,7 @@ static struct s3c2410_nand_set at2440evb_nand_sets[] = {
123 }, 123 },
124}; 124};
125 125
126static struct s3c2410_platform_nand at2440evb_nand_info = { 126static struct s3c2410_platform_nand __initdata at2440evb_nand_info = {
127 .tacls = 25, 127 .tacls = 25,
128 .twrph0 = 55, 128 .twrph0 = 55,
129 .twrph1 = 40, 129 .twrph1 = 40,
@@ -216,8 +216,6 @@ static struct platform_device *at2440evb_devices[] __initdata = {
216 216
217static void __init at2440evb_map_io(void) 217static void __init at2440evb_map_io(void)
218{ 218{
219 s3c_device_nand.dev.platform_data = &at2440evb_nand_info;
220 s3c_device_sdi.name = "s3c2440-sdi";
221 s3c_device_sdi.dev.platform_data = &at2440evb_mci_pdata; 219 s3c_device_sdi.dev.platform_data = &at2440evb_mci_pdata;
222 220
223 s3c24xx_init_io(at2440evb_iodesc, ARRAY_SIZE(at2440evb_iodesc)); 221 s3c24xx_init_io(at2440evb_iodesc, ARRAY_SIZE(at2440evb_iodesc));
@@ -228,6 +226,7 @@ static void __init at2440evb_map_io(void)
228static void __init at2440evb_init(void) 226static void __init at2440evb_init(void)
229{ 227{
230 s3c24xx_fb_set_platdata(&at2440evb_fb_info); 228 s3c24xx_fb_set_platdata(&at2440evb_fb_info);
229 s3c_nand_set_platdata(&at2440evb_nand_info);
231 s3c_i2c0_set_platdata(NULL); 230 s3c_i2c0_set_platdata(NULL);
232 231
233 platform_add_devices(at2440evb_devices, ARRAY_SIZE(at2440evb_devices)); 232 platform_add_devices(at2440evb_devices, ARRAY_SIZE(at2440evb_devices));
diff --git a/arch/arm/mach-s3c2440/mach-mini2440.c b/arch/arm/mach-s3c2440/mach-mini2440.c
index 1c3382fefdd2..547d4fc99131 100644
--- a/arch/arm/mach-s3c2440/mach-mini2440.c
+++ b/arch/arm/mach-s3c2440/mach-mini2440.c
@@ -532,7 +532,6 @@ static void __init mini2440_map_io(void)
532 s3c24xx_init_clocks(12000000); 532 s3c24xx_init_clocks(12000000);
533 s3c24xx_init_uarts(mini2440_uartcfgs, ARRAY_SIZE(mini2440_uartcfgs)); 533 s3c24xx_init_uarts(mini2440_uartcfgs, ARRAY_SIZE(mini2440_uartcfgs));
534 534
535 s3c_device_nand.dev.platform_data = &mini2440_nand_info;
536 s3c_device_sdi.dev.platform_data = &mini2440_mmc_cfg; 535 s3c_device_sdi.dev.platform_data = &mini2440_mmc_cfg;
537} 536}
538 537
@@ -677,8 +676,11 @@ static void __init mini2440_init(void)
677 printk("\n"); 676 printk("\n");
678 s3c24xx_fb_set_platdata(&mini2440_fb_info); 677 s3c24xx_fb_set_platdata(&mini2440_fb_info);
679 } 678 }
679
680 s3c24xx_udc_set_platdata(&mini2440_udc_cfg); 680 s3c24xx_udc_set_platdata(&mini2440_udc_cfg);
681 s3c_nand_set_platdata(&mini2440_nand_info);
681 s3c_i2c0_set_platdata(NULL); 682 s3c_i2c0_set_platdata(NULL);
683
682 i2c_register_board_info(0, mini2440_i2c_devs, 684 i2c_register_board_info(0, mini2440_i2c_devs,
683 ARRAY_SIZE(mini2440_i2c_devs)); 685 ARRAY_SIZE(mini2440_i2c_devs));
684 686
diff --git a/arch/arm/mach-s3c2440/mach-osiris-dvs.c b/arch/arm/mach-s3c2440/mach-osiris-dvs.c
new file mode 100644
index 000000000000..ad2792dfbee1
--- /dev/null
+++ b/arch/arm/mach-s3c2440/mach-osiris-dvs.c
@@ -0,0 +1,194 @@
1/* linux/arch/arm/mach-s3c2440/mach-osiris-dvs.c
2 *
3 * Copyright (c) 2009 Simtec Electronics
4 * http://armlinux.simtec.co.uk/
5 * Ben Dooks <ben@simtec.co.uk>
6 *
7 * Simtec Osiris Dynamic Voltage Scaling support.
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12*/
13
14#include <linux/kernel.h>
15#include <linux/module.h>
16#include <linux/platform_device.h>
17#include <linux/cpufreq.h>
18#include <linux/gpio.h>
19
20#include <linux/i2c/tps65010.h>
21
22#include <plat/cpu-freq.h>
23
24#define OSIRIS_GPIO_DVS S3C2410_GPB(5)
25
26static bool dvs_en;
27
28static void osiris_dvs_tps_setdvs(bool on)
29{
30 unsigned vregs1 = 0, vdcdc2 = 0;
31
32 if (!on) {
33 vdcdc2 = TPS_VCORE_DISCH | TPS_LP_COREOFF;
34 vregs1 = TPS_LDO1_OFF; /* turn off in low-power mode */
35 }
36
37 dvs_en = on;
38 vdcdc2 |= TPS_VCORE_1_3V | TPS_VCORE_LP_1_0V;
39 vregs1 |= TPS_LDO2_ENABLE | TPS_LDO1_ENABLE;
40
41 tps65010_config_vregs1(vregs1);
42 tps65010_config_vdcdc2(vdcdc2);
43}
44
45static bool is_dvs(struct s3c_freq *f)
46{
47 /* at the moment, we assume ARMCLK = HCLK => DVS */
48 return f->armclk == f->hclk;
49}
50
51/* keep track of current state */
52static bool cur_dvs = false;
53
54static int osiris_dvs_notify(struct notifier_block *nb,
55 unsigned long val, void *data)
56{
57 struct cpufreq_freqs *cf = data;
58 struct s3c_cpufreq_freqs *freqs = to_s3c_cpufreq(cf);
59 bool old_dvs = is_dvs(&freqs->old);
60 bool new_dvs = is_dvs(&freqs->new);
61 int ret = 0;
62
63 if (!dvs_en)
64 return 0;
65
66 printk(KERN_DEBUG "%s: old %ld,%ld new %ld,%ld\n", __func__,
67 freqs->old.armclk, freqs->old.hclk,
68 freqs->new.armclk, freqs->new.hclk);
69
70 switch (val) {
71 case CPUFREQ_PRECHANGE:
72 if (old_dvs & !new_dvs ||
73 cur_dvs & !new_dvs) {
74 pr_debug("%s: exiting dvs\n", __func__);
75 cur_dvs = false;
76 gpio_set_value(OSIRIS_GPIO_DVS, 1);
77 }
78 break;
79 case CPUFREQ_POSTCHANGE:
80 if (!old_dvs & new_dvs ||
81 !cur_dvs & new_dvs) {
82 pr_debug("entering dvs\n");
83 cur_dvs = true;
84 gpio_set_value(OSIRIS_GPIO_DVS, 0);
85 }
86 break;
87 }
88
89 return ret;
90}
91
92static struct notifier_block osiris_dvs_nb = {
93 .notifier_call = osiris_dvs_notify,
94};
95
96static int __devinit osiris_dvs_probe(struct platform_device *pdev)
97{
98 int ret;
99
100 dev_info(&pdev->dev, "initialising\n");
101
102 ret = gpio_request(OSIRIS_GPIO_DVS, "osiris-dvs");
103 if (ret) {
104 dev_err(&pdev->dev, "cannot claim gpio\n");
105 goto err_nogpio;
106 }
107
108 /* start with dvs disabled */
109 gpio_direction_output(OSIRIS_GPIO_DVS, 1);
110
111 ret = cpufreq_register_notifier(&osiris_dvs_nb,
112 CPUFREQ_TRANSITION_NOTIFIER);
113 if (ret) {
114 dev_err(&pdev->dev, "failed to register with cpufreq\n");
115 goto err_nofreq;
116 }
117
118 osiris_dvs_tps_setdvs(true);
119
120 return 0;
121
122err_nofreq:
123 gpio_free(OSIRIS_GPIO_DVS);
124
125err_nogpio:
126 return ret;
127}
128
129static int __devexit osiris_dvs_remove(struct platform_device *pdev)
130{
131 dev_info(&pdev->dev, "exiting\n");
132
133 /* disable any current dvs */
134 gpio_set_value(OSIRIS_GPIO_DVS, 1);
135 osiris_dvs_tps_setdvs(false);
136
137 cpufreq_unregister_notifier(&osiris_dvs_nb,
138 CPUFREQ_TRANSITION_NOTIFIER);
139
140 gpio_free(OSIRIS_GPIO_DVS);
141
142 return 0;
143}
144
145/* the CONFIG_PM block is so small, it isn't worth actaully compiling it
146 * out if the configuration isn't set. */
147
148static int osiris_dvs_suspend(struct device *dev)
149{
150 gpio_set_value(OSIRIS_GPIO_DVS, 1);
151 osiris_dvs_tps_setdvs(false);
152 cur_dvs = false;
153
154 return 0;
155}
156
157static int osiris_dvs_resume(struct device *dev)
158{
159 osiris_dvs_tps_setdvs(true);
160 return 0;
161}
162
163static const struct dev_pm_ops osiris_dvs_pm = {
164 .suspend = osiris_dvs_suspend,
165 .resume = osiris_dvs_resume,
166};
167
168static struct platform_driver osiris_dvs_driver = {
169 .probe = osiris_dvs_probe,
170 .remove = __devexit_p(osiris_dvs_remove),
171 .driver = {
172 .name = "osiris-dvs",
173 .owner = THIS_MODULE,
174 .pm = &osiris_dvs_pm,
175 },
176};
177
178static int __init osiris_dvs_init(void)
179{
180 return platform_driver_register(&osiris_dvs_driver);
181}
182
183static void __exit osiris_dvs_exit(void)
184{
185 platform_driver_unregister(&osiris_dvs_driver);
186}
187
188module_init(osiris_dvs_init);
189module_exit(osiris_dvs_exit);
190
191MODULE_DESCRIPTION("Simtec OSIRIS DVS support");
192MODULE_AUTHOR("Ben Dooks <ben@simtec.co.uk>");
193MODULE_LICENSE("GPL");
194MODULE_ALIAS("platform:osiris-dvs");
diff --git a/arch/arm/mach-s3c2440/mach-osiris.c b/arch/arm/mach-s3c2440/mach-osiris.c
index 2105a41281a4..015dfb2a80da 100644
--- a/arch/arm/mach-s3c2440/mach-osiris.c
+++ b/arch/arm/mach-s3c2440/mach-osiris.c
@@ -1,6 +1,6 @@
1/* linux/arch/arm/mach-s3c2440/mach-osiris.c 1/* linux/arch/arm/mach-s3c2440/mach-osiris.c
2 * 2 *
3 * Copyright (c) 2005,2008 Simtec Electronics 3 * Copyright (c) 2005-2008 Simtec Electronics
4 * http://armlinux.simtec.co.uk/ 4 * http://armlinux.simtec.co.uk/
5 * Ben Dooks <ben@simtec.co.uk> 5 * Ben Dooks <ben@simtec.co.uk>
6 * 6 *
@@ -23,6 +23,8 @@
23#include <linux/i2c.h> 23#include <linux/i2c.h>
24#include <linux/io.h> 24#include <linux/io.h>
25 25
26#include <linux/i2c/tps65010.h>
27
26#include <asm/mach/arch.h> 28#include <asm/mach/arch.h>
27#include <asm/mach/map.h> 29#include <asm/mach/map.h>
28#include <asm/mach/irq.h> 30#include <asm/mach/irq.h>
@@ -148,7 +150,7 @@ static int external_map[] = { 2 };
148static int chip0_map[] = { 0 }; 150static int chip0_map[] = { 0 };
149static int chip1_map[] = { 1 }; 151static int chip1_map[] = { 1 };
150 152
151static struct mtd_partition osiris_default_nand_part[] = { 153static struct mtd_partition __initdata osiris_default_nand_part[] = {
152 [0] = { 154 [0] = {
153 .name = "Boot Agent", 155 .name = "Boot Agent",
154 .size = SZ_16K, 156 .size = SZ_16K,
@@ -171,7 +173,7 @@ static struct mtd_partition osiris_default_nand_part[] = {
171 } 173 }
172}; 174};
173 175
174static struct mtd_partition osiris_default_nand_part_large[] = { 176static struct mtd_partition __initdata osiris_default_nand_part_large[] = {
175 [0] = { 177 [0] = {
176 .name = "Boot Agent", 178 .name = "Boot Agent",
177 .size = SZ_128K, 179 .size = SZ_128K,
@@ -201,7 +203,7 @@ static struct mtd_partition osiris_default_nand_part_large[] = {
201 * socket. 203 * socket.
202*/ 204*/
203 205
204static struct s3c2410_nand_set osiris_nand_sets[] = { 206static struct s3c2410_nand_set __initdata osiris_nand_sets[] = {
205 [1] = { 207 [1] = {
206 .name = "External", 208 .name = "External",
207 .nr_chips = 1, 209 .nr_chips = 1,
@@ -243,7 +245,7 @@ static void osiris_nand_select(struct s3c2410_nand_set *set, int slot)
243 __raw_writeb(tmp, OSIRIS_VA_CTRL0); 245 __raw_writeb(tmp, OSIRIS_VA_CTRL0);
244} 246}
245 247
246static struct s3c2410_platform_nand osiris_nand_info = { 248static struct s3c2410_platform_nand __initdata osiris_nand_info = {
247 .tacls = 25, 249 .tacls = 25,
248 .twrph0 = 60, 250 .twrph0 = 60,
249 .twrph1 = 60, 251 .twrph1 = 60,
@@ -326,12 +328,44 @@ static struct sys_device osiris_pm_sysdev = {
326 .cls = &osiris_pm_sysclass, 328 .cls = &osiris_pm_sysclass,
327}; 329};
328 330
331/* Link for DVS driver to TPS65011 */
332
333static void osiris_tps_release(struct device *dev)
334{
335 /* static device, do not need to release anything */
336}
337
338static struct platform_device osiris_tps_device = {
339 .name = "osiris-dvs",
340 .id = -1,
341 .dev.release = osiris_tps_release,
342};
343
344static int osiris_tps_setup(struct i2c_client *client, void *context)
345{
346 osiris_tps_device.dev.parent = &client->dev;
347 return platform_device_register(&osiris_tps_device);
348}
349
350static int osiris_tps_remove(struct i2c_client *client, void *context)
351{
352 platform_device_unregister(&osiris_tps_device);
353 return 0;
354}
355
356static struct tps65010_board osiris_tps_board = {
357 .base = -1, /* GPIO can go anywhere at the moment */
358 .setup = osiris_tps_setup,
359 .teardown = osiris_tps_remove,
360};
361
329/* I2C devices fitted. */ 362/* I2C devices fitted. */
330 363
331static struct i2c_board_info osiris_i2c_devs[] __initdata = { 364static struct i2c_board_info osiris_i2c_devs[] __initdata = {
332 { 365 {
333 I2C_BOARD_INFO("tps65011", 0x48), 366 I2C_BOARD_INFO("tps65011", 0x48),
334 .irq = IRQ_EINT20, 367 .irq = IRQ_EINT20,
368 .platform_data = &osiris_tps_board,
335 }, 369 },
336}; 370};
337 371
@@ -377,8 +411,6 @@ static void __init osiris_map_io(void)
377 411
378 s3c24xx_register_clocks(osiris_clocks, ARRAY_SIZE(osiris_clocks)); 412 s3c24xx_register_clocks(osiris_clocks, ARRAY_SIZE(osiris_clocks));
379 413
380 s3c_device_nand.dev.platform_data = &osiris_nand_info;
381
382 s3c24xx_init_io(osiris_iodesc, ARRAY_SIZE(osiris_iodesc)); 414 s3c24xx_init_io(osiris_iodesc, ARRAY_SIZE(osiris_iodesc));
383 s3c24xx_init_clocks(0); 415 s3c24xx_init_clocks(0);
384 s3c24xx_init_uarts(osiris_uartcfgs, ARRAY_SIZE(osiris_uartcfgs)); 416 s3c24xx_init_uarts(osiris_uartcfgs, ARRAY_SIZE(osiris_uartcfgs));
@@ -408,6 +440,7 @@ static void __init osiris_init(void)
408 sysdev_register(&osiris_pm_sysdev); 440 sysdev_register(&osiris_pm_sysdev);
409 441
410 s3c_i2c0_set_platdata(NULL); 442 s3c_i2c0_set_platdata(NULL);
443 s3c_nand_set_platdata(&osiris_nand_info);
411 444
412 s3c_cpufreq_setboard(&osiris_cpufreq); 445 s3c_cpufreq_setboard(&osiris_cpufreq);
413 446
diff --git a/arch/arm/mach-s3c2440/mach-rx3715.c b/arch/arm/mach-s3c2440/mach-rx3715.c
index bc8d8d1ebd1a..a952a13afb1f 100644
--- a/arch/arm/mach-s3c2440/mach-rx3715.c
+++ b/arch/arm/mach-s3c2440/mach-rx3715.c
@@ -1,6 +1,6 @@
1/* linux/arch/arm/mach-s3c2440/mach-rx3715.c 1/* linux/arch/arm/mach-s3c2440/mach-rx3715.c
2 * 2 *
3 * Copyright (c) 2003,2004 Simtec Electronics 3 * Copyright (c) 2003-2004 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk> 4 * Ben Dooks <ben@simtec.co.uk>
5 * 5 *
6 * http://www.handhelds.org/projects/rx3715.html 6 * http://www.handhelds.org/projects/rx3715.html
@@ -149,7 +149,7 @@ static struct s3c2410fb_mach_info rx3715_fb_info __initdata = {
149 .gpdup_mask = 0xffffffff, 149 .gpdup_mask = 0xffffffff,
150}; 150};
151 151
152static struct mtd_partition rx3715_nand_part[] = { 152static struct mtd_partition __initdata rx3715_nand_part[] = {
153 [0] = { 153 [0] = {
154 .name = "Whole Flash", 154 .name = "Whole Flash",
155 .offset = 0, 155 .offset = 0,
@@ -158,7 +158,7 @@ static struct mtd_partition rx3715_nand_part[] = {
158 } 158 }
159}; 159};
160 160
161static struct s3c2410_nand_set rx3715_nand_sets[] = { 161static struct s3c2410_nand_set __initdata rx3715_nand_sets[] = {
162 [0] = { 162 [0] = {
163 .name = "Internal", 163 .name = "Internal",
164 .nr_chips = 1, 164 .nr_chips = 1,
@@ -167,7 +167,7 @@ static struct s3c2410_nand_set rx3715_nand_sets[] = {
167 }, 167 },
168}; 168};
169 169
170static struct s3c2410_platform_nand rx3715_nand_info = { 170static struct s3c2410_platform_nand __initdata rx3715_nand_info = {
171 .tacls = 25, 171 .tacls = 25,
172 .twrph0 = 50, 172 .twrph0 = 50,
173 .twrph1 = 15, 173 .twrph1 = 15,
@@ -186,8 +186,6 @@ static struct platform_device *rx3715_devices[] __initdata = {
186 186
187static void __init rx3715_map_io(void) 187static void __init rx3715_map_io(void)
188{ 188{
189 s3c_device_nand.dev.platform_data = &rx3715_nand_info;
190
191 s3c24xx_init_io(rx3715_iodesc, ARRAY_SIZE(rx3715_iodesc)); 189 s3c24xx_init_io(rx3715_iodesc, ARRAY_SIZE(rx3715_iodesc));
192 s3c24xx_init_clocks(16934000); 190 s3c24xx_init_clocks(16934000);
193 s3c24xx_init_uarts(rx3715_uartcfgs, ARRAY_SIZE(rx3715_uartcfgs)); 191 s3c24xx_init_uarts(rx3715_uartcfgs, ARRAY_SIZE(rx3715_uartcfgs));
@@ -205,6 +203,7 @@ static void __init rx3715_init_machine(void)
205#endif 203#endif
206 s3c_pm_init(); 204 s3c_pm_init();
207 205
206 s3c_nand_set_platdata(&rx3715_nand_info);
208 s3c24xx_fb_set_platdata(&rx3715_fb_info); 207 s3c24xx_fb_set_platdata(&rx3715_fb_info);
209 platform_add_devices(rx3715_devices, ARRAY_SIZE(rx3715_devices)); 208 platform_add_devices(rx3715_devices, ARRAY_SIZE(rx3715_devices));
210} 209}
diff --git a/arch/arm/mach-s3c2440/mach-smdk2440.c b/arch/arm/mach-s3c2440/mach-smdk2440.c
index db6eafbd4d90..ec13e748ccc5 100644
--- a/arch/arm/mach-s3c2440/mach-smdk2440.c
+++ b/arch/arm/mach-s3c2440/mach-smdk2440.c
@@ -1,6 +1,6 @@
1/* linux/arch/arm/mach-s3c2440/mach-smdk2440.c 1/* linux/arch/arm/mach-s3c2440/mach-smdk2440.c
2 * 2 *
3 * Copyright (c) 2004,2005 Simtec Electronics 3 * Copyright (c) 2004-2005 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk> 4 * Ben Dooks <ben@simtec.co.uk>
5 * 5 *
6 * http://www.fluff.org/ben/smdk2440/ 6 * http://www.fluff.org/ben/smdk2440/
diff --git a/arch/arm/mach-s3c2442/mach-gta02.c b/arch/arm/mach-s3c2442/mach-gta02.c
index 0fb385bd9cd9..f76d6ff4aeb9 100644
--- a/arch/arm/mach-s3c2442/mach-gta02.c
+++ b/arch/arm/mach-s3c2442/mach-gta02.c
@@ -423,7 +423,7 @@ static struct i2c_board_info gta02_i2c_devs[] __initdata = {
423 }, 423 },
424}; 424};
425 425
426static struct s3c2410_nand_set gta02_nand_sets[] = { 426static struct s3c2410_nand_set __initdata gta02_nand_sets[] = {
427 [0] = { 427 [0] = {
428 /* 428 /*
429 * This name is also hard-coded in the boot loaders, so 429 * This name is also hard-coded in the boot loaders, so
@@ -442,7 +442,7 @@ static struct s3c2410_nand_set gta02_nand_sets[] = {
442 * data sheet (K5D2G13ACM-D075 MCP Memory). 442 * data sheet (K5D2G13ACM-D075 MCP Memory).
443 */ 443 */
444 444
445static struct s3c2410_platform_nand gta02_nand_info = { 445static struct s3c2410_platform_nand __initdata gta02_nand_info = {
446 .tacls = 0, 446 .tacls = 0,
447 .twrph0 = 25, 447 .twrph0 = 25,
448 .twrph1 = 15, 448 .twrph1 = 15,
@@ -621,9 +621,9 @@ static void __init gta02_machine_init(void)
621#endif 621#endif
622 622
623 s3c_device_usb.dev.platform_data = &gta02_usb_info; 623 s3c_device_usb.dev.platform_data = &gta02_usb_info;
624 s3c_device_nand.dev.platform_data = &gta02_nand_info;
625 624
626 s3c24xx_udc_set_platdata(&gta02_udc_cfg); 625 s3c24xx_udc_set_platdata(&gta02_udc_cfg);
626 s3c_nand_set_platdata(&gta02_nand_info);
627 s3c_i2c0_set_platdata(NULL); 627 s3c_i2c0_set_platdata(NULL);
628 628
629 i2c_register_board_info(0, gta02_i2c_devs, ARRAY_SIZE(gta02_i2c_devs)); 629 i2c_register_board_info(0, gta02_i2c_devs, ARRAY_SIZE(gta02_i2c_devs));
diff --git a/arch/arm/mach-s3c24a0/include/mach/map.h b/arch/arm/mach-s3c24a0/include/mach/map.h
index 79e4d93ea2b6..d88c8b24fe34 100644
--- a/arch/arm/mach-s3c24a0/include/mach/map.h
+++ b/arch/arm/mach-s3c24a0/include/mach/map.h
@@ -1,6 +1,6 @@
1/* linux/arch/arm/mach-s3c24a0/include/mach/map.h 1/* linux/arch/arm/mach-s3c24a0/include/mach/map.h
2 * 2 *
3 * Copyright 2003,2007 Simtec Electronics 3 * Copyright 2003-2007 Simtec Electronics
4 * http://armlinux.simtec.co.uk/ 4 * http://armlinux.simtec.co.uk/
5 * Ben Dooks <ben@simtec.co.uk> 5 * Ben Dooks <ben@simtec.co.uk>
6 * 6 *
diff --git a/arch/arm/mach-s3c24a0/include/mach/regs-clock.h b/arch/arm/mach-s3c24a0/include/mach/regs-clock.h
index af2abd756c30..be0af518b488 100644
--- a/arch/arm/mach-s3c24a0/include/mach/regs-clock.h
+++ b/arch/arm/mach-s3c24a0/include/mach/regs-clock.h
@@ -1,7 +1,7 @@
1/* linux/arch/arm/mach-s3c24a0/include/mach/regs-clock.h 1/* linux/arch/arm/mach-s3c24a0/include/mach/regs-clock.h
2 * 2 *
3 * Copyright (c) 2003,2004,2005,2006 Simtec Electronics <linux@simtec.co.uk> 3 * Copyright (c) 2003-2006 Simtec Electronics <linux@simtec.co.uk>
4 * http://armlinux.simtec.co.uk/ 4 * http://armlinux.simtec.co.uk/
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify 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 7 * it under the terms of the GNU General Public License version 2 as
diff --git a/arch/arm/mach-s3c6400/include/mach/map.h b/arch/arm/mach-s3c6400/include/mach/map.h
index fc8b223bad4f..f3b48f841d84 100644
--- a/arch/arm/mach-s3c6400/include/mach/map.h
+++ b/arch/arm/mach-s3c6400/include/mach/map.h
@@ -64,6 +64,9 @@
64 64
65#define S3C64XX_PA_USBHOST (0x74300000) 65#define S3C64XX_PA_USBHOST (0x74300000)
66 66
67#define S3C64XX_PA_USB_HSPHY (0x7C100000)
68#define S3C64XX_VA_USB_HSPHY S3C_ADDR_CPU(0x00200000)
69
67/* place VICs close together */ 70/* place VICs close together */
68#define S3C_VA_VIC0 (S3C_VA_IRQ + 0x00) 71#define S3C_VA_VIC0 (S3C_VA_IRQ + 0x00)
69#define S3C_VA_VIC1 (S3C_VA_IRQ + 0x10000) 72#define S3C_VA_VIC1 (S3C_VA_IRQ + 0x10000)
@@ -79,5 +82,6 @@
79#define S3C_PA_FB S3C64XX_PA_FB 82#define S3C_PA_FB S3C64XX_PA_FB
80#define S3C_PA_USBHOST S3C64XX_PA_USBHOST 83#define S3C_PA_USBHOST S3C64XX_PA_USBHOST
81#define S3C_PA_USB_HSOTG S3C64XX_PA_USB_HSOTG 84#define S3C_PA_USB_HSOTG S3C64XX_PA_USB_HSOTG
85#define S3C_VA_USB_HSPHY S3C64XX_VA_USB_HSPHY
82 86
83#endif /* __ASM_ARCH_6400_MAP_H */ 87#endif /* __ASM_ARCH_6400_MAP_H */
diff --git a/arch/arm/mach-s3c6400/include/mach/regs-fb.h b/arch/arm/mach-s3c6400/include/mach/regs-fb.h
index 47019795ce06..f56611526c63 100644
--- a/arch/arm/mach-s3c6400/include/mach/regs-fb.h
+++ b/arch/arm/mach-s3c6400/include/mach/regs-fb.h
@@ -1,195 +1,30 @@
1/* arch/arm/mach-s3c6400/include/mach/regs-fb.h 1/*
2 *
3 * Copyright 2008 Openmoko, Inc. 2 * Copyright 2008 Openmoko, Inc.
4 * Copyright 2008 Simtec Electronics 3 * Copyright 2008 Simtec Electronics
5 * http://armlinux.simtec.co.uk/ 4 * Copyright 2009 Samsung Electronics Co.
6 * Ben Dooks <ben@simtec.co.uk>
7 *
8 * S3C64XX - new-style framebuffer register definitions
9 * 5 *
10 * This is the register set for the new style framebuffer interface 6 * Pawel Osciak <p.osciak@samsung.com>
11 * found from the S3C2443 onwards and specifically the S3C64XX series 7 * Based on plat-s3c/include/plat/regs-fb.h by Ben Dooks <ben@simtec.co.uk>
12 * S3C6400 and S3C6410.
13 * 8 *
14 * The file contains the cpu specific items which change between whichever 9 * Framebuffer register definitions for Samsung S3C64xx.
15 * architecture is selected. See <plat/regs-fb.h> for the core definitions
16 * that are the same.
17 * 10 *
18 * This program is free software; you can redistribute it and/or modify 11 * This program is free software; you can redistribute it and/or modify
19 * it under the terms of the GNU General Public License version 2 as 12 * it under the terms of the GNU General Public License version 2 as
20 * published by the Free Software Foundation. 13 * published by the Free Software Foundation.
21*/ 14*/
22 15
23/* include the core definitions here, in case we really do need to 16#ifndef __ASM_ARCH_MACH_REGS_FB_H
24 * override them at a later date. 17#define __ASM_ARCH_MACH_REGS_FB_H __FILE__
25*/
26
27#include <plat/regs-fb.h>
28
29#define S3C_FB_MAX_WIN (5) /* number of hardware windows available. */
30#define VIDCON1_FSTATUS_EVEN (1 << 15)
31
32/* Video timing controls */
33#define VIDTCON0 (0x10)
34#define VIDTCON1 (0x14)
35#define VIDTCON2 (0x18)
36
37/* Window position controls */
38
39#define WINCON(_win) (0x20 + ((_win) * 4))
40
41/* OSD1 and OSD4 do not have register D */
42
43#define VIDOSD_A(_win) (0x40 + ((_win) * 16))
44#define VIDOSD_B(_win) (0x44 + ((_win) * 16))
45#define VIDOSD_C(_win) (0x48 + ((_win) * 16))
46#define VIDOSD_D(_win) (0x4C + ((_win) * 16))
47
48/* Video buffer addresses */
49
50#define VIDW_BUF_START(_buff) (0xA0 + ((_buff) * 8))
51#define VIDW_BUF_START1(_buff) (0xA4 + ((_buff) * 8))
52#define VIDW_BUF_END(_buff) (0xD0 + ((_buff) * 8))
53#define VIDW_BUF_END1(_buff) (0xD4 + ((_buff) * 8))
54#define VIDW_BUF_SIZE(_buff) (0x100 + ((_buff) * 4))
55
56#define VIDINTCON0 (0x130)
57
58#define WxKEYCONy(_win, _con) ((0x140 + ((_win) * 8)) + ((_con) * 4))
59
60/* WINCONx */
61
62#define WINCONx_CSCWIDTH_MASK (0x3 << 26)
63#define WINCONx_CSCWIDTH_SHIFT (26)
64#define WINCONx_CSCWIDTH_WIDE (0x0 << 26)
65#define WINCONx_CSCWIDTH_NARROW (0x3 << 26)
66
67#define WINCONx_ENLOCAL (1 << 22)
68#define WINCONx_BUFSTATUS (1 << 21)
69#define WINCONx_BUFSEL (1 << 20)
70#define WINCONx_BUFAUTOEN (1 << 19)
71#define WINCONx_YCbCr (1 << 13)
72
73#define WINCON1_LOCALSEL_CAMIF (1 << 23)
74
75#define WINCON2_LOCALSEL_CAMIF (1 << 23)
76#define WINCON2_BLD_PIX (1 << 6)
77
78#define WINCON2_ALPHA_SEL (1 << 1)
79#define WINCON2_BPPMODE_MASK (0xf << 2)
80#define WINCON2_BPPMODE_SHIFT (2)
81#define WINCON2_BPPMODE_1BPP (0x0 << 2)
82#define WINCON2_BPPMODE_2BPP (0x1 << 2)
83#define WINCON2_BPPMODE_4BPP (0x2 << 2)
84#define WINCON2_BPPMODE_8BPP_1232 (0x4 << 2)
85#define WINCON2_BPPMODE_16BPP_565 (0x5 << 2)
86#define WINCON2_BPPMODE_16BPP_A1555 (0x6 << 2)
87#define WINCON2_BPPMODE_16BPP_I1555 (0x7 << 2)
88#define WINCON2_BPPMODE_18BPP_666 (0x8 << 2)
89#define WINCON2_BPPMODE_18BPP_A1665 (0x9 << 2)
90#define WINCON2_BPPMODE_19BPP_A1666 (0xa << 2)
91#define WINCON2_BPPMODE_24BPP_888 (0xb << 2)
92#define WINCON2_BPPMODE_24BPP_A1887 (0xc << 2)
93#define WINCON2_BPPMODE_25BPP_A1888 (0xd << 2)
94#define WINCON2_BPPMODE_28BPP_A4888 (0xd << 2)
95
96#define WINCON3_BLD_PIX (1 << 6)
97
98#define WINCON3_ALPHA_SEL (1 << 1)
99#define WINCON3_BPPMODE_MASK (0xf << 2)
100#define WINCON3_BPPMODE_SHIFT (2)
101#define WINCON3_BPPMODE_1BPP (0x0 << 2)
102#define WINCON3_BPPMODE_2BPP (0x1 << 2)
103#define WINCON3_BPPMODE_4BPP (0x2 << 2)
104#define WINCON3_BPPMODE_16BPP_565 (0x5 << 2)
105#define WINCON3_BPPMODE_16BPP_A1555 (0x6 << 2)
106#define WINCON3_BPPMODE_16BPP_I1555 (0x7 << 2)
107#define WINCON3_BPPMODE_18BPP_666 (0x8 << 2)
108#define WINCON3_BPPMODE_18BPP_A1665 (0x9 << 2)
109#define WINCON3_BPPMODE_19BPP_A1666 (0xa << 2)
110#define WINCON3_BPPMODE_24BPP_888 (0xb << 2)
111#define WINCON3_BPPMODE_24BPP_A1887 (0xc << 2)
112#define WINCON3_BPPMODE_25BPP_A1888 (0xd << 2)
113#define WINCON3_BPPMODE_28BPP_A4888 (0xd << 2)
114
115#define VIDINTCON0_FIFIOSEL_WINDOW2 (0x10 << 5)
116#define VIDINTCON0_FIFIOSEL_WINDOW3 (0x20 << 5)
117#define VIDINTCON0_FIFIOSEL_WINDOW4 (0x40 << 5)
118
119#define DITHMODE (0x170)
120#define WINxMAP(_win) (0x180 + ((_win) * 4))
121
122
123#define DITHMODE_R_POS_MASK (0x3 << 5)
124#define DITHMODE_R_POS_SHIFT (5)
125#define DITHMODE_R_POS_8BIT (0x0 << 5)
126#define DITHMODE_R_POS_6BIT (0x1 << 5)
127#define DITHMODE_R_POS_5BIT (0x2 << 5)
128
129#define DITHMODE_G_POS_MASK (0x3 << 3)
130#define DITHMODE_G_POS_SHIFT (3)
131#define DITHMODE_G_POS_8BIT (0x0 << 3)
132#define DITHMODE_G_POS_6BIT (0x1 << 3)
133#define DITHMODE_G_POS_5BIT (0x2 << 3)
134
135#define DITHMODE_B_POS_MASK (0x3 << 1)
136#define DITHMODE_B_POS_SHIFT (1)
137#define DITHMODE_B_POS_8BIT (0x0 << 1)
138#define DITHMODE_B_POS_6BIT (0x1 << 1)
139#define DITHMODE_B_POS_5BIT (0x2 << 1)
140 18
141#define DITHMODE_DITH_EN (1 << 0) 19#include <plat/regs-fb-v4.h>
142
143#define WPALCON (0x1A0)
144
145#define WPALCON_W4PAL_16BPP_A555 (1 << 8)
146#define WPALCON_W3PAL_16BPP_A555 (1 << 7)
147#define WPALCON_W2PAL_16BPP_A555 (1 << 6)
148 20
149/* Palette registers */ 21/* Palette registers */
150
151#define WIN2_PAL(_entry) (0x300 + ((_entry) * 2)) 22#define WIN2_PAL(_entry) (0x300 + ((_entry) * 2))
152#define WIN3_PAL(_entry) (0x320 + ((_entry) * 2)) 23#define WIN3_PAL(_entry) (0x320 + ((_entry) * 2))
153#define WIN4_PAL(_entry) (0x340 + ((_entry) * 2)) 24#define WIN4_PAL(_entry) (0x340 + ((_entry) * 2))
154#define WIN0_PAL(_entry) (0x400 + ((_entry) * 4)) 25#define WIN0_PAL(_entry) (0x400 + ((_entry) * 4))
155#define WIN1_PAL(_entry) (0x800 + ((_entry) * 4)) 26#define WIN1_PAL(_entry) (0x800 + ((_entry) * 4))
156 27
157/* system specific implementation code for palette sizes, and other
158 * information that changes depending on which architecture is being
159 * compiled.
160*/
161
162/* return true if window _win has OSD register D */
163#define s3c_fb_has_osd_d(_win) ((_win) != 4 && (_win) != 0)
164
165static inline unsigned int s3c_fb_win_pal_size(unsigned int win)
166{
167 if (win < 2)
168 return 256;
169 if (win < 4)
170 return 16;
171 if (win == 4)
172 return 4;
173
174 BUG(); /* shouldn't get here */
175}
176
177static inline int s3c_fb_validate_win_bpp(unsigned int win, unsigned int bpp)
178{
179 /* all windows can do 1/2 bpp */
180
181 if ((bpp == 25 || bpp == 19) && win == 0)
182 return 0; /* win 0 does not have 19 or 25bpp modes */
183
184 if (bpp == 4 && win == 4)
185 return 0;
186
187 if (bpp == 8 && (win >= 3))
188 return 0; /* win 3/4 cannot do 8bpp in any mode */
189
190 return 1;
191}
192
193static inline unsigned int s3c_fb_pal_reg(unsigned int window, int reg) 28static inline unsigned int s3c_fb_pal_reg(unsigned int window, int reg)
194{ 29{
195 switch (window) { 30 switch (window) {
@@ -203,57 +38,4 @@ static inline unsigned int s3c_fb_pal_reg(unsigned int window, int reg)
203 BUG(); 38 BUG();
204} 39}
205 40
206static inline int s3c_fb_pal_is16(unsigned int window) 41#endif /* __ASM_ARCH_MACH_REGS_FB_H */
207{
208 return window > 1;
209}
210
211struct s3c_fb_palette {
212 struct fb_bitfield r;
213 struct fb_bitfield g;
214 struct fb_bitfield b;
215 struct fb_bitfield a;
216};
217
218static inline void s3c_fb_init_palette(unsigned int window,
219 struct s3c_fb_palette *palette)
220{
221 if (window < 2) {
222 /* Windows 0/1 are 8/8/8 or A/8/8/8 */
223 palette->r.offset = 16;
224 palette->r.length = 8;
225 palette->g.offset = 8;
226 palette->g.length = 8;
227 palette->b.offset = 0;
228 palette->b.length = 8;
229 } else {
230 /* currently we assume RGB 5/6/5 */
231 palette->r.offset = 11;
232 palette->r.length = 5;
233 palette->g.offset = 5;
234 palette->g.length = 6;
235 palette->b.offset = 0;
236 palette->b.length = 5;
237 }
238}
239
240/* Notes on per-window bpp settings
241 *
242 * Value Win0 Win1 Win2 Win3 Win 4
243 * 0000 1(P) 1(P) 1(P) 1(P) 1(P)
244 * 0001 2(P) 2(P) 2(P) 2(P) 2(P)
245 * 0010 4(P) 4(P) 4(P) 4(P) -none-
246 * 0011 8(P) 8(P) -none- -none- -none-
247 * 0100 -none- 8(A232) 8(A232) -none- -none-
248 * 0101 16(565) 16(565) 16(565) 16(565) 16(565)
249 * 0110 -none- 16(A555) 16(A555) 16(A555) 16(A555)
250 * 0111 16(I555) 16(I565) 16(I555) 16(I555) 16(I555)
251 * 1000 18(666) 18(666) 18(666) 18(666) 18(666)
252 * 1001 -none- 18(A665) 18(A665) 18(A665) 16(A665)
253 * 1010 -none- 19(A666) 19(A666) 19(A666) 19(A666)
254 * 1011 24(888) 24(888) 24(888) 24(888) 24(888)
255 * 1100 -none- 24(A887) 24(A887) 24(A887) 24(A887)
256 * 1101 -none- 25(A888) 25(A888) 25(A888) 25(A888)
257 * 1110 -none- -none- -none- -none- -none-
258 * 1111 -none- -none- -none- -none- -none-
259*/
diff --git a/arch/arm/mach-s3c6400/s3c6400.c b/arch/arm/mach-s3c6400/s3c6400.c
index b42bdd0f2138..d876ee503671 100644
--- a/arch/arm/mach-s3c6400/s3c6400.c
+++ b/arch/arm/mach-s3c6400/s3c6400.c
@@ -45,6 +45,7 @@ void __init s3c6400_map_io(void)
45 45
46 s3c6400_default_sdhci0(); 46 s3c6400_default_sdhci0();
47 s3c6400_default_sdhci1(); 47 s3c6400_default_sdhci1();
48 s3c6400_default_sdhci2();
48 49
49 /* the i2c devices are directly compatible with s3c2440 */ 50 /* the i2c devices are directly compatible with s3c2440 */
50 s3c_i2c0_setname("s3c2440-i2c"); 51 s3c_i2c0_setname("s3c2440-i2c");
diff --git a/arch/arm/mach-s3c6410/cpu.c b/arch/arm/mach-s3c6410/cpu.c
index 9b67c663d9d8..522c08691952 100644
--- a/arch/arm/mach-s3c6410/cpu.c
+++ b/arch/arm/mach-s3c6410/cpu.c
@@ -58,6 +58,7 @@ void __init s3c6410_map_io(void)
58 /* initialise device information early */ 58 /* initialise device information early */
59 s3c6410_default_sdhci0(); 59 s3c6410_default_sdhci0();
60 s3c6410_default_sdhci1(); 60 s3c6410_default_sdhci1();
61 s3c6410_default_sdhci2();
61 62
62 /* the i2c devices are directly compatible with s3c2440 */ 63 /* the i2c devices are directly compatible with s3c2440 */
63 s3c_i2c0_setname("s3c2440-i2c"); 64 s3c_i2c0_setname("s3c2440-i2c");
diff --git a/arch/arm/mach-s3c6410/mach-hmt.c b/arch/arm/mach-s3c6410/mach-hmt.c
index c5741056193f..cdd4b5378552 100644
--- a/arch/arm/mach-s3c6410/mach-hmt.c
+++ b/arch/arm/mach-s3c6410/mach-hmt.c
@@ -250,7 +250,7 @@ static void __init hmt_machine_init(void)
250{ 250{
251 s3c_i2c0_set_platdata(NULL); 251 s3c_i2c0_set_platdata(NULL);
252 s3c_fb_set_platdata(&hmt_lcd_pdata); 252 s3c_fb_set_platdata(&hmt_lcd_pdata);
253 s3c_device_nand.dev.platform_data = &hmt_nand_info; 253 s3c_nand_set_platdata(&hmt_nand_info);
254 254
255 gpio_request(S3C64XX_GPC(7), "usb power"); 255 gpio_request(S3C64XX_GPC(7), "usb power");
256 gpio_direction_output(S3C64XX_GPC(7), 0); 256 gpio_direction_output(S3C64XX_GPC(7), 0);
diff --git a/arch/arm/mach-s3c6410/mach-smdk6410.c b/arch/arm/mach-s3c6410/mach-smdk6410.c
index 9f1a21462620..480d297c1de2 100644
--- a/arch/arm/mach-s3c6410/mach-smdk6410.c
+++ b/arch/arm/mach-s3c6410/mach-smdk6410.c
@@ -25,6 +25,7 @@
25#include <linux/gpio.h> 25#include <linux/gpio.h>
26#include <linux/delay.h> 26#include <linux/delay.h>
27#include <linux/smsc911x.h> 27#include <linux/smsc911x.h>
28#include <linux/regulator/fixed.h>
28 29
29#ifdef CONFIG_SMDK6410_WM1190_EV1 30#ifdef CONFIG_SMDK6410_WM1190_EV1
30#include <linux/mfd/wm8350/core.h> 31#include <linux/mfd/wm8350/core.h>
@@ -184,6 +185,43 @@ static struct platform_device smdk6410_smsc911x = {
184 }, 185 },
185}; 186};
186 187
188#ifdef CONFIG_REGULATOR
189static struct regulator_consumer_supply smdk6410_b_pwr_5v_consumers[] = {
190 {
191 /* WM8580 */
192 .supply = "PVDD",
193 .dev_name = "0-001b",
194 },
195 {
196 /* WM8580 */
197 .supply = "AVDD",
198 .dev_name = "0-001b",
199 },
200};
201
202static struct regulator_init_data smdk6410_b_pwr_5v_data = {
203 .constraints = {
204 .always_on = 1,
205 },
206 .num_consumer_supplies = ARRAY_SIZE(smdk6410_b_pwr_5v_consumers),
207 .consumer_supplies = smdk6410_b_pwr_5v_consumers,
208};
209
210static struct fixed_voltage_config smdk6410_b_pwr_5v_pdata = {
211 .supply_name = "B_PWR_5V",
212 .microvolts = 5000000,
213 .init_data = &smdk6410_b_pwr_5v_data,
214};
215
216static struct platform_device smdk6410_b_pwr_5v = {
217 .name = "reg-fixed-voltage",
218 .id = -1,
219 .dev = {
220 .platform_data = &smdk6410_b_pwr_5v_pdata,
221 },
222};
223#endif
224
187static struct map_desc smdk6410_iodesc[] = {}; 225static struct map_desc smdk6410_iodesc[] = {};
188 226
189static struct platform_device *smdk6410_devices[] __initdata = { 227static struct platform_device *smdk6410_devices[] __initdata = {
@@ -198,6 +236,10 @@ static struct platform_device *smdk6410_devices[] __initdata = {
198 &s3c_device_fb, 236 &s3c_device_fb,
199 &s3c_device_usb, 237 &s3c_device_usb,
200 &s3c_device_usb_hsotg, 238 &s3c_device_usb_hsotg,
239
240#ifdef CONFIG_REGULATOR
241 &smdk6410_b_pwr_5v,
242#endif
201 &smdk6410_lcd_powerdev, 243 &smdk6410_lcd_powerdev,
202 244
203 &smdk6410_smsc911x, 245 &smdk6410_smsc911x,
@@ -232,6 +274,14 @@ static struct regulator_init_data wm8350_dcdc3_data = {
232}; 274};
233 275
234/* USB, EXT, PCM, ADC/DAC, USB, MMC */ 276/* USB, EXT, PCM, ADC/DAC, USB, MMC */
277static struct regulator_consumer_supply wm8350_dcdc4_consumers[] = {
278 {
279 /* WM8580 */
280 .supply = "DVDD",
281 .dev_name = "0-001b",
282 },
283};
284
235static struct regulator_init_data wm8350_dcdc4_data = { 285static struct regulator_init_data wm8350_dcdc4_data = {
236 .constraints = { 286 .constraints = {
237 .name = "PVDD_HI/PVDD_EXT/PVDD_SYS/PVCCM2MTV", 287 .name = "PVDD_HI/PVDD_EXT/PVDD_SYS/PVCCM2MTV",
@@ -239,6 +289,8 @@ static struct regulator_init_data wm8350_dcdc4_data = {
239 .max_uV = 3000000, 289 .max_uV = 3000000,
240 .always_on = 1, 290 .always_on = 1,
241 }, 291 },
292 .num_consumer_supplies = ARRAY_SIZE(wm8350_dcdc4_consumers),
293 .consumer_supplies = wm8350_dcdc4_consumers,
242}; 294};
243 295
244/* ARM core */ 296/* ARM core */
diff --git a/arch/arm/mach-s5pc100/Kconfig b/arch/arm/mach-s5pc100/Kconfig
index b1a4ba504416..0dd2b8c6eabe 100644
--- a/arch/arm/mach-s5pc100/Kconfig
+++ b/arch/arm/mach-s5pc100/Kconfig
@@ -14,9 +14,23 @@ config CPU_S5PC100
14 help 14 help
15 Enable S5PC100 CPU support 15 Enable S5PC100 CPU support
16 16
17config S5PC100_SETUP_SDHCI
18 bool
19 select S5PC1XX_SETUP_SDHCI_GPIO
20 help
21 Internal helper functions for S5PC100 based SDHCI systems
22
17config MACH_SMDKC100 23config MACH_SMDKC100
18 bool "SMDKC100" 24 bool "SMDKC100"
19 select CPU_S5PC100 25 select CPU_S5PC100
26 select S3C_DEV_FB
27 select S3C_DEV_I2C1
28 select S3C_DEV_HSMMC
29 select S3C_DEV_HSMMC1
30 select S3C_DEV_HSMMC2
31 select S5PC1XX_SETUP_I2C0
20 select S5PC1XX_SETUP_I2C1 32 select S5PC1XX_SETUP_I2C1
33 select S5PC1XX_SETUP_FB_24BPP
34 select S5PC100_SETUP_SDHCI
21 help 35 help
22 Machine support for the Samsung SMDKC100 36 Machine support for the Samsung SMDKC100
diff --git a/arch/arm/mach-s5pc100/Makefile b/arch/arm/mach-s5pc100/Makefile
index afc89b381d7a..809ff10f768f 100644
--- a/arch/arm/mach-s5pc100/Makefile
+++ b/arch/arm/mach-s5pc100/Makefile
@@ -13,5 +13,9 @@ obj- :=
13 13
14obj-$(CONFIG_CPU_S5PC100) += cpu.o 14obj-$(CONFIG_CPU_S5PC100) += cpu.o
15 15
16# Helper and device support
17
18obj-$(CONFIG_S5PC100_SETUP_SDHCI) += setup-sdhci.o
19
16# machine support 20# machine support
17obj-$(CONFIG_MACH_SMDKC100) += mach-smdkc100.o 21obj-$(CONFIG_MACH_SMDKC100) += mach-smdkc100.o
diff --git a/arch/arm/mach-s5pc100/cpu.c b/arch/arm/mach-s5pc100/cpu.c
index 0e718890da32..d79e7574a852 100644
--- a/arch/arm/mach-s5pc100/cpu.c
+++ b/arch/arm/mach-s5pc100/cpu.c
@@ -22,6 +22,8 @@
22#include <linux/serial_core.h> 22#include <linux/serial_core.h>
23#include <linux/platform_device.h> 23#include <linux/platform_device.h>
24 24
25#include <asm/proc-fns.h>
26
25#include <asm/mach/arch.h> 27#include <asm/mach/arch.h>
26#include <asm/mach/map.h> 28#include <asm/mach/map.h>
27#include <asm/mach/irq.h> 29#include <asm/mach/irq.h>
@@ -32,6 +34,7 @@
32 34
33#include <plat/cpu-freq.h> 35#include <plat/cpu-freq.h>
34#include <plat/regs-serial.h> 36#include <plat/regs-serial.h>
37#include <plat/regs-power.h>
35 38
36#include <plat/cpu.h> 39#include <plat/cpu.h>
37#include <plat/devs.h> 40#include <plat/devs.h>
@@ -45,6 +48,23 @@
45static struct map_desc s5pc100_iodesc[] __initdata = { 48static struct map_desc s5pc100_iodesc[] __initdata = {
46}; 49};
47 50
51static void s5pc100_idle(void)
52{
53 unsigned long tmp;
54
55 tmp = __raw_readl(S5PC100_PWR_CFG);
56 tmp &= ~S5PC100_PWRCFG_CFG_DEEP_IDLE;
57 tmp &= ~S5PC100_PWRCFG_CFG_WFI_MASK;
58 tmp |= S5PC100_PWRCFG_CFG_WFI_DEEP_IDLE;
59 __raw_writel(tmp, S5PC100_PWR_CFG);
60
61 tmp = __raw_readl(S5PC100_OTHERS);
62 tmp |= S5PC100_PMU_INT_DISABLE;
63 __raw_writel(tmp, S5PC100_OTHERS);
64
65 cpu_do_idle();
66}
67
48/* s5pc100_map_io 68/* s5pc100_map_io
49 * 69 *
50 * register the standard cpu IO areas 70 * register the standard cpu IO areas
@@ -55,6 +75,13 @@ void __init s5pc100_map_io(void)
55 iotable_init(s5pc100_iodesc, ARRAY_SIZE(s5pc100_iodesc)); 75 iotable_init(s5pc100_iodesc, ARRAY_SIZE(s5pc100_iodesc));
56 76
57 /* initialise device information early */ 77 /* initialise device information early */
78 s5pc100_default_sdhci0();
79 s5pc100_default_sdhci1();
80 s5pc100_default_sdhci2();
81
82 /* the i2c devices are directly compatible with s3c2440 */
83 s3c_i2c0_setname("s3c2440-i2c");
84 s3c_i2c1_setname("s3c2440-i2c");
58} 85}
59 86
60void __init s5pc100_init_clocks(int xtal) 87void __init s5pc100_init_clocks(int xtal)
@@ -93,5 +120,7 @@ int __init s5pc100_init(void)
93{ 120{
94 printk(KERN_DEBUG "S5PC100: Initialising architecture\n"); 121 printk(KERN_DEBUG "S5PC100: Initialising architecture\n");
95 122
123 s5pc1xx_idle = s5pc100_idle;
124
96 return sysdev_register(&s5pc100_sysdev); 125 return sysdev_register(&s5pc100_sysdev);
97} 126}
diff --git a/arch/arm/mach-s5pc100/include/mach/gpio.h b/arch/arm/mach-s5pc100/include/mach/gpio.h
index c74fc93d7d15..2c4cbe8ee6b7 100644
--- a/arch/arm/mach-s5pc100/include/mach/gpio.h
+++ b/arch/arm/mach-s5pc100/include/mach/gpio.h
@@ -18,40 +18,45 @@
18#define gpio_to_irq __gpio_to_irq 18#define gpio_to_irq __gpio_to_irq
19 19
20/* GPIO bank sizes */ 20/* GPIO bank sizes */
21#define S5PC1XX_GPIO_A0_NR (8) 21#define S5PC100_GPIO_A0_NR (8)
22#define S5PC1XX_GPIO_A1_NR (5) 22#define S5PC100_GPIO_A1_NR (5)
23#define S5PC1XX_GPIO_B_NR (8) 23#define S5PC100_GPIO_B_NR (8)
24#define S5PC1XX_GPIO_C_NR (5) 24#define S5PC100_GPIO_C_NR (5)
25#define S5PC1XX_GPIO_D_NR (7) 25#define S5PC100_GPIO_D_NR (7)
26#define S5PC1XX_GPIO_E0_NR (8) 26#define S5PC100_GPIO_E0_NR (8)
27#define S5PC1XX_GPIO_E1_NR (6) 27#define S5PC100_GPIO_E1_NR (6)
28#define S5PC1XX_GPIO_F0_NR (8) 28#define S5PC100_GPIO_F0_NR (8)
29#define S5PC1XX_GPIO_F1_NR (8) 29#define S5PC100_GPIO_F1_NR (8)
30#define S5PC1XX_GPIO_F2_NR (8) 30#define S5PC100_GPIO_F2_NR (8)
31#define S5PC1XX_GPIO_F3_NR (4) 31#define S5PC100_GPIO_F3_NR (4)
32#define S5PC1XX_GPIO_G0_NR (8) 32#define S5PC100_GPIO_G0_NR (8)
33#define S5PC1XX_GPIO_G1_NR (3) 33#define S5PC100_GPIO_G1_NR (3)
34#define S5PC1XX_GPIO_G2_NR (7) 34#define S5PC100_GPIO_G2_NR (7)
35#define S5PC1XX_GPIO_G3_NR (7) 35#define S5PC100_GPIO_G3_NR (7)
36#define S5PC1XX_GPIO_H0_NR (8) 36#define S5PC100_GPIO_H0_NR (8)
37#define S5PC1XX_GPIO_H1_NR (8) 37#define S5PC100_GPIO_H1_NR (8)
38#define S5PC1XX_GPIO_H2_NR (8) 38#define S5PC100_GPIO_H2_NR (8)
39#define S5PC1XX_GPIO_H3_NR (8) 39#define S5PC100_GPIO_H3_NR (8)
40#define S5PC1XX_GPIO_I_NR (8) 40#define S5PC100_GPIO_I_NR (8)
41#define S5PC1XX_GPIO_J0_NR (8) 41#define S5PC100_GPIO_J0_NR (8)
42#define S5PC1XX_GPIO_J1_NR (5) 42#define S5PC100_GPIO_J1_NR (5)
43#define S5PC1XX_GPIO_J2_NR (8) 43#define S5PC100_GPIO_J2_NR (8)
44#define S5PC1XX_GPIO_J3_NR (8) 44#define S5PC100_GPIO_J3_NR (8)
45#define S5PC1XX_GPIO_J4_NR (4) 45#define S5PC100_GPIO_J4_NR (4)
46#define S5PC1XX_GPIO_K0_NR (8) 46#define S5PC100_GPIO_K0_NR (8)
47#define S5PC1XX_GPIO_K1_NR (6) 47#define S5PC100_GPIO_K1_NR (6)
48#define S5PC1XX_GPIO_K2_NR (8) 48#define S5PC100_GPIO_K2_NR (8)
49#define S5PC1XX_GPIO_K3_NR (8) 49#define S5PC100_GPIO_K3_NR (8)
50#define S5PC1XX_GPIO_MP00_NR (8) 50#define S5PC100_GPIO_L0_NR (8)
51#define S5PC1XX_GPIO_MP01_NR (8) 51#define S5PC100_GPIO_L1_NR (8)
52#define S5PC1XX_GPIO_MP02_NR (8) 52#define S5PC100_GPIO_L2_NR (8)
53#define S5PC1XX_GPIO_MP03_NR (8) 53#define S5PC100_GPIO_L3_NR (8)
54#define S5PC1XX_GPIO_MP04_NR (5) 54#define S5PC100_GPIO_L4_NR (8)
55#define S5PC100_GPIO_MP00_NR (8)
56#define S5PC100_GPIO_MP01_NR (8)
57#define S5PC100_GPIO_MP02_NR (8)
58#define S5PC100_GPIO_MP03_NR (8)
59#define S5PC100_GPIO_MP04_NR (5)
55 60
56/* GPIO bank numbes */ 61/* GPIO bank numbes */
57 62
@@ -64,83 +69,94 @@
64 ((__gpio##_START) + (__gpio##_NR) + CONFIG_S3C_GPIO_SPACE + 1) 69 ((__gpio##_START) + (__gpio##_NR) + CONFIG_S3C_GPIO_SPACE + 1)
65 70
66enum s3c_gpio_number { 71enum s3c_gpio_number {
67 S5PC1XX_GPIO_A0_START = 0, 72 S5PC100_GPIO_A0_START = 0,
68 S5PC1XX_GPIO_A1_START = S5PC1XX_GPIO_NEXT(S5PC1XX_GPIO_A0), 73 S5PC100_GPIO_A1_START = S5PC1XX_GPIO_NEXT(S5PC100_GPIO_A0),
69 S5PC1XX_GPIO_B_START = S5PC1XX_GPIO_NEXT(S5PC1XX_GPIO_A1), 74 S5PC100_GPIO_B_START = S5PC1XX_GPIO_NEXT(S5PC100_GPIO_A1),
70 S5PC1XX_GPIO_C_START = S5PC1XX_GPIO_NEXT(S5PC1XX_GPIO_B), 75 S5PC100_GPIO_C_START = S5PC1XX_GPIO_NEXT(S5PC100_GPIO_B),
71 S5PC1XX_GPIO_D_START = S5PC1XX_GPIO_NEXT(S5PC1XX_GPIO_C), 76 S5PC100_GPIO_D_START = S5PC1XX_GPIO_NEXT(S5PC100_GPIO_C),
72 S5PC1XX_GPIO_E0_START = S5PC1XX_GPIO_NEXT(S5PC1XX_GPIO_D), 77 S5PC100_GPIO_E0_START = S5PC1XX_GPIO_NEXT(S5PC100_GPIO_D),
73 S5PC1XX_GPIO_E1_START = S5PC1XX_GPIO_NEXT(S5PC1XX_GPIO_E0), 78 S5PC100_GPIO_E1_START = S5PC1XX_GPIO_NEXT(S5PC100_GPIO_E0),
74 S5PC1XX_GPIO_F0_START = S5PC1XX_GPIO_NEXT(S5PC1XX_GPIO_E1), 79 S5PC100_GPIO_F0_START = S5PC1XX_GPIO_NEXT(S5PC100_GPIO_E1),
75 S5PC1XX_GPIO_F1_START = S5PC1XX_GPIO_NEXT(S5PC1XX_GPIO_F0), 80 S5PC100_GPIO_F1_START = S5PC1XX_GPIO_NEXT(S5PC100_GPIO_F0),
76 S5PC1XX_GPIO_F2_START = S5PC1XX_GPIO_NEXT(S5PC1XX_GPIO_F1), 81 S5PC100_GPIO_F2_START = S5PC1XX_GPIO_NEXT(S5PC100_GPIO_F1),
77 S5PC1XX_GPIO_F3_START = S5PC1XX_GPIO_NEXT(S5PC1XX_GPIO_F2), 82 S5PC100_GPIO_F3_START = S5PC1XX_GPIO_NEXT(S5PC100_GPIO_F2),
78 S5PC1XX_GPIO_G0_START = S5PC1XX_GPIO_NEXT(S5PC1XX_GPIO_F3), 83 S5PC100_GPIO_G0_START = S5PC1XX_GPIO_NEXT(S5PC100_GPIO_F3),
79 S5PC1XX_GPIO_G1_START = S5PC1XX_GPIO_NEXT(S5PC1XX_GPIO_G0), 84 S5PC100_GPIO_G1_START = S5PC1XX_GPIO_NEXT(S5PC100_GPIO_G0),
80 S5PC1XX_GPIO_G2_START = S5PC1XX_GPIO_NEXT(S5PC1XX_GPIO_G1), 85 S5PC100_GPIO_G2_START = S5PC1XX_GPIO_NEXT(S5PC100_GPIO_G1),
81 S5PC1XX_GPIO_G3_START = S5PC1XX_GPIO_NEXT(S5PC1XX_GPIO_G2), 86 S5PC100_GPIO_G3_START = S5PC1XX_GPIO_NEXT(S5PC100_GPIO_G2),
82 S5PC1XX_GPIO_H0_START = S5PC1XX_GPIO_NEXT(S5PC1XX_GPIO_G3), 87 S5PC100_GPIO_H0_START = S5PC1XX_GPIO_NEXT(S5PC100_GPIO_G3),
83 S5PC1XX_GPIO_H1_START = S5PC1XX_GPIO_NEXT(S5PC1XX_GPIO_H0), 88 S5PC100_GPIO_H1_START = S5PC1XX_GPIO_NEXT(S5PC100_GPIO_H0),
84 S5PC1XX_GPIO_H2_START = S5PC1XX_GPIO_NEXT(S5PC1XX_GPIO_H1), 89 S5PC100_GPIO_H2_START = S5PC1XX_GPIO_NEXT(S5PC100_GPIO_H1),
85 S5PC1XX_GPIO_H3_START = S5PC1XX_GPIO_NEXT(S5PC1XX_GPIO_H2), 90 S5PC100_GPIO_H3_START = S5PC1XX_GPIO_NEXT(S5PC100_GPIO_H2),
86 S5PC1XX_GPIO_I_START = S5PC1XX_GPIO_NEXT(S5PC1XX_GPIO_H3), 91 S5PC100_GPIO_I_START = S5PC1XX_GPIO_NEXT(S5PC100_GPIO_H3),
87 S5PC1XX_GPIO_J0_START = S5PC1XX_GPIO_NEXT(S5PC1XX_GPIO_I), 92 S5PC100_GPIO_J0_START = S5PC1XX_GPIO_NEXT(S5PC100_GPIO_I),
88 S5PC1XX_GPIO_J1_START = S5PC1XX_GPIO_NEXT(S5PC1XX_GPIO_J0), 93 S5PC100_GPIO_J1_START = S5PC1XX_GPIO_NEXT(S5PC100_GPIO_J0),
89 S5PC1XX_GPIO_J2_START = S5PC1XX_GPIO_NEXT(S5PC1XX_GPIO_J1), 94 S5PC100_GPIO_J2_START = S5PC1XX_GPIO_NEXT(S5PC100_GPIO_J1),
90 S5PC1XX_GPIO_J3_START = S5PC1XX_GPIO_NEXT(S5PC1XX_GPIO_J2), 95 S5PC100_GPIO_J3_START = S5PC1XX_GPIO_NEXT(S5PC100_GPIO_J2),
91 S5PC1XX_GPIO_J4_START = S5PC1XX_GPIO_NEXT(S5PC1XX_GPIO_J3), 96 S5PC100_GPIO_J4_START = S5PC1XX_GPIO_NEXT(S5PC100_GPIO_J3),
92 S5PC1XX_GPIO_K0_START = S5PC1XX_GPIO_NEXT(S5PC1XX_GPIO_J4), 97 S5PC100_GPIO_K0_START = S5PC1XX_GPIO_NEXT(S5PC100_GPIO_J4),
93 S5PC1XX_GPIO_K1_START = S5PC1XX_GPIO_NEXT(S5PC1XX_GPIO_K0), 98 S5PC100_GPIO_K1_START = S5PC1XX_GPIO_NEXT(S5PC100_GPIO_K0),
94 S5PC1XX_GPIO_K2_START = S5PC1XX_GPIO_NEXT(S5PC1XX_GPIO_K1), 99 S5PC100_GPIO_K2_START = S5PC1XX_GPIO_NEXT(S5PC100_GPIO_K1),
95 S5PC1XX_GPIO_K3_START = S5PC1XX_GPIO_NEXT(S5PC1XX_GPIO_K2), 100 S5PC100_GPIO_K3_START = S5PC1XX_GPIO_NEXT(S5PC100_GPIO_K2),
96 S5PC1XX_GPIO_MP00_START = S5PC1XX_GPIO_NEXT(S5PC1XX_GPIO_K3), 101 S5PC100_GPIO_L0_START = S5PC1XX_GPIO_NEXT(S5PC100_GPIO_K3),
97 S5PC1XX_GPIO_MP01_START = S5PC1XX_GPIO_NEXT(S5PC1XX_GPIO_MP00), 102 S5PC100_GPIO_L1_START = S5PC1XX_GPIO_NEXT(S5PC100_GPIO_L0),
98 S5PC1XX_GPIO_MP02_START = S5PC1XX_GPIO_NEXT(S5PC1XX_GPIO_MP01), 103 S5PC100_GPIO_L2_START = S5PC1XX_GPIO_NEXT(S5PC100_GPIO_L1),
99 S5PC1XX_GPIO_MP03_START = S5PC1XX_GPIO_NEXT(S5PC1XX_GPIO_MP02), 104 S5PC100_GPIO_L3_START = S5PC1XX_GPIO_NEXT(S5PC100_GPIO_L2),
100 S5PC1XX_GPIO_MP04_START = S5PC1XX_GPIO_NEXT(S5PC1XX_GPIO_MP03), 105 S5PC100_GPIO_L4_START = S5PC1XX_GPIO_NEXT(S5PC100_GPIO_L3),
106 S5PC100_GPIO_MP00_START = S5PC1XX_GPIO_NEXT(S5PC100_GPIO_L4),
107 S5PC100_GPIO_MP01_START = S5PC1XX_GPIO_NEXT(S5PC100_GPIO_MP00),
108 S5PC100_GPIO_MP02_START = S5PC1XX_GPIO_NEXT(S5PC100_GPIO_MP01),
109 S5PC100_GPIO_MP03_START = S5PC1XX_GPIO_NEXT(S5PC100_GPIO_MP02),
110 S5PC100_GPIO_MP04_START = S5PC1XX_GPIO_NEXT(S5PC100_GPIO_MP03),
111 S5PC100_GPIO_END = S5PC1XX_GPIO_NEXT(S5PC100_GPIO_MP04),
101}; 112};
102 113
103/* S5PC1XX GPIO number definitions. */ 114/* S5PC100 GPIO number definitions. */
104#define S5PC1XX_GPA0(_nr) (S5PC1XX_GPIO_A0_START + (_nr)) 115#define S5PC100_GPA0(_nr) (S5PC100_GPIO_A0_START + (_nr))
105#define S5PC1XX_GPA1(_nr) (S5PC1XX_GPIO_A1_START + (_nr)) 116#define S5PC100_GPA1(_nr) (S5PC100_GPIO_A1_START + (_nr))
106#define S5PC1XX_GPB(_nr) (S5PC1XX_GPIO_B_START + (_nr)) 117#define S5PC100_GPB(_nr) (S5PC100_GPIO_B_START + (_nr))
107#define S5PC1XX_GPC(_nr) (S5PC1XX_GPIO_C_START + (_nr)) 118#define S5PC100_GPC(_nr) (S5PC100_GPIO_C_START + (_nr))
108#define S5PC1XX_GPD(_nr) (S5PC1XX_GPIO_D_START + (_nr)) 119#define S5PC100_GPD(_nr) (S5PC100_GPIO_D_START + (_nr))
109#define S5PC1XX_GPE0(_nr) (S5PC1XX_GPIO_E0_START + (_nr)) 120#define S5PC100_GPE0(_nr) (S5PC100_GPIO_E0_START + (_nr))
110#define S5PC1XX_GPE1(_nr) (S5PC1XX_GPIO_E1_START + (_nr)) 121#define S5PC100_GPE1(_nr) (S5PC100_GPIO_E1_START + (_nr))
111#define S5PC1XX_GPF0(_nr) (S5PC1XX_GPIO_F0_START + (_nr)) 122#define S5PC100_GPF0(_nr) (S5PC100_GPIO_F0_START + (_nr))
112#define S5PC1XX_GPF1(_nr) (S5PC1XX_GPIO_F1_START + (_nr)) 123#define S5PC100_GPF1(_nr) (S5PC100_GPIO_F1_START + (_nr))
113#define S5PC1XX_GPF2(_nr) (S5PC1XX_GPIO_F2_START + (_nr)) 124#define S5PC100_GPF2(_nr) (S5PC100_GPIO_F2_START + (_nr))
114#define S5PC1XX_GPF3(_nr) (S5PC1XX_GPIO_F3_START + (_nr)) 125#define S5PC100_GPF3(_nr) (S5PC100_GPIO_F3_START + (_nr))
115#define S5PC1XX_GPG0(_nr) (S5PC1XX_GPIO_G0_START + (_nr)) 126#define S5PC100_GPG0(_nr) (S5PC100_GPIO_G0_START + (_nr))
116#define S5PC1XX_GPG1(_nr) (S5PC1XX_GPIO_G1_START + (_nr)) 127#define S5PC100_GPG1(_nr) (S5PC100_GPIO_G1_START + (_nr))
117#define S5PC1XX_GPG2(_nr) (S5PC1XX_GPIO_G2_START + (_nr)) 128#define S5PC100_GPG2(_nr) (S5PC100_GPIO_G2_START + (_nr))
118#define S5PC1XX_GPG3(_nr) (S5PC1XX_GPIO_G3_START + (_nr)) 129#define S5PC100_GPG3(_nr) (S5PC100_GPIO_G3_START + (_nr))
119#define S5PC1XX_GPH0(_nr) (S5PC1XX_GPIO_H0_START + (_nr)) 130#define S5PC100_GPH0(_nr) (S5PC100_GPIO_H0_START + (_nr))
120#define S5PC1XX_GPH1(_nr) (S5PC1XX_GPIO_H1_START + (_nr)) 131#define S5PC100_GPH1(_nr) (S5PC100_GPIO_H1_START + (_nr))
121#define S5PC1XX_GPH2(_nr) (S5PC1XX_GPIO_H2_START + (_nr)) 132#define S5PC100_GPH2(_nr) (S5PC100_GPIO_H2_START + (_nr))
122#define S5PC1XX_GPH3(_nr) (S5PC1XX_GPIO_H3_START + (_nr)) 133#define S5PC100_GPH3(_nr) (S5PC100_GPIO_H3_START + (_nr))
123#define S5PC1XX_GPI(_nr) (S5PC1XX_GPIO_I_START + (_nr)) 134#define S5PC100_GPI(_nr) (S5PC100_GPIO_I_START + (_nr))
124#define S5PC1XX_GPJ0(_nr) (S5PC1XX_GPIO_J0_START + (_nr)) 135#define S5PC100_GPJ0(_nr) (S5PC100_GPIO_J0_START + (_nr))
125#define S5PC1XX_GPJ1(_nr) (S5PC1XX_GPIO_J1_START + (_nr)) 136#define S5PC100_GPJ1(_nr) (S5PC100_GPIO_J1_START + (_nr))
126#define S5PC1XX_GPJ2(_nr) (S5PC1XX_GPIO_J2_START + (_nr)) 137#define S5PC100_GPJ2(_nr) (S5PC100_GPIO_J2_START + (_nr))
127#define S5PC1XX_GPJ3(_nr) (S5PC1XX_GPIO_J3_START + (_nr)) 138#define S5PC100_GPJ3(_nr) (S5PC100_GPIO_J3_START + (_nr))
128#define S5PC1XX_GPJ4(_nr) (S5PC1XX_GPIO_J4_START + (_nr)) 139#define S5PC100_GPJ4(_nr) (S5PC100_GPIO_J4_START + (_nr))
129#define S5PC1XX_GPK0(_nr) (S5PC1XX_GPIO_K0_START + (_nr)) 140#define S5PC100_GPK0(_nr) (S5PC100_GPIO_K0_START + (_nr))
130#define S5PC1XX_GPK1(_nr) (S5PC1XX_GPIO_K1_START + (_nr)) 141#define S5PC100_GPK1(_nr) (S5PC100_GPIO_K1_START + (_nr))
131#define S5PC1XX_GPK2(_nr) (S5PC1XX_GPIO_K2_START + (_nr)) 142#define S5PC100_GPK2(_nr) (S5PC100_GPIO_K2_START + (_nr))
132#define S5PC1XX_GPK3(_nr) (S5PC1XX_GPIO_K3_START + (_nr)) 143#define S5PC100_GPK3(_nr) (S5PC100_GPIO_K3_START + (_nr))
133#define S5PC1XX_MP00(_nr) (S5PC1XX_GPIO_MP00_START + (_nr)) 144#define S5PC100_GPL0(_nr) (S5PC100_GPIO_L0_START + (_nr))
134#define S5PC1XX_MP01(_nr) (S5PC1XX_GPIO_MP01_START + (_nr)) 145#define S5PC100_GPL1(_nr) (S5PC100_GPIO_L1_START + (_nr))
135#define S5PC1XX_MP02(_nr) (S5PC1XX_GPIO_MP02_START + (_nr)) 146#define S5PC100_GPL2(_nr) (S5PC100_GPIO_L2_START + (_nr))
136#define S5PC1XX_MP03(_nr) (S5PC1XX_GPIO_MP03_START + (_nr)) 147#define S5PC100_GPL3(_nr) (S5PC100_GPIO_L3_START + (_nr))
137#define S5PC1XX_MP04(_nr) (S5PC1XX_GPIO_MP04_START + (_nr)) 148#define S5PC100_GPL4(_nr) (S5PC100_GPIO_L4_START + (_nr))
149#define S5PC100_MP00(_nr) (S5PC100_GPIO_MP00_START + (_nr))
150#define S5PC100_MP01(_nr) (S5PC100_GPIO_MP01_START + (_nr))
151#define S5PC100_MP02(_nr) (S5PC100_GPIO_MP02_START + (_nr))
152#define S5PC100_MP03(_nr) (S5PC100_GPIO_MP03_START + (_nr))
153#define S5PC100_MP04(_nr) (S5PC100_GPIO_MP04_START + (_nr))
154#define S5PC100_MP05(_nr) (S5PC100_GPIO_MP05_START + (_nr))
138 155
139/* the end of the S5PC1XX specific gpios */ 156/* It used the end of the S5PC1XX gpios */
140#define S5PC1XX_GPIO_END (S5PC1XX_MP04(S5PC1XX_GPIO_MP04_NR) + 1) 157#define S3C_GPIO_END S5PC100_GPIO_END
141#define S3C_GPIO_END S5PC1XX_GPIO_END
142 158
143/* define the number of gpios we need to the one after the MP04() range */ 159/* define the number of gpios we need to the one after the MP04() range */
144#define ARCH_NR_GPIOS (S5PC1XX_MP04(S5PC1XX_GPIO_MP04_NR) + 1) 160#define ARCH_NR_GPIOS (S5PC100_GPIO_END + 1)
145 161
146#include <asm-generic/gpio.h> 162#include <asm-generic/gpio.h>
diff --git a/arch/arm/mach-s5pc100/include/mach/irqs.h b/arch/arm/mach-s5pc100/include/mach/irqs.h
index 622720dba289..b53fa48a52c6 100644
--- a/arch/arm/mach-s5pc100/include/mach/irqs.h
+++ b/arch/arm/mach-s5pc100/include/mach/irqs.h
@@ -11,4 +11,9 @@
11 11
12#include <plat/irqs.h> 12#include <plat/irqs.h>
13 13
14/* LCD */
15#define IRQ_LCD_FIFO IRQ_LCD0
16#define IRQ_LCD_VSYNC IRQ_LCD1
17#define IRQ_LCD_SYSTEM IRQ_LCD2
18
14#endif /* __ASM_ARCH_IRQ_H */ 19#endif /* __ASM_ARCH_IRQ_H */
diff --git a/arch/arm/mach-s5pc100/include/mach/map.h b/arch/arm/mach-s5pc100/include/mach/map.h
index 9e9f39130b2c..4681ebe8bef6 100644
--- a/arch/arm/mach-s5pc100/include/mach/map.h
+++ b/arch/arm/mach-s5pc100/include/mach/map.h
@@ -17,6 +17,19 @@
17 17
18#include <plat/map-base.h> 18#include <plat/map-base.h>
19 19
20/*
21 * map-base.h has already defined virtual memory address
22 * S3C_VA_IRQ S3C_ADDR(0x00000000) irq controller(s)
23 * S3C_VA_SYS S3C_ADDR(0x00100000) system control
24 * S3C_VA_MEM S3C_ADDR(0x00200000) system control (not used)
25 * S3C_VA_TIMER S3C_ADDR(0x00300000) timer block
26 * S3C_VA_WATCHDOG S3C_ADDR(0x00400000) watchdog
27 * S3C_VA_UART S3C_ADDR(0x01000000) UART
28 *
29 * S5PC100 specific virtual memory address can be defined here
30 * S5PC1XX_VA_GPIO S3C_ADDR(0x00500000) GPIO
31 *
32 */
20 33
21/* Chip ID */ 34/* Chip ID */
22#define S5PC100_PA_CHIPID (0xE0000000) 35#define S5PC100_PA_CHIPID (0xE0000000)
@@ -24,13 +37,20 @@
24#define S5PC1XX_VA_CHIPID S3C_VA_SYS 37#define S5PC1XX_VA_CHIPID S3C_VA_SYS
25 38
26/* System */ 39/* System */
27#define S5PC100_PA_SYS (0xE0100000) 40#define S5PC100_PA_CLK (0xE0100000)
28#define S5PC100_PA_CLK (S5PC100_PA_SYS + 0x0) 41#define S5PC100_PA_CLK_OTHER (0xE0200000)
29#define S5PC100_PA_PWR (S5PC100_PA_SYS + 0x8000) 42#define S5PC100_PA_PWR (0xE0108000)
30#define S5PC1XX_PA_CLK S5PC100_PA_CLK 43#define S5PC1XX_PA_CLK S5PC100_PA_CLK
31#define S5PC1XX_PA_PWR S5PC100_PA_PWR 44#define S5PC1XX_PA_PWR S5PC100_PA_PWR
45#define S5PC1XX_PA_CLK_OTHER S5PC100_PA_CLK_OTHER
32#define S5PC1XX_VA_CLK (S3C_VA_SYS + 0x10000) 46#define S5PC1XX_VA_CLK (S3C_VA_SYS + 0x10000)
33#define S5PC1XX_VA_PWR (S3C_VA_SYS + 0x20000) 47#define S5PC1XX_VA_PWR (S3C_VA_SYS + 0x20000)
48#define S5PC1XX_VA_CLK_OTHER (S3C_VA_SYS + 0x30000)
49
50/* GPIO */
51#define S5PC100_PA_GPIO (0xE0300000)
52#define S5PC1XX_PA_GPIO S5PC100_PA_GPIO
53#define S5PC1XX_VA_GPIO S3C_ADDR(0x00500000)
34 54
35/* Interrupt */ 55/* Interrupt */
36#define S5PC100_PA_VIC (0xE4000000) 56#define S5PC100_PA_VIC (0xE4000000)
@@ -40,23 +60,64 @@
40#define S5PC1XX_PA_VIC(x) (S5PC100_PA_VIC + ((x) * S5PC100_PA_VIC_OFFSET)) 60#define S5PC1XX_PA_VIC(x) (S5PC100_PA_VIC + ((x) * S5PC100_PA_VIC_OFFSET))
41#define S5PC1XX_VA_VIC(x) (S5PC100_VA_VIC + ((x) * S5PC100_VA_VIC_OFFSET)) 61#define S5PC1XX_VA_VIC(x) (S5PC100_VA_VIC + ((x) * S5PC100_VA_VIC_OFFSET))
42 62
63/* DMA */
64#define S5PC100_PA_MDMA (0xE8100000)
65#define S5PC100_PA_PDMA0 (0xE9000000)
66#define S5PC100_PA_PDMA1 (0xE9200000)
67
43/* Timer */ 68/* Timer */
44#define S5PC100_PA_TIMER (0xEA000000) 69#define S5PC100_PA_TIMER (0xEA000000)
45#define S5PC1XX_PA_TIMER S5PC100_PA_TIMER 70#define S5PC1XX_PA_TIMER S5PC100_PA_TIMER
46#define S5PC1XX_VA_TIMER S3C_VA_TIMER 71#define S5PC1XX_VA_TIMER S3C_VA_TIMER
47 72
73/* RTC */
74#define S5PC100_PA_RTC (0xEA300000)
75
48/* UART */ 76/* UART */
49#define S5PC100_PA_UART (0xEC000000) 77#define S5PC100_PA_UART (0xEC000000)
50#define S5PC1XX_PA_UART S5PC100_PA_UART 78#define S5PC1XX_PA_UART S5PC100_PA_UART
51#define S5PC1XX_VA_UART S3C_VA_UART 79#define S5PC1XX_VA_UART S3C_VA_UART
52 80
53/* IIC */ 81/* I2C */
54#define S5PC100_PA_IIC (0xEC100000) 82#define S5PC100_PA_I2C (0xEC100000)
83#define S5PC100_PA_I2C1 (0xEC200000)
84
85/* USB HS OTG */
86#define S5PC100_PA_USB_HSOTG (0xED200000)
87#define S5PC100_PA_USB_HSPHY (0xED300000)
88
89/* SD/MMC */
90#define S5PC100_PA_HSMMC(x) (0xED800000 + ((x) * 0x100000))
91#define S5PC100_PA_HSMMC0 S5PC100_PA_HSMMC(0)
92#define S5PC100_PA_HSMMC1 S5PC100_PA_HSMMC(1)
93#define S5PC100_PA_HSMMC2 S5PC100_PA_HSMMC(2)
94
95/* LCD */
96#define S5PC100_PA_FB (0xEE000000)
97
98/* Multimedia */
99#define S5PC100_PA_G2D (0xEE800000)
100#define S5PC100_PA_JPEG (0xEE500000)
101#define S5PC100_PA_ROTATOR (0xEE100000)
102#define S5PC100_PA_G3D (0xEF000000)
103
104/* I2S */
105#define S5PC100_PA_I2S0 (0xF2000000)
106#define S5PC100_PA_I2S1 (0xF2100000)
107#define S5PC100_PA_I2S2 (0xF2200000)
108
109/* KEYPAD */
110#define S5PC100_PA_KEYPAD (0xF3100000)
111
112/* ADC & TouchScreen */
113#define S5PC100_PA_TSADC (0xF3000000)
55 114
56/* ETC */ 115/* ETC */
57#define S5PC100_PA_SDRAM (0x20000000) 116#define S5PC100_PA_SDRAM (0x20000000)
117#define S5PC1XX_PA_SDRAM S5PC100_PA_SDRAM
58 118
59/* compatibility defines. */ 119/* compatibility defines. */
120#define S3C_PA_RTC S5PC100_PA_RTC
60#define S3C_PA_UART S5PC100_PA_UART 121#define S3C_PA_UART S5PC100_PA_UART
61#define S3C_PA_UART0 (S5PC100_PA_UART + 0x0) 122#define S3C_PA_UART0 (S5PC100_PA_UART + 0x0)
62#define S3C_PA_UART1 (S5PC100_PA_UART + 0x400) 123#define S3C_PA_UART1 (S5PC100_PA_UART + 0x400)
@@ -67,9 +128,23 @@
67#define S3C_VA_UART2 (S3C_VA_UART + 0x800) 128#define S3C_VA_UART2 (S3C_VA_UART + 0x800)
68#define S3C_VA_UART3 (S3C_VA_UART + 0xC00) 129#define S3C_VA_UART3 (S3C_VA_UART + 0xC00)
69#define S3C_UART_OFFSET 0x400 130#define S3C_UART_OFFSET 0x400
131#define S3C_VA_UARTx(x) (S3C_VA_UART + ((x) * S3C_UART_OFFSET))
132#define S3C_PA_FB S5PC100_PA_FB
133#define S3C_PA_G2D S5PC100_PA_G2D
134#define S3C_PA_G3D S5PC100_PA_G3D
135#define S3C_PA_JPEG S5PC100_PA_JPEG
136#define S3C_PA_ROTATOR S5PC100_PA_ROTATOR
70#define S3C_VA_VIC0 (S3C_VA_IRQ + 0x0) 137#define S3C_VA_VIC0 (S3C_VA_IRQ + 0x0)
71#define S3C_VA_VIC1 (S3C_VA_IRQ + 0x10000) 138#define S3C_VA_VIC1 (S3C_VA_IRQ + 0x10000)
72#define S3C_VA_VIC2 (S3C_VA_IRQ + 0x20000) 139#define S3C_VA_VIC2 (S3C_VA_IRQ + 0x20000)
73#define S3C_PA_IIC S5PC100_PA_IIC 140#define S3C_PA_IIC S5PC100_PA_I2C
141#define S3C_PA_IIC1 S5PC100_PA_I2C1
142#define S3C_PA_USB_HSOTG S5PC100_PA_USB_HSOTG
143#define S3C_PA_USB_HSPHY S5PC100_PA_USB_HSPHY
144#define S3C_PA_HSMMC0 S5PC100_PA_HSMMC0
145#define S3C_PA_HSMMC1 S5PC100_PA_HSMMC1
146#define S3C_PA_HSMMC2 S5PC100_PA_HSMMC2
147#define S3C_PA_KEYPAD S5PC100_PA_KEYPAD
148#define S3C_PA_TSADC S5PC100_PA_TSADC
74 149
75#endif /* __ASM_ARCH_C100_MAP_H */ 150#endif /* __ASM_ARCH_C100_MAP_H */
diff --git a/arch/arm/mach-s5pc100/include/mach/regs-fb.h b/arch/arm/mach-s5pc100/include/mach/regs-fb.h
new file mode 100644
index 000000000000..1732cd28c765
--- /dev/null
+++ b/arch/arm/mach-s5pc100/include/mach/regs-fb.h
@@ -0,0 +1,139 @@
1/* arch/arm/mach-s5pc100/include/mach/regs-fb.h
2 *
3 * Copyright 2009 Samsung Electronics Co.
4 * Pawel Osciak <p.osciak@samsung.com>
5 *
6 * Framebuffer register definitions for Samsung S5PC100.
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_FB_H
14#define __ASM_ARCH_REGS_FB_H __FILE__
15
16#include <plat/regs-fb-v4.h>
17
18/* VP1 interface timing control */
19#define VP1CON0 (0x118)
20#define VP1_RATECON_EN (1 << 31)
21#define VP1_CLKRATE_MASK (0xff)
22
23#define VP1CON1 (0x11c)
24#define VP1_VTREGCON_EN (1 << 31)
25#define VP1_VBPD_MASK (0xfff)
26#define VP1_VBPD_SHIFT (16)
27
28
29#define WPALCON_H (0x19c)
30#define WPALCON_L (0x1a0)
31
32/* Pallete contro for WPAL0 and WPAL1 is the same as in S3C64xx, but
33 * different for WPAL2-4
34 */
35/* In WPALCON_L (aka WPALCON) */
36#define WPALCON_W1PAL_32BPP_A888 (0x7 << 3)
37#define WPALCON_W0PAL_32BPP_A888 (0x7 << 0)
38
39/* To set W2PAL-W4PAL consist of one bit from WPALCON_L and two from WPALCON_H,
40 * e.g. W2PAL[2..0] is made of (WPALCON_H[10..9], WPALCON_L[6]).
41 */
42#define WPALCON_L_WxPAL_L_MASK (0x1)
43#define WPALCON_L_W2PAL_L_SHIFT (6)
44#define WPALCON_L_W3PAL_L_SHIFT (7)
45#define WPALCON_L_W4PAL_L_SHIFT (8)
46
47#define WPALCON_L_WxPAL_H_MASK (0x3)
48#define WPALCON_H_W2PAL_H_SHIFT (9)
49#define WPALCON_H_W3PAL_H_SHIFT (13)
50#define WPALCON_H_W4PAL_H_SHIFT (17)
51
52/* Per-window alpha value registers */
53/* For window 0 8-bit alpha values are in VIDW0ALPHAx,
54 * for windows 1-4 alpha values consist of two parts, the 4 low bits are
55 * taken from VIDWxALPHAx and 4 high bits are from VIDOSDxC,
56 * e.g. WIN1_ALPHA0_B[7..0] = (VIDOSD1C[3..0], VIDW1ALPHA0[3..0])
57 */
58#define VIDWxALPHA0(_win) (0x200 + (_win * 8))
59#define VIDWxALPHA1(_win) (0x204 + (_win * 8))
60
61/* Only for window 0 in VIDW0ALPHAx. */
62#define VIDW0ALPHAx_R(_x) ((_x) << 16)
63#define VIDW0ALPHAx_R_MASK (0xff << 16)
64#define VIDW0ALPHAx_R_SHIFT (16)
65#define VIDW0ALPHAx_G(_x) ((_x) << 8)
66#define VIDW0ALPHAx_G_MASK (0xff << 8)
67#define VIDW0ALPHAx_G_SHIFT (8)
68#define VIDW0ALPHAx_B(_x) ((_x) << 0)
69#define VIDW0ALPHAx_B_MASK (0xff << 0)
70#define VIDW0ALPHAx_B_SHIFT (0)
71
72/* Low 4 bits of alpha0-1 for windows 1-4 */
73#define VIDW14ALPHAx_R_L(_x) ((_x) << 16)
74#define VIDW14ALPHAx_R_L_MASK (0xf << 16)
75#define VIDW14ALPHAx_R_L_SHIFT (16)
76#define VIDW14ALPHAx_G_L(_x) ((_x) << 8)
77#define VIDW14ALPHAx_G_L_MASK (0xf << 8)
78#define VIDW14ALPHAx_G_L_SHIFT (8)
79#define VIDW14ALPHAx_B_L(_x) ((_x) << 0)
80#define VIDW14ALPHAx_B_L_MASK (0xf << 0)
81#define VIDW14ALPHAx_B_L_SHIFT (0)
82
83
84/* Per-window blending equation control registers */
85#define BLENDEQx(_win) (0x244 + ((_win) * 4))
86#define BLENDEQ1 (0x244)
87#define BLENDEQ2 (0x248)
88#define BLENDEQ3 (0x24c)
89#define BLENDEQ4 (0x250)
90
91#define BLENDEQx_Q_FUNC(_x) ((_x) << 18)
92#define BLENDEQx_Q_FUNC_MASK (0xf << 18)
93#define BLENDEQx_P_FUNC(_x) ((_x) << 12)
94#define BLENDEQx_P_FUNC_MASK (0xf << 12)
95#define BLENDEQx_B_FUNC(_x) ((_x) << 6)
96#define BLENDEQx_B_FUNC_MASK (0xf << 6)
97#define BLENDEQx_A_FUNC(_x) ((_x) << 0)
98#define BLENDEQx_A_FUNC_MASK (0xf << 0)
99
100#define BLENDCON (0x260)
101#define BLENDCON_8BIT_ALPHA (1 << 0)
102
103/* Per-window palette base addresses (start of palette memory).
104 * Each window palette area consists of 256 32-bit entries.
105 * START is the first address (entry 0th), END is the address of 255th entry.
106 */
107#define WIN0_PAL_BASE (0x2400)
108#define WIN0_PAL_END (0x27fc)
109#define WIN1_PAL_BASE (0x2800)
110#define WIN1_PAL_END (0x2bfc)
111#define WIN2_PAL_BASE (0x2c00)
112#define WIN2_PAL_END (0x2ffc)
113#define WIN3_PAL_BASE (0x3000)
114#define WIN3_PAL_END (0x33fc)
115#define WIN4_PAL_BASE (0x3400)
116#define WIN4_PAL_END (0x37fc)
117
118#define WIN0_PAL(_entry) (WIN0_PAL_BASE + ((_entry) * 4))
119#define WIN1_PAL(_entry) (WIN1_PAL_BASE + ((_entry) * 4))
120#define WIN2_PAL(_entry) (WIN2_PAL_BASE + ((_entry) * 4))
121#define WIN3_PAL(_entry) (WIN3_PAL_BASE + ((_entry) * 4))
122#define WIN4_PAL(_entry) (WIN4_PAL_BASE + ((_entry) * 4))
123
124static inline unsigned int s3c_fb_pal_reg(unsigned int window, int reg)
125{
126 switch (window) {
127 case 0: return WIN0_PAL(reg);
128 case 1: return WIN1_PAL(reg);
129 case 2: return WIN2_PAL(reg);
130 case 3: return WIN3_PAL(reg);
131 case 4: return WIN4_PAL(reg);
132 }
133
134 BUG();
135}
136
137
138#endif /* __ASM_ARCH_REGS_FB_H */
139
diff --git a/arch/arm/mach-s5pc100/include/mach/system.h b/arch/arm/mach-s5pc100/include/mach/system.h
index e39014375470..f0d31a2a598c 100644
--- a/arch/arm/mach-s5pc100/include/mach/system.h
+++ b/arch/arm/mach-s5pc100/include/mach/system.h
@@ -11,14 +11,21 @@
11#ifndef __ASM_ARCH_SYSTEM_H 11#ifndef __ASM_ARCH_SYSTEM_H
12#define __ASM_ARCH_SYSTEM_H __FILE__ 12#define __ASM_ARCH_SYSTEM_H __FILE__
13 13
14#include <linux/io.h>
15#include <mach/map.h>
16#include <plat/regs-clock.h>
17
18void (*s5pc1xx_idle)(void);
19
14static void arch_idle(void) 20static void arch_idle(void)
15{ 21{
16 /* nothing here yet */ 22 if (s5pc1xx_idle)
23 s5pc1xx_idle();
17} 24}
18 25
19static void arch_reset(char mode, const char *cmd) 26static void arch_reset(char mode, const char *cmd)
20{ 27{
21 /* nothing here yet */ 28 __raw_writel(S5PC100_SWRESET_RESETVAL, S5PC100_SWRESET);
29 return;
22} 30}
23
24#endif /* __ASM_ARCH_IRQ_H */ 31#endif /* __ASM_ARCH_IRQ_H */
diff --git a/arch/arm/mach-s5pc100/mach-smdkc100.c b/arch/arm/mach-s5pc100/mach-smdkc100.c
index 214093cd7632..ae3c52cd0ebb 100644
--- a/arch/arm/mach-s5pc100/mach-smdkc100.c
+++ b/arch/arm/mach-s5pc100/mach-smdkc100.c
@@ -27,16 +27,22 @@
27#include <asm/mach/map.h> 27#include <asm/mach/map.h>
28 28
29#include <mach/map.h> 29#include <mach/map.h>
30#include <mach/regs-fb.h>
31#include <video/platform_lcd.h>
30 32
31#include <asm/irq.h> 33#include <asm/irq.h>
32#include <asm/mach-types.h> 34#include <asm/mach-types.h>
33 35
34#include <plat/regs-serial.h> 36#include <plat/regs-serial.h>
37#include <plat/gpio-cfg.h>
38#include <plat/regs-gpio.h>
35 39
36#include <plat/clock.h> 40#include <plat/clock.h>
37#include <plat/devs.h> 41#include <plat/devs.h>
38#include <plat/cpu.h> 42#include <plat/cpu.h>
39#include <plat/s5pc100.h> 43#include <plat/s5pc100.h>
44#include <plat/fb.h>
45#include <plat/iic.h>
40 46
41#define UCON (S3C2410_UCON_DEFAULT | S3C2410_UCON_UCLK) 47#define UCON (S3C2410_UCON_DEFAULT | S3C2410_UCON_UCLK)
42#define ULCON (S3C2410_LCON_CS8 | S3C2410_LCON_PNONE | S3C2410_LCON_STOPB) 48#define ULCON (S3C2410_LCON_CS8 | S3C2410_LCON_PNONE | S3C2410_LCON_STOPB)
@@ -73,9 +79,78 @@ static struct s3c2410_uartcfg smdkc100_uartcfgs[] __initdata = {
73 }, 79 },
74}; 80};
75 81
82/* I2C0 */
83static struct i2c_board_info i2c_devs0[] __initdata = {
84};
85
86/* I2C1 */
87static struct i2c_board_info i2c_devs1[] __initdata = {
88};
89
90/* LCD power controller */
91static void smdkc100_lcd_power_set(struct plat_lcd_data *pd,
92 unsigned int power)
93{
94 /* backlight */
95 gpio_direction_output(S5PC100_GPD(0), power);
96
97 if (power) {
98 /* module reset */
99 gpio_direction_output(S5PC100_GPH0(6), 1);
100 mdelay(100);
101 gpio_direction_output(S5PC100_GPH0(6), 0);
102 mdelay(10);
103 gpio_direction_output(S5PC100_GPH0(6), 1);
104 mdelay(10);
105 }
106}
107
108static struct plat_lcd_data smdkc100_lcd_power_data = {
109 .set_power = smdkc100_lcd_power_set,
110};
111
112static struct platform_device smdkc100_lcd_powerdev = {
113 .name = "platform-lcd",
114 .dev.parent = &s3c_device_fb.dev,
115 .dev.platform_data = &smdkc100_lcd_power_data,
116};
117
118/* Frame Buffer */
119static struct s3c_fb_pd_win smdkc100_fb_win0 = {
120 /* this is to ensure we use win0 */
121 .win_mode = {
122 .refresh = 70,
123 .pixclock = (8+13+3+800)*(7+5+1+480),
124 .left_margin = 8,
125 .right_margin = 13,
126 .upper_margin = 7,
127 .lower_margin = 5,
128 .hsync_len = 3,
129 .vsync_len = 1,
130 .xres = 800,
131 .yres = 480,
132 },
133 .max_bpp = 32,
134 .default_bpp = 16,
135};
136
137static struct s3c_fb_platdata smdkc100_lcd_pdata __initdata = {
138 .win[0] = &smdkc100_fb_win0,
139 .vidcon0 = VIDCON0_VIDOUT_RGB | VIDCON0_PNRMODE_RGB,
140 .vidcon1 = VIDCON1_INV_HSYNC | VIDCON1_INV_VSYNC,
141 .setup_gpio = s5pc100_fb_gpio_setup_24bpp,
142};
143
76static struct map_desc smdkc100_iodesc[] = {}; 144static struct map_desc smdkc100_iodesc[] = {};
77 145
78static struct platform_device *smdkc100_devices[] __initdata = { 146static struct platform_device *smdkc100_devices[] __initdata = {
147 &s3c_device_i2c0,
148 &s3c_device_i2c1,
149 &s3c_device_fb,
150 &s3c_device_hsmmc0,
151 &s3c_device_hsmmc1,
152 &s3c_device_hsmmc2,
153 &smdkc100_lcd_powerdev,
79}; 154};
80 155
81static void __init smdkc100_map_io(void) 156static void __init smdkc100_map_io(void)
@@ -87,12 +162,24 @@ static void __init smdkc100_map_io(void)
87 162
88static void __init smdkc100_machine_init(void) 163static void __init smdkc100_machine_init(void)
89{ 164{
165 /* I2C */
166 s3c_i2c0_set_platdata(NULL);
167 s3c_i2c1_set_platdata(NULL);
168 i2c_register_board_info(0, i2c_devs0, ARRAY_SIZE(i2c_devs0));
169 i2c_register_board_info(1, i2c_devs1, ARRAY_SIZE(i2c_devs1));
170
171 s3c_fb_set_platdata(&smdkc100_lcd_pdata);
172
173 /* LCD init */
174 gpio_request(S5PC100_GPD(0), "GPD");
175 gpio_request(S5PC100_GPH0(6), "GPH0");
176 smdkc100_lcd_power_set(&smdkc100_lcd_power_data, 0);
90 platform_add_devices(smdkc100_devices, ARRAY_SIZE(smdkc100_devices)); 177 platform_add_devices(smdkc100_devices, ARRAY_SIZE(smdkc100_devices));
91} 178}
92 179
93MACHINE_START(SMDKC100, "SMDKC100") 180MACHINE_START(SMDKC100, "SMDKC100")
94 /* Maintainer: Byungho Min <bhmin@samsung.com> */ 181 /* Maintainer: Byungho Min <bhmin@samsung.com> */
95 .phys_io = S5PC1XX_PA_UART & 0xfff00000, 182 .phys_io = S5PC100_PA_UART & 0xfff00000,
96 .io_pg_offst = (((u32)S5PC1XX_VA_UART) >> 18) & 0xfffc, 183 .io_pg_offst = (((u32)S5PC1XX_VA_UART) >> 18) & 0xfffc,
97 .boot_params = S5PC100_PA_SDRAM + 0x100, 184 .boot_params = S5PC100_PA_SDRAM + 0x100,
98 185
diff --git a/arch/arm/mach-s5pc100/setup-sdhci.c b/arch/arm/mach-s5pc100/setup-sdhci.c
new file mode 100644
index 000000000000..4385986a3da0
--- /dev/null
+++ b/arch/arm/mach-s5pc100/setup-sdhci.c
@@ -0,0 +1,65 @@
1/* linux/arch/arm/mach-s5pc100/setup-sdhci.c
2 *
3 * Copyright 2008 Samsung Electronics
4 *
5 * S5PC100 - Helper functions for settign up SDHCI device(s) (HSMMC)
6 *
7 * Based on mach-s3c6410/setup-sdhci.c
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12*/
13
14#include <linux/kernel.h>
15#include <linux/types.h>
16#include <linux/interrupt.h>
17#include <linux/platform_device.h>
18#include <linux/io.h>
19
20#include <linux/mmc/card.h>
21#include <linux/mmc/host.h>
22
23#include <plat/regs-sdhci.h>
24#include <plat/sdhci.h>
25
26/* clock sources for the mmc bus clock, order as for the ctrl2[5..4] */
27
28char *s5pc100_hsmmc_clksrcs[4] = {
29 [0] = "hsmmc",
30 [1] = "hsmmc",
31 /* [2] = "mmc_bus", not yet succesfuuly used yet */
32 /* [3] = "48m", - note not succesfully used yet */
33};
34
35
36void s5pc100_setup_sdhci0_cfg_card(struct platform_device *dev,
37 void __iomem *r,
38 struct mmc_ios *ios,
39 struct mmc_card *card)
40{
41 u32 ctrl2, ctrl3;
42
43 /* don't need to alter anything acording to card-type */
44
45 writel(S3C64XX_SDHCI_CONTROL4_DRIVE_9mA, r + S3C64XX_SDHCI_CONTROL4);
46
47 ctrl2 = readl(r + S3C_SDHCI_CONTROL2);
48 ctrl2 &= S3C_SDHCI_CTRL2_SELBASECLK_MASK;
49 ctrl2 |= (S3C64XX_SDHCI_CTRL2_ENSTAASYNCCLR |
50 S3C64XX_SDHCI_CTRL2_ENCMDCNFMSK |
51 S3C_SDHCI_CTRL2_ENFBCLKRX |
52 S3C_SDHCI_CTRL2_DFCNT_NONE |
53 S3C_SDHCI_CTRL2_ENCLKOUTHOLD);
54
55 if (ios->clock < 25 * 1000000)
56 ctrl3 = (S3C_SDHCI_CTRL3_FCSEL3 |
57 S3C_SDHCI_CTRL3_FCSEL2 |
58 S3C_SDHCI_CTRL3_FCSEL1 |
59 S3C_SDHCI_CTRL3_FCSEL0);
60 else
61 ctrl3 = (S3C_SDHCI_CTRL3_FCSEL1 | S3C_SDHCI_CTRL3_FCSEL0);
62
63 writel(ctrl2, r + S3C_SDHCI_CONTROL2);
64 writel(ctrl3, r + S3C_SDHCI_CONTROL3);
65}
diff --git a/arch/arm/plat-s3c/Kconfig b/arch/arm/plat-s3c/Kconfig
index 8931c5f0e46b..e139a72c2149 100644
--- a/arch/arm/plat-s3c/Kconfig
+++ b/arch/arm/plat-s3c/Kconfig
@@ -159,6 +159,12 @@ config S3C_GPIO_CFG_S3C64XX
159 Internal configuration to enable S3C64XX style GPIO configuration 159 Internal configuration to enable S3C64XX style GPIO configuration
160 functions. 160 functions.
161 161
162config S5P_GPIO_CFG_S5PC1XX
163 bool
164 help
165 Internal configuration to enable S5PC1XX style GPIO configuration
166 functions.
167
162# DMA 168# DMA
163 169
164config S3C_DMA 170config S3C_DMA
@@ -178,6 +184,11 @@ config S3C_DEV_HSMMC1
178 help 184 help
179 Compile in platform device definitions for HSMMC channel 1 185 Compile in platform device definitions for HSMMC channel 1
180 186
187config S3C_DEV_HSMMC2
188 bool
189 help
190 Compile in platform device definitions for HSMMC channel 2
191
181config S3C_DEV_I2C1 192config S3C_DEV_I2C1
182 bool 193 bool
183 help 194 help
diff --git a/arch/arm/plat-s3c/Makefile b/arch/arm/plat-s3c/Makefile
index 3c09109e9e84..50444da98425 100644
--- a/arch/arm/plat-s3c/Makefile
+++ b/arch/arm/plat-s3c/Makefile
@@ -36,6 +36,7 @@ obj-$(CONFIG_HAVE_PWM) += pwm.o
36 36
37obj-$(CONFIG_S3C_DEV_HSMMC) += dev-hsmmc.o 37obj-$(CONFIG_S3C_DEV_HSMMC) += dev-hsmmc.o
38obj-$(CONFIG_S3C_DEV_HSMMC1) += dev-hsmmc1.o 38obj-$(CONFIG_S3C_DEV_HSMMC1) += dev-hsmmc1.o
39obj-$(CONFIG_S3C_DEV_HSMMC2) += dev-hsmmc2.o
39obj-y += dev-i2c0.o 40obj-y += dev-i2c0.o
40obj-$(CONFIG_S3C_DEV_I2C1) += dev-i2c1.o 41obj-$(CONFIG_S3C_DEV_I2C1) += dev-i2c1.o
41obj-$(CONFIG_S3C_DEV_FB) += dev-fb.o 42obj-$(CONFIG_S3C_DEV_FB) += dev-fb.o
diff --git a/arch/arm/plat-s3c/clock.c b/arch/arm/plat-s3c/clock.c
index 4d01ef1a25dd..619cfa82dcab 100644
--- a/arch/arm/plat-s3c/clock.c
+++ b/arch/arm/plat-s3c/clock.c
@@ -1,6 +1,6 @@
1/* linux/arch/arm/plat-s3c24xx/clock.c 1/* linux/arch/arm/plat-s3c24xx/clock.c
2 * 2 *
3 * Copyright (c) 2004-2005 Simtec Electronics 3 * Copyright 2004-2005 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk> 4 * Ben Dooks <ben@simtec.co.uk>
5 * 5 *
6 * S3C24XX Core clock control support 6 * S3C24XX Core clock control support
@@ -337,7 +337,7 @@ int s3c24xx_register_clocks(struct clk **clks, int nr_clks)
337 337
338int __init s3c24xx_register_baseclocks(unsigned long xtal) 338int __init s3c24xx_register_baseclocks(unsigned long xtal)
339{ 339{
340 printk(KERN_INFO "S3C24XX Clocks, (c) 2004 Simtec Electronics\n"); 340 printk(KERN_INFO "S3C24XX Clocks, Copyright 2004 Simtec Electronics\n");
341 341
342 clk_xtal.rate = xtal; 342 clk_xtal.rate = xtal;
343 343
diff --git a/arch/arm/plat-s3c/dev-hsmmc2.c b/arch/arm/plat-s3c/dev-hsmmc2.c
new file mode 100644
index 000000000000..824580bc0e06
--- /dev/null
+++ b/arch/arm/plat-s3c/dev-hsmmc2.c
@@ -0,0 +1,69 @@
1/* linux/arch/arm/plat-s3c/dev-hsmmc2.c
2 *
3 * Copyright (c) 2009 Samsung Electronics
4 * Copyright (c) 2009 Maurus Cuelenaere
5 *
6 * Based on arch/arm/plat-s3c/dev-hsmmc1.c
7 * original file Copyright (c) 2008 Simtec Electronics
8 *
9 * S3C series device definition for hsmmc device 2
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License version 2 as
13 * published by the Free Software Foundation.
14*/
15
16#include <linux/kernel.h>
17#include <linux/platform_device.h>
18#include <linux/mmc/host.h>
19
20#include <mach/map.h>
21#include <plat/sdhci.h>
22#include <plat/devs.h>
23
24#define S3C_SZ_HSMMC (0x1000)
25
26static struct resource s3c_hsmmc2_resource[] = {
27 [0] = {
28 .start = S3C_PA_HSMMC2,
29 .end = S3C_PA_HSMMC2 + S3C_SZ_HSMMC - 1,
30 .flags = IORESOURCE_MEM,
31 },
32 [1] = {
33 .start = IRQ_HSMMC2,
34 .end = IRQ_HSMMC2,
35 .flags = IORESOURCE_IRQ,
36 }
37};
38
39static u64 s3c_device_hsmmc2_dmamask = 0xffffffffUL;
40
41struct s3c_sdhci_platdata s3c_hsmmc2_def_platdata = {
42 .max_width = 4,
43 .host_caps = (MMC_CAP_4_BIT_DATA |
44 MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED),
45};
46
47struct platform_device s3c_device_hsmmc2 = {
48 .name = "s3c-sdhci",
49 .id = 2,
50 .num_resources = ARRAY_SIZE(s3c_hsmmc2_resource),
51 .resource = s3c_hsmmc2_resource,
52 .dev = {
53 .dma_mask = &s3c_device_hsmmc2_dmamask,
54 .coherent_dma_mask = 0xffffffffUL,
55 .platform_data = &s3c_hsmmc2_def_platdata,
56 },
57};
58
59void s3c_sdhci2_set_platdata(struct s3c_sdhci_platdata *pd)
60{
61 struct s3c_sdhci_platdata *set = &s3c_hsmmc2_def_platdata;
62
63 set->max_width = pd->max_width;
64
65 if (pd->cfg_gpio)
66 set->cfg_gpio = pd->cfg_gpio;
67 if (pd->cfg_card)
68 set->cfg_card = pd->cfg_card;
69}
diff --git a/arch/arm/plat-s3c/dev-i2c0.c b/arch/arm/plat-s3c/dev-i2c0.c
index 428372868fbb..4c761529b949 100644
--- a/arch/arm/plat-s3c/dev-i2c0.c
+++ b/arch/arm/plat-s3c/dev-i2c0.c
@@ -1,6 +1,6 @@
1/* linux/arch/arm/plat-s3c/dev-i2c0.c 1/* linux/arch/arm/plat-s3c/dev-i2c0.c
2 * 2 *
3 * Copyright 2008,2009 Simtec Electronics 3 * Copyright 2008-2009 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk> 4 * Ben Dooks <ben@simtec.co.uk>
5 * http://armlinux.simtec.co.uk/ 5 * http://armlinux.simtec.co.uk/
6 * 6 *
diff --git a/arch/arm/plat-s3c/dev-i2c1.c b/arch/arm/plat-s3c/dev-i2c1.c
index 8349c462788c..d44f79110506 100644
--- a/arch/arm/plat-s3c/dev-i2c1.c
+++ b/arch/arm/plat-s3c/dev-i2c1.c
@@ -1,6 +1,6 @@
1/* linux/arch/arm/plat-s3c/dev-i2c1.c 1/* linux/arch/arm/plat-s3c/dev-i2c1.c
2 * 2 *
3 * Copyright 2008,2009 Simtec Electronics 3 * Copyright 2008-2009 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk> 4 * Ben Dooks <ben@simtec.co.uk>
5 * http://armlinux.simtec.co.uk/ 5 * http://armlinux.simtec.co.uk/
6 * 6 *
diff --git a/arch/arm/plat-s3c/dev-nand.c b/arch/arm/plat-s3c/dev-nand.c
index 4e5323732434..e771e77dcd54 100644
--- a/arch/arm/plat-s3c/dev-nand.c
+++ b/arch/arm/plat-s3c/dev-nand.c
@@ -9,8 +9,12 @@
9#include <linux/kernel.h> 9#include <linux/kernel.h>
10#include <linux/platform_device.h> 10#include <linux/platform_device.h>
11 11
12#include <linux/mtd/mtd.h>
13#include <linux/mtd/partitions.h>
14
12#include <mach/map.h> 15#include <mach/map.h>
13#include <plat/devs.h> 16#include <plat/devs.h>
17#include <plat/nand.h>
14 18
15static struct resource s3c_nand_resource[] = { 19static struct resource s3c_nand_resource[] = {
16 [0] = { 20 [0] = {
@@ -28,3 +32,96 @@ struct platform_device s3c_device_nand = {
28}; 32};
29 33
30EXPORT_SYMBOL(s3c_device_nand); 34EXPORT_SYMBOL(s3c_device_nand);
35
36/**
37 * s3c_nand_copy_set() - copy nand set data
38 * @set: The new structure, directly copied from the old.
39 *
40 * Copy all the fields from the NAND set field from what is probably __initdata
41 * to new kernel memory. The code returns 0 if the copy happened correctly or
42 * an error code for the calling function to display.
43 *
44 * Note, we currently do not try and look to see if we've already copied the
45 * data in a previous set.
46 */
47static int __init s3c_nand_copy_set(struct s3c2410_nand_set *set)
48{
49 void *ptr;
50 int size;
51
52 size = sizeof(struct mtd_partition) * set->nr_partitions;
53 if (size) {
54 ptr = kmemdup(set->partitions, size, GFP_KERNEL);
55 set->partitions = ptr;
56
57 if (!ptr)
58 return -ENOMEM;
59 }
60
61 size = sizeof(int) * set->nr_chips;
62 if (size) {
63 ptr = kmemdup(set->nr_map, size, GFP_KERNEL);
64 set->nr_map = ptr;
65
66 if (!ptr)
67 return -ENOMEM;
68 }
69
70 if (set->ecc_layout) {
71 ptr = kmemdup(set->ecc_layout,
72 sizeof(struct nand_ecclayout), GFP_KERNEL);
73 set->ecc_layout = ptr;
74
75 if (!ptr)
76 return -ENOMEM;
77 }
78
79 return 0;
80}
81
82void __init s3c_nand_set_platdata(struct s3c2410_platform_nand *nand)
83{
84 struct s3c2410_platform_nand *npd;
85 int size;
86 int ret;
87
88 /* note, if we get a failure in allocation, we simply drop out of the
89 * function. If there is so little memory available at initialisation
90 * time then there is little chance the system is going to run.
91 */
92
93 npd = kmemdup(nand, sizeof(struct s3c2410_platform_nand), GFP_KERNEL);
94 if (!npd) {
95 printk(KERN_ERR "%s: failed copying platform data\n", __func__);
96 return;
97 }
98
99 /* now see if we need to copy any of the nand set data */
100
101 size = sizeof(struct s3c2410_nand_set) * npd->nr_sets;
102 if (size) {
103 struct s3c2410_nand_set *from = npd->sets;
104 struct s3c2410_nand_set *to;
105 int i;
106
107 to = kmemdup(from, size, GFP_KERNEL);
108 npd->sets = to; /* set, even if we failed */
109
110 if (!to) {
111 printk(KERN_ERR "%s: no memory for sets\n", __func__);
112 return;
113 }
114
115 for (i = 0; i < npd->nr_sets; i++) {
116 ret = s3c_nand_copy_set(to);
117 if (!ret) {
118 printk(KERN_ERR "%s: failed to copy set %d\n",
119 __func__, i);
120 return;
121 }
122 to++;
123 }
124 }
125}
126
127EXPORT_SYMBOL_GPL(s3c_nand_set_platdata);
diff --git a/arch/arm/plat-s3c/dma.c b/arch/arm/plat-s3c/dma.c
index c9db75c06af5..a995850cd9d5 100644
--- a/arch/arm/plat-s3c/dma.c
+++ b/arch/arm/plat-s3c/dma.c
@@ -1,6 +1,6 @@
1/* linux/arch/arm/plat-s3c/dma.c 1/* linux/arch/arm/plat-s3c/dma.c
2 * 2 *
3 * Copyright (c) 2003-2005,2006,2009 Simtec Electronics 3 * Copyright (c) 2003-2009 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk> 4 * Ben Dooks <ben@simtec.co.uk>
5 * http://armlinux.simtec.co.uk/ 5 * http://armlinux.simtec.co.uk/
6 * 6 *
diff --git a/arch/arm/plat-s3c/include/plat/audio-simtec.h b/arch/arm/plat-s3c/include/plat/audio-simtec.h
index 0f440b9168db..53a93656d5db 100644
--- a/arch/arm/plat-s3c/include/plat/audio-simtec.h
+++ b/arch/arm/plat-s3c/include/plat/audio-simtec.h
@@ -33,5 +33,5 @@ struct s3c24xx_audio_simtec_pdata {
33 void (*startup)(void); 33 void (*startup)(void);
34}; 34};
35 35
36extern int simtec_audio_add(const char *codec_name, 36extern int simtec_audio_add(const char *codec_name, bool has_lr_routing,
37 struct s3c24xx_audio_simtec_pdata *pdata); 37 struct s3c24xx_audio_simtec_pdata *pdata);
diff --git a/arch/arm/plat-s3c/include/plat/cpu-freq.h b/arch/arm/plat-s3c/include/plat/cpu-freq.h
index 7b982b7f28cd..94eb06a2ea5c 100644
--- a/arch/arm/plat-s3c/include/plat/cpu-freq.h
+++ b/arch/arm/plat-s3c/include/plat/cpu-freq.h
@@ -1,6 +1,6 @@
1/* arch/arm/plat-s3c/include/plat/cpu-freq.h 1/* arch/arm/plat-s3c/include/plat/cpu-freq.h
2 * 2 *
3 * Copyright (c) 2006,2007 Simtec Electronics 3 * Copyright (c) 2006-2007 Simtec Electronics
4 * http://armlinux.simtec.co.uk/ 4 * http://armlinux.simtec.co.uk/
5 * Ben Dooks <ben@simtec.co.uk> 5 * Ben Dooks <ben@simtec.co.uk>
6 * 6 *
diff --git a/arch/arm/plat-s3c/include/plat/cpu.h b/arch/arm/plat-s3c/include/plat/cpu.h
index fbc3d498e02e..d1131ca11e97 100644
--- a/arch/arm/plat-s3c/include/plat/cpu.h
+++ b/arch/arm/plat-s3c/include/plat/cpu.h
@@ -12,6 +12,9 @@
12 12
13/* todo - fix when rmk changes iodescs to use `void __iomem *` */ 13/* todo - fix when rmk changes iodescs to use `void __iomem *` */
14 14
15#ifndef __SAMSUNG_PLAT_CPU_H
16#define __SAMSUNG_PLAT_CPU_H
17
15#define IODESC_ENT(x) { (unsigned long)S3C24XX_VA_##x, __phys_to_pfn(S3C24XX_PA_##x), S3C24XX_SZ_##x, MT_DEVICE } 18#define IODESC_ENT(x) { (unsigned long)S3C24XX_VA_##x, __phys_to_pfn(S3C24XX_PA_##x), S3C24XX_SZ_##x, MT_DEVICE }
16 19
17#ifndef MHZ 20#ifndef MHZ
@@ -73,3 +76,6 @@ extern struct sysdev_class s3c2443_sysclass;
73extern struct sysdev_class s3c6410_sysclass; 76extern struct sysdev_class s3c6410_sysclass;
74extern struct sysdev_class s3c64xx_sysclass; 77extern struct sysdev_class s3c64xx_sysclass;
75 78
79extern void (*s5pc1xx_idle)(void);
80
81#endif
diff --git a/arch/arm/plat-s3c/include/plat/dma.h b/arch/arm/plat-s3c/include/plat/dma.h
index 34dba98f08e1..e429d10be3ad 100644
--- a/arch/arm/plat-s3c/include/plat/dma.h
+++ b/arch/arm/plat-s3c/include/plat/dma.h
@@ -1,6 +1,6 @@
1/* arch/arm/plat-s3c/include/plat/dma.h 1/* arch/arm/plat-s3c/include/plat/dma.h
2 * 2 *
3 * Copyright (C) 2003,2004,2006 Simtec Electronics 3 * Copyright (C) 2003-2006 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk> 4 * Ben Dooks <ben@simtec.co.uk>
5 * 5 *
6 * Samsung S3C DMA support 6 * Samsung S3C DMA support
diff --git a/arch/arm/plat-s3c/include/plat/fb.h b/arch/arm/plat-s3c/include/plat/fb.h
index 214ff561b0dd..f8db87930f8b 100644
--- a/arch/arm/plat-s3c/include/plat/fb.h
+++ b/arch/arm/plat-s3c/include/plat/fb.h
@@ -70,4 +70,11 @@ extern void s3c_fb_set_platdata(struct s3c_fb_platdata *pd);
70 */ 70 */
71extern void s3c64xx_fb_gpio_setup_24bpp(void); 71extern void s3c64xx_fb_gpio_setup_24bpp(void);
72 72
73/**
74 * s5pc100_fb_gpio_setup_24bpp() - S5PC100 setup function for 24bpp LCD
75 *
76 * Initialise the GPIO for an 24bpp LCD display on the RGB interface.
77 */
78extern void s5pc100_fb_gpio_setup_24bpp(void);
79
73#endif /* __PLAT_S3C_FB_H */ 80#endif /* __PLAT_S3C_FB_H */
diff --git a/arch/arm/plat-s3c/include/plat/iic.h b/arch/arm/plat-s3c/include/plat/iic.h
index 67450f115748..3083df00dee6 100644
--- a/arch/arm/plat-s3c/include/plat/iic.h
+++ b/arch/arm/plat-s3c/include/plat/iic.h
@@ -1,6 +1,6 @@
1/* arch/arm/plat-s3c/include/plat/iic.h 1/* arch/arm/plat-s3c/include/plat/iic.h
2 * 2 *
3 * Copyright 2004,2009 Simtec Electronics 3 * Copyright 2004-2009 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk> 4 * Ben Dooks <ben@simtec.co.uk>
5 * 5 *
6 * S3C - I2C Controller platform_device info 6 * S3C - I2C Controller platform_device info
diff --git a/arch/arm/plat-s3c/include/plat/nand.h b/arch/arm/plat-s3c/include/plat/nand.h
index 18f958801e64..065985978413 100644
--- a/arch/arm/plat-s3c/include/plat/nand.h
+++ b/arch/arm/plat-s3c/include/plat/nand.h
@@ -55,3 +55,11 @@ struct s3c2410_platform_nand {
55 int chip); 55 int chip);
56}; 56};
57 57
58/**
59 * s3c_nand_set_platdata() - register NAND platform data.
60 * @nand: The NAND platform data to register with s3c_device_nand.
61 *
62 * This function copies the given NAND platform data, @nand and registers
63 * it with the s3c_device_nand. This allows @nand to be __initdata.
64*/
65extern void s3c_nand_set_platdata(struct s3c2410_platform_nand *nand);
diff --git a/arch/arm/plat-s3c/include/plat/regs-fb-v4.h b/arch/arm/plat-s3c/include/plat/regs-fb-v4.h
new file mode 100644
index 000000000000..a60ed0d06c94
--- /dev/null
+++ b/arch/arm/plat-s3c/include/plat/regs-fb-v4.h
@@ -0,0 +1,235 @@
1/* arch/arm/plat-s3c/include/plat/regs-fb-v4.h
2 *
3 * Copyright 2008 Openmoko, Inc.
4 * Copyright 2008 Simtec Electronics
5 * http://armlinux.simtec.co.uk/
6 * Ben Dooks <ben@simtec.co.uk>
7 *
8 * S3C64XX - new-style framebuffer register definitions
9 *
10 * This is the register set for the new style framebuffer interface
11 * found from the S3C2443 onwards and specifically the S3C64XX series
12 * S3C6400 and S3C6410.
13 *
14 * The file contains the cpu specific items which change between whichever
15 * architecture is selected. See <plat/regs-fb.h> for the core definitions
16 * that are the same.
17 *
18 * This program is free software; you can redistribute it and/or modify
19 * it under the terms of the GNU General Public License version 2 as
20 * published by the Free Software Foundation.
21*/
22
23/* include the core definitions here, in case we really do need to
24 * override them at a later date.
25*/
26
27#include <plat/regs-fb.h>
28
29#define S3C_FB_MAX_WIN (5) /* number of hardware windows available. */
30#define VIDCON1_FSTATUS_EVEN (1 << 15)
31
32/* Video timing controls */
33#define VIDTCON0 (0x10)
34#define VIDTCON1 (0x14)
35#define VIDTCON2 (0x18)
36
37/* Window position controls */
38
39#define WINCON(_win) (0x20 + ((_win) * 4))
40
41/* OSD1 and OSD4 do not have register D */
42
43#define VIDOSD_A(_win) (0x40 + ((_win) * 16))
44#define VIDOSD_B(_win) (0x44 + ((_win) * 16))
45#define VIDOSD_C(_win) (0x48 + ((_win) * 16))
46#define VIDOSD_D(_win) (0x4C + ((_win) * 16))
47
48
49#define VIDINTCON0 (0x130)
50
51#define WxKEYCONy(_win, _con) ((0x140 + ((_win) * 8)) + ((_con) * 4))
52
53/* WINCONx */
54
55#define WINCONx_CSCWIDTH_MASK (0x3 << 26)
56#define WINCONx_CSCWIDTH_SHIFT (26)
57#define WINCONx_CSCWIDTH_WIDE (0x0 << 26)
58#define WINCONx_CSCWIDTH_NARROW (0x3 << 26)
59
60#define WINCONx_ENLOCAL (1 << 22)
61#define WINCONx_BUFSTATUS (1 << 21)
62#define WINCONx_BUFSEL (1 << 20)
63#define WINCONx_BUFAUTOEN (1 << 19)
64#define WINCONx_YCbCr (1 << 13)
65
66#define WINCON1_LOCALSEL_CAMIF (1 << 23)
67
68#define WINCON2_LOCALSEL_CAMIF (1 << 23)
69#define WINCON2_BLD_PIX (1 << 6)
70
71#define WINCON2_ALPHA_SEL (1 << 1)
72#define WINCON2_BPPMODE_MASK (0xf << 2)
73#define WINCON2_BPPMODE_SHIFT (2)
74#define WINCON2_BPPMODE_1BPP (0x0 << 2)
75#define WINCON2_BPPMODE_2BPP (0x1 << 2)
76#define WINCON2_BPPMODE_4BPP (0x2 << 2)
77#define WINCON2_BPPMODE_8BPP_1232 (0x4 << 2)
78#define WINCON2_BPPMODE_16BPP_565 (0x5 << 2)
79#define WINCON2_BPPMODE_16BPP_A1555 (0x6 << 2)
80#define WINCON2_BPPMODE_16BPP_I1555 (0x7 << 2)
81#define WINCON2_BPPMODE_18BPP_666 (0x8 << 2)
82#define WINCON2_BPPMODE_18BPP_A1665 (0x9 << 2)
83#define WINCON2_BPPMODE_19BPP_A1666 (0xa << 2)
84#define WINCON2_BPPMODE_24BPP_888 (0xb << 2)
85#define WINCON2_BPPMODE_24BPP_A1887 (0xc << 2)
86#define WINCON2_BPPMODE_25BPP_A1888 (0xd << 2)
87#define WINCON2_BPPMODE_28BPP_A4888 (0xd << 2)
88
89#define WINCON3_BLD_PIX (1 << 6)
90
91#define WINCON3_ALPHA_SEL (1 << 1)
92#define WINCON3_BPPMODE_MASK (0xf << 2)
93#define WINCON3_BPPMODE_SHIFT (2)
94#define WINCON3_BPPMODE_1BPP (0x0 << 2)
95#define WINCON3_BPPMODE_2BPP (0x1 << 2)
96#define WINCON3_BPPMODE_4BPP (0x2 << 2)
97#define WINCON3_BPPMODE_16BPP_565 (0x5 << 2)
98#define WINCON3_BPPMODE_16BPP_A1555 (0x6 << 2)
99#define WINCON3_BPPMODE_16BPP_I1555 (0x7 << 2)
100#define WINCON3_BPPMODE_18BPP_666 (0x8 << 2)
101#define WINCON3_BPPMODE_18BPP_A1665 (0x9 << 2)
102#define WINCON3_BPPMODE_19BPP_A1666 (0xa << 2)
103#define WINCON3_BPPMODE_24BPP_888 (0xb << 2)
104#define WINCON3_BPPMODE_24BPP_A1887 (0xc << 2)
105#define WINCON3_BPPMODE_25BPP_A1888 (0xd << 2)
106#define WINCON3_BPPMODE_28BPP_A4888 (0xd << 2)
107
108#define VIDINTCON0_FIFIOSEL_WINDOW2 (0x10 << 5)
109#define VIDINTCON0_FIFIOSEL_WINDOW3 (0x20 << 5)
110#define VIDINTCON0_FIFIOSEL_WINDOW4 (0x40 << 5)
111
112#define DITHMODE (0x170)
113#define WINxMAP(_win) (0x180 + ((_win) * 4))
114
115
116#define DITHMODE_R_POS_MASK (0x3 << 5)
117#define DITHMODE_R_POS_SHIFT (5)
118#define DITHMODE_R_POS_8BIT (0x0 << 5)
119#define DITHMODE_R_POS_6BIT (0x1 << 5)
120#define DITHMODE_R_POS_5BIT (0x2 << 5)
121
122#define DITHMODE_G_POS_MASK (0x3 << 3)
123#define DITHMODE_G_POS_SHIFT (3)
124#define DITHMODE_G_POS_8BIT (0x0 << 3)
125#define DITHMODE_G_POS_6BIT (0x1 << 3)
126#define DITHMODE_G_POS_5BIT (0x2 << 3)
127
128#define DITHMODE_B_POS_MASK (0x3 << 1)
129#define DITHMODE_B_POS_SHIFT (1)
130#define DITHMODE_B_POS_8BIT (0x0 << 1)
131#define DITHMODE_B_POS_6BIT (0x1 << 1)
132#define DITHMODE_B_POS_5BIT (0x2 << 1)
133
134#define DITHMODE_DITH_EN (1 << 0)
135
136#define WPALCON (0x1A0)
137
138/* Palette control */
139/* Note for S5PC100: you can still use those macros on WPALCON (aka WPALCON_L),
140 * but make sure that WPALCON_H W2PAL-W4PAL entries are zeroed out */
141#define WPALCON_W4PAL_16BPP_A555 (1 << 8)
142#define WPALCON_W3PAL_16BPP_A555 (1 << 7)
143#define WPALCON_W2PAL_16BPP_A555 (1 << 6)
144
145
146/* system specific implementation code for palette sizes, and other
147 * information that changes depending on which architecture is being
148 * compiled.
149*/
150
151/* return true if window _win has OSD register D */
152#define s3c_fb_has_osd_d(_win) ((_win) != 4 && (_win) != 0)
153
154static inline unsigned int s3c_fb_win_pal_size(unsigned int win)
155{
156 if (win < 2)
157 return 256;
158 if (win < 4)
159 return 16;
160 if (win == 4)
161 return 4;
162
163 BUG(); /* shouldn't get here */
164}
165
166static inline int s3c_fb_validate_win_bpp(unsigned int win, unsigned int bpp)
167{
168 /* all windows can do 1/2 bpp */
169
170 if ((bpp == 25 || bpp == 19) && win == 0)
171 return 0; /* win 0 does not have 19 or 25bpp modes */
172
173 if (bpp == 4 && win == 4)
174 return 0;
175
176 if (bpp == 8 && (win >= 3))
177 return 0; /* win 3/4 cannot do 8bpp in any mode */
178
179 return 1;
180}
181
182static inline int s3c_fb_pal_is16(unsigned int window)
183{
184 return window > 1;
185}
186
187struct s3c_fb_palette {
188 struct fb_bitfield r;
189 struct fb_bitfield g;
190 struct fb_bitfield b;
191 struct fb_bitfield a;
192};
193
194static inline void s3c_fb_init_palette(unsigned int window,
195 struct s3c_fb_palette *palette)
196{
197 if (window < 2) {
198 /* Windows 0/1 are 8/8/8 or A/8/8/8 */
199 palette->r.offset = 16;
200 palette->r.length = 8;
201 palette->g.offset = 8;
202 palette->g.length = 8;
203 palette->b.offset = 0;
204 palette->b.length = 8;
205 } else {
206 /* currently we assume RGB 5/6/5 */
207 palette->r.offset = 11;
208 palette->r.length = 5;
209 palette->g.offset = 5;
210 palette->g.length = 6;
211 palette->b.offset = 0;
212 palette->b.length = 5;
213 }
214}
215
216/* Notes on per-window bpp settings
217 *
218 * Value Win0 Win1 Win2 Win3 Win 4
219 * 0000 1(P) 1(P) 1(P) 1(P) 1(P)
220 * 0001 2(P) 2(P) 2(P) 2(P) 2(P)
221 * 0010 4(P) 4(P) 4(P) 4(P) -none-
222 * 0011 8(P) 8(P) -none- -none- -none-
223 * 0100 -none- 8(A232) 8(A232) -none- -none-
224 * 0101 16(565) 16(565) 16(565) 16(565) 16(565)
225 * 0110 -none- 16(A555) 16(A555) 16(A555) 16(A555)
226 * 0111 16(I555) 16(I565) 16(I555) 16(I555) 16(I555)
227 * 1000 18(666) 18(666) 18(666) 18(666) 18(666)
228 * 1001 -none- 18(A665) 18(A665) 18(A665) 16(A665)
229 * 1010 -none- 19(A666) 19(A666) 19(A666) 19(A666)
230 * 1011 24(888) 24(888) 24(888) 24(888) 24(888)
231 * 1100 -none- 24(A887) 24(A887) 24(A887) 24(A887)
232 * 1101 -none- 25(A888) 25(A888) 25(A888) 25(A888)
233 * 1110 -none- -none- -none- -none- -none-
234 * 1111 -none- -none- -none- -none- -none-
235*/
diff --git a/arch/arm/plat-s3c/include/plat/regs-nand.h b/arch/arm/plat-s3c/include/plat/regs-nand.h
index b2caa4bca270..238efea7b9e4 100644
--- a/arch/arm/plat-s3c/include/plat/regs-nand.h
+++ b/arch/arm/plat-s3c/include/plat/regs-nand.h
@@ -1,7 +1,7 @@
1/* arch/arm/mach-s3c2410/include/mach/regs-nand.h 1/* arch/arm/mach-s3c2410/include/mach/regs-nand.h
2 * 2 *
3 * Copyright (c) 2004,2005 Simtec Electronics <linux@simtec.co.uk> 3 * Copyright (c) 2004-2005 Simtec Electronics <linux@simtec.co.uk>
4 * http://www.simtec.co.uk/products/SWLINUX/ 4 * http://www.simtec.co.uk/products/SWLINUX/
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify 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 7 * it under the terms of the GNU General Public License version 2 as
diff --git a/arch/arm/plat-s3c/include/plat/regs-serial.h b/arch/arm/plat-s3c/include/plat/regs-serial.h
index 66af75a5cdd1..85d8904e7f24 100644
--- a/arch/arm/plat-s3c/include/plat/regs-serial.h
+++ b/arch/arm/plat-s3c/include/plat/regs-serial.h
@@ -6,7 +6,7 @@
6 * 6 *
7 * Copyright (C) 2002 Shane Nay (shane@minirl.com) 7 * Copyright (C) 2002 Shane Nay (shane@minirl.com)
8 * 8 *
9 * Additional defines, (c) 2003 Simtec Electronics (linux@simtec.co.uk) 9 * Additional defines, Copyright 2003 Simtec Electronics (linux@simtec.co.uk)
10 * 10 *
11 * Adapted from: 11 * Adapted from:
12 * 12 *
diff --git a/arch/arm/plat-s3c/include/plat/sdhci.h b/arch/arm/plat-s3c/include/plat/sdhci.h
index f615308ccdfb..53198673b6bd 100644
--- a/arch/arm/plat-s3c/include/plat/sdhci.h
+++ b/arch/arm/plat-s3c/include/plat/sdhci.h
@@ -57,6 +57,7 @@ struct s3c_sdhci_platdata {
57 */ 57 */
58extern void s3c_sdhci0_set_platdata(struct s3c_sdhci_platdata *pd); 58extern void s3c_sdhci0_set_platdata(struct s3c_sdhci_platdata *pd);
59extern void s3c_sdhci1_set_platdata(struct s3c_sdhci_platdata *pd); 59extern void s3c_sdhci1_set_platdata(struct s3c_sdhci_platdata *pd);
60extern void s3c_sdhci2_set_platdata(struct s3c_sdhci_platdata *pd);
60 61
61/* Default platform data, exported so that per-cpu initialisation can 62/* Default platform data, exported so that per-cpu initialisation can
62 * set the correct one when there are more than one cpu type selected. 63 * set the correct one when there are more than one cpu type selected.
@@ -64,11 +65,16 @@ extern void s3c_sdhci1_set_platdata(struct s3c_sdhci_platdata *pd);
64 65
65extern struct s3c_sdhci_platdata s3c_hsmmc0_def_platdata; 66extern struct s3c_sdhci_platdata s3c_hsmmc0_def_platdata;
66extern struct s3c_sdhci_platdata s3c_hsmmc1_def_platdata; 67extern struct s3c_sdhci_platdata s3c_hsmmc1_def_platdata;
68extern struct s3c_sdhci_platdata s3c_hsmmc2_def_platdata;
67 69
68/* Helper function availablity */ 70/* Helper function availablity */
69 71
70extern void s3c64xx_setup_sdhci0_cfg_gpio(struct platform_device *, int w); 72extern void s3c64xx_setup_sdhci0_cfg_gpio(struct platform_device *, int w);
71extern void s3c64xx_setup_sdhci1_cfg_gpio(struct platform_device *, int w); 73extern void s3c64xx_setup_sdhci1_cfg_gpio(struct platform_device *, int w);
74extern void s5pc100_setup_sdhci0_cfg_gpio(struct platform_device *, int w);
75extern void s5pc100_setup_sdhci1_cfg_gpio(struct platform_device *, int w);
76extern void s5pc100_setup_sdhci2_cfg_gpio(struct platform_device *, int w);
77extern void s3c64xx_setup_sdhci2_cfg_gpio(struct platform_device *, int w);
72 78
73/* S3C6400 SDHCI setup */ 79/* S3C6400 SDHCI setup */
74 80
@@ -103,6 +109,17 @@ static inline void s3c6400_default_sdhci1(void)
103static inline void s3c6400_default_sdhci1(void) { } 109static inline void s3c6400_default_sdhci1(void) { }
104#endif /* CONFIG_S3C_DEV_HSMMC1 */ 110#endif /* CONFIG_S3C_DEV_HSMMC1 */
105 111
112#ifdef CONFIG_S3C_DEV_HSMMC2
113static inline void s3c6400_default_sdhci2(void)
114{
115 s3c_hsmmc2_def_platdata.clocks = s3c6400_hsmmc_clksrcs;
116 s3c_hsmmc2_def_platdata.cfg_gpio = s3c64xx_setup_sdhci2_cfg_gpio;
117 s3c_hsmmc2_def_platdata.cfg_card = s3c6400_setup_sdhci_cfg_card;
118}
119#else
120static inline void s3c6400_default_sdhci2(void) { }
121#endif /* CONFIG_S3C_DEV_HSMMC2 */
122
106#else 123#else
107static inline void s3c6400_default_sdhci0(void) { } 124static inline void s3c6400_default_sdhci0(void) { }
108static inline void s3c6400_default_sdhci1(void) { } 125static inline void s3c6400_default_sdhci1(void) { }
@@ -140,9 +157,70 @@ static inline void s3c6410_default_sdhci1(void)
140static inline void s3c6410_default_sdhci1(void) { } 157static inline void s3c6410_default_sdhci1(void) { }
141#endif /* CONFIG_S3C_DEV_HSMMC1 */ 158#endif /* CONFIG_S3C_DEV_HSMMC1 */
142 159
160#ifdef CONFIG_S3C_DEV_HSMMC2
161static inline void s3c6410_default_sdhci2(void)
162{
163 s3c_hsmmc2_def_platdata.clocks = s3c6410_hsmmc_clksrcs;
164 s3c_hsmmc2_def_platdata.cfg_gpio = s3c64xx_setup_sdhci2_cfg_gpio;
165 s3c_hsmmc2_def_platdata.cfg_card = s3c6410_setup_sdhci0_cfg_card;
166}
167#else
168static inline void s3c6410_default_sdhci2(void) { }
169#endif /* CONFIG_S3C_DEV_HSMMC2 */
170
143#else 171#else
144static inline void s3c6410_default_sdhci0(void) { } 172static inline void s3c6410_default_sdhci0(void) { }
145static inline void s3c6410_default_sdhci1(void) { } 173static inline void s3c6410_default_sdhci1(void) { }
146#endif /* CONFIG_S3C6410_SETUP_SDHCI */ 174#endif /* CONFIG_S3C6410_SETUP_SDHCI */
147 175
176/* S5PC100 SDHCI setup */
177
178#ifdef CONFIG_S5PC100_SETUP_SDHCI
179extern char *s5pc100_hsmmc_clksrcs[4];
180
181extern void s5pc100_setup_sdhci0_cfg_card(struct platform_device *dev,
182 void __iomem *r,
183 struct mmc_ios *ios,
184 struct mmc_card *card);
185
186#ifdef CONFIG_S3C_DEV_HSMMC
187static inline void s5pc100_default_sdhci0(void)
188{
189 s3c_hsmmc0_def_platdata.clocks = s5pc100_hsmmc_clksrcs;
190 s3c_hsmmc0_def_platdata.cfg_gpio = s5pc100_setup_sdhci0_cfg_gpio;
191 s3c_hsmmc0_def_platdata.cfg_card = s5pc100_setup_sdhci0_cfg_card;
192}
193#else
194static inline void s5pc100_default_sdhci0(void) { }
195#endif /* CONFIG_S3C_DEV_HSMMC */
196
197#ifdef CONFIG_S3C_DEV_HSMMC1
198static inline void s5pc100_default_sdhci1(void)
199{
200 s3c_hsmmc1_def_platdata.clocks = s5pc100_hsmmc_clksrcs;
201 s3c_hsmmc1_def_platdata.cfg_gpio = s5pc100_setup_sdhci1_cfg_gpio;
202 s3c_hsmmc1_def_platdata.cfg_card = s5pc100_setup_sdhci0_cfg_card;
203}
204#else
205static inline void s5pc100_default_sdhci1(void) { }
206#endif /* CONFIG_S3C_DEV_HSMMC1 */
207
208#ifdef CONFIG_S3C_DEV_HSMMC2
209static inline void s5pc100_default_sdhci2(void)
210{
211 s3c_hsmmc2_def_platdata.clocks = s5pc100_hsmmc_clksrcs;
212 s3c_hsmmc2_def_platdata.cfg_gpio = s5pc100_setup_sdhci2_cfg_gpio;
213 s3c_hsmmc2_def_platdata.cfg_card = s5pc100_setup_sdhci0_cfg_card;
214}
215#else
216static inline void s5pc100_default_sdhci2(void) { }
217#endif /* CONFIG_S3C_DEV_HSMMC1 */
218
219
220#else
221static inline void s5pc100_default_sdhci0(void) { }
222static inline void s5pc100_default_sdhci1(void) { }
223static inline void s5pc100_default_sdhci2(void) { }
224#endif /* CONFIG_S5PC100_SETUP_SDHCI */
225
148#endif /* __PLAT_S3C_SDHCI_H */ 226#endif /* __PLAT_S3C_SDHCI_H */
diff --git a/arch/arm/plat-s3c/pm-check.c b/arch/arm/plat-s3c/pm-check.c
index 39f2555564da..8eb1f439861c 100644
--- a/arch/arm/plat-s3c/pm-check.c
+++ b/arch/arm/plat-s3c/pm-check.c
@@ -1,7 +1,7 @@
1/* linux/arch/arm/plat-s3c/pm-check.c 1/* linux/arch/arm/plat-s3c/pm-check.c
2 * originally in linux/arch/arm/plat-s3c24xx/pm.c 2 * originally in linux/arch/arm/plat-s3c24xx/pm.c
3 * 3 *
4 * Copyright (c) 2004,2006,2008 Simtec Electronics 4 * Copyright (c) 2004-2008 Simtec Electronics
5 * http://armlinux.simtec.co.uk 5 * http://armlinux.simtec.co.uk
6 * Ben Dooks <ben@simtec.co.uk> 6 * Ben Dooks <ben@simtec.co.uk>
7 * 7 *
diff --git a/arch/arm/plat-s3c/pm.c b/arch/arm/plat-s3c/pm.c
index 8d97db2c7a0d..767470601e5c 100644
--- a/arch/arm/plat-s3c/pm.c
+++ b/arch/arm/plat-s3c/pm.c
@@ -1,7 +1,7 @@
1/* linux/arch/arm/plat-s3c/pm.c 1/* linux/arch/arm/plat-s3c/pm.c
2 * 2 *
3 * Copyright 2008 Openmoko, Inc. 3 * Copyright 2008 Openmoko, Inc.
4 * Copyright 2004,2006,2008 Simtec Electronics 4 * Copyright 2004-2008 Simtec Electronics
5 * Ben Dooks <ben@simtec.co.uk> 5 * Ben Dooks <ben@simtec.co.uk>
6 * http://armlinux.simtec.co.uk/ 6 * http://armlinux.simtec.co.uk/
7 * 7 *
diff --git a/arch/arm/plat-s3c24xx/Kconfig b/arch/arm/plat-s3c24xx/Kconfig
index 9c7aca489643..20fbf936bb93 100644
--- a/arch/arm/plat-s3c24xx/Kconfig
+++ b/arch/arm/plat-s3c24xx/Kconfig
@@ -178,4 +178,11 @@ config MACH_SMDK
178 help 178 help
179 Common machine code for SMDK2410 and SMDK2440 179 Common machine code for SMDK2410 and SMDK2440
180 180
181config S3C24XX_SIMTEC_AUDIO
182 bool
183 depends on (ARCH_BAST || MACH_VR1000 || MACH_OSIRIS || MACH_ANUBIS)
184 default y
185 help
186 Add audio devices for common Simtec S3C24XX boards
187
181endif 188endif
diff --git a/arch/arm/plat-s3c24xx/Makefile b/arch/arm/plat-s3c24xx/Makefile
index 7780d2dd833a..5dee8c12e8b4 100644
--- a/arch/arm/plat-s3c24xx/Makefile
+++ b/arch/arm/plat-s3c24xx/Makefile
@@ -55,3 +55,4 @@ obj-$(CONFIG_S3C24XX_SPI_BUS1_GPD8_GPD9_GPD10) += spi-bus1-gpd8_9_10.o
55# machine common support 55# machine common support
56 56
57obj-$(CONFIG_MACH_SMDK) += common-smdk.o 57obj-$(CONFIG_MACH_SMDK) += common-smdk.o
58obj-$(CONFIG_S3C24XX_SIMTEC_AUDIO) += simtec-audio.o
diff --git a/arch/arm/plat-s3c24xx/clock-dclk.c b/arch/arm/plat-s3c24xx/clock-dclk.c
index 0afb217a775e..ac061a1bcb37 100644
--- a/arch/arm/plat-s3c24xx/clock-dclk.c
+++ b/arch/arm/plat-s3c24xx/clock-dclk.c
@@ -1,6 +1,6 @@
1/* linux/arch/arm/plat-s3c24xx/clock-dclk.c 1/* linux/arch/arm/plat-s3c24xx/clock-dclk.c
2 * 2 *
3 * Copyright (c) 2004,2008 Simtec Electronics 3 * Copyright (c) 2004-2008 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk> 4 * Ben Dooks <ben@simtec.co.uk>
5 * http://armlinux.simtec.co.uk/ 5 * http://armlinux.simtec.co.uk/
6 * 6 *
diff --git a/arch/arm/plat-s3c24xx/common-smdk.c b/arch/arm/plat-s3c24xx/common-smdk.c
index aa119863c5ce..9e0e20ad2e46 100644
--- a/arch/arm/plat-s3c24xx/common-smdk.c
+++ b/arch/arm/plat-s3c24xx/common-smdk.c
@@ -198,7 +198,7 @@ void __init smdk_machine_init(void)
198 if (machine_is_smdk2443()) 198 if (machine_is_smdk2443())
199 smdk_nand_info.twrph0 = 50; 199 smdk_nand_info.twrph0 = 50;
200 200
201 s3c_device_nand.dev.platform_data = &smdk_nand_info; 201 s3c_nand_set_platdata(&smdk_nand_info);
202 202
203 platform_add_devices(smdk_devs, ARRAY_SIZE(smdk_devs)); 203 platform_add_devices(smdk_devs, ARRAY_SIZE(smdk_devs));
204 204
diff --git a/arch/arm/plat-s3c24xx/cpu-freq.c b/arch/arm/plat-s3c24xx/cpu-freq.c
index 4f1b789a1173..2d42efb9f4e9 100644
--- a/arch/arm/plat-s3c24xx/cpu-freq.c
+++ b/arch/arm/plat-s3c24xx/cpu-freq.c
@@ -1,6 +1,6 @@
1/* linux/arch/arm/plat-s3c24xx/cpu-freq.c 1/* linux/arch/arm/plat-s3c24xx/cpu-freq.c
2 * 2 *
3 * Copyright (c) 2006,2007,2008 Simtec Electronics 3 * Copyright (c) 2006-2008 Simtec Electronics
4 * http://armlinux.simtec.co.uk/ 4 * http://armlinux.simtec.co.uk/
5 * Ben Dooks <ben@simtec.co.uk> 5 * Ben Dooks <ben@simtec.co.uk>
6 * 6 *
diff --git a/arch/arm/plat-s3c24xx/dma.c b/arch/arm/plat-s3c24xx/dma.c
index f046f8c51084..f65192d5b1d7 100644
--- a/arch/arm/plat-s3c24xx/dma.c
+++ b/arch/arm/plat-s3c24xx/dma.c
@@ -1,6 +1,6 @@
1/* linux/arch/arm/plat-s3c24xx/dma.c 1/* linux/arch/arm/plat-s3c24xx/dma.c
2 * 2 *
3 * Copyright (c) 2003-2005,2006 Simtec Electronics 3 * Copyright 2003-2006 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk> 4 * Ben Dooks <ben@simtec.co.uk>
5 * 5 *
6 * S3C2410 DMA core 6 * S3C2410 DMA core
@@ -1310,7 +1310,7 @@ int __init s3c24xx_dma_init(unsigned int channels, unsigned int irq,
1310 int channel; 1310 int channel;
1311 int ret; 1311 int ret;
1312 1312
1313 printk("S3C24XX DMA Driver, (c) 2003-2004,2006 Simtec Electronics\n"); 1313 printk("S3C24XX DMA Driver, Copyright 2003-2006 Simtec Electronics\n");
1314 1314
1315 dma_channels = channels; 1315 dma_channels = channels;
1316 1316
diff --git a/arch/arm/plat-s3c24xx/include/plat/cpu-freq-core.h b/arch/arm/plat-s3c24xx/include/plat/cpu-freq-core.h
index c776120b99e6..33d421d78bad 100644
--- a/arch/arm/plat-s3c24xx/include/plat/cpu-freq-core.h
+++ b/arch/arm/plat-s3c24xx/include/plat/cpu-freq-core.h
@@ -1,6 +1,6 @@
1/* arch/arm/plat-s3c/include/plat/cpu-freq.h 1/* arch/arm/plat-s3c/include/plat/cpu-freq.h
2 * 2 *
3 * Copyright (c) 2006,2007,2009 Simtec Electronics 3 * Copyright (c) 2006-2009 Simtec Electronics
4 * http://armlinux.simtec.co.uk/ 4 * http://armlinux.simtec.co.uk/
5 * Ben Dooks <ben@simtec.co.uk> 5 * Ben Dooks <ben@simtec.co.uk>
6 * 6 *
diff --git a/arch/arm/plat-s3c24xx/include/plat/mci.h b/arch/arm/plat-s3c24xx/include/plat/mci.h
index c2cef6139683..36aaa10fad06 100644
--- a/arch/arm/plat-s3c24xx/include/plat/mci.h
+++ b/arch/arm/plat-s3c24xx/include/plat/mci.h
@@ -1,6 +1,31 @@
1#ifndef _ARCH_MCI_H 1#ifndef _ARCH_MCI_H
2#define _ARCH_MCI_H 2#define _ARCH_MCI_H
3 3
4/**
5 * struct s3c24xx_mci_pdata - sd/mmc controller platform data
6 * @no_wprotect: Set this to indicate there is no write-protect switch.
7 * @no_detect: Set this if there is no detect switch.
8 * @wprotect_invert: Invert the default sense of the write protect switch.
9 * @detect_invert: Invert the default sense of the write protect switch.
10 * @use_dma: Set to allow the use of DMA.
11 * @gpio_detect: GPIO number for the card detect line.
12 * @gpio_wprotect: GPIO number for the write protect line.
13 * @ocr_avail: The mask of the available power states, non-zero to use.
14 * @set_power: Callback to control the power mode.
15 *
16 * The @gpio_detect is used for card detection when @no_wprotect is unset,
17 * and the default sense is that 0 returned from gpio_get_value() means
18 * that a card is inserted. If @detect_invert is set, then the value from
19 * gpio_get_value() is inverted, which makes 1 mean card inserted.
20 *
21 * The driver will use @gpio_wprotect to signal whether the card is write
22 * protected if @no_wprotect is not set. A 0 returned from gpio_get_value()
23 * means the card is read/write, and 1 means read-only. The @wprotect_invert
24 * will invert the value returned from gpio_get_value().
25 *
26 * Card power is set by @ocr_availa, using MCC_VDD_ constants if it is set
27 * to a non-zero value, otherwise the default of 3.2-3.4V is used.
28 */
4struct s3c24xx_mci_pdata { 29struct s3c24xx_mci_pdata {
5 unsigned int no_wprotect : 1; 30 unsigned int no_wprotect : 1;
6 unsigned int no_detect : 1; 31 unsigned int no_detect : 1;
diff --git a/arch/arm/plat-s3c24xx/include/plat/regs-dma.h b/arch/arm/plat-s3c24xx/include/plat/regs-dma.h
index 3bc0a216df97..1b0f4c36d384 100644
--- a/arch/arm/plat-s3c24xx/include/plat/regs-dma.h
+++ b/arch/arm/plat-s3c24xx/include/plat/regs-dma.h
@@ -1,6 +1,6 @@
1/* arch/arm/mach-s3c2410/include/mach/dma.h 1/* arch/arm/mach-s3c2410/include/mach/dma.h
2 * 2 *
3 * Copyright (C) 2003,2004,2006 Simtec Electronics 3 * Copyright (C) 2003-2006 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk> 4 * Ben Dooks <ben@simtec.co.uk>
5 * 5 *
6 * Samsung S3C24XX DMA support 6 * Samsung S3C24XX DMA support
diff --git a/arch/arm/plat-s3c24xx/irq-pm.c b/arch/arm/plat-s3c24xx/irq-pm.c
index b7acf1a8ecd2..ea8dea3339a4 100644
--- a/arch/arm/plat-s3c24xx/irq-pm.c
+++ b/arch/arm/plat-s3c24xx/irq-pm.c
@@ -1,6 +1,6 @@
1/* linux/arch/arm/plat-s3c24xx/irq-om.c 1/* linux/arch/arm/plat-s3c24xx/irq-om.c
2 * 2 *
3 * Copyright (c) 2003,2004 Simtec Electronics 3 * Copyright (c) 2003-2004 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk> 4 * Ben Dooks <ben@simtec.co.uk>
5 * http://armlinux.simtec.co.uk/ 5 * http://armlinux.simtec.co.uk/
6 * 6 *
diff --git a/arch/arm/plat-s3c24xx/irq.c b/arch/arm/plat-s3c24xx/irq.c
index d02f5f02045e..ef0f521437d7 100644
--- a/arch/arm/plat-s3c24xx/irq.c
+++ b/arch/arm/plat-s3c24xx/irq.c
@@ -1,6 +1,6 @@
1/* linux/arch/arm/plat-s3c24xx/irq.c 1/* linux/arch/arm/plat-s3c24xx/irq.c
2 * 2 *
3 * Copyright (c) 2003,2004 Simtec Electronics 3 * Copyright (c) 2003-2004 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk> 4 * Ben Dooks <ben@simtec.co.uk>
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify 6 * This program is free software; you can redistribute it and/or modify
diff --git a/arch/arm/plat-s3c24xx/pm-simtec.c b/arch/arm/plat-s3c24xx/pm-simtec.c
index da0d3217d3e3..663b280d65da 100644
--- a/arch/arm/plat-s3c24xx/pm-simtec.c
+++ b/arch/arm/plat-s3c24xx/pm-simtec.c
@@ -1,6 +1,6 @@
1/* linux/arch/arm/plat-s3c24xx/pm-simtec.c 1/* linux/arch/arm/plat-s3c24xx/pm-simtec.c
2 * 2 *
3 * Copyright (c) 2004 Simtec Electronics 3 * Copyright 2004 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk> 4 * Ben Dooks <ben@simtec.co.uk>
5 * 5 *
6 * http://armlinux.simtec.co.uk/ 6 * http://armlinux.simtec.co.uk/
@@ -35,7 +35,7 @@
35 35
36#include <plat/pm.h> 36#include <plat/pm.h>
37 37
38#define COPYRIGHT ", (c) 2005 Simtec Electronics" 38#define COPYRIGHT ", Copyright 2005 Simtec Electronics"
39 39
40/* pm_simtec_init 40/* pm_simtec_init
41 * 41 *
diff --git a/arch/arm/plat-s3c24xx/pm.c b/arch/arm/plat-s3c24xx/pm.c
index 56e5253ca02c..3620dd299095 100644
--- a/arch/arm/plat-s3c24xx/pm.c
+++ b/arch/arm/plat-s3c24xx/pm.c
@@ -1,6 +1,6 @@
1/* linux/arch/arm/plat-s3c24xx/pm.c 1/* linux/arch/arm/plat-s3c24xx/pm.c
2 * 2 *
3 * Copyright (c) 2004,2006 Simtec Electronics 3 * Copyright (c) 2004-2006 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk> 4 * Ben Dooks <ben@simtec.co.uk>
5 * 5 *
6 * S3C24XX Power Manager (Suspend-To-RAM) support 6 * S3C24XX Power Manager (Suspend-To-RAM) support
diff --git a/arch/arm/plat-s3c24xx/s3c2410-iotiming.c b/arch/arm/plat-s3c24xx/s3c2410-iotiming.c
index d0a3a145cd4d..963fb0b4379e 100644
--- a/arch/arm/plat-s3c24xx/s3c2410-iotiming.c
+++ b/arch/arm/plat-s3c24xx/s3c2410-iotiming.c
@@ -1,6 +1,6 @@
1/* linux/arch/arm/plat-s3c24xx/s3c2410-iotiming.c 1/* linux/arch/arm/plat-s3c24xx/s3c2410-iotiming.c
2 * 2 *
3 * Copyright (c) 2006,2008,2009 Simtec Electronics 3 * Copyright (c) 2006-2009 Simtec Electronics
4 * http://armlinux.simtec.co.uk/ 4 * http://armlinux.simtec.co.uk/
5 * Ben Dooks <ben@simtec.co.uk> 5 * Ben Dooks <ben@simtec.co.uk>
6 * 6 *
diff --git a/arch/arm/plat-s3c24xx/s3c2412-iotiming.c b/arch/arm/plat-s3c24xx/s3c2412-iotiming.c
index fd45e47facbc..24993dce10b5 100644
--- a/arch/arm/plat-s3c24xx/s3c2412-iotiming.c
+++ b/arch/arm/plat-s3c24xx/s3c2412-iotiming.c
@@ -1,6 +1,6 @@
1/* linux/arch/arm/plat-s3c24xx/s3c2412-iotiming.c 1/* linux/arch/arm/plat-s3c24xx/s3c2412-iotiming.c
2 * 2 *
3 * Copyright (c) 2006,2008 Simtec Electronics 3 * Copyright (c) 2006-2008 Simtec Electronics
4 * http://armlinux.simtec.co.uk/ 4 * http://armlinux.simtec.co.uk/
5 * Ben Dooks <ben@simtec.co.uk> 5 * Ben Dooks <ben@simtec.co.uk>
6 * 6 *
diff --git a/arch/arm/plat-s3c24xx/s3c2440-cpufreq.c b/arch/arm/plat-s3c24xx/s3c2440-cpufreq.c
index ae2e6c604f27..976002fb1b8f 100644
--- a/arch/arm/plat-s3c24xx/s3c2440-cpufreq.c
+++ b/arch/arm/plat-s3c24xx/s3c2440-cpufreq.c
@@ -1,6 +1,6 @@
1/* linux/arch/arm/plat-s3c24xx/s3c2440-cpufreq.c 1/* linux/arch/arm/plat-s3c24xx/s3c2440-cpufreq.c
2 * 2 *
3 * Copyright (c) 2006,2008,2009 Simtec Electronics 3 * Copyright (c) 2006-2009 Simtec Electronics
4 * http://armlinux.simtec.co.uk/ 4 * http://armlinux.simtec.co.uk/
5 * Ben Dooks <ben@simtec.co.uk> 5 * Ben Dooks <ben@simtec.co.uk>
6 * Vincent Sanders <vince@simtec.co.uk> 6 * Vincent Sanders <vince@simtec.co.uk>
diff --git a/arch/arm/plat-s3c24xx/s3c2440-pll-12000000.c b/arch/arm/plat-s3c24xx/s3c2440-pll-12000000.c
index ff9443b233aa..49f65032f2c0 100644
--- a/arch/arm/plat-s3c24xx/s3c2440-pll-12000000.c
+++ b/arch/arm/plat-s3c24xx/s3c2440-pll-12000000.c
@@ -1,6 +1,6 @@
1/* arch/arm/plat-s3c24xx/s3c2440-pll-12000000.c 1/* arch/arm/plat-s3c24xx/s3c2440-pll-12000000.c
2 * 2 *
3 * Copyright (c) 2006,2007 Simtec Electronics 3 * Copyright (c) 2006-2007 Simtec Electronics
4 * http://armlinux.simtec.co.uk/ 4 * http://armlinux.simtec.co.uk/
5 * Ben Dooks <ben@simtec.co.uk> 5 * Ben Dooks <ben@simtec.co.uk>
6 * Vincent Sanders <vince@arm.linux.org.uk> 6 * Vincent Sanders <vince@arm.linux.org.uk>
diff --git a/arch/arm/plat-s3c24xx/s3c244x-clock.c b/arch/arm/plat-s3c24xx/s3c244x-clock.c
index dde41f171aff..79371091aa38 100644
--- a/arch/arm/plat-s3c24xx/s3c244x-clock.c
+++ b/arch/arm/plat-s3c24xx/s3c244x-clock.c
@@ -1,6 +1,6 @@
1/* linux/arch/arm/plat-s3c24xx/s3c24xx-clock.c 1/* linux/arch/arm/plat-s3c24xx/s3c24xx-clock.c
2 * 2 *
3 * Copyright (c) 2004-2005,2008 Simtec Electronics 3 * Copyright (c) 2004-2008 Simtec Electronics
4 * http://armlinux.simtec.co.uk/ 4 * http://armlinux.simtec.co.uk/
5 * Ben Dooks <ben@simtec.co.uk> 5 * Ben Dooks <ben@simtec.co.uk>
6 * 6 *
diff --git a/arch/arm/plat-s3c24xx/s3c244x-irq.c b/arch/arm/plat-s3c24xx/s3c244x-irq.c
index 0902afd227ca..a75c0c2431ea 100644
--- a/arch/arm/plat-s3c24xx/s3c244x-irq.c
+++ b/arch/arm/plat-s3c24xx/s3c244x-irq.c
@@ -1,6 +1,6 @@
1/* linux/arch/arm/plat-s3c24xx/s3c244x-irq.c 1/* linux/arch/arm/plat-s3c24xx/s3c244x-irq.c
2 * 2 *
3 * Copyright (c) 2003,2004 Simtec Electronics 3 * Copyright (c) 2003-2004 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk> 4 * Ben Dooks <ben@simtec.co.uk>
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify 6 * This program is free software; you can redistribute it and/or modify
diff --git a/arch/arm/plat-s3c24xx/simtec-audio.c b/arch/arm/plat-s3c24xx/simtec-audio.c
new file mode 100644
index 000000000000..6bc832e0d8ea
--- /dev/null
+++ b/arch/arm/plat-s3c24xx/simtec-audio.c
@@ -0,0 +1,77 @@
1/* linux/arch/arm/plat-s3c24xx/simtec-audio.c
2 *
3 * Copyright (c) 2009 Simtec Electronics
4 * http://armlinux.simtec.co.uk/
5 * Ben Dooks <ben@simtec.co.uk>
6 *
7 * Audio setup for various Simtec S3C24XX implementations
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12*/
13
14#include <linux/kernel.h>
15#include <linux/interrupt.h>
16#include <linux/init.h>
17#include <linux/device.h>
18#include <linux/io.h>
19
20#include <mach/bast-map.h>
21#include <mach/bast-irq.h>
22#include <mach/bast-cpld.h>
23
24#include <mach/hardware.h>
25#include <mach/regs-gpio.h>
26
27#include <plat/audio-simtec.h>
28#include <plat/devs.h>
29
30/* platform ops for audio */
31
32static void simtec_audio_startup_lrroute(void)
33{
34 unsigned int tmp;
35 unsigned long flags;
36
37 local_irq_save(flags);
38
39 tmp = __raw_readb(BAST_VA_CTRL1);
40 tmp &= ~BAST_CPLD_CTRL1_LRMASK;
41 tmp |= BAST_CPLD_CTRL1_LRCDAC;
42 __raw_writeb(tmp, BAST_VA_CTRL1);
43
44 local_irq_restore(flags);
45}
46
47static struct s3c24xx_audio_simtec_pdata simtec_audio_platdata;
48static char our_name[32];
49
50static struct platform_device simtec_audio_dev = {
51 .name = our_name,
52 .id = -1,
53 .dev = {
54 .parent = &s3c_device_iis.dev,
55 .platform_data = &simtec_audio_platdata,
56 },
57};
58
59int __init simtec_audio_add(const char *name, bool has_lr_routing,
60 struct s3c24xx_audio_simtec_pdata *spd)
61{
62 if (!name)
63 name = "tlv320aic23";
64
65 snprintf(our_name, sizeof(our_name)-1, "s3c24xx-simtec-%s", name);
66
67 /* copy platform data so the source can be __initdata */
68 if (spd)
69 simtec_audio_platdata = *spd;
70
71 if (has_lr_routing)
72 simtec_audio_platdata.startup = simtec_audio_startup_lrroute;
73
74 platform_device_register(&s3c_device_iis);
75 platform_device_register(&simtec_audio_dev);
76 return 0;
77}
diff --git a/arch/arm/plat-s3c64xx/cpu.c b/arch/arm/plat-s3c64xx/cpu.c
index b1fdd83940a6..49796d2db86d 100644
--- a/arch/arm/plat-s3c64xx/cpu.c
+++ b/arch/arm/plat-s3c64xx/cpu.c
@@ -107,6 +107,11 @@ static struct map_desc s3c_iodesc[] __initdata = {
107 .pfn = __phys_to_pfn(S3C64XX_PA_WATCHDOG), 107 .pfn = __phys_to_pfn(S3C64XX_PA_WATCHDOG),
108 .length = SZ_4K, 108 .length = SZ_4K,
109 .type = MT_DEVICE, 109 .type = MT_DEVICE,
110 }, {
111 .virtual = (unsigned long)S3C_VA_USB_HSPHY,
112 .pfn = __phys_to_pfn(S3C64XX_PA_USB_HSPHY),
113 .length = SZ_1K,
114 .type = MT_DEVICE,
110 }, 115 },
111}; 116};
112 117
diff --git a/arch/arm/plat-s3c64xx/cpufreq.c b/arch/arm/plat-s3c64xx/cpufreq.c
index e6e0843215df..74c0e8347de5 100644
--- a/arch/arm/plat-s3c64xx/cpufreq.c
+++ b/arch/arm/plat-s3c64xx/cpufreq.c
@@ -19,6 +19,7 @@
19 19
20static struct clk *armclk; 20static struct clk *armclk;
21static struct regulator *vddarm; 21static struct regulator *vddarm;
22static unsigned long regulator_latency;
22 23
23#ifdef CONFIG_CPU_S3C6410 24#ifdef CONFIG_CPU_S3C6410
24struct s3c64xx_dvfs { 25struct s3c64xx_dvfs {
@@ -27,11 +28,10 @@ struct s3c64xx_dvfs {
27}; 28};
28 29
29static struct s3c64xx_dvfs s3c64xx_dvfs_table[] = { 30static struct s3c64xx_dvfs s3c64xx_dvfs_table[] = {
30 [0] = { 1000000, 1000000 }, 31 [0] = { 1000000, 1150000 },
31 [1] = { 1000000, 1050000 }, 32 [1] = { 1050000, 1150000 },
32 [2] = { 1050000, 1100000 }, 33 [2] = { 1100000, 1150000 },
33 [3] = { 1050000, 1150000 }, 34 [3] = { 1200000, 1350000 },
34 [4] = { 1250000, 1350000 },
35}; 35};
36 36
37static struct cpufreq_frequency_table s3c64xx_freq_table[] = { 37static struct cpufreq_frequency_table s3c64xx_freq_table[] = {
@@ -41,9 +41,9 @@ static struct cpufreq_frequency_table s3c64xx_freq_table[] = {
41 { 1, 266000 }, 41 { 1, 266000 },
42 { 2, 333000 }, 42 { 2, 333000 },
43 { 2, 400000 }, 43 { 2, 400000 },
44 { 3, 532000 }, 44 { 2, 532000 },
45 { 3, 533000 }, 45 { 2, 533000 },
46 { 4, 667000 }, 46 { 3, 667000 },
47 { 0, CPUFREQ_TABLE_END }, 47 { 0, CPUFREQ_TABLE_END },
48}; 48};
49#endif 49#endif
@@ -141,7 +141,7 @@ err:
141} 141}
142 142
143#ifdef CONFIG_REGULATOR 143#ifdef CONFIG_REGULATOR
144static void __init s3c64xx_cpufreq_constrain_voltages(void) 144static void __init s3c64xx_cpufreq_config_regulator(void)
145{ 145{
146 int count, v, i, found; 146 int count, v, i, found;
147 struct cpufreq_frequency_table *freq; 147 struct cpufreq_frequency_table *freq;
@@ -150,11 +150,10 @@ static void __init s3c64xx_cpufreq_constrain_voltages(void)
150 count = regulator_count_voltages(vddarm); 150 count = regulator_count_voltages(vddarm);
151 if (count < 0) { 151 if (count < 0) {
152 pr_err("cpufreq: Unable to check supported voltages\n"); 152 pr_err("cpufreq: Unable to check supported voltages\n");
153 return;
154 } 153 }
155 154
156 freq = s3c64xx_freq_table; 155 freq = s3c64xx_freq_table;
157 while (freq->frequency != CPUFREQ_TABLE_END) { 156 while (count > 0 && freq->frequency != CPUFREQ_TABLE_END) {
158 if (freq->frequency == CPUFREQ_ENTRY_INVALID) 157 if (freq->frequency == CPUFREQ_ENTRY_INVALID)
159 continue; 158 continue;
160 159
@@ -175,6 +174,10 @@ static void __init s3c64xx_cpufreq_constrain_voltages(void)
175 174
176 freq++; 175 freq++;
177 } 176 }
177
178 /* Guess based on having to do an I2C/SPI write; in future we
179 * will be able to query the regulator performance here. */
180 regulator_latency = 1 * 1000 * 1000;
178} 181}
179#endif 182#endif
180 183
@@ -206,7 +209,7 @@ static int __init s3c64xx_cpufreq_driver_init(struct cpufreq_policy *policy)
206 pr_err("cpufreq: Only frequency scaling available\n"); 209 pr_err("cpufreq: Only frequency scaling available\n");
207 vddarm = NULL; 210 vddarm = NULL;
208 } else { 211 } else {
209 s3c64xx_cpufreq_constrain_voltages(); 212 s3c64xx_cpufreq_config_regulator();
210 } 213 }
211#endif 214#endif
212 215
@@ -217,8 +220,11 @@ static int __init s3c64xx_cpufreq_driver_init(struct cpufreq_policy *policy)
217 /* Check for frequencies we can generate */ 220 /* Check for frequencies we can generate */
218 r = clk_round_rate(armclk, freq->frequency * 1000); 221 r = clk_round_rate(armclk, freq->frequency * 1000);
219 r /= 1000; 222 r /= 1000;
220 if (r != freq->frequency) 223 if (r != freq->frequency) {
224 pr_debug("cpufreq: %dkHz unsupported by clock\n",
225 freq->frequency);
221 freq->frequency = CPUFREQ_ENTRY_INVALID; 226 freq->frequency = CPUFREQ_ENTRY_INVALID;
227 }
222 228
223 /* If we have no regulator then assume startup 229 /* If we have no regulator then assume startup
224 * frequency is the maximum we can support. */ 230 * frequency is the maximum we can support. */
@@ -230,9 +236,11 @@ static int __init s3c64xx_cpufreq_driver_init(struct cpufreq_policy *policy)
230 236
231 policy->cur = clk_get_rate(armclk) / 1000; 237 policy->cur = clk_get_rate(armclk) / 1000;
232 238
233 /* Pick a conservative guess in ns: we'll need ~1 I2C/SPI 239 /* Datasheet says PLL stabalisation time (if we were to use
234 * write plus clock reprogramming. */ 240 * the PLLs, which we don't currently) is ~300us worst case,
235 policy->cpuinfo.transition_latency = 2 * 1000 * 1000; 241 * but add some fudge.
242 */
243 policy->cpuinfo.transition_latency = (500 * 1000) + regulator_latency;
236 244
237 ret = cpufreq_frequency_table_cpuinfo(policy, s3c64xx_freq_table); 245 ret = cpufreq_frequency_table_cpuinfo(policy, s3c64xx_freq_table);
238 if (ret != 0) { 246 if (ret != 0) {
diff --git a/arch/arm/plat-s3c64xx/gpiolib.c b/arch/arm/plat-s3c64xx/gpiolib.c
index 92859290ea33..778560457277 100644
--- a/arch/arm/plat-s3c64xx/gpiolib.c
+++ b/arch/arm/plat-s3c64xx/gpiolib.c
@@ -213,6 +213,11 @@ static struct s3c_gpio_cfg gpio_4bit_cfg_eint0011 = {
213 .get_pull = s3c_gpio_getpull_updown, 213 .get_pull = s3c_gpio_getpull_updown,
214}; 214};
215 215
216int s3c64xx_gpio2int_gpm(struct gpio_chip *chip, unsigned pin)
217{
218 return pin < 5 ? IRQ_EINT(23) + pin : -ENXIO;
219}
220
216static struct s3c_gpio_chip gpio_4bit[] = { 221static struct s3c_gpio_chip gpio_4bit[] = {
217 { 222 {
218 .base = S3C64XX_GPA_BASE, 223 .base = S3C64XX_GPA_BASE,
@@ -269,10 +274,16 @@ static struct s3c_gpio_chip gpio_4bit[] = {
269 .base = S3C64XX_GPM(0), 274 .base = S3C64XX_GPM(0),
270 .ngpio = S3C64XX_GPIO_M_NR, 275 .ngpio = S3C64XX_GPIO_M_NR,
271 .label = "GPM", 276 .label = "GPM",
277 .to_irq = s3c64xx_gpio2int_gpm,
272 }, 278 },
273 }, 279 },
274}; 280};
275 281
282int s3c64xx_gpio2int_gpl(struct gpio_chip *chip, unsigned pin)
283{
284 return pin >= 8 ? IRQ_EINT(16) + pin - 8 : -ENXIO;
285}
286
276static struct s3c_gpio_chip gpio_4bit2[] = { 287static struct s3c_gpio_chip gpio_4bit2[] = {
277 { 288 {
278 .base = S3C64XX_GPH_BASE + 0x4, 289 .base = S3C64XX_GPH_BASE + 0x4,
@@ -297,6 +308,7 @@ static struct s3c_gpio_chip gpio_4bit2[] = {
297 .base = S3C64XX_GPL(0), 308 .base = S3C64XX_GPL(0),
298 .ngpio = S3C64XX_GPIO_L_NR, 309 .ngpio = S3C64XX_GPIO_L_NR,
299 .label = "GPL", 310 .label = "GPL",
311 .to_irq = s3c64xx_gpio2int_gpl,
300 }, 312 },
301 }, 313 },
302}; 314};
diff --git a/arch/arm/plat-s3c64xx/include/plat/gpio-bank-c.h b/arch/arm/plat-s3c64xx/include/plat/gpio-bank-c.h
index c47daf7e2723..e22b49f4f982 100644
--- a/arch/arm/plat-s3c64xx/include/plat/gpio-bank-c.h
+++ b/arch/arm/plat-s3c64xx/include/plat/gpio-bank-c.h
@@ -36,18 +36,18 @@
36 36
37#define S3C64XX_GPC4_SPI_MISO1 (0x02 << 16) 37#define S3C64XX_GPC4_SPI_MISO1 (0x02 << 16)
38#define S3C64XX_GPC4_MMC2_CMD (0x03 << 16) 38#define S3C64XX_GPC4_MMC2_CMD (0x03 << 16)
39#define S3C64XX_GPC4_I2S0_V40_DO (0x05 << 16) 39#define S3C64XX_GPC4_I2S_V40_DO0 (0x05 << 16)
40#define S3C64XX_GPC4_EINT_G2_4 (0x07 << 16) 40#define S3C64XX_GPC4_EINT_G2_4 (0x07 << 16)
41 41
42#define S3C64XX_GPC5_SPI_CLK1 (0x02 << 20) 42#define S3C64XX_GPC5_SPI_CLK1 (0x02 << 20)
43#define S3C64XX_GPC5_MMC2_CLK (0x03 << 20) 43#define S3C64XX_GPC5_MMC2_CLK (0x03 << 20)
44#define S3C64XX_GPC5_I2S1_V40_DO (0x05 << 20) 44#define S3C64XX_GPC5_I2S_V40_DO1 (0x05 << 20)
45#define S3C64XX_GPC5_EINT_G2_5 (0x07 << 20) 45#define S3C64XX_GPC5_EINT_G2_5 (0x07 << 20)
46 46
47#define S3C64XX_GPC6_SPI_MOSI1 (0x02 << 24) 47#define S3C64XX_GPC6_SPI_MOSI1 (0x02 << 24)
48#define S3C64XX_GPC6_EINT_G2_6 (0x07 << 24) 48#define S3C64XX_GPC6_EINT_G2_6 (0x07 << 24)
49 49
50#define S3C64XX_GPC7_SPI_nCS1 (0x02 << 28) 50#define S3C64XX_GPC7_SPI_nCS1 (0x02 << 28)
51#define S3C64XX_GPC7_I2S2_V40_DO (0x05 << 28) 51#define S3C64XX_GPC7_I2S_V40_DO2 (0x05 << 28)
52#define S3C64XX_GPC7_EINT_G2_7 (0x07 << 28) 52#define S3C64XX_GPC7_EINT_G2_7 (0x07 << 28)
53 53
diff --git a/arch/arm/plat-s3c64xx/irq-eint.c b/arch/arm/plat-s3c64xx/irq-eint.c
index f81b7b818ba0..ebdf183a0911 100644
--- a/arch/arm/plat-s3c64xx/irq-eint.c
+++ b/arch/arm/plat-s3c64xx/irq-eint.c
@@ -65,7 +65,7 @@ static void s3c_irq_eint_maskack(unsigned int irq)
65static int s3c_irq_eint_set_type(unsigned int irq, unsigned int type) 65static int s3c_irq_eint_set_type(unsigned int irq, unsigned int type)
66{ 66{
67 int offs = eint_offset(irq); 67 int offs = eint_offset(irq);
68 int pin; 68 int pin, pin_val;
69 int shift; 69 int shift;
70 u32 ctrl, mask; 70 u32 ctrl, mask;
71 u32 newvalue = 0; 71 u32 newvalue = 0;
@@ -109,7 +109,10 @@ static int s3c_irq_eint_set_type(unsigned int irq, unsigned int type)
109 return -1; 109 return -1;
110 } 110 }
111 111
112 shift = (offs / 2) * 4; 112 if (offs <= 15)
113 shift = (offs / 2) * 4;
114 else
115 shift = ((offs - 16) / 2) * 4;
113 mask = 0x7 << shift; 116 mask = 0x7 << shift;
114 117
115 ctrl = __raw_readl(reg); 118 ctrl = __raw_readl(reg);
@@ -119,12 +122,18 @@ static int s3c_irq_eint_set_type(unsigned int irq, unsigned int type)
119 122
120 /* set the GPIO pin appropriately */ 123 /* set the GPIO pin appropriately */
121 124
122 if (offs < 23) 125 if (offs < 16) {
123 pin = S3C64XX_GPN(offs); 126 pin = S3C64XX_GPN(offs);
124 else 127 pin_val = S3C_GPIO_SFN(2);
128 } else if (offs < 23) {
129 pin = S3C64XX_GPL(offs + 8 - 16);
130 pin_val = S3C_GPIO_SFN(3);
131 } else {
125 pin = S3C64XX_GPM(offs - 23); 132 pin = S3C64XX_GPM(offs - 23);
133 pin_val = S3C_GPIO_SFN(3);
134 }
126 135
127 s3c_gpio_cfgpin(pin, S3C_GPIO_SFN(2)); 136 s3c_gpio_cfgpin(pin, pin_val);
128 137
129 return 0; 138 return 0;
130} 139}
diff --git a/arch/arm/plat-s3c64xx/setup-sdhci-gpio.c b/arch/arm/plat-s3c64xx/setup-sdhci-gpio.c
index 5417123b0ac1..a58c0cc7ba5e 100644
--- a/arch/arm/plat-s3c64xx/setup-sdhci-gpio.c
+++ b/arch/arm/plat-s3c64xx/setup-sdhci-gpio.c
@@ -53,3 +53,23 @@ void s3c64xx_setup_sdhci1_cfg_gpio(struct platform_device *dev, int width)
53 s3c_gpio_setpull(S3C64XX_GPG(6), S3C_GPIO_PULL_UP); 53 s3c_gpio_setpull(S3C64XX_GPG(6), S3C_GPIO_PULL_UP);
54 s3c_gpio_cfgpin(S3C64XX_GPG(6), S3C_GPIO_SFN(3)); 54 s3c_gpio_cfgpin(S3C64XX_GPG(6), S3C_GPIO_SFN(3));
55} 55}
56
57void s3c64xx_setup_sdhci2_cfg_gpio(struct platform_device *dev, int width)
58{
59 unsigned int gpio;
60 unsigned int end;
61
62 end = S3C64XX_GPH(6 + width);
63
64 /* Set all the necessary GPH pins to special-function 1 */
65 for (gpio = S3C64XX_GPH(6); gpio < end; gpio++) {
66 s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(3));
67 s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
68 }
69
70 /* Set all the necessary GPC pins to special-function 1 */
71 for (gpio = S3C64XX_GPC(4); gpio < S3C64XX_GPC(6); gpio++) {
72 s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(3));
73 s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
74 }
75}
diff --git a/arch/arm/plat-s5pc1xx/Kconfig b/arch/arm/plat-s5pc1xx/Kconfig
index a8a711c3c064..1608e62b0c9d 100644
--- a/arch/arm/plat-s5pc1xx/Kconfig
+++ b/arch/arm/plat-s5pc1xx/Kconfig
@@ -15,6 +15,9 @@ config PLAT_S5PC1XX
15 select ARCH_REQUIRE_GPIOLIB 15 select ARCH_REQUIRE_GPIOLIB
16 select S3C_GPIO_TRACK 16 select S3C_GPIO_TRACK
17 select S3C_GPIO_PULL_UPDOWN 17 select S3C_GPIO_PULL_UPDOWN
18 select S3C_GPIO_CFG_S3C24XX
19 select S3C_GPIO_CFG_S3C64XX
20 select S5P_GPIO_CFG_S5PC1XX
18 help 21 help
19 Base platform code for any Samsung S5PC1XX device 22 Base platform code for any Samsung S5PC1XX device
20 23
@@ -34,7 +37,12 @@ config CPU_S5PC100_CLOCK
34 37
35# platform specific device setup 38# platform specific device setup
36 39
37config S5PC100_SETUP_I2C0 40config S5PC1XX_SETUP_FB_24BPP
41 bool
42 help
43 Common setup code for S5PC1XX with an 24bpp RGB display helper.
44
45config S5PC1XX_SETUP_I2C0
38 bool 46 bool
39 default y 47 default y
40 help 48 help
@@ -43,8 +51,14 @@ config S5PC100_SETUP_I2C0
43 Note, currently since i2c0 is always compiled, this setup helper 51 Note, currently since i2c0 is always compiled, this setup helper
44 is always compiled with it. 52 is always compiled with it.
45 53
46config S5PC100_SETUP_I2C1 54config S5PC1XX_SETUP_I2C1
47 bool 55 bool
48 help 56 help
49 Common setup code for i2c bus 1. 57 Common setup code for i2c bus 1.
58
59config S5PC1XX_SETUP_SDHCI_GPIO
60 bool
61 help
62 Common setup code for SDHCI gpio.
63
50endif 64endif
diff --git a/arch/arm/plat-s5pc1xx/Makefile b/arch/arm/plat-s5pc1xx/Makefile
index f1ecb2c37ee2..278f26806089 100644
--- a/arch/arm/plat-s5pc1xx/Makefile
+++ b/arch/arm/plat-s5pc1xx/Makefile
@@ -13,7 +13,9 @@ obj- :=
13 13
14obj-y += dev-uart.o 14obj-y += dev-uart.o
15obj-y += cpu.o 15obj-y += cpu.o
16obj-y += irq.o 16obj-y += irq.o irq-gpio.o irq-eint.o
17obj-y += clock.o
18obj-y += gpiolib.o
17 19
18# CPU support 20# CPU support
19 21
@@ -22,5 +24,8 @@ obj-$(CONFIG_CPU_S5PC100_CLOCK) += s5pc100-clock.o
22 24
23# Device setup 25# Device setup
24 26
25obj-$(CONFIG_S5PC100_SETUP_I2C0) += setup-i2c0.o 27obj-$(CONFIG_S5P_GPIO_CFG_S5PC1XX) += gpio-config.o
26obj-$(CONFIG_S5PC100_SETUP_I2C1) += setup-i2c1.o 28obj-$(CONFIG_S5PC1XX_SETUP_FB_24BPP) += setup-fb-24bpp.o
29obj-$(CONFIG_S5PC1XX_SETUP_I2C0) += setup-i2c0.o
30obj-$(CONFIG_S5PC1XX_SETUP_I2C1) += setup-i2c1.o
31obj-$(CONFIG_S5PC1XX_SETUP_SDHCI_GPIO) += setup-sdhci-gpio.o
diff --git a/arch/arm/plat-s5pc1xx/clock.c b/arch/arm/plat-s5pc1xx/clock.c
new file mode 100644
index 000000000000..26c21d849790
--- /dev/null
+++ b/arch/arm/plat-s5pc1xx/clock.c
@@ -0,0 +1,728 @@
1/* linux/arch/arm/plat-s5pc1xx/clock.c
2 *
3 * Copyright 2009 Samsung Electronics Co.
4 *
5 * S5PC1XX Base clock support
6 *
7 * Based on plat-s3c64xx/clock.c
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12*/
13
14#include <linux/init.h>
15#include <linux/module.h>
16#include <linux/interrupt.h>
17#include <linux/ioport.h>
18#include <linux/clk.h>
19#include <linux/io.h>
20
21#include <mach/hardware.h>
22#include <mach/map.h>
23
24#include <plat/regs-clock.h>
25#include <plat/devs.h>
26#include <plat/clock.h>
27
28struct clk clk_27m = {
29 .name = "clk_27m",
30 .id = -1,
31 .rate = 27000000,
32};
33
34static int clk_48m_ctrl(struct clk *clk, int enable)
35{
36 unsigned long flags;
37 u32 val;
38
39 /* can't rely on clock lock, this register has other usages */
40 local_irq_save(flags);
41
42 val = __raw_readl(S5PC100_CLKSRC1);
43 if (enable)
44 val |= S5PC100_CLKSRC1_CLK48M_MASK;
45 else
46 val &= ~S5PC100_CLKSRC1_CLK48M_MASK;
47
48 __raw_writel(val, S5PC100_CLKSRC1);
49 local_irq_restore(flags);
50
51 return 0;
52}
53
54struct clk clk_48m = {
55 .name = "clk_48m",
56 .id = -1,
57 .rate = 48000000,
58 .enable = clk_48m_ctrl,
59};
60
61struct clk clk_54m = {
62 .name = "clk_54m",
63 .id = -1,
64 .rate = 54000000,
65};
66
67static int clk_default_setrate(struct clk *clk, unsigned long rate)
68{
69 clk->rate = rate;
70 return 0;
71}
72
73static int clk_dummy_enable(struct clk *clk, int enable)
74{
75 return 0;
76}
77
78struct clk clk_hd0 = {
79 .name = "hclkd0",
80 .id = -1,
81 .rate = 0,
82 .parent = NULL,
83 .ctrlbit = 0,
84 .set_rate = clk_default_setrate,
85 .enable = clk_dummy_enable,
86};
87
88struct clk clk_pd0 = {
89 .name = "pclkd0",
90 .id = -1,
91 .rate = 0,
92 .parent = NULL,
93 .ctrlbit = 0,
94 .set_rate = clk_default_setrate,
95 .enable = clk_dummy_enable,
96};
97
98static int s5pc1xx_clk_gate(void __iomem *reg, struct clk *clk, int enable)
99{
100 unsigned int ctrlbit = clk->ctrlbit;
101 u32 con;
102
103 con = __raw_readl(reg);
104 if (enable)
105 con |= ctrlbit;
106 else
107 con &= ~ctrlbit;
108 __raw_writel(con, reg);
109
110 return 0;
111}
112
113static int s5pc100_clk_d00_ctrl(struct clk *clk, int enable)
114{
115 return s5pc1xx_clk_gate(S5PC100_CLKGATE_D00, clk, enable);
116}
117
118static int s5pc100_clk_d01_ctrl(struct clk *clk, int enable)
119{
120 return s5pc1xx_clk_gate(S5PC100_CLKGATE_D01, clk, enable);
121}
122
123static int s5pc100_clk_d02_ctrl(struct clk *clk, int enable)
124{
125 return s5pc1xx_clk_gate(S5PC100_CLKGATE_D02, clk, enable);
126}
127
128static int s5pc100_clk_d10_ctrl(struct clk *clk, int enable)
129{
130 return s5pc1xx_clk_gate(S5PC100_CLKGATE_D10, clk, enable);
131}
132
133static int s5pc100_clk_d11_ctrl(struct clk *clk, int enable)
134{
135 return s5pc1xx_clk_gate(S5PC100_CLKGATE_D11, clk, enable);
136}
137
138static int s5pc100_clk_d12_ctrl(struct clk *clk, int enable)
139{
140 return s5pc1xx_clk_gate(S5PC100_CLKGATE_D12, clk, enable);
141}
142
143static int s5pc100_clk_d13_ctrl(struct clk *clk, int enable)
144{
145 return s5pc1xx_clk_gate(S5PC100_CLKGATE_D13, clk, enable);
146}
147
148static int s5pc100_clk_d14_ctrl(struct clk *clk, int enable)
149{
150 return s5pc1xx_clk_gate(S5PC100_CLKGATE_D14, clk, enable);
151}
152
153static int s5pc100_clk_d15_ctrl(struct clk *clk, int enable)
154{
155 return s5pc1xx_clk_gate(S5PC100_CLKGATE_D15, clk, enable);
156}
157
158static int s5pc100_clk_d20_ctrl(struct clk *clk, int enable)
159{
160 return s5pc1xx_clk_gate(S5PC100_CLKGATE_D20, clk, enable);
161}
162
163int s5pc100_sclk0_ctrl(struct clk *clk, int enable)
164{
165 return s5pc1xx_clk_gate(S5PC100_SCLKGATE0, clk, enable);
166}
167
168int s5pc100_sclk1_ctrl(struct clk *clk, int enable)
169{
170 return s5pc1xx_clk_gate(S5PC100_SCLKGATE1, clk, enable);
171}
172
173static struct clk s5pc100_init_clocks_disable[] = {
174 {
175 .name = "dsi",
176 .id = -1,
177 .parent = &clk_p,
178 .enable = s5pc100_clk_d11_ctrl,
179 .ctrlbit = S5PC100_CLKGATE_D11_DSI,
180 }, {
181 .name = "csi",
182 .id = -1,
183 .parent = &clk_h,
184 .enable = s5pc100_clk_d11_ctrl,
185 .ctrlbit = S5PC100_CLKGATE_D11_CSI,
186 }, {
187 .name = "ccan",
188 .id = 0,
189 .parent = &clk_p,
190 .enable = s5pc100_clk_d14_ctrl,
191 .ctrlbit = S5PC100_CLKGATE_D14_CCAN0,
192 }, {
193 .name = "ccan",
194 .id = 1,
195 .parent = &clk_p,
196 .enable = s5pc100_clk_d14_ctrl,
197 .ctrlbit = S5PC100_CLKGATE_D14_CCAN1,
198 }, {
199 .name = "keypad",
200 .id = -1,
201 .parent = &clk_p,
202 .enable = s5pc100_clk_d15_ctrl,
203 .ctrlbit = S5PC100_CLKGATE_D15_KEYIF,
204 }, {
205 .name = "hclkd2",
206 .id = -1,
207 .parent = NULL,
208 .enable = s5pc100_clk_d20_ctrl,
209 .ctrlbit = S5PC100_CLKGATE_D20_HCLKD2,
210 }, {
211 .name = "iis-d2",
212 .id = -1,
213 .parent = NULL,
214 .enable = s5pc100_clk_d20_ctrl,
215 .ctrlbit = S5PC100_CLKGATE_D20_I2SD2,
216 },
217};
218
219static struct clk s5pc100_init_clocks[] = {
220 /* System1 (D0_0) devices */
221 {
222 .name = "intc",
223 .id = -1,
224 .parent = &clk_hd0,
225 .enable = s5pc100_clk_d00_ctrl,
226 .ctrlbit = S5PC100_CLKGATE_D00_INTC,
227 }, {
228 .name = "tzic",
229 .id = -1,
230 .parent = &clk_hd0,
231 .enable = s5pc100_clk_d00_ctrl,
232 .ctrlbit = S5PC100_CLKGATE_D00_TZIC,
233 }, {
234 .name = "cf-ata",
235 .id = -1,
236 .parent = &clk_hd0,
237 .enable = s5pc100_clk_d00_ctrl,
238 .ctrlbit = S5PC100_CLKGATE_D00_CFCON,
239 }, {
240 .name = "mdma",
241 .id = -1,
242 .parent = &clk_hd0,
243 .enable = s5pc100_clk_d00_ctrl,
244 .ctrlbit = S5PC100_CLKGATE_D00_MDMA,
245 }, {
246 .name = "g2d",
247 .id = -1,
248 .parent = &clk_hd0,
249 .enable = s5pc100_clk_d00_ctrl,
250 .ctrlbit = S5PC100_CLKGATE_D00_G2D,
251 }, {
252 .name = "secss",
253 .id = -1,
254 .parent = &clk_hd0,
255 .enable = s5pc100_clk_d00_ctrl,
256 .ctrlbit = S5PC100_CLKGATE_D00_SECSS,
257 }, {
258 .name = "cssys",
259 .id = -1,
260 .parent = &clk_hd0,
261 .enable = s5pc100_clk_d00_ctrl,
262 .ctrlbit = S5PC100_CLKGATE_D00_CSSYS,
263 },
264
265 /* Memory (D0_1) devices */
266 {
267 .name = "dmc",
268 .id = -1,
269 .parent = &clk_hd0,
270 .enable = s5pc100_clk_d01_ctrl,
271 .ctrlbit = S5PC100_CLKGATE_D01_DMC,
272 }, {
273 .name = "sromc",
274 .id = -1,
275 .parent = &clk_hd0,
276 .enable = s5pc100_clk_d01_ctrl,
277 .ctrlbit = S5PC100_CLKGATE_D01_SROMC,
278 }, {
279 .name = "onenand",
280 .id = -1,
281 .parent = &clk_hd0,
282 .enable = s5pc100_clk_d01_ctrl,
283 .ctrlbit = S5PC100_CLKGATE_D01_ONENAND,
284 }, {
285 .name = "nand",
286 .id = -1,
287 .parent = &clk_hd0,
288 .enable = s5pc100_clk_d01_ctrl,
289 .ctrlbit = S5PC100_CLKGATE_D01_NFCON,
290 }, {
291 .name = "intmem",
292 .id = -1,
293 .parent = &clk_hd0,
294 .enable = s5pc100_clk_d01_ctrl,
295 .ctrlbit = S5PC100_CLKGATE_D01_INTMEM,
296 }, {
297 .name = "ebi",
298 .id = -1,
299 .parent = &clk_hd0,
300 .enable = s5pc100_clk_d01_ctrl,
301 .ctrlbit = S5PC100_CLKGATE_D01_EBI,
302 },
303
304 /* System2 (D0_2) devices */
305 {
306 .name = "seckey",
307 .id = -1,
308 .parent = &clk_pd0,
309 .enable = s5pc100_clk_d02_ctrl,
310 .ctrlbit = S5PC100_CLKGATE_D02_SECKEY,
311 }, {
312 .name = "sdm",
313 .id = -1,
314 .parent = &clk_hd0,
315 .enable = s5pc100_clk_d02_ctrl,
316 .ctrlbit = S5PC100_CLKGATE_D02_SDM,
317 },
318
319 /* File (D1_0) devices */
320 {
321 .name = "pdma",
322 .id = 0,
323 .parent = &clk_h,
324 .enable = s5pc100_clk_d10_ctrl,
325 .ctrlbit = S5PC100_CLKGATE_D10_PDMA0,
326 }, {
327 .name = "pdma",
328 .id = 1,
329 .parent = &clk_h,
330 .enable = s5pc100_clk_d10_ctrl,
331 .ctrlbit = S5PC100_CLKGATE_D10_PDMA1,
332 }, {
333 .name = "usb-host",
334 .id = -1,
335 .parent = &clk_h,
336 .enable = s5pc100_clk_d10_ctrl,
337 .ctrlbit = S5PC100_CLKGATE_D10_USBHOST,
338 }, {
339 .name = "otg",
340 .id = -1,
341 .parent = &clk_h,
342 .enable = s5pc100_clk_d10_ctrl,
343 .ctrlbit = S5PC100_CLKGATE_D10_USBOTG,
344 }, {
345 .name = "modem",
346 .id = -1,
347 .parent = &clk_h,
348 .enable = s5pc100_clk_d10_ctrl,
349 .ctrlbit = S5PC100_CLKGATE_D10_MODEMIF,
350 }, {
351 .name = "hsmmc",
352 .id = 0,
353 .parent = &clk_48m,
354 .enable = s5pc100_clk_d10_ctrl,
355 .ctrlbit = S5PC100_CLKGATE_D10_HSMMC0,
356 }, {
357 .name = "hsmmc",
358 .id = 1,
359 .parent = &clk_48m,
360 .enable = s5pc100_clk_d10_ctrl,
361 .ctrlbit = S5PC100_CLKGATE_D10_HSMMC1,
362 }, {
363 .name = "hsmmc",
364 .id = 2,
365 .parent = &clk_48m,
366 .enable = s5pc100_clk_d10_ctrl,
367 .ctrlbit = S5PC100_CLKGATE_D10_HSMMC2,
368 },
369
370 /* Multimedia1 (D1_1) devices */
371 {
372 .name = "lcd",
373 .id = -1,
374 .parent = &clk_p,
375 .enable = s5pc100_clk_d11_ctrl,
376 .ctrlbit = S5PC100_CLKGATE_D11_LCD,
377 }, {
378 .name = "rotator",
379 .id = -1,
380 .parent = &clk_p,
381 .enable = s5pc100_clk_d11_ctrl,
382 .ctrlbit = S5PC100_CLKGATE_D11_ROTATOR,
383 }, {
384 .name = "fimc",
385 .id = -1,
386 .parent = &clk_p,
387 .enable = s5pc100_clk_d11_ctrl,
388 .ctrlbit = S5PC100_CLKGATE_D11_FIMC0,
389 }, {
390 .name = "fimc",
391 .id = -1,
392 .parent = &clk_p,
393 .enable = s5pc100_clk_d11_ctrl,
394 .ctrlbit = S5PC100_CLKGATE_D11_FIMC1,
395 }, {
396 .name = "fimc",
397 .id = -1,
398 .parent = &clk_p,
399 .enable = s5pc100_clk_d11_ctrl,
400 .ctrlbit = S5PC100_CLKGATE_D11_FIMC2,
401 }, {
402 .name = "jpeg",
403 .id = -1,
404 .parent = &clk_p,
405 .enable = s5pc100_clk_d11_ctrl,
406 .ctrlbit = S5PC100_CLKGATE_D11_JPEG,
407 }, {
408 .name = "g3d",
409 .id = -1,
410 .parent = &clk_p,
411 .enable = s5pc100_clk_d11_ctrl,
412 .ctrlbit = S5PC100_CLKGATE_D11_G3D,
413 },
414
415 /* Multimedia2 (D1_2) devices */
416 {
417 .name = "tv",
418 .id = -1,
419 .parent = &clk_p,
420 .enable = s5pc100_clk_d12_ctrl,
421 .ctrlbit = S5PC100_CLKGATE_D12_TV,
422 }, {
423 .name = "vp",
424 .id = -1,
425 .parent = &clk_p,
426 .enable = s5pc100_clk_d12_ctrl,
427 .ctrlbit = S5PC100_CLKGATE_D12_VP,
428 }, {
429 .name = "mixer",
430 .id = -1,
431 .parent = &clk_p,
432 .enable = s5pc100_clk_d12_ctrl,
433 .ctrlbit = S5PC100_CLKGATE_D12_MIXER,
434 }, {
435 .name = "hdmi",
436 .id = -1,
437 .parent = &clk_p,
438 .enable = s5pc100_clk_d12_ctrl,
439 .ctrlbit = S5PC100_CLKGATE_D12_HDMI,
440 }, {
441 .name = "mfc",
442 .id = -1,
443 .parent = &clk_p,
444 .enable = s5pc100_clk_d12_ctrl,
445 .ctrlbit = S5PC100_CLKGATE_D12_MFC,
446 },
447
448 /* System (D1_3) devices */
449 {
450 .name = "chipid",
451 .id = -1,
452 .parent = &clk_p,
453 .enable = s5pc100_clk_d13_ctrl,
454 .ctrlbit = S5PC100_CLKGATE_D13_CHIPID,
455 }, {
456 .name = "gpio",
457 .id = -1,
458 .parent = &clk_p,
459 .enable = s5pc100_clk_d13_ctrl,
460 .ctrlbit = S5PC100_CLKGATE_D13_GPIO,
461 }, {
462 .name = "apc",
463 .id = -1,
464 .parent = &clk_p,
465 .enable = s5pc100_clk_d13_ctrl,
466 .ctrlbit = S5PC100_CLKGATE_D13_APC,
467 }, {
468 .name = "iec",
469 .id = -1,
470 .parent = &clk_p,
471 .enable = s5pc100_clk_d13_ctrl,
472 .ctrlbit = S5PC100_CLKGATE_D13_IEC,
473 }, {
474 .name = "timers",
475 .id = -1,
476 .parent = &clk_p,
477 .enable = s5pc100_clk_d13_ctrl,
478 .ctrlbit = S5PC100_CLKGATE_D13_PWM,
479 }, {
480 .name = "systimer",
481 .id = -1,
482 .parent = &clk_p,
483 .enable = s5pc100_clk_d13_ctrl,
484 .ctrlbit = S5PC100_CLKGATE_D13_SYSTIMER,
485 }, {
486 .name = "watchdog",
487 .id = -1,
488 .parent = &clk_p,
489 .enable = s5pc100_clk_d13_ctrl,
490 .ctrlbit = S5PC100_CLKGATE_D13_WDT,
491 }, {
492 .name = "rtc",
493 .id = -1,
494 .parent = &clk_p,
495 .enable = s5pc100_clk_d13_ctrl,
496 .ctrlbit = S5PC100_CLKGATE_D13_RTC,
497 },
498
499 /* Connectivity (D1_4) devices */
500 {
501 .name = "uart",
502 .id = 0,
503 .parent = &clk_p,
504 .enable = s5pc100_clk_d14_ctrl,
505 .ctrlbit = S5PC100_CLKGATE_D14_UART0,
506 }, {
507 .name = "uart",
508 .id = 1,
509 .parent = &clk_p,
510 .enable = s5pc100_clk_d14_ctrl,
511 .ctrlbit = S5PC100_CLKGATE_D14_UART1,
512 }, {
513 .name = "uart",
514 .id = 2,
515 .parent = &clk_p,
516 .enable = s5pc100_clk_d14_ctrl,
517 .ctrlbit = S5PC100_CLKGATE_D14_UART2,
518 }, {
519 .name = "uart",
520 .id = 3,
521 .parent = &clk_p,
522 .enable = s5pc100_clk_d14_ctrl,
523 .ctrlbit = S5PC100_CLKGATE_D14_UART3,
524 }, {
525 .name = "i2c",
526 .id = -1,
527 .parent = &clk_p,
528 .enable = s5pc100_clk_d14_ctrl,
529 .ctrlbit = S5PC100_CLKGATE_D14_IIC,
530 }, {
531 .name = "hdmi-i2c",
532 .id = -1,
533 .parent = &clk_p,
534 .enable = s5pc100_clk_d14_ctrl,
535 .ctrlbit = S5PC100_CLKGATE_D14_HDMI_IIC,
536 }, {
537 .name = "spi",
538 .id = 0,
539 .parent = &clk_p,
540 .enable = s5pc100_clk_d14_ctrl,
541 .ctrlbit = S5PC100_CLKGATE_D14_SPI0,
542 }, {
543 .name = "spi",
544 .id = 1,
545 .parent = &clk_p,
546 .enable = s5pc100_clk_d14_ctrl,
547 .ctrlbit = S5PC100_CLKGATE_D14_SPI1,
548 }, {
549 .name = "spi",
550 .id = 2,
551 .parent = &clk_p,
552 .enable = s5pc100_clk_d14_ctrl,
553 .ctrlbit = S5PC100_CLKGATE_D14_SPI2,
554 }, {
555 .name = "irda",
556 .id = -1,
557 .parent = &clk_p,
558 .enable = s5pc100_clk_d14_ctrl,
559 .ctrlbit = S5PC100_CLKGATE_D14_IRDA,
560 }, {
561 .name = "hsitx",
562 .id = -1,
563 .parent = &clk_p,
564 .enable = s5pc100_clk_d14_ctrl,
565 .ctrlbit = S5PC100_CLKGATE_D14_HSITX,
566 }, {
567 .name = "hsirx",
568 .id = -1,
569 .parent = &clk_p,
570 .enable = s5pc100_clk_d14_ctrl,
571 .ctrlbit = S5PC100_CLKGATE_D14_HSIRX,
572 },
573
574 /* Audio (D1_5) devices */
575 {
576 .name = "iis",
577 .id = 0,
578 .parent = &clk_p,
579 .enable = s5pc100_clk_d15_ctrl,
580 .ctrlbit = S5PC100_CLKGATE_D15_IIS0,
581 }, {
582 .name = "iis",
583 .id = 1,
584 .parent = &clk_p,
585 .enable = s5pc100_clk_d15_ctrl,
586 .ctrlbit = S5PC100_CLKGATE_D15_IIS1,
587 }, {
588 .name = "iis",
589 .id = 2,
590 .parent = &clk_p,
591 .enable = s5pc100_clk_d15_ctrl,
592 .ctrlbit = S5PC100_CLKGATE_D15_IIS2,
593 }, {
594 .name = "ac97",
595 .id = -1,
596 .parent = &clk_p,
597 .enable = s5pc100_clk_d15_ctrl,
598 .ctrlbit = S5PC100_CLKGATE_D15_AC97,
599 }, {
600 .name = "pcm",
601 .id = 0,
602 .parent = &clk_p,
603 .enable = s5pc100_clk_d15_ctrl,
604 .ctrlbit = S5PC100_CLKGATE_D15_PCM0,
605 }, {
606 .name = "pcm",
607 .id = 1,
608 .parent = &clk_p,
609 .enable = s5pc100_clk_d15_ctrl,
610 .ctrlbit = S5PC100_CLKGATE_D15_PCM1,
611 }, {
612 .name = "spdif",
613 .id = -1,
614 .parent = &clk_p,
615 .enable = s5pc100_clk_d15_ctrl,
616 .ctrlbit = S5PC100_CLKGATE_D15_SPDIF,
617 }, {
618 .name = "adc",
619 .id = -1,
620 .parent = &clk_p,
621 .enable = s5pc100_clk_d15_ctrl,
622 .ctrlbit = S5PC100_CLKGATE_D15_TSADC,
623 }, {
624 .name = "cg",
625 .id = -1,
626 .parent = &clk_p,
627 .enable = s5pc100_clk_d15_ctrl,
628 .ctrlbit = S5PC100_CLKGATE_D15_CG,
629 },
630
631 /* Audio (D2_0) devices: all disabled */
632
633 /* Special Clocks 0 */
634 {
635 .name = "sclk_hpm",
636 .id = -1,
637 .parent = NULL,
638 .enable = s5pc100_sclk0_ctrl,
639 .ctrlbit = S5PC100_CLKGATE_SCLK0_HPM,
640 }, {
641 .name = "sclk_onenand",
642 .id = -1,
643 .parent = NULL,
644 .enable = s5pc100_sclk0_ctrl,
645 .ctrlbit = S5PC100_CLKGATE_SCLK0_ONENAND,
646 }, {
647 .name = "spi_48",
648 .id = 0,
649 .parent = &clk_48m,
650 .enable = s5pc100_sclk0_ctrl,
651 .ctrlbit = S5PC100_CLKGATE_SCLK0_SPI0_48,
652 }, {
653 .name = "spi_48",
654 .id = 1,
655 .parent = &clk_48m,
656 .enable = s5pc100_sclk0_ctrl,
657 .ctrlbit = S5PC100_CLKGATE_SCLK0_SPI1_48,
658 }, {
659 .name = "spi_48",
660 .id = 2,
661 .parent = &clk_48m,
662 .enable = s5pc100_sclk0_ctrl,
663 .ctrlbit = S5PC100_CLKGATE_SCLK0_SPI2_48,
664 }, {
665 .name = "mmc_48",
666 .id = 0,
667 .parent = &clk_48m,
668 .enable = s5pc100_sclk0_ctrl,
669 .ctrlbit = S5PC100_CLKGATE_SCLK0_MMC0_48,
670 }, {
671 .name = "mmc_48",
672 .id = 1,
673 .parent = &clk_48m,
674 .enable = s5pc100_sclk0_ctrl,
675 .ctrlbit = S5PC100_CLKGATE_SCLK0_MMC1_48,
676 }, {
677 .name = "mmc_48",
678 .id = 2,
679 .parent = &clk_48m,
680 .enable = s5pc100_sclk0_ctrl,
681 .ctrlbit = S5PC100_CLKGATE_SCLK0_MMC2_48,
682 },
683 /* Special Clocks 1 */
684};
685
686static struct clk *clks[] __initdata = {
687 &clk_ext,
688 &clk_epll,
689 &clk_27m,
690 &clk_48m,
691 &clk_54m,
692};
693
694void __init s5pc1xx_register_clocks(void)
695{
696 struct clk *clkp;
697 int ret;
698 int ptr;
699 int size;
700
701 s3c24xx_register_clocks(clks, ARRAY_SIZE(clks));
702
703 clkp = s5pc100_init_clocks;
704 size = ARRAY_SIZE(s5pc100_init_clocks);
705
706 for (ptr = 0; ptr < size; ptr++, clkp++) {
707 ret = s3c24xx_register_clock(clkp);
708 if (ret < 0) {
709 printk(KERN_ERR "Failed to register clock %s (%d)\n",
710 clkp->name, ret);
711 }
712 }
713
714 clkp = s5pc100_init_clocks_disable;
715 size = ARRAY_SIZE(s5pc100_init_clocks_disable);
716
717 for (ptr = 0; ptr < size; ptr++, clkp++) {
718 ret = s3c24xx_register_clock(clkp);
719 if (ret < 0) {
720 printk(KERN_ERR "Failed to register clock %s (%d)\n",
721 clkp->name, ret);
722 }
723
724 (clkp->enable)(clkp, 0);
725 }
726
727 s3c_pwmclk_init();
728}
diff --git a/arch/arm/plat-s5pc1xx/cpu.c b/arch/arm/plat-s5pc1xx/cpu.c
index 715a7330794d..02baeaa2a121 100644
--- a/arch/arm/plat-s5pc1xx/cpu.c
+++ b/arch/arm/plat-s5pc1xx/cpu.c
@@ -55,6 +55,16 @@ static struct cpu_table cpu_ids[] __initdata = {
55 55
56static struct map_desc s5pc1xx_iodesc[] __initdata = { 56static struct map_desc s5pc1xx_iodesc[] __initdata = {
57 { 57 {
58 .virtual = (unsigned long)S5PC1XX_VA_CLK_OTHER,
59 .pfn = __phys_to_pfn(S5PC1XX_PA_CLK_OTHER),
60 .length = SZ_4K,
61 .type = MT_DEVICE,
62 }, {
63 .virtual = (unsigned long)S5PC1XX_VA_GPIO,
64 .pfn = __phys_to_pfn(S5PC100_PA_GPIO),
65 .length = SZ_4K,
66 .type = MT_DEVICE,
67 }, {
58 .virtual = (unsigned long)S5PC1XX_VA_CHIPID, 68 .virtual = (unsigned long)S5PC1XX_VA_CHIPID,
59 .pfn = __phys_to_pfn(S5PC1XX_PA_CHIPID), 69 .pfn = __phys_to_pfn(S5PC1XX_PA_CHIPID),
60 .length = SZ_16, 70 .length = SZ_16,
diff --git a/arch/arm/plat-s5pc1xx/gpio-config.c b/arch/arm/plat-s5pc1xx/gpio-config.c
new file mode 100644
index 000000000000..bba675df9c75
--- /dev/null
+++ b/arch/arm/plat-s5pc1xx/gpio-config.c
@@ -0,0 +1,62 @@
1/* linux/arch/arm/plat-s5pc1xx/gpio-config.c
2 *
3 * Copyright 2009 Samsung Electronics
4 *
5 * S5PC1XX GPIO Configuration.
6 *
7 * Based on plat-s3c64xx/gpio-config.c
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12*/
13
14#include <linux/kernel.h>
15#include <linux/module.h>
16#include <linux/gpio.h>
17#include <linux/io.h>
18
19#include <mach/gpio-core.h>
20#include <plat/gpio-cfg-s5pc1xx.h>
21
22s5p_gpio_drvstr_t s5p_gpio_get_drvstr(unsigned int pin, unsigned int off)
23{
24 struct s3c_gpio_chip *chip = s3c_gpiolib_getchip(pin);
25 void __iomem *reg;
26 int shift = off * 2;
27 u32 drvstr;
28
29 if (!chip)
30 return -EINVAL;
31
32 reg = chip->base + 0x0C;
33
34 drvstr = __raw_readl(reg);
35 drvstr = 0xffff & (0x3 << shift);
36 drvstr = drvstr >> shift;
37
38 return (__force s5p_gpio_drvstr_t)drvstr;
39}
40EXPORT_SYMBOL(s5p_gpio_get_drvstr);
41
42int s5p_gpio_set_drvstr(unsigned int pin, unsigned int off,
43 s5p_gpio_drvstr_t drvstr)
44{
45 struct s3c_gpio_chip *chip = s3c_gpiolib_getchip(pin);
46 void __iomem *reg;
47 int shift = off * 2;
48 u32 tmp;
49
50 if (!chip)
51 return -EINVAL;
52
53 reg = chip->base + 0x0C;
54
55 tmp = __raw_readl(reg);
56 tmp |= drvstr << shift;
57
58 __raw_writel(tmp, reg);
59
60 return 0;
61}
62EXPORT_SYMBOL(s5p_gpio_set_drvstr);
diff --git a/arch/arm/plat-s5pc1xx/gpiolib.c b/arch/arm/plat-s5pc1xx/gpiolib.c
new file mode 100644
index 000000000000..facb410e7a71
--- /dev/null
+++ b/arch/arm/plat-s5pc1xx/gpiolib.c
@@ -0,0 +1,503 @@
1/*
2 * arch/arm/plat-s5pc1xx/gpiolib.c
3 *
4 * Copyright 2009 Samsung Electronics Co
5 * Kyungmin Park <kyungmin.park@samsung.com>
6 *
7 * S5PC1XX - GPIOlib support
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12 */
13
14#include <linux/kernel.h>
15#include <linux/irq.h>
16#include <linux/io.h>
17#include <linux/gpio.h>
18
19#include <mach/map.h>
20#include <mach/gpio-core.h>
21
22#include <plat/gpio-cfg.h>
23#include <plat/gpio-cfg-helpers.h>
24#include <plat/regs-gpio.h>
25
26/* S5PC100 GPIO bank summary:
27 *
28 * Bank GPIOs Style INT Type
29 * A0 8 4Bit GPIO_INT0
30 * A1 5 4Bit GPIO_INT1
31 * B 8 4Bit GPIO_INT2
32 * C 5 4Bit GPIO_INT3
33 * D 7 4Bit GPIO_INT4
34 * E0 8 4Bit GPIO_INT5
35 * E1 6 4Bit GPIO_INT6
36 * F0 8 4Bit GPIO_INT7
37 * F1 8 4Bit GPIO_INT8
38 * F2 8 4Bit GPIO_INT9
39 * F3 4 4Bit GPIO_INT10
40 * G0 8 4Bit GPIO_INT11
41 * G1 3 4Bit GPIO_INT12
42 * G2 7 4Bit GPIO_INT13
43 * G3 7 4Bit GPIO_INT14
44 * H0 8 4Bit WKUP_INT
45 * H1 8 4Bit WKUP_INT
46 * H2 8 4Bit WKUP_INT
47 * H3 8 4Bit WKUP_INT
48 * I 8 4Bit GPIO_INT15
49 * J0 8 4Bit GPIO_INT16
50 * J1 5 4Bit GPIO_INT17
51 * J2 8 4Bit GPIO_INT18
52 * J3 8 4Bit GPIO_INT19
53 * J4 4 4Bit GPIO_INT20
54 * K0 8 4Bit None
55 * K1 6 4Bit None
56 * K2 8 4Bit None
57 * K3 8 4Bit None
58 * L0 8 4Bit None
59 * L1 8 4Bit None
60 * L2 8 4Bit None
61 * L3 8 4Bit None
62 */
63
64#define OFF_GPCON (0x00)
65#define OFF_GPDAT (0x04)
66
67#define con_4bit_shift(__off) ((__off) * 4)
68
69#if 1
70#define gpio_dbg(x...) do { } while (0)
71#else
72#define gpio_dbg(x...) printk(KERN_DEBUG x)
73#endif
74
75/* The s5pc1xx_gpiolib routines are to control the gpio banks where
76 * the gpio configuration register (GPxCON) has 4 bits per GPIO, as the
77 * following example:
78 *
79 * base + 0x00: Control register, 4 bits per gpio
80 * gpio n: 4 bits starting at (4*n)
81 * 0000 = input, 0001 = output, others mean special-function
82 * base + 0x04: Data register, 1 bit per gpio
83 * bit n: data bit n
84 *
85 * Note, since the data register is one bit per gpio and is at base + 0x4
86 * we can use s3c_gpiolib_get and s3c_gpiolib_set to change the state of
87 * the output.
88 */
89
90static int s5pc1xx_gpiolib_input(struct gpio_chip *chip, unsigned offset)
91{
92 struct s3c_gpio_chip *ourchip = to_s3c_gpio(chip);
93 void __iomem *base = ourchip->base;
94 unsigned long con;
95
96 con = __raw_readl(base + OFF_GPCON);
97 con &= ~(0xf << con_4bit_shift(offset));
98 __raw_writel(con, base + OFF_GPCON);
99
100 gpio_dbg("%s: %p: CON now %08lx\n", __func__, base, con);
101
102 return 0;
103}
104
105static int s5pc1xx_gpiolib_output(struct gpio_chip *chip,
106 unsigned offset, int value)
107{
108 struct s3c_gpio_chip *ourchip = to_s3c_gpio(chip);
109 void __iomem *base = ourchip->base;
110 unsigned long con;
111 unsigned long dat;
112
113 con = __raw_readl(base + OFF_GPCON);
114 con &= ~(0xf << con_4bit_shift(offset));
115 con |= 0x1 << con_4bit_shift(offset);
116
117 dat = __raw_readl(base + OFF_GPDAT);
118 if (value)
119 dat |= 1 << offset;
120 else
121 dat &= ~(1 << offset);
122
123 __raw_writel(dat, base + OFF_GPDAT);
124 __raw_writel(con, base + OFF_GPCON);
125 __raw_writel(dat, base + OFF_GPDAT);
126
127 gpio_dbg("%s: %p: CON %08lx, DAT %08lx\n", __func__, base, con, dat);
128
129 return 0;
130}
131
132static int s5pc1xx_gpiolib_to_irq(struct gpio_chip *chip, unsigned int offset)
133{
134 return S3C_IRQ_GPIO(chip->base + offset);
135}
136
137static int s5pc1xx_gpiolib_to_eint(struct gpio_chip *chip, unsigned int offset)
138{
139 int base;
140
141 base = chip->base - S5PC100_GPH0(0);
142 if (base == 0)
143 return IRQ_EINT(offset);
144 base = chip->base - S5PC100_GPH1(0);
145 if (base == 0)
146 return IRQ_EINT(8 + offset);
147 base = chip->base - S5PC100_GPH2(0);
148 if (base == 0)
149 return IRQ_EINT(16 + offset);
150 base = chip->base - S5PC100_GPH3(0);
151 if (base == 0)
152 return IRQ_EINT(24 + offset);
153 return -EINVAL;
154}
155
156static struct s3c_gpio_cfg gpio_cfg = {
157 .set_config = s3c_gpio_setcfg_s3c64xx_4bit,
158 .set_pull = s3c_gpio_setpull_updown,
159 .get_pull = s3c_gpio_getpull_updown,
160};
161
162static struct s3c_gpio_cfg gpio_cfg_eint = {
163 .cfg_eint = 0xf,
164 .set_config = s3c_gpio_setcfg_s3c64xx_4bit,
165 .set_pull = s3c_gpio_setpull_updown,
166 .get_pull = s3c_gpio_getpull_updown,
167};
168
169static struct s3c_gpio_cfg gpio_cfg_noint = {
170 .set_config = s3c_gpio_setcfg_s3c64xx_4bit,
171 .set_pull = s3c_gpio_setpull_updown,
172 .get_pull = s3c_gpio_getpull_updown,
173};
174
175static struct s3c_gpio_chip s5pc100_gpio_chips[] = {
176 {
177 .base = S5PC100_GPA0_BASE,
178 .config = &gpio_cfg,
179 .chip = {
180 .base = S5PC100_GPA0(0),
181 .ngpio = S5PC100_GPIO_A0_NR,
182 .label = "GPA0",
183 },
184 }, {
185 .base = S5PC100_GPA1_BASE,
186 .config = &gpio_cfg,
187 .chip = {
188 .base = S5PC100_GPA1(0),
189 .ngpio = S5PC100_GPIO_A1_NR,
190 .label = "GPA1",
191 },
192 }, {
193 .base = S5PC100_GPB_BASE,
194 .config = &gpio_cfg,
195 .chip = {
196 .base = S5PC100_GPB(0),
197 .ngpio = S5PC100_GPIO_B_NR,
198 .label = "GPB",
199 },
200 }, {
201 .base = S5PC100_GPC_BASE,
202 .config = &gpio_cfg,
203 .chip = {
204 .base = S5PC100_GPC(0),
205 .ngpio = S5PC100_GPIO_C_NR,
206 .label = "GPC",
207 },
208 }, {
209 .base = S5PC100_GPD_BASE,
210 .config = &gpio_cfg,
211 .chip = {
212 .base = S5PC100_GPD(0),
213 .ngpio = S5PC100_GPIO_D_NR,
214 .label = "GPD",
215 },
216 }, {
217 .base = S5PC100_GPE0_BASE,
218 .config = &gpio_cfg,
219 .chip = {
220 .base = S5PC100_GPE0(0),
221 .ngpio = S5PC100_GPIO_E0_NR,
222 .label = "GPE0",
223 },
224 }, {
225 .base = S5PC100_GPE1_BASE,
226 .config = &gpio_cfg,
227 .chip = {
228 .base = S5PC100_GPE1(0),
229 .ngpio = S5PC100_GPIO_E1_NR,
230 .label = "GPE1",
231 },
232 }, {
233 .base = S5PC100_GPF0_BASE,
234 .config = &gpio_cfg,
235 .chip = {
236 .base = S5PC100_GPF0(0),
237 .ngpio = S5PC100_GPIO_F0_NR,
238 .label = "GPF0",
239 },
240 }, {
241 .base = S5PC100_GPF1_BASE,
242 .config = &gpio_cfg,
243 .chip = {
244 .base = S5PC100_GPF1(0),
245 .ngpio = S5PC100_GPIO_F1_NR,
246 .label = "GPF1",
247 },
248 }, {
249 .base = S5PC100_GPF2_BASE,
250 .config = &gpio_cfg,
251 .chip = {
252 .base = S5PC100_GPF2(0),
253 .ngpio = S5PC100_GPIO_F2_NR,
254 .label = "GPF2",
255 },
256 }, {
257 .base = S5PC100_GPF3_BASE,
258 .config = &gpio_cfg,
259 .chip = {
260 .base = S5PC100_GPF3(0),
261 .ngpio = S5PC100_GPIO_F3_NR,
262 .label = "GPF3",
263 },
264 }, {
265 .base = S5PC100_GPG0_BASE,
266 .config = &gpio_cfg,
267 .chip = {
268 .base = S5PC100_GPG0(0),
269 .ngpio = S5PC100_GPIO_G0_NR,
270 .label = "GPG0",
271 },
272 }, {
273 .base = S5PC100_GPG1_BASE,
274 .config = &gpio_cfg,
275 .chip = {
276 .base = S5PC100_GPG1(0),
277 .ngpio = S5PC100_GPIO_G1_NR,
278 .label = "GPG1",
279 },
280 }, {
281 .base = S5PC100_GPG2_BASE,
282 .config = &gpio_cfg,
283 .chip = {
284 .base = S5PC100_GPG2(0),
285 .ngpio = S5PC100_GPIO_G2_NR,
286 .label = "GPG2",
287 },
288 }, {
289 .base = S5PC100_GPG3_BASE,
290 .config = &gpio_cfg,
291 .chip = {
292 .base = S5PC100_GPG3(0),
293 .ngpio = S5PC100_GPIO_G3_NR,
294 .label = "GPG3",
295 },
296 }, {
297 .base = S5PC100_GPH0_BASE,
298 .config = &gpio_cfg_eint,
299 .chip = {
300 .base = S5PC100_GPH0(0),
301 .ngpio = S5PC100_GPIO_H0_NR,
302 .label = "GPH0",
303 },
304 }, {
305 .base = S5PC100_GPH1_BASE,
306 .config = &gpio_cfg_eint,
307 .chip = {
308 .base = S5PC100_GPH1(0),
309 .ngpio = S5PC100_GPIO_H1_NR,
310 .label = "GPH1",
311 },
312 }, {
313 .base = S5PC100_GPH2_BASE,
314 .config = &gpio_cfg_eint,
315 .chip = {
316 .base = S5PC100_GPH2(0),
317 .ngpio = S5PC100_GPIO_H2_NR,
318 .label = "GPH2",
319 },
320 }, {
321 .base = S5PC100_GPH3_BASE,
322 .config = &gpio_cfg_eint,
323 .chip = {
324 .base = S5PC100_GPH3(0),
325 .ngpio = S5PC100_GPIO_H3_NR,
326 .label = "GPH3",
327 },
328 }, {
329 .base = S5PC100_GPI_BASE,
330 .config = &gpio_cfg,
331 .chip = {
332 .base = S5PC100_GPI(0),
333 .ngpio = S5PC100_GPIO_I_NR,
334 .label = "GPI",
335 },
336 }, {
337 .base = S5PC100_GPJ0_BASE,
338 .config = &gpio_cfg,
339 .chip = {
340 .base = S5PC100_GPJ0(0),
341 .ngpio = S5PC100_GPIO_J0_NR,
342 .label = "GPJ0",
343 },
344 }, {
345 .base = S5PC100_GPJ1_BASE,
346 .config = &gpio_cfg,
347 .chip = {
348 .base = S5PC100_GPJ1(0),
349 .ngpio = S5PC100_GPIO_J1_NR,
350 .label = "GPJ1",
351 },
352 }, {
353 .base = S5PC100_GPJ2_BASE,
354 .config = &gpio_cfg,
355 .chip = {
356 .base = S5PC100_GPJ2(0),
357 .ngpio = S5PC100_GPIO_J2_NR,
358 .label = "GPJ2",
359 },
360 }, {
361 .base = S5PC100_GPJ3_BASE,
362 .config = &gpio_cfg,
363 .chip = {
364 .base = S5PC100_GPJ3(0),
365 .ngpio = S5PC100_GPIO_J3_NR,
366 .label = "GPJ3",
367 },
368 }, {
369 .base = S5PC100_GPJ4_BASE,
370 .config = &gpio_cfg,
371 .chip = {
372 .base = S5PC100_GPJ4(0),
373 .ngpio = S5PC100_GPIO_J4_NR,
374 .label = "GPJ4",
375 },
376 }, {
377 .base = S5PC100_GPK0_BASE,
378 .config = &gpio_cfg_noint,
379 .chip = {
380 .base = S5PC100_GPK0(0),
381 .ngpio = S5PC100_GPIO_K0_NR,
382 .label = "GPK0",
383 },
384 }, {
385 .base = S5PC100_GPK1_BASE,
386 .config = &gpio_cfg_noint,
387 .chip = {
388 .base = S5PC100_GPK1(0),
389 .ngpio = S5PC100_GPIO_K1_NR,
390 .label = "GPK1",
391 },
392 }, {
393 .base = S5PC100_GPK2_BASE,
394 .config = &gpio_cfg_noint,
395 .chip = {
396 .base = S5PC100_GPK2(0),
397 .ngpio = S5PC100_GPIO_K2_NR,
398 .label = "GPK2",
399 },
400 }, {
401 .base = S5PC100_GPK3_BASE,
402 .config = &gpio_cfg_noint,
403 .chip = {
404 .base = S5PC100_GPK3(0),
405 .ngpio = S5PC100_GPIO_K3_NR,
406 .label = "GPK3",
407 },
408 }, {
409 .base = S5PC100_GPL0_BASE,
410 .config = &gpio_cfg_noint,
411 .chip = {
412 .base = S5PC100_GPL0(0),
413 .ngpio = S5PC100_GPIO_L0_NR,
414 .label = "GPL0",
415 },
416 }, {
417 .base = S5PC100_GPL1_BASE,
418 .config = &gpio_cfg_noint,
419 .chip = {
420 .base = S5PC100_GPL1(0),
421 .ngpio = S5PC100_GPIO_L1_NR,
422 .label = "GPL1",
423 },
424 }, {
425 .base = S5PC100_GPL2_BASE,
426 .config = &gpio_cfg_noint,
427 .chip = {
428 .base = S5PC100_GPL2(0),
429 .ngpio = S5PC100_GPIO_L2_NR,
430 .label = "GPL2",
431 },
432 }, {
433 .base = S5PC100_GPL3_BASE,
434 .config = &gpio_cfg_noint,
435 .chip = {
436 .base = S5PC100_GPL3(0),
437 .ngpio = S5PC100_GPIO_L3_NR,
438 .label = "GPL3",
439 },
440 }, {
441 .base = S5PC100_GPL4_BASE,
442 .config = &gpio_cfg_noint,
443 .chip = {
444 .base = S5PC100_GPL4(0),
445 .ngpio = S5PC100_GPIO_L4_NR,
446 .label = "GPL4",
447 },
448 },
449};
450
451/* FIXME move from irq-gpio.c */
452extern struct irq_chip s5pc1xx_gpioint;
453extern void s5pc1xx_irq_gpioint_handler(unsigned int irq, struct irq_desc *desc);
454
455static __init void s5pc1xx_gpiolib_link(struct s3c_gpio_chip *chip)
456{
457 chip->chip.direction_input = s5pc1xx_gpiolib_input;
458 chip->chip.direction_output = s5pc1xx_gpiolib_output;
459 chip->pm = __gpio_pm(&s3c_gpio_pm_4bit);
460
461 /* Interrupt */
462 if (chip->config == &gpio_cfg) {
463 int i, irq;
464
465 chip->chip.to_irq = s5pc1xx_gpiolib_to_irq;
466
467 for (i = 0; i < chip->chip.ngpio; i++) {
468 irq = S3C_IRQ_GPIO_BASE + chip->chip.base + i;
469 set_irq_chip(irq, &s5pc1xx_gpioint);
470 set_irq_data(irq, &chip->chip);
471 set_irq_handler(irq, handle_level_irq);
472 set_irq_flags(irq, IRQF_VALID);
473 }
474 } else if (chip->config == &gpio_cfg_eint)
475 chip->chip.to_irq = s5pc1xx_gpiolib_to_eint;
476}
477
478static __init void s5pc1xx_gpiolib_add(struct s3c_gpio_chip *chips,
479 int nr_chips,
480 void (*fn)(struct s3c_gpio_chip *))
481{
482 for (; nr_chips > 0; nr_chips--, chips++) {
483 if (fn)
484 (fn)(chips);
485 s3c_gpiolib_add(chips);
486 }
487}
488
489static __init int s5pc1xx_gpiolib_init(void)
490{
491 struct s3c_gpio_chip *chips;
492 int nr_chips;
493
494 chips = s5pc100_gpio_chips;
495 nr_chips = ARRAY_SIZE(s5pc100_gpio_chips);
496
497 s5pc1xx_gpiolib_add(chips, nr_chips, s5pc1xx_gpiolib_link);
498 /* Interrupt */
499 set_irq_chained_handler(IRQ_GPIOINT, s5pc1xx_irq_gpioint_handler);
500
501 return 0;
502}
503core_initcall(s5pc1xx_gpiolib_init);
diff --git a/arch/arm/plat-s5pc1xx/include/plat/gpio-cfg-s5pc1xx.h b/arch/arm/plat-s5pc1xx/include/plat/gpio-cfg-s5pc1xx.h
new file mode 100644
index 000000000000..72ad59f61efc
--- /dev/null
+++ b/arch/arm/plat-s5pc1xx/include/plat/gpio-cfg-s5pc1xx.h
@@ -0,0 +1,32 @@
1/* linux/arch/arm/plat-s5pc1xx/include/plat/gpio-cfg.h
2 *
3 * Copyright 2009 Samsung Electronic
4 *
5 * S5PC1XX Platform - GPIO pin configuration
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10*/
11
12/* This file contains the necessary definitions to get the basic gpio
13 * pin configuration done such as setting a pin to input or output or
14 * changing the pull-{up,down} configurations.
15 */
16
17#ifndef __GPIO_CFG_S5PC1XX_H
18#define __GPIO_CFG_S5PC1XX_H __FILE__
19
20typedef unsigned int __bitwise__ s5p_gpio_drvstr_t;
21
22#define S5P_GPIO_DRVSTR_LV1 0x00
23#define S5P_GPIO_DRVSTR_LV2 0x01
24#define S5P_GPIO_DRVSTR_LV3 0x10
25#define S5P_GPIO_DRVSTR_LV4 0x11
26
27extern s5p_gpio_drvstr_t s5p_gpio_get_drvstr(unsigned int pin, unsigned int off);
28
29extern int s5p_gpio_set_drvstr(unsigned int pin, unsigned int off,
30 s5p_gpio_drvstr_t drvstr);
31
32#endif /* __GPIO_CFG_S5PC1XX_H */
diff --git a/arch/arm/plat-s5pc1xx/include/plat/gpio-ext.h b/arch/arm/plat-s5pc1xx/include/plat/gpio-ext.h
new file mode 100644
index 000000000000..33ad267e8477
--- /dev/null
+++ b/arch/arm/plat-s5pc1xx/include/plat/gpio-ext.h
@@ -0,0 +1,44 @@
1/* linux/arch/arm/plat-s5pc1xx/include/plat/gpio-eint.h
2 *
3 * Copyright 2009 Samsung Electronics Co.
4 *
5 * External Interrupt (GPH0 ~ GPH3) control register definitions
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10*/
11
12#define S5PC1XX_WKUP_INT_CON0_7 (S5PC1XX_EINT_BASE + 0x0)
13#define S5PC1XX_WKUP_INT_CON8_15 (S5PC1XX_EINT_BASE + 0x4)
14#define S5PC1XX_WKUP_INT_CON16_23 (S5PC1XX_EINT_BASE + 0x8)
15#define S5PC1XX_WKUP_INT_CON24_31 (S5PC1XX_EINT_BASE + 0xC)
16#define S5PC1XX_WKUP_INT_CON(x) (S5PC1XX_WKUP_INT_CON0_7 + (x * 0x4))
17
18#define S5PC1XX_WKUP_INT_FLTCON0_3 (S5PC1XX_EINT_BASE + 0x80)
19#define S5PC1XX_WKUP_INT_FLTCON4_7 (S5PC1XX_EINT_BASE + 0x84)
20#define S5PC1XX_WKUP_INT_FLTCON8_11 (S5PC1XX_EINT_BASE + 0x88)
21#define S5PC1XX_WKUP_INT_FLTCON12_15 (S5PC1XX_EINT_BASE + 0x8C)
22#define S5PC1XX_WKUP_INT_FLTCON16_19 (S5PC1XX_EINT_BASE + 0x90)
23#define S5PC1XX_WKUP_INT_FLTCON20_23 (S5PC1XX_EINT_BASE + 0x94)
24#define S5PC1XX_WKUP_INT_FLTCON24_27 (S5PC1XX_EINT_BASE + 0x98)
25#define S5PC1XX_WKUP_INT_FLTCON28_31 (S5PC1XX_EINT_BASE + 0x9C)
26#define S5PC1XX_WKUP_INT_FLTCON(x) (S5PC1XX_WKUP_INT_FLTCON0_3 + (x * 0x4))
27
28#define S5PC1XX_WKUP_INT_MASK0_7 (S5PC1XX_EINT_BASE + 0x100)
29#define S5PC1XX_WKUP_INT_MASK8_15 (S5PC1XX_EINT_BASE + 0x104)
30#define S5PC1XX_WKUP_INT_MASK16_23 (S5PC1XX_EINT_BASE + 0x108)
31#define S5PC1XX_WKUP_INT_MASK24_31 (S5PC1XX_EINT_BASE + 0x10C)
32#define S5PC1XX_WKUP_INT_MASK(x) (S5PC1XX_WKUP_INT_MASK0_7 + (x * 0x4))
33
34#define S5PC1XX_WKUP_INT_PEND0_7 (S5PC1XX_EINT_BASE + 0x140)
35#define S5PC1XX_WKUP_INT_PEND8_15 (S5PC1XX_EINT_BASE + 0x144)
36#define S5PC1XX_WKUP_INT_PEND16_23 (S5PC1XX_EINT_BASE + 0x148)
37#define S5PC1XX_WKUP_INT_PEND24_31 (S5PC1XX_EINT_BASE + 0x14C)
38#define S5PC1XX_WKUP_INT_PEND(x) (S5PC1XX_WKUP_INT_PEND0_7 + (x * 0x4))
39
40#define S5PC1XX_WKUP_INT_LOWLEV (0x00)
41#define S5PC1XX_WKUP_INT_HILEV (0x01)
42#define S5PC1XX_WKUP_INT_FALLEDGE (0x02)
43#define S5PC1XX_WKUP_INT_RISEEDGE (0x03)
44#define S5PC1XX_WKUP_INT_BOTHEDGE (0x04)
diff --git a/arch/arm/plat-s5pc1xx/include/plat/irqs.h b/arch/arm/plat-s5pc1xx/include/plat/irqs.h
index f07d8c3b25d6..ef8736366f0d 100644
--- a/arch/arm/plat-s5pc1xx/include/plat/irqs.h
+++ b/arch/arm/plat-s5pc1xx/include/plat/irqs.h
@@ -171,12 +171,21 @@
171#define IRQ_SDMIRQ S5PC1XX_IRQ_VIC2(30) 171#define IRQ_SDMIRQ S5PC1XX_IRQ_VIC2(30)
172#define IRQ_SDMFIQ S5PC1XX_IRQ_VIC2(31) 172#define IRQ_SDMFIQ S5PC1XX_IRQ_VIC2(31)
173 173
174/* External interrupt */
174#define S3C_IRQ_EINT_BASE (IRQ_SDMFIQ + 1) 175#define S3C_IRQ_EINT_BASE (IRQ_SDMFIQ + 1)
175 176
176#define S3C_EINT(x) ((x) + S3C_IRQ_EINT_BASE) 177#define S3C_EINT(x) (S3C_IRQ_EINT_BASE + (x - 16))
177#define IRQ_EINT(x) S3C_EINT(x) 178#define IRQ_EINT(x) (x < 16 ? IRQ_EINT0 + x : S3C_EINT(x))
179#define IRQ_EINT_BIT(x) (x < IRQ_EINT16_31 ? x - IRQ_EINT0 : x - S3C_EINT(0))
178 180
179#define NR_IRQS (IRQ_EINT(31)+1) 181/* GPIO interrupt */
182#define S3C_IRQ_GPIO_BASE (IRQ_EINT(31) + 1)
183#define S3C_IRQ_GPIO(x) (S3C_IRQ_GPIO_BASE + (x))
184
185/*
186 * Until MP04 Groups -> 40 (exactly 39) Groups * 8 ~= 320 GPIOs
187 */
188#define NR_IRQS (S3C_IRQ_GPIO(320) + 1)
180 189
181#endif /* __ASM_PLAT_S5PC1XX_IRQS_H */ 190#endif /* __ASM_PLAT_S5PC1XX_IRQS_H */
182 191
diff --git a/arch/arm/plat-s5pc1xx/include/plat/regs-clock.h b/arch/arm/plat-s5pc1xx/include/plat/regs-clock.h
index 75c8390cb827..c5cc86e92d65 100644
--- a/arch/arm/plat-s5pc1xx/include/plat/regs-clock.h
+++ b/arch/arm/plat-s5pc1xx/include/plat/regs-clock.h
@@ -13,68 +13,69 @@
13#ifndef __PLAT_REGS_CLOCK_H 13#ifndef __PLAT_REGS_CLOCK_H
14#define __PLAT_REGS_CLOCK_H __FILE__ 14#define __PLAT_REGS_CLOCK_H __FILE__
15 15
16#define S5PC1XX_CLKREG(x) (S5PC1XX_VA_CLK + (x)) 16#define S5PC100_CLKREG(x) (S5PC1XX_VA_CLK + (x))
17 17#define S5PC100_CLKREG_OTHER(x) (S5PC1XX_VA_CLK_OTHER + (x))
18#define S5PC1XX_APLL_LOCK S5PC1XX_CLKREG(0x00) 18
19#define S5PC1XX_MPLL_LOCK S5PC1XX_CLKREG(0x04) 19/* s5pc100 register for clock */
20#define S5PC1XX_EPLL_LOCK S5PC1XX_CLKREG(0x08) 20#define S5PC100_APLL_LOCK S5PC100_CLKREG(0x00)
21#define S5PC100_HPLL_LOCK S5PC1XX_CLKREG(0x0C) 21#define S5PC100_MPLL_LOCK S5PC100_CLKREG(0x04)
22 22#define S5PC100_EPLL_LOCK S5PC100_CLKREG(0x08)
23#define S5PC1XX_APLL_CON S5PC1XX_CLKREG(0x100) 23#define S5PC100_HPLL_LOCK S5PC100_CLKREG(0x0C)
24#define S5PC1XX_MPLL_CON S5PC1XX_CLKREG(0x104) 24
25#define S5PC1XX_EPLL_CON S5PC1XX_CLKREG(0x108) 25#define S5PC100_APLL_CON S5PC100_CLKREG(0x100)
26#define S5PC100_HPLL_CON S5PC1XX_CLKREG(0x10C) 26#define S5PC100_MPLL_CON S5PC100_CLKREG(0x104)
27 27#define S5PC100_EPLL_CON S5PC100_CLKREG(0x108)
28#define S5PC1XX_CLK_SRC0 S5PC1XX_CLKREG(0x200) 28#define S5PC100_HPLL_CON S5PC100_CLKREG(0x10C)
29#define S5PC1XX_CLK_SRC1 S5PC1XX_CLKREG(0x204) 29
30#define S5PC1XX_CLK_SRC2 S5PC1XX_CLKREG(0x208) 30#define S5PC100_CLKSRC0 S5PC100_CLKREG(0x200)
31#define S5PC1XX_CLK_SRC3 S5PC1XX_CLKREG(0x20C) 31#define S5PC100_CLKSRC1 S5PC100_CLKREG(0x204)
32 32#define S5PC100_CLKSRC2 S5PC100_CLKREG(0x208)
33#define S5PC1XX_CLK_DIV0 S5PC1XX_CLKREG(0x300) 33#define S5PC100_CLKSRC3 S5PC100_CLKREG(0x20C)
34#define S5PC1XX_CLK_DIV1 S5PC1XX_CLKREG(0x304) 34
35#define S5PC1XX_CLK_DIV2 S5PC1XX_CLKREG(0x308) 35#define S5PC100_CLKDIV0 S5PC100_CLKREG(0x300)
36#define S5PC1XX_CLK_DIV3 S5PC1XX_CLKREG(0x30C) 36#define S5PC100_CLKDIV1 S5PC100_CLKREG(0x304)
37#define S5PC1XX_CLK_DIV4 S5PC1XX_CLKREG(0x310) 37#define S5PC100_CLKDIV2 S5PC100_CLKREG(0x308)
38 38#define S5PC100_CLKDIV3 S5PC100_CLKREG(0x30C)
39#define S5PC100_CLK_OUT S5PC1XX_CLKREG(0x400) 39#define S5PC100_CLKDIV4 S5PC100_CLKREG(0x310)
40 40
41#define S5PC100_CLKGATE_D00 S5PC1XX_CLKREG(0x500) 41#define S5PC100_CLK_OUT S5PC100_CLKREG(0x400)
42#define S5PC100_CLKGATE_D01 S5PC1XX_CLKREG(0x504) 42
43#define S5PC100_CLKGATE_D02 S5PC1XX_CLKREG(0x508) 43#define S5PC100_CLKGATE_D00 S5PC100_CLKREG(0x500)
44 44#define S5PC100_CLKGATE_D01 S5PC100_CLKREG(0x504)
45#define S5PC100_CLKGATE_D10 S5PC1XX_CLKREG(0x520) 45#define S5PC100_CLKGATE_D02 S5PC100_CLKREG(0x508)
46#define S5PC100_CLKGATE_D11 S5PC1XX_CLKREG(0x524) 46
47#define S5PC100_CLKGATE_D12 S5PC1XX_CLKREG(0x528) 47#define S5PC100_CLKGATE_D10 S5PC100_CLKREG(0x520)
48#define S5PC100_CLKGATE_D13 S5PC1XX_CLKREG(0x52C) 48#define S5PC100_CLKGATE_D11 S5PC100_CLKREG(0x524)
49#define S5PC100_CLKGATE_D14 S5PC1XX_CLKREG(0x530) 49#define S5PC100_CLKGATE_D12 S5PC100_CLKREG(0x528)
50#define S5PC100_CLKGATE_D15 S5PC1XX_CLKREG(0x534) 50#define S5PC100_CLKGATE_D13 S5PC100_CLKREG(0x52C)
51 51#define S5PC100_CLKGATE_D14 S5PC100_CLKREG(0x530)
52#define S5PC100_CLKGATE_D20 S5PC1XX_CLKREG(0x540) 52#define S5PC100_CLKGATE_D15 S5PC100_CLKREG(0x534)
53 53
54#define S5PC100_SCLKGATE0 S5PC1XX_CLKREG(0x560) 54#define S5PC100_CLKGATE_D20 S5PC100_CLKREG(0x540)
55#define S5PC100_SCLKGATE1 S5PC1XX_CLKREG(0x564) 55
56 56#define S5PC100_SCLKGATE0 S5PC100_CLKREG(0x560)
57#define S5PC100_OTHERS S5PC1XX_CLKREG(0x8200) 57#define S5PC100_SCLKGATE1 S5PC100_CLKREG(0x564)
58 58
59#define S5PC1XX_EPLL_EN (1<<31) 59/* EPLL_CON */
60#define S5PC1XX_EPLL_MASK 0xffffffff 60#define S5PC100_EPLL_EN (1<<31)
61#define S5PC1XX_EPLLVAL(_m, _p, _s) ((_m) << 16 | ((_p) << 8) | ((_s))) 61#define S5PC100_EPLL_MASK 0xffffffff
62#define S5PC100_EPLLVAL(_m, _p, _s) ((_m) << 16 | ((_p) << 8) | ((_s)))
62 63
63/* CLKSRC0 */ 64/* CLKSRC0 */
64#define S5PC1XX_CLKSRC0_APLL_MASK (0x1<<0) 65#define S5PC100_CLKSRC0_APLL_MASK (0x1<<0)
65#define S5PC1XX_CLKSRC0_APLL_SHIFT (0) 66#define S5PC100_CLKSRC0_APLL_SHIFT (0)
66#define S5PC1XX_CLKSRC0_MPLL_MASK (0x1<<4) 67#define S5PC100_CLKSRC0_MPLL_MASK (0x1<<4)
67#define S5PC1XX_CLKSRC0_MPLL_SHIFT (4) 68#define S5PC100_CLKSRC0_MPLL_SHIFT (4)
68#define S5PC1XX_CLKSRC0_EPLL_MASK (0x1<<8) 69#define S5PC100_CLKSRC0_EPLL_MASK (0x1<<8)
69#define S5PC1XX_CLKSRC0_EPLL_SHIFT (8) 70#define S5PC100_CLKSRC0_EPLL_SHIFT (8)
70#define S5PC100_CLKSRC0_HPLL_MASK (0x1<<12) 71#define S5PC100_CLKSRC0_HPLL_MASK (0x1<<12)
71#define S5PC100_CLKSRC0_HPLL_SHIFT (12) 72#define S5PC100_CLKSRC0_HPLL_SHIFT (12)
72#define S5PC100_CLKSRC0_AMMUX_MASK (0x1<<16) 73#define S5PC100_CLKSRC0_AMMUX_MASK (0x1<<16)
73#define S5PC100_CLKSRC0_AMMUX_SHIFT (16) 74#define S5PC100_CLKSRC0_AMMUX_SHIFT (16)
74#define S5PC100_CLKSRC0_HREF_MASK (0x1<<20) 75#define S5PC100_CLKSRC0_HREF_MASK (0x1<<20)
75#define S5PC100_CLKSRC0_HREF_SHIFT (20) 76#define S5PC100_CLKSRC0_HREF_SHIFT (20)
76#define S5PC1XX_CLKSRC0_ONENAND_MASK (0x1<<24) 77#define S5PC100_CLKSRC0_ONENAND_MASK (0x1<<24)
77#define S5PC1XX_CLKSRC0_ONENAND_SHIFT (24) 78#define S5PC100_CLKSRC0_ONENAND_SHIFT (24)
78 79
79 80
80/* CLKSRC1 */ 81/* CLKSRC1 */
@@ -127,10 +128,9 @@
127#define S5PC100_CLKSRC3_SPDIF_MASK (0x3<<24) 128#define S5PC100_CLKSRC3_SPDIF_MASK (0x3<<24)
128#define S5PC100_CLKSRC3_SPDIF_SHIFT (24) 129#define S5PC100_CLKSRC3_SPDIF_SHIFT (24)
129 130
130
131/* CLKDIV0 */ 131/* CLKDIV0 */
132#define S5PC1XX_CLKDIV0_APLL_MASK (0x1<<0) 132#define S5PC100_CLKDIV0_APLL_MASK (0x1<<0)
133#define S5PC1XX_CLKDIV0_APLL_SHIFT (0) 133#define S5PC100_CLKDIV0_APLL_SHIFT (0)
134#define S5PC100_CLKDIV0_ARM_MASK (0x7<<4) 134#define S5PC100_CLKDIV0_ARM_MASK (0x7<<4)
135#define S5PC100_CLKDIV0_ARM_SHIFT (4) 135#define S5PC100_CLKDIV0_ARM_SHIFT (4)
136#define S5PC100_CLKDIV0_D0_MASK (0x7<<8) 136#define S5PC100_CLKDIV0_D0_MASK (0x7<<8)
@@ -141,8 +141,8 @@
141#define S5PC100_CLKDIV0_SECSS_SHIFT (16) 141#define S5PC100_CLKDIV0_SECSS_SHIFT (16)
142 142
143/* CLKDIV1 */ 143/* CLKDIV1 */
144#define S5PC100_CLKDIV1_AM_MASK (0x7<<0) 144#define S5PC100_CLKDIV1_APLL2_MASK (0x7<<0)
145#define S5PC100_CLKDIV1_AM_SHIFT (0) 145#define S5PC100_CLKDIV1_APLL2_SHIFT (0)
146#define S5PC100_CLKDIV1_MPLL_MASK (0x3<<4) 146#define S5PC100_CLKDIV1_MPLL_MASK (0x3<<4)
147#define S5PC100_CLKDIV1_MPLL_SHIFT (4) 147#define S5PC100_CLKDIV1_MPLL_SHIFT (4)
148#define S5PC100_CLKDIV1_MPLL2_MASK (0x1<<8) 148#define S5PC100_CLKDIV1_MPLL2_MASK (0x1<<8)
@@ -202,7 +202,6 @@
202#define S5PC100_CLKDIV4_AUDIO2_MASK (0xf<<20) 202#define S5PC100_CLKDIV4_AUDIO2_MASK (0xf<<20)
203#define S5PC100_CLKDIV4_AUDIO2_SHIFT (20) 203#define S5PC100_CLKDIV4_AUDIO2_SHIFT (20)
204 204
205
206/* HCLKD0/PCLKD0 Clock Gate 0 Registers */ 205/* HCLKD0/PCLKD0 Clock Gate 0 Registers */
207#define S5PC100_CLKGATE_D00_INTC (1<<0) 206#define S5PC100_CLKGATE_D00_INTC (1<<0)
208#define S5PC100_CLKGATE_D00_TZIC (1<<1) 207#define S5PC100_CLKGATE_D00_TZIC (1<<1)
@@ -295,8 +294,8 @@
295#define S5PC100_CLKGATE_D20_I2SD2 (1<<1) 294#define S5PC100_CLKGATE_D20_I2SD2 (1<<1)
296 295
297/* Special Clock Gate 0 Registers */ 296/* Special Clock Gate 0 Registers */
298#define S5PC1XX_CLKGATE_SCLK0_HPM (1<<0) 297#define S5PC100_CLKGATE_SCLK0_HPM (1<<0)
299#define S5PC1XX_CLKGATE_SCLK0_PWI (1<<1) 298#define S5PC100_CLKGATE_SCLK0_PWI (1<<1)
300#define S5PC100_CLKGATE_SCLK0_ONENAND (1<<2) 299#define S5PC100_CLKGATE_SCLK0_ONENAND (1<<2)
301#define S5PC100_CLKGATE_SCLK0_UART (1<<3) 300#define S5PC100_CLKGATE_SCLK0_UART (1<<3)
302#define S5PC100_CLKGATE_SCLK0_SPI0 (1<<4) 301#define S5PC100_CLKGATE_SCLK0_SPI0 (1<<4)
@@ -329,89 +328,28 @@
329#define S5PC100_CLKGATE_SCLK1_SPDIF (1<<11) 328#define S5PC100_CLKGATE_SCLK1_SPDIF (1<<11)
330#define S5PC100_CLKGATE_SCLK1_CAM (1<<12) 329#define S5PC100_CLKGATE_SCLK1_CAM (1<<12)
331 330
332/* register for power management */ 331#define S5PC100_SWRESET S5PC100_CLKREG_OTHER(0x000)
333#define S5PC100_PWR_CFG S5PC1XX_CLKREG(0x8000) 332#define S5PC100_OND_SWRESET S5PC100_CLKREG_OTHER(0x008)
334#define S5PC100_EINT_WAKEUP_MASK S5PC1XX_CLKREG(0x8004) 333#define S5PC100_GEN_CTRL S5PC100_CLKREG_OTHER(0x100)
335#define S5PC100_NORMAL_CFG S5PC1XX_CLKREG(0x8010) 334#define S5PC100_GEN_STATUS S5PC100_CLKREG_OTHER(0x104)
336#define S5PC100_STOP_CFG S5PC1XX_CLKREG(0x8014) 335#define S5PC100_MEM_SYS_CFG S5PC100_CLKREG_OTHER(0x200)
337#define S5PC100_SLEEP_CFG S5PC1XX_CLKREG(0x8018) 336#define S5PC100_CAM_MUX_SEL S5PC100_CLKREG_OTHER(0x300)
338#define S5PC100_STOP_MEM_CFG S5PC1XX_CLKREG(0x801C) 337#define S5PC100_MIXER_OUT_SEL S5PC100_CLKREG_OTHER(0x304)
339#define S5PC100_OSC_FREQ S5PC1XX_CLKREG(0x8100) 338#define S5PC100_LPMP_MODE_SEL S5PC100_CLKREG_OTHER(0x308)
340#define S5PC100_OSC_STABLE S5PC1XX_CLKREG(0x8104) 339#define S5PC100_MIPI_PHY_CON0 S5PC100_CLKREG_OTHER(0x400)
341#define S5PC100_PWR_STABLE S5PC1XX_CLKREG(0x8108) 340#define S5PC100_MIPI_PHY_CON1 S5PC100_CLKREG_OTHER(0x414)
342#define S5PC100_MTC_STABLE S5PC1XX_CLKREG(0x8110) 341#define S5PC100_HDMI_PHY_CON0 S5PC100_CLKREG_OTHER(0x420)
343#define S5PC100_CLAMP_STABLE S5PC1XX_CLKREG(0x8114) 342
344#define S5PC100_OTHERS S5PC1XX_CLKREG(0x8200) 343#define S5PC100_SWRESET_RESETVAL 0xc100
345#define S5PC100_RST_STAT S5PC1XX_CLKREG(0x8300)
346#define S5PC100_WAKEUP_STAT S5PC1XX_CLKREG(0x8304)
347#define S5PC100_BLK_PWR_STAT S5PC1XX_CLKREG(0x8308)
348#define S5PC100_INFORM0 S5PC1XX_CLKREG(0x8400)
349#define S5PC100_INFORM1 S5PC1XX_CLKREG(0x8404)
350#define S5PC100_INFORM2 S5PC1XX_CLKREG(0x8408)
351#define S5PC100_INFORM3 S5PC1XX_CLKREG(0x840C)
352#define S5PC100_INFORM4 S5PC1XX_CLKREG(0x8410)
353#define S5PC100_INFORM5 S5PC1XX_CLKREG(0x8414)
354#define S5PC100_INFORM6 S5PC1XX_CLKREG(0x8418)
355#define S5PC100_INFORM7 S5PC1XX_CLKREG(0x841C)
356#define S5PC100_DCGIDX_MAP0 S5PC1XX_CLKREG(0x8500)
357#define S5PC100_DCGIDX_MAP1 S5PC1XX_CLKREG(0x8504)
358#define S5PC100_DCGIDX_MAP2 S5PC1XX_CLKREG(0x8508)
359#define S5PC100_DCGPERF_MAP0 S5PC1XX_CLKREG(0x850C)
360#define S5PC100_DCGPERF_MAP1 S5PC1XX_CLKREG(0x8510)
361#define S5PC100_DVCIDX_MAP S5PC1XX_CLKREG(0x8514)
362#define S5PC100_FREQ_CPU S5PC1XX_CLKREG(0x8518)
363#define S5PC100_FREQ_DPM S5PC1XX_CLKREG(0x851C)
364#define S5PC100_DVSEMCLK_EN S5PC1XX_CLKREG(0x8520)
365#define S5PC100_APLL_CON_L8 S5PC1XX_CLKREG(0x8600)
366#define S5PC100_APLL_CON_L7 S5PC1XX_CLKREG(0x8604)
367#define S5PC100_APLL_CON_L6 S5PC1XX_CLKREG(0x8608)
368#define S5PC100_APLL_CON_L5 S5PC1XX_CLKREG(0x860C)
369#define S5PC100_APLL_CON_L4 S5PC1XX_CLKREG(0x8610)
370#define S5PC100_APLL_CON_L3 S5PC1XX_CLKREG(0x8614)
371#define S5PC100_APLL_CON_L2 S5PC1XX_CLKREG(0x8618)
372#define S5PC100_APLL_CON_L1 S5PC1XX_CLKREG(0x861C)
373#define S5PC100_IEM_CONTROL S5PC1XX_CLKREG(0x8620)
374#define S5PC100_CLKDIV_IEM_L8 S5PC1XX_CLKREG(0x8700)
375#define S5PC100_CLKDIV_IEM_L7 S5PC1XX_CLKREG(0x8704)
376#define S5PC100_CLKDIV_IEM_L6 S5PC1XX_CLKREG(0x8708)
377#define S5PC100_CLKDIV_IEM_L5 S5PC1XX_CLKREG(0x870C)
378#define S5PC100_CLKDIV_IEM_L4 S5PC1XX_CLKREG(0x8710)
379#define S5PC100_CLKDIV_IEM_L3 S5PC1XX_CLKREG(0x8714)
380#define S5PC100_CLKDIV_IEM_L2 S5PC1XX_CLKREG(0x8718)
381#define S5PC100_CLKDIV_IEM_L1 S5PC1XX_CLKREG(0x871C)
382#define S5PC100_IEM_HPMCLK_DIV S5PC1XX_CLKREG(0x8724)
383
384#define S5PC100_SWRESET S5PC1XX_CLKREG(0x100000)
385#define S5PC100_OND_SWRESET S5PC1XX_CLKREG(0x100008)
386#define S5PC100_GEN_CTRL S5PC1XX_CLKREG(0x100100)
387#define S5PC100_GEN_STATUS S5PC1XX_CLKREG(0x100104)
388#define S5PC100_MEM_SYS_CFG S5PC1XX_CLKREG(0x100200)
389#define S5PC100_CAM_MUX_SEL S5PC1XX_CLKREG(0x100300)
390#define S5PC100_MIXER_OUT_SEL S5PC1XX_CLKREG(0x100304)
391#define S5PC100_LPMP_MODE_SEL S5PC1XX_CLKREG(0x100308)
392#define S5PC100_MIPI_PHY_CON0 S5PC1XX_CLKREG(0x100400)
393#define S5PC100_MIPI_PHY_CON1 S5PC1XX_CLKREG(0x100414)
394#define S5PC100_HDMI_PHY_CON0 S5PC1XX_CLKREG(0x100420)
395
396#define S5PC100_CFG_WFI_CLEAN (~(3<<5))
397#define S5PC100_CFG_WFI_IDLE (1<<5)
398#define S5PC100_CFG_WFI_STOP (2<<5)
399#define S5PC100_CFG_WFI_SLEEP (3<<5)
400
401#define S5PC100_OTHER_SYS_INT 24 344#define S5PC100_OTHER_SYS_INT 24
402#define S5PC100_OTHER_STA_TYPE 23 345#define S5PC100_OTHER_STA_TYPE 23
403#define STA_TYPE_EXPON 0 346#define STA_TYPE_EXPON 0
404#define STA_TYPE_SFR 1 347#define STA_TYPE_SFR 1
405 348
406#define S5PC100_PWR_STA_EXP_SCALE 0
407#define S5PC100_PWR_STA_CNT 4
408
409#define S5PC100_PWR_STABLE_COUNT 85500
410
411#define S5PC100_SLEEP_CFG_OSC_EN 0 349#define S5PC100_SLEEP_CFG_OSC_EN 0
412 350
413/* OTHERS Resgister */ 351/* OTHERS Resgister */
414#define S5PC100_OTHERS_USB_SIG_MASK (1 << 16) 352#define S5PC100_OTHERS_USB_SIG_MASK (1 << 16)
415#define S5PC100_OTHERS_MIPI_DPHY_EN (1 << 28) 353#define S5PC100_OTHERS_MIPI_DPHY_EN (1 << 28)
416 354
417/* MIPI D-PHY Control Register 0 */ 355/* MIPI D-PHY Control Register 0 */
diff --git a/arch/arm/plat-s5pc1xx/include/plat/regs-gpio.h b/arch/arm/plat-s5pc1xx/include/plat/regs-gpio.h
new file mode 100644
index 000000000000..43c7bc8bf784
--- /dev/null
+++ b/arch/arm/plat-s5pc1xx/include/plat/regs-gpio.h
@@ -0,0 +1,70 @@
1/* linux/arch/arm/plat-s5pc1xx/include/plat/regs-gpio.h
2 *
3 * Copyright 2009 Samsung Electronics Co.
4 * Byungho Min <bhmin@samsung.com>
5 *
6 * S5PC1XX - GPIO register definitions
7 */
8
9#ifndef __ASM_PLAT_S5PC1XX_REGS_GPIO_H
10#define __ASM_PLAT_S5PC1XX_REGS_GPIO_H __FILE__
11
12#include <mach/map.h>
13
14/* S5PC100 */
15#define S5PC100_GPIO_BASE S5PC1XX_VA_GPIO
16#define S5PC100_GPA0_BASE (S5PC100_GPIO_BASE + 0x0000)
17#define S5PC100_GPA1_BASE (S5PC100_GPIO_BASE + 0x0020)
18#define S5PC100_GPB_BASE (S5PC100_GPIO_BASE + 0x0040)
19#define S5PC100_GPC_BASE (S5PC100_GPIO_BASE + 0x0060)
20#define S5PC100_GPD_BASE (S5PC100_GPIO_BASE + 0x0080)
21#define S5PC100_GPE0_BASE (S5PC100_GPIO_BASE + 0x00A0)
22#define S5PC100_GPE1_BASE (S5PC100_GPIO_BASE + 0x00C0)
23#define S5PC100_GPF0_BASE (S5PC100_GPIO_BASE + 0x00E0)
24#define S5PC100_GPF1_BASE (S5PC100_GPIO_BASE + 0x0100)
25#define S5PC100_GPF2_BASE (S5PC100_GPIO_BASE + 0x0120)
26#define S5PC100_GPF3_BASE (S5PC100_GPIO_BASE + 0x0140)
27#define S5PC100_GPG0_BASE (S5PC100_GPIO_BASE + 0x0160)
28#define S5PC100_GPG1_BASE (S5PC100_GPIO_BASE + 0x0180)
29#define S5PC100_GPG2_BASE (S5PC100_GPIO_BASE + 0x01A0)
30#define S5PC100_GPG3_BASE (S5PC100_GPIO_BASE + 0x01C0)
31#define S5PC100_GPH0_BASE (S5PC100_GPIO_BASE + 0x0C00)
32#define S5PC100_GPH1_BASE (S5PC100_GPIO_BASE + 0x0C20)
33#define S5PC100_GPH2_BASE (S5PC100_GPIO_BASE + 0x0C40)
34#define S5PC100_GPH3_BASE (S5PC100_GPIO_BASE + 0x0C60)
35#define S5PC100_GPI_BASE (S5PC100_GPIO_BASE + 0x01E0)
36#define S5PC100_GPJ0_BASE (S5PC100_GPIO_BASE + 0x0200)
37#define S5PC100_GPJ1_BASE (S5PC100_GPIO_BASE + 0x0220)
38#define S5PC100_GPJ2_BASE (S5PC100_GPIO_BASE + 0x0240)
39#define S5PC100_GPJ3_BASE (S5PC100_GPIO_BASE + 0x0260)
40#define S5PC100_GPJ4_BASE (S5PC100_GPIO_BASE + 0x0280)
41#define S5PC100_GPK0_BASE (S5PC100_GPIO_BASE + 0x02A0)
42#define S5PC100_GPK1_BASE (S5PC100_GPIO_BASE + 0x02C0)
43#define S5PC100_GPK2_BASE (S5PC100_GPIO_BASE + 0x02E0)
44#define S5PC100_GPK3_BASE (S5PC100_GPIO_BASE + 0x0300)
45#define S5PC100_GPL0_BASE (S5PC100_GPIO_BASE + 0x0320)
46#define S5PC100_GPL1_BASE (S5PC100_GPIO_BASE + 0x0340)
47#define S5PC100_GPL2_BASE (S5PC100_GPIO_BASE + 0x0360)
48#define S5PC100_GPL3_BASE (S5PC100_GPIO_BASE + 0x0380)
49#define S5PC100_GPL4_BASE (S5PC100_GPIO_BASE + 0x03A0)
50#define S5PC100_EINT_BASE (S5PC100_GPIO_BASE + 0x0E00)
51
52#define S5PC100_UHOST (S5PC100_GPIO_BASE + 0x0B68)
53#define S5PC100_PDNEN (S5PC100_GPIO_BASE + 0x0F80)
54
55/* PDNEN */
56#define S5PC100_PDNEN_CFG_PDNEN (1 << 1)
57#define S5PC100_PDNEN_CFG_AUTO (0 << 1)
58#define S5PC100_PDNEN_POWERDOWN (1 << 0)
59#define S5PC100_PDNEN_NORMAL (0 << 0)
60
61/* Common part */
62/* External interrupt base is same at both s5pc100 and s5pc110 */
63#define S5PC1XX_EINT_BASE (S5PC100_EINT_BASE)
64
65#define S5PC100_GPx_INPUT(__gpio) (0x0 << ((__gpio) * 4))
66#define S5PC100_GPx_OUTPUT(__gpio) (0x1 << ((__gpio) * 4))
67#define S5PC100_GPx_CONMASK(__gpio) (0xf << ((__gpio) * 4))
68
69#endif /* __ASM_PLAT_S5PC1XX_REGS_GPIO_H */
70
diff --git a/arch/arm/plat-s5pc1xx/include/plat/regs-power.h b/arch/arm/plat-s5pc1xx/include/plat/regs-power.h
new file mode 100644
index 000000000000..02ffa491b53a
--- /dev/null
+++ b/arch/arm/plat-s5pc1xx/include/plat/regs-power.h
@@ -0,0 +1,84 @@
1/* arch/arm/plat-s5pc1xx/include/plat/regs-clock.h
2 *
3 * Copyright 2009 Samsung Electronics Co.
4 * Jongse Won <jongse.won@samsung.com>
5 *
6 * S5PC1XX clock register definitions
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_ARM_REGS_PWR
14#define __ASM_ARM_REGS_PWR __FILE__
15
16#define S5PC1XX_PWRREG(x) (S5PC1XX_VA_PWR + (x))
17
18/* s5pc100 (0xE0108000) register for power management */
19#define S5PC100_PWR_CFG S5PC1XX_PWRREG(0x0)
20#define S5PC100_EINT_WAKEUP_MASK S5PC1XX_PWRREG(0x4)
21#define S5PC100_NORMAL_CFG S5PC1XX_PWRREG(0x10)
22#define S5PC100_STOP_CFG S5PC1XX_PWRREG(0x14)
23#define S5PC100_SLEEP_CFG S5PC1XX_PWRREG(0x18)
24#define S5PC100_STOP_MEM_CFG S5PC1XX_PWRREG(0x1C)
25#define S5PC100_OSC_FREQ S5PC1XX_PWRREG(0x100)
26#define S5PC100_OSC_STABLE S5PC1XX_PWRREG(0x104)
27#define S5PC100_PWR_STABLE S5PC1XX_PWRREG(0x108)
28#define S5PC100_MTC_STABLE S5PC1XX_PWRREG(0x110)
29#define S5PC100_CLAMP_STABLE S5PC1XX_PWRREG(0x114)
30#define S5PC100_OTHERS S5PC1XX_PWRREG(0x200)
31#define S5PC100_RST_STAT S5PC1XX_PWRREG(0x300)
32#define S5PC100_WAKEUP_STAT S5PC1XX_PWRREG(0x304)
33#define S5PC100_BLK_PWR_STAT S5PC1XX_PWRREG(0x308)
34#define S5PC100_INFORM0 S5PC1XX_PWRREG(0x400)
35#define S5PC100_INFORM1 S5PC1XX_PWRREG(0x404)
36#define S5PC100_INFORM2 S5PC1XX_PWRREG(0x408)
37#define S5PC100_INFORM3 S5PC1XX_PWRREG(0x40C)
38#define S5PC100_INFORM4 S5PC1XX_PWRREG(0x410)
39#define S5PC100_INFORM5 S5PC1XX_PWRREG(0x414)
40#define S5PC100_INFORM6 S5PC1XX_PWRREG(0x418)
41#define S5PC100_INFORM7 S5PC1XX_PWRREG(0x41C)
42#define S5PC100_DCGIDX_MAP0 S5PC1XX_PWRREG(0x500)
43#define S5PC100_DCGIDX_MAP1 S5PC1XX_PWRREG(0x504)
44#define S5PC100_DCGIDX_MAP2 S5PC1XX_PWRREG(0x508)
45#define S5PC100_DCGPERF_MAP0 S5PC1XX_PWRREG(0x50C)
46#define S5PC100_DCGPERF_MAP1 S5PC1XX_PWRREG(0x510)
47#define S5PC100_DVCIDX_MAP S5PC1XX_PWRREG(0x514)
48#define S5PC100_FREQ_CPU S5PC1XX_PWRREG(0x518)
49#define S5PC100_FREQ_DPM S5PC1XX_PWRREG(0x51C)
50#define S5PC100_DVSEMCLK_EN S5PC1XX_PWRREG(0x520)
51#define S5PC100_APLL_CON_L8 S5PC1XX_PWRREG(0x600)
52#define S5PC100_APLL_CON_L7 S5PC1XX_PWRREG(0x604)
53#define S5PC100_APLL_CON_L6 S5PC1XX_PWRREG(0x608)
54#define S5PC100_APLL_CON_L5 S5PC1XX_PWRREG(0x60C)
55#define S5PC100_APLL_CON_L4 S5PC1XX_PWRREG(0x610)
56#define S5PC100_APLL_CON_L3 S5PC1XX_PWRREG(0x614)
57#define S5PC100_APLL_CON_L2 S5PC1XX_PWRREG(0x618)
58#define S5PC100_APLL_CON_L1 S5PC1XX_PWRREG(0x61C)
59#define S5PC100_IEM_CONTROL S5PC1XX_PWRREG(0x620)
60#define S5PC100_CLKDIV_IEM_L8 S5PC1XX_PWRREG(0x700)
61#define S5PC100_CLKDIV_IEM_L7 S5PC1XX_PWRREG(0x704)
62#define S5PC100_CLKDIV_IEM_L6 S5PC1XX_PWRREG(0x708)
63#define S5PC100_CLKDIV_IEM_L5 S5PC1XX_PWRREG(0x70C)
64#define S5PC100_CLKDIV_IEM_L4 S5PC1XX_PWRREG(0x710)
65#define S5PC100_CLKDIV_IEM_L3 S5PC1XX_PWRREG(0x714)
66#define S5PC100_CLKDIV_IEM_L2 S5PC1XX_PWRREG(0x718)
67#define S5PC100_CLKDIV_IEM_L1 S5PC1XX_PWRREG(0x71C)
68#define S5PC100_IEM_HPMCLK_DIV S5PC1XX_PWRREG(0x724)
69
70/* PWR_CFG */
71#define S5PC100_PWRCFG_CFG_DEEP_IDLE (1 << 31)
72#define S5PC100_PWRCFG_CFG_WFI_MASK (3 << 5)
73#define S5PC100_PWRCFG_CFG_WFI_IDLE (0 << 5)
74#define S5PC100_PWRCFG_CFG_WFI_DEEP_IDLE (1 << 5)
75#define S5PC100_PWRCFG_CFG_WFI_STOP (2 << 5)
76#define S5PC100_PWRCFG_CFG_WFI_SLEEP (3 << 5)
77
78/* SLEEP_CFG */
79#define S5PC100_SLEEP_OSC_EN_SLEEP (1 << 0)
80
81/* OTHERS */
82#define S5PC100_PMU_INT_DISABLE (1 << 24)
83
84#endif /* __ASM_ARM_REGS_PWR */
diff --git a/arch/arm/plat-s5pc1xx/include/plat/s5pc100.h b/arch/arm/plat-s5pc1xx/include/plat/s5pc100.h
index 45e275131665..2531f34a56f3 100644
--- a/arch/arm/plat-s5pc1xx/include/plat/s5pc100.h
+++ b/arch/arm/plat-s5pc1xx/include/plat/s5pc100.h
@@ -35,10 +35,9 @@ extern struct clk clk_hpll;
35extern struct clk clk_hd0; 35extern struct clk clk_hd0;
36extern struct clk clk_pd0; 36extern struct clk clk_pd0;
37extern struct clk clk_54m; 37extern struct clk clk_54m;
38extern struct clk clk_dout_mpll2;
39extern void s5pc1xx_register_clocks(void); 38extern void s5pc1xx_register_clocks(void);
40extern int s5pc1xx_sclk0_ctrl(struct clk *clk, int enable); 39extern int s5pc100_sclk0_ctrl(struct clk *clk, int enable);
41extern int s5pc1xx_sclk1_ctrl(struct clk *clk, int enable); 40extern int s5pc100_sclk1_ctrl(struct clk *clk, int enable);
42 41
43/* Some day, belows will be moved to plat-s5pc/include/plat/devs.h */ 42/* Some day, belows will be moved to plat-s5pc/include/plat/devs.h */
44extern struct s3c24xx_uart_resources s5pc1xx_uart_resources[]; 43extern struct s3c24xx_uart_resources s5pc1xx_uart_resources[];
diff --git a/arch/arm/plat-s5pc1xx/irq-eint.c b/arch/arm/plat-s5pc1xx/irq-eint.c
new file mode 100644
index 000000000000..373122f57d56
--- /dev/null
+++ b/arch/arm/plat-s5pc1xx/irq-eint.c
@@ -0,0 +1,281 @@
1/*
2 * linux/arch/arm/plat-s5pc1xx/irq-eint.c
3 *
4 * Copyright 2009 Samsung Electronics Co.
5 * Byungho Min <bhmin@samsung.com>
6 * Kyungin Park <kyungmin.park@samsung.com>
7 *
8 * Based on plat-s3c64xx/irq-eint.c
9 *
10 * S5PC1XX - Interrupt handling for IRQ_EINT(x)
11 *
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License version 2 as
14 * published by the Free Software Foundation.
15 */
16
17#include <linux/kernel.h>
18#include <linux/interrupt.h>
19#include <linux/irq.h>
20#include <linux/io.h>
21#include <linux/sysdev.h>
22#include <linux/pm.h>
23#include <linux/gpio.h>
24
25#include <asm/hardware/vic.h>
26
27#include <mach/map.h>
28
29#include <plat/gpio-cfg.h>
30#include <plat/gpio-ext.h>
31#include <plat/pm.h>
32#include <plat/regs-gpio.h>
33#include <plat/regs-irqtype.h>
34
35/*
36 * bank is a group of external interrupt
37 * bank0 means EINT0 ... EINT7
38 * bank1 means EINT8 ... EINT15
39 * bank2 means EINT16 ... EINT23
40 * bank3 means EINT24 ... EINT31
41 */
42
43static inline int s3c_get_eint(unsigned int irq)
44{
45 int real;
46
47 if (irq < IRQ_EINT16_31)
48 real = (irq - IRQ_EINT0);
49 else
50 real = (irq - S3C_IRQ_EINT_BASE) + IRQ_EINT16_31 - IRQ_EINT0;
51
52 return real;
53}
54
55static inline int s3c_get_bank(unsigned int irq)
56{
57 return s3c_get_eint(irq) >> 3;
58}
59
60static inline int s3c_eint_to_bit(unsigned int irq)
61{
62 int real, bit;
63
64 real = s3c_get_eint(irq);
65 bit = 1 << (real & (8 - 1));
66
67 return bit;
68}
69
70static inline void s3c_irq_eint_mask(unsigned int irq)
71{
72 u32 mask;
73 u32 bank = s3c_get_bank(irq);
74
75 mask = __raw_readl(S5PC1XX_WKUP_INT_MASK(bank));
76 mask |= s3c_eint_to_bit(irq);
77 __raw_writel(mask, S5PC1XX_WKUP_INT_MASK(bank));
78}
79
80static void s3c_irq_eint_unmask(unsigned int irq)
81{
82 u32 mask;
83 u32 bank = s3c_get_bank(irq);
84
85 mask = __raw_readl(S5PC1XX_WKUP_INT_MASK(bank));
86 mask &= ~(s3c_eint_to_bit(irq));
87 __raw_writel(mask, S5PC1XX_WKUP_INT_MASK(bank));
88}
89
90static inline void s3c_irq_eint_ack(unsigned int irq)
91{
92 u32 bank = s3c_get_bank(irq);
93
94 __raw_writel(s3c_eint_to_bit(irq), S5PC1XX_WKUP_INT_PEND(bank));
95}
96
97static void s3c_irq_eint_maskack(unsigned int irq)
98{
99 /* compiler should in-line these */
100 s3c_irq_eint_mask(irq);
101 s3c_irq_eint_ack(irq);
102}
103
104static int s3c_irq_eint_set_type(unsigned int irq, unsigned int type)
105{
106 u32 bank = s3c_get_bank(irq);
107 int real = s3c_get_eint(irq);
108 int gpio, shift, sfn;
109 u32 ctrl, con = 0;
110
111 switch (type) {
112 case IRQ_TYPE_NONE:
113 printk(KERN_WARNING "No edge setting!\n");
114 break;
115
116 case IRQ_TYPE_EDGE_RISING:
117 con = S5PC1XX_WKUP_INT_RISEEDGE;
118 break;
119
120 case IRQ_TYPE_EDGE_FALLING:
121 con = S5PC1XX_WKUP_INT_FALLEDGE;
122 break;
123
124 case IRQ_TYPE_EDGE_BOTH:
125 con = S5PC1XX_WKUP_INT_BOTHEDGE;
126 break;
127
128 case IRQ_TYPE_LEVEL_LOW:
129 con = S5PC1XX_WKUP_INT_LOWLEV;
130 break;
131
132 case IRQ_TYPE_LEVEL_HIGH:
133 con = S5PC1XX_WKUP_INT_HILEV;
134 break;
135
136 default:
137 printk(KERN_ERR "No such irq type %d", type);
138 return -EINVAL;
139 }
140
141 gpio = real & (8 - 1);
142 shift = gpio << 2;
143
144 ctrl = __raw_readl(S5PC1XX_WKUP_INT_CON(bank));
145 ctrl &= ~(0x7 << shift);
146 ctrl |= con << shift;
147 __raw_writel(ctrl, S5PC1XX_WKUP_INT_CON(bank));
148
149 switch (real) {
150 case 0 ... 7:
151 gpio = S5PC100_GPH0(gpio);
152 break;
153 case 8 ... 15:
154 gpio = S5PC100_GPH1(gpio);
155 break;
156 case 16 ... 23:
157 gpio = S5PC100_GPH2(gpio);
158 break;
159 case 24 ... 31:
160 gpio = S5PC100_GPH3(gpio);
161 break;
162 default:
163 return -EINVAL;
164 }
165
166 sfn = S3C_GPIO_SFN(0x2);
167 s3c_gpio_cfgpin(gpio, sfn);
168
169 return 0;
170}
171
172static struct irq_chip s3c_irq_eint = {
173 .name = "EINT",
174 .mask = s3c_irq_eint_mask,
175 .unmask = s3c_irq_eint_unmask,
176 .mask_ack = s3c_irq_eint_maskack,
177 .ack = s3c_irq_eint_ack,
178 .set_type = s3c_irq_eint_set_type,
179 .set_wake = s3c_irqext_wake,
180};
181
182/* s3c_irq_demux_eint
183 *
184 * This function demuxes the IRQ from external interrupts,
185 * from IRQ_EINT(16) to IRQ_EINT(31). It is designed to be inlined into
186 * the specific handlers s3c_irq_demux_eintX_Y.
187 */
188static inline void s3c_irq_demux_eint(unsigned int start, unsigned int end)
189{
190 u32 status = __raw_readl(S5PC1XX_WKUP_INT_PEND((start >> 3)));
191 u32 mask = __raw_readl(S5PC1XX_WKUP_INT_MASK((start >> 3)));
192 unsigned int irq;
193
194 status &= ~mask;
195 status &= (1 << (end - start + 1)) - 1;
196
197 for (irq = IRQ_EINT(start); irq <= IRQ_EINT(end); irq++) {
198 if (status & 1)
199 generic_handle_irq(irq);
200
201 status >>= 1;
202 }
203}
204
205static void s3c_irq_demux_eint16_31(unsigned int irq, struct irq_desc *desc)
206{
207 s3c_irq_demux_eint(16, 23);
208 s3c_irq_demux_eint(24, 31);
209}
210
211/*
212 * Handle EINT0 ... EINT15 at VIC directly
213 */
214static void s3c_irq_vic_eint_mask(unsigned int irq)
215{
216 void __iomem *base = get_irq_chip_data(irq);
217 unsigned int real;
218
219 s3c_irq_eint_mask(irq);
220 real = s3c_get_eint(irq);
221 writel(1 << real, base + VIC_INT_ENABLE_CLEAR);
222}
223
224static void s3c_irq_vic_eint_unmask(unsigned int irq)
225{
226 void __iomem *base = get_irq_chip_data(irq);
227 unsigned int real;
228
229 s3c_irq_eint_unmask(irq);
230 real = s3c_get_eint(irq);
231 writel(1 << real, base + VIC_INT_ENABLE);
232}
233
234static inline void s3c_irq_vic_eint_ack(unsigned int irq)
235{
236 u32 bit;
237 u32 bank = s3c_get_bank(irq);
238
239 bit = s3c_eint_to_bit(irq);
240 __raw_writel(bit, S5PC1XX_WKUP_INT_PEND(bank));
241}
242
243static void s3c_irq_vic_eint_maskack(unsigned int irq)
244{
245 /* compiler should in-line these */
246 s3c_irq_vic_eint_mask(irq);
247 s3c_irq_vic_eint_ack(irq);
248}
249
250static struct irq_chip s3c_irq_vic_eint = {
251 .name = "EINT",
252 .mask = s3c_irq_vic_eint_mask,
253 .unmask = s3c_irq_vic_eint_unmask,
254 .mask_ack = s3c_irq_vic_eint_maskack,
255 .ack = s3c_irq_vic_eint_ack,
256 .set_type = s3c_irq_eint_set_type,
257 .set_wake = s3c_irqext_wake,
258};
259
260static int __init s5pc1xx_init_irq_eint(void)
261{
262 int irq;
263
264 for (irq = IRQ_EINT0; irq <= IRQ_EINT15; irq++) {
265 set_irq_chip(irq, &s3c_irq_vic_eint);
266 set_irq_handler(irq, handle_level_irq);
267 set_irq_flags(irq, IRQF_VALID);
268 }
269
270 for (irq = IRQ_EINT(16); irq <= IRQ_EINT(31); irq++) {
271 set_irq_chip(irq, &s3c_irq_eint);
272 set_irq_handler(irq, handle_level_irq);
273 set_irq_flags(irq, IRQF_VALID);
274 }
275
276 set_irq_chained_handler(IRQ_EINT16_31, s3c_irq_demux_eint16_31);
277
278 return 0;
279}
280
281arch_initcall(s5pc1xx_init_irq_eint);
diff --git a/arch/arm/plat-s5pc1xx/irq-gpio.c b/arch/arm/plat-s5pc1xx/irq-gpio.c
new file mode 100644
index 000000000000..fecca7a679b0
--- /dev/null
+++ b/arch/arm/plat-s5pc1xx/irq-gpio.c
@@ -0,0 +1,266 @@
1/*
2 * arch/arm/plat-s5pc1xx/irq-gpio.c
3 *
4 * Copyright (C) 2009 Samsung Electronics
5 *
6 * S5PC1XX - Interrupt handling for IRQ_GPIO${group}(x)
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/kernel.h>
14#include <linux/interrupt.h>
15#include <linux/irq.h>
16#include <linux/io.h>
17#include <linux/gpio.h>
18
19#include <mach/map.h>
20#include <plat/gpio-cfg.h>
21
22#define S5PC1XX_GPIOREG(x) (S5PC1XX_VA_GPIO + (x))
23
24#define CON_OFFSET 0x700
25#define MASK_OFFSET 0x900
26#define PEND_OFFSET 0xA00
27#define CON_OFFSET_2 0xE00
28#define MASK_OFFSET_2 0xF00
29#define PEND_OFFSET_2 0xF40
30
31#define GPIOINT_LEVEL_LOW 0x0
32#define GPIOINT_LEVEL_HIGH 0x1
33#define GPIOINT_EDGE_FALLING 0x2
34#define GPIOINT_EDGE_RISING 0x3
35#define GPIOINT_EDGE_BOTH 0x4
36
37static int group_to_con_offset(int group)
38{
39 return group << 2;
40}
41
42static int group_to_mask_offset(int group)
43{
44 return group << 2;
45}
46
47static int group_to_pend_offset(int group)
48{
49 return group << 2;
50}
51
52static int s5pc1xx_get_start(unsigned int group)
53{
54 switch (group) {
55 case 0: return S5PC100_GPIO_A0_START;
56 case 1: return S5PC100_GPIO_A1_START;
57 case 2: return S5PC100_GPIO_B_START;
58 case 3: return S5PC100_GPIO_C_START;
59 case 4: return S5PC100_GPIO_D_START;
60 case 5: return S5PC100_GPIO_E0_START;
61 case 6: return S5PC100_GPIO_E1_START;
62 case 7: return S5PC100_GPIO_F0_START;
63 case 8: return S5PC100_GPIO_F1_START;
64 case 9: return S5PC100_GPIO_F2_START;
65 case 10: return S5PC100_GPIO_F3_START;
66 case 11: return S5PC100_GPIO_G0_START;
67 case 12: return S5PC100_GPIO_G1_START;
68 case 13: return S5PC100_GPIO_G2_START;
69 case 14: return S5PC100_GPIO_G3_START;
70 case 15: return S5PC100_GPIO_I_START;
71 case 16: return S5PC100_GPIO_J0_START;
72 case 17: return S5PC100_GPIO_J1_START;
73 case 18: return S5PC100_GPIO_J2_START;
74 case 19: return S5PC100_GPIO_J3_START;
75 case 20: return S5PC100_GPIO_J4_START;
76 default:
77 BUG();
78 }
79
80 return -EINVAL;
81}
82
83static int s5pc1xx_get_group(unsigned int irq)
84{
85 irq -= S3C_IRQ_GPIO(0);
86
87 switch (irq) {
88 case S5PC100_GPIO_A0_START ... S5PC100_GPIO_A1_START - 1:
89 return 0;
90 case S5PC100_GPIO_A1_START ... S5PC100_GPIO_B_START - 1:
91 return 1;
92 case S5PC100_GPIO_B_START ... S5PC100_GPIO_C_START - 1:
93 return 2;
94 case S5PC100_GPIO_C_START ... S5PC100_GPIO_D_START - 1:
95 return 3;
96 case S5PC100_GPIO_D_START ... S5PC100_GPIO_E0_START - 1:
97 return 4;
98 case S5PC100_GPIO_E0_START ... S5PC100_GPIO_E1_START - 1:
99 return 5;
100 case S5PC100_GPIO_E1_START ... S5PC100_GPIO_F0_START - 1:
101 return 6;
102 case S5PC100_GPIO_F0_START ... S5PC100_GPIO_F1_START - 1:
103 return 7;
104 case S5PC100_GPIO_F1_START ... S5PC100_GPIO_F2_START - 1:
105 return 8;
106 case S5PC100_GPIO_F2_START ... S5PC100_GPIO_F3_START - 1:
107 return 9;
108 case S5PC100_GPIO_F3_START ... S5PC100_GPIO_G0_START - 1:
109 return 10;
110 case S5PC100_GPIO_G0_START ... S5PC100_GPIO_G1_START - 1:
111 return 11;
112 case S5PC100_GPIO_G1_START ... S5PC100_GPIO_G2_START - 1:
113 return 12;
114 case S5PC100_GPIO_G2_START ... S5PC100_GPIO_G3_START - 1:
115 return 13;
116 case S5PC100_GPIO_G3_START ... S5PC100_GPIO_H0_START - 1:
117 return 14;
118 case S5PC100_GPIO_I_START ... S5PC100_GPIO_J0_START - 1:
119 return 15;
120 case S5PC100_GPIO_J0_START ... S5PC100_GPIO_J1_START - 1:
121 return 16;
122 case S5PC100_GPIO_J1_START ... S5PC100_GPIO_J2_START - 1:
123 return 17;
124 case S5PC100_GPIO_J2_START ... S5PC100_GPIO_J3_START - 1:
125 return 18;
126 case S5PC100_GPIO_J3_START ... S5PC100_GPIO_J4_START - 1:
127 return 19;
128 case S5PC100_GPIO_J4_START ... S5PC100_GPIO_K0_START - 1:
129 return 20;
130 default:
131 BUG();
132 }
133
134 return -EINVAL;
135}
136
137static int s5pc1xx_get_offset(unsigned int irq)
138{
139 struct gpio_chip *chip = get_irq_data(irq);
140 return irq - S3C_IRQ_GPIO(chip->base);
141}
142
143static void s5pc1xx_gpioint_ack(unsigned int irq)
144{
145 int group, offset, pend_offset;
146 unsigned int value;
147
148 group = s5pc1xx_get_group(irq);
149 offset = s5pc1xx_get_offset(irq);
150 pend_offset = group_to_pend_offset(group);
151
152 value = __raw_readl(S5PC1XX_GPIOREG(PEND_OFFSET) + pend_offset);
153 value |= 1 << offset;
154 __raw_writel(value, S5PC1XX_GPIOREG(PEND_OFFSET) + pend_offset);
155}
156
157static void s5pc1xx_gpioint_mask(unsigned int irq)
158{
159 int group, offset, mask_offset;
160 unsigned int value;
161
162 group = s5pc1xx_get_group(irq);
163 offset = s5pc1xx_get_offset(irq);
164 mask_offset = group_to_mask_offset(group);
165
166 value = __raw_readl(S5PC1XX_GPIOREG(MASK_OFFSET) + mask_offset);
167 value |= 1 << offset;
168 __raw_writel(value, S5PC1XX_GPIOREG(MASK_OFFSET) + mask_offset);
169}
170
171static void s5pc1xx_gpioint_unmask(unsigned int irq)
172{
173 int group, offset, mask_offset;
174 unsigned int value;
175
176 group = s5pc1xx_get_group(irq);
177 offset = s5pc1xx_get_offset(irq);
178 mask_offset = group_to_mask_offset(group);
179
180 value = __raw_readl(S5PC1XX_GPIOREG(MASK_OFFSET) + mask_offset);
181 value &= ~(1 << offset);
182 __raw_writel(value, S5PC1XX_GPIOREG(MASK_OFFSET) + mask_offset);
183}
184
185static void s5pc1xx_gpioint_mask_ack(unsigned int irq)
186{
187 s5pc1xx_gpioint_mask(irq);
188 s5pc1xx_gpioint_ack(irq);
189}
190
191static int s5pc1xx_gpioint_set_type(unsigned int irq, unsigned int type)
192{
193 int group, offset, con_offset;
194 unsigned int value;
195
196 group = s5pc1xx_get_group(irq);
197 offset = s5pc1xx_get_offset(irq);
198 con_offset = group_to_con_offset(group);
199
200 switch (type) {
201 case IRQ_TYPE_NONE:
202 printk(KERN_WARNING "No irq type\n");
203 return -EINVAL;
204 case IRQ_TYPE_EDGE_RISING:
205 type = GPIOINT_EDGE_RISING;
206 break;
207 case IRQ_TYPE_EDGE_FALLING:
208 type = GPIOINT_EDGE_FALLING;
209 break;
210 case IRQ_TYPE_EDGE_BOTH:
211 type = GPIOINT_EDGE_BOTH;
212 break;
213 case IRQ_TYPE_LEVEL_HIGH:
214 type = GPIOINT_LEVEL_HIGH;
215 break;
216 case IRQ_TYPE_LEVEL_LOW:
217 type = GPIOINT_LEVEL_LOW;
218 break;
219 default:
220 BUG();
221 }
222
223
224 value = __raw_readl(S5PC1XX_GPIOREG(CON_OFFSET) + con_offset);
225 value &= ~(0xf << (offset * 0x4));
226 value |= (type << (offset * 0x4));
227 __raw_writel(value, S5PC1XX_GPIOREG(CON_OFFSET) + con_offset);
228
229 return 0;
230}
231
232struct irq_chip s5pc1xx_gpioint = {
233 .name = "GPIO",
234 .ack = s5pc1xx_gpioint_ack,
235 .mask = s5pc1xx_gpioint_mask,
236 .mask_ack = s5pc1xx_gpioint_mask_ack,
237 .unmask = s5pc1xx_gpioint_unmask,
238 .set_type = s5pc1xx_gpioint_set_type,
239};
240
241void s5pc1xx_irq_gpioint_handler(unsigned int irq, struct irq_desc *desc)
242{
243 int group, offset, pend_offset, mask_offset;
244 int real_irq, group_end;
245 unsigned int pend, mask;
246
247 group_end = 21;
248
249 for (group = 0; group < group_end; group++) {
250 pend_offset = group_to_pend_offset(group);
251 pend = __raw_readl(S5PC1XX_GPIOREG(PEND_OFFSET) + pend_offset);
252 if (!pend)
253 continue;
254
255 mask_offset = group_to_mask_offset(group);
256 mask = __raw_readl(S5PC1XX_GPIOREG(MASK_OFFSET) + mask_offset);
257 pend &= ~mask;
258
259 for (offset = 0; offset < 8; offset++) {
260 if (pend & (1 << offset)) {
261 real_irq = s5pc1xx_get_start(group) + offset;
262 generic_handle_irq(S3C_IRQ_GPIO(real_irq));
263 }
264 }
265 }
266}
diff --git a/arch/arm/plat-s5pc1xx/irq.c b/arch/arm/plat-s5pc1xx/irq.c
index 80d6dd942cb8..e44fd04ef333 100644
--- a/arch/arm/plat-s5pc1xx/irq.c
+++ b/arch/arm/plat-s5pc1xx/irq.c
@@ -79,7 +79,7 @@ static void s3c_irq_timer_ack(unsigned int irq)
79{ 79{
80 u32 reg = __raw_readl(S3C64XX_TINT_CSTAT); 80 u32 reg = __raw_readl(S3C64XX_TINT_CSTAT);
81 81
82 reg &= 0x1f; 82 reg &= 0x1f; /* mask out pending interrupts */
83 reg |= (1 << 5) << (irq - IRQ_TIMER0); 83 reg |= (1 << 5) << (irq - IRQ_TIMER0);
84 __raw_writel(reg, S3C64XX_TINT_CSTAT); 84 __raw_writel(reg, S3C64XX_TINT_CSTAT);
85} 85}
diff --git a/arch/arm/plat-s5pc1xx/s5pc100-clock.c b/arch/arm/plat-s5pc1xx/s5pc100-clock.c
index 6b24035172fa..b436d44510c8 100644
--- a/arch/arm/plat-s5pc1xx/s5pc100-clock.c
+++ b/arch/arm/plat-s5pc1xx/s5pc100-clock.c
@@ -49,6 +49,7 @@ static struct clk clk_ext_xtal_mux = {
49#define clk_fin_hpll clk_ext_xtal_mux 49#define clk_fin_hpll clk_ext_xtal_mux
50 50
51#define clk_fout_mpll clk_mpll 51#define clk_fout_mpll clk_mpll
52#define clk_vclk_54m clk_54m
52 53
53struct clk_sources { 54struct clk_sources {
54 unsigned int nr_sources; 55 unsigned int nr_sources;
@@ -67,746 +68,327 @@ struct clksrc_clk {
67 void __iomem *reg_source; 68 void __iomem *reg_source;
68}; 69};
69 70
70static int clk_default_setrate(struct clk *clk, unsigned long rate) 71/* APLL */
71{ 72static struct clk clk_fout_apll = {
72 clk->rate = rate; 73 .name = "fout_apll",
73 return 1;
74}
75
76struct clk clk_27m = {
77 .name = "clk_27m",
78 .id = -1, 74 .id = -1,
79 .rate = 27000000, 75 .rate = 27000000,
80}; 76};
81 77
82static int clk_48m_ctrl(struct clk *clk, int enable) 78static struct clk *clk_src_apll_list[] = {
83{ 79 [0] = &clk_fin_apll,
84 unsigned long flags; 80 [1] = &clk_fout_apll,
85 u32 val; 81};
82
83static struct clk_sources clk_src_apll = {
84 .sources = clk_src_apll_list,
85 .nr_sources = ARRAY_SIZE(clk_src_apll_list),
86};
86 87
87 /* can't rely on clock lock, this register has other usages */ 88static struct clksrc_clk clk_mout_apll = {
88 local_irq_save(flags); 89 .clk = {
90 .name = "mout_apll",
91 .id = -1,
92 },
93 .shift = S5PC100_CLKSRC0_APLL_SHIFT,
94 .mask = S5PC100_CLKSRC0_APLL_MASK,
95 .sources = &clk_src_apll,
96 .reg_source = S5PC100_CLKSRC0,
97};
89 98
90 val = __raw_readl(S5PC1XX_CLK_SRC1); 99static unsigned long s5pc100_clk_dout_apll_get_rate(struct clk *clk)
91 if (enable) 100{
92 val |= S5PC100_CLKSRC1_CLK48M_MASK; 101 unsigned long rate = clk_get_rate(clk->parent);
93 else 102 unsigned int ratio;
94 val &= ~S5PC100_CLKSRC1_CLK48M_MASK;
95 103
96 __raw_writel(val, S5PC1XX_CLK_SRC1); 104 ratio = __raw_readl(S5PC100_CLKDIV0) & S5PC100_CLKDIV0_APLL_MASK;
97 local_irq_restore(flags); 105 ratio >>= S5PC100_CLKDIV0_APLL_SHIFT;
98 106
99 return 0; 107 return rate / (ratio + 1);
100} 108}
101 109
102struct clk clk_48m = { 110static struct clk clk_dout_apll = {
103 .name = "clk_48m", 111 .name = "dout_apll",
104 .id = -1, 112 .id = -1,
105 .rate = 48000000, 113 .parent = &clk_mout_apll.clk,
106 .enable = clk_48m_ctrl, 114 .get_rate = s5pc100_clk_dout_apll_get_rate,
107}; 115};
108 116
109struct clk clk_54m = { 117static unsigned long s5pc100_clk_arm_get_rate(struct clk *clk)
110 .name = "clk_54m", 118{
111 .id = -1, 119 unsigned long rate = clk_get_rate(clk->parent);
112 .rate = 54000000, 120 unsigned int ratio;
113};
114
115struct clk clk_hpll = {
116 .name = "hpll",
117 .id = -1,
118};
119 121
120struct clk clk_hd0 = { 122 ratio = __raw_readl(S5PC100_CLKDIV0) & S5PC100_CLKDIV0_ARM_MASK;
121 .name = "hclkd0", 123 ratio >>= S5PC100_CLKDIV0_ARM_SHIFT;
122 .id = -1,
123 .rate = 0,
124 .parent = NULL,
125 .ctrlbit = 0,
126 .set_rate = clk_default_setrate,
127};
128 124
129struct clk clk_pd0 = { 125 return rate / (ratio + 1);
130 .name = "pclkd0", 126}
131 .id = -1,
132 .rate = 0,
133 .parent = NULL,
134 .ctrlbit = 0,
135 .set_rate = clk_default_setrate,
136};
137 127
138static int s5pc1xx_clk_gate(void __iomem *reg, 128static unsigned long s5pc100_clk_arm_round_rate(struct clk *clk,
139 struct clk *clk, 129 unsigned long rate)
140 int enable)
141{ 130{
142 unsigned int ctrlbit = clk->ctrlbit; 131 unsigned long parent = clk_get_rate(clk->parent);
143 u32 con; 132 u32 div;
144 133
145 con = __raw_readl(reg); 134 if (parent < rate)
135 return rate;
146 136
147 if (enable) 137 div = (parent / rate) - 1;
148 con |= ctrlbit; 138 if (div > S5PC100_CLKDIV0_ARM_MASK)
149 else 139 div = S5PC100_CLKDIV0_ARM_MASK;
150 con &= ~ctrlbit;
151 140
152 __raw_writel(con, reg); 141 return parent / (div + 1);
153 return 0;
154} 142}
155 143
156static int s5pc1xx_clk_d00_ctrl(struct clk *clk, int enable) 144static int s5pc100_clk_arm_set_rate(struct clk *clk, unsigned long rate)
157{ 145{
158 return s5pc1xx_clk_gate(S5PC100_CLKGATE_D00, clk, enable); 146 unsigned long parent = clk_get_rate(clk->parent);
159} 147 u32 div;
148 u32 val;
160 149
161static int s5pc1xx_clk_d01_ctrl(struct clk *clk, int enable) 150 if (rate < parent / (S5PC100_CLKDIV0_ARM_MASK + 1))
162{ 151 return -EINVAL;
163 return s5pc1xx_clk_gate(S5PC100_CLKGATE_D01, clk, enable);
164}
165 152
166static int s5pc1xx_clk_d02_ctrl(struct clk *clk, int enable) 153 rate = clk_round_rate(clk, rate);
167{ 154 div = clk_get_rate(clk->parent) / rate;
168 return s5pc1xx_clk_gate(S5PC100_CLKGATE_D02, clk, enable);
169}
170 155
171static int s5pc1xx_clk_d10_ctrl(struct clk *clk, int enable) 156 val = __raw_readl(S5PC100_CLKDIV0);
172{ 157 val &= S5PC100_CLKDIV0_ARM_MASK;
173 return s5pc1xx_clk_gate(S5PC100_CLKGATE_D10, clk, enable); 158 val |= (div - 1);
174} 159 __raw_writel(val, S5PC100_CLKDIV0);
175 160
176static int s5pc1xx_clk_d11_ctrl(struct clk *clk, int enable) 161 return 0;
177{
178 return s5pc1xx_clk_gate(S5PC100_CLKGATE_D11, clk, enable);
179} 162}
180 163
181static int s5pc1xx_clk_d12_ctrl(struct clk *clk, int enable) 164static struct clk clk_arm = {
182{ 165 .name = "armclk",
183 return s5pc1xx_clk_gate(S5PC100_CLKGATE_D12, clk, enable); 166 .id = -1,
184} 167 .parent = &clk_dout_apll,
168 .get_rate = s5pc100_clk_arm_get_rate,
169 .set_rate = s5pc100_clk_arm_set_rate,
170 .round_rate = s5pc100_clk_arm_round_rate,
171};
185 172
186static int s5pc1xx_clk_d13_ctrl(struct clk *clk, int enable) 173static unsigned long s5pc100_clk_dout_d0_bus_get_rate(struct clk *clk)
187{ 174{
188 return s5pc1xx_clk_gate(S5PC100_CLKGATE_D13, clk, enable); 175 unsigned long rate = clk_get_rate(clk->parent);
189} 176 unsigned int ratio;
190 177
191static int s5pc1xx_clk_d14_ctrl(struct clk *clk, int enable) 178 ratio = __raw_readl(S5PC100_CLKDIV0) & S5PC100_CLKDIV0_D0_MASK;
192{ 179 ratio >>= S5PC100_CLKDIV0_D0_SHIFT;
193 return s5pc1xx_clk_gate(S5PC100_CLKGATE_D14, clk, enable);
194}
195 180
196static int s5pc1xx_clk_d15_ctrl(struct clk *clk, int enable) 181 return rate / (ratio + 1);
197{
198 return s5pc1xx_clk_gate(S5PC100_CLKGATE_D15, clk, enable);
199} 182}
200 183
201static int s5pc1xx_clk_d20_ctrl(struct clk *clk, int enable) 184static struct clk clk_dout_d0_bus = {
202{ 185 .name = "dout_d0_bus",
203 return s5pc1xx_clk_gate(S5PC100_CLKGATE_D20, clk, enable); 186 .id = -1,
204} 187 .parent = &clk_arm,
188 .get_rate = s5pc100_clk_dout_d0_bus_get_rate,
189};
205 190
206int s5pc1xx_sclk0_ctrl(struct clk *clk, int enable) 191static unsigned long s5pc100_clk_dout_pclkd0_get_rate(struct clk *clk)
207{ 192{
208 return s5pc1xx_clk_gate(S5PC100_SCLKGATE0, clk, enable); 193 unsigned long rate = clk_get_rate(clk->parent);
194 unsigned int ratio;
195
196 ratio = __raw_readl(S5PC100_CLKDIV0) & S5PC100_CLKDIV0_PCLKD0_MASK;
197 ratio >>= S5PC100_CLKDIV0_PCLKD0_SHIFT;
198
199 return rate / (ratio + 1);
209} 200}
210 201
211int s5pc1xx_sclk1_ctrl(struct clk *clk, int enable) 202static struct clk clk_dout_pclkd0 = {
203 .name = "dout_pclkd0",
204 .id = -1,
205 .parent = &clk_dout_d0_bus,
206 .get_rate = s5pc100_clk_dout_pclkd0_get_rate,
207};
208
209static unsigned long s5pc100_clk_dout_apll2_get_rate(struct clk *clk)
212{ 210{
213 return s5pc1xx_clk_gate(S5PC100_SCLKGATE1, clk, enable); 211 unsigned long rate = clk_get_rate(clk->parent);
212 unsigned int ratio;
213
214 ratio = __raw_readl(S5PC100_CLKDIV1) & S5PC100_CLKDIV1_APLL2_MASK;
215 ratio >>= S5PC100_CLKDIV1_APLL2_SHIFT;
216
217 return rate / (ratio + 1);
214} 218}
215 219
216static struct clk init_clocks_disable[] = { 220static struct clk clk_dout_apll2 = {
217 { 221 .name = "dout_apll2",
218 .name = "dsi", 222 .id = -1,
219 .id = -1, 223 .parent = &clk_mout_apll.clk,
220 .parent = &clk_p, 224 .get_rate = s5pc100_clk_dout_apll2_get_rate,
221 .enable = s5pc1xx_clk_d11_ctrl,
222 .ctrlbit = S5PC100_CLKGATE_D11_DSI,
223 }, {
224 .name = "csi",
225 .id = -1,
226 .parent = &clk_h,
227 .enable = s5pc1xx_clk_d11_ctrl,
228 .ctrlbit = S5PC100_CLKGATE_D11_CSI,
229 }, {
230 .name = "ccan0",
231 .id = 0,
232 .parent = &clk_p,
233 .enable = s5pc1xx_clk_d14_ctrl,
234 .ctrlbit = S5PC100_CLKGATE_D14_CCAN0,
235 }, {
236 .name = "ccan1",
237 .id = 1,
238 .parent = &clk_p,
239 .enable = s5pc1xx_clk_d14_ctrl,
240 .ctrlbit = S5PC100_CLKGATE_D14_CCAN1,
241 }, {
242 .name = "keypad",
243 .id = -1,
244 .parent = &clk_p,
245 .enable = s5pc1xx_clk_d15_ctrl,
246 .ctrlbit = S5PC100_CLKGATE_D15_KEYIF,
247 }, {
248 .name = "hclkd2",
249 .id = -1,
250 .parent = NULL,
251 .enable = s5pc1xx_clk_d20_ctrl,
252 .ctrlbit = S5PC100_CLKGATE_D20_HCLKD2,
253 }, {
254 .name = "iis-d2",
255 .id = -1,
256 .parent = NULL,
257 .enable = s5pc1xx_clk_d20_ctrl,
258 .ctrlbit = S5PC100_CLKGATE_D20_I2SD2,
259 }, {
260 .name = "otg",
261 .id = -1,
262 .parent = &clk_h,
263 .enable = s5pc1xx_clk_d10_ctrl,
264 .ctrlbit = S5PC100_CLKGATE_D10_USBOTG,
265 },
266}; 225};
267 226
268static struct clk init_clocks[] = { 227/* MPLL */
269 /* System1 (D0_0) devices */ 228static struct clk *clk_src_mpll_list[] = {
270 { 229 [0] = &clk_fin_mpll,
271 .name = "intc", 230 [1] = &clk_fout_mpll,
272 .id = -1, 231};
273 .parent = &clk_hd0,
274 .enable = s5pc1xx_clk_d00_ctrl,
275 .ctrlbit = S5PC100_CLKGATE_D00_INTC,
276 }, {
277 .name = "tzic",
278 .id = -1,
279 .parent = &clk_hd0,
280 .enable = s5pc1xx_clk_d00_ctrl,
281 .ctrlbit = S5PC100_CLKGATE_D00_TZIC,
282 }, {
283 .name = "cf-ata",
284 .id = -1,
285 .parent = &clk_hd0,
286 .enable = s5pc1xx_clk_d00_ctrl,
287 .ctrlbit = S5PC100_CLKGATE_D00_CFCON,
288 }, {
289 .name = "mdma",
290 .id = -1,
291 .parent = &clk_hd0,
292 .enable = s5pc1xx_clk_d00_ctrl,
293 .ctrlbit = S5PC100_CLKGATE_D00_MDMA,
294 }, {
295 .name = "g2d",
296 .id = -1,
297 .parent = &clk_hd0,
298 .enable = s5pc1xx_clk_d00_ctrl,
299 .ctrlbit = S5PC100_CLKGATE_D00_G2D,
300 }, {
301 .name = "secss",
302 .id = -1,
303 .parent = &clk_hd0,
304 .enable = s5pc1xx_clk_d00_ctrl,
305 .ctrlbit = S5PC100_CLKGATE_D00_SECSS,
306 }, {
307 .name = "cssys",
308 .id = -1,
309 .parent = &clk_hd0,
310 .enable = s5pc1xx_clk_d00_ctrl,
311 .ctrlbit = S5PC100_CLKGATE_D00_CSSYS,
312 },
313 232
314 /* Memory (D0_1) devices */ 233static struct clk_sources clk_src_mpll = {
315 { 234 .sources = clk_src_mpll_list,
316 .name = "dmc", 235 .nr_sources = ARRAY_SIZE(clk_src_mpll_list),
317 .id = -1, 236};
318 .parent = &clk_hd0,
319 .enable = s5pc1xx_clk_d01_ctrl,
320 .ctrlbit = S5PC100_CLKGATE_D01_DMC,
321 }, {
322 .name = "sromc",
323 .id = -1,
324 .parent = &clk_hd0,
325 .enable = s5pc1xx_clk_d01_ctrl,
326 .ctrlbit = S5PC100_CLKGATE_D01_SROMC,
327 }, {
328 .name = "onenand",
329 .id = -1,
330 .parent = &clk_hd0,
331 .enable = s5pc1xx_clk_d01_ctrl,
332 .ctrlbit = S5PC100_CLKGATE_D01_ONENAND,
333 }, {
334 .name = "nand",
335 .id = -1,
336 .parent = &clk_hd0,
337 .enable = s5pc1xx_clk_d01_ctrl,
338 .ctrlbit = S5PC100_CLKGATE_D01_NFCON,
339 }, {
340 .name = "intmem",
341 .id = -1,
342 .parent = &clk_hd0,
343 .enable = s5pc1xx_clk_d01_ctrl,
344 .ctrlbit = S5PC100_CLKGATE_D01_INTMEM,
345 }, {
346 .name = "ebi",
347 .id = -1,
348 .parent = &clk_hd0,
349 .enable = s5pc1xx_clk_d01_ctrl,
350 .ctrlbit = S5PC100_CLKGATE_D01_EBI,
351 },
352 237
353 /* System2 (D0_2) devices */ 238static struct clksrc_clk clk_mout_mpll = {
354 { 239 .clk = {
355 .name = "seckey", 240 .name = "mout_mpll",
356 .id = -1,
357 .parent = &clk_pd0,
358 .enable = s5pc1xx_clk_d02_ctrl,
359 .ctrlbit = S5PC100_CLKGATE_D02_SECKEY,
360 }, {
361 .name = "sdm",
362 .id = -1, 241 .id = -1,
363 .parent = &clk_hd0,
364 .enable = s5pc1xx_clk_d02_ctrl,
365 .ctrlbit = S5PC100_CLKGATE_D02_SDM,
366 }, 242 },
243 .shift = S5PC100_CLKSRC0_MPLL_SHIFT,
244 .mask = S5PC100_CLKSRC0_MPLL_MASK,
245 .sources = &clk_src_mpll,
246 .reg_source = S5PC100_CLKSRC0,
247};
367 248
368 /* File (D1_0) devices */ 249static struct clk *clkset_am_list[] = {
369 { 250 [0] = &clk_mout_mpll.clk,
370 .name = "pdma0", 251 [1] = &clk_dout_apll2,
371 .id = -1, 252};
372 .parent = &clk_h,
373 .enable = s5pc1xx_clk_d10_ctrl,
374 .ctrlbit = S5PC100_CLKGATE_D10_PDMA0,
375 }, {
376 .name = "pdma1",
377 .id = -1,
378 .parent = &clk_h,
379 .enable = s5pc1xx_clk_d10_ctrl,
380 .ctrlbit = S5PC100_CLKGATE_D10_PDMA1,
381 }, {
382 .name = "usb-host",
383 .id = -1,
384 .parent = &clk_h,
385 .enable = s5pc1xx_clk_d10_ctrl,
386 .ctrlbit = S5PC100_CLKGATE_D10_USBHOST,
387 }, {
388 .name = "modem",
389 .id = -1,
390 .parent = &clk_h,
391 .enable = s5pc1xx_clk_d10_ctrl,
392 .ctrlbit = S5PC100_CLKGATE_D10_MODEMIF,
393 }, {
394 .name = "hsmmc",
395 .id = 0,
396 .parent = &clk_h,
397 .enable = s5pc1xx_clk_d10_ctrl,
398 .ctrlbit = S5PC100_CLKGATE_D10_HSMMC0,
399 }, {
400 .name = "hsmmc",
401 .id = 1,
402 .parent = &clk_h,
403 .enable = s5pc1xx_clk_d10_ctrl,
404 .ctrlbit = S5PC100_CLKGATE_D10_HSMMC1,
405 }, {
406 .name = "hsmmc",
407 .id = 2,
408 .parent = &clk_h,
409 .enable = s5pc1xx_clk_d10_ctrl,
410 .ctrlbit = S5PC100_CLKGATE_D10_HSMMC2,
411 },
412 253
413 /* Multimedia1 (D1_1) devices */ 254static struct clk_sources clk_src_am = {
414 { 255 .sources = clkset_am_list,
415 .name = "lcd", 256 .nr_sources = ARRAY_SIZE(clkset_am_list),
416 .id = -1, 257};
417 .parent = &clk_h,
418 .enable = s5pc1xx_clk_d11_ctrl,
419 .ctrlbit = S5PC100_CLKGATE_D11_LCD,
420 }, {
421 .name = "rotator",
422 .id = -1,
423 .parent = &clk_h,
424 .enable = s5pc1xx_clk_d11_ctrl,
425 .ctrlbit = S5PC100_CLKGATE_D11_ROTATOR,
426 }, {
427 .name = "fimc",
428 .id = 0,
429 .parent = &clk_h,
430 .enable = s5pc1xx_clk_d11_ctrl,
431 .ctrlbit = S5PC100_CLKGATE_D11_FIMC0,
432 }, {
433 .name = "fimc",
434 .id = 1,
435 .parent = &clk_h,
436 .enable = s5pc1xx_clk_d11_ctrl,
437 .ctrlbit = S5PC100_CLKGATE_D11_FIMC1,
438 }, {
439 .name = "fimc",
440 .id = 2,
441 .parent = &clk_h,
442 .enable = s5pc1xx_clk_d11_ctrl,
443 .ctrlbit = S5PC100_CLKGATE_D11_FIMC2,
444 }, {
445 .name = "jpeg",
446 .id = -1,
447 .parent = &clk_h,
448 .enable = s5pc1xx_clk_d11_ctrl,
449 .ctrlbit = S5PC100_CLKGATE_D11_JPEG,
450 }, {
451 .name = "g3d",
452 .id = -1,
453 .parent = &clk_h,
454 .enable = s5pc1xx_clk_d11_ctrl,
455 .ctrlbit = S5PC100_CLKGATE_D11_G3D,
456 },
457 258
458 /* Multimedia2 (D1_2) devices */ 259static struct clksrc_clk clk_mout_am = {
459 { 260 .clk = {
460 .name = "tv", 261 .name = "mout_am",
461 .id = -1,
462 .parent = &clk_h,
463 .enable = s5pc1xx_clk_d12_ctrl,
464 .ctrlbit = S5PC100_CLKGATE_D12_TV,
465 }, {
466 .name = "vp",
467 .id = -1,
468 .parent = &clk_h,
469 .enable = s5pc1xx_clk_d12_ctrl,
470 .ctrlbit = S5PC100_CLKGATE_D12_VP,
471 }, {
472 .name = "mixer",
473 .id = -1,
474 .parent = &clk_h,
475 .enable = s5pc1xx_clk_d12_ctrl,
476 .ctrlbit = S5PC100_CLKGATE_D12_MIXER,
477 }, {
478 .name = "hdmi",
479 .id = -1,
480 .parent = &clk_h,
481 .enable = s5pc1xx_clk_d12_ctrl,
482 .ctrlbit = S5PC100_CLKGATE_D12_HDMI,
483 }, {
484 .name = "mfc",
485 .id = -1, 262 .id = -1,
486 .parent = &clk_h,
487 .enable = s5pc1xx_clk_d12_ctrl,
488 .ctrlbit = S5PC100_CLKGATE_D12_MFC,
489 }, 263 },
264 .shift = S5PC100_CLKSRC0_AMMUX_SHIFT,
265 .mask = S5PC100_CLKSRC0_AMMUX_MASK,
266 .sources = &clk_src_am,
267 .reg_source = S5PC100_CLKSRC0,
268};
490 269
491 /* System (D1_3) devices */ 270static unsigned long s5pc100_clk_dout_d1_bus_get_rate(struct clk *clk)
492 { 271{
493 .name = "chipid", 272 unsigned long rate = clk_get_rate(clk->parent);
494 .id = -1, 273 unsigned int ratio;
495 .parent = &clk_p,
496 .enable = s5pc1xx_clk_d13_ctrl,
497 .ctrlbit = S5PC100_CLKGATE_D13_CHIPID,
498 }, {
499 .name = "gpio",
500 .id = -1,
501 .parent = &clk_p,
502 .enable = s5pc1xx_clk_d13_ctrl,
503 .ctrlbit = S5PC100_CLKGATE_D13_GPIO,
504 }, {
505 .name = "apc",
506 .id = -1,
507 .parent = &clk_p,
508 .enable = s5pc1xx_clk_d13_ctrl,
509 .ctrlbit = S5PC100_CLKGATE_D13_APC,
510 }, {
511 .name = "iec",
512 .id = -1,
513 .parent = &clk_p,
514 .enable = s5pc1xx_clk_d13_ctrl,
515 .ctrlbit = S5PC100_CLKGATE_D13_IEC,
516 }, {
517 .name = "timers",
518 .id = -1,
519 .parent = &clk_p,
520 .enable = s5pc1xx_clk_d13_ctrl,
521 .ctrlbit = S5PC100_CLKGATE_D13_PWM,
522 }, {
523 .name = "systimer",
524 .id = -1,
525 .parent = &clk_p,
526 .enable = s5pc1xx_clk_d13_ctrl,
527 .ctrlbit = S5PC100_CLKGATE_D13_SYSTIMER,
528 }, {
529 .name = "watchdog",
530 .id = -1,
531 .parent = &clk_p,
532 .enable = s5pc1xx_clk_d13_ctrl,
533 .ctrlbit = S5PC100_CLKGATE_D13_WDT,
534 }, {
535 .name = "rtc",
536 .id = -1,
537 .parent = &clk_p,
538 .enable = s5pc1xx_clk_d13_ctrl,
539 .ctrlbit = S5PC100_CLKGATE_D13_RTC,
540 },
541 274
542 /* Connectivity (D1_4) devices */ 275 printk(KERN_DEBUG "%s: parent is %ld\n", __func__, rate);
543 {
544 .name = "uart",
545 .id = 0,
546 .parent = &clk_p,
547 .enable = s5pc1xx_clk_d14_ctrl,
548 .ctrlbit = S5PC100_CLKGATE_D14_UART0,
549 }, {
550 .name = "uart",
551 .id = 1,
552 .parent = &clk_p,
553 .enable = s5pc1xx_clk_d14_ctrl,
554 .ctrlbit = S5PC100_CLKGATE_D14_UART1,
555 }, {
556 .name = "uart",
557 .id = 2,
558 .parent = &clk_p,
559 .enable = s5pc1xx_clk_d14_ctrl,
560 .ctrlbit = S5PC100_CLKGATE_D14_UART2,
561 }, {
562 .name = "uart",
563 .id = 3,
564 .parent = &clk_p,
565 .enable = s5pc1xx_clk_d14_ctrl,
566 .ctrlbit = S5PC100_CLKGATE_D14_UART3,
567 }, {
568 .name = "i2c",
569 .id = -1,
570 .parent = &clk_p,
571 .enable = s5pc1xx_clk_d14_ctrl,
572 .ctrlbit = S5PC100_CLKGATE_D14_IIC,
573 }, {
574 .name = "hdmi-i2c",
575 .id = -1,
576 .parent = &clk_p,
577 .enable = s5pc1xx_clk_d14_ctrl,
578 .ctrlbit = S5PC100_CLKGATE_D14_HDMI_IIC,
579 }, {
580 .name = "spi",
581 .id = 0,
582 .parent = &clk_p,
583 .enable = s5pc1xx_clk_d14_ctrl,
584 .ctrlbit = S5PC100_CLKGATE_D14_SPI0,
585 }, {
586 .name = "spi",
587 .id = 1,
588 .parent = &clk_p,
589 .enable = s5pc1xx_clk_d14_ctrl,
590 .ctrlbit = S5PC100_CLKGATE_D14_SPI1,
591 }, {
592 .name = "spi",
593 .id = 2,
594 .parent = &clk_p,
595 .enable = s5pc1xx_clk_d14_ctrl,
596 .ctrlbit = S5PC100_CLKGATE_D14_SPI2,
597 }, {
598 .name = "irda",
599 .id = -1,
600 .parent = &clk_p,
601 .enable = s5pc1xx_clk_d14_ctrl,
602 .ctrlbit = S5PC100_CLKGATE_D14_IRDA,
603 }, {
604 .name = "hsitx",
605 .id = -1,
606 .parent = &clk_p,
607 .enable = s5pc1xx_clk_d14_ctrl,
608 .ctrlbit = S5PC100_CLKGATE_D14_HSITX,
609 }, {
610 .name = "hsirx",
611 .id = -1,
612 .parent = &clk_p,
613 .enable = s5pc1xx_clk_d14_ctrl,
614 .ctrlbit = S5PC100_CLKGATE_D14_HSIRX,
615 },
616 276
617 /* Audio (D1_5) devices */ 277 ratio = __raw_readl(S5PC100_CLKDIV1) & S5PC100_CLKDIV1_D1_MASK;
618 { 278 ratio >>= S5PC100_CLKDIV1_D1_SHIFT;
619 .name = "iis",
620 .id = 0,
621 .parent = &clk_p,
622 .enable = s5pc1xx_clk_d15_ctrl,
623 .ctrlbit = S5PC100_CLKGATE_D15_IIS0,
624 }, {
625 .name = "iis",
626 .id = 1,
627 .parent = &clk_p,
628 .enable = s5pc1xx_clk_d15_ctrl,
629 .ctrlbit = S5PC100_CLKGATE_D15_IIS1,
630 }, {
631 .name = "iis",
632 .id = 2,
633 .parent = &clk_p,
634 .enable = s5pc1xx_clk_d15_ctrl,
635 .ctrlbit = S5PC100_CLKGATE_D15_IIS2,
636 }, {
637 .name = "ac97",
638 .id = -1,
639 .parent = &clk_p,
640 .enable = s5pc1xx_clk_d15_ctrl,
641 .ctrlbit = S5PC100_CLKGATE_D15_AC97,
642 }, {
643 .name = "pcm",
644 .id = 0,
645 .parent = &clk_p,
646 .enable = s5pc1xx_clk_d15_ctrl,
647 .ctrlbit = S5PC100_CLKGATE_D15_PCM0,
648 }, {
649 .name = "pcm",
650 .id = 1,
651 .parent = &clk_p,
652 .enable = s5pc1xx_clk_d15_ctrl,
653 .ctrlbit = S5PC100_CLKGATE_D15_PCM1,
654 }, {
655 .name = "spdif",
656 .id = -1,
657 .parent = &clk_p,
658 .enable = s5pc1xx_clk_d15_ctrl,
659 .ctrlbit = S5PC100_CLKGATE_D15_SPDIF,
660 }, {
661 .name = "adc",
662 .id = -1,
663 .parent = &clk_p,
664 .enable = s5pc1xx_clk_d15_ctrl,
665 .ctrlbit = S5PC100_CLKGATE_D15_TSADC,
666 }, {
667 .name = "keyif",
668 .id = -1,
669 .parent = &clk_p,
670 .enable = s5pc1xx_clk_d15_ctrl,
671 .ctrlbit = S5PC100_CLKGATE_D15_KEYIF,
672 }, {
673 .name = "cg",
674 .id = -1,
675 .parent = &clk_p,
676 .enable = s5pc1xx_clk_d15_ctrl,
677 .ctrlbit = S5PC100_CLKGATE_D15_CG,
678 },
679 279
680 /* Audio (D2_0) devices: all disabled */ 280 return rate / (ratio + 1);
281}
681 282
682 /* Special Clocks 1 */ 283static struct clk clk_dout_d1_bus = {
683 { 284 .name = "dout_d1_bus",
684 .name = "sclk_hpm", 285 .id = -1,
685 .id = -1, 286 .parent = &clk_mout_am.clk,
686 .parent = NULL, 287 .get_rate = s5pc100_clk_dout_d1_bus_get_rate,
687 .enable = s5pc1xx_sclk0_ctrl, 288};
688 .ctrlbit = S5PC1XX_CLKGATE_SCLK0_HPM,
689 }, {
690 .name = "sclk_onenand",
691 .id = -1,
692 .parent = NULL,
693 .enable = s5pc1xx_sclk0_ctrl,
694 .ctrlbit = S5PC100_CLKGATE_SCLK0_ONENAND,
695 }, {
696 .name = "sclk_spi_48",
697 .id = 0,
698 .parent = &clk_48m,
699 .enable = s5pc1xx_sclk0_ctrl,
700 .ctrlbit = S5PC100_CLKGATE_SCLK0_SPI0_48,
701 }, {
702 .name = "sclk_spi_48",
703 .id = 1,
704 .parent = &clk_48m,
705 .enable = s5pc1xx_sclk0_ctrl,
706 .ctrlbit = S5PC100_CLKGATE_SCLK0_SPI1_48,
707 }, {
708 .name = "sclk_spi_48",
709 .id = 2,
710 .parent = &clk_48m,
711 .enable = s5pc1xx_sclk0_ctrl,
712 .ctrlbit = S5PC100_CLKGATE_SCLK0_SPI2_48,
713 }, {
714 .name = "sclk_mmc_48",
715 .id = 0,
716 .parent = &clk_48m,
717 .enable = s5pc1xx_sclk0_ctrl,
718 .ctrlbit = S5PC100_CLKGATE_SCLK0_MMC0_48,
719 }, {
720 .name = "sclk_mmc_48",
721 .id = 1,
722 .parent = &clk_48m,
723 .enable = s5pc1xx_sclk0_ctrl,
724 .ctrlbit = S5PC100_CLKGATE_SCLK0_MMC1_48,
725 }, {
726 .name = "sclk_mmc_48",
727 .id = 2,
728 .parent = &clk_48m,
729 .enable = s5pc1xx_sclk0_ctrl,
730 .ctrlbit = S5PC100_CLKGATE_SCLK0_MMC2_48,
731 },
732 289
733 /* Special Clocks 2 */ 290static struct clk *clkset_onenand_list[] = {
734 { 291 [0] = &clk_dout_d0_bus,
735 .name = "sclk_tv_54", 292 [1] = &clk_dout_d1_bus,
736 .id = -1, 293};
737 .parent = &clk_54m, 294
738 .enable = s5pc1xx_sclk1_ctrl, 295static struct clk_sources clk_src_onenand = {
739 .ctrlbit = S5PC100_CLKGATE_SCLK1_TV54, 296 .sources = clkset_onenand_list,
740 }, { 297 .nr_sources = ARRAY_SIZE(clkset_onenand_list),
741 .name = "sclk_vdac_54", 298};
742 .id = -1, 299
743 .parent = &clk_54m, 300static struct clksrc_clk clk_mout_onenand = {
744 .enable = s5pc1xx_sclk1_ctrl, 301 .clk = {
745 .ctrlbit = S5PC100_CLKGATE_SCLK1_VDAC54, 302 .name = "mout_onenand",
746 }, {
747 .name = "sclk_spdif",
748 .id = -1, 303 .id = -1,
749 .parent = NULL,
750 .enable = s5pc1xx_sclk1_ctrl,
751 .ctrlbit = S5PC100_CLKGATE_SCLK1_SPDIF,
752 }, 304 },
305 .shift = S5PC100_CLKSRC0_ONENAND_SHIFT,
306 .mask = S5PC100_CLKSRC0_ONENAND_MASK,
307 .sources = &clk_src_onenand,
308 .reg_source = S5PC100_CLKSRC0,
753}; 309};
754 310
755void __init s5pc1xx_register_clocks(void) 311static unsigned long s5pc100_clk_dout_pclkd1_get_rate(struct clk *clk)
756{ 312{
757 struct clk *clkp; 313 unsigned long rate = clk_get_rate(clk->parent);
758 int ret; 314 unsigned int ratio;
759 int ptr;
760 315
761 clkp = init_clocks; 316 printk(KERN_DEBUG "%s: parent is %ld\n", __func__, rate);
762 for (ptr = 0; ptr < ARRAY_SIZE(init_clocks); ptr++, clkp++) {
763 ret = s3c24xx_register_clock(clkp);
764 if (ret < 0) {
765 printk(KERN_ERR "Failed to register clock %s (%d)\n",
766 clkp->name, ret);
767 }
768 }
769 317
770 clkp = init_clocks_disable; 318 ratio = __raw_readl(S5PC100_CLKDIV1) & S5PC100_CLKDIV1_PCLKD1_MASK;
771 for (ptr = 0; ptr < ARRAY_SIZE(init_clocks_disable); ptr++, clkp++) { 319 ratio >>= S5PC100_CLKDIV1_PCLKD1_SHIFT;
772 320
773 ret = s3c24xx_register_clock(clkp); 321 return rate / (ratio + 1);
774 if (ret < 0) { 322}
775 printk(KERN_ERR "Failed to register clock %s (%d)\n",
776 clkp->name, ret);
777 }
778 323
779 (clkp->enable)(clkp, 0); 324static struct clk clk_dout_pclkd1 = {
780 } 325 .name = "dout_pclkd1",
326 .id = -1,
327 .parent = &clk_dout_d1_bus,
328 .get_rate = s5pc100_clk_dout_pclkd1_get_rate,
329};
330
331static unsigned long s5pc100_clk_dout_mpll2_get_rate(struct clk *clk)
332{
333 unsigned long rate = clk_get_rate(clk->parent);
334 unsigned int ratio;
335
336 printk(KERN_DEBUG "%s: parent is %ld\n", __func__, rate);
337
338 ratio = __raw_readl(S5PC100_CLKDIV1) & S5PC100_CLKDIV1_MPLL2_MASK;
339 ratio >>= S5PC100_CLKDIV1_MPLL2_SHIFT;
781 340
782 s3c_pwmclk_init(); 341 return rate / (ratio + 1);
783} 342}
784static struct clk clk_fout_apll = { 343
785 .name = "fout_apll", 344static struct clk clk_dout_mpll2 = {
345 .name = "dout_mpll2",
786 .id = -1, 346 .id = -1,
347 .parent = &clk_mout_am.clk,
348 .get_rate = s5pc100_clk_dout_mpll2_get_rate,
787}; 349};
788 350
789static struct clk *clk_src_apll_list[] = { 351static unsigned long s5pc100_clk_dout_cam_get_rate(struct clk *clk)
790 [0] = &clk_fin_apll, 352{
791 [1] = &clk_fout_apll, 353 unsigned long rate = clk_get_rate(clk->parent);
792}; 354 unsigned int ratio;
793 355
794static struct clk_sources clk_src_apll = { 356 printk(KERN_DEBUG "%s: parent is %ld\n", __func__, rate);
795 .sources = clk_src_apll_list, 357
796 .nr_sources = ARRAY_SIZE(clk_src_apll_list), 358 ratio = __raw_readl(S5PC100_CLKDIV1) & S5PC100_CLKDIV1_CAM_MASK;
359 ratio >>= S5PC100_CLKDIV1_CAM_SHIFT;
360
361 return rate / (ratio + 1);
362}
363
364static struct clk clk_dout_cam = {
365 .name = "dout_cam",
366 .id = -1,
367 .parent = &clk_dout_mpll2,
368 .get_rate = s5pc100_clk_dout_cam_get_rate,
797}; 369};
798 370
799static struct clksrc_clk clk_mout_apll = { 371static unsigned long s5pc100_clk_dout_mpll_get_rate(struct clk *clk)
800 .clk = { 372{
801 .name = "mout_apll", 373 unsigned long rate = clk_get_rate(clk->parent);
802 .id = -1, 374 unsigned int ratio;
803 }, 375
804 .shift = S5PC1XX_CLKSRC0_APLL_SHIFT, 376 printk(KERN_DEBUG "%s: parent is %ld\n", __func__, rate);
805 .mask = S5PC1XX_CLKSRC0_APLL_MASK, 377
806 .sources = &clk_src_apll, 378 ratio = __raw_readl(S5PC100_CLKDIV1) & S5PC100_CLKDIV1_MPLL_MASK;
807 .reg_source = S5PC1XX_CLK_SRC0, 379 ratio >>= S5PC100_CLKDIV1_MPLL_SHIFT;
380
381 return rate / (ratio + 1);
382}
383
384static struct clk clk_dout_mpll = {
385 .name = "dout_mpll",
386 .id = -1,
387 .parent = &clk_mout_am.clk,
388 .get_rate = s5pc100_clk_dout_mpll_get_rate,
808}; 389};
809 390
391/* EPLL */
810static struct clk clk_fout_epll = { 392static struct clk clk_fout_epll = {
811 .name = "fout_epll", 393 .name = "fout_epll",
812 .id = -1, 394 .id = -1,
@@ -827,91 +409,57 @@ static struct clksrc_clk clk_mout_epll = {
827 .name = "mout_epll", 409 .name = "mout_epll",
828 .id = -1, 410 .id = -1,
829 }, 411 },
830 .shift = S5PC1XX_CLKSRC0_EPLL_SHIFT, 412 .shift = S5PC100_CLKSRC0_EPLL_SHIFT,
831 .mask = S5PC1XX_CLKSRC0_EPLL_MASK, 413 .mask = S5PC100_CLKSRC0_EPLL_MASK,
832 .sources = &clk_src_epll, 414 .sources = &clk_src_epll,
833 .reg_source = S5PC1XX_CLK_SRC0, 415 .reg_source = S5PC100_CLKSRC0,
834}; 416};
835 417
836static struct clk *clk_src_mpll_list[] = { 418/* HPLL */
837 [0] = &clk_fin_mpll, 419static struct clk clk_fout_hpll = {
838 [1] = &clk_fout_mpll, 420 .name = "fout_hpll",
839};
840
841static struct clk_sources clk_src_mpll = {
842 .sources = clk_src_mpll_list,
843 .nr_sources = ARRAY_SIZE(clk_src_mpll_list),
844};
845
846static struct clksrc_clk clk_mout_mpll = {
847 .clk = {
848 .name = "mout_mpll",
849 .id = -1,
850 },
851 .shift = S5PC1XX_CLKSRC0_MPLL_SHIFT,
852 .mask = S5PC1XX_CLKSRC0_MPLL_MASK,
853 .sources = &clk_src_mpll,
854 .reg_source = S5PC1XX_CLK_SRC0,
855};
856
857static unsigned long s5pc1xx_clk_doutmpll_get_rate(struct clk *clk)
858{
859 unsigned long rate = clk_get_rate(clk->parent);
860 unsigned long clkdiv;
861
862 printk(KERN_DEBUG "%s: parent is %ld\n", __func__, rate);
863
864 clkdiv = __raw_readl(S5PC1XX_CLK_DIV1) & S5PC100_CLKDIV1_MPLL_MASK;
865 rate /= (clkdiv >> S5PC100_CLKDIV1_MPLL_SHIFT) + 1;
866
867 return rate;
868}
869
870static struct clk clk_dout_mpll = {
871 .name = "dout_mpll",
872 .id = -1, 421 .id = -1,
873 .parent = &clk_mout_mpll.clk,
874 .get_rate = s5pc1xx_clk_doutmpll_get_rate,
875}; 422};
876 423
877static unsigned long s5pc1xx_clk_doutmpll2_get_rate(struct clk *clk) 424static struct clk *clk_src_hpll_list[] = {
878{ 425 [0] = &clk_27m,
879 unsigned long rate = clk_get_rate(clk->parent); 426 [1] = &clk_fout_hpll,
880 unsigned long clkdiv;
881
882 printk(KERN_DEBUG "%s: parent is %ld\n", __func__, rate);
883
884 clkdiv = __raw_readl(S5PC1XX_CLK_DIV1) & S5PC100_CLKDIV1_MPLL2_MASK;
885 rate /= (clkdiv >> S5PC100_CLKDIV1_MPLL2_SHIFT) + 1;
886
887 return rate;
888}
889
890struct clk clk_dout_mpll2 = {
891 .name = "dout_mpll2",
892 .id = -1,
893 .parent = &clk_mout_mpll.clk,
894 .get_rate = s5pc1xx_clk_doutmpll2_get_rate,
895}; 427};
896 428
897static struct clk *clkset_uart_list[] = { 429static struct clk_sources clk_src_hpll = {
898 &clk_mout_epll.clk, 430 .sources = clk_src_hpll_list,
899 &clk_dout_mpll, 431 .nr_sources = ARRAY_SIZE(clk_src_hpll_list),
900 NULL,
901 NULL
902}; 432};
903 433
904static struct clk_sources clkset_uart = { 434static struct clksrc_clk clk_mout_hpll = {
905 .sources = clkset_uart_list, 435 .clk = {
906 .nr_sources = ARRAY_SIZE(clkset_uart_list), 436 .name = "mout_hpll",
437 .id = -1,
438 },
439 .shift = S5PC100_CLKSRC0_HPLL_SHIFT,
440 .mask = S5PC100_CLKSRC0_HPLL_MASK,
441 .sources = &clk_src_hpll,
442 .reg_source = S5PC100_CLKSRC0,
907}; 443};
908 444
445/* Peripherals */
446/*
447 * The peripheral clocks are all controlled via clocksource followed
448 * by an optional divider and gate stage. We currently roll this into
449 * one clock which hides the intermediate clock from the mux.
450 *
451 * Note, the JPEG clock can only be an even divider...
452 *
453 * The scaler and LCD clocks depend on the S5PC100 version, and also
454 * have a common parent divisor so are not included here.
455 */
456
909static inline struct clksrc_clk *to_clksrc(struct clk *clk) 457static inline struct clksrc_clk *to_clksrc(struct clk *clk)
910{ 458{
911 return container_of(clk, struct clksrc_clk, clk); 459 return container_of(clk, struct clksrc_clk, clk);
912} 460}
913 461
914static unsigned long s5pc1xx_getrate_clksrc(struct clk *clk) 462static unsigned long s5pc100_getrate_clksrc(struct clk *clk)
915{ 463{
916 struct clksrc_clk *sclk = to_clksrc(clk); 464 struct clksrc_clk *sclk = to_clksrc(clk);
917 unsigned long rate = clk_get_rate(clk->parent); 465 unsigned long rate = clk_get_rate(clk->parent);
@@ -925,7 +473,7 @@ static unsigned long s5pc1xx_getrate_clksrc(struct clk *clk)
925 return rate; 473 return rate;
926} 474}
927 475
928static int s5pc1xx_setrate_clksrc(struct clk *clk, unsigned long rate) 476static int s5pc100_setrate_clksrc(struct clk *clk, unsigned long rate)
929{ 477{
930 struct clksrc_clk *sclk = to_clksrc(clk); 478 struct clksrc_clk *sclk = to_clksrc(clk);
931 void __iomem *reg = sclk->reg_divider; 479 void __iomem *reg = sclk->reg_divider;
@@ -938,14 +486,14 @@ static int s5pc1xx_setrate_clksrc(struct clk *clk, unsigned long rate)
938 return -EINVAL; 486 return -EINVAL;
939 487
940 val = __raw_readl(reg); 488 val = __raw_readl(reg);
941 val &= ~(0xf << sclk->shift); 489 val &= ~(0xf << sclk->divider_shift);
942 val |= (div - 1) << sclk->shift; 490 val |= (div - 1) << sclk->divider_shift;
943 __raw_writel(val, reg); 491 __raw_writel(val, reg);
944 492
945 return 0; 493 return 0;
946} 494}
947 495
948static int s5pc1xx_setparent_clksrc(struct clk *clk, struct clk *parent) 496static int s5pc100_setparent_clksrc(struct clk *clk, struct clk *parent)
949{ 497{
950 struct clksrc_clk *sclk = to_clksrc(clk); 498 struct clksrc_clk *sclk = to_clksrc(clk);
951 struct clk_sources *srcs = sclk->sources; 499 struct clk_sources *srcs = sclk->sources;
@@ -970,7 +518,7 @@ static int s5pc1xx_setparent_clksrc(struct clk *clk, struct clk *parent)
970 return -EINVAL; 518 return -EINVAL;
971} 519}
972 520
973static unsigned long s5pc1xx_roundrate_clksrc(struct clk *clk, 521static unsigned long s5pc100_roundrate_clksrc(struct clk *clk,
974 unsigned long rate) 522 unsigned long rate)
975{ 523{
976 unsigned long parent_rate = clk_get_rate(clk->parent); 524 unsigned long parent_rate = clk_get_rate(clk->parent);
@@ -992,35 +540,466 @@ static unsigned long s5pc1xx_roundrate_clksrc(struct clk *clk,
992 return rate; 540 return rate;
993} 541}
994 542
543static struct clk *clkset_spi_list[] = {
544 &clk_mout_epll.clk,
545 &clk_dout_mpll2,
546 &clk_fin_epll,
547 &clk_mout_hpll.clk,
548};
549
550static struct clk_sources clkset_spi = {
551 .sources = clkset_spi_list,
552 .nr_sources = ARRAY_SIZE(clkset_spi_list),
553};
554
555static struct clksrc_clk clk_spi0 = {
556 .clk = {
557 .name = "spi_bus",
558 .id = 0,
559 .ctrlbit = S5PC100_CLKGATE_SCLK0_SPI0,
560 .enable = s5pc100_sclk0_ctrl,
561 .set_parent = s5pc100_setparent_clksrc,
562 .get_rate = s5pc100_getrate_clksrc,
563 .set_rate = s5pc100_setrate_clksrc,
564 .round_rate = s5pc100_roundrate_clksrc,
565 },
566 .shift = S5PC100_CLKSRC1_SPI0_SHIFT,
567 .mask = S5PC100_CLKSRC1_SPI0_MASK,
568 .sources = &clkset_spi,
569 .divider_shift = S5PC100_CLKDIV2_SPI0_SHIFT,
570 .reg_divider = S5PC100_CLKDIV2,
571 .reg_source = S5PC100_CLKSRC1,
572};
573
574static struct clksrc_clk clk_spi1 = {
575 .clk = {
576 .name = "spi_bus",
577 .id = 1,
578 .ctrlbit = S5PC100_CLKGATE_SCLK0_SPI1,
579 .enable = s5pc100_sclk0_ctrl,
580 .set_parent = s5pc100_setparent_clksrc,
581 .get_rate = s5pc100_getrate_clksrc,
582 .set_rate = s5pc100_setrate_clksrc,
583 .round_rate = s5pc100_roundrate_clksrc,
584 },
585 .shift = S5PC100_CLKSRC1_SPI1_SHIFT,
586 .mask = S5PC100_CLKSRC1_SPI1_MASK,
587 .sources = &clkset_spi,
588 .divider_shift = S5PC100_CLKDIV2_SPI1_SHIFT,
589 .reg_divider = S5PC100_CLKDIV2,
590 .reg_source = S5PC100_CLKSRC1,
591};
592
593static struct clksrc_clk clk_spi2 = {
594 .clk = {
595 .name = "spi_bus",
596 .id = 2,
597 .ctrlbit = S5PC100_CLKGATE_SCLK0_SPI2,
598 .enable = s5pc100_sclk0_ctrl,
599 .set_parent = s5pc100_setparent_clksrc,
600 .get_rate = s5pc100_getrate_clksrc,
601 .set_rate = s5pc100_setrate_clksrc,
602 .round_rate = s5pc100_roundrate_clksrc,
603 },
604 .shift = S5PC100_CLKSRC1_SPI2_SHIFT,
605 .mask = S5PC100_CLKSRC1_SPI2_MASK,
606 .sources = &clkset_spi,
607 .divider_shift = S5PC100_CLKDIV2_SPI2_SHIFT,
608 .reg_divider = S5PC100_CLKDIV2,
609 .reg_source = S5PC100_CLKSRC1,
610};
611
612static struct clk *clkset_uart_list[] = {
613 &clk_mout_epll.clk,
614 &clk_dout_mpll,
615};
616
617static struct clk_sources clkset_uart = {
618 .sources = clkset_uart_list,
619 .nr_sources = ARRAY_SIZE(clkset_uart_list),
620};
621
995static struct clksrc_clk clk_uart_uclk1 = { 622static struct clksrc_clk clk_uart_uclk1 = {
996 .clk = { 623 .clk = {
997 .name = "uclk1", 624 .name = "uclk1",
998 .id = -1, 625 .id = -1,
999 .ctrlbit = S5PC100_CLKGATE_SCLK0_UART, 626 .ctrlbit = S5PC100_CLKGATE_SCLK0_UART,
1000 .enable = s5pc1xx_sclk0_ctrl, 627 .enable = s5pc100_sclk0_ctrl,
1001 .set_parent = s5pc1xx_setparent_clksrc, 628 .set_parent = s5pc100_setparent_clksrc,
1002 .get_rate = s5pc1xx_getrate_clksrc, 629 .get_rate = s5pc100_getrate_clksrc,
1003 .set_rate = s5pc1xx_setrate_clksrc, 630 .set_rate = s5pc100_setrate_clksrc,
1004 .round_rate = s5pc1xx_roundrate_clksrc, 631 .round_rate = s5pc100_roundrate_clksrc,
1005 }, 632 },
1006 .shift = S5PC100_CLKSRC1_UART_SHIFT, 633 .shift = S5PC100_CLKSRC1_UART_SHIFT,
1007 .mask = S5PC100_CLKSRC1_UART_MASK, 634 .mask = S5PC100_CLKSRC1_UART_MASK,
1008 .sources = &clkset_uart, 635 .sources = &clkset_uart,
1009 .divider_shift = S5PC100_CLKDIV2_UART_SHIFT, 636 .divider_shift = S5PC100_CLKDIV2_UART_SHIFT,
1010 .reg_divider = S5PC1XX_CLK_DIV2, 637 .reg_divider = S5PC100_CLKDIV2,
1011 .reg_source = S5PC1XX_CLK_SRC1, 638 .reg_source = S5PC100_CLKSRC1,
639};
640
641static struct clk clk_iis_cd0 = {
642 .name = "iis_cdclk0",
643 .id = -1,
644};
645
646static struct clk clk_iis_cd1 = {
647 .name = "iis_cdclk1",
648 .id = -1,
649};
650
651static struct clk clk_iis_cd2 = {
652 .name = "iis_cdclk2",
653 .id = -1,
654};
655
656static struct clk clk_pcm_cd0 = {
657 .name = "pcm_cdclk0",
658 .id = -1,
659};
660
661static struct clk clk_pcm_cd1 = {
662 .name = "pcm_cdclk1",
663 .id = -1,
664};
665
666static struct clk *clkset_audio0_list[] = {
667 &clk_mout_epll.clk,
668 &clk_dout_mpll,
669 &clk_fin_epll,
670 &clk_iis_cd0,
671 &clk_pcm_cd0,
672 &clk_mout_hpll.clk,
673};
674
675static struct clk_sources clkset_audio0 = {
676 .sources = clkset_audio0_list,
677 .nr_sources = ARRAY_SIZE(clkset_audio0_list),
678};
679
680static struct clksrc_clk clk_audio0 = {
681 .clk = {
682 .name = "audio-bus",
683 .id = 0,
684 .ctrlbit = S5PC100_CLKGATE_SCLK1_AUDIO0,
685 .enable = s5pc100_sclk1_ctrl,
686 .set_parent = s5pc100_setparent_clksrc,
687 .get_rate = s5pc100_getrate_clksrc,
688 .set_rate = s5pc100_setrate_clksrc,
689 .round_rate = s5pc100_roundrate_clksrc,
690 },
691 .shift = S5PC100_CLKSRC3_AUDIO0_SHIFT,
692 .mask = S5PC100_CLKSRC3_AUDIO0_MASK,
693 .sources = &clkset_audio0,
694 .divider_shift = S5PC100_CLKDIV4_AUDIO0_SHIFT,
695 .reg_divider = S5PC100_CLKDIV4,
696 .reg_source = S5PC100_CLKSRC3,
697};
698
699static struct clk *clkset_audio1_list[] = {
700 &clk_mout_epll.clk,
701 &clk_dout_mpll,
702 &clk_fin_epll,
703 &clk_iis_cd1,
704 &clk_pcm_cd1,
705 &clk_mout_hpll.clk,
706};
707
708static struct clk_sources clkset_audio1 = {
709 .sources = clkset_audio1_list,
710 .nr_sources = ARRAY_SIZE(clkset_audio1_list),
711};
712
713static struct clksrc_clk clk_audio1 = {
714 .clk = {
715 .name = "audio-bus",
716 .id = 1,
717 .ctrlbit = S5PC100_CLKGATE_SCLK1_AUDIO1,
718 .enable = s5pc100_sclk1_ctrl,
719 .set_parent = s5pc100_setparent_clksrc,
720 .get_rate = s5pc100_getrate_clksrc,
721 .set_rate = s5pc100_setrate_clksrc,
722 .round_rate = s5pc100_roundrate_clksrc,
723 },
724 .shift = S5PC100_CLKSRC3_AUDIO1_SHIFT,
725 .mask = S5PC100_CLKSRC3_AUDIO1_MASK,
726 .sources = &clkset_audio1,
727 .divider_shift = S5PC100_CLKDIV4_AUDIO1_SHIFT,
728 .reg_divider = S5PC100_CLKDIV4,
729 .reg_source = S5PC100_CLKSRC3,
730};
731
732static struct clk *clkset_audio2_list[] = {
733 &clk_mout_epll.clk,
734 &clk_dout_mpll,
735 &clk_fin_epll,
736 &clk_iis_cd2,
737 &clk_mout_hpll.clk,
738};
739
740static struct clk_sources clkset_audio2 = {
741 .sources = clkset_audio2_list,
742 .nr_sources = ARRAY_SIZE(clkset_audio2_list),
743};
744
745static struct clksrc_clk clk_audio2 = {
746 .clk = {
747 .name = "audio-bus",
748 .id = 2,
749 .ctrlbit = S5PC100_CLKGATE_SCLK1_AUDIO2,
750 .enable = s5pc100_sclk1_ctrl,
751 .set_parent = s5pc100_setparent_clksrc,
752 .get_rate = s5pc100_getrate_clksrc,
753 .set_rate = s5pc100_setrate_clksrc,
754 .round_rate = s5pc100_roundrate_clksrc,
755 },
756 .shift = S5PC100_CLKSRC3_AUDIO2_SHIFT,
757 .mask = S5PC100_CLKSRC3_AUDIO2_MASK,
758 .sources = &clkset_audio2,
759 .divider_shift = S5PC100_CLKDIV4_AUDIO2_SHIFT,
760 .reg_divider = S5PC100_CLKDIV4,
761 .reg_source = S5PC100_CLKSRC3,
762};
763
764static struct clk *clkset_spdif_list[] = {
765 &clk_audio0.clk,
766 &clk_audio1.clk,
767 &clk_audio2.clk,
768};
769
770static struct clk_sources clkset_spdif = {
771 .sources = clkset_spdif_list,
772 .nr_sources = ARRAY_SIZE(clkset_spdif_list),
773};
774
775static struct clksrc_clk clk_spdif = {
776 .clk = {
777 .name = "spdif",
778 .id = -1,
779 },
780 .shift = S5PC100_CLKSRC3_SPDIF_SHIFT,
781 .mask = S5PC100_CLKSRC3_SPDIF_MASK,
782 .sources = &clkset_spdif,
783 .reg_source = S5PC100_CLKSRC3,
784};
785
786static struct clk *clkset_lcd_fimc_list[] = {
787 &clk_mout_epll.clk,
788 &clk_dout_mpll,
789 &clk_mout_hpll.clk,
790 &clk_vclk_54m,
791};
792
793static struct clk_sources clkset_lcd_fimc = {
794 .sources = clkset_lcd_fimc_list,
795 .nr_sources = ARRAY_SIZE(clkset_lcd_fimc_list),
796};
797
798static struct clksrc_clk clk_lcd = {
799 .clk = {
800 .name = "lcd",
801 .id = -1,
802 .ctrlbit = S5PC100_CLKGATE_SCLK1_LCD,
803 .enable = s5pc100_sclk1_ctrl,
804 .set_parent = s5pc100_setparent_clksrc,
805 .get_rate = s5pc100_getrate_clksrc,
806 .set_rate = s5pc100_setrate_clksrc,
807 .round_rate = s5pc100_roundrate_clksrc,
808 },
809 .shift = S5PC100_CLKSRC2_LCD_SHIFT,
810 .mask = S5PC100_CLKSRC2_LCD_MASK,
811 .sources = &clkset_lcd_fimc,
812 .divider_shift = S5PC100_CLKDIV3_LCD_SHIFT,
813 .reg_divider = S5PC100_CLKDIV3,
814 .reg_source = S5PC100_CLKSRC2,
815};
816
817static struct clksrc_clk clk_fimc0 = {
818 .clk = {
819 .name = "fimc",
820 .id = 0,
821 .ctrlbit = S5PC100_CLKGATE_SCLK1_FIMC0,
822 .enable = s5pc100_sclk1_ctrl,
823 .set_parent = s5pc100_setparent_clksrc,
824 .get_rate = s5pc100_getrate_clksrc,
825 .set_rate = s5pc100_setrate_clksrc,
826 .round_rate = s5pc100_roundrate_clksrc,
827 },
828 .shift = S5PC100_CLKSRC2_FIMC0_SHIFT,
829 .mask = S5PC100_CLKSRC2_FIMC0_MASK,
830 .sources = &clkset_lcd_fimc,
831 .divider_shift = S5PC100_CLKDIV3_FIMC0_SHIFT,
832 .reg_divider = S5PC100_CLKDIV3,
833 .reg_source = S5PC100_CLKSRC2,
834};
835
836static struct clksrc_clk clk_fimc1 = {
837 .clk = {
838 .name = "fimc",
839 .id = 1,
840 .ctrlbit = S5PC100_CLKGATE_SCLK1_FIMC1,
841 .enable = s5pc100_sclk1_ctrl,
842 .set_parent = s5pc100_setparent_clksrc,
843 .get_rate = s5pc100_getrate_clksrc,
844 .set_rate = s5pc100_setrate_clksrc,
845 .round_rate = s5pc100_roundrate_clksrc,
846 },
847 .shift = S5PC100_CLKSRC2_FIMC1_SHIFT,
848 .mask = S5PC100_CLKSRC2_FIMC1_MASK,
849 .sources = &clkset_lcd_fimc,
850 .divider_shift = S5PC100_CLKDIV3_FIMC1_SHIFT,
851 .reg_divider = S5PC100_CLKDIV3,
852 .reg_source = S5PC100_CLKSRC2,
853};
854
855static struct clksrc_clk clk_fimc2 = {
856 .clk = {
857 .name = "fimc",
858 .id = 2,
859 .ctrlbit = S5PC100_CLKGATE_SCLK1_FIMC2,
860 .enable = s5pc100_sclk1_ctrl,
861 .set_parent = s5pc100_setparent_clksrc,
862 .get_rate = s5pc100_getrate_clksrc,
863 .set_rate = s5pc100_setrate_clksrc,
864 .round_rate = s5pc100_roundrate_clksrc,
865 },
866 .shift = S5PC100_CLKSRC2_FIMC2_SHIFT,
867 .mask = S5PC100_CLKSRC2_FIMC2_MASK,
868 .sources = &clkset_lcd_fimc,
869 .divider_shift = S5PC100_CLKDIV3_FIMC2_SHIFT,
870 .reg_divider = S5PC100_CLKDIV3,
871 .reg_source = S5PC100_CLKSRC2,
872};
873
874static struct clk *clkset_mmc_list[] = {
875 &clk_mout_epll.clk,
876 &clk_dout_mpll,
877 &clk_fin_epll,
878 &clk_mout_hpll.clk ,
879};
880
881static struct clk_sources clkset_mmc = {
882 .sources = clkset_mmc_list,
883 .nr_sources = ARRAY_SIZE(clkset_mmc_list),
884};
885
886static struct clksrc_clk clk_mmc0 = {
887 .clk = {
888 .name = "mmc_bus",
889 .id = 0,
890 .ctrlbit = S5PC100_CLKGATE_SCLK0_MMC0,
891 .enable = s5pc100_sclk0_ctrl,
892 .set_parent = s5pc100_setparent_clksrc,
893 .get_rate = s5pc100_getrate_clksrc,
894 .set_rate = s5pc100_setrate_clksrc,
895 .round_rate = s5pc100_roundrate_clksrc,
896 },
897 .shift = S5PC100_CLKSRC2_MMC0_SHIFT,
898 .mask = S5PC100_CLKSRC2_MMC0_MASK,
899 .sources = &clkset_mmc,
900 .divider_shift = S5PC100_CLKDIV3_MMC0_SHIFT,
901 .reg_divider = S5PC100_CLKDIV3,
902 .reg_source = S5PC100_CLKSRC2,
903};
904
905static struct clksrc_clk clk_mmc1 = {
906 .clk = {
907 .name = "mmc_bus",
908 .id = 1,
909 .ctrlbit = S5PC100_CLKGATE_SCLK0_MMC1,
910 .enable = s5pc100_sclk0_ctrl,
911 .set_parent = s5pc100_setparent_clksrc,
912 .get_rate = s5pc100_getrate_clksrc,
913 .set_rate = s5pc100_setrate_clksrc,
914 .round_rate = s5pc100_roundrate_clksrc,
915 },
916 .shift = S5PC100_CLKSRC2_MMC1_SHIFT,
917 .mask = S5PC100_CLKSRC2_MMC1_MASK,
918 .sources = &clkset_mmc,
919 .divider_shift = S5PC100_CLKDIV3_MMC1_SHIFT,
920 .reg_divider = S5PC100_CLKDIV3,
921 .reg_source = S5PC100_CLKSRC2,
922};
923
924static struct clksrc_clk clk_mmc2 = {
925 .clk = {
926 .name = "mmc_bus",
927 .id = 2,
928 .ctrlbit = S5PC100_CLKGATE_SCLK0_MMC2,
929 .enable = s5pc100_sclk0_ctrl,
930 .set_parent = s5pc100_setparent_clksrc,
931 .get_rate = s5pc100_getrate_clksrc,
932 .set_rate = s5pc100_setrate_clksrc,
933 .round_rate = s5pc100_roundrate_clksrc,
934 },
935 .shift = S5PC100_CLKSRC2_MMC2_SHIFT,
936 .mask = S5PC100_CLKSRC2_MMC2_MASK,
937 .sources = &clkset_mmc,
938 .divider_shift = S5PC100_CLKDIV3_MMC2_SHIFT,
939 .reg_divider = S5PC100_CLKDIV3,
940 .reg_source = S5PC100_CLKSRC2,
941};
942
943
944static struct clk *clkset_usbhost_list[] = {
945 &clk_mout_epll.clk,
946 &clk_dout_mpll,
947 &clk_mout_hpll.clk,
948 &clk_48m,
949};
950
951static struct clk_sources clkset_usbhost = {
952 .sources = clkset_usbhost_list,
953 .nr_sources = ARRAY_SIZE(clkset_usbhost_list),
954};
955
956static struct clksrc_clk clk_usbhost = {
957 .clk = {
958 .name = "usbhost",
959 .id = -1,
960 .ctrlbit = S5PC100_CLKGATE_SCLK0_USBHOST,
961 .enable = s5pc100_sclk0_ctrl,
962 .set_parent = s5pc100_setparent_clksrc,
963 .get_rate = s5pc100_getrate_clksrc,
964 .set_rate = s5pc100_setrate_clksrc,
965 .round_rate = s5pc100_roundrate_clksrc,
966 },
967 .shift = S5PC100_CLKSRC1_UHOST_SHIFT,
968 .mask = S5PC100_CLKSRC1_UHOST_MASK,
969 .sources = &clkset_usbhost,
970 .divider_shift = S5PC100_CLKDIV2_UHOST_SHIFT,
971 .reg_divider = S5PC100_CLKDIV2,
972 .reg_source = S5PC100_CLKSRC1,
1012}; 973};
1013 974
1014/* Clock initialisation code */ 975/* Clock initialisation code */
1015 976
1016static struct clksrc_clk *init_parents[] = { 977static struct clksrc_clk *init_parents[] = {
1017 &clk_mout_apll, 978 &clk_mout_apll,
1018 &clk_mout_epll,
1019 &clk_mout_mpll, 979 &clk_mout_mpll,
980 &clk_mout_am,
981 &clk_mout_onenand,
982 &clk_mout_epll,
983 &clk_mout_hpll,
984 &clk_spi0,
985 &clk_spi1,
986 &clk_spi2,
1020 &clk_uart_uclk1, 987 &clk_uart_uclk1,
988 &clk_audio0,
989 &clk_audio1,
990 &clk_audio2,
991 &clk_spdif,
992 &clk_lcd,
993 &clk_fimc0,
994 &clk_fimc1,
995 &clk_fimc2,
996 &clk_mmc0,
997 &clk_mmc1,
998 &clk_mmc2,
999 &clk_usbhost,
1021}; 1000};
1022 1001
1023static void __init_or_cpufreq s5pc1xx_set_clksrc(struct clksrc_clk *clk) 1002static void __init_or_cpufreq s5pc100_set_clksrc(struct clksrc_clk *clk)
1024{ 1003{
1025 struct clk_sources *srcs = clk->sources; 1004 struct clk_sources *srcs = clk->sources;
1026 u32 clksrc = __raw_readl(clk->reg_source); 1005 u32 clksrc = __raw_readl(clk->reg_source);
@@ -1036,9 +1015,9 @@ static void __init_or_cpufreq s5pc1xx_set_clksrc(struct clksrc_clk *clk)
1036 1015
1037 clk->clk.parent = srcs->sources[clksrc]; 1016 clk->clk.parent = srcs->sources[clksrc];
1038 1017
1039 printk(KERN_INFO "%s: source is %s (%d), rate is %ld\n", 1018 printk(KERN_INFO "%s: source is %s (%d), rate is %ld.%03ld MHz\n",
1040 clk->clk.name, clk->clk.parent->name, clksrc, 1019 clk->clk.name, clk->clk.parent->name, clksrc,
1041 clk_get_rate(&clk->clk)); 1020 print_mhz(clk_get_rate(&clk->clk)));
1042} 1021}
1043 1022
1044#define GET_DIV(clk, field) ((((clk) & field##_MASK) >> field##_SHIFT) + 1) 1023#define GET_DIV(clk, field) ((((clk) & field##_MASK) >> field##_SHIFT) + 1)
@@ -1052,20 +1031,16 @@ void __init_or_cpufreq s5pc100_setup_clocks(void)
1052 unsigned long hclk; 1031 unsigned long hclk;
1053 unsigned long pclkd0; 1032 unsigned long pclkd0;
1054 unsigned long pclk; 1033 unsigned long pclk;
1055 unsigned long apll; 1034 unsigned long apll, mpll, epll, hpll;
1056 unsigned long mpll;
1057 unsigned long hpll;
1058 unsigned long epll;
1059 unsigned int ptr; 1035 unsigned int ptr;
1060 u32 clkdiv0, clkdiv1; 1036 u32 clkdiv0, clkdiv1;
1061 1037
1062 printk(KERN_DEBUG "%s: registering clocks\n", __func__); 1038 printk(KERN_DEBUG "%s: registering clocks\n", __func__);
1063 1039
1064 clkdiv0 = __raw_readl(S5PC1XX_CLK_DIV0); 1040 clkdiv0 = __raw_readl(S5PC100_CLKDIV0);
1065 clkdiv1 = __raw_readl(S5PC1XX_CLK_DIV1); 1041 clkdiv1 = __raw_readl(S5PC100_CLKDIV1);
1066 1042
1067 printk(KERN_DEBUG "%s: clkdiv0 = %08x, clkdiv1 = %08x\n", 1043 printk(KERN_DEBUG "%s: clkdiv0 = %08x, clkdiv1 = %08x\n", __func__, clkdiv0, clkdiv1);
1068 __func__, clkdiv0, clkdiv1);
1069 1044
1070 xtal_clk = clk_get(NULL, "xtal"); 1045 xtal_clk = clk_get(NULL, "xtal");
1071 BUG_ON(IS_ERR(xtal_clk)); 1046 BUG_ON(IS_ERR(xtal_clk));
@@ -1075,48 +1050,81 @@ void __init_or_cpufreq s5pc100_setup_clocks(void)
1075 1050
1076 printk(KERN_DEBUG "%s: xtal is %ld\n", __func__, xtal); 1051 printk(KERN_DEBUG "%s: xtal is %ld\n", __func__, xtal);
1077 1052
1078 apll = s5pc1xx_get_pll(xtal, __raw_readl(S5PC1XX_APLL_CON)); 1053 apll = s5pc1xx_get_pll(xtal, __raw_readl(S5PC100_APLL_CON));
1079 mpll = s5pc1xx_get_pll(xtal, __raw_readl(S5PC1XX_MPLL_CON)); 1054 mpll = s5pc1xx_get_pll(xtal, __raw_readl(S5PC100_MPLL_CON));
1080 epll = s5pc1xx_get_pll(xtal, __raw_readl(S5PC1XX_EPLL_CON)); 1055 epll = s5pc1xx_get_pll(xtal, __raw_readl(S5PC100_EPLL_CON));
1081 hpll = s5pc1xx_get_pll(xtal, __raw_readl(S5PC100_HPLL_CON)); 1056 hpll = s5pc1xx_get_pll(xtal, __raw_readl(S5PC100_HPLL_CON));
1082 1057
1083 printk(KERN_INFO "S5PC100: PLL settings, A=%ld, M=%ld, E=%ld, H=%ld\n", 1058 printk(KERN_INFO "S5PC100: Apll=%ld.%03ld Mhz, Mpll=%ld.%03ld Mhz"
1084 apll, mpll, epll, hpll); 1059 ", Epll=%ld.%03ld Mhz, Hpll=%ld.%03ld Mhz\n",
1060 print_mhz(apll), print_mhz(mpll),
1061 print_mhz(epll), print_mhz(hpll));
1085 1062
1086 armclk = apll / GET_DIV(clkdiv0, S5PC1XX_CLKDIV0_APLL); 1063 armclk = apll / GET_DIV(clkdiv0, S5PC100_CLKDIV0_APLL);
1087 armclk = armclk / GET_DIV(clkdiv0, S5PC100_CLKDIV0_ARM); 1064 armclk = armclk / GET_DIV(clkdiv0, S5PC100_CLKDIV0_ARM);
1088 hclkd0 = armclk / GET_DIV(clkdiv0, S5PC100_CLKDIV0_D0); 1065 hclkd0 = armclk / GET_DIV(clkdiv0, S5PC100_CLKDIV0_D0);
1089 pclkd0 = hclkd0 / GET_DIV(clkdiv0, S5PC100_CLKDIV0_PCLKD0); 1066 pclkd0 = hclkd0 / GET_DIV(clkdiv0, S5PC100_CLKDIV0_PCLKD0);
1090 hclk = mpll / GET_DIV(clkdiv1, S5PC100_CLKDIV1_D1); 1067 hclk = mpll / GET_DIV(clkdiv1, S5PC100_CLKDIV1_D1);
1091 pclk = hclk / GET_DIV(clkdiv1, S5PC100_CLKDIV1_PCLKD1); 1068 pclk = hclk / GET_DIV(clkdiv1, S5PC100_CLKDIV1_PCLKD1);
1092 1069
1093 printk(KERN_INFO "S5PC100: ARMCLK=%ld, HCLKD0=%ld, PCLKD0=%ld, HCLK=%ld, PCLK=%ld\n", 1070 printk(KERN_INFO "S5PC100: ARMCLK=%ld.%03ld MHz, HCLKD0=%ld.%03ld MHz,"
1094 armclk, hclkd0, pclkd0, hclk, pclk); 1071 " PCLKD0=%ld.%03ld MHz\n, HCLK=%ld.%03ld MHz,"
1072 " PCLK=%ld.%03ld MHz\n",
1073 print_mhz(armclk), print_mhz(hclkd0),
1074 print_mhz(pclkd0), print_mhz(hclk), print_mhz(pclk));
1095 1075
1096 clk_fout_apll.rate = apll; 1076 clk_fout_apll.rate = apll;
1097 clk_fout_mpll.rate = mpll; 1077 clk_fout_mpll.rate = mpll;
1098 clk_fout_epll.rate = epll; 1078 clk_fout_epll.rate = epll;
1099 clk_fout_apll.rate = apll; 1079 clk_fout_hpll.rate = hpll;
1100 1080
1101 clk_h.rate = hclk; 1081 clk_h.rate = hclk;
1102 clk_p.rate = pclk; 1082 clk_p.rate = pclk;
1083 clk_f.rate = armclk;
1103 1084
1104 for (ptr = 0; ptr < ARRAY_SIZE(init_parents); ptr++) 1085 for (ptr = 0; ptr < ARRAY_SIZE(init_parents); ptr++)
1105 s5pc1xx_set_clksrc(init_parents[ptr]); 1086 s5pc100_set_clksrc(init_parents[ptr]);
1106} 1087}
1107 1088
1108static struct clk *clks[] __initdata = { 1089static struct clk *clks[] __initdata = {
1109 &clk_ext_xtal_mux, 1090 &clk_ext_xtal_mux,
1110 &clk_mout_epll.clk, 1091 &clk_mout_apll.clk,
1111 &clk_fout_epll, 1092 &clk_dout_apll,
1093 &clk_dout_d0_bus,
1094 &clk_dout_pclkd0,
1095 &clk_dout_apll2,
1112 &clk_mout_mpll.clk, 1096 &clk_mout_mpll.clk,
1097 &clk_mout_am.clk,
1098 &clk_dout_d1_bus,
1099 &clk_mout_onenand.clk,
1100 &clk_dout_pclkd1,
1101 &clk_dout_mpll2,
1102 &clk_dout_cam,
1113 &clk_dout_mpll, 1103 &clk_dout_mpll,
1104 &clk_mout_epll.clk,
1105 &clk_fout_epll,
1106 &clk_iis_cd0,
1107 &clk_iis_cd1,
1108 &clk_iis_cd2,
1109 &clk_pcm_cd0,
1110 &clk_pcm_cd1,
1111 &clk_spi0.clk,
1112 &clk_spi1.clk,
1113 &clk_spi2.clk,
1114 &clk_uart_uclk1.clk, 1114 &clk_uart_uclk1.clk,
1115 &clk_ext, 1115 &clk_audio0.clk,
1116 &clk_epll, 1116 &clk_audio1.clk,
1117 &clk_27m, 1117 &clk_audio2.clk,
1118 &clk_48m, 1118 &clk_spdif.clk,
1119 &clk_54m, 1119 &clk_lcd.clk,
1120 &clk_fimc0.clk,
1121 &clk_fimc1.clk,
1122 &clk_fimc2.clk,
1123 &clk_mmc0.clk,
1124 &clk_mmc1.clk,
1125 &clk_mmc2.clk,
1126 &clk_usbhost.clk,
1127 &clk_arm,
1120}; 1128};
1121 1129
1122void __init s5pc100_register_clocks(void) 1130void __init s5pc100_register_clocks(void)
@@ -1133,7 +1141,4 @@ void __init s5pc100_register_clocks(void)
1133 clkp->name, ret); 1141 clkp->name, ret);
1134 } 1142 }
1135 } 1143 }
1136
1137 clk_mpll.parent = &clk_mout_mpll.clk;
1138 clk_epll.parent = &clk_mout_epll.clk;
1139} 1144}
diff --git a/arch/arm/plat-s5pc1xx/setup-fb-24bpp.c b/arch/arm/plat-s5pc1xx/setup-fb-24bpp.c
new file mode 100644
index 000000000000..1a63768a9a2e
--- /dev/null
+++ b/arch/arm/plat-s5pc1xx/setup-fb-24bpp.c
@@ -0,0 +1,49 @@
1/*
2 * linux/arch/arm/plat-s5pc100/setup-fb-24bpp.c
3 *
4 * Copyright 2009 Samsung Electronics
5 *
6 * Base S5PC1XX setup information for 24bpp LCD framebuffer
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/kernel.h>
14#include <linux/types.h>
15#include <linux/fb.h>
16#include <linux/gpio.h>
17
18#include <mach/regs-fb.h>
19#include <mach/map.h>
20#include <plat/fb.h>
21#include <plat/gpio-cfg.h>
22#include <plat/gpio-cfg-s5pc1xx.h>
23
24#define DISR_OFFSET 0x7008
25
26void s5pc100_fb_gpio_setup_24bpp(void)
27{
28 unsigned int gpio = 0;
29
30 for (gpio = S5PC100_GPF0(0); gpio <= S5PC100_GPF0(7); gpio++) {
31 s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(2));
32 s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
33 }
34
35 for (gpio = S5PC100_GPF1(0); gpio <= S5PC100_GPF1(7); gpio++) {
36 s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(2));
37 s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
38 }
39
40 for (gpio = S5PC100_GPF2(0); gpio <= S5PC100_GPF2(7); gpio++) {
41 s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(2));
42 s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
43 }
44
45 for (gpio = S5PC100_GPF3(0); gpio <= S5PC100_GPF3(3); gpio++) {
46 s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(2));
47 s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
48 }
49}
diff --git a/arch/arm/plat-s5pc1xx/setup-i2c0.c b/arch/arm/plat-s5pc1xx/setup-i2c0.c
index 3d00c025fffb..5e4a7c3a231e 100644
--- a/arch/arm/plat-s5pc1xx/setup-i2c0.c
+++ b/arch/arm/plat-s5pc1xx/setup-i2c0.c
@@ -17,9 +17,14 @@
17 17
18struct platform_device; /* don't need the contents */ 18struct platform_device; /* don't need the contents */
19 19
20#include <linux/gpio.h>
20#include <plat/iic.h> 21#include <plat/iic.h>
22#include <plat/gpio-cfg.h>
21 23
22void s3c_i2c0_cfg_gpio(struct platform_device *dev) 24void s3c_i2c0_cfg_gpio(struct platform_device *dev)
23{ 25{
24 /* Pin configuration would be needed */ 26 s3c_gpio_cfgpin(S5PC100_GPD(3), S3C_GPIO_SFN(2));
27 s3c_gpio_setpull(S5PC100_GPD(3), S3C_GPIO_PULL_UP);
28 s3c_gpio_cfgpin(S5PC100_GPD(4), S3C_GPIO_SFN(2));
29 s3c_gpio_setpull(S5PC100_GPD(4), S3C_GPIO_PULL_UP);
25} 30}
diff --git a/arch/arm/plat-s5pc1xx/setup-i2c1.c b/arch/arm/plat-s5pc1xx/setup-i2c1.c
index c8f3ca42f51d..a0a8b4ae6ad8 100644
--- a/arch/arm/plat-s5pc1xx/setup-i2c1.c
+++ b/arch/arm/plat-s5pc1xx/setup-i2c1.c
@@ -17,9 +17,14 @@
17 17
18struct platform_device; /* don't need the contents */ 18struct platform_device; /* don't need the contents */
19 19
20#include <linux/gpio.h>
20#include <plat/iic.h> 21#include <plat/iic.h>
22#include <plat/gpio-cfg.h>
21 23
22void s3c_i2c1_cfg_gpio(struct platform_device *dev) 24void s3c_i2c1_cfg_gpio(struct platform_device *dev)
23{ 25{
24 /* Pin configuration would be needed */ 26 s3c_gpio_cfgpin(S5PC100_GPD(5), S3C_GPIO_SFN(2));
27 s3c_gpio_setpull(S5PC100_GPD(5), S3C_GPIO_PULL_UP);
28 s3c_gpio_cfgpin(S5PC100_GPD(6), S3C_GPIO_SFN(2));
29 s3c_gpio_setpull(S5PC100_GPD(6), S3C_GPIO_PULL_UP);
25} 30}
diff --git a/arch/arm/plat-s5pc1xx/setup-sdhci-gpio.c b/arch/arm/plat-s5pc1xx/setup-sdhci-gpio.c
new file mode 100644
index 000000000000..185c8941e644
--- /dev/null
+++ b/arch/arm/plat-s5pc1xx/setup-sdhci-gpio.c
@@ -0,0 +1,86 @@
1/* linux/arch/arm/plat-s5pc1xx/setup-sdhci-gpio.c
2 *
3 * Copyright 2009 Samsung Eletronics
4 *
5 * S5PC1XX - Helper functions for setting up SDHCI device(s) GPIO (HSMMC)
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10*/
11
12#include <linux/kernel.h>
13#include <linux/types.h>
14#include <linux/interrupt.h>
15#include <linux/platform_device.h>
16#include <linux/io.h>
17#include <linux/gpio.h>
18#include <linux/mmc/host.h>
19#include <linux/mmc/card.h>
20
21#include <plat/gpio-cfg.h>
22#include <plat/regs-sdhci.h>
23
24void s5pc100_setup_sdhci0_cfg_gpio(struct platform_device *dev, int width)
25{
26 unsigned int gpio;
27 unsigned int end;
28 unsigned int num;
29
30 num = width;
31 /* In case of 8 width, we should decrease the 2 */
32 if (width == 8)
33 num = width - 2;
34
35 end = S5PC100_GPG0(2 + num);
36
37 /* Set all the necessary GPG0/GPG1 pins to special-function 0 */
38 for (gpio = S5PC100_GPG0(0); gpio < end; gpio++) {
39 s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(2));
40 s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
41 }
42
43 if (width == 8) {
44 for (gpio = S5PC100_GPG1(0); gpio <= S5PC100_GPG1(1); gpio++) {
45 s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(2));
46 s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
47 }
48 }
49
50 s3c_gpio_setpull(S5PC100_GPG1(2), S3C_GPIO_PULL_UP);
51 s3c_gpio_cfgpin(S5PC100_GPG1(2), S3C_GPIO_SFN(2));
52}
53
54void s5pc100_setup_sdhci1_cfg_gpio(struct platform_device *dev, int width)
55{
56 unsigned int gpio;
57 unsigned int end;
58
59 end = S5PC100_GPG2(2 + width);
60
61 /* Set all the necessary GPG2 pins to special-function 2 */
62 for (gpio = S5PC100_GPG2(0); gpio < end; gpio++) {
63 s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(2));
64 s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
65 }
66
67 s3c_gpio_setpull(S5PC100_GPG2(6), S3C_GPIO_PULL_UP);
68 s3c_gpio_cfgpin(S5PC100_GPG2(6), S3C_GPIO_SFN(2));
69}
70
71void s5pc100_setup_sdhci2_cfg_gpio(struct platform_device *dev, int width)
72{
73 unsigned int gpio;
74 unsigned int end;
75
76 end = S5PC100_GPG3(2 + width);
77
78 /* Set all the necessary GPG3 pins to special-function 2 */
79 for (gpio = S5PC100_GPG3(0); gpio < end; gpio++) {
80 s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(2));
81 s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
82 }
83
84 s3c_gpio_setpull(S5PC100_GPG3(6), S3C_GPIO_PULL_UP);
85 s3c_gpio_cfgpin(S5PC100_GPG3(6), S3C_GPIO_SFN(2));
86}
diff --git a/arch/arm/plat-samsung/Kconfig b/arch/arm/plat-samsung/Kconfig
new file mode 100644
index 000000000000..486a0d6301e7
--- /dev/null
+++ b/arch/arm/plat-samsung/Kconfig
@@ -0,0 +1,17 @@
1# arch/arm/plat-samsung/Kconfig
2#
3# Copyright 2009 Simtec Electronics
4#
5# Licensed under GPLv2
6
7config PLAT_SAMSUNG
8 bool
9 depends on ARCH_S3C2410 || ARCH_S3C24A0 || ARCH_S3C64XX || ARCH_S5PC1XX
10 default y
11 help
12 Base platform code for all Samsung SoC based systems
13
14if PLAT_SAMSUNG
15
16
17endif
diff --git a/arch/arm/plat-samsung/Makefile b/arch/arm/plat-samsung/Makefile
new file mode 100644
index 000000000000..4478b9f7dc34
--- /dev/null
+++ b/arch/arm/plat-samsung/Makefile
@@ -0,0 +1,11 @@
1# arch/arm/plat-s3c64xx/Makefile
2#
3# Copyright 2009 Simtec Electronics
4#
5# Licensed under GPLv2
6
7obj-y :=
8obj-m :=
9obj-n := dummy.o
10obj- :=
11