blob: 909507bae2fab89990abd8a5ffd183625cb3a87b [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 Kima2e0d622010-10-18 18:29:51 +090024#include <plat/s5p6450.h>
Marek Szyprowskiacc84702010-05-20 07:51:08 +020025#include <plat/s5pc100.h>
Kukjin Kim939d28a2010-02-24 16:40:29 +090026#include <plat/s5pv210.h>
Kukjin Kim7d30e8b2011-02-14 16:33:10 +090027#include <plat/exynos4.h>
Kukjin Kim209fecd2010-01-14 15:29:17 +090028
29/* table of supported CPUs */
30
31static const char name_s5p6440[] = "S5P6440";
Kukjin Kima2e0d622010-10-18 18:29:51 +090032static const char name_s5p6450[] = "S5P6450";
Marek Szyprowskiacc84702010-05-20 07:51:08 +020033static const char name_s5pc100[] = "S5PC100";
Kukjin Kim939d28a2010-02-24 16:40:29 +090034static const char name_s5pv210[] = "S5PV210/S5PC110";
Kukjin Kim7d30e8b2011-02-14 16:33:10 +090035static const char name_exynos4210[] = "EXYNOS4210";
Kukjin Kim68465382011-08-24 17:25:09 +090036static const char name_exynos4212[] = "EXYNOS4212";
Kukjin Kim209fecd2010-01-14 15:29:17 +090037
38static struct cpu_table cpu_ids[] __initdata = {
39 {
Kukjin Kimc06af3c2011-08-20 02:18:18 +090040 .idcode = S5P6440_CPU_ID,
41 .idmask = S5P64XX_CPU_MASK,
Kukjin Kim209fecd2010-01-14 15:29:17 +090042 .map_io = s5p6440_map_io,
43 .init_clocks = s5p6440_init_clocks,
44 .init_uarts = s5p6440_init_uarts,
Kukjin Kima2e0d622010-10-18 18:29:51 +090045 .init = s5p64x0_init,
Kukjin Kim209fecd2010-01-14 15:29:17 +090046 .name = name_s5p6440,
Kukjin Kim5f7f6a42010-01-29 10:12:14 +090047 }, {
Kukjin Kimc06af3c2011-08-20 02:18:18 +090048 .idcode = S5P6450_CPU_ID,
49 .idmask = S5P64XX_CPU_MASK,
Kukjin Kima2e0d622010-10-18 18:29:51 +090050 .map_io = s5p6450_map_io,
51 .init_clocks = s5p6450_init_clocks,
52 .init_uarts = s5p6450_init_uarts,
53 .init = s5p64x0_init,
54 .name = name_s5p6450,
55 }, {
Kukjin Kimc06af3c2011-08-20 02:18:18 +090056 .idcode = S5PC100_CPU_ID,
57 .idmask = S5PC100_CPU_MASK,
Marek Szyprowskiacc84702010-05-20 07:51:08 +020058 .map_io = s5pc100_map_io,
59 .init_clocks = s5pc100_init_clocks,
60 .init_uarts = s5pc100_init_uarts,
61 .init = s5pc100_init,
62 .name = name_s5pc100,
63 }, {
Kukjin Kimc06af3c2011-08-20 02:18:18 +090064 .idcode = S5PV210_CPU_ID,
65 .idmask = S5PV210_CPU_MASK,
Kukjin Kim939d28a2010-02-24 16:40:29 +090066 .map_io = s5pv210_map_io,
67 .init_clocks = s5pv210_init_clocks,
68 .init_uarts = s5pv210_init_uarts,
69 .init = s5pv210_init,
70 .name = name_s5pv210,
Changhwan Youn2b12b5c2010-07-26 21:08:52 +090071 }, {
Kukjin Kimc06af3c2011-08-20 02:18:18 +090072 .idcode = EXYNOS4210_CPU_ID,
73 .idmask = EXYNOS4_CPU_MASK,
Kukjin Kim7d30e8b2011-02-14 16:33:10 +090074 .map_io = exynos4_map_io,
75 .init_clocks = exynos4_init_clocks,
76 .init_uarts = exynos4_init_uarts,
77 .init = exynos4_init,
78 .name = name_exynos4210,
Kukjin Kim68465382011-08-24 17:25:09 +090079 }, {
80 .idcode = EXYNOS4212_CPU_ID,
81 .idmask = EXYNOS4_CPU_MASK,
82 .map_io = exynos4_map_io,
83 .init_clocks = exynos4_init_clocks,
84 .init_uarts = exynos4_init_uarts,
85 .init = exynos4_init,
86 .name = name_exynos4212,
Kukjin Kim209fecd2010-01-14 15:29:17 +090087 },
88};
89
90/* minimal IO mapping */
91
Kukjin Kim209fecd2010-01-14 15:29:17 +090092static struct map_desc s5p_iodesc[] __initdata = {
93 {
Kukjin Kim81317962010-01-27 16:57:07 +090094 .virtual = (unsigned long)S5P_VA_CHIPID,
95 .pfn = __phys_to_pfn(S5P_PA_CHIPID),
96 .length = SZ_4K,
97 .type = MT_DEVICE,
98 }, {
99 .virtual = (unsigned long)S3C_VA_SYS,
Kukjin Kim209fecd2010-01-14 15:29:17 +0900100 .pfn = __phys_to_pfn(S5P_PA_SYSCON),
101 .length = SZ_64K,
102 .type = MT_DEVICE,
103 }, {
Kukjin Kim81317962010-01-27 16:57:07 +0900104 .virtual = (unsigned long)S3C_VA_TIMER,
Kukjin Kim209fecd2010-01-14 15:29:17 +0900105 .pfn = __phys_to_pfn(S5P_PA_TIMER),
106 .length = SZ_16K,
107 .type = MT_DEVICE,
108 }, {
Jongpill Leed7f1e822010-06-23 21:31:21 +0900109 .virtual = (unsigned long)S3C_VA_WATCHDOG,
110 .pfn = __phys_to_pfn(S3C_PA_WDT),
111 .length = SZ_4K,
112 .type = MT_DEVICE,
Thomas Abrahambe297f02010-12-02 18:06:50 +0900113 }, {
114 .virtual = (unsigned long)S5P_VA_SROMC,
115 .pfn = __phys_to_pfn(S5P_PA_SROMC),
116 .length = SZ_4K,
117 .type = MT_DEVICE,
Kukjin Kim209fecd2010-01-14 15:29:17 +0900118 },
119};
120
121/* read cpu identification code */
122
123void __init s5p_init_io(struct map_desc *mach_desc,
124 int size, void __iomem *cpuid_addr)
125{
Kukjin Kim209fecd2010-01-14 15:29:17 +0900126 /* initialize the io descriptors we need for initialization */
127 iotable_init(s5p_iodesc, ARRAY_SIZE(s5p_iodesc));
128 if (mach_desc)
129 iotable_init(mach_desc, size);
130
Kukjin Kime6d1cb92011-08-20 12:18:07 +0900131 /* detect cpu id and rev. */
132 s5p_init_cpu(cpuid_addr);
133
Kukjin Kimc06af3c2011-08-20 02:18:18 +0900134 s3c_init_cpu(samsung_cpu_id, cpu_ids, ARRAY_SIZE(cpu_ids));
Kukjin Kim209fecd2010-01-14 15:29:17 +0900135}