Catalin Marinas | 8ad68bb | 2005-10-31 14:25:02 +0000 | [diff] [blame] | 1 | /* |
| 2 | * linux/arch/arm/mach-realview/realview_eb.c |
| 3 | * |
| 4 | * Copyright (C) 2004 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 as published by |
| 9 | * the Free Software Foundation; either version 2 of the License, or |
| 10 | * (at your option) any later version. |
| 11 | * |
| 12 | * This program is distributed in the hope that it will be useful, |
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 | * GNU General Public License for more details. |
| 16 | * |
| 17 | * You should have received a copy of the GNU General Public License |
| 18 | * along with this program; if not, write to the Free Software |
| 19 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 20 | */ |
| 21 | |
Catalin Marinas | 8ad68bb | 2005-10-31 14:25:02 +0000 | [diff] [blame] | 22 | #include <linux/init.h> |
Russell King | 1be7228 | 2005-10-31 16:57:06 +0000 | [diff] [blame] | 23 | #include <linux/platform_device.h> |
Catalin Marinas | 8ad68bb | 2005-10-31 14:25:02 +0000 | [diff] [blame] | 24 | #include <linux/sysdev.h> |
Russell King | a62c80e | 2006-01-07 13:52:45 +0000 | [diff] [blame] | 25 | #include <linux/amba/bus.h> |
Catalin Marinas | 8ad68bb | 2005-10-31 14:25:02 +0000 | [diff] [blame] | 26 | |
| 27 | #include <asm/hardware.h> |
| 28 | #include <asm/io.h> |
| 29 | #include <asm/irq.h> |
| 30 | #include <asm/leds.h> |
| 31 | #include <asm/mach-types.h> |
| 32 | #include <asm/hardware/gic.h> |
Catalin Marinas | 8ad68bb | 2005-10-31 14:25:02 +0000 | [diff] [blame] | 33 | #include <asm/hardware/icst307.h> |
| 34 | |
| 35 | #include <asm/mach/arch.h> |
| 36 | #include <asm/mach/map.h> |
| 37 | #include <asm/mach/mmc.h> |
| 38 | |
| 39 | #include <asm/arch/irqs.h> |
| 40 | |
| 41 | #include "core.h" |
| 42 | #include "clock.h" |
| 43 | |
| 44 | static struct map_desc realview_eb_io_desc[] __initdata = { |
Russell King | 1ffedce | 2005-11-02 14:14:37 +0000 | [diff] [blame] | 45 | { |
| 46 | .virtual = IO_ADDRESS(REALVIEW_SYS_BASE), |
| 47 | .pfn = __phys_to_pfn(REALVIEW_SYS_BASE), |
| 48 | .length = SZ_4K, |
| 49 | .type = MT_DEVICE, |
| 50 | }, { |
| 51 | .virtual = IO_ADDRESS(REALVIEW_GIC_CPU_BASE), |
| 52 | .pfn = __phys_to_pfn(REALVIEW_GIC_CPU_BASE), |
| 53 | .length = SZ_4K, |
| 54 | .type = MT_DEVICE, |
| 55 | }, { |
| 56 | .virtual = IO_ADDRESS(REALVIEW_GIC_DIST_BASE), |
| 57 | .pfn = __phys_to_pfn(REALVIEW_GIC_DIST_BASE), |
| 58 | .length = SZ_4K, |
| 59 | .type = MT_DEVICE, |
Catalin Marinas | 3edf22a | 2007-02-14 19:18:09 +0100 | [diff] [blame^] | 60 | }, |
| 61 | #ifdef CONFIG_REALVIEW_MPCORE |
| 62 | { |
| 63 | .virtual = IO_ADDRESS(REALVIEW_GIC1_CPU_BASE), |
| 64 | .pfn = __phys_to_pfn(REALVIEW_GIC1_CPU_BASE), |
| 65 | .length = SZ_4K, |
| 66 | .type = MT_DEVICE, |
Russell King | 1ffedce | 2005-11-02 14:14:37 +0000 | [diff] [blame] | 67 | }, { |
Catalin Marinas | 3edf22a | 2007-02-14 19:18:09 +0100 | [diff] [blame^] | 68 | .virtual = IO_ADDRESS(REALVIEW_GIC1_DIST_BASE), |
| 69 | .pfn = __phys_to_pfn(REALVIEW_GIC1_DIST_BASE), |
| 70 | .length = SZ_4K, |
| 71 | .type = MT_DEVICE, |
| 72 | }, |
| 73 | #endif |
| 74 | { |
Russell King | 1ffedce | 2005-11-02 14:14:37 +0000 | [diff] [blame] | 75 | .virtual = IO_ADDRESS(REALVIEW_SCTL_BASE), |
| 76 | .pfn = __phys_to_pfn(REALVIEW_SCTL_BASE), |
| 77 | .length = SZ_4K, |
| 78 | .type = MT_DEVICE, |
| 79 | }, { |
| 80 | .virtual = IO_ADDRESS(REALVIEW_TIMER0_1_BASE), |
| 81 | .pfn = __phys_to_pfn(REALVIEW_TIMER0_1_BASE), |
| 82 | .length = SZ_4K, |
| 83 | .type = MT_DEVICE, |
| 84 | }, { |
| 85 | .virtual = IO_ADDRESS(REALVIEW_TIMER2_3_BASE), |
| 86 | .pfn = __phys_to_pfn(REALVIEW_TIMER2_3_BASE), |
| 87 | .length = SZ_4K, |
| 88 | .type = MT_DEVICE, |
| 89 | }, |
Catalin Marinas | 8ad68bb | 2005-10-31 14:25:02 +0000 | [diff] [blame] | 90 | #ifdef CONFIG_DEBUG_LL |
Russell King | 1ffedce | 2005-11-02 14:14:37 +0000 | [diff] [blame] | 91 | { |
| 92 | .virtual = IO_ADDRESS(REALVIEW_UART0_BASE), |
| 93 | .pfn = __phys_to_pfn(REALVIEW_UART0_BASE), |
| 94 | .length = SZ_4K, |
| 95 | .type = MT_DEVICE, |
| 96 | } |
Catalin Marinas | 8ad68bb | 2005-10-31 14:25:02 +0000 | [diff] [blame] | 97 | #endif |
| 98 | }; |
| 99 | |
| 100 | static void __init realview_eb_map_io(void) |
| 101 | { |
| 102 | iotable_init(realview_eb_io_desc, ARRAY_SIZE(realview_eb_io_desc)); |
| 103 | } |
| 104 | |
| 105 | /* FPGA Primecells */ |
| 106 | AMBA_DEVICE(aaci, "fpga:04", AACI, NULL); |
| 107 | AMBA_DEVICE(mmc0, "fpga:05", MMCI0, &realview_mmc0_plat_data); |
| 108 | AMBA_DEVICE(kmi0, "fpga:06", KMI0, NULL); |
| 109 | AMBA_DEVICE(kmi1, "fpga:07", KMI1, NULL); |
| 110 | AMBA_DEVICE(uart3, "fpga:09", UART3, NULL); |
| 111 | |
| 112 | /* DevChip Primecells */ |
| 113 | AMBA_DEVICE(smc, "dev:00", SMC, NULL); |
| 114 | AMBA_DEVICE(clcd, "dev:20", CLCD, &clcd_plat_data); |
| 115 | AMBA_DEVICE(dmac, "dev:30", DMAC, NULL); |
| 116 | AMBA_DEVICE(sctl, "dev:e0", SCTL, NULL); |
| 117 | AMBA_DEVICE(wdog, "dev:e1", WATCHDOG, NULL); |
| 118 | AMBA_DEVICE(gpio0, "dev:e4", GPIO0, NULL); |
| 119 | AMBA_DEVICE(gpio1, "dev:e5", GPIO1, NULL); |
| 120 | AMBA_DEVICE(gpio2, "dev:e6", GPIO2, NULL); |
| 121 | AMBA_DEVICE(rtc, "dev:e8", RTC, NULL); |
| 122 | AMBA_DEVICE(sci0, "dev:f0", SCI, NULL); |
| 123 | AMBA_DEVICE(uart0, "dev:f1", UART0, NULL); |
| 124 | AMBA_DEVICE(uart1, "dev:f2", UART1, NULL); |
| 125 | AMBA_DEVICE(uart2, "dev:f3", UART2, NULL); |
| 126 | AMBA_DEVICE(ssp0, "dev:f4", SSP, NULL); |
| 127 | |
| 128 | static struct amba_device *amba_devs[] __initdata = { |
| 129 | &dmac_device, |
| 130 | &uart0_device, |
| 131 | &uart1_device, |
| 132 | &uart2_device, |
| 133 | &uart3_device, |
| 134 | &smc_device, |
| 135 | &clcd_device, |
| 136 | &sctl_device, |
| 137 | &wdog_device, |
| 138 | &gpio0_device, |
| 139 | &gpio1_device, |
| 140 | &gpio2_device, |
| 141 | &rtc_device, |
| 142 | &sci0_device, |
| 143 | &ssp0_device, |
| 144 | &aaci_device, |
| 145 | &mmc0_device, |
| 146 | &kmi0_device, |
| 147 | &kmi1_device, |
| 148 | }; |
| 149 | |
| 150 | static void __init gic_init_irq(void) |
| 151 | { |
Russell King | 9b1283b | 2005-11-07 21:01:06 +0000 | [diff] [blame] | 152 | #ifdef CONFIG_REALVIEW_MPCORE |
Harry Fearnhamm | bb1a2aa | 2006-05-16 16:50:21 +0100 | [diff] [blame] | 153 | unsigned int pldctrl; |
Russell King | 9b1283b | 2005-11-07 21:01:06 +0000 | [diff] [blame] | 154 | writel(0x0000a05f, __io_address(REALVIEW_SYS_LOCK)); |
Harry Fearnhamm | bb1a2aa | 2006-05-16 16:50:21 +0100 | [diff] [blame] | 155 | pldctrl = readl(__io_address(REALVIEW_SYS_BASE) + 0xd8); |
| 156 | pldctrl |= 0x00800000; /* New irq mode */ |
| 157 | writel(pldctrl, __io_address(REALVIEW_SYS_BASE) + 0xd8); |
Russell King | 9b1283b | 2005-11-07 21:01:06 +0000 | [diff] [blame] | 158 | writel(0x00000000, __io_address(REALVIEW_SYS_LOCK)); |
| 159 | #endif |
Catalin Marinas | b3a1bde | 2007-02-14 19:14:56 +0100 | [diff] [blame] | 160 | gic_dist_init(0, __io_address(REALVIEW_GIC_DIST_BASE), 29); |
| 161 | gic_cpu_init(0, __io_address(REALVIEW_GIC_CPU_BASE)); |
Catalin Marinas | 3edf22a | 2007-02-14 19:18:09 +0100 | [diff] [blame^] | 162 | #ifdef CONFIG_REALVIEW_MPCORE |
| 163 | gic_dist_init(1, __io_address(REALVIEW_GIC1_DIST_BASE), 64); |
| 164 | gic_cpu_init(1, __io_address(REALVIEW_GIC1_CPU_BASE)); |
| 165 | gic_cascade_irq(1, IRQ_EB_IRQ1); |
| 166 | #endif |
Catalin Marinas | 8ad68bb | 2005-10-31 14:25:02 +0000 | [diff] [blame] | 167 | } |
| 168 | |
| 169 | static void __init realview_eb_init(void) |
| 170 | { |
| 171 | int i; |
| 172 | |
| 173 | clk_register(&realview_clcd_clk); |
| 174 | |
| 175 | platform_device_register(&realview_flash_device); |
| 176 | platform_device_register(&realview_smc91x_device); |
Russell King | 6b65cd7 | 2006-12-10 21:21:32 +0100 | [diff] [blame] | 177 | platform_device_register(&realview_i2c_device); |
Catalin Marinas | 8ad68bb | 2005-10-31 14:25:02 +0000 | [diff] [blame] | 178 | |
| 179 | for (i = 0; i < ARRAY_SIZE(amba_devs); i++) { |
| 180 | struct amba_device *d = amba_devs[i]; |
| 181 | amba_device_register(d, &iomem_resource); |
| 182 | } |
| 183 | |
| 184 | #ifdef CONFIG_LEDS |
| 185 | leds_event = realview_leds_event; |
| 186 | #endif |
| 187 | } |
| 188 | |
| 189 | MACHINE_START(REALVIEW_EB, "ARM-RealView EB") |
| 190 | /* Maintainer: ARM Ltd/Deep Blue Solutions Ltd */ |
Catalin Marinas | 8ad68bb | 2005-10-31 14:25:02 +0000 | [diff] [blame] | 191 | .phys_io = REALVIEW_UART0_BASE, |
| 192 | .io_pg_offst = (IO_ADDRESS(REALVIEW_UART0_BASE) >> 18) & 0xfffc, |
| 193 | .boot_params = 0x00000100, |
| 194 | .map_io = realview_eb_map_io, |
| 195 | .init_irq = gic_init_irq, |
| 196 | .timer = &realview_timer, |
| 197 | .init_machine = realview_eb_init, |
| 198 | MACHINE_END |