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> |
| 23 | #include <linux/init.h> |
| 24 | #include <linux/mm.h> |
| 25 | #include <linux/module.h> |
| 26 | #include <linux/platform_device.h> |
| 27 | #include <linux/spi/spi.h> |
| 28 | #include <linux/spi/flash.h> |
| 29 | |
Russell King | a09e64f | 2008-08-05 16:14:15 +0100 | [diff] [blame] | 30 | #include <mach/hardware.h> |
Andrew Victor | 2f036ac | 2008-04-15 21:10:11 +0100 | [diff] [blame] | 31 | #include <asm/setup.h> |
| 32 | #include <asm/mach-types.h> |
| 33 | #include <asm/irq.h> |
| 34 | |
| 35 | #include <asm/mach/arch.h> |
| 36 | #include <asm/mach/map.h> |
| 37 | #include <asm/mach/irq.h> |
| 38 | |
Russell King | a09e64f | 2008-08-05 16:14:15 +0100 | [diff] [blame] | 39 | #include <mach/board.h> |
| 40 | #include <mach/gpio.h> |
Jean-Christophe PLAGNIOL-VILLARD | e57556e3 | 2011-04-24 11:40:22 +0800 | [diff] [blame] | 41 | #include <mach/cpu.h> |
Andrew Victor | 2f036ac | 2008-04-15 21:10:11 +0100 | [diff] [blame] | 42 | |
| 43 | #include "generic.h" |
| 44 | |
| 45 | |
Jean-Christophe PLAGNIOL-VILLARD | 1b021a3 | 2011-04-28 20:19:32 +0800 | [diff] [blame] | 46 | static void __init ecb_at91init_early(void) |
Andrew Victor | 2f036ac | 2008-04-15 21:10:11 +0100 | [diff] [blame] | 47 | { |
Jean-Christophe PLAGNIOL-VILLARD | e57556e3 | 2011-04-24 11:40:22 +0800 | [diff] [blame] | 48 | /* Set cpu type: PQFP */ |
| 49 | at91rm9200_set_type(ARCH_REVISON_9200_PQFP); |
| 50 | |
Andrew Victor | 2f036ac | 2008-04-15 21:10:11 +0100 | [diff] [blame] | 51 | /* Initialize processor: 18.432 MHz crystal */ |
Jean-Christophe PLAGNIOL-VILLARD | 21d08b9 | 2011-04-23 15:28:34 +0800 | [diff] [blame^] | 52 | at91_initialize(18432000); |
Andrew Victor | 2f036ac | 2008-04-15 21:10:11 +0100 | [diff] [blame] | 53 | |
| 54 | /* Setup the LEDs */ |
| 55 | at91_init_leds(AT91_PIN_PC7, AT91_PIN_PC7); |
| 56 | |
| 57 | /* DBGU on ttyS0. (Rx & Tx only) */ |
| 58 | at91_register_uart(0, 0, 0); |
| 59 | |
| 60 | /* USART0 on ttyS1. (Rx & Tx only) */ |
| 61 | at91_register_uart(AT91RM9200_ID_US0, 1, 0); |
| 62 | |
| 63 | /* set serial console to ttyS0 (ie, DBGU) */ |
| 64 | at91_set_serial_console(0); |
| 65 | } |
| 66 | |
| 67 | static void __init ecb_at91init_irq(void) |
| 68 | { |
| 69 | at91rm9200_init_interrupts(NULL); |
| 70 | } |
| 71 | |
| 72 | static struct at91_eth_data __initdata ecb_at91eth_data = { |
| 73 | .phy_irq_pin = AT91_PIN_PC4, |
| 74 | .is_rmii = 0, |
| 75 | }; |
| 76 | |
| 77 | static struct at91_usbh_data __initdata ecb_at91usbh_data = { |
| 78 | .ports = 1, |
| 79 | }; |
| 80 | |
| 81 | static struct at91_mmc_data __initdata ecb_at91mmc_data = { |
| 82 | .slot_b = 0, |
| 83 | .wire4 = 1, |
| 84 | }; |
| 85 | |
| 86 | |
| 87 | #if defined(CONFIG_MTD_DATAFLASH) |
| 88 | static struct mtd_partition __initdata my_flash0_partitions[] = |
| 89 | { |
| 90 | { /* 0x8400 */ |
| 91 | .name = "Darrell-loader", |
| 92 | .offset = 0, |
Andrew Victor | e505240 | 2008-09-21 21:30:02 +0100 | [diff] [blame] | 93 | .size = 12 * 1056, |
Andrew Victor | 2f036ac | 2008-04-15 21:10:11 +0100 | [diff] [blame] | 94 | }, |
| 95 | { |
| 96 | .name = "U-boot", |
| 97 | .offset = MTDPART_OFS_NXTBLK, |
| 98 | .size = 110 * 1056, |
| 99 | }, |
| 100 | { /* 1336 (167 blocks) pages * 1056 bytes = 0x158700 bytes */ |
| 101 | .name = "UBoot-env", |
| 102 | .offset = MTDPART_OFS_NXTBLK, |
| 103 | .size = 8 * 1056, |
| 104 | }, |
| 105 | { /* 1336 (167 blocks) pages * 1056 bytes = 0x158700 bytes */ |
| 106 | .name = "Kernel", |
| 107 | .offset = MTDPART_OFS_NXTBLK, |
| 108 | .size = 1534 * 1056, |
| 109 | }, |
| 110 | { /* 190200 - jffs2 root filesystem */ |
| 111 | .name = "Filesystem", |
| 112 | .offset = MTDPART_OFS_NXTBLK, |
| 113 | .size = MTDPART_SIZ_FULL, /* 26 sectors */ |
| 114 | } |
| 115 | }; |
| 116 | |
| 117 | static struct flash_platform_data __initdata my_flash0_platform = { |
| 118 | .name = "Removable flash card", |
| 119 | .parts = my_flash0_partitions, |
| 120 | .nr_parts = ARRAY_SIZE(my_flash0_partitions) |
| 121 | }; |
| 122 | |
| 123 | #endif |
| 124 | |
| 125 | static struct spi_board_info __initdata ecb_at91spi_devices[] = { |
| 126 | { /* DataFlash chip */ |
| 127 | .modalias = "mtd_dataflash", |
| 128 | .chip_select = 0, |
| 129 | .max_speed_hz = 10 * 1000 * 1000, |
| 130 | .bus_num = 0, |
| 131 | #if defined(CONFIG_MTD_DATAFLASH) |
| 132 | .platform_data = &my_flash0_platform, |
| 133 | #endif |
| 134 | }, |
Uwe Kleine-König | b595076 | 2010-11-01 15:38:34 -0400 | [diff] [blame] | 135 | { /* User accessible spi - cs1 (250KHz) */ |
Andrew Victor | 2f036ac | 2008-04-15 21:10:11 +0100 | [diff] [blame] | 136 | .modalias = "spi-cs1", |
| 137 | .chip_select = 1, |
| 138 | .max_speed_hz = 250 * 1000, |
| 139 | }, |
Uwe Kleine-König | b595076 | 2010-11-01 15:38:34 -0400 | [diff] [blame] | 140 | { /* User accessible spi - cs2 (1MHz) */ |
Andrew Victor | 2f036ac | 2008-04-15 21:10:11 +0100 | [diff] [blame] | 141 | .modalias = "spi-cs2", |
| 142 | .chip_select = 2, |
| 143 | .max_speed_hz = 1 * 1000 * 1000, |
| 144 | }, |
Uwe Kleine-König | b595076 | 2010-11-01 15:38:34 -0400 | [diff] [blame] | 145 | { /* User accessible spi - cs3 (10MHz) */ |
Andrew Victor | 2f036ac | 2008-04-15 21:10:11 +0100 | [diff] [blame] | 146 | .modalias = "spi-cs3", |
| 147 | .chip_select = 3, |
| 148 | .max_speed_hz = 10 * 1000 * 1000, |
| 149 | }, |
| 150 | }; |
| 151 | |
| 152 | static void __init ecb_at91board_init(void) |
| 153 | { |
| 154 | /* Serial */ |
| 155 | at91_add_device_serial(); |
| 156 | |
| 157 | /* Ethernet */ |
| 158 | at91_add_device_eth(&ecb_at91eth_data); |
| 159 | |
| 160 | /* USB Host */ |
| 161 | at91_add_device_usbh(&ecb_at91usbh_data); |
| 162 | |
| 163 | /* I2C */ |
| 164 | at91_add_device_i2c(NULL, 0); |
| 165 | |
| 166 | /* MMC */ |
| 167 | at91_add_device_mmc(0, &ecb_at91mmc_data); |
| 168 | |
| 169 | /* SPI */ |
| 170 | at91_add_device_spi(ecb_at91spi_devices, ARRAY_SIZE(ecb_at91spi_devices)); |
| 171 | } |
| 172 | |
| 173 | MACHINE_START(ECBAT91, "emQbit's ECB_AT91") |
| 174 | /* Maintainer: emQbit.com */ |
Andrew Victor | 2f036ac | 2008-04-15 21:10:11 +0100 | [diff] [blame] | 175 | .timer = &at91rm9200_timer, |
Jean-Christophe PLAGNIOL-VILLARD | 21d08b9 | 2011-04-23 15:28:34 +0800 | [diff] [blame^] | 176 | .map_io = at91_map_io, |
Jean-Christophe PLAGNIOL-VILLARD | 1b021a3 | 2011-04-28 20:19:32 +0800 | [diff] [blame] | 177 | .init_early = ecb_at91init_early, |
Andrew Victor | 2f036ac | 2008-04-15 21:10:11 +0100 | [diff] [blame] | 178 | .init_irq = ecb_at91init_irq, |
| 179 | .init_machine = ecb_at91board_init, |
| 180 | MACHINE_END |