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 | |
| 22 | #include <linux/config.h> |
| 23 | #include <linux/init.h> |
Russell King | 1be7228 | 2005-10-31 16:57:06 +0000 | [diff] [blame] | 24 | #include <linux/platform_device.h> |
Catalin Marinas | 8ad68bb | 2005-10-31 14:25:02 +0000 | [diff] [blame] | 25 | #include <linux/sysdev.h> |
Russell King | a62c80e | 2006-01-07 13:52:45 +0000 | [diff] [blame] | 26 | #include <linux/amba/bus.h> |
Catalin Marinas | 8ad68bb | 2005-10-31 14:25:02 +0000 | [diff] [blame] | 27 | |
| 28 | #include <asm/hardware.h> |
| 29 | #include <asm/io.h> |
| 30 | #include <asm/irq.h> |
| 31 | #include <asm/leds.h> |
| 32 | #include <asm/mach-types.h> |
| 33 | #include <asm/hardware/gic.h> |
Catalin Marinas | 8ad68bb | 2005-10-31 14:25:02 +0000 | [diff] [blame] | 34 | #include <asm/hardware/icst307.h> |
| 35 | |
| 36 | #include <asm/mach/arch.h> |
| 37 | #include <asm/mach/map.h> |
| 38 | #include <asm/mach/mmc.h> |
| 39 | |
| 40 | #include <asm/arch/irqs.h> |
| 41 | |
| 42 | #include "core.h" |
| 43 | #include "clock.h" |
| 44 | |
| 45 | static struct map_desc realview_eb_io_desc[] __initdata = { |
Russell King | 1ffedce | 2005-11-02 14:14:37 +0000 | [diff] [blame] | 46 | { |
| 47 | .virtual = IO_ADDRESS(REALVIEW_SYS_BASE), |
| 48 | .pfn = __phys_to_pfn(REALVIEW_SYS_BASE), |
| 49 | .length = SZ_4K, |
| 50 | .type = MT_DEVICE, |
| 51 | }, { |
| 52 | .virtual = IO_ADDRESS(REALVIEW_GIC_CPU_BASE), |
| 53 | .pfn = __phys_to_pfn(REALVIEW_GIC_CPU_BASE), |
| 54 | .length = SZ_4K, |
| 55 | .type = MT_DEVICE, |
| 56 | }, { |
| 57 | .virtual = IO_ADDRESS(REALVIEW_GIC_DIST_BASE), |
| 58 | .pfn = __phys_to_pfn(REALVIEW_GIC_DIST_BASE), |
| 59 | .length = SZ_4K, |
| 60 | .type = MT_DEVICE, |
| 61 | }, { |
| 62 | .virtual = IO_ADDRESS(REALVIEW_SCTL_BASE), |
| 63 | .pfn = __phys_to_pfn(REALVIEW_SCTL_BASE), |
| 64 | .length = SZ_4K, |
| 65 | .type = MT_DEVICE, |
| 66 | }, { |
| 67 | .virtual = IO_ADDRESS(REALVIEW_TIMER0_1_BASE), |
| 68 | .pfn = __phys_to_pfn(REALVIEW_TIMER0_1_BASE), |
| 69 | .length = SZ_4K, |
| 70 | .type = MT_DEVICE, |
| 71 | }, { |
| 72 | .virtual = IO_ADDRESS(REALVIEW_TIMER2_3_BASE), |
| 73 | .pfn = __phys_to_pfn(REALVIEW_TIMER2_3_BASE), |
| 74 | .length = SZ_4K, |
| 75 | .type = MT_DEVICE, |
| 76 | }, |
Catalin Marinas | 8ad68bb | 2005-10-31 14:25:02 +0000 | [diff] [blame] | 77 | #ifdef CONFIG_DEBUG_LL |
Russell King | 1ffedce | 2005-11-02 14:14:37 +0000 | [diff] [blame] | 78 | { |
| 79 | .virtual = IO_ADDRESS(REALVIEW_UART0_BASE), |
| 80 | .pfn = __phys_to_pfn(REALVIEW_UART0_BASE), |
| 81 | .length = SZ_4K, |
| 82 | .type = MT_DEVICE, |
| 83 | } |
Catalin Marinas | 8ad68bb | 2005-10-31 14:25:02 +0000 | [diff] [blame] | 84 | #endif |
| 85 | }; |
| 86 | |
| 87 | static void __init realview_eb_map_io(void) |
| 88 | { |
| 89 | iotable_init(realview_eb_io_desc, ARRAY_SIZE(realview_eb_io_desc)); |
| 90 | } |
| 91 | |
| 92 | /* FPGA Primecells */ |
| 93 | AMBA_DEVICE(aaci, "fpga:04", AACI, NULL); |
| 94 | AMBA_DEVICE(mmc0, "fpga:05", MMCI0, &realview_mmc0_plat_data); |
| 95 | AMBA_DEVICE(kmi0, "fpga:06", KMI0, NULL); |
| 96 | AMBA_DEVICE(kmi1, "fpga:07", KMI1, NULL); |
| 97 | AMBA_DEVICE(uart3, "fpga:09", UART3, NULL); |
| 98 | |
| 99 | /* DevChip Primecells */ |
| 100 | AMBA_DEVICE(smc, "dev:00", SMC, NULL); |
| 101 | AMBA_DEVICE(clcd, "dev:20", CLCD, &clcd_plat_data); |
| 102 | AMBA_DEVICE(dmac, "dev:30", DMAC, NULL); |
| 103 | AMBA_DEVICE(sctl, "dev:e0", SCTL, NULL); |
| 104 | AMBA_DEVICE(wdog, "dev:e1", WATCHDOG, NULL); |
| 105 | AMBA_DEVICE(gpio0, "dev:e4", GPIO0, NULL); |
| 106 | AMBA_DEVICE(gpio1, "dev:e5", GPIO1, NULL); |
| 107 | AMBA_DEVICE(gpio2, "dev:e6", GPIO2, NULL); |
| 108 | AMBA_DEVICE(rtc, "dev:e8", RTC, NULL); |
| 109 | AMBA_DEVICE(sci0, "dev:f0", SCI, NULL); |
| 110 | AMBA_DEVICE(uart0, "dev:f1", UART0, NULL); |
| 111 | AMBA_DEVICE(uart1, "dev:f2", UART1, NULL); |
| 112 | AMBA_DEVICE(uart2, "dev:f3", UART2, NULL); |
| 113 | AMBA_DEVICE(ssp0, "dev:f4", SSP, NULL); |
| 114 | |
| 115 | static struct amba_device *amba_devs[] __initdata = { |
| 116 | &dmac_device, |
| 117 | &uart0_device, |
| 118 | &uart1_device, |
| 119 | &uart2_device, |
| 120 | &uart3_device, |
| 121 | &smc_device, |
| 122 | &clcd_device, |
| 123 | &sctl_device, |
| 124 | &wdog_device, |
| 125 | &gpio0_device, |
| 126 | &gpio1_device, |
| 127 | &gpio2_device, |
| 128 | &rtc_device, |
| 129 | &sci0_device, |
| 130 | &ssp0_device, |
| 131 | &aaci_device, |
| 132 | &mmc0_device, |
| 133 | &kmi0_device, |
| 134 | &kmi1_device, |
| 135 | }; |
| 136 | |
| 137 | static void __init gic_init_irq(void) |
| 138 | { |
Russell King | 9b1283b | 2005-11-07 21:01:06 +0000 | [diff] [blame] | 139 | #ifdef CONFIG_REALVIEW_MPCORE |
| 140 | writel(0x0000a05f, __io_address(REALVIEW_SYS_LOCK)); |
| 141 | writel(0x008003c0, __io_address(REALVIEW_SYS_BASE) + 0xd8); |
| 142 | writel(0x00000000, __io_address(REALVIEW_SYS_LOCK)); |
| 143 | #endif |
Catalin Marinas | 8ad68bb | 2005-10-31 14:25:02 +0000 | [diff] [blame] | 144 | gic_dist_init(__io_address(REALVIEW_GIC_DIST_BASE)); |
| 145 | gic_cpu_init(__io_address(REALVIEW_GIC_CPU_BASE)); |
| 146 | } |
| 147 | |
| 148 | static void __init realview_eb_init(void) |
| 149 | { |
| 150 | int i; |
| 151 | |
| 152 | clk_register(&realview_clcd_clk); |
| 153 | |
| 154 | platform_device_register(&realview_flash_device); |
| 155 | platform_device_register(&realview_smc91x_device); |
| 156 | |
| 157 | for (i = 0; i < ARRAY_SIZE(amba_devs); i++) { |
| 158 | struct amba_device *d = amba_devs[i]; |
| 159 | amba_device_register(d, &iomem_resource); |
| 160 | } |
| 161 | |
| 162 | #ifdef CONFIG_LEDS |
| 163 | leds_event = realview_leds_event; |
| 164 | #endif |
| 165 | } |
| 166 | |
| 167 | MACHINE_START(REALVIEW_EB, "ARM-RealView EB") |
| 168 | /* Maintainer: ARM Ltd/Deep Blue Solutions Ltd */ |
Catalin Marinas | 8ad68bb | 2005-10-31 14:25:02 +0000 | [diff] [blame] | 169 | .phys_io = REALVIEW_UART0_BASE, |
| 170 | .io_pg_offst = (IO_ADDRESS(REALVIEW_UART0_BASE) >> 18) & 0xfffc, |
| 171 | .boot_params = 0x00000100, |
| 172 | .map_io = realview_eb_map_io, |
| 173 | .init_irq = gic_init_irq, |
| 174 | .timer = &realview_timer, |
| 175 | .init_machine = realview_eb_init, |
| 176 | MACHINE_END |