Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/btrfs...
[pandora-kernel.git] / arch / arm / plat-s5p / cpu.c
1 /* linux/arch/arm/plat-s5p/cpu.c
2  *
3  * Copyright (c) 2009-2011 Samsung Electronics Co., Ltd.
4  *              http://www.samsung.com
5  *
6  * S5P CPU Support
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License version 2 as
10  * published by the Free Software Foundation.
11 */
12
13 #include <linux/init.h>
14 #include <linux/module.h>
15
16 #include <asm/mach/arch.h>
17 #include <asm/mach/map.h>
18
19 #include <mach/map.h>
20 #include <mach/regs-clock.h>
21
22 #include <plat/cpu.h>
23 #include <plat/s5p6440.h>
24 #include <plat/s5p6450.h>
25 #include <plat/s5pc100.h>
26 #include <plat/s5pv210.h>
27 #include <plat/exynos4.h>
28
29 /* table of supported CPUs */
30
31 static const char name_s5p6440[] = "S5P6440";
32 static const char name_s5p6450[] = "S5P6450";
33 static const char name_s5pc100[] = "S5PC100";
34 static const char name_s5pv210[] = "S5PV210/S5PC110";
35 static const char name_exynos4210[] = "EXYNOS4210";
36
37 static struct cpu_table cpu_ids[] __initdata = {
38         {
39                 .idcode         = 0x56440100,
40                 .idmask         = 0xfffff000,
41                 .map_io         = s5p6440_map_io,
42                 .init_clocks    = s5p6440_init_clocks,
43                 .init_uarts     = s5p6440_init_uarts,
44                 .init           = s5p64x0_init,
45                 .name           = name_s5p6440,
46         }, {
47                 .idcode         = 0x36450000,
48                 .idmask         = 0xfffff000,
49                 .map_io         = s5p6450_map_io,
50                 .init_clocks    = s5p6450_init_clocks,
51                 .init_uarts     = s5p6450_init_uarts,
52                 .init           = s5p64x0_init,
53                 .name           = name_s5p6450,
54         }, {
55                 .idcode         = 0x43100000,
56                 .idmask         = 0xfffff000,
57                 .map_io         = s5pc100_map_io,
58                 .init_clocks    = s5pc100_init_clocks,
59                 .init_uarts     = s5pc100_init_uarts,
60                 .init           = s5pc100_init,
61                 .name           = name_s5pc100,
62         }, {
63                 .idcode         = 0x43110000,
64                 .idmask         = 0xfffff000,
65                 .map_io         = s5pv210_map_io,
66                 .init_clocks    = s5pv210_init_clocks,
67                 .init_uarts     = s5pv210_init_uarts,
68                 .init           = s5pv210_init,
69                 .name           = name_s5pv210,
70         }, {
71                 .idcode         = 0x43210000,
72                 .idmask         = 0xfffe0000,
73                 .map_io         = exynos4_map_io,
74                 .init_clocks    = exynos4_init_clocks,
75                 .init_uarts     = exynos4_init_uarts,
76                 .init           = exynos4_init,
77                 .name           = name_exynos4210,
78         },
79 };
80
81 /* minimal IO mapping */
82
83 static struct map_desc s5p_iodesc[] __initdata = {
84         {
85                 .virtual        = (unsigned long)S5P_VA_CHIPID,
86                 .pfn            = __phys_to_pfn(S5P_PA_CHIPID),
87                 .length         = SZ_4K,
88                 .type           = MT_DEVICE,
89         }, {
90                 .virtual        = (unsigned long)S3C_VA_SYS,
91                 .pfn            = __phys_to_pfn(S5P_PA_SYSCON),
92                 .length         = SZ_64K,
93                 .type           = MT_DEVICE,
94         }, {
95                 .virtual        = (unsigned long)S3C_VA_TIMER,
96                 .pfn            = __phys_to_pfn(S5P_PA_TIMER),
97                 .length         = SZ_16K,
98                 .type           = MT_DEVICE,
99         }, {
100                 .virtual        = (unsigned long)S3C_VA_WATCHDOG,
101                 .pfn            = __phys_to_pfn(S3C_PA_WDT),
102                 .length         = SZ_4K,
103                 .type           = MT_DEVICE,
104         }, {
105                 .virtual        = (unsigned long)S5P_VA_SROMC,
106                 .pfn            = __phys_to_pfn(S5P_PA_SROMC),
107                 .length         = SZ_4K,
108                 .type           = MT_DEVICE,
109         },
110 };
111
112 /* read cpu identification code */
113
114 void __init s5p_init_io(struct map_desc *mach_desc,
115                         int size, void __iomem *cpuid_addr)
116 {
117         unsigned long idcode;
118
119         /* initialize the io descriptors we need for initialization */
120         iotable_init(s5p_iodesc, ARRAY_SIZE(s5p_iodesc));
121         if (mach_desc)
122                 iotable_init(mach_desc, size);
123
124         idcode = __raw_readl(cpuid_addr);
125         s3c_init_cpu(idcode, cpu_ids, ARRAY_SIZE(cpu_ids));
126 }