]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blame - arch/arm/mach-exynos4/cpu.c
ARM: EXYNOS4: Increase reset delay for USB HOST PHY
[mirror_ubuntu-bionic-kernel.git] / arch / arm / mach-exynos4 / cpu.c
CommitLineData
7d30e8b3 1/* linux/arch/arm/mach-exynos4/cpu.c
2b12b5c4 2 *
7d30e8b3
KK
3 * Copyright (c) 2010-2011 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com
2b12b5c4
CY
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/sched.h>
12#include <linux/sysdev.h>
13
14#include <asm/mach/map.h>
15#include <asm/mach/irq.h>
16
17#include <asm/proc-fns.h>
1cf0eb79 18#include <asm/hardware/cache-l2x0.h>
aab74d3e 19#include <asm/hardware/gic.h>
2b12b5c4
CY
20
21#include <plat/cpu.h>
22#include <plat/clock.h>
0e9e5265 23#include <plat/devs.h>
7d30e8b3 24#include <plat/exynos4.h>
0e9e5265 25#include <plat/adc-core.h>
1036c3ab 26#include <plat/sdhci.h>
e61b1701 27#include <plat/fb-core.h>
604eefeb 28#include <plat/fimc-core.h>
5f27275e 29#include <plat/iic-core.h>
2b12b5c4
CY
30
31#include <mach/regs-irq.h>
32
2b12b5c4
CY
33extern int combiner_init(unsigned int combiner_nr, void __iomem *base,
34 unsigned int irq_start);
35extern void combiner_cascade_irq(unsigned int combiner_nr, unsigned int irq);
36
37/* Initial IO mappings */
7d30e8b3 38static struct map_desc exynos4_iodesc[] __initdata = {
2b12b5c4 39 {
2b740159
CY
40 .virtual = (unsigned long)S5P_VA_SYSTIMER,
41 .pfn = __phys_to_pfn(EXYNOS4_PA_SYSTIMER),
42 .length = SZ_4K,
43 .type = MT_DEVICE,
44 }, {
19a2c065 45 .virtual = (unsigned long)S5P_VA_SYSRAM,
7d30e8b3 46 .pfn = __phys_to_pfn(EXYNOS4_PA_SYSRAM),
19a2c065
KK
47 .length = SZ_4K,
48 .type = MT_DEVICE,
49 }, {
50 .virtual = (unsigned long)S5P_VA_CMU,
7d30e8b3 51 .pfn = __phys_to_pfn(EXYNOS4_PA_CMU),
19a2c065 52 .length = SZ_128K,
2b12b5c4 53 .type = MT_DEVICE,
d6d8b481
CY
54 }, {
55 .virtual = (unsigned long)S5P_VA_PMU,
7d30e8b3 56 .pfn = __phys_to_pfn(EXYNOS4_PA_PMU),
d6d8b481
CY
57 .length = SZ_64K,
58 .type = MT_DEVICE,
2b12b5c4
CY
59 }, {
60 .virtual = (unsigned long)S5P_VA_COMBINER_BASE,
7d30e8b3 61 .pfn = __phys_to_pfn(EXYNOS4_PA_COMBINER),
2b12b5c4
CY
62 .length = SZ_4K,
63 .type = MT_DEVICE,
19a2c065
KK
64 }, {
65 .virtual = (unsigned long)S5P_VA_COREPERI_BASE,
7d30e8b3 66 .pfn = __phys_to_pfn(EXYNOS4_PA_COREPERI),
19a2c065
KK
67 .length = SZ_8K,
68 .type = MT_DEVICE,
2b12b5c4
CY
69 }, {
70 .virtual = (unsigned long)S5P_VA_L2CC,
7d30e8b3 71 .pfn = __phys_to_pfn(EXYNOS4_PA_L2CC),
2b12b5c4
CY
72 .length = SZ_4K,
73 .type = MT_DEVICE,
766211e7 74 }, {
37ea63b1 75 .virtual = (unsigned long)S5P_VA_GPIO1,
7d30e8b3 76 .pfn = __phys_to_pfn(EXYNOS4_PA_GPIO1),
766211e7
CY
77 .length = SZ_4K,
78 .type = MT_DEVICE,
37ea63b1
JL
79 }, {
80 .virtual = (unsigned long)S5P_VA_GPIO2,
7d30e8b3 81 .pfn = __phys_to_pfn(EXYNOS4_PA_GPIO2),
37ea63b1
JL
82 .length = SZ_4K,
83 .type = MT_DEVICE,
84 }, {
85 .virtual = (unsigned long)S5P_VA_GPIO3,
7d30e8b3 86 .pfn = __phys_to_pfn(EXYNOS4_PA_GPIO3),
37ea63b1
JL
87 .length = SZ_256,
88 .type = MT_DEVICE,
dd0b7e20
SK
89 }, {
90 .virtual = (unsigned long)S5P_VA_DMC0,
7d30e8b3 91 .pfn = __phys_to_pfn(EXYNOS4_PA_DMC0),
dd0b7e20
SK
92 .length = SZ_4K,
93 .type = MT_DEVICE,
c598c47d 94 }, {
19a2c065
KK
95 .virtual = (unsigned long)S3C_VA_UART,
96 .pfn = __phys_to_pfn(S3C_PA_UART),
97 .length = SZ_512K,
c598c47d 98 .type = MT_DEVICE,
09596ba0
DM
99 }, {
100 .virtual = (unsigned long)S5P_VA_SROMC,
7d30e8b3 101 .pfn = __phys_to_pfn(EXYNOS4_PA_SROMC),
09596ba0
DM
102 .length = SZ_4K,
103 .type = MT_DEVICE,
8f1d169f 104 }, {
08115a13 105 .virtual = (unsigned long)S3C_VA_USB_HSPHY,
8f1d169f
JS
106 .pfn = __phys_to_pfn(EXYNOS4_PA_HSPHY),
107 .length = SZ_4K,
108 .type = MT_DEVICE,
eb13f2bf
CY
109 }, {
110 .virtual = (unsigned long)S5P_VA_GIC_CPU,
111 .pfn = __phys_to_pfn(EXYNOS4_PA_GIC_CPU),
112 .length = SZ_64K,
113 .type = MT_DEVICE,
114 }, {
115 .virtual = (unsigned long)S5P_VA_GIC_DIST,
116 .pfn = __phys_to_pfn(EXYNOS4_PA_GIC_DIST),
117 .length = SZ_64K,
118 .type = MT_DEVICE,
119 },
2b12b5c4
CY
120};
121
7d30e8b3 122static void exynos4_idle(void)
2b12b5c4
CY
123{
124 if (!need_resched())
125 cpu_do_idle();
126
127 local_irq_enable();
128}
129
7d30e8b3
KK
130/*
131 * exynos4_map_io
2b12b5c4
CY
132 *
133 * register the standard cpu IO areas
7d30e8b3
KK
134 */
135void __init exynos4_map_io(void)
2b12b5c4 136{
7d30e8b3 137 iotable_init(exynos4_iodesc, ARRAY_SIZE(exynos4_iodesc));
1036c3ab
HL
138
139 /* initialize device information early */
7d30e8b3
KK
140 exynos4_default_sdhci0();
141 exynos4_default_sdhci1();
142 exynos4_default_sdhci2();
143 exynos4_default_sdhci3();
604eefeb 144
0e9e5265
MH
145 s3c_adc_setname("samsung-adc-v3");
146
604eefeb
SN
147 s3c_fimc_setname(0, "exynos4-fimc");
148 s3c_fimc_setname(1, "exynos4-fimc");
149 s3c_fimc_setname(2, "exynos4-fimc");
150 s3c_fimc_setname(3, "exynos4-fimc");
5f27275e
SN
151
152 /* The I2C bus controllers are directly compatible with s3c2440 */
153 s3c_i2c0_setname("s3c2440-i2c");
154 s3c_i2c1_setname("s3c2440-i2c");
155 s3c_i2c2_setname("s3c2440-i2c");
e61b1701
JH
156
157 s5p_fb_setname(0, "exynos4-fb");
2b12b5c4
CY
158}
159
7d30e8b3 160void __init exynos4_init_clocks(int xtal)
2b12b5c4
CY
161{
162 printk(KERN_DEBUG "%s: initializing clocks\n", __func__);
163
164 s3c24xx_register_baseclocks(xtal);
165 s5p_register_clocks(xtal);
7d30e8b3
KK
166 exynos4_register_clocks();
167 exynos4_setup_clocks();
2b12b5c4
CY
168}
169
aab74d3e
CY
170static void exynos4_gic_irq_eoi(struct irq_data *d)
171{
172 struct gic_chip_data *gic_data = irq_data_get_irq_chip_data(d);
173
174 gic_data->cpu_base = S5P_VA_GIC_CPU +
175 (EXYNOS4_GIC_BANK_OFFSET * smp_processor_id());
176}
177
7d30e8b3 178void __init exynos4_init_irq(void)
2b12b5c4
CY
179{
180 int irq;
181
069d4e74 182 gic_init(0, IRQ_SPI(0), S5P_VA_GIC_DIST, S5P_VA_GIC_CPU);
aab74d3e 183 gic_arch_extn.irq_eoi = exynos4_gic_irq_eoi;
2b12b5c4
CY
184
185 for (irq = 0; irq < MAX_COMBINER_NR; irq++) {
1f2d6c49 186
2b12b5c4
CY
187 combiner_init(irq, (void __iomem *)S5P_VA_COMBINER(irq),
188 COMBINER_IRQ(irq, 0));
189 combiner_cascade_irq(irq, IRQ_SPI(irq));
190 }
191
192 /* The parameters of s5p_init_irq() are for VIC init.
7d30e8b3 193 * Theses parameters should be NULL and 0 because EXYNOS4
2b12b5c4
CY
194 * uses GIC instead of VIC.
195 */
196 s5p_init_irq(NULL, 0);
197}
198
7d30e8b3
KK
199struct sysdev_class exynos4_sysclass = {
200 .name = "exynos4-core",
2b12b5c4
CY
201};
202
7d30e8b3
KK
203static struct sys_device exynos4_sysdev = {
204 .cls = &exynos4_sysclass,
2b12b5c4
CY
205};
206
7d30e8b3 207static int __init exynos4_core_init(void)
2b12b5c4 208{
7d30e8b3 209 return sysdev_class_register(&exynos4_sysclass);
2b12b5c4
CY
210}
211
7d30e8b3 212core_initcall(exynos4_core_init);
2b12b5c4 213
1cf0eb79 214#ifdef CONFIG_CACHE_L2X0
7d30e8b3 215static int __init exynos4_l2x0_cache_init(void)
1cf0eb79
KP
216{
217 /* TAG, Data Latency Control: 2cycle */
218 __raw_writel(0x110, S5P_VA_L2CC + L2X0_TAG_LATENCY_CTRL);
219 __raw_writel(0x110, S5P_VA_L2CC + L2X0_DATA_LATENCY_CTRL);
220
221 /* L2X0 Prefetch Control */
222 __raw_writel(0x30000007, S5P_VA_L2CC + L2X0_PREFETCH_CTRL);
223
224 /* L2X0 Power Control */
225 __raw_writel(L2X0_DYNAMIC_CLK_GATING_EN | L2X0_STNDBY_MODE_EN,
226 S5P_VA_L2CC + L2X0_POWER_CTRL);
227
a50eb1c7 228 l2x0_init(S5P_VA_L2CC, 0x7C470001, 0xC200ffff);
1cf0eb79
KP
229
230 return 0;
231}
232
7d30e8b3 233early_initcall(exynos4_l2x0_cache_init);
1cf0eb79
KP
234#endif
235
7d30e8b3 236int __init exynos4_init(void)
2b12b5c4 237{
7d30e8b3 238 printk(KERN_INFO "EXYNOS4: Initializing architecture\n");
2b12b5c4
CY
239
240 /* set idle function */
7d30e8b3 241 pm_idle = exynos4_idle;
2b12b5c4 242
7d30e8b3 243 return sysdev_register(&exynos4_sysdev);
2b12b5c4 244}