blob: 842af86bda6def3db35fcab32bd36127f5e14aad [file] [log] [blame]
Kukjin Kim5f7f6a42010-01-29 10:12:14 +09001/* linux/arch/arm/mach-s5p6442/cpu.c
2 *
3 * Copyright (c) 2010 Samsung Electronics Co., Ltd.
Kukjin Kim19a2c062010-08-31 16:30:51 +09004 * http://www.samsung.com
Kukjin Kim5f7f6a42010-01-29 10:12:14 +09005 *
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#include <linux/kernel.h>
12#include <linux/types.h>
13#include <linux/interrupt.h>
14#include <linux/list.h>
15#include <linux/timer.h>
16#include <linux/init.h>
17#include <linux/clk.h>
18#include <linux/io.h>
19#include <linux/sysdev.h>
20#include <linux/serial_core.h>
21#include <linux/platform_device.h>
SeungChull Suh4341f9b2010-10-02 12:48:12 +090022#include <linux/sched.h>
Kukjin Kim5f7f6a42010-01-29 10:12:14 +090023
24#include <asm/mach/arch.h>
25#include <asm/mach/map.h>
26#include <asm/mach/irq.h>
27
28#include <asm/proc-fns.h>
29
30#include <mach/hardware.h>
31#include <mach/map.h>
32#include <asm/irq.h>
33
34#include <plat/regs-serial.h>
35#include <mach/regs-clock.h>
36
37#include <plat/cpu.h>
38#include <plat/devs.h>
39#include <plat/clock.h>
40#include <plat/s5p6442.h>
41
42/* Initial IO mappings */
43
44static struct map_desc s5p6442_iodesc[] __initdata = {
45 {
46 .virtual = (unsigned long)S5P_VA_SYSTIMER,
47 .pfn = __phys_to_pfn(S5P6442_PA_SYSTIMER),
48 .length = SZ_16K,
49 .type = MT_DEVICE,
50 }, {
Kukjin Kim19a2c062010-08-31 16:30:51 +090051 .virtual = (unsigned long)S5P_VA_GPIO,
52 .pfn = __phys_to_pfn(S5P6442_PA_GPIO),
53 .length = SZ_4K,
54 .type = MT_DEVICE,
55 }, {
56 .virtual = (unsigned long)VA_VIC0,
57 .pfn = __phys_to_pfn(S5P6442_PA_VIC0),
58 .length = SZ_16K,
59 .type = MT_DEVICE,
60 }, {
61 .virtual = (unsigned long)VA_VIC1,
62 .pfn = __phys_to_pfn(S5P6442_PA_VIC1),
63 .length = SZ_16K,
64 .type = MT_DEVICE,
65 }, {
Kukjin Kim5f7f6a42010-01-29 10:12:14 +090066 .virtual = (unsigned long)VA_VIC2,
67 .pfn = __phys_to_pfn(S5P6442_PA_VIC2),
68 .length = SZ_16K,
69 .type = MT_DEVICE,
Kukjin Kim19a2c062010-08-31 16:30:51 +090070 }, {
71 .virtual = (unsigned long)S3C_VA_UART,
72 .pfn = __phys_to_pfn(S3C_PA_UART),
73 .length = SZ_512K,
74 .type = MT_DEVICE,
Kukjin Kim5f7f6a42010-01-29 10:12:14 +090075 }
76};
77
78static void s5p6442_idle(void)
79{
80 if (!need_resched())
81 cpu_do_idle();
82
83 local_irq_enable();
84}
85
Kukjin Kim19a2c062010-08-31 16:30:51 +090086/*
87 * s5p6442_map_io
Kukjin Kim5f7f6a42010-01-29 10:12:14 +090088 *
89 * register the standard cpu IO areas
Kukjin Kim19a2c062010-08-31 16:30:51 +090090 */
Kukjin Kim5f7f6a42010-01-29 10:12:14 +090091
92void __init s5p6442_map_io(void)
93{
94 iotable_init(s5p6442_iodesc, ARRAY_SIZE(s5p6442_iodesc));
95}
96
97void __init s5p6442_init_clocks(int xtal)
98{
99 printk(KERN_DEBUG "%s: initializing clocks\n", __func__);
100
101 s3c24xx_register_baseclocks(xtal);
102 s5p_register_clocks(xtal);
103 s5p6442_register_clocks();
104 s5p6442_setup_clocks();
105}
106
107void __init s5p6442_init_irq(void)
108{
109 /* S5P6442 supports 3 VIC */
110 u32 vic[3];
111
112 /* VIC0, VIC1, and VIC2: some interrupt reserved */
113 vic[0] = 0x7fefffff;
114 vic[1] = 0X7f389c81;
115 vic[2] = 0X1bbbcfff;
116
117 s5p_init_irq(vic, ARRAY_SIZE(vic));
118}
119
Kukjin Kim0ad73ce2010-05-11 09:56:37 +0900120struct sysdev_class s5p6442_sysclass = {
Kukjin Kim5f7f6a42010-01-29 10:12:14 +0900121 .name = "s5p6442-core",
122};
123
124static struct sys_device s5p6442_sysdev = {
125 .cls = &s5p6442_sysclass,
126};
127
128static int __init s5p6442_core_init(void)
129{
130 return sysdev_class_register(&s5p6442_sysclass);
131}
132
133core_initcall(s5p6442_core_init);
134
135int __init s5p6442_init(void)
136{
137 printk(KERN_INFO "S5P6442: Initializing architecture\n");
138
139 /* set idle function */
140 pm_idle = s5p6442_idle;
141
142 return sysdev_register(&s5p6442_sysdev);
143}