Colin Tuckley | 1b504bb | 2009-05-30 13:56:12 +0100 | [diff] [blame] | 1 | /* |
| 2 | * arch/arm/mach-realview/realview_pbx.c |
| 3 | * |
| 4 | * Copyright (C) 2009 ARM Limited |
| 5 | * Copyright (C) 2000 Deep Blue Solutions Ltd |
| 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 | * This program is distributed in the hope that it will be useful, |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | * GNU General Public License for more details. |
| 15 | * |
| 16 | * You should have received a copy of the GNU General Public License |
| 17 | * along with this program; if not, write to the Free Software |
| 18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 19 | */ |
| 20 | |
| 21 | #include <linux/init.h> |
| 22 | #include <linux/platform_device.h> |
Kay Sievers | edbaa60 | 2011-12-21 16:26:03 -0800 | [diff] [blame] | 23 | #include <linux/device.h> |
Colin Tuckley | 1b504bb | 2009-05-30 13:56:12 +0100 | [diff] [blame] | 24 | #include <linux/amba/bus.h> |
Russell King | eb7fffa | 2009-07-05 22:41:31 +0100 | [diff] [blame] | 25 | #include <linux/amba/pl061.h> |
Linus Walleij | 6ef297f | 2009-09-22 14:29:36 +0100 | [diff] [blame] | 26 | #include <linux/amba/mmci.h> |
Linus Walleij | d6ada86 | 2010-07-14 23:58:38 +0100 | [diff] [blame] | 27 | #include <linux/amba/pl022.h> |
Colin Tuckley | 1b504bb | 2009-05-30 13:56:12 +0100 | [diff] [blame] | 28 | #include <linux/io.h> |
Rob Herring | 520f7bd | 2012-12-27 13:10:24 -0600 | [diff] [blame] | 29 | #include <linux/irqchip/arm-gic.h> |
Linus Walleij | f9a6aa4 | 2012-08-06 18:32:08 +0200 | [diff] [blame] | 30 | #include <linux/platform_data/clk-realview.h> |
Robin Holt | 7b6d864 | 2013-07-08 16:01:40 -0700 | [diff] [blame] | 31 | #include <linux/reboot.h> |
Laura Abbott | 1c2f87c | 2014-04-13 22:54:58 +0100 | [diff] [blame] | 32 | #include <linux/memblock.h> |
Colin Tuckley | 1b504bb | 2009-05-30 13:56:12 +0100 | [diff] [blame] | 33 | |
| 34 | #include <asm/irq.h> |
Colin Tuckley | 1b504bb | 2009-05-30 13:56:12 +0100 | [diff] [blame] | 35 | #include <asm/mach-types.h> |
Catalin Marinas | c3c2174 | 2009-06-19 11:28:48 +0100 | [diff] [blame] | 36 | #include <asm/smp_twd.h> |
Catalin Marinas | cc9897d | 2010-06-21 15:12:40 +0100 | [diff] [blame] | 37 | #include <asm/pgtable.h> |
Colin Tuckley | 1b504bb | 2009-05-30 13:56:12 +0100 | [diff] [blame] | 38 | #include <asm/hardware/cache-l2x0.h> |
| 39 | |
| 40 | #include <asm/mach/arch.h> |
| 41 | #include <asm/mach/map.h> |
Colin Tuckley | 1b504bb | 2009-05-30 13:56:12 +0100 | [diff] [blame] | 42 | #include <asm/mach/time.h> |
| 43 | |
Arnd Bergmann | 6d407a6 | 2015-11-25 17:32:22 +0100 | [diff] [blame] | 44 | #include "hardware.h" |
| 45 | #include "board-pbx.h" |
Arnd Bergmann | 38d2cfc | 2015-11-25 17:32:23 +0100 | [diff] [blame] | 46 | #include "irqs-pbx.h" |
Colin Tuckley | 1b504bb | 2009-05-30 13:56:12 +0100 | [diff] [blame] | 47 | |
| 48 | #include "core.h" |
| 49 | |
| 50 | static struct map_desc realview_pbx_io_desc[] __initdata = { |
| 51 | { |
| 52 | .virtual = IO_ADDRESS(REALVIEW_SYS_BASE), |
| 53 | .pfn = __phys_to_pfn(REALVIEW_SYS_BASE), |
| 54 | .length = SZ_4K, |
| 55 | .type = MT_DEVICE, |
| 56 | }, { |
| 57 | .virtual = IO_ADDRESS(REALVIEW_PBX_GIC_CPU_BASE), |
| 58 | .pfn = __phys_to_pfn(REALVIEW_PBX_GIC_CPU_BASE), |
| 59 | .length = SZ_4K, |
| 60 | .type = MT_DEVICE, |
| 61 | }, { |
| 62 | .virtual = IO_ADDRESS(REALVIEW_PBX_GIC_DIST_BASE), |
| 63 | .pfn = __phys_to_pfn(REALVIEW_PBX_GIC_DIST_BASE), |
| 64 | .length = SZ_4K, |
| 65 | .type = MT_DEVICE, |
| 66 | }, { |
| 67 | .virtual = IO_ADDRESS(REALVIEW_SCTL_BASE), |
| 68 | .pfn = __phys_to_pfn(REALVIEW_SCTL_BASE), |
| 69 | .length = SZ_4K, |
| 70 | .type = MT_DEVICE, |
| 71 | }, { |
| 72 | .virtual = IO_ADDRESS(REALVIEW_PBX_TIMER0_1_BASE), |
| 73 | .pfn = __phys_to_pfn(REALVIEW_PBX_TIMER0_1_BASE), |
| 74 | .length = SZ_4K, |
| 75 | .type = MT_DEVICE, |
| 76 | }, { |
| 77 | .virtual = IO_ADDRESS(REALVIEW_PBX_TIMER2_3_BASE), |
| 78 | .pfn = __phys_to_pfn(REALVIEW_PBX_TIMER2_3_BASE), |
| 79 | .length = SZ_4K, |
| 80 | .type = MT_DEVICE, |
| 81 | }, |
Colin Tuckley | 1b504bb | 2009-05-30 13:56:12 +0100 | [diff] [blame] | 82 | #ifdef CONFIG_DEBUG_LL |
| 83 | { |
| 84 | .virtual = IO_ADDRESS(REALVIEW_PBX_UART0_BASE), |
| 85 | .pfn = __phys_to_pfn(REALVIEW_PBX_UART0_BASE), |
| 86 | .length = SZ_4K, |
| 87 | .type = MT_DEVICE, |
| 88 | }, |
| 89 | #endif |
| 90 | }; |
| 91 | |
| 92 | static struct map_desc realview_local_io_desc[] __initdata = { |
| 93 | { |
Rob Herring | 9ceceb6 | 2011-09-29 16:22:02 -0500 | [diff] [blame] | 94 | .virtual = IO_ADDRESS(REALVIEW_PBX_TILE_SCU_BASE), |
| 95 | .pfn = __phys_to_pfn(REALVIEW_PBX_TILE_SCU_BASE), |
Colin Tuckley | 1b504bb | 2009-05-30 13:56:12 +0100 | [diff] [blame] | 96 | .length = SZ_4K, |
| 97 | .type = MT_DEVICE, |
| 98 | }, { |
| 99 | .virtual = IO_ADDRESS(REALVIEW_PBX_TILE_GIC_DIST_BASE), |
| 100 | .pfn = __phys_to_pfn(REALVIEW_PBX_TILE_GIC_DIST_BASE), |
| 101 | .length = SZ_4K, |
| 102 | .type = MT_DEVICE, |
| 103 | }, { |
| 104 | .virtual = IO_ADDRESS(REALVIEW_PBX_TILE_L220_BASE), |
| 105 | .pfn = __phys_to_pfn(REALVIEW_PBX_TILE_L220_BASE), |
| 106 | .length = SZ_8K, |
| 107 | .type = MT_DEVICE, |
| 108 | } |
| 109 | }; |
| 110 | |
| 111 | static void __init realview_pbx_map_io(void) |
| 112 | { |
| 113 | iotable_init(realview_pbx_io_desc, ARRAY_SIZE(realview_pbx_io_desc)); |
| 114 | if (core_tile_pbx11mp() || core_tile_pbxa9mp()) |
| 115 | iotable_init(realview_local_io_desc, ARRAY_SIZE(realview_local_io_desc)); |
| 116 | } |
| 117 | |
Russell King | eb7fffa | 2009-07-05 22:41:31 +0100 | [diff] [blame] | 118 | static struct pl061_platform_data gpio0_plat_data = { |
| 119 | .gpio_base = 0, |
Russell King | eb7fffa | 2009-07-05 22:41:31 +0100 | [diff] [blame] | 120 | }; |
| 121 | |
| 122 | static struct pl061_platform_data gpio1_plat_data = { |
| 123 | .gpio_base = 8, |
Russell King | eb7fffa | 2009-07-05 22:41:31 +0100 | [diff] [blame] | 124 | }; |
| 125 | |
| 126 | static struct pl061_platform_data gpio2_plat_data = { |
| 127 | .gpio_base = 16, |
Russell King | eb7fffa | 2009-07-05 22:41:31 +0100 | [diff] [blame] | 128 | }; |
| 129 | |
Linus Walleij | d6ada86 | 2010-07-14 23:58:38 +0100 | [diff] [blame] | 130 | static struct pl022_ssp_controller ssp0_plat_data = { |
| 131 | .bus_id = 0, |
| 132 | .enable_dma = 0, |
| 133 | .num_chipselect = 1, |
| 134 | }; |
| 135 | |
Colin Tuckley | 1b504bb | 2009-05-30 13:56:12 +0100 | [diff] [blame] | 136 | /* |
| 137 | * RealView PBXCore AMBA devices |
| 138 | */ |
| 139 | |
Russell King | 0dada61 | 2011-12-18 11:40:46 +0000 | [diff] [blame] | 140 | #define GPIO2_IRQ { IRQ_PBX_GPIO2 } |
| 141 | #define GPIO3_IRQ { IRQ_PBX_GPIO3 } |
| 142 | #define AACI_IRQ { IRQ_PBX_AACI } |
Colin Tuckley | 1b504bb | 2009-05-30 13:56:12 +0100 | [diff] [blame] | 143 | #define MMCI0_IRQ { IRQ_PBX_MMCI0A, IRQ_PBX_MMCI0B } |
Russell King | 0dada61 | 2011-12-18 11:40:46 +0000 | [diff] [blame] | 144 | #define KMI0_IRQ { IRQ_PBX_KMI0 } |
| 145 | #define KMI1_IRQ { IRQ_PBX_KMI1 } |
| 146 | #define PBX_SMC_IRQ { } |
| 147 | #define MPMC_IRQ { } |
| 148 | #define PBX_CLCD_IRQ { IRQ_PBX_CLCD } |
| 149 | #define DMAC_IRQ { IRQ_PBX_DMAC } |
| 150 | #define SCTL_IRQ { } |
| 151 | #define PBX_WATCHDOG_IRQ { IRQ_PBX_WATCHDOG } |
| 152 | #define PBX_GPIO0_IRQ { IRQ_PBX_GPIO0 } |
| 153 | #define GPIO1_IRQ { IRQ_PBX_GPIO1 } |
| 154 | #define PBX_RTC_IRQ { IRQ_PBX_RTC } |
| 155 | #define SCI_IRQ { IRQ_PBX_SCI } |
| 156 | #define PBX_UART0_IRQ { IRQ_PBX_UART0 } |
| 157 | #define PBX_UART1_IRQ { IRQ_PBX_UART1 } |
| 158 | #define PBX_UART2_IRQ { IRQ_PBX_UART2 } |
| 159 | #define PBX_UART3_IRQ { IRQ_PBX_UART3 } |
| 160 | #define PBX_SSP_IRQ { IRQ_PBX_SSP } |
Colin Tuckley | 1b504bb | 2009-05-30 13:56:12 +0100 | [diff] [blame] | 161 | |
| 162 | /* FPGA Primecells */ |
Russell King | 9199340b | 2011-12-18 13:38:49 +0000 | [diff] [blame] | 163 | APB_DEVICE(aaci, "fpga:aaci", AACI, NULL); |
| 164 | APB_DEVICE(mmc0, "fpga:mmc0", MMCI0, &realview_mmc0_plat_data); |
| 165 | APB_DEVICE(kmi0, "fpga:kmi0", KMI0, NULL); |
| 166 | APB_DEVICE(kmi1, "fpga:kmi1", KMI1, NULL); |
| 167 | APB_DEVICE(uart3, "fpga:uart3", PBX_UART3, NULL); |
Colin Tuckley | 1b504bb | 2009-05-30 13:56:12 +0100 | [diff] [blame] | 168 | |
| 169 | /* DevChip Primecells */ |
Russell King | 9199340b | 2011-12-18 13:38:49 +0000 | [diff] [blame] | 170 | AHB_DEVICE(smc, "dev:smc", PBX_SMC, NULL); |
| 171 | AHB_DEVICE(sctl, "dev:sctl", SCTL, NULL); |
| 172 | APB_DEVICE(wdog, "dev:wdog", PBX_WATCHDOG, NULL); |
| 173 | APB_DEVICE(gpio0, "dev:gpio0", PBX_GPIO0, &gpio0_plat_data); |
| 174 | APB_DEVICE(gpio1, "dev:gpio1", GPIO1, &gpio1_plat_data); |
| 175 | APB_DEVICE(gpio2, "dev:gpio2", GPIO2, &gpio2_plat_data); |
| 176 | APB_DEVICE(rtc, "dev:rtc", PBX_RTC, NULL); |
| 177 | APB_DEVICE(sci0, "dev:sci0", SCI, NULL); |
| 178 | APB_DEVICE(uart0, "dev:uart0", PBX_UART0, NULL); |
| 179 | APB_DEVICE(uart1, "dev:uart1", PBX_UART1, NULL); |
| 180 | APB_DEVICE(uart2, "dev:uart2", PBX_UART2, NULL); |
| 181 | APB_DEVICE(ssp0, "dev:ssp0", PBX_SSP, &ssp0_plat_data); |
Colin Tuckley | 1b504bb | 2009-05-30 13:56:12 +0100 | [diff] [blame] | 182 | |
| 183 | /* Primecells on the NEC ISSP chip */ |
Russell King | 9199340b | 2011-12-18 13:38:49 +0000 | [diff] [blame] | 184 | AHB_DEVICE(clcd, "issp:clcd", PBX_CLCD, &clcd_plat_data); |
| 185 | AHB_DEVICE(dmac, "issp:dmac", DMAC, NULL); |
Colin Tuckley | 1b504bb | 2009-05-30 13:56:12 +0100 | [diff] [blame] | 186 | |
| 187 | static struct amba_device *amba_devs[] __initdata = { |
| 188 | &dmac_device, |
| 189 | &uart0_device, |
| 190 | &uart1_device, |
| 191 | &uart2_device, |
| 192 | &uart3_device, |
| 193 | &smc_device, |
| 194 | &clcd_device, |
| 195 | &sctl_device, |
| 196 | &wdog_device, |
| 197 | &gpio0_device, |
| 198 | &gpio1_device, |
| 199 | &gpio2_device, |
| 200 | &rtc_device, |
| 201 | &sci0_device, |
| 202 | &ssp0_device, |
| 203 | &aaci_device, |
| 204 | &mmc0_device, |
| 205 | &kmi0_device, |
| 206 | &kmi1_device, |
| 207 | }; |
| 208 | |
| 209 | /* |
| 210 | * RealView PB-X platform devices |
| 211 | */ |
| 212 | static struct resource realview_pbx_flash_resources[] = { |
| 213 | [0] = { |
| 214 | .start = REALVIEW_PBX_FLASH0_BASE, |
| 215 | .end = REALVIEW_PBX_FLASH0_BASE + REALVIEW_PBX_FLASH0_SIZE - 1, |
| 216 | .flags = IORESOURCE_MEM, |
| 217 | }, |
| 218 | [1] = { |
| 219 | .start = REALVIEW_PBX_FLASH1_BASE, |
| 220 | .end = REALVIEW_PBX_FLASH1_BASE + REALVIEW_PBX_FLASH1_SIZE - 1, |
| 221 | .flags = IORESOURCE_MEM, |
| 222 | }, |
| 223 | }; |
| 224 | |
| 225 | static struct resource realview_pbx_smsc911x_resources[] = { |
| 226 | [0] = { |
| 227 | .start = REALVIEW_PBX_ETH_BASE, |
| 228 | .end = REALVIEW_PBX_ETH_BASE + SZ_64K - 1, |
| 229 | .flags = IORESOURCE_MEM, |
| 230 | }, |
| 231 | [1] = { |
| 232 | .start = IRQ_PBX_ETH, |
| 233 | .end = IRQ_PBX_ETH, |
| 234 | .flags = IORESOURCE_IRQ, |
| 235 | }, |
| 236 | }; |
| 237 | |
| 238 | static struct resource realview_pbx_isp1761_resources[] = { |
| 239 | [0] = { |
| 240 | .start = REALVIEW_PBX_USB_BASE, |
| 241 | .end = REALVIEW_PBX_USB_BASE + SZ_128K - 1, |
| 242 | .flags = IORESOURCE_MEM, |
| 243 | }, |
| 244 | [1] = { |
| 245 | .start = IRQ_PBX_USB, |
| 246 | .end = IRQ_PBX_USB, |
| 247 | .flags = IORESOURCE_IRQ, |
| 248 | }, |
| 249 | }; |
| 250 | |
Arnd Bergmann | 7fbbe38 | 2016-02-23 14:35:58 +0100 | [diff] [blame] | 251 | #ifdef CONFIG_CACHE_L2X0 |
Will Deacon | f417cba | 2010-04-15 10:16:26 +0100 | [diff] [blame] | 252 | static struct resource pmu_resources[] = { |
| 253 | [0] = { |
| 254 | .start = IRQ_PBX_PMU_CPU0, |
| 255 | .end = IRQ_PBX_PMU_CPU0, |
| 256 | .flags = IORESOURCE_IRQ, |
| 257 | }, |
| 258 | [1] = { |
| 259 | .start = IRQ_PBX_PMU_CPU1, |
| 260 | .end = IRQ_PBX_PMU_CPU1, |
| 261 | .flags = IORESOURCE_IRQ, |
| 262 | }, |
| 263 | [2] = { |
| 264 | .start = IRQ_PBX_PMU_CPU2, |
| 265 | .end = IRQ_PBX_PMU_CPU2, |
| 266 | .flags = IORESOURCE_IRQ, |
| 267 | }, |
| 268 | [3] = { |
| 269 | .start = IRQ_PBX_PMU_CPU3, |
| 270 | .end = IRQ_PBX_PMU_CPU3, |
| 271 | .flags = IORESOURCE_IRQ, |
| 272 | }, |
| 273 | }; |
| 274 | |
| 275 | static struct platform_device pmu_device = { |
Mark Rutland | cbed838 | 2014-05-23 12:12:04 +0100 | [diff] [blame] | 276 | .name = "armv7-pmu", |
Sudeep KarkadaNagesha | df3d17e | 2012-07-19 09:50:21 +0100 | [diff] [blame] | 277 | .id = -1, |
Will Deacon | f417cba | 2010-04-15 10:16:26 +0100 | [diff] [blame] | 278 | .num_resources = ARRAY_SIZE(pmu_resources), |
| 279 | .resource = pmu_resources, |
| 280 | }; |
Arnd Bergmann | 7fbbe38 | 2016-02-23 14:35:58 +0100 | [diff] [blame] | 281 | #endif |
Will Deacon | f417cba | 2010-04-15 10:16:26 +0100 | [diff] [blame] | 282 | |
Colin Tuckley | 1b504bb | 2009-05-30 13:56:12 +0100 | [diff] [blame] | 283 | static void __init gic_init_irq(void) |
| 284 | { |
| 285 | /* ARM PBX on-board GIC */ |
| 286 | if (core_tile_pbx11mp() || core_tile_pbxa9mp()) { |
Russell King | b580b89 | 2010-12-04 15:55:14 +0000 | [diff] [blame] | 287 | gic_init(0, 29, __io_address(REALVIEW_PBX_TILE_GIC_DIST_BASE), |
| 288 | __io_address(REALVIEW_PBX_TILE_GIC_CPU_BASE)); |
Colin Tuckley | 1b504bb | 2009-05-30 13:56:12 +0100 | [diff] [blame] | 289 | } else { |
Russell King | b580b89 | 2010-12-04 15:55:14 +0000 | [diff] [blame] | 290 | gic_init(0, IRQ_PBX_GIC_START, |
| 291 | __io_address(REALVIEW_PBX_GIC_DIST_BASE), |
| 292 | __io_address(REALVIEW_PBX_GIC_CPU_BASE)); |
Colin Tuckley | 1b504bb | 2009-05-30 13:56:12 +0100 | [diff] [blame] | 293 | } |
| 294 | } |
| 295 | |
Marc Zyngier | 7c380f2 | 2011-08-04 11:57:04 +0100 | [diff] [blame] | 296 | #ifdef CONFIG_HAVE_ARM_TWD |
| 297 | static DEFINE_TWD_LOCAL_TIMER(twd_local_timer, |
| 298 | REALVIEW_PBX_TILE_TWD_BASE, |
| 299 | IRQ_LOCALTIMER); |
| 300 | |
| 301 | static void __init realview_pbx_twd_init(void) |
| 302 | { |
| 303 | int err = twd_local_timer_register(&twd_local_timer); |
| 304 | if (err) |
| 305 | pr_err("twd_local_timer_register failed %d\n", err); |
| 306 | } |
| 307 | #else |
| 308 | #define realview_pbx_twd_init() do { } while(0) |
| 309 | #endif |
| 310 | |
Colin Tuckley | 1b504bb | 2009-05-30 13:56:12 +0100 | [diff] [blame] | 311 | static void __init realview_pbx_timer_init(void) |
| 312 | { |
| 313 | timer0_va_base = __io_address(REALVIEW_PBX_TIMER0_1_BASE); |
| 314 | timer1_va_base = __io_address(REALVIEW_PBX_TIMER0_1_BASE) + 0x20; |
| 315 | timer2_va_base = __io_address(REALVIEW_PBX_TIMER2_3_BASE); |
| 316 | timer3_va_base = __io_address(REALVIEW_PBX_TIMER2_3_BASE) + 0x20; |
| 317 | |
Linus Walleij | f9a6aa4 | 2012-08-06 18:32:08 +0200 | [diff] [blame] | 318 | realview_clk_init(__io_address(REALVIEW_SYS_BASE), false); |
Colin Tuckley | 1b504bb | 2009-05-30 13:56:12 +0100 | [diff] [blame] | 319 | realview_timer_init(IRQ_PBX_TIMER0_1); |
Marc Zyngier | 7c380f2 | 2011-08-04 11:57:04 +0100 | [diff] [blame] | 320 | realview_pbx_twd_init(); |
Colin Tuckley | 1b504bb | 2009-05-30 13:56:12 +0100 | [diff] [blame] | 321 | } |
| 322 | |
Laura Abbott | 1c2f87c | 2014-04-13 22:54:58 +0100 | [diff] [blame] | 323 | static void realview_pbx_fixup(struct tag *tags, char **from) |
Catalin Marinas | c97c5aa | 2009-11-04 12:19:05 +0000 | [diff] [blame] | 324 | { |
| 325 | #ifdef CONFIG_SPARSEMEM |
| 326 | /* |
| 327 | * Memory configuration with SPARSEMEM enabled on RealView PBX (see |
| 328 | * asm/mach/memory.h for more information). |
| 329 | */ |
Laura Abbott | 1c2f87c | 2014-04-13 22:54:58 +0100 | [diff] [blame] | 330 | |
| 331 | memblock_add(0, SZ_256M); |
| 332 | memblock_add(0x20000000, SZ_512M); |
| 333 | memblock_add(0x80000000, SZ_256M); |
Catalin Marinas | c97c5aa | 2009-11-04 12:19:05 +0000 | [diff] [blame] | 334 | #else |
Laura Abbott | 1c2f87c | 2014-04-13 22:54:58 +0100 | [diff] [blame] | 335 | realview_fixup(tags, from); |
Catalin Marinas | c97c5aa | 2009-11-04 12:19:05 +0000 | [diff] [blame] | 336 | #endif |
| 337 | } |
| 338 | |
Robin Holt | 7b6d864 | 2013-07-08 16:01:40 -0700 | [diff] [blame] | 339 | static void realview_pbx_restart(enum reboot_mode mode, const char *cmd) |
Colin Tuckley | 4c9f8be | 2010-01-11 11:09:15 +0100 | [diff] [blame] | 340 | { |
| 341 | void __iomem *reset_ctrl = __io_address(REALVIEW_SYS_RESETCTL); |
| 342 | void __iomem *lock_ctrl = __io_address(REALVIEW_SYS_LOCK); |
| 343 | |
| 344 | /* |
| 345 | * To reset, we hit the on-board reset register |
| 346 | * in the system FPGA |
| 347 | */ |
| 348 | __raw_writel(REALVIEW_SYS_LOCK_VAL, lock_ctrl); |
Colin Tuckley | df2e615 | 2010-01-29 12:52:55 +0100 | [diff] [blame] | 349 | __raw_writel(0x00F0, reset_ctrl); |
| 350 | __raw_writel(0x00F4, reset_ctrl); |
Russell King | 47cacdd4 | 2011-11-03 14:00:13 +0000 | [diff] [blame] | 351 | dsb(); |
Colin Tuckley | 4c9f8be | 2010-01-11 11:09:15 +0100 | [diff] [blame] | 352 | } |
| 353 | |
Colin Tuckley | 1b504bb | 2009-05-30 13:56:12 +0100 | [diff] [blame] | 354 | static void __init realview_pbx_init(void) |
| 355 | { |
| 356 | int i; |
| 357 | |
| 358 | #ifdef CONFIG_CACHE_L2X0 |
| 359 | if (core_tile_pbxa9mp()) { |
| 360 | void __iomem *l2x0_base = |
| 361 | __io_address(REALVIEW_PBX_TILE_L220_BASE); |
| 362 | |
| 363 | /* set RAM latencies to 1 cycle for eASIC */ |
Russell King | 1a5a954 | 2014-03-16 20:52:25 +0000 | [diff] [blame] | 364 | writel(0, l2x0_base + L310_TAG_LATENCY_CTRL); |
| 365 | writel(0, l2x0_base + L310_DATA_LATENCY_CTRL); |
Colin Tuckley | 1b504bb | 2009-05-30 13:56:12 +0100 | [diff] [blame] | 366 | |
| 367 | /* 16KB way size, 8-way associativity, parity disabled |
| 368 | * Bits: .. 0 0 0 0 1 00 1 0 1 001 0 000 0 .... .... .... */ |
| 369 | l2x0_init(l2x0_base, 0x02520000, 0xc0000fff); |
Will Deacon | f417cba | 2010-04-15 10:16:26 +0100 | [diff] [blame] | 370 | platform_device_register(&pmu_device); |
Colin Tuckley | 1b504bb | 2009-05-30 13:56:12 +0100 | [diff] [blame] | 371 | } |
| 372 | #endif |
| 373 | |
| 374 | realview_flash_register(realview_pbx_flash_resources, |
| 375 | ARRAY_SIZE(realview_pbx_flash_resources)); |
| 376 | realview_eth_register(NULL, realview_pbx_smsc911x_resources); |
| 377 | platform_device_register(&realview_i2c_device); |
| 378 | platform_device_register(&realview_cf_device); |
Linus Walleij | e4ecf2b | 2014-02-27 14:29:22 +0100 | [diff] [blame] | 379 | platform_device_register(&realview_leds_device); |
Colin Tuckley | 1b504bb | 2009-05-30 13:56:12 +0100 | [diff] [blame] | 380 | realview_usb_register(realview_pbx_isp1761_resources); |
| 381 | |
| 382 | for (i = 0; i < ARRAY_SIZE(amba_devs); i++) { |
| 383 | struct amba_device *d = amba_devs[i]; |
| 384 | amba_device_register(d, &iomem_resource); |
| 385 | } |
Colin Tuckley | 1b504bb | 2009-05-30 13:56:12 +0100 | [diff] [blame] | 386 | } |
| 387 | |
| 388 | MACHINE_START(REALVIEW_PBX, "ARM-RealView PBX") |
| 389 | /* Maintainer: ARM Ltd/Deep Blue Solutions Ltd */ |
Nicolas Pitre | 9ddea57 | 2011-07-05 22:38:16 -0400 | [diff] [blame] | 390 | .atag_offset = 0x100, |
Marc Zyngier | 3695adc | 2011-09-08 13:15:22 +0100 | [diff] [blame] | 391 | .smp = smp_ops(realview_smp_ops), |
Catalin Marinas | c97c5aa | 2009-11-04 12:19:05 +0000 | [diff] [blame] | 392 | .fixup = realview_pbx_fixup, |
Colin Tuckley | 1b504bb | 2009-05-30 13:56:12 +0100 | [diff] [blame] | 393 | .map_io = realview_pbx_map_io, |
Russell King | 631e55f | 2011-01-11 13:05:01 +0000 | [diff] [blame] | 394 | .init_early = realview_init_early, |
Colin Tuckley | 1b504bb | 2009-05-30 13:56:12 +0100 | [diff] [blame] | 395 | .init_irq = gic_init_irq, |
Stephen Warren | 6bb27d7 | 2012-11-08 12:40:59 -0700 | [diff] [blame] | 396 | .init_time = realview_pbx_timer_init, |
Colin Tuckley | 1b504bb | 2009-05-30 13:56:12 +0100 | [diff] [blame] | 397 | .init_machine = realview_pbx_init, |
Nicolas Pitre | 00e9125 | 2011-07-05 22:28:09 -0400 | [diff] [blame] | 398 | #ifdef CONFIG_ZONE_DMA |
| 399 | .dma_zone_size = SZ_256M, |
| 400 | #endif |
Russell King | 47cacdd4 | 2011-11-03 14:00:13 +0000 | [diff] [blame] | 401 | .restart = realview_pbx_restart, |
Colin Tuckley | 1b504bb | 2009-05-30 13:56:12 +0100 | [diff] [blame] | 402 | MACHINE_END |