ARM: S5P64X0: Update Kconfig and Makefile
[firefly-linux-kernel-4.4.55.git] / arch / arm / mach-s5p6440 / cpu.c
1 /* linux/arch/arm/mach-s5p6440/cpu.c
2  *
3  * Copyright (c) 2009-2010 Samsung Electronics Co., Ltd.
4  *              http://www.samsung.com
5  *
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>
22 #include <linux/sched.h>
23
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/s5p6440.h>
41 #include <plat/adc-core.h>
42
43 /* Initial IO mappings */
44
45 static struct map_desc s5p6440_iodesc[] __initdata = {
46         {
47                 .virtual        = (unsigned long)S5P_VA_GPIO,
48                 .pfn            = __phys_to_pfn(S5P6440_PA_GPIO),
49                 .length         = SZ_4K,
50                 .type           = MT_DEVICE,
51         }, {
52                 .virtual        = (unsigned long)VA_VIC0,
53                 .pfn            = __phys_to_pfn(S5P6440_PA_VIC0),
54                 .length         = SZ_16K,
55                 .type           = MT_DEVICE,
56         }, {
57                 .virtual        = (unsigned long)VA_VIC1,
58                 .pfn            = __phys_to_pfn(S5P6440_PA_VIC1),
59                 .length         = SZ_16K,
60                 .type           = MT_DEVICE,
61         }, {
62                 .virtual        = (unsigned long)S3C_VA_UART,
63                 .pfn            = __phys_to_pfn(S3C_PA_UART),
64                 .length         = SZ_512K,
65                 .type           = MT_DEVICE,
66         }
67 };
68
69 static void s5p6440_idle(void)
70 {
71         unsigned long val;
72
73         if (!need_resched()) {
74                 val = __raw_readl(S5P_PWR_CFG);
75                 val &= ~(0x3<<5);
76                 val |= (0x1<<5);
77                 __raw_writel(val, S5P_PWR_CFG);
78
79                 cpu_do_idle();
80         }
81         local_irq_enable();
82 }
83
84 /*
85  * s5p6440_map_io
86  *
87  * register the standard cpu IO areas
88  */
89
90 void __init s5p6440_map_io(void)
91 {
92         /* initialize any device information early */
93         s3c_adc_setname("s3c64xx-adc");
94
95         iotable_init(s5p6440_iodesc, ARRAY_SIZE(s5p6440_iodesc));
96 }
97
98 void __init s5p6440_init_clocks(int xtal)
99 {
100         printk(KERN_DEBUG "%s: initializing clocks\n", __func__);
101
102         s3c24xx_register_baseclocks(xtal);
103         s5p_register_clocks(xtal);
104         s5p6440_register_clocks();
105         s5p6440_setup_clocks();
106 }
107
108 void __init s5p6440_init_irq(void)
109 {
110         /* S5P6440 supports only 2 VIC */
111         u32 vic[2];
112
113         /*
114          * VIC0 is missing IRQ_VIC0[3, 4, 8, 10, (12-22)]
115          * VIC1 is missing IRQ VIC1[1, 3, 4, 10, 11, 12, 14, 15, 22]
116          */
117         vic[0] = 0xff800ae7;
118         vic[1] = 0xffbf23e5;
119
120         s5p_init_irq(vic, ARRAY_SIZE(vic));
121 }
122
123 struct sysdev_class s5p6440_sysclass = {
124         .name   = "s5p6440-core",
125 };
126
127 static struct sys_device s5p6440_sysdev = {
128         .cls    = &s5p6440_sysclass,
129 };
130
131 static int __init s5p6440_core_init(void)
132 {
133         return sysdev_class_register(&s5p6440_sysclass);
134 }
135
136 core_initcall(s5p6440_core_init);
137
138 int __init s5p6440_init(void)
139 {
140         printk(KERN_INFO "S5P6440: Initializing architecture\n");
141
142         /* set idle function */
143         pm_idle = s5p6440_idle;
144
145         return sysdev_register(&s5p6440_sysdev);
146 }