blob: 558546cf63f492bf46d5b290b389e019f428244a [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-VILLARDf363c402012-02-13 12:58:53 +080029#include <mach/at91_ramc.h>
Jean-Christophe PLAGNIOL-VILLARDe57556e32011-04-24 11:40:22 +080030#include <mach/cpu.h>
31
Uwe Kleine-König01c62c92009-11-03 20:39:02 +010032#include "generic.h"
33
Jean-Christophe PLAGNIOL-VILLARD1b021a32011-04-28 20:19:32 +080034static void __init eco920_init_early(void)
Uwe Kleine-König01c62c92009-11-03 20:39:02 +010035{
Jean-Christophe PLAGNIOL-VILLARDe57556e32011-04-24 11:40:22 +080036 /* Set cpu type: PQFP */
37 at91rm9200_set_type(ARCH_REVISON_9200_PQFP);
38
Jean-Christophe PLAGNIOL-VILLARD21d08b92011-04-23 15:28:34 +080039 at91_initialize(18432000);
Uwe Kleine-König01c62c92009-11-03 20:39:02 +010040}
41
Jamie Iles84e0cdb2011-03-08 20:17:06 +000042static struct macb_platform_data __initdata eco920_eth_data = {
Uwe Kleine-König01c62c92009-11-03 20:39:02 +010043 .phy_irq_pin = AT91_PIN_PC2,
44 .is_rmii = 1,
45};
46
47static struct at91_usbh_data __initdata eco920_usbh_data = {
48 .ports = 1,
Jean-Christophe PLAGNIOL-VILLARD63b4c292011-11-25 01:51:06 +080049 .vbus_pin = {-EINVAL, -EINVAL},
50 .overcurrent_pin= {-EINVAL, -EINVAL},
Uwe Kleine-König01c62c92009-11-03 20:39:02 +010051};
52
53static struct at91_udc_data __initdata eco920_udc_data = {
54 .vbus_pin = AT91_PIN_PB12,
55 .pullup_pin = AT91_PIN_PB13,
56};
57
58static struct at91_mmc_data __initdata eco920_mmc_data = {
59 .slot_b = 0,
60 .wire4 = 0,
Jean-Christophe PLAGNIOL-VILLARD63b4c292011-11-25 01:51:06 +080061 .det_pin = -EINVAL,
62 .wp_pin = -EINVAL,
63 .vcc_pin = -EINVAL,
Uwe Kleine-König01c62c92009-11-03 20:39:02 +010064};
65
66static struct physmap_flash_data eco920_flash_data = {
67 .width = 2,
68};
69
70static struct resource eco920_flash_resource = {
71 .start = 0x11000000,
72 .end = 0x11ffffff,
73 .flags = IORESOURCE_MEM,
74};
75
76static struct platform_device eco920_flash = {
77 .name = "physmap-flash",
78 .id = 0,
79 .dev = {
80 .platform_data = &eco920_flash_data,
81 },
82 .resource = &eco920_flash_resource,
83 .num_resources = 1,
84};
85
Uwe Kleine-König01c62c92009-11-03 20:39:02 +010086static struct spi_board_info eco920_spi_devices[] = {
87 { /* CAN controller */
88 .modalias = "tlv5638",
89 .chip_select = 3,
90 .max_speed_hz = 20 * 1000 * 1000,
91 .mode = SPI_CPHA,
92 },
93};
94
95static void __init eco920_board_init(void)
96{
Jean-Christophe PLAGNIOL-VILLARD7eb1dbb2012-04-05 14:27:57 +080097 /* Setup the LEDs */
98 at91_init_leds(AT91_PIN_PB0, AT91_PIN_PB1);
Jean-Christophe PLAGNIOL-VILLARD71b149b2012-04-05 14:14:28 +080099 /* DBGU on ttyS0. (Rx & Tx only */
100 at91_register_uart(0, 0, 0);
Uwe Kleine-König01c62c92009-11-03 20:39:02 +0100101 at91_add_device_serial();
102 at91_add_device_eth(&eco920_eth_data);
103 at91_add_device_usbh(&eco920_usbh_data);
104 at91_add_device_udc(&eco920_udc_data);
105
106 at91_add_device_mmc(0, &eco920_mmc_data);
107 platform_device_register(&eco920_flash);
108
Jean-Christophe PLAGNIOL-VILLARDf363c402012-02-13 12:58:53 +0800109 at91_ramc_write(0, AT91_SMC_CSR(7), AT91_SMC_RWHOLD_(1)
Uwe Kleine-König01c62c92009-11-03 20:39:02 +0100110 | AT91_SMC_RWSETUP_(1)
111 | AT91_SMC_DBW_8
112 | AT91_SMC_WSEN
113 | AT91_SMC_NWS_(15));
114
115 at91_set_A_periph(AT91_PIN_PC6, 1);
116
117 at91_set_gpio_input(AT91_PIN_PA23, 0);
118 at91_set_deglitch(AT91_PIN_PA23, 1);
119
120/* Initialization of the Static Memory Controller for Chip Select 3 */
Jean-Christophe PLAGNIOL-VILLARDf363c402012-02-13 12:58:53 +0800121 at91_ramc_write(0, AT91_SMC_CSR(3),
Uwe Kleine-König01c62c92009-11-03 20:39:02 +0100122 AT91_SMC_DBW_16 | /* 16 bit */
123 AT91_SMC_WSEN |
124 AT91_SMC_NWS_(5) | /* wait states */
125 AT91_SMC_TDF_(1) /* float time */
126 );
127
Uwe Kleine-König01c62c92009-11-03 20:39:02 +0100128 at91_add_device_spi(eco920_spi_devices, ARRAY_SIZE(eco920_spi_devices));
129}
130
131MACHINE_START(ECO920, "eco920")
132 /* Maintainer: Sascha Hauer */
Uwe Kleine-König01c62c92009-11-03 20:39:02 +0100133 .timer = &at91rm9200_timer,
Jean-Christophe PLAGNIOL-VILLARD21d08b92011-04-23 15:28:34 +0800134 .map_io = at91_map_io,
Jean-Christophe PLAGNIOL-VILLARD1b021a32011-04-28 20:19:32 +0800135 .init_early = eco920_init_early,
Jean-Christophe PLAGNIOL-VILLARD92100c12011-04-23 15:28:34 +0800136 .init_irq = at91_init_irq_default,
Uwe Kleine-König01c62c92009-11-03 20:39:02 +0100137 .init_machine = eco920_board_init,
138MACHINE_END