Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
| 2 | * linux/arch/arm/mach-versatile/versatile_pb.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 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 22 | #include <linux/init.h> |
| 23 | #include <linux/device.h> |
Russell King | a62c80e | 2006-01-07 13:52:45 +0000 | [diff] [blame] | 24 | #include <linux/amba/bus.h> |
Russell King | bbeddc4 | 2009-07-05 22:43:01 +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> |
Russell King | fced80c | 2008-09-06 12:10:45 +0100 | [diff] [blame] | 27 | #include <linux/io.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 28 | |
Russell King | a09e64f | 2008-08-05 16:14:15 +0100 | [diff] [blame] | 29 | #include <mach/hardware.h> |
Jamie Iles | c8be7ac | 2011-09-27 20:46:10 +0100 | [diff] [blame] | 30 | #include <asm/hardware/vic.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 31 | #include <asm/irq.h> |
| 32 | #include <asm/mach-types.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 33 | |
| 34 | #include <asm/mach/arch.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 35 | |
| 36 | #include "core.h" |
| 37 | |
| 38 | #if 1 |
| 39 | #define IRQ_MMCI1A IRQ_VICSOURCE23 |
| 40 | #else |
| 41 | #define IRQ_MMCI1A IRQ_SIC_MMCI1A |
| 42 | #endif |
| 43 | |
Linus Walleij | 6ef297f | 2009-09-22 14:29:36 +0100 | [diff] [blame] | 44 | static struct mmci_platform_data mmc1_plat_data = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 45 | .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34, |
| 46 | .status = mmc_status, |
Russell King | 7fb2bbf | 2009-07-09 15:15:12 +0100 | [diff] [blame] | 47 | .gpio_wp = -1, |
| 48 | .gpio_cd = -1, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 49 | }; |
| 50 | |
Russell King | bbeddc4 | 2009-07-05 22:43:01 +0100 | [diff] [blame] | 51 | static struct pl061_platform_data gpio2_plat_data = { |
| 52 | .gpio_base = 16, |
| 53 | .irq_base = IRQ_GPIO2_START, |
| 54 | }; |
| 55 | |
| 56 | static struct pl061_platform_data gpio3_plat_data = { |
| 57 | .gpio_base = 24, |
| 58 | .irq_base = IRQ_GPIO3_START, |
| 59 | }; |
| 60 | |
Russell King | 0dada61 | 2011-12-18 11:40:46 +0000 | [diff] [blame] | 61 | #define UART3_IRQ { IRQ_SIC_UART3 } |
| 62 | #define SCI1_IRQ { IRQ_SIC_SCI3 } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 63 | #define MMCI1_IRQ { IRQ_MMCI1A, IRQ_SIC_MMCI1B } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 64 | |
| 65 | /* |
| 66 | * These devices are connected via the core APB bridge |
| 67 | */ |
Russell King | 0dada61 | 2011-12-18 11:40:46 +0000 | [diff] [blame] | 68 | #define GPIO2_IRQ { IRQ_GPIOINT2 } |
| 69 | #define GPIO3_IRQ { IRQ_GPIOINT3 } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 70 | |
| 71 | /* |
| 72 | * These devices are connected via the DMA APB bridge |
| 73 | */ |
| 74 | |
| 75 | /* FPGA Primecells */ |
Russell King | 8f5088b | 2011-12-18 12:21:09 +0000 | [diff] [blame] | 76 | APB_DEVICE(uart3, "fpga:09", UART3, NULL); |
| 77 | APB_DEVICE(sci1, "fpga:0a", SCI1, NULL); |
| 78 | APB_DEVICE(mmc1, "fpga:0b", MMCI1, &mmc1_plat_data); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 79 | |
| 80 | /* DevChip Primecells */ |
Russell King | 8f5088b | 2011-12-18 12:21:09 +0000 | [diff] [blame] | 81 | APB_DEVICE(gpio2, "dev:e6", GPIO2, &gpio2_plat_data); |
| 82 | APB_DEVICE(gpio3, "dev:e7", GPIO3, &gpio3_plat_data); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 83 | |
| 84 | static struct amba_device *amba_devs[] __initdata = { |
| 85 | &uart3_device, |
| 86 | &gpio2_device, |
| 87 | &gpio3_device, |
| 88 | &sci1_device, |
| 89 | &mmc1_device, |
| 90 | }; |
| 91 | |
Russell King | 4e4e520 | 2006-11-30 22:42:20 +0000 | [diff] [blame] | 92 | static void __init versatile_pb_init(void) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 93 | { |
| 94 | int i; |
| 95 | |
Russell King | 4e4e520 | 2006-11-30 22:42:20 +0000 | [diff] [blame] | 96 | versatile_init(); |
| 97 | |
| 98 | for (i = 0; i < ARRAY_SIZE(amba_devs); i++) { |
| 99 | struct amba_device *d = amba_devs[i]; |
| 100 | amba_device_register(d, &iomem_resource); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 101 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 102 | } |
| 103 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 104 | MACHINE_START(VERSATILE_PB, "ARM-Versatile PB") |
Russell King | e9dea0c | 2005-07-03 17:38:58 +0100 | [diff] [blame] | 105 | /* Maintainer: ARM Ltd/Deep Blue Solutions Ltd */ |
Nicolas Pitre | 171fa8a | 2011-07-05 22:38:18 -0400 | [diff] [blame] | 106 | .atag_offset = 0x100, |
Russell King | e9dea0c | 2005-07-03 17:38:58 +0100 | [diff] [blame] | 107 | .map_io = versatile_map_io, |
Russell King | ad3bb19 | 2011-01-11 12:55:38 +0000 | [diff] [blame] | 108 | .init_early = versatile_init_early, |
Russell King | e9dea0c | 2005-07-03 17:38:58 +0100 | [diff] [blame] | 109 | .init_irq = versatile_init_irq, |
Jamie Iles | c8be7ac | 2011-09-27 20:46:10 +0100 | [diff] [blame] | 110 | .handle_irq = vic_handle_irq, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 111 | .timer = &versatile_timer, |
Russell King | 4e4e520 | 2006-11-30 22:42:20 +0000 | [diff] [blame] | 112 | .init_machine = versatile_pb_init, |
Russell King | b56a7c6 | 2011-11-03 11:43:08 +0000 | [diff] [blame] | 113 | .restart = versatile_restart, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 114 | MACHINE_END |