blob: c3bfe9b13acf0c64c671e725395a8ba4d8ab423d [file] [log] [blame]
Kukjin Kim209fecd2010-01-14 15:29:17 +09001/* linux/arch/arm/plat-s5p/cpu.c
2 *
Kukjin Kim7d30e8b2011-02-14 16:33:10 +09003 * Copyright (c) 2009-2011 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com
Kukjin Kim209fecd2010-01-14 15:29:17 +09005 *
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>
Kukjin Kim7d30e8b2011-02-14 16:33:10 +090015
Kukjin Kim209fecd2010-01-14 15:29:17 +090016#include <asm/mach/arch.h>
17#include <asm/mach/map.h>
Kukjin Kim7d30e8b2011-02-14 16:33:10 +090018
19#include <mach/map.h>
Kukjin Kim209fecd2010-01-14 15:29:17 +090020#include <mach/regs-clock.h>
Kukjin Kim7d30e8b2011-02-14 16:33:10 +090021
Kukjin Kim209fecd2010-01-14 15:29:17 +090022#include <plat/cpu.h>
23#include <plat/s5p6440.h>
Kukjin Kim5f7f6a42010-01-29 10:12:14 +090024#include <plat/s5p6442.h>
Kukjin Kima2e0d622010-10-18 18:29:51 +090025#include <plat/s5p6450.h>
Marek Szyprowskiacc84702010-05-20 07:51:08 +020026#include <plat/s5pc100.h>
Kukjin Kim939d28a2010-02-24 16:40:29 +090027#include <plat/s5pv210.h>
Kukjin Kim7d30e8b2011-02-14 16:33:10 +090028#include <plat/exynos4.h>
Kukjin Kim209fecd2010-01-14 15:29:17 +090029
30/* table of supported CPUs */
31
32static const char name_s5p6440[] = "S5P6440";
Kukjin Kim5f7f6a42010-01-29 10:12:14 +090033static const char name_s5p6442[] = "S5P6442";
Kukjin Kima2e0d622010-10-18 18:29:51 +090034static const char name_s5p6450[] = "S5P6450";
Marek Szyprowskiacc84702010-05-20 07:51:08 +020035static const char name_s5pc100[] = "S5PC100";
Kukjin Kim939d28a2010-02-24 16:40:29 +090036static const char name_s5pv210[] = "S5PV210/S5PC110";
Kukjin Kim7d30e8b2011-02-14 16:33:10 +090037static const char name_exynos4210[] = "EXYNOS4210";
Kukjin Kim209fecd2010-01-14 15:29:17 +090038
39static struct cpu_table cpu_ids[] __initdata = {
40 {
41 .idcode = 0x56440100,
42 .idmask = 0xffffff00,
43 .map_io = s5p6440_map_io,
44 .init_clocks = s5p6440_init_clocks,
45 .init_uarts = s5p6440_init_uarts,
Kukjin Kima2e0d622010-10-18 18:29:51 +090046 .init = s5p64x0_init,
Kukjin Kim209fecd2010-01-14 15:29:17 +090047 .name = name_s5p6440,
Kukjin Kim5f7f6a42010-01-29 10:12:14 +090048 }, {
49 .idcode = 0x36442000,
50 .idmask = 0xffffff00,
51 .map_io = s5p6442_map_io,
52 .init_clocks = s5p6442_init_clocks,
53 .init_uarts = s5p6442_init_uarts,
54 .init = s5p6442_init,
55 .name = name_s5p6442,
Kukjin Kim939d28a2010-02-24 16:40:29 +090056 }, {
Kukjin Kima2e0d622010-10-18 18:29:51 +090057 .idcode = 0x36450000,
58 .idmask = 0xffffff00,
59 .map_io = s5p6450_map_io,
60 .init_clocks = s5p6450_init_clocks,
61 .init_uarts = s5p6450_init_uarts,
62 .init = s5p64x0_init,
63 .name = name_s5p6450,
64 }, {
Marek Szyprowskiacc84702010-05-20 07:51:08 +020065 .idcode = 0x43100000,
66 .idmask = 0xfffff000,
67 .map_io = s5pc100_map_io,
68 .init_clocks = s5pc100_init_clocks,
69 .init_uarts = s5pc100_init_uarts,
70 .init = s5pc100_init,
71 .name = name_s5pc100,
72 }, {
Kukjin Kim939d28a2010-02-24 16:40:29 +090073 .idcode = 0x43110000,
74 .idmask = 0xfffff000,
75 .map_io = s5pv210_map_io,
76 .init_clocks = s5pv210_init_clocks,
77 .init_uarts = s5pv210_init_uarts,
78 .init = s5pv210_init,
79 .name = name_s5pv210,
Changhwan Youn2b12b5c2010-07-26 21:08:52 +090080 }, {
Kukjin Kim7d30e8b2011-02-14 16:33:10 +090081 .idcode = 0x43210000,
Changhwan Youn2b12b5c2010-07-26 21:08:52 +090082 .idmask = 0xfffff000,
Kukjin Kim7d30e8b2011-02-14 16:33:10 +090083 .map_io = exynos4_map_io,
84 .init_clocks = exynos4_init_clocks,
85 .init_uarts = exynos4_init_uarts,
86 .init = exynos4_init,
87 .name = name_exynos4210,
Kukjin Kim209fecd2010-01-14 15:29:17 +090088 },
89};
90
91/* minimal IO mapping */
92
Kukjin Kim209fecd2010-01-14 15:29:17 +090093static struct map_desc s5p_iodesc[] __initdata = {
94 {
Kukjin Kim81317962010-01-27 16:57:07 +090095 .virtual = (unsigned long)S5P_VA_CHIPID,
96 .pfn = __phys_to_pfn(S5P_PA_CHIPID),
97 .length = SZ_4K,
98 .type = MT_DEVICE,
99 }, {
100 .virtual = (unsigned long)S3C_VA_SYS,
Kukjin Kim209fecd2010-01-14 15:29:17 +0900101 .pfn = __phys_to_pfn(S5P_PA_SYSCON),
102 .length = SZ_64K,
103 .type = MT_DEVICE,
104 }, {
Kukjin Kim81317962010-01-27 16:57:07 +0900105 .virtual = (unsigned long)S3C_VA_TIMER,
Kukjin Kim209fecd2010-01-14 15:29:17 +0900106 .pfn = __phys_to_pfn(S5P_PA_TIMER),
107 .length = SZ_16K,
108 .type = MT_DEVICE,
109 }, {
Jongpill Leed7f1e822010-06-23 21:31:21 +0900110 .virtual = (unsigned long)S3C_VA_WATCHDOG,
111 .pfn = __phys_to_pfn(S3C_PA_WDT),
112 .length = SZ_4K,
113 .type = MT_DEVICE,
Thomas Abrahambe297f02010-12-02 18:06:50 +0900114 }, {
115 .virtual = (unsigned long)S5P_VA_SROMC,
116 .pfn = __phys_to_pfn(S5P_PA_SROMC),
117 .length = SZ_4K,
118 .type = MT_DEVICE,
Kukjin Kim209fecd2010-01-14 15:29:17 +0900119 },
120};
121
122/* read cpu identification code */
123
124void __init s5p_init_io(struct map_desc *mach_desc,
125 int size, void __iomem *cpuid_addr)
126{
127 unsigned long idcode;
128
129 /* initialize the io descriptors we need for initialization */
130 iotable_init(s5p_iodesc, ARRAY_SIZE(s5p_iodesc));
131 if (mach_desc)
132 iotable_init(mach_desc, size);
133
134 idcode = __raw_readl(cpuid_addr);
135 s3c_init_cpu(idcode, cpu_ids, ARRAY_SIZE(cpu_ids));
136}