blob: 07ef35b0ec2cdceecf7e124e705cb842c31b1b62 [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
27#include <mach/board.h>
28#include <mach/at91rm9200_mc.h>
Jean-Christophe PLAGNIOL-VILLARDe57556e32011-04-24 11:40:22 +080029#include <mach/cpu.h>
30
Uwe Kleine-König01c62c92009-11-03 20:39:02 +010031#include "generic.h"
32
Jean-Christophe PLAGNIOL-VILLARD1b021a32011-04-28 20:19:32 +080033static void __init eco920_init_early(void)
Uwe Kleine-König01c62c92009-11-03 20:39:02 +010034{
Jean-Christophe PLAGNIOL-VILLARDe57556e32011-04-24 11:40:22 +080035 /* Set cpu type: PQFP */
36 at91rm9200_set_type(ARCH_REVISON_9200_PQFP);
37
Jean-Christophe PLAGNIOL-VILLARD21d08b92011-04-23 15:28:34 +080038 at91_initialize(18432000);
Uwe Kleine-König01c62c92009-11-03 20:39:02 +010039
40 /* Setup the LEDs */
41 at91_init_leds(AT91_PIN_PB0, AT91_PIN_PB1);
42
43 /* DBGU on ttyS0. (Rx & Tx only */
44 at91_register_uart(0, 0, 0);
45
46 /* set serial console to ttyS0 (ie, DBGU) */
47 at91_set_serial_console(0);
48}
49
Jamie Iles84e0cdb2011-03-08 20:17:06 +000050static struct macb_platform_data __initdata eco920_eth_data = {
Uwe Kleine-König01c62c92009-11-03 20:39:02 +010051 .phy_irq_pin = AT91_PIN_PC2,
52 .is_rmii = 1,
53};
54
55static struct at91_usbh_data __initdata eco920_usbh_data = {
56 .ports = 1,
Jean-Christophe PLAGNIOL-VILLARD63b4c292011-11-25 01:51:06 +080057 .vbus_pin = {-EINVAL, -EINVAL},
58 .overcurrent_pin= {-EINVAL, -EINVAL},
Uwe Kleine-König01c62c92009-11-03 20:39:02 +010059};
60
61static struct at91_udc_data __initdata eco920_udc_data = {
62 .vbus_pin = AT91_PIN_PB12,
63 .pullup_pin = AT91_PIN_PB13,
64};
65
66static struct at91_mmc_data __initdata eco920_mmc_data = {
67 .slot_b = 0,
68 .wire4 = 0,
Jean-Christophe PLAGNIOL-VILLARD63b4c292011-11-25 01:51:06 +080069 .det_pin = -EINVAL,
70 .wp_pin = -EINVAL,
71 .vcc_pin = -EINVAL,
Uwe Kleine-König01c62c92009-11-03 20:39:02 +010072};
73
74static struct physmap_flash_data eco920_flash_data = {
75 .width = 2,
76};
77
78static struct resource eco920_flash_resource = {
79 .start = 0x11000000,
80 .end = 0x11ffffff,
81 .flags = IORESOURCE_MEM,
82};
83
84static struct platform_device eco920_flash = {
85 .name = "physmap-flash",
86 .id = 0,
87 .dev = {
88 .platform_data = &eco920_flash_data,
89 },
90 .resource = &eco920_flash_resource,
91 .num_resources = 1,
92};
93
Uwe Kleine-König01c62c92009-11-03 20:39:02 +010094static struct spi_board_info eco920_spi_devices[] = {
95 { /* CAN controller */
96 .modalias = "tlv5638",
97 .chip_select = 3,
98 .max_speed_hz = 20 * 1000 * 1000,
99 .mode = SPI_CPHA,
100 },
101};
102
103static void __init eco920_board_init(void)
104{
105 at91_add_device_serial();
106 at91_add_device_eth(&eco920_eth_data);
107 at91_add_device_usbh(&eco920_usbh_data);
108 at91_add_device_udc(&eco920_udc_data);
109
110 at91_add_device_mmc(0, &eco920_mmc_data);
111 platform_device_register(&eco920_flash);
112
113 at91_sys_write(AT91_SMC_CSR(7), AT91_SMC_RWHOLD_(1)
114 | AT91_SMC_RWSETUP_(1)
115 | AT91_SMC_DBW_8
116 | AT91_SMC_WSEN
117 | AT91_SMC_NWS_(15));
118
119 at91_set_A_periph(AT91_PIN_PC6, 1);
120
121 at91_set_gpio_input(AT91_PIN_PA23, 0);
122 at91_set_deglitch(AT91_PIN_PA23, 1);
123
124/* Initialization of the Static Memory Controller for Chip Select 3 */
125 at91_sys_write(AT91_SMC_CSR(3),
126 AT91_SMC_DBW_16 | /* 16 bit */
127 AT91_SMC_WSEN |
128 AT91_SMC_NWS_(5) | /* wait states */
129 AT91_SMC_TDF_(1) /* float time */
130 );
131
Uwe Kleine-König01c62c92009-11-03 20:39:02 +0100132 at91_add_device_spi(eco920_spi_devices, ARRAY_SIZE(eco920_spi_devices));
133}
134
135MACHINE_START(ECO920, "eco920")
136 /* Maintainer: Sascha Hauer */
Uwe Kleine-König01c62c92009-11-03 20:39:02 +0100137 .timer = &at91rm9200_timer,
Jean-Christophe PLAGNIOL-VILLARD21d08b92011-04-23 15:28:34 +0800138 .map_io = at91_map_io,
Jean-Christophe PLAGNIOL-VILLARD1b021a32011-04-28 20:19:32 +0800139 .init_early = eco920_init_early,
Jean-Christophe PLAGNIOL-VILLARD92100c12011-04-23 15:28:34 +0800140 .init_irq = at91_init_irq_default,
Uwe Kleine-König01c62c92009-11-03 20:39:02 +0100141 .init_machine = eco920_board_init,
142MACHINE_END