blob: 086ec5b3ebe873ee999edad82f83bde92f51cf7a [file] [log] [blame]
Andrew Victor2f036ac2008-04-15 21:10:11 +01001/*
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 King2f8163b2011-07-26 10:53:52 +010023#include <linux/gpio.h>
Andrew Victor2f036ac2008-04-15 21:10:11 +010024#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 Kinga09e64f2008-08-05 16:14:15 +010031#include <mach/hardware.h>
Andrew Victor2f036ac2008-04-15 21:10:11 +010032#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
Russell Kinga09e64f2008-08-05 16:14:15 +010040#include <mach/board.h>
Jean-Christophe PLAGNIOL-VILLARDe57556e32011-04-24 11:40:22 +080041#include <mach/cpu.h>
Andrew Victor2f036ac2008-04-15 21:10:11 +010042
43#include "generic.h"
44
45
Jean-Christophe PLAGNIOL-VILLARD1b021a32011-04-28 20:19:32 +080046static void __init ecb_at91init_early(void)
Andrew Victor2f036ac2008-04-15 21:10:11 +010047{
Jean-Christophe PLAGNIOL-VILLARDe57556e32011-04-24 11:40:22 +080048 /* Set cpu type: PQFP */
49 at91rm9200_set_type(ARCH_REVISON_9200_PQFP);
50
Andrew Victor2f036ac2008-04-15 21:10:11 +010051 /* Initialize processor: 18.432 MHz crystal */
Jean-Christophe PLAGNIOL-VILLARD21d08b92011-04-23 15:28:34 +080052 at91_initialize(18432000);
Andrew Victor2f036ac2008-04-15 21:10:11 +010053}
54
Jamie Iles84e0cdb2011-03-08 20:17:06 +000055static struct macb_platform_data __initdata ecb_at91eth_data = {
Andrew Victor2f036ac2008-04-15 21:10:11 +010056 .phy_irq_pin = AT91_PIN_PC4,
57 .is_rmii = 0,
58};
59
60static struct at91_usbh_data __initdata ecb_at91usbh_data = {
61 .ports = 1,
Jean-Christophe PLAGNIOL-VILLARD63b4c292011-11-25 01:51:06 +080062 .vbus_pin = {-EINVAL, -EINVAL},
63 .overcurrent_pin= {-EINVAL, -EINVAL},
Andrew Victor2f036ac2008-04-15 21:10:11 +010064};
65
Ludovic Desroches4cf33262012-05-21 12:23:27 +020066static struct mci_platform_data __initdata ecbat91_mci0_data = {
67 .slot[0] = {
68 .bus_width = 4,
69 .detect_pin = -EINVAL,
70 .wp_pin = -EINVAL,
71 },
Andrew Victor2f036ac2008-04-15 21:10:11 +010072};
73
74
75#if defined(CONFIG_MTD_DATAFLASH)
76static struct mtd_partition __initdata my_flash0_partitions[] =
77{
78 { /* 0x8400 */
79 .name = "Darrell-loader",
80 .offset = 0,
Andrew Victore5052402008-09-21 21:30:02 +010081 .size = 12 * 1056,
Andrew Victor2f036ac2008-04-15 21:10:11 +010082 },
83 {
84 .name = "U-boot",
85 .offset = MTDPART_OFS_NXTBLK,
86 .size = 110 * 1056,
87 },
88 { /* 1336 (167 blocks) pages * 1056 bytes = 0x158700 bytes */
89 .name = "UBoot-env",
90 .offset = MTDPART_OFS_NXTBLK,
91 .size = 8 * 1056,
92 },
93 { /* 1336 (167 blocks) pages * 1056 bytes = 0x158700 bytes */
94 .name = "Kernel",
95 .offset = MTDPART_OFS_NXTBLK,
96 .size = 1534 * 1056,
97 },
98 { /* 190200 - jffs2 root filesystem */
99 .name = "Filesystem",
100 .offset = MTDPART_OFS_NXTBLK,
101 .size = MTDPART_SIZ_FULL, /* 26 sectors */
102 }
103};
104
105static struct flash_platform_data __initdata my_flash0_platform = {
106 .name = "Removable flash card",
107 .parts = my_flash0_partitions,
108 .nr_parts = ARRAY_SIZE(my_flash0_partitions)
109};
110
111#endif
112
113static struct spi_board_info __initdata ecb_at91spi_devices[] = {
114 { /* DataFlash chip */
115 .modalias = "mtd_dataflash",
116 .chip_select = 0,
117 .max_speed_hz = 10 * 1000 * 1000,
118 .bus_num = 0,
119#if defined(CONFIG_MTD_DATAFLASH)
120 .platform_data = &my_flash0_platform,
121#endif
122 },
Uwe Kleine-Königb5950762010-11-01 15:38:34 -0400123 { /* User accessible spi - cs1 (250KHz) */
Andrew Victor2f036ac2008-04-15 21:10:11 +0100124 .modalias = "spi-cs1",
125 .chip_select = 1,
126 .max_speed_hz = 250 * 1000,
127 },
Uwe Kleine-Königb5950762010-11-01 15:38:34 -0400128 { /* User accessible spi - cs2 (1MHz) */
Andrew Victor2f036ac2008-04-15 21:10:11 +0100129 .modalias = "spi-cs2",
130 .chip_select = 2,
131 .max_speed_hz = 1 * 1000 * 1000,
132 },
Uwe Kleine-Königb5950762010-11-01 15:38:34 -0400133 { /* User accessible spi - cs3 (10MHz) */
Andrew Victor2f036ac2008-04-15 21:10:11 +0100134 .modalias = "spi-cs3",
135 .chip_select = 3,
136 .max_speed_hz = 10 * 1000 * 1000,
137 },
138};
139
140static void __init ecb_at91board_init(void)
141{
Jean-Christophe PLAGNIOL-VILLARD7eb1dbb2012-04-05 14:27:57 +0800142 /* Setup the LEDs */
143 at91_init_leds(AT91_PIN_PC7, AT91_PIN_PC7);
144
Andrew Victor2f036ac2008-04-15 21:10:11 +0100145 /* Serial */
Jean-Christophe PLAGNIOL-VILLARD71b149b2012-04-05 14:14:28 +0800146 /* DBGU on ttyS0. (Rx & Tx only) */
147 at91_register_uart(0, 0, 0);
148
149 /* USART0 on ttyS1. (Rx & Tx only) */
150 at91_register_uart(AT91RM9200_ID_US0, 1, 0);
Andrew Victor2f036ac2008-04-15 21:10:11 +0100151 at91_add_device_serial();
152
153 /* Ethernet */
154 at91_add_device_eth(&ecb_at91eth_data);
155
156 /* USB Host */
157 at91_add_device_usbh(&ecb_at91usbh_data);
158
159 /* I2C */
160 at91_add_device_i2c(NULL, 0);
161
162 /* MMC */
Ludovic Desroches4cf33262012-05-21 12:23:27 +0200163 at91_add_device_mci(0, &ecbat91_mci0_data);
Andrew Victor2f036ac2008-04-15 21:10:11 +0100164
165 /* SPI */
166 at91_add_device_spi(ecb_at91spi_devices, ARRAY_SIZE(ecb_at91spi_devices));
167}
168
169MACHINE_START(ECBAT91, "emQbit's ECB_AT91")
170 /* Maintainer: emQbit.com */
Andrew Victor2f036ac2008-04-15 21:10:11 +0100171 .timer = &at91rm9200_timer,
Jean-Christophe PLAGNIOL-VILLARD21d08b92011-04-23 15:28:34 +0800172 .map_io = at91_map_io,
Jean-Christophe PLAGNIOL-VILLARD1b021a32011-04-28 20:19:32 +0800173 .init_early = ecb_at91init_early,
Jean-Christophe PLAGNIOL-VILLARD92100c12011-04-23 15:28:34 +0800174 .init_irq = at91_init_irq_default,
Andrew Victor2f036ac2008-04-15 21:10:11 +0100175 .init_machine = ecb_at91board_init,
176MACHINE_END