aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/plat-s3c64xx
diff options
context:
space:
mode:
authorBen Dooks <ben-linux@fluff.org>2008-10-21 09:06:49 -0400
committerBen Dooks <ben-linux@fluff.org>2008-12-15 16:50:31 -0500
commitbeda30f6a9c5f8e1eebd195019a537057cc556fd (patch)
tree547c909046ca656874639ed5d34c1939a14b6ae2 /arch/arm/plat-s3c64xx
parentc142f173cd5e5e16877016673f482009ffafaef6 (diff)
[ARM] S3C64XX: Basic CPU detection and map initialisation
Initialise the basic physical to virtual mappings and then detect the CPU that the system is being run on so that the cpu code code can call the correct initialisation code. Signed-off-by: Ben Dooks <ben-linux@fluff.org>
Diffstat (limited to 'arch/arm/plat-s3c64xx')
-rw-r--r--arch/arm/plat-s3c64xx/Makefile1
-rw-r--r--arch/arm/plat-s3c64xx/cpu.c106
-rw-r--r--arch/arm/plat-s3c64xx/include/plat/s3c6400.h33
-rw-r--r--arch/arm/plat-s3c64xx/include/plat/s3c6410.h28
4 files changed, 168 insertions, 0 deletions
diff --git a/arch/arm/plat-s3c64xx/Makefile b/arch/arm/plat-s3c64xx/Makefile
index 178c968bb8da..5d9a1d86ab8e 100644
--- a/arch/arm/plat-s3c64xx/Makefile
+++ b/arch/arm/plat-s3c64xx/Makefile
@@ -13,3 +13,4 @@ obj- :=
13# Core files 13# Core files
14 14
15obj-y += dev-uart.o 15obj-y += dev-uart.o
16obj-y += cpu.o
diff --git a/arch/arm/plat-s3c64xx/cpu.c b/arch/arm/plat-s3c64xx/cpu.c
new file mode 100644
index 000000000000..dc7bf112ec05
--- /dev/null
+++ b/arch/arm/plat-s3c64xx/cpu.c
@@ -0,0 +1,106 @@
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 = 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 = S3C_VA_VIC0,
82 .pfn = __phys_to_pfn(S3C64XX_PA_VIC0),
83 .length = SZ_16K,
84 .type = MT_DEVICE,
85 }, {
86 .virtual = S3C_VA_VIC1,
87 .pfn = __phys_to_pfn(S3C64XX_PA_VIC1),
88 .length = SZ_16K,
89 .type = MT_DEVICE,
90 },
91};
92
93/* read cpu identification code */
94
95
96void __init s3c64xx_init_io(struct map_desc *mach_desc, int size)
97{
98 unsigned long idcode;
99
100 /* initialise the io descriptors we need for initialisation */
101 iotable_init(s3c_iodesc, ARRAY_SIZE(s3c_iodesc));
102 iotable_init(mach_desc, size);
103
104 idcode = __raw_readl(S3C_VA_SYS + 0x118);
105 s3c_init_cpu(idcode, cpu_ids, ARRAY_SIZE(cpu_ids));
106}
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 000000000000..142bb3d18cdc
--- /dev/null
+++ b/arch/arm/plat-s3c64xx/include/plat/s3c6400.h
@@ -0,0 +1,33 @@
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);
18
19#ifdef CONFIG_CPU_S3C6400
20
21extern int s3c6400_init(void);
22extern void s3c6400_map_io(void);
23extern void s3c6400_init_clocks(int xtal);
24
25#define s3c6400_init_uarts s3c6400_common_init_uarts
26
27#else
28#define s3c6400_init_clocks NULL
29#define s3c6400_init_uarts NULL
30#define s3c6400_map_io NULL
31#define s3c6400_init NULL
32#endif
33
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 000000000000..56f14b5d454b
--- /dev/null
+++ b/arch/arm/plat-s3c64xx/include/plat/s3c6410.h
@@ -0,0 +1,28 @@
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_map_io(void);
19extern void s3c6410_init_clocks(int xtal);
20
21#define s3c6410_init_uarts s3c6400_common_init_uarts
22
23#else
24#define s3c6410_init_clocks NULL
25#define s3c6410_init_uarts NULL
26#define s3c6410_map_io NULL
27#define s3c6410_init NULL
28#endif