aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/arm/Kconfig13
-rw-r--r--arch/arm/Makefile3
-rw-r--r--arch/arm/common/vic.c8
-rw-r--r--arch/arm/configs/s3c6400_defconfig733
-rw-r--r--arch/arm/include/asm/hardware/vic.h10
-rw-r--r--arch/arm/mach-s3c2410/include/mach/map.h80
-rw-r--r--arch/arm/mach-s3c2410/include/mach/tick.h15
-rw-r--r--arch/arm/mach-s3c2410/include/mach/uncompress.h1
-rw-r--r--arch/arm/mach-s3c2412/clock.c7
-rw-r--r--arch/arm/mach-s3c2443/clock.c17
-rw-r--r--arch/arm/mach-s3c24a0/include/mach/debug-macro.S28
-rw-r--r--arch/arm/mach-s3c24a0/include/mach/io.h16
-rw-r--r--arch/arm/mach-s3c24a0/include/mach/irqs.h115
-rw-r--r--arch/arm/mach-s3c24a0/include/mach/map.h85
-rw-r--r--arch/arm/mach-s3c24a0/include/mach/memory.h19
-rw-r--r--arch/arm/mach-s3c24a0/include/mach/regs-clock.h88
-rw-r--r--arch/arm/mach-s3c24a0/include/mach/regs-irq.h25
-rw-r--r--arch/arm/mach-s3c24a0/include/mach/system.h25
-rw-r--r--arch/arm/mach-s3c24a0/include/mach/tick.h15
-rw-r--r--arch/arm/mach-s3c24a0/include/mach/timex.h18
-rw-r--r--arch/arm/mach-s3c24a0/include/mach/vmalloc.h17
-rw-r--r--arch/arm/mach-s3c6400/Kconfig8
-rw-r--r--arch/arm/mach-s3c6400/Makefile15
-rw-r--r--arch/arm/mach-s3c6400/Makefile.boot2
-rw-r--r--arch/arm/mach-s3c6400/include/mach/debug-macro.S39
-rw-r--r--arch/arm/mach-s3c6400/include/mach/dma.h16
-rw-r--r--arch/arm/mach-s3c6400/include/mach/entry-macro.S44
-rw-r--r--arch/arm/mach-s3c6400/include/mach/gpio.h22
-rw-r--r--arch/arm/mach-s3c6400/include/mach/hardware.h16
-rw-r--r--arch/arm/mach-s3c6400/include/mach/irqs.h20
-rw-r--r--arch/arm/mach-s3c6400/include/mach/map.h53
-rw-r--r--arch/arm/mach-s3c6400/include/mach/memory.h21
-rw-r--r--arch/arm/mach-s3c6400/include/mach/pwm-clock.h56
-rw-r--r--arch/arm/mach-s3c6400/include/mach/regs-irq.h20
-rw-r--r--arch/arm/mach-s3c6400/include/mach/system.h24
-rw-r--r--arch/arm/mach-s3c6400/include/mach/tick.h29
-rw-r--r--arch/arm/mach-s3c6400/include/mach/uncompress.h28
-rw-r--r--arch/arm/mach-s3c6410/Kconfig21
-rw-r--r--arch/arm/mach-s3c6410/Makefile19
-rw-r--r--arch/arm/mach-s3c6410/cpu.c91
-rw-r--r--arch/arm/mach-s3c6410/mach-smdk6410.c89
-rw-r--r--arch/arm/plat-s3c/Kconfig12
-rw-r--r--arch/arm/plat-s3c/clock.c10
-rw-r--r--arch/arm/plat-s3c/include/plat/clock.h16
-rw-r--r--arch/arm/plat-s3c/include/plat/cpu.h2
-rw-r--r--arch/arm/plat-s3c/include/plat/debug-macro.S2
-rw-r--r--arch/arm/plat-s3c/include/plat/devs.h1
-rw-r--r--arch/arm/plat-s3c/include/plat/map-base.h (renamed from arch/arm/plat-s3c/include/plat/map.h)0
-rw-r--r--arch/arm/plat-s3c/include/plat/regs-serial.h14
-rw-r--r--arch/arm/plat-s3c/include/plat/regs-timer.h11
-rw-r--r--arch/arm/plat-s3c/include/plat/uncompress.h2
-rw-r--r--arch/arm/plat-s3c/pwm-clock.c71
-rw-r--r--arch/arm/plat-s3c/time.c81
-rw-r--r--arch/arm/plat-s3c24xx/Kconfig4
-rw-r--r--arch/arm/plat-s3c24xx/devs.c8
-rw-r--r--arch/arm/plat-s3c24xx/include/mach/pwm-clock.h55
-rw-r--r--arch/arm/plat-s3c24xx/include/plat/map.h100
-rw-r--r--arch/arm/plat-s3c24xx/s3c2410-clock.c1
-rw-r--r--arch/arm/plat-s3c64xx/Kconfig36
-rw-r--r--arch/arm/plat-s3c64xx/Makefile24
-rw-r--r--arch/arm/plat-s3c64xx/clock.c282
-rw-r--r--arch/arm/plat-s3c64xx/cpu.c115
-rw-r--r--arch/arm/plat-s3c64xx/dev-uart.c176
-rw-r--r--arch/arm/plat-s3c64xx/include/plat/irqs.h196
-rw-r--r--arch/arm/plat-s3c64xx/include/plat/pll.h74
-rw-r--r--arch/arm/plat-s3c64xx/include/plat/regs-clock.h224
-rw-r--r--arch/arm/plat-s3c64xx/include/plat/regs-sys.h24
-rw-r--r--arch/arm/plat-s3c64xx/include/plat/s3c6400.h35
-rw-r--r--arch/arm/plat-s3c64xx/include/plat/s3c6410.h29
-rw-r--r--arch/arm/plat-s3c64xx/irq-eint.c202
-rw-r--r--arch/arm/plat-s3c64xx/irq.c257
-rw-r--r--arch/arm/plat-s3c64xx/s3c6400-clock.c655
-rw-r--r--arch/arm/plat-s3c64xx/s3c6400-init.c29
-rw-r--r--drivers/serial/Kconfig15
-rw-r--r--drivers/serial/Makefile2
-rw-r--r--drivers/serial/s3c24a0.c118
-rw-r--r--drivers/serial/s3c6400.c151
-rw-r--r--drivers/serial/samsung.c55
-rw-r--r--drivers/serial/samsung.h3
-rw-r--r--include/linux/serial_core.h2
80 files changed, 4849 insertions, 216 deletions
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 4546f8b2ce8..f512b5530ef 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -517,6 +517,13 @@ config ARCH_S3C2410
517 BAST (<http://www.simtec.co.uk/products/EB110ITX/>), the IPAQ 1940 or 517 BAST (<http://www.simtec.co.uk/products/EB110ITX/>), the IPAQ 1940 or
518 the Samsung SMDK2410 development board (and derivatives). 518 the Samsung SMDK2410 development board (and derivatives).
519 519
520config ARCH_S3C64XX
521 bool "Samsung S3C64XX"
522 select GENERIC_GPIO
523 select HAVE_CLK
524 help
525 Samsung S3C64XX series based systems
526
520config ARCH_SHARK 527config ARCH_SHARK
521 bool "Shark" 528 bool "Shark"
522 select CPU_SA110 529 select CPU_SA110
@@ -620,6 +627,7 @@ source "arch/arm/mach-orion5x/Kconfig"
620source "arch/arm/mach-kirkwood/Kconfig" 627source "arch/arm/mach-kirkwood/Kconfig"
621 628
622source "arch/arm/plat-s3c24xx/Kconfig" 629source "arch/arm/plat-s3c24xx/Kconfig"
630source "arch/arm/plat-s3c64xx/Kconfig"
623source "arch/arm/plat-s3c/Kconfig" 631source "arch/arm/plat-s3c/Kconfig"
624 632
625if ARCH_S3C2410 633if ARCH_S3C2410
@@ -631,6 +639,11 @@ source "arch/arm/mach-s3c2442/Kconfig"
631source "arch/arm/mach-s3c2443/Kconfig" 639source "arch/arm/mach-s3c2443/Kconfig"
632endif 640endif
633 641
642if ARCH_S3C64XX
643source "arch/arm/mach-s3c6400/Kconfig"
644source "arch/arm/mach-s3c6410/Kconfig"
645endif
646
634source "arch/arm/mach-lh7a40x/Kconfig" 647source "arch/arm/mach-lh7a40x/Kconfig"
635 648
636source "arch/arm/mach-imx/Kconfig" 649source "arch/arm/mach-imx/Kconfig"
diff --git a/arch/arm/Makefile b/arch/arm/Makefile
index 260864f3f01..3ce88d719ce 100644
--- a/arch/arm/Makefile
+++ b/arch/arm/Makefile
@@ -121,7 +121,10 @@ endif
121 machine-$(CONFIG_ARCH_OMAP3) := omap2 121 machine-$(CONFIG_ARCH_OMAP3) := omap2
122 plat-$(CONFIG_ARCH_OMAP) := omap 122 plat-$(CONFIG_ARCH_OMAP) := omap
123 machine-$(CONFIG_ARCH_S3C2410) := s3c2410 s3c2400 s3c2412 s3c2440 s3c2442 s3c2443 123 machine-$(CONFIG_ARCH_S3C2410) := s3c2410 s3c2400 s3c2412 s3c2440 s3c2442 s3c2443
124 machine-$(CONFIG_ARCH_S3C24A0) := s3c24a0
124 plat-$(CONFIG_PLAT_S3C24XX) := s3c24xx s3c 125 plat-$(CONFIG_PLAT_S3C24XX) := s3c24xx s3c
126 machine-$(CONFIG_ARCH_S3C64XX) := s3c6400 s3c6410
127 plat-$(CONFIG_PLAT_S3C64XX) := s3c64xx s3c
125 machine-$(CONFIG_ARCH_LH7A40X) := lh7a40x 128 machine-$(CONFIG_ARCH_LH7A40X) := lh7a40x
126 machine-$(CONFIG_ARCH_VERSATILE) := versatile 129 machine-$(CONFIG_ARCH_VERSATILE) := versatile
127 machine-$(CONFIG_ARCH_IMX) := imx 130 machine-$(CONFIG_ARCH_IMX) := imx
diff --git a/arch/arm/common/vic.c b/arch/arm/common/vic.c
index f1e4b8f60ca..ecf0bfbab10 100644
--- a/arch/arm/common/vic.c
+++ b/arch/arm/common/vic.c
@@ -69,12 +69,12 @@ void __init vic_init(void __iomem *base, unsigned int irq_start,
69 /* 69 /*
70 * Make sure we clear all existing interrupts 70 * Make sure we clear all existing interrupts
71 */ 71 */
72 writel(0, base + VIC_VECT_ADDR); 72 writel(0, base + VIC_PL190_VECT_ADDR);
73 for (i = 0; i < 19; i++) { 73 for (i = 0; i < 19; i++) {
74 unsigned int value; 74 unsigned int value;
75 75
76 value = readl(base + VIC_VECT_ADDR); 76 value = readl(base + VIC_PL190_VECT_ADDR);
77 writel(value, base + VIC_VECT_ADDR); 77 writel(value, base + VIC_PL190_VECT_ADDR);
78 } 78 }
79 79
80 for (i = 0; i < 16; i++) { 80 for (i = 0; i < 16; i++) {
@@ -82,7 +82,7 @@ void __init vic_init(void __iomem *base, unsigned int irq_start,
82 writel(VIC_VECT_CNTL_ENABLE | i, reg); 82 writel(VIC_VECT_CNTL_ENABLE | i, reg);
83 } 83 }
84 84
85 writel(32, base + VIC_DEF_VECT_ADDR); 85 writel(32, base + VIC_PL190_DEF_VECT_ADDR);
86 86
87 for (i = 0; i < 32; i++) { 87 for (i = 0; i < 32; i++) {
88 unsigned int irq = irq_start + i; 88 unsigned int irq = irq_start + i;
diff --git a/arch/arm/configs/s3c6400_defconfig b/arch/arm/configs/s3c6400_defconfig
new file mode 100644
index 00000000000..3a50716d443
--- /dev/null
+++ b/arch/arm/configs/s3c6400_defconfig
@@ -0,0 +1,733 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.27
4# Fri Oct 17 09:20:54 2008
5#
6CONFIG_ARM=y
7CONFIG_SYS_SUPPORTS_APM_EMULATION=y
8CONFIG_GENERIC_GPIO=y
9# CONFIG_GENERIC_TIME is not set
10# CONFIG_GENERIC_CLOCKEVENTS is not set
11CONFIG_MMU=y
12CONFIG_NO_IOPORT=y
13CONFIG_GENERIC_HARDIRQS=y
14CONFIG_STACKTRACE_SUPPORT=y
15CONFIG_HAVE_LATENCYTOP_SUPPORT=y
16CONFIG_LOCKDEP_SUPPORT=y
17CONFIG_TRACE_IRQFLAGS_SUPPORT=y
18CONFIG_HARDIRQS_SW_RESEND=y
19CONFIG_GENERIC_IRQ_PROBE=y
20CONFIG_RWSEM_GENERIC_SPINLOCK=y
21# CONFIG_ARCH_HAS_ILOG2_U32 is not set
22# CONFIG_ARCH_HAS_ILOG2_U64 is not set
23CONFIG_GENERIC_HWEIGHT=y
24CONFIG_GENERIC_CALIBRATE_DELAY=y
25CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
26CONFIG_VECTORS_BASE=0xffff0000
27CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
28
29#
30# General setup
31#
32CONFIG_EXPERIMENTAL=y
33CONFIG_BROKEN_ON_SMP=y
34CONFIG_INIT_ENV_ARG_LIMIT=32
35CONFIG_LOCALVERSION=""
36CONFIG_LOCALVERSION_AUTO=y
37CONFIG_SWAP=y
38# CONFIG_SYSVIPC is not set
39# CONFIG_BSD_PROCESS_ACCT is not set
40# CONFIG_IKCONFIG is not set
41CONFIG_LOG_BUF_SHIFT=17
42# CONFIG_CGROUPS is not set
43# CONFIG_GROUP_SCHED is not set
44CONFIG_SYSFS_DEPRECATED=y
45CONFIG_SYSFS_DEPRECATED_V2=y
46# CONFIG_RELAY is not set
47CONFIG_NAMESPACES=y
48# CONFIG_UTS_NS is not set
49# CONFIG_USER_NS is not set
50# CONFIG_PID_NS is not set
51CONFIG_BLK_DEV_INITRD=y
52CONFIG_INITRAMFS_SOURCE=""
53CONFIG_CC_OPTIMIZE_FOR_SIZE=y
54CONFIG_SYSCTL=y
55# CONFIG_EMBEDDED is not set
56CONFIG_UID16=y
57CONFIG_SYSCTL_SYSCALL=y
58CONFIG_KALLSYMS=y
59CONFIG_KALLSYMS_ALL=y
60# CONFIG_KALLSYMS_EXTRA_PASS is not set
61CONFIG_HOTPLUG=y
62CONFIG_PRINTK=y
63CONFIG_BUG=y
64CONFIG_ELF_CORE=y
65CONFIG_COMPAT_BRK=y
66CONFIG_BASE_FULL=y
67CONFIG_FUTEX=y
68CONFIG_ANON_INODES=y
69CONFIG_EPOLL=y
70CONFIG_SIGNALFD=y
71CONFIG_TIMERFD=y
72CONFIG_EVENTFD=y
73CONFIG_SHMEM=y
74CONFIG_AIO=y
75CONFIG_VM_EVENT_COUNTERS=y
76CONFIG_SLUB_DEBUG=y
77# CONFIG_SLAB is not set
78CONFIG_SLUB=y
79# CONFIG_SLOB is not set
80# CONFIG_PROFILING is not set
81# CONFIG_MARKERS is not set
82CONFIG_HAVE_OPROFILE=y
83# CONFIG_KPROBES is not set
84CONFIG_HAVE_KPROBES=y
85CONFIG_HAVE_KRETPROBES=y
86CONFIG_HAVE_CLK=y
87CONFIG_HAVE_GENERIC_DMA_COHERENT=y
88CONFIG_SLABINFO=y
89CONFIG_RT_MUTEXES=y
90# CONFIG_TINY_SHMEM is not set
91CONFIG_BASE_SMALL=0
92CONFIG_MODULES=y
93# CONFIG_MODULE_FORCE_LOAD is not set
94CONFIG_MODULE_UNLOAD=y
95# CONFIG_MODULE_FORCE_UNLOAD is not set
96# CONFIG_MODVERSIONS is not set
97# CONFIG_MODULE_SRCVERSION_ALL is not set
98CONFIG_KMOD=y
99CONFIG_BLOCK=y
100CONFIG_LBD=y
101# CONFIG_BLK_DEV_IO_TRACE is not set
102CONFIG_LSF=y
103# CONFIG_BLK_DEV_BSG is not set
104# CONFIG_BLK_DEV_INTEGRITY is not set
105
106#
107# IO Schedulers
108#
109CONFIG_IOSCHED_NOOP=y
110CONFIG_IOSCHED_AS=y
111CONFIG_IOSCHED_DEADLINE=y
112CONFIG_IOSCHED_CFQ=y
113# CONFIG_DEFAULT_AS is not set
114# CONFIG_DEFAULT_DEADLINE is not set
115CONFIG_DEFAULT_CFQ=y
116# CONFIG_DEFAULT_NOOP is not set
117CONFIG_DEFAULT_IOSCHED="cfq"
118CONFIG_CLASSIC_RCU=y
119
120#
121# System Type
122#
123# CONFIG_ARCH_AAEC2000 is not set
124# CONFIG_ARCH_INTEGRATOR is not set
125# CONFIG_ARCH_REALVIEW is not set
126# CONFIG_ARCH_VERSATILE is not set
127# CONFIG_ARCH_AT91 is not set
128# CONFIG_ARCH_CLPS7500 is not set
129# CONFIG_ARCH_CLPS711X is not set
130# CONFIG_ARCH_EBSA110 is not set
131# CONFIG_ARCH_EP93XX is not set
132# CONFIG_ARCH_FOOTBRIDGE is not set
133# CONFIG_ARCH_NETX is not set
134# CONFIG_ARCH_H720X is not set
135# CONFIG_ARCH_IMX is not set
136# CONFIG_ARCH_IOP13XX is not set
137# CONFIG_ARCH_IOP32X is not set
138# CONFIG_ARCH_IOP33X is not set
139# CONFIG_ARCH_IXP23XX is not set
140# CONFIG_ARCH_IXP2000 is not set
141# CONFIG_ARCH_IXP4XX is not set
142# CONFIG_ARCH_L7200 is not set
143# CONFIG_ARCH_KIRKWOOD is not set
144# CONFIG_ARCH_KS8695 is not set
145# CONFIG_ARCH_NS9XXX is not set
146# CONFIG_ARCH_LOKI is not set
147# CONFIG_ARCH_MV78XX0 is not set
148# CONFIG_ARCH_MXC is not set
149# CONFIG_ARCH_ORION5X is not set
150# CONFIG_ARCH_PNX4008 is not set
151# CONFIG_ARCH_PXA is not set
152# CONFIG_ARCH_RPC is not set
153# CONFIG_ARCH_SA1100 is not set
154# CONFIG_ARCH_S3C2410 is not set
155# CONFIG_ARCH_S3C24A0 is not set
156CONFIG_ARCH_S3C64XX=y
157# CONFIG_ARCH_SHARK is not set
158# CONFIG_ARCH_LH7A40X is not set
159# CONFIG_ARCH_DAVINCI is not set
160# CONFIG_ARCH_OMAP is not set
161# CONFIG_ARCH_MSM7X00A is not set
162CONFIG_PLAT_S3C64XX=y
163CONFIG_CPU_S3C6400_INIT=y
164CONFIG_CPU_S3C6400_CLOCK=y
165CONFIG_PLAT_S3C=y
166
167#
168# Boot options
169#
170CONFIG_S3C_BOOT_ERROR_RESET=y
171
172#
173# Power management
174#
175CONFIG_S3C_LOWLEVEL_UART_PORT=0
176CONFIG_CPU_S3C6410=y
177CONFIG_MACH_SMDK6410=y
178
179#
180# Processor Type
181#
182CONFIG_CPU_32=y
183CONFIG_CPU_V6=y
184CONFIG_CPU_32v6K=y
185CONFIG_CPU_32v6=y
186CONFIG_CPU_ABRT_EV6=y
187CONFIG_CPU_PABRT_NOIFAR=y
188CONFIG_CPU_CACHE_V6=y
189CONFIG_CPU_CACHE_VIPT=y
190CONFIG_CPU_COPY_V6=y
191CONFIG_CPU_TLB_V6=y
192CONFIG_CPU_HAS_ASID=y
193CONFIG_CPU_CP15=y
194CONFIG_CPU_CP15_MMU=y
195
196#
197# Processor Features
198#
199CONFIG_ARM_THUMB=y
200# CONFIG_CPU_ICACHE_DISABLE is not set
201# CONFIG_CPU_DCACHE_DISABLE is not set
202# CONFIG_CPU_BPREDICT_DISABLE is not set
203# CONFIG_OUTER_CACHE is not set
204CONFIG_ARM_VIC=y
205
206#
207# Bus support
208#
209# CONFIG_PCI_SYSCALL is not set
210# CONFIG_ARCH_SUPPORTS_MSI is not set
211# CONFIG_PCCARD is not set
212
213#
214# Kernel Features
215#
216CONFIG_VMSPLIT_3G=y
217# CONFIG_VMSPLIT_2G is not set
218# CONFIG_VMSPLIT_1G is not set
219CONFIG_PAGE_OFFSET=0xC0000000
220# CONFIG_PREEMPT is not set
221CONFIG_HZ=100
222CONFIG_AEABI=y
223CONFIG_OABI_COMPAT=y
224CONFIG_ARCH_FLATMEM_HAS_HOLES=y
225# CONFIG_ARCH_SPARSEMEM_DEFAULT is not set
226# CONFIG_ARCH_SELECT_MEMORY_MODEL is not set
227CONFIG_SELECT_MEMORY_MODEL=y
228CONFIG_FLATMEM_MANUAL=y
229# CONFIG_DISCONTIGMEM_MANUAL is not set
230# CONFIG_SPARSEMEM_MANUAL is not set
231CONFIG_FLATMEM=y
232CONFIG_FLAT_NODE_MEM_MAP=y
233CONFIG_PAGEFLAGS_EXTENDED=y
234CONFIG_SPLIT_PTLOCK_CPUS=4
235# CONFIG_RESOURCES_64BIT is not set
236CONFIG_ZONE_DMA_FLAG=0
237CONFIG_VIRT_TO_BUS=y
238CONFIG_ALIGNMENT_TRAP=y
239
240#
241# Boot options
242#
243CONFIG_ZBOOT_ROM_TEXT=0
244CONFIG_ZBOOT_ROM_BSS=0
245CONFIG_CMDLINE="console=ttySAC0,115200 root=/dev/ram init=/bin/bash initrd=0x51000000,4M"
246# CONFIG_XIP_KERNEL is not set
247# CONFIG_KEXEC is not set
248
249#
250# CPU Power Management
251#
252# CONFIG_CPU_IDLE is not set
253
254#
255# Floating point emulation
256#
257
258#
259# At least one emulation must be selected
260#
261# CONFIG_FPE_NWFPE is not set
262# CONFIG_FPE_FASTFPE is not set
263CONFIG_VFP=y
264
265#
266# Userspace binary formats
267#
268CONFIG_BINFMT_ELF=y
269CONFIG_HAVE_AOUT=y
270# CONFIG_BINFMT_AOUT is not set
271# CONFIG_BINFMT_MISC is not set
272
273#
274# Power management options
275#
276# CONFIG_PM is not set
277CONFIG_ARCH_SUSPEND_POSSIBLE=y
278# CONFIG_NET is not set
279
280#
281# Device Drivers
282#
283
284#
285# Generic Driver Options
286#
287CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
288CONFIG_STANDALONE=y
289CONFIG_PREVENT_FIRMWARE_BUILD=y
290CONFIG_FW_LOADER=y
291CONFIG_FIRMWARE_IN_KERNEL=y
292CONFIG_EXTRA_FIRMWARE=""
293# CONFIG_DEBUG_DRIVER is not set
294# CONFIG_DEBUG_DEVRES is not set
295# CONFIG_SYS_HYPERVISOR is not set
296# CONFIG_MTD is not set
297# CONFIG_PARPORT is not set
298CONFIG_BLK_DEV=y
299# CONFIG_BLK_DEV_COW_COMMON is not set
300CONFIG_BLK_DEV_LOOP=y
301# CONFIG_BLK_DEV_CRYPTOLOOP is not set
302CONFIG_BLK_DEV_RAM=y
303CONFIG_BLK_DEV_RAM_COUNT=16
304CONFIG_BLK_DEV_RAM_SIZE=4096
305# CONFIG_BLK_DEV_XIP is not set
306# CONFIG_CDROM_PKTCDVD is not set
307CONFIG_MISC_DEVICES=y
308# CONFIG_EEPROM_93CX6 is not set
309# CONFIG_ENCLOSURE_SERVICES is not set
310CONFIG_HAVE_IDE=y
311# CONFIG_IDE is not set
312
313#
314# SCSI device support
315#
316# CONFIG_RAID_ATTRS is not set
317# CONFIG_SCSI is not set
318# CONFIG_SCSI_DMA is not set
319# CONFIG_SCSI_NETLINK is not set
320# CONFIG_ATA is not set
321# CONFIG_MD is not set
322
323#
324# Input device support
325#
326CONFIG_INPUT=y
327# CONFIG_INPUT_FF_MEMLESS is not set
328# CONFIG_INPUT_POLLDEV is not set
329
330#
331# Userland interfaces
332#
333CONFIG_INPUT_MOUSEDEV=y
334CONFIG_INPUT_MOUSEDEV_PSAUX=y
335CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
336CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
337# CONFIG_INPUT_JOYDEV is not set
338# CONFIG_INPUT_EVDEV is not set
339# CONFIG_INPUT_EVBUG is not set
340
341#
342# Input Device Drivers
343#
344CONFIG_INPUT_KEYBOARD=y
345CONFIG_KEYBOARD_ATKBD=y
346# CONFIG_KEYBOARD_SUNKBD is not set
347# CONFIG_KEYBOARD_LKKBD is not set
348# CONFIG_KEYBOARD_XTKBD is not set
349# CONFIG_KEYBOARD_NEWTON is not set
350# CONFIG_KEYBOARD_STOWAWAY is not set
351# CONFIG_KEYBOARD_GPIO is not set
352CONFIG_INPUT_MOUSE=y
353CONFIG_MOUSE_PS2=y
354CONFIG_MOUSE_PS2_ALPS=y
355CONFIG_MOUSE_PS2_LOGIPS2PP=y
356CONFIG_MOUSE_PS2_SYNAPTICS=y
357CONFIG_MOUSE_PS2_LIFEBOOK=y
358CONFIG_MOUSE_PS2_TRACKPOINT=y
359# CONFIG_MOUSE_PS2_TOUCHKIT is not set
360# CONFIG_MOUSE_SERIAL is not set
361# CONFIG_MOUSE_APPLETOUCH is not set
362# CONFIG_MOUSE_BCM5974 is not set
363# CONFIG_MOUSE_VSXXXAA is not set
364# CONFIG_MOUSE_GPIO is not set
365# CONFIG_INPUT_JOYSTICK is not set
366# CONFIG_INPUT_TABLET is not set
367# CONFIG_INPUT_TOUCHSCREEN is not set
368# CONFIG_INPUT_MISC is not set
369
370#
371# Hardware I/O ports
372#
373CONFIG_SERIO=y
374CONFIG_SERIO_SERPORT=y
375CONFIG_SERIO_LIBPS2=y
376# CONFIG_SERIO_RAW is not set
377# CONFIG_GAMEPORT is not set
378
379#
380# Character devices
381#
382CONFIG_VT=y
383CONFIG_CONSOLE_TRANSLATIONS=y
384CONFIG_VT_CONSOLE=y
385CONFIG_HW_CONSOLE=y
386# CONFIG_VT_HW_CONSOLE_BINDING is not set
387CONFIG_DEVKMEM=y
388# CONFIG_SERIAL_NONSTANDARD is not set
389
390#
391# Serial drivers
392#
393CONFIG_SERIAL_8250=y
394# CONFIG_SERIAL_8250_CONSOLE is not set
395CONFIG_SERIAL_8250_NR_UARTS=4
396CONFIG_SERIAL_8250_RUNTIME_UARTS=4
397# CONFIG_SERIAL_8250_EXTENDED is not set
398
399#
400# Non-8250 serial port support
401#
402CONFIG_SERIAL_SAMSUNG=y
403# CONFIG_SERIAL_SAMSUNG_DEBUG is not set
404CONFIG_SERIAL_SAMSUNG_CONSOLE=y
405CONFIG_SERIAL_S3C6400=y
406CONFIG_SERIAL_CORE=y
407CONFIG_SERIAL_CORE_CONSOLE=y
408CONFIG_UNIX98_PTYS=y
409CONFIG_LEGACY_PTYS=y
410CONFIG_LEGACY_PTY_COUNT=256
411# CONFIG_IPMI_HANDLER is not set
412CONFIG_HW_RANDOM=y
413# CONFIG_NVRAM is not set
414# CONFIG_R3964 is not set
415# CONFIG_RAW_DRIVER is not set
416# CONFIG_TCG_TPM is not set
417# CONFIG_I2C is not set
418# CONFIG_SPI is not set
419CONFIG_ARCH_REQUIRE_GPIOLIB=y
420CONFIG_GPIOLIB=y
421# CONFIG_DEBUG_GPIO is not set
422# CONFIG_GPIO_SYSFS is not set
423
424#
425# I2C GPIO expanders:
426#
427
428#
429# PCI GPIO expanders:
430#
431
432#
433# SPI GPIO expanders:
434#
435# CONFIG_W1 is not set
436# CONFIG_POWER_SUPPLY is not set
437CONFIG_HWMON=y
438# CONFIG_HWMON_VID is not set
439# CONFIG_SENSORS_F71805F is not set
440# CONFIG_SENSORS_F71882FG is not set
441# CONFIG_SENSORS_IT87 is not set
442# CONFIG_SENSORS_PC87360 is not set
443# CONFIG_SENSORS_PC87427 is not set
444# CONFIG_SENSORS_SMSC47M1 is not set
445# CONFIG_SENSORS_SMSC47B397 is not set
446# CONFIG_SENSORS_VT1211 is not set
447# CONFIG_SENSORS_W83627HF is not set
448# CONFIG_SENSORS_W83627EHF is not set
449# CONFIG_HWMON_DEBUG_CHIP is not set
450# CONFIG_THERMAL is not set
451# CONFIG_THERMAL_HWMON is not set
452# CONFIG_WATCHDOG is not set
453
454#
455# Sonics Silicon Backplane
456#
457CONFIG_SSB_POSSIBLE=y
458# CONFIG_SSB is not set
459
460#
461# Multifunction device drivers
462#
463# CONFIG_MFD_CORE is not set
464# CONFIG_MFD_SM501 is not set
465# CONFIG_MFD_ASIC3 is not set
466# CONFIG_HTC_EGPIO is not set
467# CONFIG_HTC_PASIC3 is not set
468# CONFIG_UCB1400_CORE is not set
469# CONFIG_MFD_TMIO is not set
470# CONFIG_MFD_T7L66XB is not set
471# CONFIG_MFD_TC6387XB is not set
472# CONFIG_MFD_TC6393XB is not set
473# CONFIG_MFD_WM8400 is not set
474
475#
476# Multimedia devices
477#
478
479#
480# Multimedia core support
481#
482# CONFIG_VIDEO_DEV is not set
483# CONFIG_VIDEO_MEDIA is not set
484
485#
486# Multimedia drivers
487#
488# CONFIG_DAB is not set
489
490#
491# Graphics support
492#
493# CONFIG_VGASTATE is not set
494# CONFIG_VIDEO_OUTPUT_CONTROL is not set
495# CONFIG_FB is not set
496# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
497
498#
499# Display device support
500#
501# CONFIG_DISPLAY_SUPPORT is not set
502
503#
504# Console display driver support
505#
506# CONFIG_VGA_CONSOLE is not set
507CONFIG_DUMMY_CONSOLE=y
508# CONFIG_SOUND is not set
509CONFIG_HID_SUPPORT=y
510CONFIG_HID=y
511CONFIG_HID_DEBUG=y
512# CONFIG_HIDRAW is not set
513# CONFIG_HID_PID is not set
514
515#
516# Special HID drivers
517#
518# CONFIG_HID_COMPAT is not set
519CONFIG_USB_SUPPORT=y
520CONFIG_USB_ARCH_HAS_HCD=y
521# CONFIG_USB_ARCH_HAS_OHCI is not set
522# CONFIG_USB_ARCH_HAS_EHCI is not set
523# CONFIG_USB is not set
524
525#
526# Enable Host or Gadget support to see Inventra options
527#
528
529#
530# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
531#
532# CONFIG_USB_GADGET is not set
533CONFIG_MMC=y
534CONFIG_MMC_DEBUG=y
535CONFIG_MMC_UNSAFE_RESUME=y
536
537#
538# MMC/SD/SDIO Card Drivers
539#
540CONFIG_MMC_BLOCK=y
541CONFIG_MMC_BLOCK_BOUNCE=y
542CONFIG_SDIO_UART=y
543# CONFIG_MMC_TEST is not set
544
545#
546# MMC/SD/SDIO Host Controller Drivers
547#
548CONFIG_MMC_SDHCI=y
549# CONFIG_MEMSTICK is not set
550# CONFIG_ACCESSIBILITY is not set
551# CONFIG_NEW_LEDS is not set
552CONFIG_RTC_LIB=y
553# CONFIG_RTC_CLASS is not set
554# CONFIG_DMADEVICES is not set
555
556#
557# Voltage and Current regulators
558#
559# CONFIG_REGULATOR is not set
560# CONFIG_REGULATOR_FIXED_VOLTAGE is not set
561# CONFIG_REGULATOR_VIRTUAL_CONSUMER is not set
562# CONFIG_REGULATOR_BQ24022 is not set
563# CONFIG_UIO is not set
564
565#
566# File systems
567#
568CONFIG_EXT2_FS=y
569# CONFIG_EXT2_FS_XATTR is not set
570# CONFIG_EXT2_FS_XIP is not set
571CONFIG_EXT3_FS=y
572CONFIG_EXT3_FS_XATTR=y
573CONFIG_EXT3_FS_POSIX_ACL=y
574CONFIG_EXT3_FS_SECURITY=y
575# CONFIG_EXT4_FS is not set
576CONFIG_JBD=y
577CONFIG_FS_MBCACHE=y
578# CONFIG_REISERFS_FS is not set
579# CONFIG_JFS_FS is not set
580CONFIG_FS_POSIX_ACL=y
581CONFIG_FILE_LOCKING=y
582# CONFIG_XFS_FS is not set
583# CONFIG_GFS2_FS is not set
584CONFIG_DNOTIFY=y
585CONFIG_INOTIFY=y
586CONFIG_INOTIFY_USER=y
587# CONFIG_QUOTA is not set
588# CONFIG_AUTOFS_FS is not set
589# CONFIG_AUTOFS4_FS is not set
590# CONFIG_FUSE_FS is not set
591CONFIG_GENERIC_ACL=y
592
593#
594# CD-ROM/DVD Filesystems
595#
596# CONFIG_ISO9660_FS is not set
597# CONFIG_UDF_FS is not set
598
599#
600# DOS/FAT/NT Filesystems
601#
602# CONFIG_MSDOS_FS is not set
603# CONFIG_VFAT_FS is not set
604# CONFIG_NTFS_FS is not set
605
606#
607# Pseudo filesystems
608#
609CONFIG_PROC_FS=y
610CONFIG_PROC_SYSCTL=y
611CONFIG_PROC_PAGE_MONITOR=y
612CONFIG_SYSFS=y
613CONFIG_TMPFS=y
614CONFIG_TMPFS_POSIX_ACL=y
615# CONFIG_HUGETLB_PAGE is not set
616# CONFIG_CONFIGFS_FS is not set
617
618#
619# Miscellaneous filesystems
620#
621# CONFIG_ADFS_FS is not set
622# CONFIG_AFFS_FS is not set
623# CONFIG_HFS_FS is not set
624# CONFIG_HFSPLUS_FS is not set
625# CONFIG_BEFS_FS is not set
626# CONFIG_BFS_FS is not set
627# CONFIG_EFS_FS is not set
628CONFIG_CRAMFS=y
629# CONFIG_VXFS_FS is not set
630# CONFIG_MINIX_FS is not set
631# CONFIG_OMFS_FS is not set
632# CONFIG_HPFS_FS is not set
633# CONFIG_QNX4FS_FS is not set
634CONFIG_ROMFS_FS=y
635# CONFIG_SYSV_FS is not set
636# CONFIG_UFS_FS is not set
637
638#
639# Partition Types
640#
641# CONFIG_PARTITION_ADVANCED is not set
642CONFIG_MSDOS_PARTITION=y
643# CONFIG_NLS is not set
644
645#
646# Kernel hacking
647#
648# CONFIG_PRINTK_TIME is not set
649CONFIG_ENABLE_WARN_DEPRECATED=y
650CONFIG_ENABLE_MUST_CHECK=y
651CONFIG_FRAME_WARN=1024
652CONFIG_MAGIC_SYSRQ=y
653# CONFIG_UNUSED_SYMBOLS is not set
654# CONFIG_DEBUG_FS is not set
655# CONFIG_HEADERS_CHECK is not set
656CONFIG_DEBUG_KERNEL=y
657# CONFIG_DEBUG_SHIRQ is not set
658CONFIG_DETECT_SOFTLOCKUP=y
659# CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC is not set
660CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC_VALUE=0
661CONFIG_SCHED_DEBUG=y
662# CONFIG_SCHEDSTATS is not set
663# CONFIG_TIMER_STATS is not set
664# CONFIG_DEBUG_OBJECTS is not set
665# CONFIG_SLUB_DEBUG_ON is not set
666# CONFIG_SLUB_STATS is not set
667CONFIG_DEBUG_RT_MUTEXES=y
668CONFIG_DEBUG_PI_LIST=y
669# CONFIG_RT_MUTEX_TESTER is not set
670CONFIG_DEBUG_SPINLOCK=y
671CONFIG_DEBUG_MUTEXES=y
672# CONFIG_DEBUG_LOCK_ALLOC is not set
673# CONFIG_PROVE_LOCKING is not set
674# CONFIG_LOCK_STAT is not set
675CONFIG_DEBUG_SPINLOCK_SLEEP=y
676# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
677# CONFIG_DEBUG_KOBJECT is not set
678CONFIG_DEBUG_BUGVERBOSE=y
679CONFIG_DEBUG_INFO=y
680# CONFIG_DEBUG_VM is not set
681# CONFIG_DEBUG_WRITECOUNT is not set
682CONFIG_DEBUG_MEMORY_INIT=y
683# CONFIG_DEBUG_LIST is not set
684# CONFIG_DEBUG_SG is not set
685CONFIG_FRAME_POINTER=y
686# CONFIG_BOOT_PRINTK_DELAY is not set
687# CONFIG_RCU_TORTURE_TEST is not set
688# CONFIG_RCU_CPU_STALL_DETECTOR is not set
689# CONFIG_BACKTRACE_SELF_TEST is not set
690# CONFIG_DEBUG_BLOCK_EXT_DEVT is not set
691# CONFIG_FAULT_INJECTION is not set
692# CONFIG_LATENCYTOP is not set
693CONFIG_SYSCTL_SYSCALL_CHECK=y
694CONFIG_HAVE_FTRACE=y
695CONFIG_HAVE_DYNAMIC_FTRACE=y
696# CONFIG_FTRACE is not set
697# CONFIG_SCHED_TRACER is not set
698# CONFIG_CONTEXT_SWITCH_TRACER is not set
699# CONFIG_SAMPLES is not set
700CONFIG_HAVE_ARCH_KGDB=y
701# CONFIG_KGDB is not set
702CONFIG_DEBUG_USER=y
703CONFIG_DEBUG_ERRORS=y
704# CONFIG_DEBUG_STACK_USAGE is not set
705CONFIG_DEBUG_LL=y
706# CONFIG_DEBUG_ICEDCC is not set
707CONFIG_DEBUG_S3C_PORT=y
708CONFIG_DEBUG_S3C_UART=0
709
710#
711# Security options
712#
713# CONFIG_KEYS is not set
714# CONFIG_SECURITY is not set
715# CONFIG_SECURITYFS is not set
716# CONFIG_SECURITY_FILE_CAPABILITIES is not set
717# CONFIG_CRYPTO is not set
718
719#
720# Library routines
721#
722CONFIG_BITREVERSE=y
723# CONFIG_CRC_CCITT is not set
724# CONFIG_CRC16 is not set
725# CONFIG_CRC_T10DIF is not set
726# CONFIG_CRC_ITU_T is not set
727CONFIG_CRC32=y
728# CONFIG_CRC7 is not set
729# CONFIG_LIBCRC32C is not set
730CONFIG_ZLIB_INFLATE=y
731CONFIG_PLIST=y
732CONFIG_HAS_IOMEM=y
733CONFIG_HAS_DMA=y
diff --git a/arch/arm/include/asm/hardware/vic.h b/arch/arm/include/asm/hardware/vic.h
index 263f2c362a3..f87328d4a18 100644
--- a/arch/arm/include/asm/hardware/vic.h
+++ b/arch/arm/include/asm/hardware/vic.h
@@ -29,15 +29,17 @@
29#define VIC_INT_SOFT 0x18 29#define VIC_INT_SOFT 0x18
30#define VIC_INT_SOFT_CLEAR 0x1c 30#define VIC_INT_SOFT_CLEAR 0x1c
31#define VIC_PROTECT 0x20 31#define VIC_PROTECT 0x20
32#define VIC_VECT_ADDR 0x30 32#define VIC_PL190_VECT_ADDR 0x30 /* PL190 only */
33#define VIC_DEF_VECT_ADDR 0x34 33#define VIC_PL190_DEF_VECT_ADDR 0x34 /* PL190 only */
34 34
35#define VIC_VECT_ADDR0 0x100 /* 0 to 15 */ 35#define VIC_VECT_ADDR0 0x100 /* 0 to 15 (0..31 PL192) */
36#define VIC_VECT_CNTL0 0x200 /* 0 to 15 */ 36#define VIC_VECT_CNTL0 0x200 /* 0 to 15 (0..31 PL192) */
37#define VIC_ITCR 0x300 /* VIC test control register */ 37#define VIC_ITCR 0x300 /* VIC test control register */
38 38
39#define VIC_VECT_CNTL_ENABLE (1 << 5) 39#define VIC_VECT_CNTL_ENABLE (1 << 5)
40 40
41#define VIC_PL192_VECT_ADDR 0xF00
42
41#ifndef __ASSEMBLY__ 43#ifndef __ASSEMBLY__
42void vic_init(void __iomem *base, unsigned int irq_start, u32 vic_sources); 44void vic_init(void __iomem *base, unsigned int irq_start, u32 vic_sources);
43#endif 45#endif
diff --git a/arch/arm/mach-s3c2410/include/mach/map.h b/arch/arm/mach-s3c2410/include/mach/map.h
index 23c470c2e5b..918e3463297 100644
--- a/arch/arm/mach-s3c2410/include/mach/map.h
+++ b/arch/arm/mach-s3c2410/include/mach/map.h
@@ -13,34 +13,20 @@
13#ifndef __ASM_ARCH_MAP_H 13#ifndef __ASM_ARCH_MAP_H
14#define __ASM_ARCH_MAP_H 14#define __ASM_ARCH_MAP_H
15 15
16#include <plat/map-base.h>
16#include <plat/map.h> 17#include <plat/map.h>
17 18
18#define S3C2410_ADDR(x) S3C_ADDR(x) 19#define S3C2410_ADDR(x) S3C_ADDR(x)
19 20
20/* interrupt controller is the first thing we put in, to make
21 * the assembly code for the irq detection easier
22 */
23#define S3C24XX_VA_IRQ S3C_VA_IRQ
24#define S3C2410_PA_IRQ (0x4A000000)
25#define S3C24XX_SZ_IRQ SZ_1M
26
27/* memory controller registers */
28#define S3C24XX_VA_MEMCTRL S3C_VA_MEM
29#define S3C2410_PA_MEMCTRL (0x48000000)
30#define S3C24XX_SZ_MEMCTRL SZ_1M
31
32/* USB host controller */ 21/* USB host controller */
33#define S3C2410_PA_USBHOST (0x49000000) 22#define S3C2410_PA_USBHOST (0x49000000)
34#define S3C24XX_SZ_USBHOST SZ_1M
35 23
36/* DMA controller */ 24/* DMA controller */
37#define S3C2410_PA_DMA (0x4B000000) 25#define S3C2410_PA_DMA (0x4B000000)
38#define S3C24XX_SZ_DMA SZ_1M 26#define S3C24XX_SZ_DMA SZ_1M
39 27
40/* Clock and Power management */ 28/* Clock and Power management */
41#define S3C24XX_VA_CLKPWR S3C_VA_SYS
42#define S3C2410_PA_CLKPWR (0x4C000000) 29#define S3C2410_PA_CLKPWR (0x4C000000)
43#define S3C24XX_SZ_CLKPWR SZ_1M
44 30
45/* LCD controller */ 31/* LCD controller */
46#define S3C2410_PA_LCD (0x4D000000) 32#define S3C2410_PA_LCD (0x4D000000)
@@ -48,48 +34,12 @@
48 34
49/* NAND flash controller */ 35/* NAND flash controller */
50#define S3C2410_PA_NAND (0x4E000000) 36#define S3C2410_PA_NAND (0x4E000000)
51#define S3C24XX_SZ_NAND SZ_1M
52
53/* UARTs */
54#define S3C24XX_VA_UART S3C_VA_UART
55#define S3C2410_PA_UART (0x50000000)
56#define S3C24XX_SZ_UART SZ_1M
57
58/* Timers */
59#define S3C24XX_VA_TIMER S3C_VA_TIMER
60#define S3C2410_PA_TIMER (0x51000000)
61#define S3C24XX_SZ_TIMER SZ_1M
62
63/* USB Device port */
64#define S3C2410_PA_USBDEV (0x52000000)
65#define S3C24XX_SZ_USBDEV SZ_1M
66
67/* Watchdog */
68#define S3C24XX_VA_WATCHDOG S3C_VA_WATCHDOG
69#define S3C2410_PA_WATCHDOG (0x53000000)
70#define S3C24XX_SZ_WATCHDOG SZ_1M
71 37
72/* IIC hardware controller */ 38/* IIC hardware controller */
73#define S3C2410_PA_IIC (0x54000000) 39#define S3C2410_PA_IIC (0x54000000)
74#define S3C24XX_SZ_IIC SZ_1M
75 40
76/* IIS controller */ 41/* IIS controller */
77#define S3C2410_PA_IIS (0x55000000) 42#define S3C2410_PA_IIS (0x55000000)
78#define S3C24XX_SZ_IIS SZ_1M
79
80/* GPIO ports */
81
82/* the calculation for the VA of this must ensure that
83 * it is the same distance apart from the UART in the
84 * phsyical address space, as the initial mapping for the IO
85 * is done as a 1:1 maping. This puts it (currently) at
86 * 0xFA800000, which is not in the way of any current mapping
87 * by the base system.
88*/
89
90#define S3C2410_PA_GPIO (0x56000000)
91#define S3C24XX_VA_GPIO ((S3C2410_PA_GPIO - S3C24XX_PA_UART) + S3C24XX_VA_UART)
92#define S3C24XX_SZ_GPIO SZ_1M
93 43
94/* RTC */ 44/* RTC */
95#define S3C2410_PA_RTC (0x57000000) 45#define S3C2410_PA_RTC (0x57000000)
@@ -97,15 +47,12 @@
97 47
98/* ADC */ 48/* ADC */
99#define S3C2410_PA_ADC (0x58000000) 49#define S3C2410_PA_ADC (0x58000000)
100#define S3C24XX_SZ_ADC SZ_1M
101 50
102/* SPI */ 51/* SPI */
103#define S3C2410_PA_SPI (0x59000000) 52#define S3C2410_PA_SPI (0x59000000)
104#define S3C24XX_SZ_SPI SZ_1M
105 53
106/* SDI */ 54/* SDI */
107#define S3C2410_PA_SDI (0x5A000000) 55#define S3C2410_PA_SDI (0x5A000000)
108#define S3C24XX_SZ_SDI SZ_1M
109 56
110/* CAMIF */ 57/* CAMIF */
111#define S3C2440_PA_CAMIF (0x4F000000) 58#define S3C2440_PA_CAMIF (0x4F000000)
@@ -120,13 +67,6 @@
120#define S3C2443_PA_HSMMC (0x4A800000) 67#define S3C2443_PA_HSMMC (0x4A800000)
121#define S3C2443_SZ_HSMMC (256) 68#define S3C2443_SZ_HSMMC (256)
122 69
123/* ISA style IO, for each machine to sort out mappings for, if it
124 * implements it. We reserve two 16M regions for ISA.
125 */
126
127#define S3C24XX_VA_ISA_WORD S3C2410_ADDR(0x02000000)
128#define S3C24XX_VA_ISA_BYTE S3C2410_ADDR(0x03000000)
129
130/* physical addresses of all the chip-select areas */ 70/* physical addresses of all the chip-select areas */
131 71
132#define S3C2410_CS0 (0x00000000) 72#define S3C2410_CS0 (0x00000000)
@@ -158,21 +98,9 @@
158#define S3C24XX_PA_RTC S3C2410_PA_RTC 98#define S3C24XX_PA_RTC S3C2410_PA_RTC
159#define S3C24XX_PA_ADC S3C2410_PA_ADC 99#define S3C24XX_PA_ADC S3C2410_PA_ADC
160#define S3C24XX_PA_SPI S3C2410_PA_SPI 100#define S3C24XX_PA_SPI S3C2410_PA_SPI
101#define S3C24XX_PA_SDI S3C2410_PA_SDI
102#define S3C24XX_PA_NAND S3C2410_PA_NAND
161 103
162/* deal with the registers that move under the 2412/2413 */ 104#define S3C_PA_UART S3C24XX_PA_UART
163
164#if defined(CONFIG_CPU_S3C2412) || defined(CONFIG_CPU_S3C2413)
165#ifndef __ASSEMBLY__
166extern void __iomem *s3c24xx_va_gpio2;
167#endif
168#ifdef CONFIG_CPU_S3C2412_ONLY
169#define S3C24XX_VA_GPIO2 (S3C24XX_VA_GPIO + 0x10)
170#else
171#define S3C24XX_VA_GPIO2 s3c24xx_va_gpio2
172#endif
173#else
174#define s3c24xx_va_gpio2 S3C24XX_VA_GPIO
175#define S3C24XX_VA_GPIO2 S3C24XX_VA_GPIO
176#endif
177 105
178#endif /* __ASM_ARCH_MAP_H */ 106#endif /* __ASM_ARCH_MAP_H */
diff --git a/arch/arm/mach-s3c2410/include/mach/tick.h b/arch/arm/mach-s3c2410/include/mach/tick.h
new file mode 100644
index 00000000000..544da41979d
--- /dev/null
+++ b/arch/arm/mach-s3c2410/include/mach/tick.h
@@ -0,0 +1,15 @@
1/* linux/arch/arm/mach-s3c2410/include/mach/tick.h
2 *
3 * Copyright 2008 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk>
5 * http://armlinux.simtec.co.uk/
6 *
7 * S3C2410 - timer tick support
8 */
9
10#define SRCPND_TIMER4 (1<<(IRQ_TIMER4 - IRQ_EINT0))
11
12static inline int s3c24xx_ostimer_pending(void)
13{
14 return __raw_readl(S3C2410_SRCPND) & SRCPND_TIMER4;
15}
diff --git a/arch/arm/mach-s3c2410/include/mach/uncompress.h b/arch/arm/mach-s3c2410/include/mach/uncompress.h
index ab39491beee..c9432103750 100644
--- a/arch/arm/mach-s3c2410/include/mach/uncompress.h
+++ b/arch/arm/mach-s3c2410/include/mach/uncompress.h
@@ -1,3 +1,4 @@
1
1/* arch/arm/mach-s3c2410/include/mach/uncompress.h 2/* arch/arm/mach-s3c2410/include/mach/uncompress.h
2 * 3 *
3 * Copyright (c) 2003, 2007 Simtec Electronics 4 * Copyright (c) 2003, 2007 Simtec Electronics
diff --git a/arch/arm/mach-s3c2412/clock.c b/arch/arm/mach-s3c2412/clock.c
index 96d9eb15424..a037df5e1c2 100644
--- a/arch/arm/mach-s3c2412/clock.c
+++ b/arch/arm/mach-s3c2412/clock.c
@@ -93,12 +93,6 @@ static int s3c2412_upll_enable(struct clk *clk, int enable)
93 93
94/* clock selections */ 94/* clock selections */
95 95
96/* CPU EXTCLK input */
97static struct clk clk_ext = {
98 .name = "extclk",
99 .id = -1,
100};
101
102static struct clk clk_erefclk = { 96static struct clk clk_erefclk = {
103 .name = "erefclk", 97 .name = "erefclk",
104 .id = -1, 98 .id = -1,
@@ -773,5 +767,6 @@ int __init s3c2412_baseclk_add(void)
773 s3c2412_clkcon_enable(clkp, 0); 767 s3c2412_clkcon_enable(clkp, 0);
774 } 768 }
775 769
770 s3c_pwmclk_init();
776 return 0; 771 return 0;
777} 772}
diff --git a/arch/arm/mach-s3c2443/clock.c b/arch/arm/mach-s3c2443/clock.c
index 1df8429242b..fdd4ec335a7 100644
--- a/arch/arm/mach-s3c2443/clock.c
+++ b/arch/arm/mach-s3c2443/clock.c
@@ -147,12 +147,6 @@ static unsigned long s3c2443_roundrate_clksrc256(struct clk *clk,
147 147
148/* clock selections */ 148/* clock selections */
149 149
150/* CPU EXTCLK input */
151static struct clk clk_ext = {
152 .name = "ext",
153 .id = -1,
154};
155
156static struct clk clk_mpllref = { 150static struct clk clk_mpllref = {
157 .name = "mpllref", 151 .name = "mpllref",
158 .parent = &clk_xtal, 152 .parent = &clk_xtal,
@@ -167,14 +161,6 @@ static struct clk clk_mpll = {
167}; 161};
168#endif 162#endif
169 163
170static struct clk clk_epllref;
171
172static struct clk clk_epll = {
173 .name = "epll",
174 .parent = &clk_epllref,
175 .id = -1,
176};
177
178static struct clk clk_i2s_ext = { 164static struct clk clk_i2s_ext = {
179 .name = "i2s-ext", 165 .name = "i2s-ext",
180 .id = -1, 166 .id = -1,
@@ -1072,6 +1058,7 @@ void __init s3c2443_init_clocks(int xtal)
1072 } 1058 }
1073 1059
1074 clk_epll.rate = s3c2443_get_epll(epllcon, xtal); 1060 clk_epll.rate = s3c2443_get_epll(epllcon, xtal);
1061 clk_epll.parent = &clk_epllref;
1075 clk_usb_bus.parent = &clk_usb_bus_host; 1062 clk_usb_bus.parent = &clk_usb_bus_host;
1076 1063
1077 /* ensure usb bus clock is within correct rate of 48MHz */ 1064 /* ensure usb bus clock is within correct rate of 48MHz */
@@ -1120,4 +1107,6 @@ void __init s3c2443_init_clocks(int xtal)
1120 1107
1121 (clkp->enable)(clkp, 0); 1108 (clkp->enable)(clkp, 0);
1122 } 1109 }
1110
1111 s3c_pwmclk_init();
1123} 1112}
diff --git a/arch/arm/mach-s3c24a0/include/mach/debug-macro.S b/arch/arm/mach-s3c24a0/include/mach/debug-macro.S
new file mode 100644
index 00000000000..f0ef0ab475f
--- /dev/null
+++ b/arch/arm/mach-s3c24a0/include/mach/debug-macro.S
@@ -0,0 +1,28 @@
1/* arch/arm/mach-s3c2410/include/mach/debug-macro.S
2 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License version 2 as
5 * published by the Free Software Foundation.
6*/
7
8/* pull in the relevant register and map files. */
9
10#include <mach/map.h>
11#include <plat/regs-serial.h>
12
13 .macro addruart, rx
14 mrc p15, 0, \rx, c1, c0
15 tst \rx, #1
16 ldreq \rx, = S3C24XX_PA_UART
17 ldrne \rx, = S3C24XX_VA_UART
18#if CONFIG_DEBUG_S3C_UART != 0
19 add \rx, \rx, #(S3C2410_UART1_OFF * CONFIG_DEBUG_S3C_UART)
20#endif
21 .endm
22
23/* include the reset of the code which will do the work, we're only
24 * compiling for a single cpu processor type so the default of s3c2440
25 * will be fine with us.
26 */
27
28#include <plat/debug-macro.S>
diff --git a/arch/arm/mach-s3c24a0/include/mach/io.h b/arch/arm/mach-s3c24a0/include/mach/io.h
new file mode 100644
index 00000000000..c163364773b
--- /dev/null
+++ b/arch/arm/mach-s3c24a0/include/mach/io.h
@@ -0,0 +1,16 @@
1/* arch/arm/mach-s3c24a0/include/mach/io.h
2 *
3 * Copyright 2008 Simtec Electronics
4 * Ben Dooks <ben-linux@fluff.org>
5 *
6 * IO access and mapping routines for the S3C24A0
7 */
8
9#ifndef __ASM_ARM_ARCH_IO_H
10#define __ASM_ARM_ARCH_IO_H
11
12/* No current ISA/PCI bus support. */
13#define __io(a) ((void __iomem *)(a))
14#define __mem_pci(a) (a)
15
16#endif
diff --git a/arch/arm/mach-s3c24a0/include/mach/irqs.h b/arch/arm/mach-s3c24a0/include/mach/irqs.h
new file mode 100644
index 00000000000..ae8c0e35978
--- /dev/null
+++ b/arch/arm/mach-s3c24a0/include/mach/irqs.h
@@ -0,0 +1,115 @@
1/* linux/arch/arm/mach-s3c24a0/include/mach/irqs.h
2 *
3 * Copyright (c) 2003-2005 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9*/
10
11
12#ifndef __ASM_ARCH_24A0_IRQS_H
13#define __ASM_ARCH_24A0_IRQS_H __FILE__
14
15#define IRQ_EINT0t2 S3C2410_IRQ(0) /* 16 */
16/* for generic entry-macro.S */
17#define IRQ_EINT0 IRQ_EINT0t2
18
19#define IRQ_EINT3t6 S3C2410_IRQ(1)
20#define IRQ_EINT7t10 S3C2410_IRQ(2)
21#define IRQ_EINT11t14 S3C2410_IRQ(3)
22#define IRQ_EINT15t18 S3C2410_IRQ(4) /* 20 */
23#define IRQ_TICK S3C2410_IRQ(5)
24#define IRQ_DCTQ S3C2410_IRQ(6)
25#define IRQ_MC S3C2410_IRQ(7)
26#define IRQ_ME S3C2410_IRQ(8) /* 24 */
27#define IRQ_KEYPAD S3C2410_IRQ(9)
28#define IRQ_TIMER0 S3C2410_IRQ(10)
29#define IRQ_TIMER1 S3C2410_IRQ(11)
30#define IRQ_TIMER2 S3C2410_IRQ(12)
31#define IRQ_TIMER3_4 S3C2410_IRQ(13)
32#define IRQ_OS_TIMER IRQ_TIMER3_4
33#define IRQ_LCD S3C2410_IRQ(14)
34#define IRQ_CAM_C S3C2410_IRQ(15)
35#define IRQ_WDT_BATFLT S3C2410_IRQ(16) /* 32 */
36#define IRQ_UART0 S3C2410_IRQ(17)
37#define IRQ_CAM_P S3C2410_IRQ(18)
38#define IRQ_MODEM S3C2410_IRQ(19)
39#define IRQ_DMA S3C2410_IRQ(20)
40#define IRQ_SDI S3C2410_IRQ(21)
41#define IRQ_SPI0 S3C2410_IRQ(22)
42#define IRQ_UART1 S3C2410_IRQ(23)
43#define IRQ_AC97_NFLASH S3C2410_IRQ(24) /* 40 */
44#define IRQ_USBD S3C2410_IRQ(25)
45#define IRQ_USBH S3C2410_IRQ(26)
46#define IRQ_IIC S3C2410_IRQ(27)
47#define IRQ_IRDA_MSTICK S3C2410_IRQ(28) /* 44 */
48#define IRQ_VLX_SPI1 S3C2410_IRQ(29)
49#define IRQ_RTC S3C2410_IRQ(30) /* 46 */
50#define IRQ_ADC_PEN S3C2410_IRQ(31)
51
52/* interrupts generated from the external interrupts sources */
53#define IRQ_EINT00 S3C2410_IRQ(32) /* 48 */
54#define IRQ_EINT1 S3C2410_IRQ(33)
55#define IRQ_EINT2 S3C2410_IRQ(34)
56#define IRQ_EINT3 S3C2410_IRQ(35)
57#define IRQ_EINT4 S3C2410_IRQ(36)
58#define IRQ_EINT5 S3C2410_IRQ(37)
59#define IRQ_EINT6 S3C2410_IRQ(38)
60#define IRQ_EINT7 S3C2410_IRQ(39)
61#define IRQ_EINT8 S3C2410_IRQ(40)
62#define IRQ_EINT9 S3C2410_IRQ(41)
63#define IRQ_EINT10 S3C2410_IRQ(42)
64#define IRQ_EINT11 S3C2410_IRQ(43)
65#define IRQ_EINT12 S3C2410_IRQ(44)
66#define IRQ_EINT13 S3C2410_IRQ(45)
67#define IRQ_EINT14 S3C2410_IRQ(46)
68#define IRQ_EINT15 S3C2410_IRQ(47)
69#define IRQ_EINT16 S3C2410_IRQ(48)
70#define IRQ_EINT17 S3C2410_IRQ(49)
71#define IRQ_EINT18 S3C2410_IRQ(50)
72
73/* SUB IRQS */
74#define IRQ_S3CUART_RX0 S3C2410_IRQ(51) /* 67 */
75#define IRQ_S3CUART_TX0 S3C2410_IRQ(52)
76#define IRQ_S3CUART_ERR0 S3C2410_IRQ(53)
77
78#define IRQ_S3CUART_RX1 S3C2410_IRQ(54)
79#define IRQ_S3CUART_TX1 S3C2410_IRQ(55)
80#define IRQ_S3CUART_ERR1 S3C2410_IRQ(56)
81
82#define IRQ_S3CUART_RX2 (0x0)
83#define IRQ_S3CUART_TX2 (0x0)
84#define IRQ_S3CUART_ERR2 (0x0)
85
86
87#define IRQ_IRDA S3C2410_IRQ(57)
88#define IRQ_MSTICK S3C2410_IRQ(58)
89#define IRQ_RESERVED0 S3C2410_IRQ(59)
90#define IRQ_RESERVED1 S3C2410_IRQ(60)
91#define IRQ_RESERVED2 S3C2410_IRQ(61)
92#define IRQ_TIMER3 S3C2410_IRQ(62)
93#define IRQ_TIMER4 S3C2410_IRQ(63)
94#define IRQ_WDT S3C2410_IRQ(64)
95#define IRQ_BATFLT S3C2410_IRQ(65)
96#define IRQ_POST S3C2410_IRQ(66)
97#define IRQ_DISP_FIFO S3C2410_IRQ(67)
98#define IRQ_PENUP S3C2410_IRQ(68)
99#define IRQ_PENDN S3C2410_IRQ(69)
100#define IRQ_ADC S3C2410_IRQ(70)
101#define IRQ_DISP_FRAME S3C2410_IRQ(71)
102#define IRQ_NFLASH S3C2410_IRQ(72)
103#define IRQ_AC97 S3C2410_IRQ(73)
104#define IRQ_SPI1 S3C2410_IRQ(74)
105#define IRQ_VLX S3C2410_IRQ(75)
106#define IRQ_DMA0 S3C2410_IRQ(76)
107#define IRQ_DMA1 S3C2410_IRQ(77)
108#define IRQ_DMA2 S3C2410_IRQ(78)
109#define IRQ_DMA3 S3C2410_IRQ(79)
110
111#define IRQ_TC (0x0)
112
113#define NR_IRQS (IRQ_DMA3+1)
114
115#endif /* __ASM_ARCH_24A0_IRQS_H */
diff --git a/arch/arm/mach-s3c24a0/include/mach/map.h b/arch/arm/mach-s3c24a0/include/mach/map.h
new file mode 100644
index 00000000000..6667355a47a
--- /dev/null
+++ b/arch/arm/mach-s3c24a0/include/mach/map.h
@@ -0,0 +1,85 @@
1/* linux/arch/arm/mach-s3c24a0/include/mach/map.h
2 *
3 * Copyright 2003,2007 Simtec Electronics
4 * http://armlinux.simtec.co.uk/
5 * Ben Dooks <ben@simtec.co.uk>
6 *
7 * S3C24A0 - Memory map definitions
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#ifndef __ASM_ARCH_24A0_MAP_H
15#define __ASM_ARCH_24A0_MAP_H __FILE__
16
17#include <plat/map-base.h>
18#include <plat/map.h>
19
20#define S3C24A0_PA_IO_BASE (0x40000000)
21#define S3C24A0_PA_CLKPWR (0x40000000)
22#define S3C24A0_PA_IRQ (0x40200000)
23#define S3C24A0_PA_DMA (0x40400000)
24#define S3C24A0_PA_MEMCTRL (0x40C00000)
25#define S3C24A0_PA_NAND (0x40C00000)
26#define S3C24A0_PA_SROM (0x40C20000)
27#define S3C24A0_PA_SDRAM (0x40C40000)
28#define S3C24A0_PA_BUSM (0x40CE0000)
29#define S3C24A0_PA_USBHOST (0x41000000)
30#define S3C24A0_PA_MODEMIF (0x41180000)
31#define S3C24A0_PA_IRDA (0x41800000)
32#define S3C24A0_PA_TIMER (0x44000000)
33#define S3C24A0_PA_WATCHDOG (0x44100000)
34#define S3C24A0_PA_RTC (0x44200000)
35#define S3C24A0_PA_UART (0x44400000)
36#define S3C24A0_PA_UART0 (S3C24A0_PA_UART)
37#define S3C24A0_PA_UART1 (S3C24A0_PA_UART + 0x4000)
38#define S3C24A0_PA_SPI (0x44500000)
39#define S3C24A0_PA_IIC (0x44600000)
40#define S3C24A0_PA_IIS (0x44700000)
41#define S3C24A0_PA_GPIO (0x44800000)
42#define S3C24A0_PA_KEYIF (0x44900000)
43#define S3C24A0_PA_USBDEV (0x44A00000)
44#define S3C24A0_PA_AC97 (0x45000000)
45#define S3C24A0_PA_ADC (0x45800000)
46#define S3C24A0_PA_SDI (0x46000000)
47#define S3C24A0_PA_MS (0x46100000)
48#define S3C24A0_PA_LCD (0x4A000000)
49#define S3C24A0_PA_VPOST (0x4A100000)
50
51/* physical addresses of all the chip-select areas */
52
53#define S3C24A0_CS0 (0x00000000)
54#define S3C24A0_CS1 (0x04000000)
55#define S3C24A0_CS2 (0x08000000)
56#define S3C24A0_CS3 (0x0C000000)
57#define S3C24A0_CS4 (0x10000000)
58#define S3C24A0_CS5 (0x40000000)
59
60#define S3C24A0_SDRAM_PA (S3C24A0_CS4)
61
62/* Use a single interface for common resources between S3C24XX cpus */
63
64#define S3C24XX_PA_IRQ S3C24A0_PA_IRQ
65#define S3C24XX_PA_MEMCTRL S3C24A0_PA_MEMCTRL
66#define S3C24XX_PA_USBHOST S3C24A0_PA_USBHOST
67#define S3C24XX_PA_DMA S3C24A0_PA_DMA
68#define S3C24XX_PA_CLKPWR S3C24A0_PA_CLKPWR
69#define S3C24XX_PA_LCD S3C24A0_PA_LCD
70#define S3C24XX_PA_UART S3C24A0_PA_UART
71#define S3C24XX_PA_TIMER S3C24A0_PA_TIMER
72#define S3C24XX_PA_USBDEV S3C24A0_PA_USBDEV
73#define S3C24XX_PA_WATCHDOG S3C24A0_PA_WATCHDOG
74#define S3C24XX_PA_IIC S3C24A0_PA_IIC
75#define S3C24XX_PA_IIS S3C24A0_PA_IIS
76#define S3C24XX_PA_GPIO S3C24A0_PA_GPIO
77#define S3C24XX_PA_RTC S3C24A0_PA_RTC
78#define S3C24XX_PA_ADC S3C24A0_PA_ADC
79#define S3C24XX_PA_SPI S3C24A0_PA_SPI
80#define S3C24XX_PA_SDI S3C24A0_PA_SDI
81#define S3C24XX_PA_NAND S3C24A0_PA_NAND
82
83#define S3C_PA_UART S3C24A0_PA_UART
84
85#endif /* __ASM_ARCH_24A0_MAP_H */
diff --git a/arch/arm/mach-s3c24a0/include/mach/memory.h b/arch/arm/mach-s3c24a0/include/mach/memory.h
new file mode 100644
index 00000000000..585211ca018
--- /dev/null
+++ b/arch/arm/mach-s3c24a0/include/mach/memory.h
@@ -0,0 +1,19 @@
1/* linux/arch/arm/mach-s3c24a0/include/mach/memory.h
2 * from linux/include/asm-arm/arch-rpc/memory.h
3 *
4 * Copyright (C) 1996,1997,1998 Russell King.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9*/
10
11#ifndef __ASM_ARCH_24A0_MEMORY_H
12#define __ASM_ARCH_24A0_MEMORY_H __FILE__
13
14#define PHYS_OFFSET UL(0x10000000)
15
16#define __virt_to_bus(x) __virt_to_phys(x)
17#define __bus_to_virt(x) __phys_to_virt(x)
18
19#endif
diff --git a/arch/arm/mach-s3c24a0/include/mach/regs-clock.h b/arch/arm/mach-s3c24a0/include/mach/regs-clock.h
new file mode 100644
index 00000000000..af2abd756c3
--- /dev/null
+++ b/arch/arm/mach-s3c24a0/include/mach/regs-clock.h
@@ -0,0 +1,88 @@
1/* linux/arch/arm/mach-s3c24a0/include/mach/regs-clock.h
2 *
3 * Copyright (c) 2003,2004,2005,2006 Simtec Electronics <linux@simtec.co.uk>
4 * http://armlinux.simtec.co.uk/
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10 * S3C24A0 clock register definitions
11*/
12
13#ifndef __ASM_ARCH_24A0_REGS_CLOCK_H
14#define __ASM_ARCH_24A0_REGS_CLOCK_H __FILE__
15
16#define S3C24A0_MPLLCON S3C2410_CLKREG(0x10)
17#define S3C24A0_UPLLCON S3C2410_CLKREG(0x14)
18#define S3C24A0_CLKCON S3C2410_CLKREG(0x20)
19#define S3C24A0_CLKSRC S3C2410_CLKREG(0x24)
20#define S3C24A0_CLKDIVN S3C2410_CLKREG(0x28)
21
22/* CLKCON register bits */
23
24#define S3C24A0_CLKCON_VLX (1<<29)
25#define S3C24A0_CLKCON_VPOST (1<<28)
26#define S3C24A0_CLKCON_WDT (1<<27) /* reserved */
27#define S3C24A0_CLKCON_MPEGDCTQ (1<<26)
28#define S3C24A0_CLKCON_VPOSTIF (1<<25)
29#define S3C24A0_CLKCON_MPEG4IF (1<<24)
30#define S3C24A0_CLKCON_CAM_UPLL (1<<23)
31#define S3C24A0_CLKCON_LCDC (1<<22)
32#define S3C24A0_CLKCON_CAM_HCLK (1<<21)
33#define S3C24A0_CLKCON_MPEG4 (1<<20)
34#define S3C24A0_CLKCON_KEYPAD (1<<19)
35#define S3C24A0_CLKCON_ADC (1<<18)
36#define S3C24A0_CLKCON_SDI (1<<17)
37#define S3C24A0_CLKCON_MS (1<<16) /* memory stick */
38#define S3C24A0_CLKCON_USBD (1<<15)
39#define S3C24A0_CLKCON_GPIO (1<<14)
40#define S3C24A0_CLKCON_IIS (1<<13)
41#define S3C24A0_CLKCON_IIC (1<<12)
42#define S3C24A0_CLKCON_SPI (1<<11)
43#define S3C24A0_CLKCON_UART1 (1<<10)
44#define S3C24A0_CLKCON_UART0 (1<<9)
45#define S3C24A0_CLKCON_PWMT (1<<8)
46#define S3C24A0_CLKCON_USBH (1<<7)
47#define S3C24A0_CLKCON_AC97 (1<<6)
48#define S3C24A0_CLKCON_IrDA (1<<4)
49#define S3C24A0_CLKCON_IDLE (1<<2)
50#define S3C24A0_CLKCON_MON (1<<1)
51#define S3C24A0_CLKCON_STOP (1<<0)
52
53/* CLKSRC register bits */
54
55#define S3C24A0_CLKSRC_OSC (1<<8) /* CLKSRC */
56#define S3C24A0_CLKSRC_UPLL (1<<7)
57#define S3C24A0_CLKSRC_MPLL (1<<5)
58#define S3C24A0_CLKSRC_EXT (1<<4)
59
60/* Use a single interface with the common code, for s3c24xx */
61
62#define S3C2410_MPLLCON S3C24A0_MPLLCON
63#define S3C2410_UPLLCON S3C24A0_UPLLCON
64#define S3C2410_CLKCON S3C24A0_CLKCON
65#define S3C2410_CLKSLOW S3C24A0_CLKSRC
66#define S3C2410_CLKDIVN S3C24A0_CLKDIVN
67
68#define S3C2410_CLKCON_IDLE S3C24A0_CLKCON_IDLE
69#define S3C2410_CLKCON_POWER S3C24A0_CLKCON_STOP
70#define S3C2410_CLKCON_LCDC S3C24A0_CLKCON_LCDC
71#define S3C2410_CLKCON_USBH S3C24A0_CLKCON_USBH
72#define S3C2410_CLKCON_USBD S3C24A0_CLKCON_USBD
73#define S3C2410_CLKCON_PWMT S3C24A0_CLKCON_PWMT
74#define S3C2410_CLKCON_SDI S3C24A0_CLKCON_SDI
75#define S3C2410_CLKCON_UART0 S3C24A0_CLKCON_UART0
76#define S3C2410_CLKCON_UART1 S3C24A0_CLKCON_UART1
77#define S3C2410_CLKCON_GPIO S3C24A0_CLKCON_GPIO
78#define S3C2410_CLKCON_ADC S3C24A0_CLKCON_ADC
79#define S3C2410_CLKCON_IIC S3C24A0_CLKCON_IIC
80#define S3C2410_CLKCON_IIS S3C24A0_CLKCON_IIS
81#define S3C2410_CLKCON_SPI S3C24A0_CLKCON_SPI
82
83#define S3C2410_CLKSLOW_UCLK_OFF S3C24A0_CLKSRC_UPLL
84#define S3C2410_CLKSLOW_MPLL_OFF S3C24A0_CLKSRC_MPLL
85#define S3C2410_CLKSLOW_SLOW (0xFF)
86#define S3C2410_CLKSLOW_GET_SLOWVAL(x) (0x1)
87
88#endif /* __ASM_ARCH_24A0_REGS_CLOCK_H */
diff --git a/arch/arm/mach-s3c24a0/include/mach/regs-irq.h b/arch/arm/mach-s3c24a0/include/mach/regs-irq.h
new file mode 100644
index 00000000000..6086f6f189e
--- /dev/null
+++ b/arch/arm/mach-s3c24a0/include/mach/regs-irq.h
@@ -0,0 +1,25 @@
1/* linux/arch/arm/mach-s3c24a0/include/mach/regs-irq.h
2 *
3 * Copyright (c) 2003 Simtec Electronics <linux@simtec.co.uk>
4 * http://www.simtec.co.uk/products/SWLINUX/
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9*/
10
11
12#ifndef ___ASM_ARCH_24A0_REGS_IRQ_H
13#define ___ASM_ARCH_24A0_REGS_IRQ_H __FILE__
14
15
16#define S3C2410_EINTMASK S3C2410_EINTREG(0x034)
17#define S3C2410_EINTPEND S3C2410_EINTREG(0X038)
18
19#define S3C24XX_EINTMASK S3C24XX_EINTREG(0x034)
20#define S3C24XX_EINTPEND S3C24XX_EINTREG(0X038)
21
22#endif /* __ASM_ARCH_24A0_REGS_IRQ_H */
23
24
25
diff --git a/arch/arm/mach-s3c24a0/include/mach/system.h b/arch/arm/mach-s3c24a0/include/mach/system.h
new file mode 100644
index 00000000000..bd1bd195765
--- /dev/null
+++ b/arch/arm/mach-s3c24a0/include/mach/system.h
@@ -0,0 +1,25 @@
1/* linux/arch/arm/mach-s3c24a0/include/mach/system.h
2 *
3 * Copyright 2008 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk>
5 *
6 * S3C24A0 - System function defines and includes
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 <mach/hardware.h>
14#include <asm/io.h>
15
16#include <mach/map.h>
17
18static void arch_idle(void)
19{
20 /* currently no specific idle support. */
21}
22
23void (*s3c24xx_reset_hook)(void);
24
25#include <asm/plat-s3c24xx/system-reset.h>
diff --git a/arch/arm/mach-s3c24a0/include/mach/tick.h b/arch/arm/mach-s3c24a0/include/mach/tick.h
new file mode 100644
index 00000000000..9dea8ba6fb7
--- /dev/null
+++ b/arch/arm/mach-s3c24a0/include/mach/tick.h
@@ -0,0 +1,15 @@
1/* linux/arch/arm/mach-s3c24a0/include/mach/tick.h
2 *
3 * Copyright 2008 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk>
5 * http://armlinux.simtec.co.uk/
6 *
7 * S3C24A0 - timer tick support
8 */
9
10#define SUBSRC_TIMER4 (1 << (IRQ_TIMER4 - IRQ_S3CUART_RX0))
11
12static inline int s3c24xx_ostimer_pending(void)
13{
14 return __raw_readl(S3C2410_SUBSRCPND) & SUBSRC_TIMER4;
15}
diff --git a/arch/arm/mach-s3c24a0/include/mach/timex.h b/arch/arm/mach-s3c24a0/include/mach/timex.h
new file mode 100644
index 00000000000..98573424a01
--- /dev/null
+++ b/arch/arm/mach-s3c24a0/include/mach/timex.h
@@ -0,0 +1,18 @@
1/* linux/arch/arm/mach-s3c24a0/include/mach/timex.h
2 *
3 * Copyright (c) 2008 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk>
5 *
6 * S3C2410 - time parameters
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_TIMEX_H
14#define __ASM_ARCH_TIMEX_H
15
16#define CLOCK_TICK_RATE 12000000
17
18#endif /* __ASM_ARCH_TIMEX_H */
diff --git a/arch/arm/mach-s3c24a0/include/mach/vmalloc.h b/arch/arm/mach-s3c24a0/include/mach/vmalloc.h
new file mode 100644
index 00000000000..4d4fe484958
--- /dev/null
+++ b/arch/arm/mach-s3c24a0/include/mach/vmalloc.h
@@ -0,0 +1,17 @@
1/* linux/include/asm-arm/arch-s3c24ao/vmalloc.h
2 *
3 * Copyright 2008 Simtec Electronics <linux@simtec.co.uk>
4
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation.
8 *
9 * S3C24A0 vmalloc definition
10*/
11
12#ifndef __ASM_ARCH_VMALLOC_H
13#define __ASM_ARCH_VMALLOC_H
14
15#define VMALLOC_END (0xE0000000)
16
17#endif /* __ASM_ARCH_VMALLOC_H */
diff --git a/arch/arm/mach-s3c6400/Kconfig b/arch/arm/mach-s3c6400/Kconfig
new file mode 100644
index 00000000000..6da82b5c09b
--- /dev/null
+++ b/arch/arm/mach-s3c6400/Kconfig
@@ -0,0 +1,8 @@
1# arch/arm/mach-s3c6400/Kconfig
2#
3# Copyright 2008 Openmoko, Inc.
4# Simtec Electronics, Ben Dooks <ben@simtec.co.uk>
5#
6# Licensed under GPLv2
7
8# Currently nothing here, this will be added later
diff --git a/arch/arm/mach-s3c6400/Makefile b/arch/arm/mach-s3c6400/Makefile
new file mode 100644
index 00000000000..8f397db25b8
--- /dev/null
+++ b/arch/arm/mach-s3c6400/Makefile
@@ -0,0 +1,15 @@
1# arch/arm/mach-s3c6400/Makefile
2#
3# Copyright 2008 Openmoko, Inc.
4# Copyright 2008 Simtec Electronics
5#
6# Licensed under GPLv2
7
8obj-y :=
9obj-m :=
10obj-n :=
11obj- :=
12
13# Core support for S3C6400 system
14
15obj-n += blank.o
diff --git a/arch/arm/mach-s3c6400/Makefile.boot b/arch/arm/mach-s3c6400/Makefile.boot
new file mode 100644
index 00000000000..ba41fdc0a58
--- /dev/null
+++ b/arch/arm/mach-s3c6400/Makefile.boot
@@ -0,0 +1,2 @@
1 zreladdr-y := 0x50008000
2params_phys-y := 0x50000100
diff --git a/arch/arm/mach-s3c6400/include/mach/debug-macro.S b/arch/arm/mach-s3c6400/include/mach/debug-macro.S
new file mode 100644
index 00000000000..b18ac5266df
--- /dev/null
+++ b/arch/arm/mach-s3c6400/include/mach/debug-macro.S
@@ -0,0 +1,39 @@
1/* arch/arm/mach-s3c6400/include/mach/debug-macro.S
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 * 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/* pull in the relevant register and map files. */
14
15#include <mach/map.h>
16#include <plat/regs-serial.h>
17
18 /* note, for the boot process to work we have to keep the UART
19 * virtual address aligned to an 1MiB boundary for the L1
20 * mapping the head code makes. We keep the UART virtual address
21 * aligned and add in the offset when we load the value here.
22 */
23
24 .macro addruart, rx
25 mrc p15, 0, \rx, c1, c0
26 tst \rx, #1
27 ldreq \rx, = S3C_PA_UART
28 ldrne \rx, = (S3C_VA_UART + S3C_PA_UART & 0xfffff)
29#if CONFIG_DEBUG_S3C_UART != 0
30 add \rx, \rx, #(0x400 * CONFIG_DEBUG_S3C_UART)
31#endif
32 .endm
33
34/* include the reset of the code which will do the work, we're only
35 * compiling for a single cpu processor type so the default of s3c2440
36 * will be fine with us.
37 */
38
39#include <plat/debug-macro.S>
diff --git a/arch/arm/mach-s3c6400/include/mach/dma.h b/arch/arm/mach-s3c6400/include/mach/dma.h
new file mode 100644
index 00000000000..9771ac2cb07
--- /dev/null
+++ b/arch/arm/mach-s3c6400/include/mach/dma.h
@@ -0,0 +1,16 @@
1/* linux/arch/arm/mach-s3c6400/include/mach/dma.h
2 *
3 * Copyright 2008 Openmoko, Inc.
4 * Copyright 2008 Simtec Electronics
5 * Ben Dooks <ben@simtec.co.uk>
6 * http://armlinux.simtec.co.uk/
7 *
8 * S3C6400 - DMA support
9 */
10
11#ifndef __ASM_ARCH_DMA_H
12#define __ASM_ARCH_DMA_H __FILE__
13
14/* currently nothing here, placeholder */
15
16#endif /* __ASM_ARCH_IRQ_H */
diff --git a/arch/arm/mach-s3c6400/include/mach/entry-macro.S b/arch/arm/mach-s3c6400/include/mach/entry-macro.S
new file mode 100644
index 00000000000..fbd90d2cf35
--- /dev/null
+++ b/arch/arm/mach-s3c6400/include/mach/entry-macro.S
@@ -0,0 +1,44 @@
1/* arch/arm/mach-s3c6400/include/mach/entry-macro.S
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 * Low-level IRQ helper macros for the Samsung S3C64XX series
9 *
10 * This file is licensed under the terms of the GNU General Public
11 * License version 2. This program is licensed "as is" without any
12 * warranty of any kind, whether express or implied.
13*/
14
15#include <asm/hardware/vic.h>
16#include <mach/map.h>
17#include <plat/irqs.h>
18
19 .macro disable_fiq
20 .endm
21
22 .macro get_irqnr_preamble, base, tmp
23 ldr \base, =S3C_VA_VIC0
24 .endm
25
26 .macro arch_ret_to_user, tmp1, tmp2
27 .endm
28
29 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
30
31 @ check the vic0
32 mov \irqnr, # S3C_IRQ_OFFSET + 31
33 ldr \irqstat, [ \base, # VIC_IRQ_STATUS ]
34 teq \irqstat, #0
35
36 @ otherwise try vic1
37 addeq \tmp, \base, #(S3C_VA_VIC1 - S3C_VA_VIC0)
38 addeq \irqnr, \irqnr, #32
39 ldreq \irqstat, [ \tmp, # VIC_IRQ_STATUS ]
40 teqeq \irqstat, #0
41
42 clzne \irqstat, \irqstat
43 subne \irqnr, \irqnr, \irqstat
44 .endm
diff --git a/arch/arm/mach-s3c6400/include/mach/gpio.h b/arch/arm/mach-s3c6400/include/mach/gpio.h
new file mode 100644
index 00000000000..8b4254a23d9
--- /dev/null
+++ b/arch/arm/mach-s3c6400/include/mach/gpio.h
@@ -0,0 +1,22 @@
1/* arch/arm/mach-s3c6400/include/mach/gpio.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 * S3C6400 - GPIO lib support
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13*/
14
15#define gpio_get_value __gpio_get_value
16#define gpio_set_value __gpio_set_value
17#define gpio_cansleep __gpio_cansleep
18#define gpio_to_irq __gpio_to_irq
19
20#define ARCH_NR_GPIOS 188
21
22#include <asm-generic/gpio.h>
diff --git a/arch/arm/mach-s3c6400/include/mach/hardware.h b/arch/arm/mach-s3c6400/include/mach/hardware.h
new file mode 100644
index 00000000000..862d033e57a
--- /dev/null
+++ b/arch/arm/mach-s3c6400/include/mach/hardware.h
@@ -0,0 +1,16 @@
1/* linux/arch/arm/mach-s3c6400/include/mach/hardware.h
2 *
3 * Copyright 2008 Openmoko, Inc.
4 * Copyright 2008 Simtec Electronics
5 * Ben Dooks <ben@simtec.co.uk>
6 * http://armlinux.simtec.co.uk/
7 *
8 * S3C6400 - Hardware support
9 */
10
11#ifndef __ASM_ARCH_HARDWARE_H
12#define __ASM_ARCH_HARDWARE_H __FILE__
13
14/* currently nothing here, placeholder */
15
16#endif /* __ASM_ARCH_IRQ_H */
diff --git a/arch/arm/mach-s3c6400/include/mach/irqs.h b/arch/arm/mach-s3c6400/include/mach/irqs.h
new file mode 100644
index 00000000000..b38c47cffc2
--- /dev/null
+++ b/arch/arm/mach-s3c6400/include/mach/irqs.h
@@ -0,0 +1,20 @@
1/* linux/arch/arm/mach-s3c6400/include/mach/irqs.h
2 *
3 * Copyright 2008 Openmoko, Inc.
4 * Copyright 2008 Simtec Electronics
5 * Ben Dooks <ben@simtec.co.uk>
6 * http://armlinux.simtec.co.uk/
7 *
8 * S3C6400 - IRQ definitions
9 */
10
11#ifndef __ASM_ARCH_IRQS_H
12#define __ASM_ARCH_IRQS_H __FILE__
13
14#ifndef __ASM_ARM_IRQ_H
15#error "Do not include this directly, instead #include <asm/irq.h>"
16#endif
17
18#include <plat/irqs.h>
19
20#endif /* __ASM_ARCH_IRQ_H */
diff --git a/arch/arm/mach-s3c6400/include/mach/map.h b/arch/arm/mach-s3c6400/include/mach/map.h
new file mode 100644
index 00000000000..618f09d637b
--- /dev/null
+++ b/arch/arm/mach-s3c6400/include/mach/map.h
@@ -0,0 +1,53 @@
1/* linux/arch/arm/mach-s3c6400/include/mach/map.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 - Memory map definitions
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13*/
14
15#ifndef __ASM_ARCH_MAP_H
16#define __ASM_ARCH_MAP_H __FILE__
17
18#include <plat/map-base.h>
19
20#define S3C_PA_UART (0x7F005000)
21#define S3C_PA_UART0 (S3C_PA_UART + 0x00)
22#define S3C_PA_UART1 (S3C_PA_UART + 0x400)
23#define S3C_PA_UART2 (S3C_PA_UART + 0x800)
24#define S3C_PA_UART3 (S3C_PA_UART + 0xC00)
25#define S3C_UART_OFFSET (0x400)
26
27/* See notes on UART VA mapping in debug-macro.S */
28#define S3C_VA_UARTx(x) (S3C_VA_UART + (S3C_PA_UART & 0xfffff) + ((x) * S3C_UART_OFFSET))
29
30#define S3C_VA_UART0 S3C_VA_UARTx(0)
31#define S3C_VA_UART1 S3C_VA_UARTx(1)
32#define S3C_VA_UART2 S3C_VA_UARTx(2)
33#define S3C_VA_UART3 S3C_VA_UARTx(3)
34
35#define S3C64XX_PA_SYSCON (0x7E00F000)
36#define S3C64XX_PA_TIMER (0x7F006000)
37
38#define S3C64XX_PA_GPIO (0x7F008000)
39#define S3C64XX_VA_GPIO S3C_ADDR(0x00500000)
40#define S3C64XX_SZ_GPIO SZ_4K
41
42#define S3C64XX_PA_SDRAM (0x50000000)
43#define S3C64XX_PA_VIC0 (0x71200000)
44#define S3C64XX_PA_VIC1 (0x71300000)
45
46/* place VICs close together */
47#define S3C_VA_VIC0 (S3C_VA_IRQ + 0x00)
48#define S3C_VA_VIC1 (S3C_VA_IRQ + 0x10000)
49
50/* compatibiltiy defines. */
51#define S3C_PA_TIMER S3C64XX_PA_TIMER
52
53#endif /* __ASM_ARCH_6400_MAP_H */
diff --git a/arch/arm/mach-s3c6400/include/mach/memory.h b/arch/arm/mach-s3c6400/include/mach/memory.h
new file mode 100644
index 00000000000..38c381132f2
--- /dev/null
+++ b/arch/arm/mach-s3c6400/include/mach/memory.h
@@ -0,0 +1,21 @@
1/* arch/arm/mach-s3c6400/include/mach/memory.h
2 *
3 * Copyright 2008 Openmoko, Inc.
4 * Copyright 2008 Simtec Electronics
5 * Ben Dooks <ben@simtec.co.uk>
6 * http://armlinux.simtec.co.uk/
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_MEMORY_H
14#define __ASM_ARCH_MEMORY_H
15
16#define PHYS_OFFSET UL(0x50000000)
17
18#define __virt_to_bus(x) __virt_to_phys(x)
19#define __bus_to_virt(x) __phys_to_virt(x)
20
21#endif
diff --git a/arch/arm/mach-s3c6400/include/mach/pwm-clock.h b/arch/arm/mach-s3c6400/include/mach/pwm-clock.h
new file mode 100644
index 00000000000..b25bedee0d5
--- /dev/null
+++ b/arch/arm/mach-s3c6400/include/mach/pwm-clock.h
@@ -0,0 +1,56 @@
1/* linux/arch/arm/mach-s3c6400/include/mach/pwm-clock.h
2 *
3 * Copyright 2008 Openmoko, Inc.
4 * Copyright 2008 Simtec Electronics
5 * Ben Dooks <ben@simtec.co.uk>
6 * http://armlinux.simtec.co.uk/
7 *
8 * S3C64xx - pwm clock and timer support
9 */
10
11/**
12 * pwm_cfg_src_is_tclk() - return whether the given mux config is a tclk
13 * @tcfg: The timer TCFG1 register bits shifted down to 0.
14 *
15 * Return true if the given configuration from TCFG1 is a TCLK instead
16 * any of the TDIV clocks.
17 */
18static inline int pwm_cfg_src_is_tclk(unsigned long tcfg)
19{
20 return tcfg >= S3C64XX_TCFG1_MUX_TCLK;
21}
22
23/**
24 * tcfg_to_divisor() - convert tcfg1 setting to a divisor
25 * @tcfg1: The tcfg1 setting, shifted down.
26 *
27 * Get the divisor value for the given tcfg1 setting. We assume the
28 * caller has already checked to see if this is not a TCLK source.
29 */
30static inline unsigned long tcfg_to_divisor(unsigned long tcfg1)
31{
32 return 1 << tcfg1;
33}
34
35/**
36 * pwm_tdiv_has_div1() - does the tdiv setting have a /1
37 *
38 * Return true if we have a /1 in the tdiv setting.
39 */
40static inline unsigned int pwm_tdiv_has_div1(void)
41{
42 return 1;
43}
44
45/**
46 * pwm_tdiv_div_bits() - calculate TCFG1 divisor value.
47 * @div: The divisor to calculate the bit information for.
48 *
49 * Turn a divisor into the necessary bit field for TCFG1.
50 */
51static inline unsigned long pwm_tdiv_div_bits(unsigned int div)
52{
53 return ilog2(div);
54}
55
56#define S3C_TCFG1_MUX_TCLK S3C64XX_TCFG1_MUX_TCLK
diff --git a/arch/arm/mach-s3c6400/include/mach/regs-irq.h b/arch/arm/mach-s3c6400/include/mach/regs-irq.h
new file mode 100644
index 00000000000..bcce68a0bb7
--- /dev/null
+++ b/arch/arm/mach-s3c6400/include/mach/regs-irq.h
@@ -0,0 +1,20 @@
1/* linux/arch/arm/mach-s3c6400/include/mach/regs-irq.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 - IRQ register definitions
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13*/
14
15#ifndef __ASM_ARCH_REGS_IRQ_H
16#define __ASM_ARCH_REGS_IRQ_H __FILE__
17
18#include <asm/hardware/vic.h>
19
20#endif /* __ASM_ARCH_6400_REGS_IRQ_H */
diff --git a/arch/arm/mach-s3c6400/include/mach/system.h b/arch/arm/mach-s3c6400/include/mach/system.h
new file mode 100644
index 00000000000..652bbc403f0
--- /dev/null
+++ b/arch/arm/mach-s3c6400/include/mach/system.h
@@ -0,0 +1,24 @@
1/* linux/arch/arm/mach-s3c6400/include/mach/system.h
2 *
3 * Copyright 2008 Openmoko, Inc.
4 * Copyright 2008 Simtec Electronics
5 * Ben Dooks <ben@simtec.co.uk>
6 * http://armlinux.simtec.co.uk/
7 *
8 * S3C6400 - system implementation
9 */
10
11#ifndef __ASM_ARCH_SYSTEM_H
12#define __ASM_ARCH_SYSTEM_H __FILE__
13
14static void arch_idle(void)
15{
16 /* nothing here yet */
17}
18
19static void arch_reset(char mode)
20{
21 /* nothing here yet */
22}
23
24#endif /* __ASM_ARCH_IRQ_H */
diff --git a/arch/arm/mach-s3c6400/include/mach/tick.h b/arch/arm/mach-s3c6400/include/mach/tick.h
new file mode 100644
index 00000000000..d9c0dc7014e
--- /dev/null
+++ b/arch/arm/mach-s3c6400/include/mach/tick.h
@@ -0,0 +1,29 @@
1/* linux/arch/arm/mach-s3c6400/include/mach/tick.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 - Timer tick support definitions
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13*/
14
15#ifndef __ASM_ARCH_TICK_H
16#define __ASM_ARCH_TICK_H __FILE__
17
18/* note, the timer interrutps turn up in 2 places, the vic and then
19 * the timer block. We take the VIC as the base at the moment.
20 */
21static inline u32 s3c24xx_ostimer_pending(void)
22{
23 u32 pend = __raw_readl(S3C_VA_VIC0 + VIC_RAW_STATUS);
24 return pend & 1 << (IRQ_TIMER4_VIC - S3C64XX_IRQ_VIC0(0));
25}
26
27#define TICK_MAX (0xffffffff)
28
29#endif /* __ASM_ARCH_6400_TICK_H */
diff --git a/arch/arm/mach-s3c6400/include/mach/uncompress.h b/arch/arm/mach-s3c6400/include/mach/uncompress.h
new file mode 100644
index 00000000000..c6a82a20bf2
--- /dev/null
+++ b/arch/arm/mach-s3c6400/include/mach/uncompress.h
@@ -0,0 +1,28 @@
1/* arch/arm/mach-s3c6400/include/mach/uncompress.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 * S3C6400 - uncompress code
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13*/
14
15#ifndef __ASM_ARCH_UNCOMPRESS_H
16#define __ASM_ARCH_UNCOMPRESS_H
17
18#include <mach/map.h>
19#include <plat/uncompress.h>
20
21static void arch_detect_cpu(void)
22{
23 /* we do not need to do any cpu detection here at the moment. */
24 fifo_mask = S3C2440_UFSTAT_TXMASK;
25 fifo_max = 63 << S3C2440_UFSTAT_TXSHIFT;
26}
27
28#endif /* __ASM_ARCH_UNCOMPRESS_H */
diff --git a/arch/arm/mach-s3c6410/Kconfig b/arch/arm/mach-s3c6410/Kconfig
new file mode 100644
index 00000000000..75b1244cf8a
--- /dev/null
+++ b/arch/arm/mach-s3c6410/Kconfig
@@ -0,0 +1,21 @@
1# arch/arm/mach-s3c6410/Kconfig
2#
3# Copyright 2008 Openmoko, Inc.
4# Copyright 2008 Simtec Electronics
5#
6# Licensed under GPLv2
7
8# Configuration options for the S3C6410 CPU
9
10config CPU_S3C6410
11 bool
12 select CPU_S3C6400_INIT
13 select CPU_S3C6400_CLOCK
14 help
15 Enable S3C6410 CPU support
16
17config MACH_SMDK6410
18 bool "SMDK6410"
19 select CPU_S3C6410
20 help
21 Machine support for the Samsung SMDK6410
diff --git a/arch/arm/mach-s3c6410/Makefile b/arch/arm/mach-s3c6410/Makefile
new file mode 100644
index 00000000000..4a20a009990
--- /dev/null
+++ b/arch/arm/mach-s3c6410/Makefile
@@ -0,0 +1,19 @@
1# arch/arm/plat-s3c6410/Makefile
2#
3# Copyright 2008 Openmoko, Inc.
4# Copyright 2008 Simtec Electronics
5#
6# Licensed under GPLv2
7
8obj-y :=
9obj-m :=
10obj-n :=
11obj- :=
12
13# Core support for S3C6410 system
14
15obj-$(CONFIG_CPU_S3C6410) += cpu.o
16
17# machine support
18
19obj-$(CONFIG_MACH_SMDK6410) += mach-smdk6410.o
diff --git a/arch/arm/mach-s3c6410/cpu.c b/arch/arm/mach-s3c6410/cpu.c
new file mode 100644
index 00000000000..975cf88f0e8
--- /dev/null
+++ b/arch/arm/mach-s3c6410/cpu.c
@@ -0,0 +1,91 @@
1/* linux/arch/arm/mach-s3c6410/cpu.c
2 *
3 * Copyright 2008 Simtec Electronics
4 * Copyright 2008 Simtec Electronics
5 * Ben Dooks <ben@simtec.co.uk>
6 * http://armlinux.simtec.co.uk/
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/interrupt.h>
16#include <linux/list.h>
17#include <linux/timer.h>
18#include <linux/init.h>
19#include <linux/clk.h>
20#include <linux/io.h>
21#include <linux/sysdev.h>
22#include <linux/serial_core.h>
23#include <linux/platform_device.h>
24
25#include <asm/mach/arch.h>
26#include <asm/mach/map.h>
27#include <asm/mach/irq.h>
28
29#include <mach/hardware.h>
30#include <asm/irq.h>
31
32#include <plat/cpu-freq.h>
33#include <plat/regs-serial.h>
34
35#include <plat/cpu.h>
36#include <plat/devs.h>
37#include <plat/clock.h>
38#include <plat/s3c6400.h>
39#include <plat/s3c6410.h>
40
41/* Initial IO mappings */
42
43static struct map_desc s3c6410_iodesc[] __initdata = {
44};
45
46/* s3c6410_map_io
47 *
48 * register the standard cpu IO areas
49*/
50
51void __init s3c6410_map_io(void)
52{
53 iotable_init(s3c6410_iodesc, ARRAY_SIZE(s3c6410_iodesc));
54}
55
56void __init s3c6410_init_clocks(int xtal)
57{
58 printk(KERN_DEBUG "%s: initialising clocks\n", __func__);
59 s3c24xx_register_baseclocks(xtal);
60 s3c64xx_register_clocks();
61 s3c6400_register_clocks();
62 s3c6400_setup_clocks();
63}
64
65void __init s3c6410_init_irq(void)
66{
67 /* VIC0 is missing IRQ7, VIC1 is fully populated. */
68 s3c64xx_init_irq(~0 & ~(1 << 7), ~0);
69}
70
71struct sysdev_class s3c6410_sysclass = {
72 .name = "s3c6410-core",
73};
74
75static struct sys_device s3c6410_sysdev = {
76 .cls = &s3c6410_sysclass,
77};
78
79static int __init s3c6410_core_init(void)
80{
81 return sysdev_class_register(&s3c6410_sysclass);
82}
83
84core_initcall(s3c6410_core_init);
85
86int __init s3c6410_init(void)
87{
88 printk("S3C6410: Initialising architecture\n");
89
90 return sysdev_register(&s3c6410_sysdev);
91}
diff --git a/arch/arm/mach-s3c6410/mach-smdk6410.c b/arch/arm/mach-s3c6410/mach-smdk6410.c
new file mode 100644
index 00000000000..9213a8ba283
--- /dev/null
+++ b/arch/arm/mach-s3c6410/mach-smdk6410.c
@@ -0,0 +1,89 @@
1/* linux/arch/arm/mach-s3c6410/mach-smdk6410.c
2 *
3 * Copyright 2008 Openmoko, Inc.
4 * Copyright 2008 Simtec Electronics
5 * Ben Dooks <ben@simtec.co.uk>
6 * http://armlinux.simtec.co.uk/
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
14#include <linux/kernel.h>
15#include <linux/types.h>
16#include <linux/interrupt.h>
17#include <linux/list.h>
18#include <linux/timer.h>
19#include <linux/init.h>
20#include <linux/serial_core.h>
21#include <linux/platform_device.h>
22#include <linux/io.h>
23
24#include <asm/mach/arch.h>
25#include <asm/mach/map.h>
26#include <asm/mach/irq.h>
27
28#include <mach/hardware.h>
29#include <mach/map.h>
30
31#include <asm/irq.h>
32#include <asm/mach-types.h>
33
34#include <plat/regs-serial.h>
35
36#include <plat/s3c6410.h>
37#include <plat/clock.h>
38#include <plat/devs.h>
39#include <plat/cpu.h>
40
41#define UCON S3C2410_UCON_DEFAULT | S3C2410_UCON_UCLK
42#define ULCON S3C2410_LCON_CS8 | S3C2410_LCON_PNONE | S3C2410_LCON_STOPB
43#define UFCON S3C2410_UFCON_RXTRIG8 | S3C2410_UFCON_FIFOMODE
44
45static struct s3c2410_uartcfg smdk6410_uartcfgs[] __initdata = {
46 [0] = {
47 .hwport = 0,
48 .flags = 0,
49 .ucon = 0x3c5,
50 .ulcon = 0x03,
51 .ufcon = 0x51,
52 },
53 [1] = {
54 .hwport = 1,
55 .flags = 0,
56 .ucon = 0x3c5,
57 .ulcon = 0x03,
58 .ufcon = 0x51,
59 },
60};
61
62struct map_desc smdk6410_iodesc[] = {};
63
64static struct platform_device *smdk6410_devices[] __initdata = {
65};
66
67static void __init smdk6410_map_io(void)
68{
69 s3c64xx_init_io(smdk6410_iodesc, ARRAY_SIZE(smdk6410_iodesc));
70 s3c24xx_init_clocks(12000000);
71 s3c24xx_init_uarts(smdk6410_uartcfgs, ARRAY_SIZE(smdk6410_uartcfgs));
72}
73
74static void __init smdk6410_machine_init(void)
75{
76 platform_add_devices(smdk6410_devices, ARRAY_SIZE(smdk6410_devices));
77}
78
79MACHINE_START(SMDK6410, "SMDK6410")
80 /* Maintainer: Ben Dooks <ben@fluff.org> */
81 .phys_io = S3C_PA_UART & 0xfff00000,
82 .io_pg_offst = (((u32)S3C_VA_UART) >> 18) & 0xfffc,
83 .boot_params = S3C64XX_PA_SDRAM + 0x100,
84
85 .init_irq = s3c6410_init_irq,
86 .map_io = smdk6410_map_io,
87 .init_machine = smdk6410_machine_init,
88 .timer = &s3c24xx_timer,
89MACHINE_END
diff --git a/arch/arm/plat-s3c/Kconfig b/arch/arm/plat-s3c/Kconfig
index 10c1dd3cd46..adb9060ec91 100644
--- a/arch/arm/plat-s3c/Kconfig
+++ b/arch/arm/plat-s3c/Kconfig
@@ -6,8 +6,8 @@
6 6
7config PLAT_S3C 7config PLAT_S3C
8 bool 8 bool
9 depends on ARCH_S3C2410 9 depends on ARCH_S3C2410 || ARCH_S3C24A0 || ARCH_S3C64XX
10 default y if ARCH_S3C2410 10 default y
11 select NO_IOPORT 11 select NO_IOPORT
12 help 12 help
13 Base platform code for any Samsung S3C device 13 Base platform code for any Samsung S3C device
@@ -16,24 +16,24 @@ config PLAT_S3C
16 16
17config CPU_LLSERIAL_S3C2410_ONLY 17config CPU_LLSERIAL_S3C2410_ONLY
18 bool 18 bool
19 depends on ARCH_S3C2410 19 depends on PLAT_S3C
20 default y if CPU_LLSERIAL_S3C2410 && !CPU_LLSERIAL_S3C2440 20 default y if CPU_LLSERIAL_S3C2410 && !CPU_LLSERIAL_S3C2440
21 21
22config CPU_LLSERIAL_S3C2440_ONLY 22config CPU_LLSERIAL_S3C2440_ONLY
23 bool 23 bool
24 depends on ARCH_S3C2410 24 depends on PLAT_S3C
25 default y if CPU_LLSERIAL_S3C2440 && !CPU_LLSERIAL_S3C2410 25 default y if CPU_LLSERIAL_S3C2440 && !CPU_LLSERIAL_S3C2410
26 26
27config CPU_LLSERIAL_S3C2410 27config CPU_LLSERIAL_S3C2410
28 bool 28 bool
29 depends on ARCH_S3C2410 29 depends on PLAT_S3C
30 help 30 help
31 Selected if there is an S3C2410 (or register compatible) serial 31 Selected if there is an S3C2410 (or register compatible) serial
32 low-level implementation needed 32 low-level implementation needed
33 33
34config CPU_LLSERIAL_S3C2440 34config CPU_LLSERIAL_S3C2440
35 bool 35 bool
36 depends on ARCH_S3C2410 36 depends on PLAT_S3C
37 help 37 help
38 Selected if there is an S3C2440 (or register compatible) serial 38 Selected if there is an S3C2440 (or register compatible) serial
39 low-level implementation needed 39 low-level implementation needed
diff --git a/arch/arm/plat-s3c/clock.c b/arch/arm/plat-s3c/clock.c
index da7ac07c7a0..1054d18828f 100644
--- a/arch/arm/plat-s3c/clock.c
+++ b/arch/arm/plat-s3c/clock.c
@@ -239,6 +239,16 @@ struct clk clk_xtal = {
239 .ctrlbit = 0, 239 .ctrlbit = 0,
240}; 240};
241 241
242struct clk clk_ext = {
243 .name = "ext",
244 .id = -1,
245};
246
247struct clk clk_epll = {
248 .name = "epll",
249 .id = -1,
250};
251
242struct clk clk_mpll = { 252struct clk clk_mpll = {
243 .name = "mpll", 253 .name = "mpll",
244 .id = -1, 254 .id = -1,
diff --git a/arch/arm/plat-s3c/include/plat/clock.h b/arch/arm/plat-s3c/include/plat/clock.h
index d871609738f..a10622eed43 100644
--- a/arch/arm/plat-s3c/include/plat/clock.h
+++ b/arch/arm/plat-s3c/include/plat/clock.h
@@ -45,7 +45,13 @@ extern struct clk clk_h;
45extern struct clk clk_p; 45extern struct clk clk_p;
46extern struct clk clk_mpll; 46extern struct clk clk_mpll;
47extern struct clk clk_upll; 47extern struct clk clk_upll;
48extern struct clk clk_epll;
48extern struct clk clk_xtal; 49extern struct clk clk_xtal;
50extern struct clk clk_ext;
51
52/* S3C64XX specific clocks */
53extern struct clk clk_27m;
54extern struct clk clk_48m;
49 55
50/* exports for arch/arm/mach-s3c2410 56/* exports for arch/arm/mach-s3c2410
51 * 57 *
@@ -61,6 +67,8 @@ extern int s3c24xx_register_clocks(struct clk **clk, int nr_clks);
61 67
62extern int s3c24xx_register_baseclocks(unsigned long xtal); 68extern int s3c24xx_register_baseclocks(unsigned long xtal);
63 69
70extern void s3c64xx_register_clocks(void);
71
64extern void s3c24xx_setup_clocks(unsigned long fclk, 72extern void s3c24xx_setup_clocks(unsigned long fclk,
65 unsigned long hclk, 73 unsigned long hclk,
66 unsigned long pclk); 74 unsigned long pclk);
@@ -70,3 +78,11 @@ extern void s3c2412_setup_clocks(void);
70extern void s3c244x_setup_clocks(void); 78extern void s3c244x_setup_clocks(void);
71extern void s3c2443_setup_clocks(void); 79extern void s3c2443_setup_clocks(void);
72 80
81/* S3C64XX specific functions and clocks */
82
83extern int s3c64xx_sclk_ctrl(struct clk *clk, int enable);
84
85/* Init for pwm clock code */
86
87extern void s3c_pwmclk_init(void);
88
diff --git a/arch/arm/plat-s3c/include/plat/cpu.h b/arch/arm/plat-s3c/include/plat/cpu.h
index 011157ea871..e62ae0fcfe5 100644
--- a/arch/arm/plat-s3c/include/plat/cpu.h
+++ b/arch/arm/plat-s3c/include/plat/cpu.h
@@ -44,8 +44,10 @@ extern void s3c_init_cpu(unsigned long idcode,
44/* core initialisation functions */ 44/* core initialisation functions */
45 45
46extern void s3c24xx_init_irq(void); 46extern void s3c24xx_init_irq(void);
47extern void s3c64xx_init_irq(u32 vic0, u32 vic1);
47 48
48extern void s3c24xx_init_io(struct map_desc *mach_desc, int size); 49extern void s3c24xx_init_io(struct map_desc *mach_desc, int size);
50extern void s3c64xx_init_io(struct map_desc *mach_desc, int size);
49 51
50extern void s3c24xx_init_uarts(struct s3c2410_uartcfg *cfg, int no); 52extern void s3c24xx_init_uarts(struct s3c2410_uartcfg *cfg, int no);
51 53
diff --git a/arch/arm/plat-s3c/include/plat/debug-macro.S b/arch/arm/plat-s3c/include/plat/debug-macro.S
index 4aa7e2e6c00..3634d4e3708 100644
--- a/arch/arm/plat-s3c/include/plat/debug-macro.S
+++ b/arch/arm/plat-s3c/include/plat/debug-macro.S
@@ -20,7 +20,7 @@
20 .endm 20 .endm
21 21
22#ifndef fifo_level 22#ifndef fifo_level
23#define fifo_level fifo_level_s3c2410 23#define fifo_level fifo_level_s3c2440
24#endif 24#endif
25 25
26 .macro fifo_full_s3c2440 rd, rx 26 .macro fifo_full_s3c2440 rd, rx
diff --git a/arch/arm/plat-s3c/include/plat/devs.h b/arch/arm/plat-s3c/include/plat/devs.h
index badaac9d64a..a689c7c5ac2 100644
--- a/arch/arm/plat-s3c/include/plat/devs.h
+++ b/arch/arm/plat-s3c/include/plat/devs.h
@@ -17,6 +17,7 @@ struct s3c24xx_uart_resources {
17}; 17};
18 18
19extern struct s3c24xx_uart_resources s3c2410_uart_resources[]; 19extern struct s3c24xx_uart_resources s3c2410_uart_resources[];
20extern struct s3c24xx_uart_resources s3c64xx_uart_resources[];
20 21
21extern struct platform_device *s3c24xx_uart_devs[]; 22extern struct platform_device *s3c24xx_uart_devs[];
22extern struct platform_device *s3c24xx_uart_src[]; 23extern struct platform_device *s3c24xx_uart_src[];
diff --git a/arch/arm/plat-s3c/include/plat/map.h b/arch/arm/plat-s3c/include/plat/map-base.h
index b84289d32a5..b84289d32a5 100644
--- a/arch/arm/plat-s3c/include/plat/map.h
+++ b/arch/arm/plat-s3c/include/plat/map-base.h
diff --git a/arch/arm/plat-s3c/include/plat/regs-serial.h b/arch/arm/plat-s3c/include/plat/regs-serial.h
index a0daa647b92..3ca28585cf8 100644
--- a/arch/arm/plat-s3c/include/plat/regs-serial.h
+++ b/arch/arm/plat-s3c/include/plat/regs-serial.h
@@ -77,6 +77,12 @@
77#define S3C2440_UCON_FCLK (3<<10) 77#define S3C2440_UCON_FCLK (3<<10)
78#define S3C2443_UCON_EPLL (3<<10) 78#define S3C2443_UCON_EPLL (3<<10)
79 79
80#define S3C6400_UCON_CLKMASK (3<<10)
81#define S3C6400_UCON_PCLK (0<<10)
82#define S3C6400_UCON_PCLK2 (2<<10)
83#define S3C6400_UCON_UCLK0 (1<<10)
84#define S3C6400_UCON_UCLK1 (3<<10)
85
80#define S3C2440_UCON2_FCLK_EN (1<<15) 86#define S3C2440_UCON2_FCLK_EN (1<<15)
81#define S3C2440_UCON0_DIVMASK (15 << 12) 87#define S3C2440_UCON0_DIVMASK (15 << 12)
82#define S3C2440_UCON1_DIVMASK (15 << 12) 88#define S3C2440_UCON1_DIVMASK (15 << 12)
@@ -149,6 +155,14 @@
149#define S3C2410_UFSTAT_RXMASK (15<<0) 155#define S3C2410_UFSTAT_RXMASK (15<<0)
150#define S3C2410_UFSTAT_RXSHIFT (0) 156#define S3C2410_UFSTAT_RXSHIFT (0)
151 157
158/* UFSTAT S3C24A0 */
159#define S3C24A0_UFSTAT_TXFULL (1 << 14)
160#define S3C24A0_UFSTAT_RXFULL (1 << 6)
161#define S3C24A0_UFSTAT_TXMASK (63 << 8)
162#define S3C24A0_UFSTAT_TXSHIFT (8)
163#define S3C24A0_UFSTAT_RXMASK (63)
164#define S3C24A0_UFSTAT_RXSHIFT (0)
165
152/* UFSTAT S3C2443 same as S3C2440 */ 166/* UFSTAT S3C2443 same as S3C2440 */
153#define S3C2440_UFSTAT_TXFULL (1<<14) 167#define S3C2440_UFSTAT_TXFULL (1<<14)
154#define S3C2440_UFSTAT_RXFULL (1<<6) 168#define S3C2440_UFSTAT_RXFULL (1<<6)
diff --git a/arch/arm/plat-s3c/include/plat/regs-timer.h b/arch/arm/plat-s3c/include/plat/regs-timer.h
index cc0eedd53e3..d097d92f8cc 100644
--- a/arch/arm/plat-s3c/include/plat/regs-timer.h
+++ b/arch/arm/plat-s3c/include/plat/regs-timer.h
@@ -10,7 +10,6 @@
10 * S3C2410 Timer configuration 10 * S3C2410 Timer configuration
11*/ 11*/
12 12
13
14#ifndef __ASM_ARCH_REGS_TIMER_H 13#ifndef __ASM_ARCH_REGS_TIMER_H
15#define __ASM_ARCH_REGS_TIMER_H 14#define __ASM_ARCH_REGS_TIMER_H
16 15
@@ -21,6 +20,8 @@
21#define S3C2410_TCFG1 S3C_TIMERREG(0x04) 20#define S3C2410_TCFG1 S3C_TIMERREG(0x04)
22#define S3C2410_TCON S3C_TIMERREG(0x08) 21#define S3C2410_TCON S3C_TIMERREG(0x08)
23 22
23#define S3C64XX_TINT_CSTAT S3C_TIMERREG(0x44)
24
24#define S3C2410_TCFG_PRESCALER0_MASK (255<<0) 25#define S3C2410_TCFG_PRESCALER0_MASK (255<<0)
25#define S3C2410_TCFG_PRESCALER1_MASK (255<<8) 26#define S3C2410_TCFG_PRESCALER1_MASK (255<<8)
26#define S3C2410_TCFG_PRESCALER1_SHIFT (8) 27#define S3C2410_TCFG_PRESCALER1_SHIFT (8)
@@ -72,6 +73,14 @@
72#define S3C2410_TCFG1_MUX_TCLK (4<<0) 73#define S3C2410_TCFG1_MUX_TCLK (4<<0)
73#define S3C2410_TCFG1_MUX_MASK (15<<0) 74#define S3C2410_TCFG1_MUX_MASK (15<<0)
74 75
76#define S3C64XX_TCFG1_MUX_DIV1 (0<<0)
77#define S3C64XX_TCFG1_MUX_DIV2 (1<<0)
78#define S3C64XX_TCFG1_MUX_DIV4 (2<<0)
79#define S3C64XX_TCFG1_MUX_DIV8 (3<<0)
80#define S3C64XX_TCFG1_MUX_DIV16 (4<<0)
81#define S3C64XX_TCFG1_MUX_TCLK (5<<0) /* 3 sets of TCLK */
82#define S3C64XX_TCFG1_MUX_MASK (15<<0)
83
75#define S3C2410_TCFG1_SHIFT(x) ((x) * 4) 84#define S3C2410_TCFG1_SHIFT(x) ((x) * 4)
76 85
77/* for each timer, we have an count buffer, an compare buffer and 86/* for each timer, we have an count buffer, an compare buffer and
diff --git a/arch/arm/plat-s3c/include/plat/uncompress.h b/arch/arm/plat-s3c/include/plat/uncompress.h
index 2c39a309aeb..6061de87f22 100644
--- a/arch/arm/plat-s3c/include/plat/uncompress.h
+++ b/arch/arm/plat-s3c/include/plat/uncompress.h
@@ -37,7 +37,7 @@ static void arch_detect_cpu(void);
37/* how many bytes we allow into the FIFO at a time in FIFO mode */ 37/* how many bytes we allow into the FIFO at a time in FIFO mode */
38#define FIFO_MAX (14) 38#define FIFO_MAX (14)
39 39
40#define uart_base S3C24XX_PA_UART + (0x4000*CONFIG_S3C_LOWLEVEL_UART_PORT) 40#define uart_base S3C_PA_UART + (S3C_UART_OFFSET * CONFIG_S3C_LOWLEVEL_UART_PORT)
41 41
42static __inline__ void 42static __inline__ void
43uart_wr(unsigned int reg, unsigned int val) 43uart_wr(unsigned int reg, unsigned int val)
diff --git a/arch/arm/plat-s3c/pwm-clock.c b/arch/arm/plat-s3c/pwm-clock.c
index e07d82891a9..a318215ab53 100644
--- a/arch/arm/plat-s3c/pwm-clock.c
+++ b/arch/arm/plat-s3c/pwm-clock.c
@@ -14,20 +14,20 @@
14#include <linux/kernel.h> 14#include <linux/kernel.h>
15#include <linux/list.h> 15#include <linux/list.h>
16#include <linux/errno.h> 16#include <linux/errno.h>
17#include <linux/log2.h>
17#include <linux/clk.h> 18#include <linux/clk.h>
18#include <linux/err.h> 19#include <linux/err.h>
19#include <linux/io.h> 20#include <linux/io.h>
20 21
21#include <mach/hardware.h> 22#include <mach/hardware.h>
23#include <mach/map.h>
22#include <asm/irq.h> 24#include <asm/irq.h>
23 25
24#include <mach/regs-clock.h>
25#include <mach/regs-gpio.h>
26
27#include <plat/clock.h> 26#include <plat/clock.h>
28#include <plat/cpu.h> 27#include <plat/cpu.h>
29 28
30#include <plat/regs-timer.h> 29#include <plat/regs-timer.h>
30#include <mach/pwm-clock.h>
31 31
32/* Each of the timers 0 through 5 go through the following 32/* Each of the timers 0 through 5 go through the following
33 * clock tree, with the inputs depending on the timers. 33 * clock tree, with the inputs depending on the timers.
@@ -168,11 +168,6 @@ static inline struct pwm_tdiv_clk *to_tdiv(struct clk *clk)
168 return container_of(clk, struct pwm_tdiv_clk, clk); 168 return container_of(clk, struct pwm_tdiv_clk, clk);
169} 169}
170 170
171static inline unsigned long tcfg_to_divisor(unsigned long tcfg1)
172{
173 return 1 << (1 + tcfg1);
174}
175
176static unsigned long clk_pwm_tdiv_get_rate(struct clk *clk) 171static unsigned long clk_pwm_tdiv_get_rate(struct clk *clk)
177{ 172{
178 unsigned long tcfg1 = __raw_readl(S3C2410_TCFG1); 173 unsigned long tcfg1 = __raw_readl(S3C2410_TCFG1);
@@ -181,7 +176,7 @@ static unsigned long clk_pwm_tdiv_get_rate(struct clk *clk)
181 tcfg1 >>= S3C2410_TCFG1_SHIFT(clk->id); 176 tcfg1 >>= S3C2410_TCFG1_SHIFT(clk->id);
182 tcfg1 &= S3C2410_TCFG1_MUX_MASK; 177 tcfg1 &= S3C2410_TCFG1_MUX_MASK;
183 178
184 if (tcfg1 == S3C2410_TCFG1_MUX_TCLK) 179 if (pwm_cfg_src_is_tclk(tcfg1))
185 divisor = to_tdiv(clk)->divisor; 180 divisor = to_tdiv(clk)->divisor;
186 else 181 else
187 divisor = tcfg_to_divisor(tcfg1); 182 divisor = tcfg_to_divisor(tcfg1);
@@ -198,7 +193,9 @@ static unsigned long clk_pwm_tdiv_round_rate(struct clk *clk,
198 parent_rate = clk_get_rate(clk->parent); 193 parent_rate = clk_get_rate(clk->parent);
199 divisor = parent_rate / rate; 194 divisor = parent_rate / rate;
200 195
201 if (divisor <= 2) 196 if (divisor <= 1 && pwm_tdiv_has_div1())
197 divisor = 1;
198 else if (divisor <= 2)
202 divisor = 2; 199 divisor = 2;
203 else if (divisor <= 4) 200 else if (divisor <= 4)
204 divisor = 4; 201 divisor = 4;
@@ -212,25 +209,7 @@ static unsigned long clk_pwm_tdiv_round_rate(struct clk *clk,
212 209
213static unsigned long clk_pwm_tdiv_bits(struct pwm_tdiv_clk *divclk) 210static unsigned long clk_pwm_tdiv_bits(struct pwm_tdiv_clk *divclk)
214{ 211{
215 unsigned long bits; 212 return pwm_tdiv_div_bits(divclk->divisor);
216
217 switch (divclk->divisor) {
218 case 2:
219 bits = S3C2410_TCFG1_MUX_DIV2;
220 break;
221 case 4:
222 bits = S3C2410_TCFG1_MUX_DIV4;
223 break;
224 case 8:
225 bits = S3C2410_TCFG1_MUX_DIV8;
226 break;
227 case 16:
228 default:
229 bits = S3C2410_TCFG1_MUX_DIV16;
230 break;
231 }
232
233 return bits;
234} 213}
235 214
236static void clk_pwm_tdiv_update(struct pwm_tdiv_clk *divclk) 215static void clk_pwm_tdiv_update(struct pwm_tdiv_clk *divclk)
@@ -271,7 +250,7 @@ static int clk_pwm_tdiv_set_rate(struct clk *clk, unsigned long rate)
271 /* Update the current MUX settings if we are currently 250 /* Update the current MUX settings if we are currently
272 * selected as the clock source for this clock. */ 251 * selected as the clock source for this clock. */
273 252
274 if (tcfg1 != S3C2410_TCFG1_MUX_TCLK) 253 if (!pwm_cfg_src_is_tclk(tcfg1))
275 clk_pwm_tdiv_update(divclk); 254 clk_pwm_tdiv_update(divclk);
276 255
277 return 0; 256 return 0;
@@ -358,7 +337,7 @@ static int clk_pwm_tin_set_parent(struct clk *clk, struct clk *parent)
358 unsigned long shift = S3C2410_TCFG1_SHIFT(id); 337 unsigned long shift = S3C2410_TCFG1_SHIFT(id);
359 338
360 if (parent == s3c24xx_pwmclk_tclk(id)) 339 if (parent == s3c24xx_pwmclk_tclk(id))
361 bits = S3C2410_TCFG1_MUX_TCLK << shift; 340 bits = S3C_TCFG1_MUX_TCLK << shift;
362 else if (parent == s3c24xx_pwmclk_tdiv(id)) 341 else if (parent == s3c24xx_pwmclk_tdiv(id))
363 bits = clk_pwm_tdiv_bits(to_tdiv(parent)) << shift; 342 bits = clk_pwm_tdiv_bits(to_tdiv(parent)) << shift;
364 else 343 else
@@ -420,7 +399,7 @@ static __init int clk_pwm_tin_register(struct clk *pwm)
420 tcfg1 >>= S3C2410_TCFG1_SHIFT(id); 399 tcfg1 >>= S3C2410_TCFG1_SHIFT(id);
421 tcfg1 &= S3C2410_TCFG1_MUX_MASK; 400 tcfg1 &= S3C2410_TCFG1_MUX_MASK;
422 401
423 if (tcfg1 == S3C2410_TCFG1_MUX_TCLK) 402 if (pwm_cfg_src_is_tclk(tcfg1))
424 parent = s3c24xx_pwmclk_tclk(id); 403 parent = s3c24xx_pwmclk_tclk(id);
425 else 404 else
426 parent = s3c24xx_pwmclk_tdiv(id); 405 parent = s3c24xx_pwmclk_tdiv(id);
@@ -428,7 +407,16 @@ static __init int clk_pwm_tin_register(struct clk *pwm)
428 return clk_set_parent(pwm, parent); 407 return clk_set_parent(pwm, parent);
429} 408}
430 409
431static __init int s3c24xx_pwmclk_init(void) 410/**
411 * s3c_pwmclk_init() - initialise pwm clocks
412 *
413 * Initialise and register the clocks which provide the inputs for the
414 * pwm timer blocks.
415 *
416 * Note, this call is required by the time core, so must be called after
417 * the base clocks are added and before any of the initcalls are run.
418 */
419__init void s3c_pwmclk_init(void)
432{ 420{
433 struct clk *clk_timers; 421 struct clk *clk_timers;
434 unsigned int clk; 422 unsigned int clk;
@@ -437,7 +425,7 @@ static __init int s3c24xx_pwmclk_init(void)
437 clk_timers = clk_get(NULL, "timers"); 425 clk_timers = clk_get(NULL, "timers");
438 if (IS_ERR(clk_timers)) { 426 if (IS_ERR(clk_timers)) {
439 printk(KERN_ERR "%s: no parent clock\n", __func__); 427 printk(KERN_ERR "%s: no parent clock\n", __func__);
440 return -EINVAL; 428 return;
441 } 429 }
442 430
443 for (clk = 0; clk < ARRAY_SIZE(clk_timer_scaler); clk++) { 431 for (clk = 0; clk < ARRAY_SIZE(clk_timer_scaler); clk++) {
@@ -445,7 +433,7 @@ static __init int s3c24xx_pwmclk_init(void)
445 ret = s3c24xx_register_clock(&clk_timer_scaler[clk]); 433 ret = s3c24xx_register_clock(&clk_timer_scaler[clk]);
446 if (ret < 0) { 434 if (ret < 0) {
447 printk(KERN_ERR "error adding pwm scaler%d clock\n", clk); 435 printk(KERN_ERR "error adding pwm scaler%d clock\n", clk);
448 goto err; 436 return;
449 } 437 }
450 } 438 }
451 439
@@ -453,7 +441,7 @@ static __init int s3c24xx_pwmclk_init(void)
453 ret = s3c24xx_register_clock(&clk_timer_tclk[clk]); 441 ret = s3c24xx_register_clock(&clk_timer_tclk[clk]);
454 if (ret < 0) { 442 if (ret < 0) {
455 printk(KERN_ERR "error adding pww tclk%d\n", clk); 443 printk(KERN_ERR "error adding pww tclk%d\n", clk);
456 goto err; 444 return;
457 } 445 }
458 } 446 }
459 447
@@ -461,7 +449,7 @@ static __init int s3c24xx_pwmclk_init(void)
461 ret = clk_pwm_tdiv_register(clk); 449 ret = clk_pwm_tdiv_register(clk);
462 if (ret < 0) { 450 if (ret < 0) {
463 printk(KERN_ERR "error adding pwm%d tdiv clock\n", clk); 451 printk(KERN_ERR "error adding pwm%d tdiv clock\n", clk);
464 goto err; 452 return;
465 } 453 }
466 } 454 }
467 455
@@ -469,14 +457,7 @@ static __init int s3c24xx_pwmclk_init(void)
469 ret = clk_pwm_tin_register(&clk_tin[clk]); 457 ret = clk_pwm_tin_register(&clk_tin[clk]);
470 if (ret < 0) { 458 if (ret < 0) {
471 printk(KERN_ERR "error adding pwm%d tin clock\n", clk); 459 printk(KERN_ERR "error adding pwm%d tin clock\n", clk);
472 goto err; 460 return;
473 } 461 }
474 } 462 }
475
476 return 0;
477
478 err:
479 return ret;
480} 463}
481
482arch_initcall(s3c24xx_pwmclk_init);
diff --git a/arch/arm/plat-s3c/time.c b/arch/arm/plat-s3c/time.c
index c6861a05a29..3b27b29da47 100644
--- a/arch/arm/plat-s3c/time.c
+++ b/arch/arm/plat-s3c/time.c
@@ -26,6 +26,7 @@
26#include <linux/err.h> 26#include <linux/err.h>
27#include <linux/clk.h> 27#include <linux/clk.h>
28#include <linux/io.h> 28#include <linux/io.h>
29#include <linux/platform_device.h>
29 30
30#include <asm/system.h> 31#include <asm/system.h>
31#include <asm/leds.h> 32#include <asm/leds.h>
@@ -36,6 +37,7 @@
36#include <plat/regs-timer.h> 37#include <plat/regs-timer.h>
37#include <mach/regs-irq.h> 38#include <mach/regs-irq.h>
38#include <asm/mach/time.h> 39#include <asm/mach/time.h>
40#include <mach/tick.h>
39 41
40#include <plat/clock.h> 42#include <plat/clock.h>
41#include <plat/cpu.h> 43#include <plat/cpu.h>
@@ -43,6 +45,10 @@
43static unsigned long timer_startval; 45static unsigned long timer_startval;
44static unsigned long timer_usec_ticks; 46static unsigned long timer_usec_ticks;
45 47
48#ifndef TICK_MAX
49#define TICK_MAX (0xffff)
50#endif
51
46#define TIMER_USEC_SHIFT 16 52#define TIMER_USEC_SHIFT 16
47 53
48/* we use the shifted arithmetic to work out the ratio of timer ticks 54/* we use the shifted arithmetic to work out the ratio of timer ticks
@@ -91,12 +97,9 @@ static inline unsigned long timer_ticks_to_usec(unsigned long ticks)
91 * IRQs are disabled before entering here from do_gettimeofday() 97 * IRQs are disabled before entering here from do_gettimeofday()
92 */ 98 */
93 99
94#define SRCPND_TIMER4 (1<<(IRQ_TIMER4 - IRQ_EINT0))
95
96static unsigned long s3c2410_gettimeoffset (void) 100static unsigned long s3c2410_gettimeoffset (void)
97{ 101{
98 unsigned long tdone; 102 unsigned long tdone;
99 unsigned long irqpend;
100 unsigned long tval; 103 unsigned long tval;
101 104
102 /* work out how many ticks have gone since last timer interrupt */ 105 /* work out how many ticks have gone since last timer interrupt */
@@ -106,8 +109,7 @@ static unsigned long s3c2410_gettimeoffset (void)
106 109
107 /* check to see if there is an interrupt pending */ 110 /* check to see if there is an interrupt pending */
108 111
109 irqpend = __raw_readl(S3C2410_SRCPND); 112 if (s3c24xx_ostimer_pending()) {
110 if (irqpend & SRCPND_TIMER4) {
111 /* re-read the timer, and try and fix up for the missed 113 /* re-read the timer, and try and fix up for the missed
112 * interrupt. Note, the interrupt may go off before the 114 * interrupt. Note, the interrupt may go off before the
113 * timer has re-loaded from wrapping. 115 * timer has re-loaded from wrapping.
@@ -146,6 +148,10 @@ static struct irqaction s3c2410_timer_irq = {
146 machine_is_anubis() || \ 148 machine_is_anubis() || \
147 machine_is_osiris()) 149 machine_is_osiris())
148 150
151static struct clk *tin;
152static struct clk *tdiv;
153static struct clk *timerclk;
154
149/* 155/*
150 * Set up timer interrupt, and return the current time in seconds. 156 * Set up timer interrupt, and return the current time in seconds.
151 * 157 *
@@ -159,13 +165,7 @@ static void s3c2410_timer_setup (void)
159 unsigned long tcfg1; 165 unsigned long tcfg1;
160 unsigned long tcfg0; 166 unsigned long tcfg0;
161 167
162 tcnt = 0xffff; /* default value for tcnt */ 168 tcnt = TICK_MAX; /* default value for tcnt */
163
164 /* read the current timer configuration bits */
165
166 tcon = __raw_readl(S3C2410_TCON);
167 tcfg1 = __raw_readl(S3C2410_TCFG1);
168 tcfg0 = __raw_readl(S3C2410_TCFG0);
169 169
170 /* configure the system for whichever machine is in use */ 170 /* configure the system for whichever machine is in use */
171 171
@@ -174,11 +174,13 @@ static void s3c2410_timer_setup (void)
174 timer_usec_ticks = timer_mask_usec_ticks(1, 12000000); 174 timer_usec_ticks = timer_mask_usec_ticks(1, 12000000);
175 tcnt = 12000000 / HZ; 175 tcnt = 12000000 / HZ;
176 176
177 tcfg1 = __raw_readl(S3C2410_TCFG1);
177 tcfg1 &= ~S3C2410_TCFG1_MUX4_MASK; 178 tcfg1 &= ~S3C2410_TCFG1_MUX4_MASK;
178 tcfg1 |= S3C2410_TCFG1_MUX4_TCLK1; 179 tcfg1 |= S3C2410_TCFG1_MUX4_TCLK1;
180 __raw_writel(tcfg1, S3C2410_TCFG1);
179 } else { 181 } else {
180 unsigned long pclk; 182 unsigned long pclk;
181 struct clk *clk; 183 struct clk *tscaler;
182 184
183 /* for the h1940 (and others), we use the pclk from the core 185 /* for the h1940 (and others), we use the pclk from the core
184 * to generate the timer values. since values around 50 to 186 * to generate the timer values. since values around 50 to
@@ -189,29 +191,25 @@ static void s3c2410_timer_setup (void)
189 * (8.45 ticks per usec) 191 * (8.45 ticks per usec)
190 */ 192 */
191 193
192 /* this is used as default if no other timer can be found */ 194 pclk = clk_get_rate(timerclk);
193
194 clk = clk_get(NULL, "timers");
195 if (IS_ERR(clk))
196 panic("failed to get clock for system timer");
197
198 clk_enable(clk);
199
200 pclk = clk_get_rate(clk);
201 195
202 /* configure clock tick */ 196 /* configure clock tick */
203 197
204 timer_usec_ticks = timer_mask_usec_ticks(6, pclk); 198 timer_usec_ticks = timer_mask_usec_ticks(6, pclk);
205 199
206 tcfg1 &= ~S3C2410_TCFG1_MUX4_MASK; 200 tscaler = clk_get_parent(tdiv);
207 tcfg1 |= S3C2410_TCFG1_MUX4_DIV2;
208 201
209 tcfg0 &= ~S3C2410_TCFG_PRESCALER1_MASK; 202 clk_set_rate(tscaler, pclk / 3);
210 tcfg0 |= ((6 - 1) / 2) << S3C2410_TCFG_PRESCALER1_SHIFT; 203 clk_set_rate(tdiv, pclk / 6);
204 clk_set_parent(tin, tdiv);
211 205
212 tcnt = (pclk / 6) / HZ; 206 tcnt = clk_get_rate(tin) / HZ;
213 } 207 }
214 208
209 tcon = __raw_readl(S3C2410_TCON);
210 tcfg0 = __raw_readl(S3C2410_TCFG0);
211 tcfg1 = __raw_readl(S3C2410_TCFG1);
212
215 /* timers reload after counting zero, so reduce the count by 1 */ 213 /* timers reload after counting zero, so reduce the count by 1 */
216 214
217 tcnt--; 215 tcnt--;
@@ -220,7 +218,7 @@ static void s3c2410_timer_setup (void)
220 tcon, tcnt, tcfg0, tcfg1, timer_usec_ticks); 218 tcon, tcnt, tcfg0, tcfg1, timer_usec_ticks);
221 219
222 /* check to see if timer is within 16bit range... */ 220 /* check to see if timer is within 16bit range... */
223 if (tcnt > 0xffff) { 221 if (tcnt > TICK_MAX) {
224 panic("setup_timer: HZ is too small, cannot configure timer!"); 222 panic("setup_timer: HZ is too small, cannot configure timer!");
225 return; 223 return;
226 } 224 }
@@ -247,8 +245,35 @@ static void s3c2410_timer_setup (void)
247 __raw_writel(tcon, S3C2410_TCON); 245 __raw_writel(tcon, S3C2410_TCON);
248} 246}
249 247
248static void __init s3c2410_timer_resources(void)
249{
250 struct platform_device tmpdev;
251
252 tmpdev.dev.bus = &platform_bus_type;
253 tmpdev.id = 4;
254
255 timerclk = clk_get(NULL, "timers");
256 if (IS_ERR(timerclk))
257 panic("failed to get clock for system timer");
258
259 clk_enable(timerclk);
260
261 if (!use_tclk1_12()) {
262 tin = clk_get(&tmpdev.dev, "pwm-tin");
263 if (IS_ERR(tin))
264 panic("failed to get pwm-tin clock for system timer");
265
266 tdiv = clk_get(&tmpdev.dev, "pwm-tdiv");
267 if (IS_ERR(tdiv))
268 panic("failed to get pwm-tdiv clock for system timer");
269 }
270
271 clk_enable(tin);
272}
273
250static void __init s3c2410_timer_init(void) 274static void __init s3c2410_timer_init(void)
251{ 275{
276 s3c2410_timer_resources();
252 s3c2410_timer_setup(); 277 s3c2410_timer_setup();
253 setup_irq(IRQ_TIMER4, &s3c2410_timer_irq); 278 setup_irq(IRQ_TIMER4, &s3c2410_timer_irq);
254} 279}
diff --git a/arch/arm/plat-s3c24xx/Kconfig b/arch/arm/plat-s3c24xx/Kconfig
index 0e07de2c9a9..2c8a2f5d75f 100644
--- a/arch/arm/plat-s3c24xx/Kconfig
+++ b/arch/arm/plat-s3c24xx/Kconfig
@@ -6,8 +6,8 @@
6 6
7config PLAT_S3C24XX 7config PLAT_S3C24XX
8 bool 8 bool
9 depends on ARCH_S3C2410 9 depends on ARCH_S3C2410 || ARCH_S3C24A0
10 default y if ARCH_S3C2410 10 default y
11 select NO_IOPORT 11 select NO_IOPORT
12 select ARCH_REQUIRE_GPIOLIB 12 select ARCH_REQUIRE_GPIOLIB
13 help 13 help
diff --git a/arch/arm/plat-s3c24xx/devs.c b/arch/arm/plat-s3c24xx/devs.c
index 6a33dbc494f..9826efb91e4 100644
--- a/arch/arm/plat-s3c24xx/devs.c
+++ b/arch/arm/plat-s3c24xx/devs.c
@@ -192,8 +192,8 @@ void __init s3c24xx_fb_set_platdata(struct s3c2410fb_mach_info *pd)
192 192
193static struct resource s3c_nand_resource[] = { 193static struct resource s3c_nand_resource[] = {
194 [0] = { 194 [0] = {
195 .start = S3C2410_PA_NAND, 195 .start = S3C24XX_PA_NAND,
196 .end = S3C2410_PA_NAND + S3C24XX_SZ_NAND - 1, 196 .end = S3C24XX_PA_NAND + S3C24XX_SZ_NAND - 1,
197 .flags = IORESOURCE_MEM, 197 .flags = IORESOURCE_MEM,
198 } 198 }
199}; 199};
@@ -390,8 +390,8 @@ struct platform_device s3c_device_hwmon = {
390 390
391static struct resource s3c_sdi_resource[] = { 391static struct resource s3c_sdi_resource[] = {
392 [0] = { 392 [0] = {
393 .start = S3C2410_PA_SDI, 393 .start = S3C24XX_PA_SDI,
394 .end = S3C2410_PA_SDI + S3C24XX_SZ_SDI - 1, 394 .end = S3C24XX_PA_SDI + S3C24XX_SZ_SDI - 1,
395 .flags = IORESOURCE_MEM, 395 .flags = IORESOURCE_MEM,
396 }, 396 },
397 [1] = { 397 [1] = {
diff --git a/arch/arm/plat-s3c24xx/include/mach/pwm-clock.h b/arch/arm/plat-s3c24xx/include/mach/pwm-clock.h
new file mode 100644
index 00000000000..a087de21bc2
--- /dev/null
+++ b/arch/arm/plat-s3c24xx/include/mach/pwm-clock.h
@@ -0,0 +1,55 @@
1/* linux/arch/arm/plat-s3c24xx/include/mach/pwm-clock.h
2 *
3 * Copyright 2008 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk>
5 * http://armlinux.simtec.co.uk/
6 *
7 * S3C24xx - pwm clock and timer support
8 */
9
10/**
11 * pwm_cfg_src_is_tclk() - return whether the given mux config is a tclk
12 * @cfg: The timer TCFG1 register bits shifted down to 0.
13 *
14 * Return true if the given configuration from TCFG1 is a TCLK instead
15 * any of the TDIV clocks.
16 */
17static inline int pwm_cfg_src_is_tclk(unsigned long tcfg)
18{
19 return tcfg == S3C2410_TCFG1_MUX_TCLK;
20}
21
22/**
23 * tcfg_to_divisor() - convert tcfg1 setting to a divisor
24 * @tcfg1: The tcfg1 setting, shifted down.
25 *
26 * Get the divisor value for the given tcfg1 setting. We assume the
27 * caller has already checked to see if this is not a TCLK source.
28 */
29static inline unsigned long tcfg_to_divisor(unsigned long tcfg1)
30{
31 return 1 << (1 + tcfg1);
32}
33
34/**
35 * pwm_tdiv_has_div1() - does the tdiv setting have a /1
36 *
37 * Return true if we have a /1 in the tdiv setting.
38 */
39static inline unsigned int pwm_tdiv_has_div1(void)
40{
41 return 0;
42}
43
44/**
45 * pwm_tdiv_div_bits() - calculate TCFG1 divisor value.
46 * @div: The divisor to calculate the bit information for.
47 *
48 * Turn a divisor into the necessary bit field for TCFG1.
49 */
50static inline unsigned long pwm_tdiv_div_bits(unsigned int div)
51{
52 return ilog2(div) - 1;
53}
54
55#define S3C_TCFG1_MUX_TCLK S3C2410_TCFG1_MUX_TCLK
diff --git a/arch/arm/plat-s3c24xx/include/plat/map.h b/arch/arm/plat-s3c24xx/include/plat/map.h
new file mode 100644
index 00000000000..e7be0c0d370
--- /dev/null
+++ b/arch/arm/plat-s3c24xx/include/plat/map.h
@@ -0,0 +1,100 @@
1/* linux/include/asm-arm/plat-s3c24xx/map.h
2 *
3 * Copyright (c) 2008 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk>
5 *
6 * S3C24XX - Memory map 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_PLAT_S3C24XX_MAP_H
14#define __ASM_PLAT_S3C24XX_MAP_H
15
16/* interrupt controller is the first thing we put in, to make
17 * the assembly code for the irq detection easier
18 */
19#define S3C24XX_VA_IRQ S3C_VA_IRQ
20#define S3C2410_PA_IRQ (0x4A000000)
21#define S3C24XX_SZ_IRQ SZ_1M
22
23/* memory controller registers */
24#define S3C24XX_VA_MEMCTRL S3C_VA_MEM
25#define S3C2410_PA_MEMCTRL (0x48000000)
26#define S3C24XX_SZ_MEMCTRL SZ_1M
27
28/* UARTs */
29#define S3C24XX_VA_UART S3C_VA_UART
30#define S3C2410_PA_UART (0x50000000)
31#define S3C24XX_SZ_UART SZ_1M
32#define S3C_UART_OFFSET (0x4000)
33
34/* Timers */
35#define S3C24XX_VA_TIMER S3C_VA_TIMER
36#define S3C2410_PA_TIMER (0x51000000)
37#define S3C24XX_SZ_TIMER SZ_1M
38
39/* Clock and Power management */
40#define S3C24XX_VA_CLKPWR S3C_VA_SYS
41#define S3C24XX_SZ_CLKPWR SZ_1M
42
43/* USB Device port */
44#define S3C2410_PA_USBDEV (0x52000000)
45#define S3C24XX_SZ_USBDEV SZ_1M
46
47/* Watchdog */
48#define S3C24XX_VA_WATCHDOG S3C_VA_WATCHDOG
49#define S3C2410_PA_WATCHDOG (0x53000000)
50#define S3C24XX_SZ_WATCHDOG SZ_1M
51
52/* Standard size definitions for peripheral blocks. */
53
54#define S3C24XX_SZ_IIC SZ_1M
55#define S3C24XX_SZ_IIS SZ_1M
56#define S3C24XX_SZ_ADC SZ_1M
57#define S3C24XX_SZ_SPI SZ_1M
58#define S3C24XX_SZ_SDI SZ_1M
59#define S3C24XX_SZ_NAND SZ_1M
60#define S3C24XX_SZ_USBHOST SZ_1M
61
62/* GPIO ports */
63
64/* the calculation for the VA of this must ensure that
65 * it is the same distance apart from the UART in the
66 * phsyical address space, as the initial mapping for the IO
67 * is done as a 1:1 maping. This puts it (currently) at
68 * 0xFA800000, which is not in the way of any current mapping
69 * by the base system.
70*/
71
72#define S3C2410_PA_GPIO (0x56000000)
73#define S3C24XX_VA_GPIO ((S3C24XX_PA_GPIO - S3C24XX_PA_UART) + S3C24XX_VA_UART)
74#define S3C24XX_SZ_GPIO SZ_1M
75
76
77/* ISA style IO, for each machine to sort out mappings for, if it
78 * implements it. We reserve two 16M regions for ISA.
79 */
80
81#define S3C24XX_VA_ISA_WORD S3C2410_ADDR(0x02000000)
82#define S3C24XX_VA_ISA_BYTE S3C2410_ADDR(0x03000000)
83
84/* deal with the registers that move under the 2412/2413 */
85
86#if defined(CONFIG_CPU_S3C2412) || defined(CONFIG_CPU_S3C2413)
87#ifndef __ASSEMBLY__
88extern void __iomem *s3c24xx_va_gpio2;
89#endif
90#ifdef CONFIG_CPU_S3C2412_ONLY
91#define S3C24XX_VA_GPIO2 (S3C24XX_VA_GPIO + 0x10)
92#else
93#define S3C24XX_VA_GPIO2 s3c24xx_va_gpio2
94#endif
95#else
96#define s3c24xx_va_gpio2 S3C24XX_VA_GPIO
97#define S3C24XX_VA_GPIO2 S3C24XX_VA_GPIO
98#endif
99
100#endif /* __ASM_PLAT_S3C24XX_MAP_H */
diff --git a/arch/arm/plat-s3c24xx/s3c2410-clock.c b/arch/arm/plat-s3c24xx/s3c2410-clock.c
index 4e07943c1e2..b61bdb79373 100644
--- a/arch/arm/plat-s3c24xx/s3c2410-clock.c
+++ b/arch/arm/plat-s3c24xx/s3c2410-clock.c
@@ -272,5 +272,6 @@ int __init s3c2410_baseclk_add(void)
272 (clkslow & S3C2410_CLKSLOW_MPLL_OFF) ? "off" : "on", 272 (clkslow & S3C2410_CLKSLOW_MPLL_OFF) ? "off" : "on",
273 (clkslow & S3C2410_CLKSLOW_UCLK_OFF) ? "off" : "on"); 273 (clkslow & S3C2410_CLKSLOW_UCLK_OFF) ? "off" : "on");
274 274
275 s3c_pwmclk_init();
275 return 0; 276 return 0;
276} 277}
diff --git a/arch/arm/plat-s3c64xx/Kconfig b/arch/arm/plat-s3c64xx/Kconfig
new file mode 100644
index 00000000000..bd832ba0cf7
--- /dev/null
+++ b/arch/arm/plat-s3c64xx/Kconfig
@@ -0,0 +1,36 @@
1# arch/arm/plat-s3c64xx/Kconfig
2#
3# Copyright 2008 Openmoko, Inc.
4# Copyright 2008 Simtec Electronics
5# Ben Dooks <ben@simtec.co.uk>
6#
7# Licensed under GPLv2
8
9config PLAT_S3C64XX
10 bool
11 depends on ARCH_S3C64XX
12 select PLAT_S3C
13 select ARM_VIC
14 default y
15 select NO_IOPORT
16 select ARCH_REQUIRE_GPIOLIB
17 help
18 Base platform code for any Samsung S3C64XX device
19
20if PLAT_S3C64XX
21
22# Configuration options shared by all S3C64XX implementations
23
24config CPU_S3C6400_INIT
25 bool
26 help
27 Common initialisation code for the S3C6400 that is shared
28 by other CPUs in the series, such as the S3C6410.
29
30config CPU_S3C6400_CLOCK
31 bool
32 help
33 Common clock support code for the S3C6400 that is shared
34 by other CPUs in the series, such as the S3C6410.
35
36endif
diff --git a/arch/arm/plat-s3c64xx/Makefile b/arch/arm/plat-s3c64xx/Makefile
new file mode 100644
index 00000000000..9c09b081980
--- /dev/null
+++ b/arch/arm/plat-s3c64xx/Makefile
@@ -0,0 +1,24 @@
1# arch/arm/plat-s3c64xx/Makefile
2#
3# Copyright 2008 Openmoko, Inc.
4# Copyright 2008 Simtec Electronics
5#
6# Licensed under GPLv2
7
8obj-y :=
9obj-m :=
10obj-n := dummy.o
11obj- :=
12
13# Core files
14
15obj-y += dev-uart.o
16obj-y += cpu.o
17obj-y += irq.o
18obj-y += irq-eint.o
19obj-y += clock.o
20
21# CPU support
22
23obj-$(CONFIG_CPU_S3C6400_INIT) += s3c6400-init.o
24obj-$(CONFIG_CPU_S3C6400_CLOCK) += s3c6400-clock.o
diff --git a/arch/arm/plat-s3c64xx/clock.c b/arch/arm/plat-s3c64xx/clock.c
new file mode 100644
index 00000000000..5a1e97e1f8f
--- /dev/null
+++ b/arch/arm/plat-s3c64xx/clock.c
@@ -0,0 +1,282 @@
1/* linux/arch/arm/plat-s3c64xx/clock.c
2 *
3 * Copyright 2008 Openmoko, Inc.
4 * Copyright 2008 Simtec Electronics
5 * Ben Dooks <ben@simtec.co.uk>
6 * http://armlinux.simtec.co.uk/
7 *
8 * S3C64XX Base clock support
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13*/
14
15#include <linux/init.h>
16#include <linux/module.h>
17#include <linux/interrupt.h>
18#include <linux/ioport.h>
19#include <linux/delay.h>
20#include <linux/io.h>
21
22#include <mach/hardware.h>
23#include <mach/map.h>
24
25#include <plat/regs-sys.h>
26#include <plat/regs-clock.h>
27#include <plat/cpu.h>
28#include <plat/devs.h>
29#include <plat/clock.h>
30
31struct clk clk_27m = {
32 .name = "clk_27m",
33 .id = -1,
34 .rate = 27000000,
35};
36
37static int clk_48m_ctrl(struct clk *clk, int enable)
38{
39 unsigned long flags;
40 u32 val;
41
42 /* can't rely on clock lock, this register has other usages */
43 local_irq_save(flags);
44
45 val = __raw_readl(S3C64XX_OTHERS);
46 if (enable)
47 val |= S3C64XX_OTHERS_USBMASK;
48 else
49 val &= ~S3C64XX_OTHERS_USBMASK;
50
51 __raw_writel(val, S3C64XX_OTHERS);
52 local_irq_restore(flags);
53
54 return 0;
55}
56
57struct clk clk_48m = {
58 .name = "clk_48m",
59 .id = -1,
60 .rate = 48000000,
61 .enable = clk_48m_ctrl,
62};
63
64static int inline s3c64xx_gate(void __iomem *reg,
65 struct clk *clk,
66 int enable)
67{
68 unsigned int ctrlbit = clk->ctrlbit;
69 u32 con;
70
71 con = __raw_readl(reg);
72
73 if (enable)
74 con |= ctrlbit;
75 else
76 con &= ~ctrlbit;
77
78 __raw_writel(con, reg);
79 return 0;
80}
81
82static int s3c64xx_pclk_ctrl(struct clk *clk, int enable)
83{
84 return s3c64xx_gate(S3C_PCLK_GATE, clk, enable);
85}
86
87static int s3c64xx_hclk_ctrl(struct clk *clk, int enable)
88{
89 return s3c64xx_gate(S3C_HCLK_GATE, clk, enable);
90}
91
92int s3c64xx_sclk_ctrl(struct clk *clk, int enable)
93{
94 return s3c64xx_gate(S3C_SCLK_GATE, clk, enable);
95}
96
97static struct clk init_clocks_disable[] = {
98 {
99 .name = "nand",
100 .id = -1,
101 .parent = &clk_h,
102 }, {
103 .name = "adc",
104 .id = -1,
105 .parent = &clk_p,
106 .enable = s3c64xx_pclk_ctrl,
107 .ctrlbit = S3C_CLKCON_PCLK_TSADC,
108 }, {
109 .name = "i2c",
110 .id = -1,
111 .parent = &clk_p,
112 .enable = s3c64xx_pclk_ctrl,
113 .ctrlbit = S3C_CLKCON_PCLK_IIC,
114 }, {
115 .name = "iis",
116 .id = 0,
117 .parent = &clk_p,
118 .enable = s3c64xx_pclk_ctrl,
119 .ctrlbit = S3C_CLKCON_PCLK_IIS0,
120 }, {
121 .name = "iis",
122 .id = 1,
123 .parent = &clk_p,
124 .enable = s3c64xx_pclk_ctrl,
125 .ctrlbit = S3C_CLKCON_PCLK_IIS1,
126 }, {
127 .name = "spi",
128 .id = 0,
129 .parent = &clk_p,
130 .enable = s3c64xx_pclk_ctrl,
131 .ctrlbit = S3C_CLKCON_PCLK_SPI0,
132 }, {
133 .name = "spi",
134 .id = 1,
135 .parent = &clk_p,
136 .enable = s3c64xx_pclk_ctrl,
137 .ctrlbit = S3C_CLKCON_PCLK_SPI1,
138 }, {
139 .name = "48m",
140 .id = 0,
141 .parent = &clk_48m,
142 .enable = s3c64xx_sclk_ctrl,
143 .ctrlbit = S3C_CLKCON_SCLK_MMC0_48,
144 }, {
145 .name = "48m",
146 .id = 1,
147 .parent = &clk_48m,
148 .enable = s3c64xx_sclk_ctrl,
149 .ctrlbit = S3C_CLKCON_SCLK_MMC1_48,
150 }, {
151 .name = "48m",
152 .id = 2,
153 .parent = &clk_48m,
154 .enable = s3c64xx_sclk_ctrl,
155 .ctrlbit = S3C_CLKCON_SCLK_MMC2_48,
156 },
157};
158
159static struct clk init_clocks[] = {
160 {
161 .name = "lcd",
162 .id = -1,
163 .parent = &clk_h,
164 .enable = s3c64xx_hclk_ctrl,
165 .ctrlbit = S3C_CLKCON_HCLK_LCD,
166 }, {
167 .name = "gpio",
168 .id = -1,
169 .parent = &clk_p,
170 .enable = s3c64xx_pclk_ctrl,
171 .ctrlbit = S3C_CLKCON_PCLK_GPIO,
172 }, {
173 .name = "usb-host",
174 .id = -1,
175 .parent = &clk_h,
176 .enable = s3c64xx_hclk_ctrl,
177 .ctrlbit = S3C_CLKCON_SCLK_UHOST,
178 }, {
179 .name = "hsmmc",
180 .id = 0,
181 .parent = &clk_h,
182 .enable = s3c64xx_hclk_ctrl,
183 .ctrlbit = S3C_CLKCON_HCLK_HSMMC0,
184 }, {
185 .name = "hsmmc",
186 .id = 1,
187 .parent = &clk_h,
188 .enable = s3c64xx_hclk_ctrl,
189 .ctrlbit = S3C_CLKCON_HCLK_HSMMC1,
190 }, {
191 .name = "hsmmc",
192 .id = 2,
193 .parent = &clk_h,
194 .enable = s3c64xx_hclk_ctrl,
195 .ctrlbit = S3C_CLKCON_HCLK_HSMMC2,
196 }, {
197 .name = "timers",
198 .id = -1,
199 .parent = &clk_p,
200 .enable = s3c64xx_pclk_ctrl,
201 .ctrlbit = S3C_CLKCON_PCLK_PWM,
202 }, {
203 .name = "uart",
204 .id = 0,
205 .parent = &clk_p,
206 .enable = s3c64xx_pclk_ctrl,
207 .ctrlbit = S3C_CLKCON_PCLK_UART0,
208 }, {
209 .name = "uart",
210 .id = 1,
211 .parent = &clk_p,
212 .enable = s3c64xx_pclk_ctrl,
213 .ctrlbit = S3C_CLKCON_PCLK_UART1,
214 }, {
215 .name = "uart",
216 .id = 2,
217 .parent = &clk_p,
218 .enable = s3c64xx_pclk_ctrl,
219 .ctrlbit = S3C_CLKCON_PCLK_UART2,
220 }, {
221 .name = "uart",
222 .id = 3,
223 .parent = &clk_p,
224 .enable = s3c64xx_pclk_ctrl,
225 .ctrlbit = S3C_CLKCON_PCLK_UART3,
226 }, {
227 .name = "rtc",
228 .id = -1,
229 .parent = &clk_p,
230 .enable = s3c64xx_pclk_ctrl,
231 .ctrlbit = S3C_CLKCON_PCLK_RTC,
232 }, {
233 .name = "watchdog",
234 .id = -1,
235 .parent = &clk_p,
236 .ctrlbit = S3C_CLKCON_PCLK_WDT,
237 }, {
238 .name = "ac97",
239 .id = -1,
240 .parent = &clk_p,
241 .ctrlbit = S3C_CLKCON_PCLK_AC97,
242 }
243};
244
245static struct clk *clks[] __initdata = {
246 &clk_ext,
247 &clk_epll,
248 &clk_27m,
249 &clk_48m,
250};
251
252void s3c64xx_register_clocks(void)
253{
254 struct clk *clkp;
255 int ret;
256 int ptr;
257
258 s3c24xx_register_clocks(clks, ARRAY_SIZE(clks));
259
260 clkp = init_clocks;
261 for (ptr = 0; ptr < ARRAY_SIZE(init_clocks); ptr++, clkp++) {
262 ret = s3c24xx_register_clock(clkp);
263 if (ret < 0) {
264 printk(KERN_ERR "Failed to register clock %s (%d)\n",
265 clkp->name, ret);
266 }
267 }
268
269 clkp = init_clocks_disable;
270 for (ptr = 0; ptr < ARRAY_SIZE(init_clocks_disable); ptr++, clkp++) {
271
272 ret = s3c24xx_register_clock(clkp);
273 if (ret < 0) {
274 printk(KERN_ERR "Failed to register clock %s (%d)\n",
275 clkp->name, ret);
276 }
277
278 (clkp->enable)(clkp, 0);
279 }
280
281 s3c_pwmclk_init();
282}
diff --git a/arch/arm/plat-s3c64xx/cpu.c b/arch/arm/plat-s3c64xx/cpu.c
new file mode 100644
index 00000000000..36182fcfaeb
--- /dev/null
+++ b/arch/arm/plat-s3c64xx/cpu.c
@@ -0,0 +1,115 @@
1/* linux/arch/arm/plat-s3c64xx/cpu.c
2 *
3 * Copyright 2008 Openmoko, Inc.
4 * Copyright 2008 Simtec Electronics
5 * Ben Dooks <ben@simtec.co.uk>
6 * http://armlinux.simtec.co.uk/
7 *
8 * S3C64XX CPU Support
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13*/
14
15#include <linux/init.h>
16#include <linux/module.h>
17#include <linux/interrupt.h>
18#include <linux/ioport.h>
19#include <linux/serial_core.h>
20#include <linux/platform_device.h>
21#include <linux/delay.h>
22#include <linux/io.h>
23
24#include <mach/hardware.h>
25#include <mach/map.h>
26
27#include <asm/mach/arch.h>
28#include <asm/mach/map.h>
29
30#include <plat/regs-serial.h>
31
32#include <plat/cpu.h>
33#include <plat/devs.h>
34#include <plat/clock.h>
35
36#include <plat/s3c6400.h>
37#include <plat/s3c6410.h>
38
39/* table of supported CPUs */
40
41static const char name_s3c6400[] = "S3C6400";
42static const char name_s3c6410[] = "S3C6410";
43
44static struct cpu_table cpu_ids[] __initdata = {
45 {
46 .idcode = 0x36400000,
47 .idmask = 0xfffff000,
48 .map_io = s3c6400_map_io,
49 .init_clocks = s3c6400_init_clocks,
50 .init_uarts = s3c6400_init_uarts,
51 .init = s3c6400_init,
52 .name = name_s3c6400,
53 }, {
54 .idcode = 0x36410100,
55 .idmask = 0xffffff00,
56 .map_io = s3c6410_map_io,
57 .init_clocks = s3c6410_init_clocks,
58 .init_uarts = s3c6410_init_uarts,
59 .init = s3c6410_init,
60 .name = name_s3c6410,
61 },
62};
63
64/* minimal IO mapping */
65
66/* see notes on uart map in arch/arm/mach-s3c6400/include/mach/debug-macro.S */
67#define UART_OFFS (S3C_PA_UART & 0xfffff)
68
69static struct map_desc s3c_iodesc[] __initdata = {
70 {
71 .virtual = (unsigned long)S3C_VA_SYS,
72 .pfn = __phys_to_pfn(S3C64XX_PA_SYSCON),
73 .length = SZ_4K,
74 .type = MT_DEVICE,
75 }, {
76 .virtual = (unsigned long)(S3C_VA_UART + UART_OFFS),
77 .pfn = __phys_to_pfn(S3C_PA_UART),
78 .length = SZ_4K,
79 .type = MT_DEVICE,
80 }, {
81 .virtual = (unsigned long)S3C_VA_VIC0,
82 .pfn = __phys_to_pfn(S3C64XX_PA_VIC0),
83 .length = SZ_16K,
84 .type = MT_DEVICE,
85 }, {
86 .virtual = (unsigned long)S3C_VA_VIC1,
87 .pfn = __phys_to_pfn(S3C64XX_PA_VIC1),
88 .length = SZ_16K,
89 .type = MT_DEVICE,
90 }, {
91 .virtual = (unsigned long)S3C_VA_TIMER,
92 .pfn = __phys_to_pfn(S3C_PA_TIMER),
93 .length = SZ_16K,
94 .type = MT_DEVICE,
95 }, {
96 .virtual = (unsigned long)S3C64XX_VA_GPIO,
97 .pfn = __phys_to_pfn(S3C64XX_PA_GPIO),
98 .length = SZ_4K,
99 .type = MT_DEVICE,
100 },
101};
102
103/* read cpu identification code */
104
105void __init s3c64xx_init_io(struct map_desc *mach_desc, int size)
106{
107 unsigned long idcode;
108
109 /* initialise the io descriptors we need for initialisation */
110 iotable_init(s3c_iodesc, ARRAY_SIZE(s3c_iodesc));
111 iotable_init(mach_desc, size);
112
113 idcode = __raw_readl(S3C_VA_SYS + 0x118);
114 s3c_init_cpu(idcode, cpu_ids, ARRAY_SIZE(cpu_ids));
115}
diff --git a/arch/arm/plat-s3c64xx/dev-uart.c b/arch/arm/plat-s3c64xx/dev-uart.c
new file mode 100644
index 00000000000..62c11a6fc7b
--- /dev/null
+++ b/arch/arm/plat-s3c64xx/dev-uart.c
@@ -0,0 +1,176 @@
1/* linux/arch/arm/plat-s3c64xx/dev-uart.c
2 *
3 * Copyright 2008 Openmoko, Inc.
4 * Copyright 2008 Simtec Electronics
5 * Ben Dooks <ben@simtec.co.uk>
6 * http://armlinux.simtec.co.uk/
7 *
8 * Base S3C64XX UART resource and device definitions
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13 *
14*/
15
16#include <linux/kernel.h>
17#include <linux/types.h>
18#include <linux/interrupt.h>
19#include <linux/list.h>
20#include <linux/platform_device.h>
21
22#include <asm/mach/arch.h>
23#include <asm/mach/irq.h>
24#include <mach/hardware.h>
25#include <mach/map.h>
26
27#include <plat/devs.h>
28
29/* Serial port registrations */
30
31/* 64xx uarts are closer together */
32
33static struct resource s3c64xx_uart0_resource[] = {
34 [0] = {
35 .start = S3C_PA_UART0,
36 .end = S3C_PA_UART0 + 0x100,
37 .flags = IORESOURCE_MEM,
38 },
39 [1] = {
40 .start = IRQ_S3CUART_RX0,
41 .end = IRQ_S3CUART_RX0,
42 .flags = IORESOURCE_IRQ,
43 },
44 [2] = {
45 .start = IRQ_S3CUART_TX0,
46 .end = IRQ_S3CUART_TX0,
47 .flags = IORESOURCE_IRQ,
48
49 },
50 [3] = {
51 .start = IRQ_S3CUART_ERR0,
52 .end = IRQ_S3CUART_ERR0,
53 .flags = IORESOURCE_IRQ,
54 }
55};
56
57static struct resource s3c64xx_uart1_resource[] = {
58 [0] = {
59 .start = S3C_PA_UART1,
60 .end = S3C_PA_UART1 + 0x100,
61 .flags = IORESOURCE_MEM,
62 },
63 [1] = {
64 .start = IRQ_S3CUART_RX1,
65 .end = IRQ_S3CUART_RX1,
66 .flags = IORESOURCE_IRQ,
67 },
68 [2] = {
69 .start = IRQ_S3CUART_TX1,
70 .end = IRQ_S3CUART_TX1,
71 .flags = IORESOURCE_IRQ,
72
73 },
74 [3] = {
75 .start = IRQ_S3CUART_ERR1,
76 .end = IRQ_S3CUART_ERR1,
77 .flags = IORESOURCE_IRQ,
78 },
79};
80
81static struct resource s3c6xx_uart2_resource[] = {
82 [0] = {
83 .start = S3C_PA_UART2,
84 .end = S3C_PA_UART2 + 0x100,
85 .flags = IORESOURCE_MEM,
86 },
87 [1] = {
88 .start = IRQ_S3CUART_RX2,
89 .end = IRQ_S3CUART_RX2,
90 .flags = IORESOURCE_IRQ,
91 },
92 [2] = {
93 .start = IRQ_S3CUART_TX2,
94 .end = IRQ_S3CUART_TX2,
95 .flags = IORESOURCE_IRQ,
96
97 },
98 [3] = {
99 .start = IRQ_S3CUART_ERR2,
100 .end = IRQ_S3CUART_ERR2,
101 .flags = IORESOURCE_IRQ,
102 },
103};
104
105static struct resource s3c64xx_uart3_resource[] = {
106 [0] = {
107 .start = S3C_PA_UART3,
108 .end = S3C_PA_UART3 + 0x100,
109 .flags = IORESOURCE_MEM,
110 },
111 [1] = {
112 .start = IRQ_S3CUART_RX3,
113 .end = IRQ_S3CUART_RX3,
114 .flags = IORESOURCE_IRQ,
115 },
116 [2] = {
117 .start = IRQ_S3CUART_TX3,
118 .end = IRQ_S3CUART_TX3,
119 .flags = IORESOURCE_IRQ,
120
121 },
122 [3] = {
123 .start = IRQ_S3CUART_ERR3,
124 .end = IRQ_S3CUART_ERR3,
125 .flags = IORESOURCE_IRQ,
126 },
127};
128
129
130struct s3c24xx_uart_resources s3c64xx_uart_resources[] __initdata = {
131 [0] = {
132 .resources = s3c64xx_uart0_resource,
133 .nr_resources = ARRAY_SIZE(s3c64xx_uart0_resource),
134 },
135 [1] = {
136 .resources = s3c64xx_uart1_resource,
137 .nr_resources = ARRAY_SIZE(s3c64xx_uart1_resource),
138 },
139 [2] = {
140 .resources = s3c6xx_uart2_resource,
141 .nr_resources = ARRAY_SIZE(s3c6xx_uart2_resource),
142 },
143 [3] = {
144 .resources = s3c64xx_uart3_resource,
145 .nr_resources = ARRAY_SIZE(s3c64xx_uart3_resource),
146 },
147};
148
149/* uart devices */
150
151static struct platform_device s3c24xx_uart_device0 = {
152 .id = 0,
153};
154
155static struct platform_device s3c24xx_uart_device1 = {
156 .id = 1,
157};
158
159static struct platform_device s3c24xx_uart_device2 = {
160 .id = 2,
161};
162
163static struct platform_device s3c24xx_uart_device3 = {
164 .id = 3,
165};
166
167struct platform_device *s3c24xx_uart_src[4] = {
168 &s3c24xx_uart_device0,
169 &s3c24xx_uart_device1,
170 &s3c24xx_uart_device2,
171 &s3c24xx_uart_device3,
172};
173
174struct platform_device *s3c24xx_uart_devs[4] = {
175};
176
diff --git a/arch/arm/plat-s3c64xx/include/plat/irqs.h b/arch/arm/plat-s3c64xx/include/plat/irqs.h
new file mode 100644
index 00000000000..bc25689c3f8
--- /dev/null
+++ b/arch/arm/plat-s3c64xx/include/plat/irqs.h
@@ -0,0 +1,196 @@
1/* linux/arch/arm/plat-s3c64xx/include/mach/irqs.h
2 *
3 * Copyright 2008 Openmoko, Inc.
4 * Copyright 2008 Simtec Electronics
5 * Ben Dooks <ben@simtec.co.uk>
6 * http://armlinux.simtec.co.uk/
7 *
8 * S3C64XX - Common IRQ support
9 */
10
11#ifndef __ASM_PLAT_S3C64XX_IRQS_H
12#define __ASM_PLAT_S3C64XX_IRQS_H __FILE__
13
14/* we keep the first set of CPU IRQs out of the range of
15 * the ISA space, so that the PC104 has them to itself
16 * and we don't end up having to do horrible things to the
17 * standard ISA drivers....
18 *
19 * note, since we're using the VICs, our start must be a
20 * mulitple of 32 to allow the common code to work
21 */
22
23#define S3C_IRQ_OFFSET (32)
24
25#define S3C_IRQ(x) ((x) + S3C_IRQ_OFFSET)
26
27#define S3C_VIC0_BASE S3C_IRQ(0)
28#define S3C_VIC1_BASE S3C_IRQ(32)
29
30/* UART interrupts, each UART has 4 intterupts per channel so
31 * use the space between the ISA and S3C main interrupts. Note, these
32 * are not in the same order as the S3C24XX series! */
33
34#define IRQ_S3CUART_BASE0 (16)
35#define IRQ_S3CUART_BASE1 (20)
36#define IRQ_S3CUART_BASE2 (24)
37#define IRQ_S3CUART_BASE3 (28)
38
39#define UART_IRQ_RXD (0)
40#define UART_IRQ_ERR (1)
41#define UART_IRQ_TXD (2)
42#define UART_IRQ_MODEM (3)
43
44#define IRQ_S3CUART_RX0 (IRQ_S3CUART_BASE0 + UART_IRQ_RXD)
45#define IRQ_S3CUART_TX0 (IRQ_S3CUART_BASE0 + UART_IRQ_TXD)
46#define IRQ_S3CUART_ERR0 (IRQ_S3CUART_BASE0 + UART_IRQ_ERR)
47
48#define IRQ_S3CUART_RX1 (IRQ_S3CUART_BASE1 + UART_IRQ_RXD)
49#define IRQ_S3CUART_TX1 (IRQ_S3CUART_BASE1 + UART_IRQ_TXD)
50#define IRQ_S3CUART_ERR1 (IRQ_S3CUART_BASE1 + UART_IRQ_ERR)
51
52#define IRQ_S3CUART_RX2 (IRQ_S3CUART_BASE2 + UART_IRQ_RXD)
53#define IRQ_S3CUART_TX2 (IRQ_S3CUART_BASE2 + UART_IRQ_TXD)
54#define IRQ_S3CUART_ERR2 (IRQ_S3CUART_BASE2 + UART_IRQ_ERR)
55
56#define IRQ_S3CUART_RX3 (IRQ_S3CUART_BASE3 + UART_IRQ_RXD)
57#define IRQ_S3CUART_TX3 (IRQ_S3CUART_BASE3 + UART_IRQ_TXD)
58#define IRQ_S3CUART_ERR3 (IRQ_S3CUART_BASE3 + UART_IRQ_ERR)
59
60/* VIC based IRQs */
61
62#define S3C64XX_IRQ_VIC0(x) (S3C_VIC0_BASE + (x))
63#define S3C64XX_IRQ_VIC1(x) (S3C_VIC1_BASE + (x))
64
65/* VIC0 */
66
67#define IRQ_EINT0_3 S3C64XX_IRQ_VIC0(0)
68#define IRQ_EINT4_11 S3C64XX_IRQ_VIC0(1)
69#define IRQ_RTC_TIC S3C64XX_IRQ_VIC0(2)
70#define IRQ_CAMIF_C S3C64XX_IRQ_VIC0(3)
71#define IRQ_CAMIF_P S3C64XX_IRQ_VIC0(4)
72#define IRQ_CAMIF_MC S3C64XX_IRQ_VIC0(5)
73#define IRQ_S3C6410_IIS S3C64XX_IRQ_VIC0(6)
74#define IRQ_S3C6400_CAMIF_MP S3C64XX_IRQ_VIC0(6)
75#define IRQ_CAMIF_WE_C S3C64XX_IRQ_VIC0(7)
76#define IRQ_S3C6410_G3D S3C64XX_IRQ_VIC0(8)
77#define IRQ_S3C6400_CAMIF_WE_P S3C64XX_IRQ_VIC0(8)
78#define IRQ_POST0 S3C64XX_IRQ_VIC0(9)
79#define IRQ_ROTATOR S3C64XX_IRQ_VIC0(10)
80#define IRQ_2D S3C64XX_IRQ_VIC0(11)
81#define IRQ_TVENC S3C64XX_IRQ_VIC0(12)
82#define IRQ_SCALER S3C64XX_IRQ_VIC0(13)
83#define IRQ_BATF S3C64XX_IRQ_VIC0(14)
84#define IRQ_JPEG S3C64XX_IRQ_VIC0(15)
85#define IRQ_MFC S3C64XX_IRQ_VIC0(16)
86#define IRQ_SDMA0 S3C64XX_IRQ_VIC0(17)
87#define IRQ_SDMA1 S3C64XX_IRQ_VIC0(18)
88#define IRQ_ARM_DMAERR S3C64XX_IRQ_VIC0(19)
89#define IRQ_ARM_DMA S3C64XX_IRQ_VIC0(20)
90#define IRQ_ARM_DMAS S3C64XX_IRQ_VIC0(21)
91#define IRQ_KEYPAD S3C64XX_IRQ_VIC0(22)
92#define IRQ_TIMER0_VIC S3C64XX_IRQ_VIC0(23)
93#define IRQ_TIMER1_VIC S3C64XX_IRQ_VIC0(24)
94#define IRQ_TIMER2_VIC S3C64XX_IRQ_VIC0(25)
95#define IRQ_WDT S3C64XX_IRQ_VIC0(26)
96#define IRQ_TIMER3_VIC S3C64XX_IRQ_VIC0(27)
97#define IRQ_TIMER4_VIC S3C64XX_IRQ_VIC0(28)
98#define IRQ_LCD_FIFO S3C64XX_IRQ_VIC0(29)
99#define IRQ_LCD_VSYNC S3C64XX_IRQ_VIC0(30)
100#define IRQ_LCD_SYSTEM S3C64XX_IRQ_VIC0(31)
101
102/* VIC1 */
103
104#define IRQ_EINT12_19 S3C64XX_IRQ_VIC1(0)
105#define IRQ_EINT20_27 S3C64XX_IRQ_VIC1(1)
106#define IRQ_PCM0 S3C64XX_IRQ_VIC1(2)
107#define IRQ_PCM1 S3C64XX_IRQ_VIC1(3)
108#define IRQ_AC97 S3C64XX_IRQ_VIC1(4)
109#define IRQ_UART0 S3C64XX_IRQ_VIC1(5)
110#define IRQ_UART1 S3C64XX_IRQ_VIC1(6)
111#define IRQ_UART2 S3C64XX_IRQ_VIC1(7)
112#define IRQ_UART3 S3C64XX_IRQ_VIC1(8)
113#define IRQ_DMA0 S3C64XX_IRQ_VIC1(9)
114#define IRQ_DMA1 S3C64XX_IRQ_VIC1(10)
115#define IRQ_ONENAND0 S3C64XX_IRQ_VIC1(11)
116#define IRQ_ONENAND1 S3C64XX_IRQ_VIC1(12)
117#define IRQ_NFC S3C64XX_IRQ_VIC1(13)
118#define IRQ_CFCON S3C64XX_IRQ_VIC1(14)
119#define IRQ_UHOST S3C64XX_IRQ_VIC1(15)
120#define IRQ_SPI0 S3C64XX_IRQ_VIC1(16)
121#define IRQ_SPI1 S3C64XX_IRQ_VIC1(17)
122#define IRQ_IIC S3C64XX_IRQ_VIC1(18)
123#define IRQ_HSItx S3C64XX_IRQ_VIC1(19)
124#define IRQ_HSIrx S3C64XX_IRQ_VIC1(20)
125#define IRQ_RESERVED S3C64XX_IRQ_VIC1(21)
126#define IRQ_MSM S3C64XX_IRQ_VIC1(22)
127#define IRQ_HOSTIF S3C64XX_IRQ_VIC1(23)
128#define IRQ_HSMMC0 S3C64XX_IRQ_VIC1(24)
129#define IRQ_HSMMC1 S3C64XX_IRQ_VIC1(25)
130#define IRQ_HSMMC2 IRQ_SPI1 /* shared with SPI1 */
131#define IRQ_OTG S3C64XX_IRQ_VIC1(26)
132#define IRQ_IRDA S3C64XX_IRQ_VIC1(27)
133#define IRQ_RTC_ALARM S3C64XX_IRQ_VIC1(28)
134#define IRQ_SEC S3C64XX_IRQ_VIC1(29)
135#define IRQ_PENDN S3C64XX_IRQ_VIC1(30)
136#define IRQ_TC IRQ_PENDN
137#define IRQ_ADC S3C64XX_IRQ_VIC1(31)
138
139#define S3C64XX_TIMER_IRQ(x) S3C_IRQ(64 + (x))
140
141#define IRQ_TIMER0 S3C64XX_TIMER_IRQ(0)
142#define IRQ_TIMER1 S3C64XX_TIMER_IRQ(1)
143#define IRQ_TIMER2 S3C64XX_TIMER_IRQ(2)
144#define IRQ_TIMER3 S3C64XX_TIMER_IRQ(3)
145#define IRQ_TIMER4 S3C64XX_TIMER_IRQ(4)
146
147/* Since the IRQ_EINT(x) are a linear mapping on current s3c64xx series
148 * we just defined them as an IRQ_EINT(x) macro from S3C_IRQ_EINT_BASE
149 * which we place after the pair of VICs. */
150
151#define S3C_IRQ_EINT_BASE S3C_IRQ(64+5)
152
153#define S3C_EINT(x) ((x) + S3C_IRQ_EINT_BASE)
154#define IRQ_EINT(x) S3C_EINT(x)
155
156/* Next the external interrupt groups. These are similar to the IRQ_EINT(x)
157 * that they are sourced from the GPIO pins but with a different scheme for
158 * priority and source indication.
159 *
160 * The IRQ_EINT(x) can be thought of as 'group 0' of the available GPIO
161 * interrupts, but for historical reasons they are kept apart from these
162 * next interrupts.
163 *
164 * Use IRQ_EINT_GROUP(group, offset) to get the number for use in the
165 * machine specific support files.
166 */
167
168#define IRQ_EINT_GROUP1_NR (15)
169#define IRQ_EINT_GROUP2_NR (8)
170#define IRQ_EINT_GROUP3_NR (5)
171#define IRQ_EINT_GROUP4_NR (14)
172#define IRQ_EINT_GROUP5_NR (7)
173#define IRQ_EINT_GROUP6_NR (10)
174#define IRQ_EINT_GROUP7_NR (16)
175#define IRQ_EINT_GROUP8_NR (15)
176#define IRQ_EINT_GROUP9_NR (9)
177
178#define IRQ_EINT_GROUP_BASE S3C_EINT(28)
179#define IRQ_EINT_GROUP1_BASE (IRQ_EINT_GROUP_BASE + 0x00)
180#define IRQ_EINT_GROUP2_BASE (IRQ_EINT_GROUP1_BASE + IRQ_EINT_GROUP1_NR)
181#define IRQ_EINT_GROUP3_BASE (IRQ_EINT_GROUP2_BASE + IRQ_EINT_GROUP2_NR)
182#define IRQ_EINT_GROUP4_BASE (IRQ_EINT_GROUP3_BASE + IRQ_EINT_GROUP3_NR)
183#define IRQ_EINT_GROUP5_BASE (IRQ_EINT_GROUP4_BASE + IRQ_EINT_GROUP4_NR)
184#define IRQ_EINT_GROUP6_BASE (IRQ_EINT_GROUP5_BASE + IRQ_EINT_GROUP5_NR)
185#define IRQ_EINT_GROUP7_BASE (IRQ_EINT_GROUP6_BASE + IRQ_EINT_GROUP6_NR)
186#define IRQ_EINT_GROUP8_BASE (IRQ_EINT_GROUP7_BASE + IRQ_EINT_GROUP7_NR)
187#define IRQ_EINT_GROUP9_BASE (IRQ_EINT_GROUP8_BASE + IRQ_EINT_GROUP8_NR)
188
189#define IRQ_EINT_GROUP(group, no) (IRQ_EINT_GROUP##group##__BASE + (x))
190
191/* Set the default NR_IRQS */
192
193#define NR_IRQS (IRQ_EINT_GROUP9_BASE + IRQ_EINT_GROUP9_NR + 1)
194
195#endif /* __ASM_PLAT_S3C64XX_IRQS_H */
196
diff --git a/arch/arm/plat-s3c64xx/include/plat/pll.h b/arch/arm/plat-s3c64xx/include/plat/pll.h
new file mode 100644
index 00000000000..90bbd72fdc4
--- /dev/null
+++ b/arch/arm/plat-s3c64xx/include/plat/pll.h
@@ -0,0 +1,74 @@
1/* arch/arm/plat-s3c64xx/include/plat/pll.h
2 *
3 * Copyright 2008 Openmoko, Inc.
4 * Copyright 2008 Simtec Electronics
5 * Ben Dooks <ben@simtec.co.uk>
6 * http://armlinux.simtec.co.uk/
7 *
8 * S3C64XX PLL code
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13*/
14
15#define S3C6400_PLL_MDIV_MASK ((1 << (25-16+1)) - 1)
16#define S3C6400_PLL_PDIV_MASK ((1 << (13-8+1)) - 1)
17#define S3C6400_PLL_SDIV_MASK ((1 << (2-0+1)) - 1)
18#define S3C6400_PLL_MDIV_SHIFT (16)
19#define S3C6400_PLL_PDIV_SHIFT (8)
20#define S3C6400_PLL_SDIV_SHIFT (0)
21
22#include <asm/div64.h>
23
24static inline unsigned long s3c6400_get_pll(unsigned long baseclk,
25 u32 pllcon)
26{
27 u32 mdiv, pdiv, sdiv;
28 u64 fvco = baseclk;
29
30 mdiv = (pllcon >> S3C6400_PLL_MDIV_SHIFT) & S3C6400_PLL_MDIV_MASK;
31 pdiv = (pllcon >> S3C6400_PLL_PDIV_SHIFT) & S3C6400_PLL_PDIV_MASK;
32 sdiv = (pllcon >> S3C6400_PLL_SDIV_SHIFT) & S3C6400_PLL_SDIV_MASK;
33
34 fvco *= mdiv;
35 do_div(fvco, (pdiv << sdiv));
36
37 return (unsigned long)fvco;
38}
39
40#define S3C6400_EPLL_MDIV_MASK ((1 << (23-16)) - 1)
41#define S3C6400_EPLL_PDIV_MASK ((1 << (13-8)) - 1)
42#define S3C6400_EPLL_SDIV_MASK ((1 << (2-0)) - 1)
43#define S3C6400_EPLL_MDIV_SHIFT (16)
44#define S3C6400_EPLL_PDIV_SHIFT (8)
45#define S3C6400_EPLL_SDIV_SHIFT (0)
46#define S3C6400_EPLL_KDIV_MASK (0xffff)
47
48static inline unsigned long s3c6400_get_epll(unsigned long baseclk)
49{
50 unsigned long result;
51 u32 epll0 = __raw_readl(S3C_EPLL_CON0);
52 u32 epll1 = __raw_readl(S3C_EPLL_CON1);
53 u32 mdiv, pdiv, sdiv, kdiv;
54 u64 tmp;
55
56 mdiv = (epll0 >> S3C6400_EPLL_MDIV_SHIFT) & S3C6400_EPLL_MDIV_MASK;
57 pdiv = (epll0 >> S3C6400_EPLL_PDIV_SHIFT) & S3C6400_EPLL_PDIV_MASK;
58 sdiv = (epll0 >> S3C6400_EPLL_SDIV_SHIFT) & S3C6400_EPLL_SDIV_MASK;
59 kdiv = epll1 & S3C6400_EPLL_KDIV_MASK;
60
61 /* We need to multiple baseclk by mdiv (the integer part) and kdiv
62 * which is in 2^16ths, so shift mdiv up (does not overflow) and
63 * add kdiv before multiplying. The use of tmp is to avoid any
64 * overflows before shifting bac down into result when multipling
65 * by the mdiv and kdiv pair.
66 */
67
68 tmp = baseclk;
69 tmp *= (mdiv << 16) + kdiv;
70 do_div(tmp, (pdiv << sdiv));
71 result = tmp >> 16;
72
73 return result;
74}
diff --git a/arch/arm/plat-s3c64xx/include/plat/regs-clock.h b/arch/arm/plat-s3c64xx/include/plat/regs-clock.h
new file mode 100644
index 00000000000..b1082c16324
--- /dev/null
+++ b/arch/arm/plat-s3c64xx/include/plat/regs-clock.h
@@ -0,0 +1,224 @@
1/* arch/arm/plat-s3c64xx/include/plat/regs-clock.h
2 *
3 * Copyright 2008 Openmoko, Inc.
4 * Copyright 2008 Simtec Electronics
5 * Ben Dooks <ben@simtec.co.uk>
6 * http://armlinux.simtec.co.uk/
7 *
8 * S3C64XX clock register definitions
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13*/
14
15#ifndef __PLAT_REGS_CLOCK_H
16#define __PLAT_REGS_CLOCK_H __FILE__
17
18#define S3C_CLKREG(x) (S3C_VA_SYS + (x))
19
20#define S3C_APLL_LOCK S3C_CLKREG(0x00)
21#define S3C_MPLL_LOCK S3C_CLKREG(0x04)
22#define S3C_EPLL_LOCK S3C_CLKREG(0x08)
23#define S3C_APLL_CON S3C_CLKREG(0x0C)
24#define S3C_MPLL_CON S3C_CLKREG(0x10)
25#define S3C_EPLL_CON0 S3C_CLKREG(0x14)
26#define S3C_EPLL_CON1 S3C_CLKREG(0x18)
27#define S3C_CLK_SRC S3C_CLKREG(0x1C)
28#define S3C_CLK_DIV0 S3C_CLKREG(0x20)
29#define S3C_CLK_DIV1 S3C_CLKREG(0x24)
30#define S3C_CLK_DIV2 S3C_CLKREG(0x28)
31#define S3C_CLK_OUT S3C_CLKREG(0x2C)
32#define S3C_HCLK_GATE S3C_CLKREG(0x30)
33#define S3C_PCLK_GATE S3C_CLKREG(0x34)
34#define S3C_SCLK_GATE S3C_CLKREG(0x38)
35
36/* CLKDIV0 */
37#define S3C6400_CLKDIV0_MFC_MASK (0xf << 28)
38#define S3C6400_CLKDIV0_MFC_SHIFT (28)
39#define S3C6400_CLKDIV0_JPEG_MASK (0xf << 24)
40#define S3C6400_CLKDIV0_JPEG_SHIFT (24)
41#define S3C6400_CLKDIV0_CAM_MASK (0xf << 20)
42#define S3C6400_CLKDIV0_CAM_SHIFT (20)
43#define S3C6400_CLKDIV0_SECURITY_MASK (0x3 << 18)
44#define S3C6400_CLKDIV0_SECURITY_SHIFT (18)
45#define S3C6400_CLKDIV0_PCLK_MASK (0xf << 12)
46#define S3C6400_CLKDIV0_PCLK_SHIFT (12)
47#define S3C6400_CLKDIV0_HCLK2_MASK (0x7 << 9)
48#define S3C6400_CLKDIV0_HCLK2_SHIFT (9)
49#define S3C6400_CLKDIV0_HCLK_MASK (0x1 << 8)
50#define S3C6400_CLKDIV0_HCLK_SHIFT (8)
51#define S3C6400_CLKDIV0_MPLL_MASK (0x1 << 4)
52#define S3C6400_CLKDIV0_MPLL_SHIFT (4)
53#define S3C6400_CLKDIV0_ARM_MASK (0x3 << 0)
54#define S3C6410_CLKDIV0_ARM_MASK (0x7 << 0)
55#define S3C6400_CLKDIV0_ARM_SHIFT (0)
56
57/* CLKDIV1 */
58#define S3C6410_CLKDIV1_FIMC_MASK (0xf << 24)
59#define S3C6410_CLKDIV1_FIMC_SHIFT (24)
60#define S3C6400_CLKDIV1_UHOST_MASK (0xf << 20)
61#define S3C6400_CLKDIV1_UHOST_SHIFT (20)
62#define S3C6400_CLKDIV1_SCALER_MASK (0xf << 16)
63#define S3C6400_CLKDIV1_SCALER_SHIFT (16)
64#define S3C6400_CLKDIV1_LCD_MASK (0xf << 12)
65#define S3C6400_CLKDIV1_LCD_SHIFT (12)
66#define S3C6400_CLKDIV1_MMC2_MASK (0xf << 8)
67#define S3C6400_CLKDIV1_MMC2_SHIFT (8)
68#define S3C6400_CLKDIV1_MMC1_MASK (0xf << 4)
69#define S3C6400_CLKDIV1_MMC1_SHIFT (4)
70#define S3C6400_CLKDIV1_MMC0_MASK (0xf << 0)
71#define S3C6400_CLKDIV1_MMC0_SHIFT (0)
72
73/* CLKDIV2 */
74#define S3C6410_CLKDIV2_AUDIO2_MASK (0xf << 24)
75#define S3C6410_CLKDIV2_AUDIO2_SHIFT (24)
76#define S3C6400_CLKDIV2_IRDA_MASK (0xf << 20)
77#define S3C6400_CLKDIV2_IRDA_SHIFT (20)
78#define S3C6400_CLKDIV2_UART_MASK (0xf << 16)
79#define S3C6400_CLKDIV2_UART_SHIFT (16)
80#define S3C6400_CLKDIV2_AUDIO1_MASK (0xf << 12)
81#define S3C6400_CLKDIV2_AUDIO1_SHIFT (12)
82#define S3C6400_CLKDIV2_AUDIO0_MASK (0xf << 8)
83#define S3C6400_CLKDIV2_AUDIO0_SHIFT (8)
84#define S3C6400_CLKDIV2_SPI1_MASK (0xf << 4)
85#define S3C6400_CLKDIV2_SPI1_SHIFT (4)
86#define S3C6400_CLKDIV2_SPI0_MASK (0xf << 0)
87#define S3C6400_CLKDIV2_SPI0_SHIFT (0)
88
89/* HCLK GATE Registers */
90#define S3C_CLKCON_HCLK_BUS (1<<30)
91#define S3C_CLKCON_HCLK_SECUR (1<<29)
92#define S3C_CLKCON_HCLK_SDMA1 (1<<28)
93#define S3C_CLKCON_HCLK_SDMA2 (1<<27)
94#define S3C_CLKCON_HCLK_UHOST (1<<26)
95#define S3C_CLKCON_HCLK_IROM (1<<25)
96#define S3C_CLKCON_HCLK_DDR1 (1<<24)
97#define S3C_CLKCON_HCLK_DDR0 (1<<23)
98#define S3C_CLKCON_HCLK_MEM1 (1<<22)
99#define S3C_CLKCON_HCLK_MEM0 (1<<21)
100#define S3C_CLKCON_HCLK_USB (1<<20)
101#define S3C_CLKCON_HCLK_HSMMC2 (1<<19)
102#define S3C_CLKCON_HCLK_HSMMC1 (1<<18)
103#define S3C_CLKCON_HCLK_HSMMC0 (1<<17)
104#define S3C_CLKCON_HCLK_MDP (1<<16)
105#define S3C_CLKCON_HCLK_DHOST (1<<15)
106#define S3C_CLKCON_HCLK_IHOST (1<<14)
107#define S3C_CLKCON_HCLK_DMA1 (1<<13)
108#define S3C_CLKCON_HCLK_DMA0 (1<<12)
109#define S3C_CLKCON_HCLK_JPEG (1<<11)
110#define S3C_CLKCON_HCLK_CAMIF (1<<10)
111#define S3C_CLKCON_HCLK_SCALER (1<<9)
112#define S3C_CLKCON_HCLK_2D (1<<8)
113#define S3C_CLKCON_HCLK_TV (1<<7)
114#define S3C_CLKCON_HCLK_POST0 (1<<5)
115#define S3C_CLKCON_HCLK_ROT (1<<4)
116#define S3C_CLKCON_HCLK_LCD (1<<3)
117#define S3C_CLKCON_HCLK_TZIC (1<<2)
118#define S3C_CLKCON_HCLK_INTC (1<<1)
119#define S3C_CLKCON_HCLK_MFC (1<<0)
120
121/* PCLK GATE Registers */
122#define S3C6410_CLKCON_PCLK_I2C1 (1<<27)
123#define S3C6410_CLKCON_PCLK_IIS2 (1<<26)
124#define S3C_CLKCON_PCLK_SKEY (1<<24)
125#define S3C_CLKCON_PCLK_CHIPID (1<<23)
126#define S3C_CLKCON_PCLK_SPI1 (1<<22)
127#define S3C_CLKCON_PCLK_SPI0 (1<<21)
128#define S3C_CLKCON_PCLK_HSIRX (1<<20)
129#define S3C_CLKCON_PCLK_HSITX (1<<19)
130#define S3C_CLKCON_PCLK_GPIO (1<<18)
131#define S3C_CLKCON_PCLK_IIC (1<<17)
132#define S3C_CLKCON_PCLK_IIS1 (1<<16)
133#define S3C_CLKCON_PCLK_IIS0 (1<<15)
134#define S3C_CLKCON_PCLK_AC97 (1<<14)
135#define S3C_CLKCON_PCLK_TZPC (1<<13)
136#define S3C_CLKCON_PCLK_TSADC (1<<12)
137#define S3C_CLKCON_PCLK_KEYPAD (1<<11)
138#define S3C_CLKCON_PCLK_IRDA (1<<10)
139#define S3C_CLKCON_PCLK_PCM1 (1<<9)
140#define S3C_CLKCON_PCLK_PCM0 (1<<8)
141#define S3C_CLKCON_PCLK_PWM (1<<7)
142#define S3C_CLKCON_PCLK_RTC (1<<6)
143#define S3C_CLKCON_PCLK_WDT (1<<5)
144#define S3C_CLKCON_PCLK_UART3 (1<<4)
145#define S3C_CLKCON_PCLK_UART2 (1<<3)
146#define S3C_CLKCON_PCLK_UART1 (1<<2)
147#define S3C_CLKCON_PCLK_UART0 (1<<1)
148#define S3C_CLKCON_PCLK_MFC (1<<0)
149
150/* SCLK GATE Registers */
151#define S3C_CLKCON_SCLK_UHOST (1<<30)
152#define S3C_CLKCON_SCLK_MMC2_48 (1<<29)
153#define S3C_CLKCON_SCLK_MMC1_48 (1<<28)
154#define S3C_CLKCON_SCLK_MMC0_48 (1<<27)
155#define S3C_CLKCON_SCLK_MMC2 (1<<26)
156#define S3C_CLKCON_SCLK_MMC1 (1<<25)
157#define S3C_CLKCON_SCLK_MMC0 (1<<24)
158#define S3C_CLKCON_SCLK_SPI1_48 (1<<23)
159#define S3C_CLKCON_SCLK_SPI0_48 (1<<22)
160#define S3C_CLKCON_SCLK_SPI1 (1<<21)
161#define S3C_CLKCON_SCLK_SPI0 (1<<20)
162#define S3C_CLKCON_SCLK_DAC27 (1<<19)
163#define S3C_CLKCON_SCLK_TV27 (1<<18)
164#define S3C_CLKCON_SCLK_SCALER27 (1<<17)
165#define S3C_CLKCON_SCLK_SCALER (1<<16)
166#define S3C_CLKCON_SCLK_LCD27 (1<<15)
167#define S3C_CLKCON_SCLK_LCD (1<<14)
168#define S3C6400_CLKCON_SCLK_POST1_27 (1<<13)
169#define S3C6410_CLKCON_FIMC (1<<13)
170#define S3C_CLKCON_SCLK_POST0_27 (1<<12)
171#define S3C6400_CLKCON_SCLK_POST1 (1<<11)
172#define S3C6410_CLKCON_SCLK_AUDIO2 (1<<11)
173#define S3C_CLKCON_SCLK_POST0 (1<<10)
174#define S3C_CLKCON_SCLK_AUDIO1 (1<<9)
175#define S3C_CLKCON_SCLK_AUDIO0 (1<<8)
176#define S3C_CLKCON_SCLK_SECUR (1<<7)
177#define S3C_CLKCON_SCLK_IRDA (1<<6)
178#define S3C_CLKCON_SCLK_UART (1<<5)
179#define S3C_CLKCON_SCLK_ONENAND (1<<4)
180#define S3C_CLKCON_SCLK_MFC (1<<3)
181#define S3C_CLKCON_SCLK_CAM (1<<2)
182#define S3C_CLKCON_SCLK_JPEG (1<<1)
183
184/* CLKSRC */
185
186#define S3C6400_CLKSRC_APLL_MOUT (1 << 0)
187#define S3C6400_CLKSRC_MPLL_MOUT (1 << 1)
188#define S3C6400_CLKSRC_EPLL_MOUT (1 << 2)
189#define S3C6400_CLKSRC_APLL_MOUT_SHIFT (0)
190#define S3C6400_CLKSRC_MPLL_MOUT_SHIFT (1)
191#define S3C6400_CLKSRC_EPLL_MOUT_SHIFT (2)
192#define S3C6400_CLKSRC_MFC (1 << 4)
193
194#define S3C6410_CLKSRC_TV27_MASK (0x1 << 31)
195#define S3C6410_CLKSRC_TV27_SHIFT (31)
196#define S3C6410_CLKSRC_DAC27_MASK (0x1 << 30)
197#define S3C6410_CLKSRC_DAC27_SHIFT (30)
198#define S3C6400_CLKSRC_SCALER_MASK (0x3 << 28)
199#define S3C6400_CLKSRC_SCALER_SHIFT (28)
200#define S3C6400_CLKSRC_LCD_MASK (0x3 << 26)
201#define S3C6400_CLKSRC_LCD_SHIFT (26)
202#define S3C6400_CLKSRC_IRDA_MASK (0x3 << 24)
203#define S3C6400_CLKSRC_IRDA_SHIFT (24)
204#define S3C6400_CLKSRC_MMC2_MASK (0x3 << 22)
205#define S3C6400_CLKSRC_MMC2_SHIFT (22)
206#define S3C6400_CLKSRC_MMC1_MASK (0x3 << 20)
207#define S3C6400_CLKSRC_MMC1_SHIFT (20)
208#define S3C6400_CLKSRC_MMC0_MASK (0x3 << 18)
209#define S3C6400_CLKSRC_MMC0_SHIFT (18)
210#define S3C6400_CLKSRC_SPI1_MASK (0x3 << 16)
211#define S3C6400_CLKSRC_SPI1_SHIFT (16)
212#define S3C6400_CLKSRC_SPI0_MASK (0x3 << 14)
213#define S3C6400_CLKSRC_SPI0_SHIFT (14)
214#define S3C6400_CLKSRC_UART_MASK (0x1 << 13)
215#define S3C6400_CLKSRC_UART_SHIFT (13)
216#define S3C6400_CLKSRC_AUDIO1_MASK (0x7 << 10)
217#define S3C6400_CLKSRC_AUDIO1_SHIFT (10)
218#define S3C6400_CLKSRC_AUDIO0_MASK (0x7 << 7)
219#define S3C6400_CLKSRC_AUDIO0_SHIFT (7)
220#define S3C6400_CLKSRC_UHOST_MASK (0x3 << 5)
221#define S3C6400_CLKSRC_UHOST_SHIFT (5)
222
223
224#endif /* _PLAT_REGS_CLOCK_H */
diff --git a/arch/arm/plat-s3c64xx/include/plat/regs-sys.h b/arch/arm/plat-s3c64xx/include/plat/regs-sys.h
new file mode 100644
index 00000000000..d8ed8291709
--- /dev/null
+++ b/arch/arm/plat-s3c64xx/include/plat/regs-sys.h
@@ -0,0 +1,24 @@
1/* arch/arm/plat-s3c64xx/include/plat/regs-sys.h
2 *
3 * Copyright 2008 Openmoko, Inc.
4 * Copyright 2008 Simtec Electronics
5 * Ben Dooks <ben@simtec.co.uk>
6 * http://armlinux.simtec.co.uk/
7 *
8 * S3C64XX system register definitions
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13*/
14
15#ifndef __PLAT_REGS_SYS_H
16#define __PLAT_REGS_SYS_H __FILE__
17
18#define S3C_SYSREG(x) (S3C_VA_SYS + (x))
19
20#define S3C64XX_OTHERS S3C_SYSREG(0x900)
21
22#define S3C64XX_OTHERS_USBMASK (1 << 16)
23
24#endif /* _PLAT_REGS_SYS_H */
diff --git a/arch/arm/plat-s3c64xx/include/plat/s3c6400.h b/arch/arm/plat-s3c64xx/include/plat/s3c6400.h
new file mode 100644
index 00000000000..571eaa2e54f
--- /dev/null
+++ b/arch/arm/plat-s3c64xx/include/plat/s3c6400.h
@@ -0,0 +1,35 @@
1/* arch/arm/plat-s3c64xx/include/plat/s3c6400.h
2 *
3 * Copyright 2008 Openmoko, Inc.
4 * Copyright 2008 Simtec Electronics
5 * Ben Dooks <ben@simtec.co.uk>
6 * http://armlinux.simtec.co.uk/
7 *
8 * Header file for s3c6400 cpu support
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13*/
14
15/* Common init code for S3C6400 related SoCs */
16
17extern void s3c6400_common_init_uarts(struct s3c2410_uartcfg *cfg, int no);
18extern void s3c6400_register_clocks(void);
19extern void s3c6400_setup_clocks(void);
20
21#ifdef CONFIG_CPU_S3C6400
22
23extern int s3c6400_init(void);
24extern void s3c6400_map_io(void);
25extern void s3c6400_init_clocks(int xtal);
26
27#define s3c6400_init_uarts s3c6400_common_init_uarts
28
29#else
30#define s3c6400_init_clocks NULL
31#define s3c6400_init_uarts NULL
32#define s3c6400_map_io NULL
33#define s3c6400_init NULL
34#endif
35
diff --git a/arch/arm/plat-s3c64xx/include/plat/s3c6410.h b/arch/arm/plat-s3c64xx/include/plat/s3c6410.h
new file mode 100644
index 00000000000..50dcdd6f680
--- /dev/null
+++ b/arch/arm/plat-s3c64xx/include/plat/s3c6410.h
@@ -0,0 +1,29 @@
1/* arch/arm/plat-s3c64xx/include/plat/s3c6410.h
2 *
3 * Copyright 2008 Openmoko, Inc.
4 * Copyright 2008 Simtec Electronics
5 * Ben Dooks <ben@simtec.co.uk>
6 * http://armlinux.simtec.co.uk/
7 *
8 * Header file for s3c6410 cpu support
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13*/
14
15#ifdef CONFIG_CPU_S3C6410
16
17extern int s3c6410_init(void);
18extern void s3c6410_init_irq(void);
19extern void s3c6410_map_io(void);
20extern void s3c6410_init_clocks(int xtal);
21
22#define s3c6410_init_uarts s3c6400_common_init_uarts
23
24#else
25#define s3c6410_init_clocks NULL
26#define s3c6410_init_uarts NULL
27#define s3c6410_map_io NULL
28#define s3c6410_init NULL
29#endif
diff --git a/arch/arm/plat-s3c64xx/irq-eint.c b/arch/arm/plat-s3c64xx/irq-eint.c
new file mode 100644
index 00000000000..1f7cc0067f5
--- /dev/null
+++ b/arch/arm/plat-s3c64xx/irq-eint.c
@@ -0,0 +1,202 @@
1/* arch/arm/plat-s3c64xx/irq-eint.c
2 *
3 * Copyright 2008 Openmoko, Inc.
4 * Copyright 2008 Simtec Electronics
5 * Ben Dooks <ben@simtec.co.uk>
6 * http://armlinux.simtec.co.uk/
7 *
8 * S3C64XX - Interrupt handling for IRQ_EINT(x)
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13 */
14
15#include <linux/kernel.h>
16#include <linux/interrupt.h>
17#include <linux/irq.h>
18#include <linux/io.h>
19
20#include <asm/hardware/vic.h>
21
22#include <plat/regs-irqtype.h>
23
24#include <mach/map.h>
25#include <plat/cpu.h>
26
27/* GPIO is 0x7F008xxx, */
28#define S3C64XX_GPIOREG(x) (S3C64XX_VA_GPIO + (x))
29
30#define S3C64XX_EINT0CON0 S3C64XX_GPIOREG(0x900)
31#define S3C64XX_EINT0CON1 S3C64XX_GPIOREG(0x904)
32#define S3C64XX_EINT0FLTCON0 S3C64XX_GPIOREG(0x910)
33#define S3C64XX_EINT0FLTCON1 S3C64XX_GPIOREG(0x914)
34#define S3C64XX_EINT0FLTCON2 S3C64XX_GPIOREG(0x918)
35#define S3C64XX_EINT0FLTCON3 S3C64XX_GPIOREG(0x91C)
36
37#define S3C64XX_EINT0MASK S3C64XX_GPIOREG(0x920)
38#define S3C64XX_EINT0PEND S3C64XX_GPIOREG(0x924)
39
40
41#define eint_offset(irq) ((irq) - IRQ_EINT(0))
42#define eint_irq_to_bit(irq) (1 << eint_offset(irq))
43
44static inline void s3c_irq_eint_mask(unsigned int irq)
45{
46 u32 mask;
47
48 mask = __raw_readl(S3C64XX_EINT0MASK);
49 mask |= eint_irq_to_bit(irq);
50 __raw_writel(mask, S3C64XX_EINT0MASK);
51}
52
53static void s3c_irq_eint_unmask(unsigned int irq)
54{
55 u32 mask;
56
57 mask = __raw_readl(S3C64XX_EINT0MASK);
58 mask |= eint_irq_to_bit(irq);
59 __raw_writel(mask, S3C64XX_EINT0MASK);
60}
61
62static inline void s3c_irq_eint_ack(unsigned int irq)
63{
64 __raw_writel(eint_irq_to_bit(irq), S3C64XX_EINT0PEND);
65}
66
67static void s3c_irq_eint_maskack(unsigned int irq)
68{
69 /* compiler should in-line these */
70 s3c_irq_eint_mask(irq);
71 s3c_irq_eint_ack(irq);
72}
73
74static int s3c_irq_eint_set_type(unsigned int irq, unsigned int type)
75{
76 int offs = eint_offset(irq);
77 int shift;
78 u32 ctrl, mask;
79 u32 newvalue = 0;
80 void __iomem *reg;
81
82 if (offs > 27)
83 return -EINVAL;
84
85 if (offs <= 15)
86 reg = S3C64XX_EINT0CON0;
87 else
88 reg = S3C64XX_EINT0CON1;
89
90 switch (type) {
91 case IRQ_TYPE_NONE:
92 printk(KERN_WARNING "No edge setting!\n");
93 break;
94
95 case IRQ_TYPE_EDGE_RISING:
96 newvalue = S3C2410_EXTINT_RISEEDGE;
97 break;
98
99 case IRQ_TYPE_EDGE_FALLING:
100 newvalue = S3C2410_EXTINT_FALLEDGE;
101 break;
102
103 case IRQ_TYPE_EDGE_BOTH:
104 newvalue = S3C2410_EXTINT_BOTHEDGE;
105 break;
106
107 case IRQ_TYPE_LEVEL_LOW:
108 newvalue = S3C2410_EXTINT_LOWLEV;
109 break;
110
111 case IRQ_TYPE_LEVEL_HIGH:
112 newvalue = S3C2410_EXTINT_HILEV;
113 break;
114
115 default:
116 printk(KERN_ERR "No such irq type %d", type);
117 return -1;
118 }
119
120 shift = (offs / 2) * 4;
121 mask = 0x7 << shift;
122
123 ctrl = __raw_readl(reg);
124 ctrl &= ~mask;
125 ctrl |= newvalue << shift;
126 __raw_writel(ctrl, reg);
127
128 return 0;
129}
130
131static struct irq_chip s3c_irq_eint = {
132 .name = "s3c-eint",
133 .mask = s3c_irq_eint_mask,
134 .unmask = s3c_irq_eint_unmask,
135 .mask_ack = s3c_irq_eint_maskack,
136 .ack = s3c_irq_eint_ack,
137 .set_type = s3c_irq_eint_set_type,
138};
139
140/* s3c_irq_demux_eint
141 *
142 * This function demuxes the IRQ from the group0 external interrupts,
143 * from IRQ_EINT(0) to IRQ_EINT(27). It is designed to be inlined into
144 * the specific handlers s3c_irq_demux_eintX_Y.
145 */
146static inline void s3c_irq_demux_eint(unsigned int start, unsigned int end)
147{
148 u32 status = __raw_readl(S3C64XX_EINT0PEND);
149 u32 mask = __raw_readl(S3C64XX_EINT0MASK);
150 unsigned int irq;
151
152 status &= ~mask;
153 status >>= start;
154 status &= (1 << (end - start + 1)) - 1;
155
156 for (irq = IRQ_EINT(start); irq <= IRQ_EINT(end); irq++) {
157 if (status & 1)
158 generic_handle_irq(irq);
159
160 status >>= 1;
161 }
162}
163
164static void s3c_irq_demux_eint0_3(unsigned int irq, struct irq_desc *desc)
165{
166 s3c_irq_demux_eint(0, 3);
167}
168
169static void s3c_irq_demux_eint4_11(unsigned int irq, struct irq_desc *desc)
170{
171 s3c_irq_demux_eint(4, 11);
172}
173
174static void s3c_irq_demux_eint12_19(unsigned int irq, struct irq_desc *desc)
175{
176 s3c_irq_demux_eint(12, 19);
177}
178
179static void s3c_irq_demux_eint20_27(unsigned int irq, struct irq_desc *desc)
180{
181 s3c_irq_demux_eint(20, 27);
182}
183
184int __init s3c64xx_init_irq_eint(void)
185{
186 int irq;
187
188 for (irq = IRQ_EINT(0); irq <= IRQ_EINT(27); irq++) {
189 set_irq_chip(irq, &s3c_irq_eint);
190 set_irq_handler(irq, handle_level_irq);
191 set_irq_flags(irq, IRQF_VALID);
192 }
193
194 set_irq_chained_handler(IRQ_EINT0_3, s3c_irq_demux_eint0_3);
195 set_irq_chained_handler(IRQ_EINT4_11, s3c_irq_demux_eint4_11);
196 set_irq_chained_handler(IRQ_EINT12_19, s3c_irq_demux_eint12_19);
197 set_irq_chained_handler(IRQ_EINT20_27, s3c_irq_demux_eint20_27);
198
199 return 0;
200}
201
202arch_initcall(s3c64xx_init_irq_eint);
diff --git a/arch/arm/plat-s3c64xx/irq.c b/arch/arm/plat-s3c64xx/irq.c
new file mode 100644
index 00000000000..a94f1d5e819
--- /dev/null
+++ b/arch/arm/plat-s3c64xx/irq.c
@@ -0,0 +1,257 @@
1/* arch/arm/plat-s3c64xx/irq.c
2 *
3 * Copyright 2008 Openmoko, Inc.
4 * Copyright 2008 Simtec Electronics
5 * Ben Dooks <ben@simtec.co.uk>
6 * http://armlinux.simtec.co.uk/
7 *
8 * S3C64XX - Interrupt handling
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13 */
14
15#include <linux/kernel.h>
16#include <linux/interrupt.h>
17#include <linux/irq.h>
18#include <linux/io.h>
19
20#include <asm/hardware/vic.h>
21
22#include <mach/map.h>
23#include <plat/regs-timer.h>
24#include <plat/cpu.h>
25
26/* Timer interrupt handling */
27
28static void s3c_irq_demux_timer(unsigned int base_irq, unsigned int sub_irq)
29{
30 generic_handle_irq(sub_irq);
31}
32
33static void s3c_irq_demux_timer0(unsigned int irq, struct irq_desc *desc)
34{
35 s3c_irq_demux_timer(irq, IRQ_TIMER0);
36}
37
38static void s3c_irq_demux_timer1(unsigned int irq, struct irq_desc *desc)
39{
40 s3c_irq_demux_timer(irq, IRQ_TIMER1);
41}
42
43static void s3c_irq_demux_timer2(unsigned int irq, struct irq_desc *desc)
44{
45 s3c_irq_demux_timer(irq, IRQ_TIMER2);
46}
47
48static void s3c_irq_demux_timer3(unsigned int irq, struct irq_desc *desc)
49{
50 s3c_irq_demux_timer(irq, IRQ_TIMER3);
51}
52
53static void s3c_irq_demux_timer4(unsigned int irq, struct irq_desc *desc)
54{
55 s3c_irq_demux_timer(irq, IRQ_TIMER4);
56}
57
58/* We assume the IRQ_TIMER0..IRQ_TIMER4 range is continuous. */
59
60static void s3c_irq_timer_mask(unsigned int irq)
61{
62 u32 reg = __raw_readl(S3C64XX_TINT_CSTAT);
63
64 reg &= 0x1f; /* mask out pending interrupts */
65 reg &= ~(1 << (irq - IRQ_TIMER0));
66 __raw_writel(reg, S3C64XX_TINT_CSTAT);
67}
68
69static void s3c_irq_timer_unmask(unsigned int irq)
70{
71 u32 reg = __raw_readl(S3C64XX_TINT_CSTAT);
72
73 reg &= 0x1f; /* mask out pending interrupts */
74 reg |= 1 << (irq - IRQ_TIMER0);
75 __raw_writel(reg, S3C64XX_TINT_CSTAT);
76}
77
78static void s3c_irq_timer_ack(unsigned int irq)
79{
80 u32 reg = __raw_readl(S3C64XX_TINT_CSTAT);
81
82 reg &= 0x1f;
83 reg |= (1 << 5) << (irq - IRQ_TIMER0);
84 __raw_writel(reg, S3C64XX_TINT_CSTAT);
85}
86
87static struct irq_chip s3c_irq_timer = {
88 .name = "s3c-timer",
89 .mask = s3c_irq_timer_mask,
90 .unmask = s3c_irq_timer_unmask,
91 .ack = s3c_irq_timer_ack,
92};
93
94struct uart_irq {
95 void __iomem *regs;
96 unsigned int base_irq;
97 unsigned int parent_irq;
98};
99
100/* Note, we make use of the fact that the parent IRQs, IRQ_UART[0..3]
101 * are consecutive when looking up the interrupt in the demux routines.
102 */
103static struct uart_irq uart_irqs[] = {
104 [0] = {
105 .regs = S3C_VA_UART0,
106 .base_irq = IRQ_S3CUART_BASE0,
107 .parent_irq = IRQ_UART0,
108 },
109 [1] = {
110 .regs = S3C_VA_UART1,
111 .base_irq = IRQ_S3CUART_BASE1,
112 .parent_irq = IRQ_UART1,
113 },
114 [2] = {
115 .regs = S3C_VA_UART2,
116 .base_irq = IRQ_S3CUART_BASE2,
117 .parent_irq = IRQ_UART2,
118 },
119 [3] = {
120 .regs = S3C_VA_UART3,
121 .base_irq = IRQ_S3CUART_BASE3,
122 .parent_irq = IRQ_UART3,
123 },
124};
125
126static inline void __iomem *s3c_irq_uart_base(unsigned int irq)
127{
128 struct uart_irq *uirq = get_irq_chip_data(irq);
129 return uirq->regs;
130}
131
132static inline unsigned int s3c_irq_uart_bit(unsigned int irq)
133{
134 return irq & 3;
135}
136
137/* UART interrupt registers, not worth adding to seperate include header */
138#define S3C64XX_UINTP 0x30
139#define S3C64XX_UINTSP 0x34
140#define S3C64XX_UINTM 0x38
141
142static void s3c_irq_uart_mask(unsigned int irq)
143{
144 void __iomem *regs = s3c_irq_uart_base(irq);
145 unsigned int bit = s3c_irq_uart_bit(irq);
146 u32 reg;
147
148 reg = __raw_readl(regs + S3C64XX_UINTM);
149 reg |= (1 << bit);
150 __raw_writel(reg, regs + S3C64XX_UINTM);
151}
152
153static void s3c_irq_uart_maskack(unsigned int irq)
154{
155 void __iomem *regs = s3c_irq_uart_base(irq);
156 unsigned int bit = s3c_irq_uart_bit(irq);
157 u32 reg;
158
159 reg = __raw_readl(regs + S3C64XX_UINTM);
160 reg |= (1 << bit);
161 __raw_writel(reg, regs + S3C64XX_UINTM);
162 __raw_writel(1 << bit, regs + S3C64XX_UINTP);
163}
164
165static void s3c_irq_uart_unmask(unsigned int irq)
166{
167 void __iomem *regs = s3c_irq_uart_base(irq);
168 unsigned int bit = s3c_irq_uart_bit(irq);
169 u32 reg;
170
171 reg = __raw_readl(regs + S3C64XX_UINTM);
172 reg &= ~(1 << bit);
173 __raw_writel(reg, regs + S3C64XX_UINTM);
174}
175
176static void s3c_irq_uart_ack(unsigned int irq)
177{
178 void __iomem *regs = s3c_irq_uart_base(irq);
179 unsigned int bit = s3c_irq_uart_bit(irq);
180
181 __raw_writel(1 << bit, regs + S3C64XX_UINTP);
182}
183
184static void s3c_irq_demux_uart(unsigned int irq, struct irq_desc *desc)
185{
186 struct uart_irq *uirq = &uart_irqs[irq - IRQ_UART0];
187 u32 pend = __raw_readl(uirq->regs + S3C64XX_UINTP);
188 int base = uirq->base_irq;
189
190 if (pend & (1 << 0))
191 generic_handle_irq(base);
192 if (pend & (1 << 1))
193 generic_handle_irq(base + 1);
194 if (pend & (1 << 2))
195 generic_handle_irq(base + 2);
196 if (pend & (1 << 3))
197 generic_handle_irq(base + 3);
198}
199
200static struct irq_chip s3c_irq_uart = {
201 .name = "s3c-uart",
202 .mask = s3c_irq_uart_mask,
203 .unmask = s3c_irq_uart_unmask,
204 .mask_ack = s3c_irq_uart_maskack,
205 .ack = s3c_irq_uart_ack,
206};
207
208static void __init s3c64xx_uart_irq(struct uart_irq *uirq)
209{
210 void *reg_base = uirq->regs;
211 unsigned int irq;
212 int offs;
213
214 /* mask all interrupts at the start. */
215 __raw_writel(0xf, reg_base + S3C64XX_UINTM);
216
217 for (offs = 0; offs < 3; offs++) {
218 irq = uirq->base_irq + offs;
219
220 set_irq_chip(irq, &s3c_irq_uart);
221 set_irq_chip_data(irq, uirq);
222 set_irq_handler(irq, handle_level_irq);
223 set_irq_flags(irq, IRQF_VALID);
224 }
225
226 set_irq_chained_handler(uirq->parent_irq, s3c_irq_demux_uart);
227}
228
229void __init s3c64xx_init_irq(u32 vic0_valid, u32 vic1_valid)
230{
231 int uart, irq;
232
233 printk(KERN_DEBUG "%s: initialising interrupts\n", __func__);
234
235 /* initialise the pair of VICs */
236 vic_init(S3C_VA_VIC0, S3C_VIC0_BASE, vic0_valid);
237 vic_init(S3C_VA_VIC1, S3C_VIC1_BASE, vic1_valid);
238
239 /* add the timer sub-irqs */
240
241 set_irq_chained_handler(IRQ_TIMER0_VIC, s3c_irq_demux_timer0);
242 set_irq_chained_handler(IRQ_TIMER1_VIC, s3c_irq_demux_timer1);
243 set_irq_chained_handler(IRQ_TIMER2_VIC, s3c_irq_demux_timer2);
244 set_irq_chained_handler(IRQ_TIMER3_VIC, s3c_irq_demux_timer3);
245 set_irq_chained_handler(IRQ_TIMER4_VIC, s3c_irq_demux_timer4);
246
247 for (irq = IRQ_TIMER0; irq <= IRQ_TIMER4; irq++) {
248 set_irq_chip(irq, &s3c_irq_timer);
249 set_irq_handler(irq, handle_level_irq);
250 set_irq_flags(irq, IRQF_VALID);
251 }
252
253 for (uart = 0; uart < ARRAY_SIZE(uart_irqs); uart++)
254 s3c64xx_uart_irq(&uart_irqs[uart]);
255}
256
257
diff --git a/arch/arm/plat-s3c64xx/s3c6400-clock.c b/arch/arm/plat-s3c64xx/s3c6400-clock.c
new file mode 100644
index 00000000000..8d9a0cada66
--- /dev/null
+++ b/arch/arm/plat-s3c64xx/s3c6400-clock.c
@@ -0,0 +1,655 @@
1/* linux/arch/arm/plat-s3c64xx/s3c6400-clock.c
2 *
3 * Copyright 2008 Openmoko, Inc.
4 * Copyright 2008 Simtec Electronics
5 * Ben Dooks <ben@simtec.co.uk>
6 * http://armlinux.simtec.co.uk/
7 *
8 * S3C6400 based common clock support
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13*/
14
15#include <linux/init.h>
16#include <linux/module.h>
17#include <linux/kernel.h>
18#include <linux/list.h>
19#include <linux/errno.h>
20#include <linux/err.h>
21#include <linux/clk.h>
22#include <linux/sysdev.h>
23#include <linux/io.h>
24
25#include <mach/hardware.h>
26#include <mach/map.h>
27
28#include <plat/cpu-freq.h>
29
30#include <plat/regs-clock.h>
31#include <plat/clock.h>
32#include <plat/cpu.h>
33#include <plat/pll.h>
34
35/* fin_apll, fin_mpll and fin_epll are all the same clock, which we call
36 * ext_xtal_mux for want of an actual name from the manual.
37*/
38
39struct clk clk_ext_xtal_mux = {
40 .name = "ext_xtal",
41 .id = -1,
42};
43
44#define clk_fin_apll clk_ext_xtal_mux
45#define clk_fin_mpll clk_ext_xtal_mux
46#define clk_fin_epll clk_ext_xtal_mux
47
48#define clk_fout_mpll clk_mpll
49
50struct clk_sources {
51 unsigned int nr_sources;
52 struct clk **sources;
53};
54
55struct clksrc_clk {
56 struct clk clk;
57 unsigned int mask;
58 unsigned int shift;
59
60 struct clk_sources *sources;
61
62 unsigned int divider_shift;
63 void __iomem *reg_divider;
64};
65
66struct clk clk_fout_apll = {
67 .name = "fout_apll",
68 .id = -1,
69};
70
71static struct clk *clk_src_apll_list[] = {
72 [0] = &clk_fin_apll,
73 [1] = &clk_fout_apll,
74};
75
76static struct clk_sources clk_src_apll = {
77 .sources = clk_src_apll_list,
78 .nr_sources = ARRAY_SIZE(clk_src_apll_list),
79};
80
81struct clksrc_clk clk_mout_apll = {
82 .clk = {
83 .name = "mout_apll",
84 .id = -1,
85 },
86 .shift = S3C6400_CLKSRC_APLL_MOUT_SHIFT,
87 .mask = S3C6400_CLKSRC_APLL_MOUT,
88 .sources = &clk_src_apll,
89};
90
91struct clk clk_fout_epll = {
92 .name = "fout_epll",
93 .id = -1,
94};
95
96static struct clk *clk_src_epll_list[] = {
97 [0] = &clk_fin_epll,
98 [1] = &clk_fout_epll,
99};
100
101static struct clk_sources clk_src_epll = {
102 .sources = clk_src_epll_list,
103 .nr_sources = ARRAY_SIZE(clk_src_epll_list),
104};
105
106struct clksrc_clk clk_mout_epll = {
107 .clk = {
108 .name = "mout_epll",
109 .id = -1,
110 },
111 .shift = S3C6400_CLKSRC_EPLL_MOUT_SHIFT,
112 .mask = S3C6400_CLKSRC_EPLL_MOUT,
113 .sources = &clk_src_epll,
114};
115
116static struct clk *clk_src_mpll_list[] = {
117 [0] = &clk_fin_mpll,
118 [1] = &clk_fout_mpll,
119};
120
121static struct clk_sources clk_src_mpll = {
122 .sources = clk_src_mpll_list,
123 .nr_sources = ARRAY_SIZE(clk_src_mpll_list),
124};
125
126struct clksrc_clk clk_mout_mpll = {
127 .clk = {
128 .name = "mout_mpll",
129 .id = -1,
130 },
131 .shift = S3C6400_CLKSRC_MPLL_MOUT_SHIFT,
132 .mask = S3C6400_CLKSRC_MPLL_MOUT,
133 .sources = &clk_src_mpll,
134};
135
136static unsigned long s3c64xx_clk_doutmpll_get_rate(struct clk *clk)
137{
138 unsigned long rate = clk_get_rate(clk->parent);
139
140 printk(KERN_DEBUG "%s: parent is %ld\n", __func__, rate);
141
142 if (__raw_readl(S3C_CLK_DIV0) & S3C6400_CLKDIV0_MPLL_MASK)
143 rate /= 2;
144
145 return rate;
146}
147
148struct clk clk_dout_mpll = {
149 .name = "dout_mpll",
150 .id = -1,
151 .parent = &clk_mout_mpll.clk,
152 .get_rate = s3c64xx_clk_doutmpll_get_rate,
153};
154
155static struct clk *clkset_spi_mmc_list[] = {
156 &clk_mout_epll.clk,
157 &clk_dout_mpll,
158 &clk_fin_epll,
159 &clk_27m,
160};
161
162static struct clk_sources clkset_spi_mmc = {
163 .sources = clkset_spi_mmc_list,
164 .nr_sources = ARRAY_SIZE(clkset_spi_mmc_list),
165};
166
167static struct clk *clkset_irda_list[] = {
168 &clk_mout_epll.clk,
169 &clk_dout_mpll,
170 NULL,
171 &clk_27m,
172};
173
174static struct clk_sources clkset_irda = {
175 .sources = clkset_irda_list,
176 .nr_sources = ARRAY_SIZE(clkset_irda_list),
177};
178
179static struct clk *clkset_uart_list[] = {
180 &clk_mout_epll.clk,
181 &clk_dout_mpll,
182 NULL,
183 NULL
184};
185
186static struct clk_sources clkset_uart = {
187 .sources = clkset_uart_list,
188 .nr_sources = ARRAY_SIZE(clkset_uart_list),
189};
190
191static struct clk *clkset_uhost_list[] = {
192 &clk_mout_epll.clk,
193 &clk_dout_mpll,
194 &clk_fin_epll,
195 &clk_48m,
196};
197
198static struct clk_sources clkset_uhost = {
199 .sources = clkset_uhost_list,
200 .nr_sources = ARRAY_SIZE(clkset_uhost_list),
201};
202
203
204/* The peripheral clocks are all controlled via clocksource followed
205 * by an optional divider and gate stage. We currently roll this into
206 * one clock which hides the intermediate clock from the mux.
207 *
208 * Note, the JPEG clock can only be an even divider...
209 *
210 * The scaler and LCD clocks depend on the S3C64XX version, and also
211 * have a common parent divisor so are not included here.
212 */
213
214static inline struct clksrc_clk *to_clksrc(struct clk *clk)
215{
216 return container_of(clk, struct clksrc_clk, clk);
217}
218
219static unsigned long s3c64xx_getrate_clksrc(struct clk *clk)
220{
221 struct clksrc_clk *sclk = to_clksrc(clk);
222 unsigned long rate = clk_get_rate(clk->parent);
223 u32 clkdiv = __raw_readl(sclk->reg_divider);
224
225 clkdiv >>= sclk->divider_shift;
226 clkdiv &= 0xf;
227 clkdiv++;
228
229 rate /= clkdiv;
230 return rate;
231}
232
233static int s3c64xx_setrate_clksrc(struct clk *clk, unsigned long rate)
234{
235 struct clksrc_clk *sclk = to_clksrc(clk);
236 void __iomem *reg = sclk->reg_divider;
237 unsigned int div;
238 u32 val;
239
240 rate = clk_round_rate(clk, rate);
241 div = clk_get_rate(clk->parent) / rate;
242
243 val = __raw_readl(reg);
244 val &= ~sclk->mask;
245 val |= (rate - 1) << sclk->shift;
246 __raw_writel(val, reg);
247
248 return 0;
249}
250
251static int s3c64xx_setparent_clksrc(struct clk *clk, struct clk *parent)
252{
253 struct clksrc_clk *sclk = to_clksrc(clk);
254 struct clk_sources *srcs = sclk->sources;
255 u32 clksrc = __raw_readl(S3C_CLK_SRC);
256 int src_nr = -1;
257 int ptr;
258
259 for (ptr = 0; ptr < srcs->nr_sources; ptr++)
260 if (srcs->sources[ptr] == parent) {
261 src_nr = ptr;
262 break;
263 }
264
265 if (src_nr >= 0) {
266 clksrc &= ~sclk->mask;
267 clksrc |= src_nr << sclk->shift;
268
269 __raw_writel(clksrc, S3C_CLK_SRC);
270 return 0;
271 }
272
273 return -EINVAL;
274}
275
276static unsigned long s3c64xx_roundrate_clksrc(struct clk *clk,
277 unsigned long rate)
278{
279 unsigned long parent_rate = clk_get_rate(clk->parent);
280 int div;
281
282 if (rate > parent_rate)
283 rate = parent_rate;
284 else {
285 div = rate / parent_rate;
286
287 if (div == 0)
288 div = 1;
289 if (div > 16)
290 div = 16;
291
292 rate = parent_rate / div;
293 }
294
295 return rate;
296}
297
298static struct clksrc_clk clk_mmc0 = {
299 .clk = {
300 .name = "mmc_bus",
301 .id = 0,
302 .ctrlbit = S3C_CLKCON_SCLK_MMC0,
303 .enable = s3c64xx_sclk_ctrl,
304 .set_parent = s3c64xx_setparent_clksrc,
305 .get_rate = s3c64xx_getrate_clksrc,
306 .set_rate = s3c64xx_setrate_clksrc,
307 .round_rate = s3c64xx_roundrate_clksrc,
308 },
309 .shift = S3C6400_CLKSRC_MMC0_SHIFT,
310 .mask = S3C6400_CLKSRC_MMC0_MASK,
311 .sources = &clkset_spi_mmc,
312 .divider_shift = S3C6400_CLKDIV1_MMC0_SHIFT,
313 .reg_divider = S3C_CLK_DIV1,
314};
315
316static struct clksrc_clk clk_mmc1 = {
317 .clk = {
318 .name = "mmc_bus",
319 .id = 1,
320 .ctrlbit = S3C_CLKCON_SCLK_MMC1,
321 .enable = s3c64xx_sclk_ctrl,
322 .get_rate = s3c64xx_getrate_clksrc,
323 .set_rate = s3c64xx_setrate_clksrc,
324 .set_parent = s3c64xx_setparent_clksrc,
325 .round_rate = s3c64xx_roundrate_clksrc,
326 },
327 .shift = S3C6400_CLKSRC_MMC1_SHIFT,
328 .mask = S3C6400_CLKSRC_MMC1_MASK,
329 .sources = &clkset_spi_mmc,
330 .divider_shift = S3C6400_CLKDIV1_MMC1_SHIFT,
331 .reg_divider = S3C_CLK_DIV1,
332};
333
334static struct clksrc_clk clk_mmc2 = {
335 .clk = {
336 .name = "mmc_bus",
337 .id = 2,
338 .ctrlbit = S3C_CLKCON_SCLK_MMC2,
339 .enable = s3c64xx_sclk_ctrl,
340 .get_rate = s3c64xx_getrate_clksrc,
341 .set_rate = s3c64xx_setrate_clksrc,
342 .set_parent = s3c64xx_setparent_clksrc,
343 .round_rate = s3c64xx_roundrate_clksrc,
344 },
345 .shift = S3C6400_CLKSRC_MMC2_SHIFT,
346 .mask = S3C6400_CLKSRC_MMC2_MASK,
347 .sources = &clkset_spi_mmc,
348 .divider_shift = S3C6400_CLKDIV1_MMC2_SHIFT,
349 .reg_divider = S3C_CLK_DIV1,
350};
351
352static struct clksrc_clk clk_usbhost = {
353 .clk = {
354 .name = "usb-host-bus",
355 .id = -1,
356 .ctrlbit = S3C_CLKCON_SCLK_UHOST,
357 .enable = s3c64xx_sclk_ctrl,
358 .set_parent = s3c64xx_setparent_clksrc,
359 .get_rate = s3c64xx_getrate_clksrc,
360 .set_rate = s3c64xx_setrate_clksrc,
361 .round_rate = s3c64xx_roundrate_clksrc,
362 },
363 .shift = S3C6400_CLKSRC_UHOST_SHIFT,
364 .mask = S3C6400_CLKSRC_UHOST_MASK,
365 .sources = &clkset_uhost,
366 .divider_shift = S3C6400_CLKDIV1_UHOST_SHIFT,
367 .reg_divider = S3C_CLK_DIV1,
368};
369
370static struct clksrc_clk clk_uart_uclk1 = {
371 .clk = {
372 .name = "uclk1",
373 .id = -1,
374 .ctrlbit = S3C_CLKCON_SCLK_UART,
375 .enable = s3c64xx_sclk_ctrl,
376 .set_parent = s3c64xx_setparent_clksrc,
377 .get_rate = s3c64xx_getrate_clksrc,
378 .set_rate = s3c64xx_setrate_clksrc,
379 .round_rate = s3c64xx_roundrate_clksrc,
380 },
381 .shift = S3C6400_CLKSRC_UART_SHIFT,
382 .mask = S3C6400_CLKSRC_UART_MASK,
383 .sources = &clkset_uart,
384 .divider_shift = S3C6400_CLKDIV2_UART_SHIFT,
385 .reg_divider = S3C_CLK_DIV2,
386};
387
388/* Where does UCLK0 come from? */
389
390static struct clksrc_clk clk_spi0 = {
391 .clk = {
392 .name = "spi-bus",
393 .id = 0,
394 .ctrlbit = S3C_CLKCON_SCLK_SPI0,
395 .enable = s3c64xx_sclk_ctrl,
396 .set_parent = s3c64xx_setparent_clksrc,
397 .get_rate = s3c64xx_getrate_clksrc,
398 .set_rate = s3c64xx_setrate_clksrc,
399 .round_rate = s3c64xx_roundrate_clksrc,
400 },
401 .shift = S3C6400_CLKSRC_SPI0_SHIFT,
402 .mask = S3C6400_CLKSRC_SPI0_MASK,
403 .sources = &clkset_spi_mmc,
404 .divider_shift = S3C6400_CLKDIV2_SPI0_SHIFT,
405 .reg_divider = S3C_CLK_DIV2,
406};
407
408static struct clksrc_clk clk_spi1 = {
409 .clk = {
410 .name = "spi-bus",
411 .id = 1,
412 .ctrlbit = S3C_CLKCON_SCLK_SPI1,
413 .enable = s3c64xx_sclk_ctrl,
414 .set_parent = s3c64xx_setparent_clksrc,
415 .get_rate = s3c64xx_getrate_clksrc,
416 .set_rate = s3c64xx_setrate_clksrc,
417 .round_rate = s3c64xx_roundrate_clksrc,
418 },
419 .shift = S3C6400_CLKSRC_SPI1_SHIFT,
420 .mask = S3C6400_CLKSRC_SPI1_MASK,
421 .sources = &clkset_spi_mmc,
422 .divider_shift = S3C6400_CLKDIV2_SPI1_SHIFT,
423 .reg_divider = S3C_CLK_DIV2,
424};
425
426static struct clk clk_iis_cd0 = {
427 .name = "iis_cdclk0",
428 .id = -1,
429};
430
431static struct clk clk_iis_cd1 = {
432 .name = "iis_cdclk1",
433 .id = -1,
434};
435
436static struct clk clk_pcm_cd = {
437 .name = "pcm_cdclk",
438 .id = -1,
439};
440
441static struct clk *clkset_audio0_list[] = {
442 [0] = &clk_mout_epll.clk,
443 [1] = &clk_dout_mpll,
444 [2] = &clk_fin_epll,
445 [3] = &clk_iis_cd0,
446 [4] = &clk_pcm_cd,
447};
448
449static struct clk_sources clkset_audio0 = {
450 .sources = clkset_audio0_list,
451 .nr_sources = ARRAY_SIZE(clkset_audio0_list),
452};
453
454static struct clksrc_clk clk_audio0 = {
455 .clk = {
456 .name = "audio-bus",
457 .id = 0,
458 .ctrlbit = S3C_CLKCON_SCLK_AUDIO0,
459 .enable = s3c64xx_sclk_ctrl,
460 .set_parent = s3c64xx_setparent_clksrc,
461 .get_rate = s3c64xx_getrate_clksrc,
462 .set_rate = s3c64xx_setrate_clksrc,
463 .round_rate = s3c64xx_roundrate_clksrc,
464 },
465 .shift = S3C6400_CLKSRC_AUDIO0_SHIFT,
466 .mask = S3C6400_CLKSRC_AUDIO0_MASK,
467 .sources = &clkset_audio0,
468 .divider_shift = S3C6400_CLKDIV2_AUDIO0_SHIFT,
469 .reg_divider = S3C_CLK_DIV2,
470};
471
472static struct clk *clkset_audio1_list[] = {
473 [0] = &clk_mout_epll.clk,
474 [1] = &clk_dout_mpll,
475 [2] = &clk_fin_epll,
476 [3] = &clk_iis_cd1,
477 [4] = &clk_pcm_cd,
478};
479
480static struct clk_sources clkset_audio1 = {
481 .sources = clkset_audio1_list,
482 .nr_sources = ARRAY_SIZE(clkset_audio1_list),
483};
484
485static struct clksrc_clk clk_audio1 = {
486 .clk = {
487 .name = "audio-bus",
488 .id = 1,
489 .ctrlbit = S3C_CLKCON_SCLK_AUDIO1,
490 .enable = s3c64xx_sclk_ctrl,
491 .set_parent = s3c64xx_setparent_clksrc,
492 .get_rate = s3c64xx_getrate_clksrc,
493 .set_rate = s3c64xx_setrate_clksrc,
494 .round_rate = s3c64xx_roundrate_clksrc,
495 },
496 .shift = S3C6400_CLKSRC_AUDIO1_SHIFT,
497 .mask = S3C6400_CLKSRC_AUDIO1_MASK,
498 .sources = &clkset_audio1,
499 .divider_shift = S3C6400_CLKDIV2_AUDIO1_SHIFT,
500 .reg_divider = S3C_CLK_DIV2,
501};
502
503static struct clksrc_clk clk_irda = {
504 .clk = {
505 .name = "irda-bus",
506 .id = 0,
507 .ctrlbit = S3C_CLKCON_SCLK_IRDA,
508 .enable = s3c64xx_sclk_ctrl,
509 .set_parent = s3c64xx_setparent_clksrc,
510 .get_rate = s3c64xx_getrate_clksrc,
511 .set_rate = s3c64xx_setrate_clksrc,
512 .round_rate = s3c64xx_roundrate_clksrc,
513 },
514 .shift = S3C6400_CLKSRC_IRDA_SHIFT,
515 .mask = S3C6400_CLKSRC_IRDA_MASK,
516 .sources = &clkset_irda,
517 .divider_shift = S3C6400_CLKDIV2_IRDA_SHIFT,
518 .reg_divider = S3C_CLK_DIV2,
519};
520
521/* Clock initialisation code */
522
523static struct clksrc_clk *init_parents[] = {
524 &clk_mout_apll,
525 &clk_mout_epll,
526 &clk_mout_mpll,
527 &clk_mmc0,
528 &clk_mmc1,
529 &clk_mmc2,
530 &clk_usbhost,
531 &clk_uart_uclk1,
532 &clk_spi0,
533 &clk_spi1,
534 &clk_audio0,
535 &clk_audio1,
536 &clk_irda,
537};
538
539static void __init_or_cpufreq s3c6400_set_clksrc(struct clksrc_clk *clk)
540{
541 struct clk_sources *srcs = clk->sources;
542 u32 clksrc = __raw_readl(S3C_CLK_SRC);
543
544 clksrc &= clk->mask;
545 clksrc >>= clk->shift;
546
547 if (clksrc > srcs->nr_sources || !srcs->sources[clksrc]) {
548 printk(KERN_ERR "%s: bad source %d\n",
549 clk->clk.name, clksrc);
550 return;
551 }
552
553 clk->clk.parent = srcs->sources[clksrc];
554
555 printk(KERN_INFO "%s: source is %s (%d), rate is %ld\n",
556 clk->clk.name, clk->clk.parent->name, clksrc,
557 clk_get_rate(&clk->clk));
558}
559
560#define GET_DIV(clk, field) ((((clk) & field##_MASK) >> field##_SHIFT) + 1)
561
562void __init_or_cpufreq s3c6400_setup_clocks(void)
563{
564 struct clk *xtal_clk;
565 unsigned long xtal;
566 unsigned long fclk;
567 unsigned long hclk;
568 unsigned long hclk2;
569 unsigned long pclk;
570 unsigned long epll;
571 unsigned long apll;
572 unsigned long mpll;
573 unsigned int ptr;
574 u32 clkdiv0;
575
576 printk(KERN_DEBUG "%s: registering clocks\n", __func__);
577
578 clkdiv0 = __raw_readl(S3C_CLK_DIV0);
579 printk(KERN_DEBUG "%s: clkdiv0 = %08x\n", __func__, clkdiv0);
580
581 xtal_clk = clk_get(NULL, "xtal");
582 BUG_ON(IS_ERR(xtal_clk));
583
584 xtal = clk_get_rate(xtal_clk);
585 clk_put(xtal_clk);
586
587 printk(KERN_DEBUG "%s: xtal is %ld\n", __func__, xtal);
588
589 epll = s3c6400_get_epll(xtal);
590 mpll = s3c6400_get_pll(xtal, __raw_readl(S3C_MPLL_CON));
591 apll = s3c6400_get_pll(xtal, __raw_readl(S3C_APLL_CON));
592
593 fclk = mpll;
594
595 printk(KERN_INFO "S3C64XX: PLL settings, A=%ld, M=%ld, E=%ld\n",
596 apll, mpll, epll);
597
598 hclk2 = mpll / GET_DIV(clkdiv0, S3C6400_CLKDIV0_HCLK2);
599 hclk = hclk2 / GET_DIV(clkdiv0, S3C6400_CLKDIV0_HCLK);
600 pclk = hclk2 / GET_DIV(clkdiv0, S3C6400_CLKDIV0_PCLK);
601
602 printk(KERN_INFO "S3C64XX: HCLK2=%ld, HCLK=%ld, PCLK=%ld\n",
603 hclk2, hclk, pclk);
604
605 clk_fout_mpll.rate = mpll;
606 clk_fout_epll.rate = epll;
607 clk_fout_apll.rate = apll;
608
609 clk_h.rate = hclk;
610 clk_p.rate = pclk;
611 clk_f.rate = fclk;
612
613 for (ptr = 0; ptr < ARRAY_SIZE(init_parents); ptr++)
614 s3c6400_set_clksrc(init_parents[ptr]);
615}
616
617static struct clk *clks[] __initdata = {
618 &clk_ext_xtal_mux,
619 &clk_iis_cd0,
620 &clk_iis_cd1,
621 &clk_pcm_cd,
622 &clk_mout_epll.clk,
623 &clk_fout_epll,
624 &clk_mout_mpll.clk,
625 &clk_dout_mpll,
626 &clk_mmc0.clk,
627 &clk_mmc1.clk,
628 &clk_mmc2.clk,
629 &clk_usbhost.clk,
630 &clk_uart_uclk1.clk,
631 &clk_spi0.clk,
632 &clk_spi1.clk,
633 &clk_audio0.clk,
634 &clk_audio1.clk,
635 &clk_irda.clk,
636};
637
638void __init s3c6400_register_clocks(void)
639{
640 struct clk *clkp;
641 int ret;
642 int ptr;
643
644 for (ptr = 0; ptr < ARRAY_SIZE(clks); ptr++) {
645 clkp = clks[ptr];
646 ret = s3c24xx_register_clock(clkp);
647 if (ret < 0) {
648 printk(KERN_ERR "Failed to register clock %s (%d)\n",
649 clkp->name, ret);
650 }
651 }
652
653 clk_mpll.parent = &clk_mout_mpll.clk;
654 clk_epll.parent = &clk_mout_epll.clk;
655}
diff --git a/arch/arm/plat-s3c64xx/s3c6400-init.c b/arch/arm/plat-s3c64xx/s3c6400-init.c
new file mode 100644
index 00000000000..6c28f39df09
--- /dev/null
+++ b/arch/arm/plat-s3c64xx/s3c6400-init.c
@@ -0,0 +1,29 @@
1/* linux/arch/arm/plat-s3c64xx/s3c6400-init.c
2 *
3 * Copyright 2008 Openmoko, Inc.
4 * Copyright 2008 Simtec Electronics
5 * Ben Dooks <ben@simtec.co.uk>
6 * http://armlinux.simtec.co.uk/
7 *
8 * S3C6400 - CPU initialisation (common with other S3C64XX chips)
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13 */
14
15#include <linux/kernel.h>
16#include <linux/types.h>
17#include <linux/init.h>
18
19#include <plat/cpu.h>
20#include <plat/devs.h>
21#include <plat/s3c6400.h>
22#include <plat/s3c6410.h>
23
24/* uart registration process */
25
26void __init s3c6400_common_init_uarts(struct s3c2410_uartcfg *cfg, int no)
27{
28 s3c24xx_init_uartdevs("s3c6400-uart", s3c64xx_uart_resources, cfg, no);
29}
diff --git a/drivers/serial/Kconfig b/drivers/serial/Kconfig
index 579d63a81aa..e4ae499e587 100644
--- a/drivers/serial/Kconfig
+++ b/drivers/serial/Kconfig
@@ -447,7 +447,7 @@ config SERIAL_CLPS711X_CONSOLE
447 447
448config SERIAL_SAMSUNG 448config SERIAL_SAMSUNG
449 tristate "Samsung SoC serial support" 449 tristate "Samsung SoC serial support"
450 depends on ARM && PLAT_S3C24XX 450 depends on ARM && PLAT_S3C
451 select SERIAL_CORE 451 select SERIAL_CORE
452 help 452 help
453 Support for the on-chip UARTs on the Samsung S3C24XX series CPUs, 453 Support for the on-chip UARTs on the Samsung S3C24XX series CPUs,
@@ -508,7 +508,20 @@ config SERIAL_S3C2440
508 help 508 help
509 Serial port support for the Samsung S3C2440 and S3C2442 SoC 509 Serial port support for the Samsung S3C2440 and S3C2442 SoC
510 510
511config SERIAL_S3C24A0
512 tristate "Samsung S3C24A0 Serial port support"
513 depends on SERIAL_SAMSUNG && CPU_S3C24A0
514 default y if CPU_S3C24A0
515 help
516 Serial port support for the Samsung S3C24A0 SoC
511 517
518config SERIAL_S3C6400
519 tristate "Samsung S3C6400/S3C6410 Serial port support"
520 depends on SERIAL_SAMSUNG && (CPU_S3C600 || CPU_S3C6410)
521 default y
522 help
523 Serial port support for the Samsung S3C6400 and S3C6410
524 SoCs
512 525
513config SERIAL_DZ 526config SERIAL_DZ
514 bool "DECstation DZ serial driver" 527 bool "DECstation DZ serial driver"
diff --git a/drivers/serial/Makefile b/drivers/serial/Makefile
index 0c17c8ddb19..dfe775ac45b 100644
--- a/drivers/serial/Makefile
+++ b/drivers/serial/Makefile
@@ -41,6 +41,8 @@ obj-$(CONFIG_SERIAL_S3C2400) += s3c2400.o
41obj-$(CONFIG_SERIAL_S3C2410) += s3c2410.o 41obj-$(CONFIG_SERIAL_S3C2410) += s3c2410.o
42obj-$(CONFIG_SERIAL_S3C2412) += s3c2412.o 42obj-$(CONFIG_SERIAL_S3C2412) += s3c2412.o
43obj-$(CONFIG_SERIAL_S3C2440) += s3c2440.o 43obj-$(CONFIG_SERIAL_S3C2440) += s3c2440.o
44obj-$(CONFIG_SERIAL_S3C24A0) += s3c24a0.o
45obj-$(CONFIG_SERIAL_S3C6400) += s3c6400.o
44obj-$(CONFIG_SERIAL_IP22_ZILOG) += ip22zilog.o 46obj-$(CONFIG_SERIAL_IP22_ZILOG) += ip22zilog.o
45obj-$(CONFIG_SERIAL_MUX) += mux.o 47obj-$(CONFIG_SERIAL_MUX) += mux.o
46obj-$(CONFIG_SERIAL_68328) += 68328serial.o 48obj-$(CONFIG_SERIAL_68328) += 68328serial.o
diff --git a/drivers/serial/s3c24a0.c b/drivers/serial/s3c24a0.c
new file mode 100644
index 00000000000..ebf2fd3c8f7
--- /dev/null
+++ b/drivers/serial/s3c24a0.c
@@ -0,0 +1,118 @@
1/* linux/drivers/serial/s3c24a0.c
2 *
3 * Driver for Samsung S3C24A0 SoC onboard UARTs.
4 *
5 * Based on drivers/serial/s3c2410.c
6 *
7 * Author: Sandeep Patil <sandeep.patil@azingo.com>
8 *
9 * Ben Dooks, Copyright (c) 2003-2005,2008 Simtec Electronics
10 * http://armlinux.simtec.co.uk/
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/module.h>
18#include <linux/ioport.h>
19#include <linux/platform_device.h>
20#include <linux/init.h>
21#include <linux/serial_core.h>
22#include <linux/serial.h>
23#include <linux/io.h>
24#include <linux/irq.h>
25
26#include <mach/hardware.h>
27
28#include <plat/regs-serial.h>
29#include <mach/regs-gpio.h>
30
31#include "samsung.h"
32
33static int s3c24a0_serial_setsource(struct uart_port *port,
34 struct s3c24xx_uart_clksrc *clk)
35{
36 unsigned long ucon = rd_regl(port, S3C2410_UCON);
37
38 if (strcmp(clk->name, "uclk") == 0)
39 ucon |= S3C2410_UCON_UCLK;
40 else
41 ucon &= ~S3C2410_UCON_UCLK;
42
43 wr_regl(port, S3C2410_UCON, ucon);
44 return 0;
45}
46
47static int s3c24a0_serial_getsource(struct uart_port *port,
48 struct s3c24xx_uart_clksrc *clk)
49{
50 unsigned long ucon = rd_regl(port, S3C2410_UCON);
51
52 clk->divisor = 1;
53 clk->name = (ucon & S3C2410_UCON_UCLK) ? "uclk" : "pclk";
54
55 return 0;
56}
57
58static int s3c24a0_serial_resetport(struct uart_port *port,
59 struct s3c2410_uartcfg *cfg)
60{
61 dbg("s3c24a0_serial_resetport: port=%p (%08lx), cfg=%p\n",
62 port, port->mapbase, cfg);
63
64 wr_regl(port, S3C2410_UCON, cfg->ucon);
65 wr_regl(port, S3C2410_ULCON, cfg->ulcon);
66
67 /* reset both fifos */
68
69 wr_regl(port, S3C2410_UFCON, cfg->ufcon | S3C2410_UFCON_RESETBOTH);
70 wr_regl(port, S3C2410_UFCON, cfg->ufcon);
71
72 return 0;
73}
74
75static struct s3c24xx_uart_info s3c24a0_uart_inf = {
76 .name = "Samsung S3C24A0 UART",
77 .type = PORT_S3C2410,
78 .fifosize = 16,
79 .rx_fifomask = S3C24A0_UFSTAT_RXMASK,
80 .rx_fifoshift = S3C24A0_UFSTAT_RXSHIFT,
81 .rx_fifofull = S3C24A0_UFSTAT_RXFULL,
82 .tx_fifofull = S3C24A0_UFSTAT_TXFULL,
83 .tx_fifomask = S3C24A0_UFSTAT_TXMASK,
84 .tx_fifoshift = S3C24A0_UFSTAT_TXSHIFT,
85 .get_clksrc = s3c24a0_serial_getsource,
86 .set_clksrc = s3c24a0_serial_setsource,
87 .reset_port = s3c24a0_serial_resetport,
88};
89
90static int s3c24a0_serial_probe(struct platform_device *dev)
91{
92 return s3c24xx_serial_probe(dev, &s3c24a0_uart_inf);
93}
94
95static struct platform_driver s3c24a0_serial_drv = {
96 .probe = s3c24a0_serial_probe,
97 .remove = s3c24xx_serial_remove,
98 .driver = {
99 .name = "s3c24a0-uart",
100 .owner = THIS_MODULE,
101 },
102};
103
104s3c24xx_console_init(&s3c24a0_serial_drv, &s3c24a0_uart_inf);
105
106static int __init s3c24a0_serial_init(void)
107{
108 return s3c24xx_serial_init(&s3c24a0_serial_drv, &s3c24a0_uart_inf);
109}
110
111static void __exit s3c24a0_serial_exit(void)
112{
113 platform_driver_unregister(&s3c24a0_serial_drv);
114}
115
116module_init(s3c24a0_serial_init);
117module_exit(s3c24a0_serial_exit);
118
diff --git a/drivers/serial/s3c6400.c b/drivers/serial/s3c6400.c
new file mode 100644
index 00000000000..06936d13393
--- /dev/null
+++ b/drivers/serial/s3c6400.c
@@ -0,0 +1,151 @@
1/* linux/drivers/serial/s3c6400.c
2 *
3 * Driver for Samsung S3C6400 and S3C6410 SoC onboard UARTs.
4 *
5 * Copyright 2008 Openmoko, Inc.
6 * Copyright 2008 Simtec Electronics
7 * Ben Dooks <ben@simtec.co.uk>
8 * http://armlinux.simtec.co.uk/
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13*/
14
15#include <linux/module.h>
16#include <linux/ioport.h>
17#include <linux/io.h>
18#include <linux/platform_device.h>
19#include <linux/init.h>
20#include <linux/serial_core.h>
21#include <linux/serial.h>
22
23#include <asm/irq.h>
24#include <mach/hardware.h>
25
26#include <plat/regs-serial.h>
27
28#include "samsung.h"
29
30static int s3c6400_serial_setsource(struct uart_port *port,
31 struct s3c24xx_uart_clksrc *clk)
32{
33 unsigned long ucon = rd_regl(port, S3C2410_UCON);
34
35 if (strcmp(clk->name, "uclk0") == 0) {
36 ucon &= ~S3C6400_UCON_CLKMASK;
37 ucon |= S3C6400_UCON_UCLK0;
38 } else if (strcmp(clk->name, "uclk1") == 0)
39 ucon |= S3C6400_UCON_UCLK1;
40 else if (strcmp(clk->name, "pclk") == 0) {
41 /* See notes about transitioning from UCLK to PCLK */
42 ucon &= ~S3C6400_UCON_UCLK0;
43 } else {
44 printk(KERN_ERR "unknown clock source %s\n", clk->name);
45 return -EINVAL;
46 }
47
48 wr_regl(port, S3C2410_UCON, ucon);
49 return 0;
50}
51
52
53static int s3c6400_serial_getsource(struct uart_port *port,
54 struct s3c24xx_uart_clksrc *clk)
55{
56 u32 ucon = rd_regl(port, S3C2410_UCON);
57
58 clk->divisor = 1;
59
60 switch (ucon & S3C6400_UCON_CLKMASK) {
61 case S3C6400_UCON_UCLK0:
62 clk->name = "uclk0";
63 break;
64
65 case S3C6400_UCON_UCLK1:
66 clk->name = "uclk1";
67 break;
68
69 case S3C6400_UCON_PCLK:
70 case S3C6400_UCON_PCLK2:
71 clk->name = "pclk";
72 break;
73 }
74
75 return 0;
76}
77
78static int s3c6400_serial_resetport(struct uart_port *port,
79 struct s3c2410_uartcfg *cfg)
80{
81 unsigned long ucon = rd_regl(port, S3C2410_UCON);
82
83 dbg("s3c6400_serial_resetport: port=%p (%08lx), cfg=%p\n",
84 port, port->mapbase, cfg);
85
86 /* ensure we don't change the clock settings... */
87
88 ucon &= S3C6400_UCON_CLKMASK;
89
90 wr_regl(port, S3C2410_UCON, ucon | cfg->ucon);
91 wr_regl(port, S3C2410_ULCON, cfg->ulcon);
92
93 /* reset both fifos */
94
95 wr_regl(port, S3C2410_UFCON, cfg->ufcon | S3C2410_UFCON_RESETBOTH);
96 wr_regl(port, S3C2410_UFCON, cfg->ufcon);
97
98 return 0;
99}
100
101static struct s3c24xx_uart_info s3c6400_uart_inf = {
102 .name = "Samsung S3C6400 UART",
103 .type = PORT_S3C6400,
104 .fifosize = 64,
105 .rx_fifomask = S3C2440_UFSTAT_RXMASK,
106 .rx_fifoshift = S3C2440_UFSTAT_RXSHIFT,
107 .rx_fifofull = S3C2440_UFSTAT_RXFULL,
108 .tx_fifofull = S3C2440_UFSTAT_TXFULL,
109 .tx_fifomask = S3C2440_UFSTAT_TXMASK,
110 .tx_fifoshift = S3C2440_UFSTAT_TXSHIFT,
111 .get_clksrc = s3c6400_serial_getsource,
112 .set_clksrc = s3c6400_serial_setsource,
113 .reset_port = s3c6400_serial_resetport,
114};
115
116/* device management */
117
118static int s3c6400_serial_probe(struct platform_device *dev)
119{
120 dbg("s3c6400_serial_probe: dev=%p\n", dev);
121 return s3c24xx_serial_probe(dev, &s3c6400_uart_inf);
122}
123
124static struct platform_driver s3c6400_serial_drv = {
125 .probe = s3c6400_serial_probe,
126 .remove = s3c24xx_serial_remove,
127 .driver = {
128 .name = "s3c6400-uart",
129 .owner = THIS_MODULE,
130 },
131};
132
133s3c24xx_console_init(&s3c6400_serial_drv, &s3c6400_uart_inf);
134
135static int __init s3c6400_serial_init(void)
136{
137 return s3c24xx_serial_init(&s3c6400_serial_drv, &s3c6400_uart_inf);
138}
139
140static void __exit s3c6400_serial_exit(void)
141{
142 platform_driver_unregister(&s3c6400_serial_drv);
143}
144
145module_init(s3c6400_serial_init);
146module_exit(s3c6400_serial_exit);
147
148MODULE_DESCRIPTION("Samsung S3C6400,S3C6410 SoC Serial port driver");
149MODULE_AUTHOR("Ben Dooks <ben@simtec.co.uk>");
150MODULE_LICENSE("GPL v2");
151MODULE_ALIAS("platform:s3c6400-uart");
diff --git a/drivers/serial/samsung.c b/drivers/serial/samsung.c
index ebeda832c8a..ba2e8685f9f 100644
--- a/drivers/serial/samsung.c
+++ b/drivers/serial/samsung.c
@@ -47,9 +47,9 @@
47#include <asm/irq.h> 47#include <asm/irq.h>
48 48
49#include <mach/hardware.h> 49#include <mach/hardware.h>
50#include <mach/map.h>
50 51
51#include <plat/regs-serial.h> 52#include <plat/regs-serial.h>
52#include <mach/regs-gpio.h>
53 53
54#include "samsung.h" 54#include "samsung.h"
55 55
@@ -61,17 +61,12 @@
61 61
62/* we can support 3 uarts, but not always use them */ 62/* we can support 3 uarts, but not always use them */
63 63
64#ifdef CONFIG_CPU_S3C2400 64#if defined(CONFIG_CPU_S3C2400) || defined(CONFIG_CPU_S3C24A0)
65#define NR_PORTS (2) 65#define NR_PORTS (2)
66#else 66#else
67#define NR_PORTS (3) 67#define NR_PORTS (3)
68#endif 68#endif
69 69
70/* port irq numbers */
71
72#define TX_IRQ(port) ((port)->irq + 1)
73#define RX_IRQ(port) ((port)->irq)
74
75/* macros to change one thing to another */ 70/* macros to change one thing to another */
76 71
77#define tx_enabled(port) ((port)->unused[0]) 72#define tx_enabled(port) ((port)->unused[0])
@@ -137,8 +132,10 @@ static void s3c24xx_serial_rx_disable(struct uart_port *port)
137 132
138static void s3c24xx_serial_stop_tx(struct uart_port *port) 133static void s3c24xx_serial_stop_tx(struct uart_port *port)
139{ 134{
135 struct s3c24xx_uart_port *ourport = to_ourport(port);
136
140 if (tx_enabled(port)) { 137 if (tx_enabled(port)) {
141 disable_irq(TX_IRQ(port)); 138 disable_irq(ourport->tx_irq);
142 tx_enabled(port) = 0; 139 tx_enabled(port) = 0;
143 if (port->flags & UPF_CONS_FLOW) 140 if (port->flags & UPF_CONS_FLOW)
144 s3c24xx_serial_rx_enable(port); 141 s3c24xx_serial_rx_enable(port);
@@ -147,11 +144,13 @@ static void s3c24xx_serial_stop_tx(struct uart_port *port)
147 144
148static void s3c24xx_serial_start_tx(struct uart_port *port) 145static void s3c24xx_serial_start_tx(struct uart_port *port)
149{ 146{
147 struct s3c24xx_uart_port *ourport = to_ourport(port);
148
150 if (!tx_enabled(port)) { 149 if (!tx_enabled(port)) {
151 if (port->flags & UPF_CONS_FLOW) 150 if (port->flags & UPF_CONS_FLOW)
152 s3c24xx_serial_rx_disable(port); 151 s3c24xx_serial_rx_disable(port);
153 152
154 enable_irq(TX_IRQ(port)); 153 enable_irq(ourport->tx_irq);
155 tx_enabled(port) = 1; 154 tx_enabled(port) = 1;
156 } 155 }
157} 156}
@@ -159,9 +158,11 @@ static void s3c24xx_serial_start_tx(struct uart_port *port)
159 158
160static void s3c24xx_serial_stop_rx(struct uart_port *port) 159static void s3c24xx_serial_stop_rx(struct uart_port *port)
161{ 160{
161 struct s3c24xx_uart_port *ourport = to_ourport(port);
162
162 if (rx_enabled(port)) { 163 if (rx_enabled(port)) {
163 dbg("s3c24xx_serial_stop_rx: port=%p\n", port); 164 dbg("s3c24xx_serial_stop_rx: port=%p\n", port);
164 disable_irq(RX_IRQ(port)); 165 disable_irq(ourport->rx_irq);
165 rx_enabled(port) = 0; 166 rx_enabled(port) = 0;
166 } 167 }
167} 168}
@@ -385,13 +386,13 @@ static void s3c24xx_serial_shutdown(struct uart_port *port)
385 struct s3c24xx_uart_port *ourport = to_ourport(port); 386 struct s3c24xx_uart_port *ourport = to_ourport(port);
386 387
387 if (ourport->tx_claimed) { 388 if (ourport->tx_claimed) {
388 free_irq(TX_IRQ(port), ourport); 389 free_irq(ourport->tx_irq, ourport);
389 tx_enabled(port) = 0; 390 tx_enabled(port) = 0;
390 ourport->tx_claimed = 0; 391 ourport->tx_claimed = 0;
391 } 392 }
392 393
393 if (ourport->rx_claimed) { 394 if (ourport->rx_claimed) {
394 free_irq(RX_IRQ(port), ourport); 395 free_irq(ourport->rx_irq, ourport);
395 ourport->rx_claimed = 0; 396 ourport->rx_claimed = 0;
396 rx_enabled(port) = 0; 397 rx_enabled(port) = 0;
397 } 398 }
@@ -408,12 +409,11 @@ static int s3c24xx_serial_startup(struct uart_port *port)
408 409
409 rx_enabled(port) = 1; 410 rx_enabled(port) = 1;
410 411
411 ret = request_irq(RX_IRQ(port), 412 ret = request_irq(ourport->rx_irq, s3c24xx_serial_rx_chars, 0,
412 s3c24xx_serial_rx_chars, 0,
413 s3c24xx_serial_portname(port), ourport); 413 s3c24xx_serial_portname(port), ourport);
414 414
415 if (ret != 0) { 415 if (ret != 0) {
416 printk(KERN_ERR "cannot get irq %d\n", RX_IRQ(port)); 416 printk(KERN_ERR "cannot get irq %d\n", ourport->rx_irq);
417 return ret; 417 return ret;
418 } 418 }
419 419
@@ -423,12 +423,11 @@ static int s3c24xx_serial_startup(struct uart_port *port)
423 423
424 tx_enabled(port) = 1; 424 tx_enabled(port) = 1;
425 425
426 ret = request_irq(TX_IRQ(port), 426 ret = request_irq(ourport->tx_irq, s3c24xx_serial_tx_chars, 0,
427 s3c24xx_serial_tx_chars, 0,
428 s3c24xx_serial_portname(port), ourport); 427 s3c24xx_serial_portname(port), ourport);
429 428
430 if (ret) { 429 if (ret) {
431 printk(KERN_ERR "cannot get irq %d\n", TX_IRQ(port)); 430 printk(KERN_ERR "cannot get irq %d\n", ourport->tx_irq);
432 goto err; 431 goto err;
433 } 432 }
434 433
@@ -756,6 +755,8 @@ static const char *s3c24xx_serial_type(struct uart_port *port)
756 return "S3C2440"; 755 return "S3C2440";
757 case PORT_S3C2412: 756 case PORT_S3C2412:
758 return "S3C2412"; 757 return "S3C2412";
758 case PORT_S3C6400:
759 return "S3C6400/10";
759 default: 760 default:
760 return NULL; 761 return NULL;
761 } 762 }
@@ -1034,18 +1035,26 @@ static int s3c24xx_serial_init_port(struct s3c24xx_uart_port *ourport,
1034 1035
1035 dbg("resource %p (%lx..%lx)\n", res, res->start, res->end); 1036 dbg("resource %p (%lx..%lx)\n", res, res->start, res->end);
1036 1037
1037 port->mapbase = res->start; 1038 port->mapbase = res->start;
1038 port->membase = S3C24XX_VA_UART + (res->start - S3C24XX_PA_UART); 1039 port->membase = S3C_VA_UART + res->start - (S3C_PA_UART & 0xfff00000);
1039 ret = platform_get_irq(platdev, 0); 1040 ret = platform_get_irq(platdev, 0);
1040 if (ret < 0) 1041 if (ret < 0)
1041 port->irq = 0; 1042 port->irq = 0;
1042 else 1043 else {
1043 port->irq = ret; 1044 port->irq = ret;
1045 ourport->rx_irq = ret;
1046 ourport->tx_irq = ret + 1;
1047 }
1048
1049 ret = platform_get_irq(platdev, 1);
1050 if (ret > 0)
1051 ourport->tx_irq = ret;
1044 1052
1045 ourport->clk = clk_get(&platdev->dev, "uart"); 1053 ourport->clk = clk_get(&platdev->dev, "uart");
1046 1054
1047 dbg("port: map=%08x, mem=%08x, irq=%d, clock=%ld\n", 1055 dbg("port: map=%08x, mem=%08x, irq=%d (%d,%d), clock=%ld\n",
1048 port->mapbase, port->membase, port->irq, port->uartclk); 1056 port->mapbase, port->membase, port->irq,
1057 ourport->rx_irq, ourport->tx_irq, port->uartclk);
1049 1058
1050 /* reset the fifos (and setup the uart) */ 1059 /* reset the fifos (and setup the uart) */
1051 s3c24xx_serial_resetport(port, cfg); 1060 s3c24xx_serial_resetport(port, cfg);
diff --git a/drivers/serial/samsung.h b/drivers/serial/samsung.h
index be263423205..571d6b90d20 100644
--- a/drivers/serial/samsung.h
+++ b/drivers/serial/samsung.h
@@ -36,6 +36,9 @@ struct s3c24xx_uart_port {
36 unsigned int pm_level; 36 unsigned int pm_level;
37 unsigned long baudclk_rate; 37 unsigned long baudclk_rate;
38 38
39 unsigned int rx_irq;
40 unsigned int tx_irq;
41
39 struct s3c24xx_uart_info *info; 42 struct s3c24xx_uart_info *info;
40 struct s3c24xx_uart_clksrc *clksrc; 43 struct s3c24xx_uart_clksrc *clksrc;
41 struct clk *clk; 44 struct clk *clk;
diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h
index 4e4f1277f3b..feb3b939ec4 100644
--- a/include/linux/serial_core.h
+++ b/include/linux/serial_core.h
@@ -158,6 +158,8 @@
158/* SH-SCI */ 158/* SH-SCI */
159#define PORT_SCIFA 83 159#define PORT_SCIFA 83
160 160
161#define PORT_S3C6400 84
162
161#ifdef __KERNEL__ 163#ifdef __KERNEL__
162 164
163#include <linux/compiler.h> 165#include <linux/compiler.h>