Andrew Victor | 2f036ac | 2008-04-15 21:10:11 +0100 | [diff] [blame] | 1 | /* |
| 2 | * linux/arch/arm/mach-at91rm9200/board-ecbat91.c |
| 3 | * Copyright (C) 2007 emQbit.com. |
| 4 | * |
| 5 | * We started from board-dk.c, which is Copyright (C) 2005 SAN People. |
| 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/types.h> |
Russell King | 2f8163b | 2011-07-26 10:53:52 +0100 | [diff] [blame] | 23 | #include <linux/gpio.h> |
Andrew Victor | 2f036ac | 2008-04-15 21:10:11 +0100 | [diff] [blame] | 24 | #include <linux/init.h> |
| 25 | #include <linux/mm.h> |
| 26 | #include <linux/module.h> |
| 27 | #include <linux/platform_device.h> |
| 28 | #include <linux/spi/spi.h> |
| 29 | #include <linux/spi/flash.h> |
| 30 | |
Russell King | a09e64f | 2008-08-05 16:14:15 +0100 | [diff] [blame] | 31 | #include <mach/hardware.h> |
Andrew Victor | 2f036ac | 2008-04-15 21:10:11 +0100 | [diff] [blame] | 32 | #include <asm/setup.h> |
| 33 | #include <asm/mach-types.h> |
| 34 | #include <asm/irq.h> |
| 35 | |
| 36 | #include <asm/mach/arch.h> |
| 37 | #include <asm/mach/map.h> |
| 38 | #include <asm/mach/irq.h> |
| 39 | |
Jean-Christophe PLAGNIOL-VILLARD | e57556e3 | 2011-04-24 11:40:22 +0800 | [diff] [blame] | 40 | #include <mach/cpu.h> |
Andrew Victor | 2f036ac | 2008-04-15 21:10:11 +0100 | [diff] [blame] | 41 | |
Jean-Christophe PLAGNIOL-VILLARD | a510b9b | 2012-10-30 06:41:28 +0800 | [diff] [blame] | 42 | #include "at91_aic.h" |
Jean-Christophe PLAGNIOL-VILLARD | 43d2f53 | 2012-10-30 05:14:17 +0800 | [diff] [blame] | 43 | #include "board.h" |
Andrew Victor | 2f036ac | 2008-04-15 21:10:11 +0100 | [diff] [blame] | 44 | #include "generic.h" |
Linus Walleij | cf2e933 | 2014-03-27 14:18:51 +0100 | [diff] [blame] | 45 | #include "gpio.h" |
Andrew Victor | 2f036ac | 2008-04-15 21:10:11 +0100 | [diff] [blame] | 46 | |
| 47 | |
Jean-Christophe PLAGNIOL-VILLARD | 1b021a3 | 2011-04-28 20:19:32 +0800 | [diff] [blame] | 48 | static void __init ecb_at91init_early(void) |
Andrew Victor | 2f036ac | 2008-04-15 21:10:11 +0100 | [diff] [blame] | 49 | { |
Jean-Christophe PLAGNIOL-VILLARD | e57556e3 | 2011-04-24 11:40:22 +0800 | [diff] [blame] | 50 | /* Set cpu type: PQFP */ |
| 51 | at91rm9200_set_type(ARCH_REVISON_9200_PQFP); |
| 52 | |
Andrew Victor | 2f036ac | 2008-04-15 21:10:11 +0100 | [diff] [blame] | 53 | /* Initialize processor: 18.432 MHz crystal */ |
Jean-Christophe PLAGNIOL-VILLARD | 21d08b9 | 2011-04-23 15:28:34 +0800 | [diff] [blame] | 54 | at91_initialize(18432000); |
Andrew Victor | 2f036ac | 2008-04-15 21:10:11 +0100 | [diff] [blame] | 55 | } |
| 56 | |
Jamie Iles | 84e0cdb | 2011-03-08 20:17:06 +0000 | [diff] [blame] | 57 | static struct macb_platform_data __initdata ecb_at91eth_data = { |
Andrew Victor | 2f036ac | 2008-04-15 21:10:11 +0100 | [diff] [blame] | 58 | .phy_irq_pin = AT91_PIN_PC4, |
| 59 | .is_rmii = 0, |
| 60 | }; |
| 61 | |
| 62 | static struct at91_usbh_data __initdata ecb_at91usbh_data = { |
| 63 | .ports = 1, |
Jean-Christophe PLAGNIOL-VILLARD | 63b4c29 | 2011-11-25 01:51:06 +0800 | [diff] [blame] | 64 | .vbus_pin = {-EINVAL, -EINVAL}, |
| 65 | .overcurrent_pin= {-EINVAL, -EINVAL}, |
Andrew Victor | 2f036ac | 2008-04-15 21:10:11 +0100 | [diff] [blame] | 66 | }; |
| 67 | |
Ludovic Desroches | 4cf3326 | 2012-05-21 12:23:27 +0200 | [diff] [blame] | 68 | static struct mci_platform_data __initdata ecbat91_mci0_data = { |
| 69 | .slot[0] = { |
| 70 | .bus_width = 4, |
| 71 | .detect_pin = -EINVAL, |
| 72 | .wp_pin = -EINVAL, |
| 73 | }, |
Andrew Victor | 2f036ac | 2008-04-15 21:10:11 +0100 | [diff] [blame] | 74 | }; |
| 75 | |
| 76 | |
| 77 | #if defined(CONFIG_MTD_DATAFLASH) |
| 78 | static struct mtd_partition __initdata my_flash0_partitions[] = |
| 79 | { |
| 80 | { /* 0x8400 */ |
| 81 | .name = "Darrell-loader", |
| 82 | .offset = 0, |
Andrew Victor | e505240 | 2008-09-21 21:30:02 +0100 | [diff] [blame] | 83 | .size = 12 * 1056, |
Andrew Victor | 2f036ac | 2008-04-15 21:10:11 +0100 | [diff] [blame] | 84 | }, |
| 85 | { |
| 86 | .name = "U-boot", |
| 87 | .offset = MTDPART_OFS_NXTBLK, |
| 88 | .size = 110 * 1056, |
| 89 | }, |
| 90 | { /* 1336 (167 blocks) pages * 1056 bytes = 0x158700 bytes */ |
| 91 | .name = "UBoot-env", |
| 92 | .offset = MTDPART_OFS_NXTBLK, |
| 93 | .size = 8 * 1056, |
| 94 | }, |
| 95 | { /* 1336 (167 blocks) pages * 1056 bytes = 0x158700 bytes */ |
| 96 | .name = "Kernel", |
| 97 | .offset = MTDPART_OFS_NXTBLK, |
| 98 | .size = 1534 * 1056, |
| 99 | }, |
| 100 | { /* 190200 - jffs2 root filesystem */ |
| 101 | .name = "Filesystem", |
| 102 | .offset = MTDPART_OFS_NXTBLK, |
| 103 | .size = MTDPART_SIZ_FULL, /* 26 sectors */ |
| 104 | } |
| 105 | }; |
| 106 | |
| 107 | static struct flash_platform_data __initdata my_flash0_platform = { |
| 108 | .name = "Removable flash card", |
| 109 | .parts = my_flash0_partitions, |
| 110 | .nr_parts = ARRAY_SIZE(my_flash0_partitions) |
| 111 | }; |
| 112 | |
| 113 | #endif |
| 114 | |
| 115 | static struct spi_board_info __initdata ecb_at91spi_devices[] = { |
| 116 | { /* DataFlash chip */ |
| 117 | .modalias = "mtd_dataflash", |
| 118 | .chip_select = 0, |
| 119 | .max_speed_hz = 10 * 1000 * 1000, |
| 120 | .bus_num = 0, |
| 121 | #if defined(CONFIG_MTD_DATAFLASH) |
| 122 | .platform_data = &my_flash0_platform, |
| 123 | #endif |
| 124 | }, |
Uwe Kleine-König | b595076 | 2010-11-01 15:38:34 -0400 | [diff] [blame] | 125 | { /* User accessible spi - cs1 (250KHz) */ |
Andrew Victor | 2f036ac | 2008-04-15 21:10:11 +0100 | [diff] [blame] | 126 | .modalias = "spi-cs1", |
| 127 | .chip_select = 1, |
| 128 | .max_speed_hz = 250 * 1000, |
| 129 | }, |
Uwe Kleine-König | b595076 | 2010-11-01 15:38:34 -0400 | [diff] [blame] | 130 | { /* User accessible spi - cs2 (1MHz) */ |
Andrew Victor | 2f036ac | 2008-04-15 21:10:11 +0100 | [diff] [blame] | 131 | .modalias = "spi-cs2", |
| 132 | .chip_select = 2, |
| 133 | .max_speed_hz = 1 * 1000 * 1000, |
| 134 | }, |
Uwe Kleine-König | b595076 | 2010-11-01 15:38:34 -0400 | [diff] [blame] | 135 | { /* User accessible spi - cs3 (10MHz) */ |
Andrew Victor | 2f036ac | 2008-04-15 21:10:11 +0100 | [diff] [blame] | 136 | .modalias = "spi-cs3", |
| 137 | .chip_select = 3, |
| 138 | .max_speed_hz = 10 * 1000 * 1000, |
| 139 | }, |
| 140 | }; |
| 141 | |
Bryan Wu | d61015f | 2012-03-13 17:47:33 +0800 | [diff] [blame] | 142 | /* |
| 143 | * LEDs |
| 144 | */ |
| 145 | static struct gpio_led ecb_leds[] = { |
| 146 | { /* D1 */ |
| 147 | .name = "led1", |
| 148 | .gpio = AT91_PIN_PC7, |
| 149 | .active_low = 1, |
| 150 | .default_trigger = "heartbeat", |
| 151 | } |
| 152 | }; |
| 153 | |
Andrew Victor | 2f036ac | 2008-04-15 21:10:11 +0100 | [diff] [blame] | 154 | static void __init ecb_at91board_init(void) |
| 155 | { |
| 156 | /* Serial */ |
Jean-Christophe PLAGNIOL-VILLARD | 71b149b | 2012-04-05 14:14:28 +0800 | [diff] [blame] | 157 | /* DBGU on ttyS0. (Rx & Tx only) */ |
| 158 | at91_register_uart(0, 0, 0); |
| 159 | |
| 160 | /* USART0 on ttyS1. (Rx & Tx only) */ |
| 161 | at91_register_uart(AT91RM9200_ID_US0, 1, 0); |
Andrew Victor | 2f036ac | 2008-04-15 21:10:11 +0100 | [diff] [blame] | 162 | at91_add_device_serial(); |
| 163 | |
| 164 | /* Ethernet */ |
| 165 | at91_add_device_eth(&ecb_at91eth_data); |
| 166 | |
| 167 | /* USB Host */ |
| 168 | at91_add_device_usbh(&ecb_at91usbh_data); |
| 169 | |
| 170 | /* I2C */ |
| 171 | at91_add_device_i2c(NULL, 0); |
| 172 | |
| 173 | /* MMC */ |
Ludovic Desroches | 4cf3326 | 2012-05-21 12:23:27 +0200 | [diff] [blame] | 174 | at91_add_device_mci(0, &ecbat91_mci0_data); |
Andrew Victor | 2f036ac | 2008-04-15 21:10:11 +0100 | [diff] [blame] | 175 | |
| 176 | /* SPI */ |
| 177 | at91_add_device_spi(ecb_at91spi_devices, ARRAY_SIZE(ecb_at91spi_devices)); |
Bryan Wu | d61015f | 2012-03-13 17:47:33 +0800 | [diff] [blame] | 178 | |
| 179 | /* LEDs */ |
| 180 | at91_gpio_leds(ecb_leds, ARRAY_SIZE(ecb_leds)); |
Andrew Victor | 2f036ac | 2008-04-15 21:10:11 +0100 | [diff] [blame] | 181 | } |
| 182 | |
| 183 | MACHINE_START(ECBAT91, "emQbit's ECB_AT91") |
| 184 | /* Maintainer: emQbit.com */ |
Stephen Warren | 6bb27d7 | 2012-11-08 12:40:59 -0700 | [diff] [blame] | 185 | .init_time = at91rm9200_timer_init, |
Jean-Christophe PLAGNIOL-VILLARD | 21d08b9 | 2011-04-23 15:28:34 +0800 | [diff] [blame] | 186 | .map_io = at91_map_io, |
Ludovic Desroches | 3e13546 | 2012-06-11 15:38:03 +0200 | [diff] [blame] | 187 | .handle_irq = at91_aic_handle_irq, |
Jean-Christophe PLAGNIOL-VILLARD | 1b021a3 | 2011-04-28 20:19:32 +0800 | [diff] [blame] | 188 | .init_early = ecb_at91init_early, |
Jean-Christophe PLAGNIOL-VILLARD | 92100c1 | 2011-04-23 15:28:34 +0800 | [diff] [blame] | 189 | .init_irq = at91_init_irq_default, |
Andrew Victor | 2f036ac | 2008-04-15 21:10:11 +0100 | [diff] [blame] | 190 | .init_machine = ecb_at91board_init, |
| 191 | MACHINE_END |