blob: 77de410efc90a94a5f2ba20eb68f28d9b88699ce [file] [log] [blame]
Uwe Kleine-König01c62c92009-11-03 20:39:02 +01001/*
2 * This program is free software; you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License as published by
4 * the Free Software Foundation; either version 2 of the License, or
5 * (at your option) any later version.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 *
12 * You should have received a copy of the GNU General Public License
13 * along with this program; if not, write to the Free Software
14 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
15 */
16
17#include <linux/init.h>
18#include <linux/platform_device.h>
19#include <linux/mtd/physmap.h>
20#include <linux/gpio.h>
21
22#include <asm/mach-types.h>
23
24#include <asm/mach/arch.h>
25#include <asm/mach/map.h>
26
Uwe Kleine-König01c62c92009-11-03 20:39:02 +010027#include <mach/at91rm9200_mc.h>
Jean-Christophe PLAGNIOL-VILLARDf363c402012-02-13 12:58:53 +080028#include <mach/at91_ramc.h>
Jean-Christophe PLAGNIOL-VILLARDe57556e32011-04-24 11:40:22 +080029#include <mach/cpu.h>
30
Jean-Christophe PLAGNIOL-VILLARDa510b9b2012-10-30 06:41:28 +080031#include "at91_aic.h"
Jean-Christophe PLAGNIOL-VILLARD43d2f532012-10-30 05:14:17 +080032#include "board.h"
Uwe Kleine-König01c62c92009-11-03 20:39:02 +010033#include "generic.h"
34
Jean-Christophe PLAGNIOL-VILLARD1b021a32011-04-28 20:19:32 +080035static void __init eco920_init_early(void)
Uwe Kleine-König01c62c92009-11-03 20:39:02 +010036{
Jean-Christophe PLAGNIOL-VILLARDe57556e32011-04-24 11:40:22 +080037 /* Set cpu type: PQFP */
38 at91rm9200_set_type(ARCH_REVISON_9200_PQFP);
39
Jean-Christophe PLAGNIOL-VILLARD21d08b92011-04-23 15:28:34 +080040 at91_initialize(18432000);
Uwe Kleine-König01c62c92009-11-03 20:39:02 +010041}
42
Jamie Iles84e0cdb2011-03-08 20:17:06 +000043static struct macb_platform_data __initdata eco920_eth_data = {
Uwe Kleine-König01c62c92009-11-03 20:39:02 +010044 .phy_irq_pin = AT91_PIN_PC2,
45 .is_rmii = 1,
46};
47
48static struct at91_usbh_data __initdata eco920_usbh_data = {
49 .ports = 1,
Jean-Christophe PLAGNIOL-VILLARD63b4c292011-11-25 01:51:06 +080050 .vbus_pin = {-EINVAL, -EINVAL},
51 .overcurrent_pin= {-EINVAL, -EINVAL},
Uwe Kleine-König01c62c92009-11-03 20:39:02 +010052};
53
54static struct at91_udc_data __initdata eco920_udc_data = {
55 .vbus_pin = AT91_PIN_PB12,
56 .pullup_pin = AT91_PIN_PB13,
57};
58
Ludovic Desroches4cf33262012-05-21 12:23:27 +020059static struct mci_platform_data __initdata eco920_mci0_data = {
60 .slot[0] = {
61 .bus_width = 1,
62 .detect_pin = -EINVAL,
63 .wp_pin = -EINVAL,
64 },
Uwe Kleine-König01c62c92009-11-03 20:39:02 +010065};
66
67static struct physmap_flash_data eco920_flash_data = {
68 .width = 2,
69};
70
71static struct resource eco920_flash_resource = {
72 .start = 0x11000000,
73 .end = 0x11ffffff,
74 .flags = IORESOURCE_MEM,
75};
76
77static struct platform_device eco920_flash = {
78 .name = "physmap-flash",
79 .id = 0,
80 .dev = {
81 .platform_data = &eco920_flash_data,
82 },
83 .resource = &eco920_flash_resource,
84 .num_resources = 1,
85};
86
Uwe Kleine-König01c62c92009-11-03 20:39:02 +010087static struct spi_board_info eco920_spi_devices[] = {
88 { /* CAN controller */
89 .modalias = "tlv5638",
90 .chip_select = 3,
91 .max_speed_hz = 20 * 1000 * 1000,
92 .mode = SPI_CPHA,
93 },
94};
95
Bryan Wud61015f2012-03-13 17:47:33 +080096/*
97 * LEDs
98 */
99static struct gpio_led eco920_leds[] = {
100 { /* D1 */
101 .name = "led1",
102 .gpio = AT91_PIN_PB0,
103 .active_low = 1,
104 .default_trigger = "heartbeat",
105 },
106 { /* D2 */
107 .name = "led2",
108 .gpio = AT91_PIN_PB1,
109 .active_low = 1,
110 .default_trigger = "timer",
111 }
112};
113
Uwe Kleine-König01c62c92009-11-03 20:39:02 +0100114static void __init eco920_board_init(void)
115{
Jean-Christophe PLAGNIOL-VILLARD71b149b2012-04-05 14:14:28 +0800116 /* DBGU on ttyS0. (Rx & Tx only */
117 at91_register_uart(0, 0, 0);
Uwe Kleine-König01c62c92009-11-03 20:39:02 +0100118 at91_add_device_serial();
119 at91_add_device_eth(&eco920_eth_data);
120 at91_add_device_usbh(&eco920_usbh_data);
121 at91_add_device_udc(&eco920_udc_data);
122
Ludovic Desroches4cf33262012-05-21 12:23:27 +0200123 at91_add_device_mci(0, &eco920_mci0_data);
Uwe Kleine-König01c62c92009-11-03 20:39:02 +0100124 platform_device_register(&eco920_flash);
125
Jean-Christophe PLAGNIOL-VILLARDf363c402012-02-13 12:58:53 +0800126 at91_ramc_write(0, AT91_SMC_CSR(7), AT91_SMC_RWHOLD_(1)
Uwe Kleine-König01c62c92009-11-03 20:39:02 +0100127 | AT91_SMC_RWSETUP_(1)
128 | AT91_SMC_DBW_8
129 | AT91_SMC_WSEN
130 | AT91_SMC_NWS_(15));
131
132 at91_set_A_periph(AT91_PIN_PC6, 1);
133
134 at91_set_gpio_input(AT91_PIN_PA23, 0);
135 at91_set_deglitch(AT91_PIN_PA23, 1);
136
137/* Initialization of the Static Memory Controller for Chip Select 3 */
Jean-Christophe PLAGNIOL-VILLARDf363c402012-02-13 12:58:53 +0800138 at91_ramc_write(0, AT91_SMC_CSR(3),
Uwe Kleine-König01c62c92009-11-03 20:39:02 +0100139 AT91_SMC_DBW_16 | /* 16 bit */
140 AT91_SMC_WSEN |
141 AT91_SMC_NWS_(5) | /* wait states */
142 AT91_SMC_TDF_(1) /* float time */
143 );
144
Uwe Kleine-König01c62c92009-11-03 20:39:02 +0100145 at91_add_device_spi(eco920_spi_devices, ARRAY_SIZE(eco920_spi_devices));
Bryan Wud61015f2012-03-13 17:47:33 +0800146 /* LEDs */
147 at91_gpio_leds(eco920_leds, ARRAY_SIZE(eco920_leds));
Uwe Kleine-König01c62c92009-11-03 20:39:02 +0100148}
149
150MACHINE_START(ECO920, "eco920")
151 /* Maintainer: Sascha Hauer */
Stephen Warren6bb27d72012-11-08 12:40:59 -0700152 .init_time = at91rm9200_timer_init,
Jean-Christophe PLAGNIOL-VILLARD21d08b92011-04-23 15:28:34 +0800153 .map_io = at91_map_io,
Ludovic Desroches3e135462012-06-11 15:38:03 +0200154 .handle_irq = at91_aic_handle_irq,
Jean-Christophe PLAGNIOL-VILLARD1b021a32011-04-28 20:19:32 +0800155 .init_early = eco920_init_early,
Jean-Christophe PLAGNIOL-VILLARD92100c12011-04-23 15:28:34 +0800156 .init_irq = at91_init_irq_default,
Uwe Kleine-König01c62c92009-11-03 20:39:02 +0100157 .init_machine = eco920_board_init,
158MACHINE_END