Eric Bénard | 10233a9 | 2009-07-30 07:23:42 +0100 | [diff] [blame] | 1 | /* |
| 2 | * linux/arch/arm/mach-at91/board-cpuat91.c |
| 3 | * |
| 4 | * Copyright (C) 2009 Eric Benard - eric@eukrea.com |
| 5 | * |
| 6 | * This program is free software; you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU General Public License as published by |
| 8 | * the Free Software Foundation; either version 2 of the License, or |
| 9 | * (at your option) any later version. |
| 10 | * |
| 11 | * This program is distributed in the hope that it will be useful, |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | * GNU General Public License for more details. |
| 15 | * |
| 16 | * You should have received a copy of the GNU General Public License |
| 17 | * along with this program; if not, write to the Free Software |
| 18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 19 | */ |
| 20 | |
| 21 | #include <linux/types.h> |
| 22 | #include <linux/init.h> |
| 23 | #include <linux/mm.h> |
| 24 | #include <linux/module.h> |
| 25 | #include <linux/platform_device.h> |
| 26 | #include <linux/mtd/physmap.h> |
| 27 | #include <linux/mtd/plat-ram.h> |
| 28 | |
| 29 | #include <mach/hardware.h> |
| 30 | #include <asm/setup.h> |
| 31 | #include <asm/mach-types.h> |
| 32 | #include <asm/irq.h> |
| 33 | |
| 34 | #include <asm/mach/arch.h> |
| 35 | #include <asm/mach/map.h> |
| 36 | #include <asm/mach/irq.h> |
| 37 | |
| 38 | #include <mach/board.h> |
| 39 | #include <mach/gpio.h> |
| 40 | #include <mach/at91rm9200_mc.h> |
Jean-Christophe PLAGNIOL-VILLARD | e57556e3 | 2011-04-24 11:40:22 +0800 | [diff] [blame] | 41 | #include <mach/cpu.h> |
Eric Bénard | 10233a9 | 2009-07-30 07:23:42 +0100 | [diff] [blame] | 42 | |
| 43 | #include "generic.h" |
| 44 | |
| 45 | static struct gpio_led cpuat91_leds[] = { |
| 46 | { |
| 47 | .name = "led1", |
| 48 | .default_trigger = "heartbeat", |
| 49 | .active_low = 1, |
| 50 | .gpio = AT91_PIN_PC0, |
| 51 | }, |
| 52 | }; |
| 53 | |
Jean-Christophe PLAGNIOL-VILLARD | 1b021a3 | 2011-04-28 20:19:32 +0800 | [diff] [blame] | 54 | static void __init cpuat91_init_early(void) |
Eric Bénard | 10233a9 | 2009-07-30 07:23:42 +0100 | [diff] [blame] | 55 | { |
Jean-Christophe PLAGNIOL-VILLARD | e57556e3 | 2011-04-24 11:40:22 +0800 | [diff] [blame] | 56 | /* Set cpu type: PQFP */ |
| 57 | at91rm9200_set_type(ARCH_REVISON_9200_PQFP); |
| 58 | |
Eric Bénard | 10233a9 | 2009-07-30 07:23:42 +0100 | [diff] [blame] | 59 | /* Initialize processor: 18.432 MHz crystal */ |
Jean-Christophe PLAGNIOL-VILLARD | e57556e3 | 2011-04-24 11:40:22 +0800 | [diff] [blame] | 60 | at91rm9200_initialize(18432000); |
Eric Bénard | 10233a9 | 2009-07-30 07:23:42 +0100 | [diff] [blame] | 61 | |
| 62 | /* DBGU on ttyS0. (Rx & Tx only) */ |
| 63 | at91_register_uart(0, 0, 0); |
| 64 | |
| 65 | /* USART0 on ttyS1. (Rx, Tx, CTS, RTS) */ |
| 66 | at91_register_uart(AT91RM9200_ID_US0, 1, ATMEL_UART_CTS | |
| 67 | ATMEL_UART_RTS); |
| 68 | |
| 69 | /* USART1 on ttyS2. (Rx, Tx, CTS, RTS, DTR, DSR, DCD, RI) */ |
| 70 | at91_register_uart(AT91RM9200_ID_US1, 2, ATMEL_UART_CTS | |
| 71 | ATMEL_UART_RTS | ATMEL_UART_DTR | ATMEL_UART_DSR | |
| 72 | ATMEL_UART_DCD | ATMEL_UART_RI); |
| 73 | |
| 74 | /* USART2 on ttyS3 (Rx, Tx) */ |
| 75 | at91_register_uart(AT91RM9200_ID_US2, 3, 0); |
| 76 | |
| 77 | /* USART3 on ttyS4 (Rx, Tx, CTS, RTS) */ |
| 78 | at91_register_uart(AT91RM9200_ID_US3, 4, ATMEL_UART_CTS | |
| 79 | ATMEL_UART_RTS); |
| 80 | |
| 81 | /* set serial console to ttyS0 (ie, DBGU) */ |
| 82 | at91_set_serial_console(0); |
| 83 | } |
| 84 | |
| 85 | static void __init cpuat91_init_irq(void) |
| 86 | { |
| 87 | at91rm9200_init_interrupts(NULL); |
| 88 | } |
| 89 | |
| 90 | static struct at91_eth_data __initdata cpuat91_eth_data = { |
| 91 | .is_rmii = 1, |
| 92 | }; |
| 93 | |
| 94 | static struct at91_usbh_data __initdata cpuat91_usbh_data = { |
| 95 | .ports = 1, |
| 96 | }; |
| 97 | |
| 98 | static struct at91_udc_data __initdata cpuat91_udc_data = { |
| 99 | .vbus_pin = AT91_PIN_PC15, |
| 100 | .pullup_pin = AT91_PIN_PC14, |
| 101 | }; |
| 102 | |
| 103 | static struct at91_mmc_data __initdata cpuat91_mmc_data = { |
| 104 | .det_pin = AT91_PIN_PC2, |
| 105 | .wire4 = 1, |
| 106 | }; |
| 107 | |
| 108 | static struct physmap_flash_data cpuat91_flash_data = { |
| 109 | .width = 2, |
| 110 | }; |
| 111 | |
| 112 | static struct resource cpuat91_flash_resource = { |
| 113 | .start = AT91_CHIPSELECT_0, |
| 114 | .end = AT91_CHIPSELECT_0 + SZ_16M - 1, |
| 115 | .flags = IORESOURCE_MEM, |
| 116 | }; |
| 117 | |
| 118 | static struct platform_device cpuat91_norflash = { |
| 119 | .name = "physmap-flash", |
| 120 | .id = 0, |
| 121 | .dev = { |
| 122 | .platform_data = &cpuat91_flash_data, |
| 123 | }, |
| 124 | .resource = &cpuat91_flash_resource, |
| 125 | .num_resources = 1, |
| 126 | }; |
| 127 | |
| 128 | #ifdef CONFIG_MTD_PLATRAM |
| 129 | struct platdata_mtd_ram at91_sram_pdata = { |
| 130 | .mapname = "SRAM", |
| 131 | .bankwidth = 2, |
| 132 | }; |
| 133 | |
| 134 | static struct resource at91_sram_resource[] = { |
| 135 | [0] = { |
| 136 | .start = AT91RM9200_SRAM_BASE, |
| 137 | .end = AT91RM9200_SRAM_BASE + AT91RM9200_SRAM_SIZE - 1, |
| 138 | .flags = IORESOURCE_MEM, |
| 139 | }, |
| 140 | }; |
| 141 | |
| 142 | static struct platform_device at91_sram = { |
| 143 | .name = "mtd-ram", |
| 144 | .id = 0, |
| 145 | .resource = at91_sram_resource, |
| 146 | .num_resources = ARRAY_SIZE(at91_sram_resource), |
| 147 | .dev = { |
| 148 | .platform_data = &at91_sram_pdata, |
| 149 | }, |
| 150 | }; |
| 151 | #endif /* MTD_PLATRAM */ |
| 152 | |
| 153 | static struct platform_device *platform_devices[] __initdata = { |
| 154 | &cpuat91_norflash, |
| 155 | #ifdef CONFIG_MTD_PLATRAM |
| 156 | &at91_sram, |
| 157 | #endif /* CONFIG_MTD_PLATRAM */ |
| 158 | }; |
| 159 | |
| 160 | static void __init cpuat91_board_init(void) |
| 161 | { |
| 162 | /* Serial */ |
| 163 | at91_add_device_serial(); |
| 164 | /* LEDs. */ |
| 165 | at91_gpio_leds(cpuat91_leds, ARRAY_SIZE(cpuat91_leds)); |
| 166 | /* Ethernet */ |
| 167 | at91_add_device_eth(&cpuat91_eth_data); |
| 168 | /* USB Host */ |
| 169 | at91_add_device_usbh(&cpuat91_usbh_data); |
| 170 | /* USB Device */ |
| 171 | at91_add_device_udc(&cpuat91_udc_data); |
| 172 | /* MMC */ |
| 173 | at91_add_device_mmc(0, &cpuat91_mmc_data); |
| 174 | /* I2C */ |
| 175 | at91_add_device_i2c(NULL, 0); |
| 176 | /* Platform devices */ |
| 177 | platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices)); |
| 178 | } |
| 179 | |
| 180 | MACHINE_START(CPUAT91, "Eukrea") |
| 181 | /* Maintainer: Eric Benard - EUKREA Electromatique */ |
Eric Bénard | 10233a9 | 2009-07-30 07:23:42 +0100 | [diff] [blame] | 182 | .timer = &at91rm9200_timer, |
Jean-Christophe PLAGNIOL-VILLARD | 1b021a3 | 2011-04-28 20:19:32 +0800 | [diff] [blame] | 183 | .map_io = at91rm9200_map_io, |
| 184 | .init_early = cpuat91_init_early, |
Eric Bénard | 10233a9 | 2009-07-30 07:23:42 +0100 | [diff] [blame] | 185 | .init_irq = cpuat91_init_irq, |
| 186 | .init_machine = cpuat91_board_init, |
| 187 | MACHINE_END |