Kukjin Kim | cc511b8 | 2011-12-27 08:18:36 +0100 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2010-2011 Samsung Electronics Co., Ltd. |
| 3 | * http://www.samsung.com |
| 4 | * |
| 5 | * Common Codes for EXYNOS |
| 6 | * |
| 7 | * This program is free software; you can redistribute it and/or modify |
| 8 | * it under the terms of the GNU General Public License version 2 as |
| 9 | * published by the Free Software Foundation. |
| 10 | */ |
| 11 | |
| 12 | #include <linux/kernel.h> |
Tomasz Figa | 68a433f | 2013-05-25 06:27:29 +0900 | [diff] [blame] | 13 | #include <linux/bitops.h> |
Kukjin Kim | cc511b8 | 2011-12-27 08:18:36 +0100 | [diff] [blame] | 14 | #include <linux/interrupt.h> |
| 15 | #include <linux/irq.h> |
Rob Herring | a900e5d | 2013-02-12 16:04:52 -0600 | [diff] [blame] | 16 | #include <linux/irqchip.h> |
Kukjin Kim | cc511b8 | 2011-12-27 08:18:36 +0100 | [diff] [blame] | 17 | #include <linux/io.h> |
Linus Torvalds | 7affca3 | 2012-01-07 12:03:30 -0800 | [diff] [blame] | 18 | #include <linux/device.h> |
Kukjin Kim | cc511b8 | 2011-12-27 08:18:36 +0100 | [diff] [blame] | 19 | #include <linux/gpio.h> |
Tomasz Figa | 68a433f | 2013-05-25 06:27:29 +0900 | [diff] [blame] | 20 | #include <clocksource/samsung_pwm.h> |
Kukjin Kim | cc511b8 | 2011-12-27 08:18:36 +0100 | [diff] [blame] | 21 | #include <linux/sched.h> |
| 22 | #include <linux/serial_core.h> |
Arnd Bergmann | 237c78b | 2012-01-07 12:30:20 +0000 | [diff] [blame] | 23 | #include <linux/of.h> |
Doug Anderson | 5b7897d | 2012-11-27 11:53:14 -0800 | [diff] [blame] | 24 | #include <linux/of_fdt.h> |
Arnd Bergmann | 237c78b | 2012-01-07 12:30:20 +0000 | [diff] [blame] | 25 | #include <linux/of_irq.h> |
Thomas Abraham | 1e60bc0 | 2012-05-15 16:18:35 +0900 | [diff] [blame] | 26 | #include <linux/export.h> |
| 27 | #include <linux/irqdomain.h> |
Thomas Abraham | e873a47 | 2012-05-15 16:25:23 +0900 | [diff] [blame] | 28 | #include <linux/of_address.h> |
Thomas Abraham | 6923ae4 | 2013-03-09 17:03:29 +0900 | [diff] [blame] | 29 | #include <linux/clocksource.h> |
| 30 | #include <linux/clk-provider.h> |
Rob Herring | 520f7bd | 2012-12-27 13:10:24 -0600 | [diff] [blame] | 31 | #include <linux/irqchip/arm-gic.h> |
Catalin Marinas | de88cbb | 2013-01-18 15:31:37 +0000 | [diff] [blame] | 32 | #include <linux/irqchip/chained_irq.h> |
Kukjin Kim | cc511b8 | 2011-12-27 08:18:36 +0100 | [diff] [blame] | 33 | |
| 34 | #include <asm/proc-fns.h> |
Arnd Bergmann | 40ba95f | 2012-01-07 11:51:28 +0000 | [diff] [blame] | 35 | #include <asm/exception.h> |
Kukjin Kim | cc511b8 | 2011-12-27 08:18:36 +0100 | [diff] [blame] | 36 | #include <asm/hardware/cache-l2x0.h> |
Kukjin Kim | cc511b8 | 2011-12-27 08:18:36 +0100 | [diff] [blame] | 37 | #include <asm/mach/map.h> |
| 38 | #include <asm/mach/irq.h> |
Amit Daniel Kachhap | b756a50 | 2012-03-08 02:07:41 -0800 | [diff] [blame] | 39 | #include <asm/cacheflush.h> |
Kukjin Kim | cc511b8 | 2011-12-27 08:18:36 +0100 | [diff] [blame] | 40 | |
| 41 | #include <mach/regs-irq.h> |
| 42 | #include <mach/regs-pmu.h> |
Kukjin Kim | cc511b8 | 2011-12-27 08:18:36 +0100 | [diff] [blame] | 43 | |
| 44 | #include <plat/cpu.h> |
Kukjin Kim | cc511b8 | 2011-12-27 08:18:36 +0100 | [diff] [blame] | 45 | #include <plat/pm.h> |
Kukjin Kim | cc511b8 | 2011-12-27 08:18:36 +0100 | [diff] [blame] | 46 | #include <plat/regs-serial.h> |
| 47 | |
| 48 | #include "common.h" |
Amit Daniel Kachhap | 6cdeddc | 2012-03-08 02:09:12 -0800 | [diff] [blame] | 49 | #define L2_AUX_VAL 0x7C470001 |
| 50 | #define L2_AUX_MASK 0xC200ffff |
Kukjin Kim | cc511b8 | 2011-12-27 08:18:36 +0100 | [diff] [blame] | 51 | |
Kukjin Kim | cc511b8 | 2011-12-27 08:18:36 +0100 | [diff] [blame] | 52 | static const char name_exynos4210[] = "EXYNOS4210"; |
| 53 | static const char name_exynos4212[] = "EXYNOS4212"; |
| 54 | static const char name_exynos4412[] = "EXYNOS4412"; |
Kukjin Kim | 94c7ca7 | 2012-02-11 22:15:45 +0900 | [diff] [blame] | 55 | static const char name_exynos5250[] = "EXYNOS5250"; |
Kukjin Kim | 2edb36c | 2012-11-15 15:48:56 +0900 | [diff] [blame] | 56 | static const char name_exynos5440[] = "EXYNOS5440"; |
Kukjin Kim | cc511b8 | 2011-12-27 08:18:36 +0100 | [diff] [blame] | 57 | |
Kukjin Kim | 906c789 | 2012-02-11 21:27:08 +0900 | [diff] [blame] | 58 | static void exynos4_map_io(void); |
Kukjin Kim | 94c7ca7 | 2012-02-11 22:15:45 +0900 | [diff] [blame] | 59 | static void exynos5_map_io(void); |
Kukjin Kim | 2edb36c | 2012-11-15 15:48:56 +0900 | [diff] [blame] | 60 | static void exynos5440_map_io(void); |
Kukjin Kim | 906c789 | 2012-02-11 21:27:08 +0900 | [diff] [blame] | 61 | static int exynos_init(void); |
Kukjin Kim | cc511b8 | 2011-12-27 08:18:36 +0100 | [diff] [blame] | 62 | |
| 63 | static struct cpu_table cpu_ids[] __initdata = { |
| 64 | { |
| 65 | .idcode = EXYNOS4210_CPU_ID, |
| 66 | .idmask = EXYNOS4_CPU_MASK, |
| 67 | .map_io = exynos4_map_io, |
Kukjin Kim | cc511b8 | 2011-12-27 08:18:36 +0100 | [diff] [blame] | 68 | .init = exynos_init, |
| 69 | .name = name_exynos4210, |
| 70 | }, { |
| 71 | .idcode = EXYNOS4212_CPU_ID, |
| 72 | .idmask = EXYNOS4_CPU_MASK, |
| 73 | .map_io = exynos4_map_io, |
Kukjin Kim | cc511b8 | 2011-12-27 08:18:36 +0100 | [diff] [blame] | 74 | .init = exynos_init, |
| 75 | .name = name_exynos4212, |
| 76 | }, { |
| 77 | .idcode = EXYNOS4412_CPU_ID, |
| 78 | .idmask = EXYNOS4_CPU_MASK, |
| 79 | .map_io = exynos4_map_io, |
Kukjin Kim | cc511b8 | 2011-12-27 08:18:36 +0100 | [diff] [blame] | 80 | .init = exynos_init, |
| 81 | .name = name_exynos4412, |
Kukjin Kim | 94c7ca7 | 2012-02-11 22:15:45 +0900 | [diff] [blame] | 82 | }, { |
| 83 | .idcode = EXYNOS5250_SOC_ID, |
| 84 | .idmask = EXYNOS5_SOC_MASK, |
| 85 | .map_io = exynos5_map_io, |
Kukjin Kim | 94c7ca7 | 2012-02-11 22:15:45 +0900 | [diff] [blame] | 86 | .init = exynos_init, |
| 87 | .name = name_exynos5250, |
Kukjin Kim | 2edb36c | 2012-11-15 15:48:56 +0900 | [diff] [blame] | 88 | }, { |
| 89 | .idcode = EXYNOS5440_SOC_ID, |
| 90 | .idmask = EXYNOS5_SOC_MASK, |
| 91 | .map_io = exynos5440_map_io, |
| 92 | .init = exynos_init, |
| 93 | .name = name_exynos5440, |
Kukjin Kim | cc511b8 | 2011-12-27 08:18:36 +0100 | [diff] [blame] | 94 | }, |
| 95 | }; |
| 96 | |
| 97 | /* Initial IO mappings */ |
| 98 | |
Kukjin Kim | 94c7ca7 | 2012-02-11 22:15:45 +0900 | [diff] [blame] | 99 | static struct map_desc exynos4_iodesc[] __initdata = { |
| 100 | { |
Kukjin Kim | cc511b8 | 2011-12-27 08:18:36 +0100 | [diff] [blame] | 101 | .virtual = (unsigned long)S3C_VA_SYS, |
| 102 | .pfn = __phys_to_pfn(EXYNOS4_PA_SYSCON), |
| 103 | .length = SZ_64K, |
| 104 | .type = MT_DEVICE, |
| 105 | }, { |
| 106 | .virtual = (unsigned long)S3C_VA_TIMER, |
| 107 | .pfn = __phys_to_pfn(EXYNOS4_PA_TIMER), |
| 108 | .length = SZ_16K, |
| 109 | .type = MT_DEVICE, |
| 110 | }, { |
| 111 | .virtual = (unsigned long)S3C_VA_WATCHDOG, |
| 112 | .pfn = __phys_to_pfn(EXYNOS4_PA_WATCHDOG), |
| 113 | .length = SZ_4K, |
| 114 | .type = MT_DEVICE, |
| 115 | }, { |
| 116 | .virtual = (unsigned long)S5P_VA_SROMC, |
| 117 | .pfn = __phys_to_pfn(EXYNOS4_PA_SROMC), |
| 118 | .length = SZ_4K, |
| 119 | .type = MT_DEVICE, |
| 120 | }, { |
| 121 | .virtual = (unsigned long)S5P_VA_SYSTIMER, |
| 122 | .pfn = __phys_to_pfn(EXYNOS4_PA_SYSTIMER), |
| 123 | .length = SZ_4K, |
| 124 | .type = MT_DEVICE, |
| 125 | }, { |
| 126 | .virtual = (unsigned long)S5P_VA_PMU, |
| 127 | .pfn = __phys_to_pfn(EXYNOS4_PA_PMU), |
| 128 | .length = SZ_64K, |
| 129 | .type = MT_DEVICE, |
| 130 | }, { |
| 131 | .virtual = (unsigned long)S5P_VA_COMBINER_BASE, |
| 132 | .pfn = __phys_to_pfn(EXYNOS4_PA_COMBINER), |
| 133 | .length = SZ_4K, |
| 134 | .type = MT_DEVICE, |
| 135 | }, { |
| 136 | .virtual = (unsigned long)S5P_VA_GIC_CPU, |
| 137 | .pfn = __phys_to_pfn(EXYNOS4_PA_GIC_CPU), |
| 138 | .length = SZ_64K, |
| 139 | .type = MT_DEVICE, |
| 140 | }, { |
| 141 | .virtual = (unsigned long)S5P_VA_GIC_DIST, |
| 142 | .pfn = __phys_to_pfn(EXYNOS4_PA_GIC_DIST), |
| 143 | .length = SZ_64K, |
| 144 | .type = MT_DEVICE, |
| 145 | }, { |
| 146 | .virtual = (unsigned long)S3C_VA_UART, |
| 147 | .pfn = __phys_to_pfn(EXYNOS4_PA_UART), |
| 148 | .length = SZ_512K, |
| 149 | .type = MT_DEVICE, |
Kukjin Kim | 94c7ca7 | 2012-02-11 22:15:45 +0900 | [diff] [blame] | 150 | }, { |
Kukjin Kim | cc511b8 | 2011-12-27 08:18:36 +0100 | [diff] [blame] | 151 | .virtual = (unsigned long)S5P_VA_CMU, |
| 152 | .pfn = __phys_to_pfn(EXYNOS4_PA_CMU), |
| 153 | .length = SZ_128K, |
| 154 | .type = MT_DEVICE, |
| 155 | }, { |
| 156 | .virtual = (unsigned long)S5P_VA_COREPERI_BASE, |
| 157 | .pfn = __phys_to_pfn(EXYNOS4_PA_COREPERI), |
| 158 | .length = SZ_8K, |
| 159 | .type = MT_DEVICE, |
| 160 | }, { |
| 161 | .virtual = (unsigned long)S5P_VA_L2CC, |
| 162 | .pfn = __phys_to_pfn(EXYNOS4_PA_L2CC), |
| 163 | .length = SZ_4K, |
| 164 | .type = MT_DEVICE, |
| 165 | }, { |
Kukjin Kim | cc511b8 | 2011-12-27 08:18:36 +0100 | [diff] [blame] | 166 | .virtual = (unsigned long)S5P_VA_DMC0, |
| 167 | .pfn = __phys_to_pfn(EXYNOS4_PA_DMC0), |
MyungJoo Ham | 2bde0b0 | 2011-12-01 15:12:30 +0900 | [diff] [blame] | 168 | .length = SZ_64K, |
| 169 | .type = MT_DEVICE, |
| 170 | }, { |
| 171 | .virtual = (unsigned long)S5P_VA_DMC1, |
| 172 | .pfn = __phys_to_pfn(EXYNOS4_PA_DMC1), |
| 173 | .length = SZ_64K, |
Kukjin Kim | cc511b8 | 2011-12-27 08:18:36 +0100 | [diff] [blame] | 174 | .type = MT_DEVICE, |
| 175 | }, { |
Kukjin Kim | cc511b8 | 2011-12-27 08:18:36 +0100 | [diff] [blame] | 176 | .virtual = (unsigned long)S3C_VA_USB_HSPHY, |
| 177 | .pfn = __phys_to_pfn(EXYNOS4_PA_HSPHY), |
| 178 | .length = SZ_4K, |
| 179 | .type = MT_DEVICE, |
| 180 | }, |
| 181 | }; |
| 182 | |
| 183 | static struct map_desc exynos4_iodesc0[] __initdata = { |
| 184 | { |
| 185 | .virtual = (unsigned long)S5P_VA_SYSRAM, |
| 186 | .pfn = __phys_to_pfn(EXYNOS4_PA_SYSRAM0), |
| 187 | .length = SZ_4K, |
| 188 | .type = MT_DEVICE, |
| 189 | }, |
| 190 | }; |
| 191 | |
| 192 | static struct map_desc exynos4_iodesc1[] __initdata = { |
| 193 | { |
| 194 | .virtual = (unsigned long)S5P_VA_SYSRAM, |
| 195 | .pfn = __phys_to_pfn(EXYNOS4_PA_SYSRAM1), |
| 196 | .length = SZ_4K, |
| 197 | .type = MT_DEVICE, |
| 198 | }, |
| 199 | }; |
| 200 | |
Tomasz Figa | 41de898 | 2012-12-11 13:58:43 +0900 | [diff] [blame] | 201 | static struct map_desc exynos4210_iodesc[] __initdata = { |
| 202 | { |
| 203 | .virtual = (unsigned long)S5P_VA_SYSRAM_NS, |
| 204 | .pfn = __phys_to_pfn(EXYNOS4210_PA_SYSRAM_NS), |
| 205 | .length = SZ_4K, |
| 206 | .type = MT_DEVICE, |
| 207 | }, |
| 208 | }; |
| 209 | |
| 210 | static struct map_desc exynos4x12_iodesc[] __initdata = { |
| 211 | { |
| 212 | .virtual = (unsigned long)S5P_VA_SYSRAM_NS, |
| 213 | .pfn = __phys_to_pfn(EXYNOS4x12_PA_SYSRAM_NS), |
| 214 | .length = SZ_4K, |
| 215 | .type = MT_DEVICE, |
| 216 | }, |
| 217 | }; |
| 218 | |
| 219 | static struct map_desc exynos5250_iodesc[] __initdata = { |
| 220 | { |
| 221 | .virtual = (unsigned long)S5P_VA_SYSRAM_NS, |
| 222 | .pfn = __phys_to_pfn(EXYNOS5250_PA_SYSRAM_NS), |
| 223 | .length = SZ_4K, |
| 224 | .type = MT_DEVICE, |
| 225 | }, |
| 226 | }; |
| 227 | |
Kukjin Kim | 94c7ca7 | 2012-02-11 22:15:45 +0900 | [diff] [blame] | 228 | static struct map_desc exynos5_iodesc[] __initdata = { |
| 229 | { |
| 230 | .virtual = (unsigned long)S3C_VA_SYS, |
| 231 | .pfn = __phys_to_pfn(EXYNOS5_PA_SYSCON), |
| 232 | .length = SZ_64K, |
| 233 | .type = MT_DEVICE, |
| 234 | }, { |
| 235 | .virtual = (unsigned long)S3C_VA_TIMER, |
| 236 | .pfn = __phys_to_pfn(EXYNOS5_PA_TIMER), |
| 237 | .length = SZ_16K, |
| 238 | .type = MT_DEVICE, |
| 239 | }, { |
| 240 | .virtual = (unsigned long)S3C_VA_WATCHDOG, |
| 241 | .pfn = __phys_to_pfn(EXYNOS5_PA_WATCHDOG), |
| 242 | .length = SZ_4K, |
| 243 | .type = MT_DEVICE, |
| 244 | }, { |
| 245 | .virtual = (unsigned long)S5P_VA_SROMC, |
| 246 | .pfn = __phys_to_pfn(EXYNOS5_PA_SROMC), |
| 247 | .length = SZ_4K, |
| 248 | .type = MT_DEVICE, |
| 249 | }, { |
Kukjin Kim | 94c7ca7 | 2012-02-11 22:15:45 +0900 | [diff] [blame] | 250 | .virtual = (unsigned long)S5P_VA_SYSRAM, |
| 251 | .pfn = __phys_to_pfn(EXYNOS5_PA_SYSRAM), |
| 252 | .length = SZ_4K, |
| 253 | .type = MT_DEVICE, |
| 254 | }, { |
| 255 | .virtual = (unsigned long)S5P_VA_CMU, |
| 256 | .pfn = __phys_to_pfn(EXYNOS5_PA_CMU), |
| 257 | .length = 144 * SZ_1K, |
| 258 | .type = MT_DEVICE, |
| 259 | }, { |
| 260 | .virtual = (unsigned long)S5P_VA_PMU, |
| 261 | .pfn = __phys_to_pfn(EXYNOS5_PA_PMU), |
| 262 | .length = SZ_64K, |
| 263 | .type = MT_DEVICE, |
| 264 | }, { |
Kukjin Kim | 94c7ca7 | 2012-02-11 22:15:45 +0900 | [diff] [blame] | 265 | .virtual = (unsigned long)S3C_VA_UART, |
| 266 | .pfn = __phys_to_pfn(EXYNOS5_PA_UART), |
| 267 | .length = SZ_512K, |
| 268 | .type = MT_DEVICE, |
Kukjin Kim | 94c7ca7 | 2012-02-11 22:15:45 +0900 | [diff] [blame] | 269 | }, |
| 270 | }; |
| 271 | |
Kukjin Kim | 2edb36c | 2012-11-15 15:48:56 +0900 | [diff] [blame] | 272 | static struct map_desc exynos5440_iodesc0[] __initdata = { |
| 273 | { |
| 274 | .virtual = (unsigned long)S3C_VA_UART, |
| 275 | .pfn = __phys_to_pfn(EXYNOS5440_PA_UART0), |
| 276 | .length = SZ_512K, |
| 277 | .type = MT_DEVICE, |
| 278 | }, |
| 279 | }; |
| 280 | |
Russell King | 9eb4859 | 2012-01-03 11:56:53 +0100 | [diff] [blame] | 281 | void exynos4_restart(char mode, const char *cmd) |
Kukjin Kim | cc511b8 | 2011-12-27 08:18:36 +0100 | [diff] [blame] | 282 | { |
| 283 | __raw_writel(0x1, S5P_SWRESET); |
| 284 | } |
| 285 | |
Kukjin Kim | 94c7ca7 | 2012-02-11 22:15:45 +0900 | [diff] [blame] | 286 | void exynos5_restart(char mode, const char *cmd) |
| 287 | { |
Thomas Abraham | 60db7e5 | 2013-01-24 10:09:13 -0800 | [diff] [blame] | 288 | struct device_node *np; |
Kukjin Kim | 2edb36c | 2012-11-15 15:48:56 +0900 | [diff] [blame] | 289 | u32 val; |
| 290 | void __iomem *addr; |
| 291 | |
| 292 | if (of_machine_is_compatible("samsung,exynos5250")) { |
| 293 | val = 0x1; |
| 294 | addr = EXYNOS_SWRESET; |
| 295 | } else if (of_machine_is_compatible("samsung,exynos5440")) { |
Jungseok Lee | 1ba830c | 2013-05-25 06:33:03 +0900 | [diff] [blame] | 296 | u32 status; |
Thomas Abraham | 60db7e5 | 2013-01-24 10:09:13 -0800 | [diff] [blame] | 297 | np = of_find_compatible_node(NULL, NULL, "samsung,exynos5440-clock"); |
Jungseok Lee | 1ba830c | 2013-05-25 06:33:03 +0900 | [diff] [blame] | 298 | |
| 299 | addr = of_iomap(np, 0) + 0xbc; |
| 300 | status = __raw_readl(addr); |
| 301 | |
Thomas Abraham | 60db7e5 | 2013-01-24 10:09:13 -0800 | [diff] [blame] | 302 | addr = of_iomap(np, 0) + 0xcc; |
Jungseok Lee | 1ba830c | 2013-05-25 06:33:03 +0900 | [diff] [blame] | 303 | val = __raw_readl(addr); |
| 304 | |
| 305 | val = (val & 0xffff0000) | (status & 0xffff); |
Kukjin Kim | 2edb36c | 2012-11-15 15:48:56 +0900 | [diff] [blame] | 306 | } else { |
| 307 | pr_err("%s: cannot support non-DT\n", __func__); |
| 308 | return; |
| 309 | } |
| 310 | |
| 311 | __raw_writel(val, addr); |
Kukjin Kim | 94c7ca7 | 2012-02-11 22:15:45 +0900 | [diff] [blame] | 312 | } |
| 313 | |
Shawn Guo | bb13fab | 2012-04-26 10:35:40 +0800 | [diff] [blame] | 314 | void __init exynos_init_late(void) |
| 315 | { |
Kukjin Kim | 2edb36c | 2012-11-15 15:48:56 +0900 | [diff] [blame] | 316 | if (of_machine_is_compatible("samsung,exynos5440")) |
| 317 | /* to be supported later */ |
| 318 | return; |
| 319 | |
Shawn Guo | bb13fab | 2012-04-26 10:35:40 +0800 | [diff] [blame] | 320 | exynos_pm_late_initcall(); |
| 321 | } |
| 322 | |
Arnd Bergmann | 564d06b | 2013-06-19 01:36:56 +0900 | [diff] [blame^] | 323 | static int __init exynos_fdt_map_chipid(unsigned long node, const char *uname, |
Thomas Abraham | f5f83c7 | 2013-04-23 22:46:53 +0900 | [diff] [blame] | 324 | int depth, void *data) |
| 325 | { |
| 326 | struct map_desc iodesc; |
| 327 | __be32 *reg; |
| 328 | unsigned long len; |
| 329 | |
| 330 | if (!of_flat_dt_is_compatible(node, "samsung,exynos4210-chipid") && |
| 331 | !of_flat_dt_is_compatible(node, "samsung,exynos5440-clock")) |
| 332 | return 0; |
| 333 | |
| 334 | reg = of_get_flat_dt_prop(node, "reg", &len); |
| 335 | if (reg == NULL || len != (sizeof(unsigned long) * 2)) |
| 336 | return 0; |
| 337 | |
| 338 | iodesc.pfn = __phys_to_pfn(be32_to_cpu(reg[0])); |
| 339 | iodesc.length = be32_to_cpu(reg[1]) - 1; |
| 340 | iodesc.virtual = (unsigned long)S5P_VA_CHIPID; |
| 341 | iodesc.type = MT_DEVICE; |
| 342 | iotable_init(&iodesc, 1); |
| 343 | return 1; |
| 344 | } |
Thomas Abraham | f5f83c7 | 2013-04-23 22:46:53 +0900 | [diff] [blame] | 345 | |
Kukjin Kim | cc511b8 | 2011-12-27 08:18:36 +0100 | [diff] [blame] | 346 | /* |
| 347 | * exynos_map_io |
| 348 | * |
| 349 | * register the standard cpu IO areas |
| 350 | */ |
| 351 | |
Arnd Bergmann | 0e2238e | 2013-06-19 01:36:47 +0900 | [diff] [blame] | 352 | void __init exynos_init_io(void) |
Kukjin Kim | cc511b8 | 2011-12-27 08:18:36 +0100 | [diff] [blame] | 353 | { |
Doug Anderson | 9c1fcdc | 2013-06-05 13:56:33 -0700 | [diff] [blame] | 354 | debug_ll_io_init(); |
| 355 | |
Tomasz Figa | 04fae59 | 2013-06-15 09:13:25 +0900 | [diff] [blame] | 356 | of_scan_flat_dt(exynos_fdt_map_chipid, NULL); |
Kukjin Kim | 2edb36c | 2012-11-15 15:48:56 +0900 | [diff] [blame] | 357 | |
Kukjin Kim | cc511b8 | 2011-12-27 08:18:36 +0100 | [diff] [blame] | 358 | /* detect cpu id and rev. */ |
| 359 | s5p_init_cpu(S5P_VA_CHIPID); |
| 360 | |
| 361 | s3c_init_cpu(samsung_cpu_id, cpu_ids, ARRAY_SIZE(cpu_ids)); |
| 362 | } |
| 363 | |
Kukjin Kim | 906c789 | 2012-02-11 21:27:08 +0900 | [diff] [blame] | 364 | static void __init exynos4_map_io(void) |
Kukjin Kim | cc511b8 | 2011-12-27 08:18:36 +0100 | [diff] [blame] | 365 | { |
| 366 | iotable_init(exynos4_iodesc, ARRAY_SIZE(exynos4_iodesc)); |
| 367 | |
| 368 | if (soc_is_exynos4210() && samsung_rev() == EXYNOS4210_REV_0) |
| 369 | iotable_init(exynos4_iodesc0, ARRAY_SIZE(exynos4_iodesc0)); |
| 370 | else |
| 371 | iotable_init(exynos4_iodesc1, ARRAY_SIZE(exynos4_iodesc1)); |
| 372 | |
Tomasz Figa | 41de898 | 2012-12-11 13:58:43 +0900 | [diff] [blame] | 373 | if (soc_is_exynos4210()) |
| 374 | iotable_init(exynos4210_iodesc, ARRAY_SIZE(exynos4210_iodesc)); |
| 375 | if (soc_is_exynos4212() || soc_is_exynos4412()) |
| 376 | iotable_init(exynos4x12_iodesc, ARRAY_SIZE(exynos4x12_iodesc)); |
Kukjin Kim | cc511b8 | 2011-12-27 08:18:36 +0100 | [diff] [blame] | 377 | } |
| 378 | |
Kukjin Kim | 94c7ca7 | 2012-02-11 22:15:45 +0900 | [diff] [blame] | 379 | static void __init exynos5_map_io(void) |
| 380 | { |
| 381 | iotable_init(exynos5_iodesc, ARRAY_SIZE(exynos5_iodesc)); |
Tomasz Figa | 41de898 | 2012-12-11 13:58:43 +0900 | [diff] [blame] | 382 | |
| 383 | if (soc_is_exynos5250()) |
| 384 | iotable_init(exynos5250_iodesc, ARRAY_SIZE(exynos5250_iodesc)); |
Kukjin Kim | 94c7ca7 | 2012-02-11 22:15:45 +0900 | [diff] [blame] | 385 | } |
| 386 | |
Kukjin Kim | 2edb36c | 2012-11-15 15:48:56 +0900 | [diff] [blame] | 387 | static void __init exynos5440_map_io(void) |
| 388 | { |
| 389 | iotable_init(exynos5440_iodesc0, ARRAY_SIZE(exynos5440_iodesc0)); |
| 390 | } |
| 391 | |
Thomas Abraham | 6923ae4 | 2013-03-09 17:03:29 +0900 | [diff] [blame] | 392 | void __init exynos_init_time(void) |
Kukjin Kim | 94c7ca7 | 2012-02-11 22:15:45 +0900 | [diff] [blame] | 393 | { |
Tomasz Figa | 3c70348 | 2013-06-15 09:04:58 +0900 | [diff] [blame] | 394 | of_clk_init(NULL); |
| 395 | clocksource_of_init(); |
Kukjin Kim | 94c7ca7 | 2012-02-11 22:15:45 +0900 | [diff] [blame] | 396 | } |
| 397 | |
Thomas Abraham | 9ee6af9 | 2012-05-15 15:47:40 +0900 | [diff] [blame] | 398 | struct bus_type exynos_subsys = { |
| 399 | .name = "exynos-core", |
| 400 | .dev_name = "exynos-core", |
Kukjin Kim | 94c7ca7 | 2012-02-11 22:15:45 +0900 | [diff] [blame] | 401 | }; |
| 402 | |
Linus Torvalds | 7affca3 | 2012-01-07 12:03:30 -0800 | [diff] [blame] | 403 | static struct device exynos4_dev = { |
Thomas Abraham | 9ee6af9 | 2012-05-15 15:47:40 +0900 | [diff] [blame] | 404 | .bus = &exynos_subsys, |
Kukjin Kim | 94c7ca7 | 2012-02-11 22:15:45 +0900 | [diff] [blame] | 405 | }; |
| 406 | |
| 407 | static int __init exynos_core_init(void) |
Kukjin Kim | cc511b8 | 2011-12-27 08:18:36 +0100 | [diff] [blame] | 408 | { |
Thomas Abraham | 9ee6af9 | 2012-05-15 15:47:40 +0900 | [diff] [blame] | 409 | return subsys_system_register(&exynos_subsys, NULL); |
Kukjin Kim | cc511b8 | 2011-12-27 08:18:36 +0100 | [diff] [blame] | 410 | } |
Kukjin Kim | 94c7ca7 | 2012-02-11 22:15:45 +0900 | [diff] [blame] | 411 | core_initcall(exynos_core_init); |
Kukjin Kim | cc511b8 | 2011-12-27 08:18:36 +0100 | [diff] [blame] | 412 | |
Kukjin Kim | cc511b8 | 2011-12-27 08:18:36 +0100 | [diff] [blame] | 413 | static int __init exynos4_l2x0_cache_init(void) |
| 414 | { |
Il Han | e1b1994 | 2012-04-05 07:59:36 -0700 | [diff] [blame] | 415 | int ret; |
| 416 | |
Amit Daniel Kachhap | 6cdeddc | 2012-03-08 02:09:12 -0800 | [diff] [blame] | 417 | ret = l2x0_of_init(L2_AUX_VAL, L2_AUX_MASK); |
Arnd Bergmann | 87107d8 | 2013-06-19 01:36:52 +0900 | [diff] [blame] | 418 | if (ret) |
| 419 | return ret; |
Kukjin Kim | cc511b8 | 2011-12-27 08:18:36 +0100 | [diff] [blame] | 420 | |
Arnd Bergmann | 87107d8 | 2013-06-19 01:36:52 +0900 | [diff] [blame] | 421 | l2x0_regs_phys = virt_to_phys(&l2x0_saved_regs); |
| 422 | clean_dcache_area(&l2x0_regs_phys, sizeof(unsigned long)); |
Kukjin Kim | cc511b8 | 2011-12-27 08:18:36 +0100 | [diff] [blame] | 423 | return 0; |
| 424 | } |
Kukjin Kim | cc511b8 | 2011-12-27 08:18:36 +0100 | [diff] [blame] | 425 | early_initcall(exynos4_l2x0_cache_init); |
Kukjin Kim | cc511b8 | 2011-12-27 08:18:36 +0100 | [diff] [blame] | 426 | |
Kukjin Kim | 906c789 | 2012-02-11 21:27:08 +0900 | [diff] [blame] | 427 | static int __init exynos_init(void) |
Kukjin Kim | cc511b8 | 2011-12-27 08:18:36 +0100 | [diff] [blame] | 428 | { |
| 429 | printk(KERN_INFO "EXYNOS: Initializing architecture\n"); |
Kukjin Kim | 94c7ca7 | 2012-02-11 22:15:45 +0900 | [diff] [blame] | 430 | |
Thomas Abraham | 9ee6af9 | 2012-05-15 15:47:40 +0900 | [diff] [blame] | 431 | return device_register(&exynos4_dev); |
Kukjin Kim | cc511b8 | 2011-12-27 08:18:36 +0100 | [diff] [blame] | 432 | } |