Uwe Kleine-König | 01c62c9 | 2009-11-03 20:39:02 +0100 | [diff] [blame] | 1 | /* |
| 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-VILLARD | f363c40 | 2012-02-13 12:58:53 +0800 | [diff] [blame] | 29 | #include <mach/at91_ramc.h> |
Jean-Christophe PLAGNIOL-VILLARD | e57556e3 | 2011-04-24 11:40:22 +0800 | [diff] [blame] | 30 | #include <mach/cpu.h> |
| 31 | |
Uwe Kleine-König | 01c62c9 | 2009-11-03 20:39:02 +0100 | [diff] [blame] | 32 | #include "generic.h" |
| 33 | |
Jean-Christophe PLAGNIOL-VILLARD | 1b021a3 | 2011-04-28 20:19:32 +0800 | [diff] [blame] | 34 | static void __init eco920_init_early(void) |
Uwe Kleine-König | 01c62c9 | 2009-11-03 20:39:02 +0100 | [diff] [blame] | 35 | { |
Jean-Christophe PLAGNIOL-VILLARD | e57556e3 | 2011-04-24 11:40:22 +0800 | [diff] [blame] | 36 | /* Set cpu type: PQFP */ |
| 37 | at91rm9200_set_type(ARCH_REVISON_9200_PQFP); |
| 38 | |
Jean-Christophe PLAGNIOL-VILLARD | 21d08b9 | 2011-04-23 15:28:34 +0800 | [diff] [blame] | 39 | at91_initialize(18432000); |
Uwe Kleine-König | 01c62c9 | 2009-11-03 20:39:02 +0100 | [diff] [blame] | 40 | |
| 41 | /* Setup the LEDs */ |
| 42 | at91_init_leds(AT91_PIN_PB0, AT91_PIN_PB1); |
Uwe Kleine-König | 01c62c9 | 2009-11-03 20:39:02 +0100 | [diff] [blame] | 43 | } |
| 44 | |
Jamie Iles | 84e0cdb | 2011-03-08 20:17:06 +0000 | [diff] [blame] | 45 | static struct macb_platform_data __initdata eco920_eth_data = { |
Uwe Kleine-König | 01c62c9 | 2009-11-03 20:39:02 +0100 | [diff] [blame] | 46 | .phy_irq_pin = AT91_PIN_PC2, |
| 47 | .is_rmii = 1, |
| 48 | }; |
| 49 | |
| 50 | static struct at91_usbh_data __initdata eco920_usbh_data = { |
| 51 | .ports = 1, |
Jean-Christophe PLAGNIOL-VILLARD | 63b4c29 | 2011-11-25 01:51:06 +0800 | [diff] [blame] | 52 | .vbus_pin = {-EINVAL, -EINVAL}, |
| 53 | .overcurrent_pin= {-EINVAL, -EINVAL}, |
Uwe Kleine-König | 01c62c9 | 2009-11-03 20:39:02 +0100 | [diff] [blame] | 54 | }; |
| 55 | |
| 56 | static struct at91_udc_data __initdata eco920_udc_data = { |
| 57 | .vbus_pin = AT91_PIN_PB12, |
| 58 | .pullup_pin = AT91_PIN_PB13, |
| 59 | }; |
| 60 | |
| 61 | static struct at91_mmc_data __initdata eco920_mmc_data = { |
| 62 | .slot_b = 0, |
| 63 | .wire4 = 0, |
Jean-Christophe PLAGNIOL-VILLARD | 63b4c29 | 2011-11-25 01:51:06 +0800 | [diff] [blame] | 64 | .det_pin = -EINVAL, |
| 65 | .wp_pin = -EINVAL, |
| 66 | .vcc_pin = -EINVAL, |
Uwe Kleine-König | 01c62c9 | 2009-11-03 20:39:02 +0100 | [diff] [blame] | 67 | }; |
| 68 | |
| 69 | static struct physmap_flash_data eco920_flash_data = { |
| 70 | .width = 2, |
| 71 | }; |
| 72 | |
| 73 | static struct resource eco920_flash_resource = { |
| 74 | .start = 0x11000000, |
| 75 | .end = 0x11ffffff, |
| 76 | .flags = IORESOURCE_MEM, |
| 77 | }; |
| 78 | |
| 79 | static struct platform_device eco920_flash = { |
| 80 | .name = "physmap-flash", |
| 81 | .id = 0, |
| 82 | .dev = { |
| 83 | .platform_data = &eco920_flash_data, |
| 84 | }, |
| 85 | .resource = &eco920_flash_resource, |
| 86 | .num_resources = 1, |
| 87 | }; |
| 88 | |
Uwe Kleine-König | 01c62c9 | 2009-11-03 20:39:02 +0100 | [diff] [blame] | 89 | static struct spi_board_info eco920_spi_devices[] = { |
| 90 | { /* CAN controller */ |
| 91 | .modalias = "tlv5638", |
| 92 | .chip_select = 3, |
| 93 | .max_speed_hz = 20 * 1000 * 1000, |
| 94 | .mode = SPI_CPHA, |
| 95 | }, |
| 96 | }; |
| 97 | |
| 98 | static void __init eco920_board_init(void) |
| 99 | { |
Jean-Christophe PLAGNIOL-VILLARD | 71b149b | 2012-04-05 14:14:28 +0800 | [diff] [blame^] | 100 | /* DBGU on ttyS0. (Rx & Tx only */ |
| 101 | at91_register_uart(0, 0, 0); |
Uwe Kleine-König | 01c62c9 | 2009-11-03 20:39:02 +0100 | [diff] [blame] | 102 | at91_add_device_serial(); |
| 103 | at91_add_device_eth(&eco920_eth_data); |
| 104 | at91_add_device_usbh(&eco920_usbh_data); |
| 105 | at91_add_device_udc(&eco920_udc_data); |
| 106 | |
| 107 | at91_add_device_mmc(0, &eco920_mmc_data); |
| 108 | platform_device_register(&eco920_flash); |
| 109 | |
Jean-Christophe PLAGNIOL-VILLARD | f363c40 | 2012-02-13 12:58:53 +0800 | [diff] [blame] | 110 | at91_ramc_write(0, AT91_SMC_CSR(7), AT91_SMC_RWHOLD_(1) |
Uwe Kleine-König | 01c62c9 | 2009-11-03 20:39:02 +0100 | [diff] [blame] | 111 | | AT91_SMC_RWSETUP_(1) |
| 112 | | AT91_SMC_DBW_8 |
| 113 | | AT91_SMC_WSEN |
| 114 | | AT91_SMC_NWS_(15)); |
| 115 | |
| 116 | at91_set_A_periph(AT91_PIN_PC6, 1); |
| 117 | |
| 118 | at91_set_gpio_input(AT91_PIN_PA23, 0); |
| 119 | at91_set_deglitch(AT91_PIN_PA23, 1); |
| 120 | |
| 121 | /* Initialization of the Static Memory Controller for Chip Select 3 */ |
Jean-Christophe PLAGNIOL-VILLARD | f363c40 | 2012-02-13 12:58:53 +0800 | [diff] [blame] | 122 | at91_ramc_write(0, AT91_SMC_CSR(3), |
Uwe Kleine-König | 01c62c9 | 2009-11-03 20:39:02 +0100 | [diff] [blame] | 123 | AT91_SMC_DBW_16 | /* 16 bit */ |
| 124 | AT91_SMC_WSEN | |
| 125 | AT91_SMC_NWS_(5) | /* wait states */ |
| 126 | AT91_SMC_TDF_(1) /* float time */ |
| 127 | ); |
| 128 | |
Uwe Kleine-König | 01c62c9 | 2009-11-03 20:39:02 +0100 | [diff] [blame] | 129 | at91_add_device_spi(eco920_spi_devices, ARRAY_SIZE(eco920_spi_devices)); |
| 130 | } |
| 131 | |
| 132 | MACHINE_START(ECO920, "eco920") |
| 133 | /* Maintainer: Sascha Hauer */ |
Uwe Kleine-König | 01c62c9 | 2009-11-03 20:39:02 +0100 | [diff] [blame] | 134 | .timer = &at91rm9200_timer, |
Jean-Christophe PLAGNIOL-VILLARD | 21d08b9 | 2011-04-23 15:28:34 +0800 | [diff] [blame] | 135 | .map_io = at91_map_io, |
Jean-Christophe PLAGNIOL-VILLARD | 1b021a3 | 2011-04-28 20:19:32 +0800 | [diff] [blame] | 136 | .init_early = eco920_init_early, |
Jean-Christophe PLAGNIOL-VILLARD | 92100c1 | 2011-04-23 15:28:34 +0800 | [diff] [blame] | 137 | .init_irq = at91_init_irq_default, |
Uwe Kleine-König | 01c62c9 | 2009-11-03 20:39:02 +0100 | [diff] [blame] | 138 | .init_machine = eco920_board_init, |
| 139 | MACHINE_END |