| 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> | 
| Russell King | 2f8163b | 2011-07-26 10:53:52 +0100 | [diff] [blame] | 22 | #include <linux/gpio.h> | 
| Eric Bénard | 10233a9 | 2009-07-30 07:23:42 +0100 | [diff] [blame] | 23 | #include <linux/init.h> | 
 | 24 | #include <linux/mm.h> | 
 | 25 | #include <linux/module.h> | 
 | 26 | #include <linux/platform_device.h> | 
 | 27 | #include <linux/mtd/physmap.h> | 
 | 28 | #include <linux/mtd/plat-ram.h> | 
 | 29 |  | 
 | 30 | #include <mach/hardware.h> | 
 | 31 | #include <asm/setup.h> | 
 | 32 | #include <asm/mach-types.h> | 
 | 33 | #include <asm/irq.h> | 
 | 34 |  | 
 | 35 | #include <asm/mach/arch.h> | 
 | 36 | #include <asm/mach/map.h> | 
 | 37 | #include <asm/mach/irq.h> | 
 | 38 |  | 
 | 39 | #include <mach/board.h> | 
| Eric Bénard | 10233a9 | 2009-07-30 07:23:42 +0100 | [diff] [blame] | 40 | #include <mach/at91rm9200_mc.h> | 
| Jean-Christophe PLAGNIOL-VILLARD | f363c40 | 2012-02-13 12:58:53 +0800 | [diff] [blame] | 41 | #include <mach/at91_ramc.h> | 
| Jean-Christophe PLAGNIOL-VILLARD | e57556e3 | 2011-04-24 11:40:22 +0800 | [diff] [blame] | 42 | #include <mach/cpu.h> | 
| Eric Bénard | 10233a9 | 2009-07-30 07:23:42 +0100 | [diff] [blame] | 43 |  | 
 | 44 | #include "generic.h" | 
 | 45 |  | 
 | 46 | static struct gpio_led cpuat91_leds[] = { | 
 | 47 | 	{ | 
 | 48 | 		.name			= "led1", | 
 | 49 | 		.default_trigger	= "heartbeat", | 
 | 50 | 		.active_low		= 1, | 
 | 51 | 		.gpio			= AT91_PIN_PC0, | 
 | 52 | 	}, | 
 | 53 | }; | 
 | 54 |  | 
| Jean-Christophe PLAGNIOL-VILLARD | 1b021a3 | 2011-04-28 20:19:32 +0800 | [diff] [blame] | 55 | static void __init cpuat91_init_early(void) | 
| Eric Bénard | 10233a9 | 2009-07-30 07:23:42 +0100 | [diff] [blame] | 56 | { | 
| Jean-Christophe PLAGNIOL-VILLARD | e57556e3 | 2011-04-24 11:40:22 +0800 | [diff] [blame] | 57 | 	/* Set cpu type: PQFP */ | 
 | 58 | 	at91rm9200_set_type(ARCH_REVISON_9200_PQFP); | 
 | 59 |  | 
| Eric Bénard | 10233a9 | 2009-07-30 07:23:42 +0100 | [diff] [blame] | 60 | 	/* Initialize processor: 18.432 MHz crystal */ | 
| Jean-Christophe PLAGNIOL-VILLARD | 21d08b9 | 2011-04-23 15:28:34 +0800 | [diff] [blame] | 61 | 	at91_initialize(18432000); | 
| Eric Bénard | 10233a9 | 2009-07-30 07:23:42 +0100 | [diff] [blame] | 62 | } | 
 | 63 |  | 
| Jamie Iles | 84e0cdb | 2011-03-08 20:17:06 +0000 | [diff] [blame] | 64 | static struct macb_platform_data __initdata cpuat91_eth_data = { | 
| Jean-Christophe PLAGNIOL-VILLARD | 63b4c29 | 2011-11-25 01:51:06 +0800 | [diff] [blame] | 65 | 	.phy_irq_pin	= -EINVAL, | 
| Eric Bénard | 10233a9 | 2009-07-30 07:23:42 +0100 | [diff] [blame] | 66 | 	.is_rmii	= 1, | 
 | 67 | }; | 
 | 68 |  | 
 | 69 | static struct at91_usbh_data __initdata cpuat91_usbh_data = { | 
 | 70 | 	.ports		= 1, | 
| Jean-Christophe PLAGNIOL-VILLARD | 63b4c29 | 2011-11-25 01:51:06 +0800 | [diff] [blame] | 71 | 	.vbus_pin	= {-EINVAL, -EINVAL}, | 
 | 72 | 	.overcurrent_pin= {-EINVAL, -EINVAL}, | 
| Eric Bénard | 10233a9 | 2009-07-30 07:23:42 +0100 | [diff] [blame] | 73 | }; | 
 | 74 |  | 
 | 75 | static struct at91_udc_data __initdata cpuat91_udc_data = { | 
 | 76 | 	.vbus_pin	= AT91_PIN_PC15, | 
 | 77 | 	.pullup_pin	= AT91_PIN_PC14, | 
 | 78 | }; | 
 | 79 |  | 
 | 80 | static struct at91_mmc_data __initdata cpuat91_mmc_data = { | 
 | 81 | 	.det_pin	= AT91_PIN_PC2, | 
 | 82 | 	.wire4		= 1, | 
| Jean-Christophe PLAGNIOL-VILLARD | 63b4c29 | 2011-11-25 01:51:06 +0800 | [diff] [blame] | 83 | 	.wp_pin		= -EINVAL, | 
 | 84 | 	.vcc_pin	= -EINVAL, | 
| Eric Bénard | 10233a9 | 2009-07-30 07:23:42 +0100 | [diff] [blame] | 85 | }; | 
 | 86 |  | 
 | 87 | static struct physmap_flash_data cpuat91_flash_data = { | 
 | 88 | 	.width		= 2, | 
 | 89 | }; | 
 | 90 |  | 
 | 91 | static struct resource cpuat91_flash_resource = { | 
 | 92 | 	.start		= AT91_CHIPSELECT_0, | 
 | 93 | 	.end		= AT91_CHIPSELECT_0 + SZ_16M - 1, | 
 | 94 | 	.flags		= IORESOURCE_MEM, | 
 | 95 | }; | 
 | 96 |  | 
 | 97 | static struct platform_device cpuat91_norflash = { | 
 | 98 | 	.name		= "physmap-flash", | 
 | 99 | 	.id		= 0, | 
 | 100 | 	.dev	= { | 
 | 101 | 		.platform_data	= &cpuat91_flash_data, | 
 | 102 | 	}, | 
 | 103 | 	.resource	= &cpuat91_flash_resource, | 
 | 104 | 	.num_resources	= 1, | 
 | 105 | }; | 
 | 106 |  | 
 | 107 | #ifdef CONFIG_MTD_PLATRAM | 
 | 108 | struct platdata_mtd_ram at91_sram_pdata = { | 
 | 109 | 	.mapname	= "SRAM", | 
 | 110 | 	.bankwidth	= 2, | 
 | 111 | }; | 
 | 112 |  | 
 | 113 | static struct resource at91_sram_resource[] = { | 
 | 114 | 	[0] = { | 
 | 115 | 		.start = AT91RM9200_SRAM_BASE, | 
 | 116 | 		.end   = AT91RM9200_SRAM_BASE + AT91RM9200_SRAM_SIZE - 1, | 
 | 117 | 		.flags = IORESOURCE_MEM, | 
 | 118 | 	}, | 
 | 119 | }; | 
 | 120 |  | 
 | 121 | static struct platform_device at91_sram = { | 
 | 122 | 	.name		= "mtd-ram", | 
 | 123 | 	.id		= 0, | 
 | 124 | 	.resource	= at91_sram_resource, | 
 | 125 | 	.num_resources	= ARRAY_SIZE(at91_sram_resource), | 
 | 126 | 	.dev	= { | 
 | 127 | 		.platform_data = &at91_sram_pdata, | 
 | 128 | 	}, | 
 | 129 | }; | 
 | 130 | #endif /* MTD_PLATRAM */ | 
 | 131 |  | 
 | 132 | static struct platform_device *platform_devices[] __initdata = { | 
 | 133 | 	&cpuat91_norflash, | 
 | 134 | #ifdef CONFIG_MTD_PLATRAM | 
 | 135 | 	&at91_sram, | 
 | 136 | #endif /* CONFIG_MTD_PLATRAM */ | 
 | 137 | }; | 
 | 138 |  | 
 | 139 | static void __init cpuat91_board_init(void) | 
 | 140 | { | 
 | 141 | 	/* Serial */ | 
| Jean-Christophe PLAGNIOL-VILLARD | 71b149b | 2012-04-05 14:14:28 +0800 | [diff] [blame] | 142 | 	/* DBGU on ttyS0. (Rx & Tx only) */ | 
 | 143 | 	at91_register_uart(0, 0, 0); | 
 | 144 |  | 
 | 145 | 	/* USART0 on ttyS1. (Rx, Tx, CTS, RTS) */ | 
 | 146 | 	at91_register_uart(AT91RM9200_ID_US0, 1, ATMEL_UART_CTS | | 
 | 147 | 		ATMEL_UART_RTS); | 
 | 148 |  | 
 | 149 | 	/* USART1 on ttyS2. (Rx, Tx, CTS, RTS, DTR, DSR, DCD, RI) */ | 
 | 150 | 	at91_register_uart(AT91RM9200_ID_US1, 2, ATMEL_UART_CTS | | 
 | 151 | 		ATMEL_UART_RTS | ATMEL_UART_DTR | ATMEL_UART_DSR | | 
 | 152 | 		ATMEL_UART_DCD | ATMEL_UART_RI); | 
 | 153 |  | 
 | 154 | 	/* USART2 on ttyS3 (Rx, Tx) */ | 
 | 155 | 	at91_register_uart(AT91RM9200_ID_US2, 3, 0); | 
 | 156 |  | 
 | 157 | 	/* USART3 on ttyS4 (Rx, Tx, CTS, RTS) */ | 
 | 158 | 	at91_register_uart(AT91RM9200_ID_US3, 4, ATMEL_UART_CTS | | 
 | 159 | 		ATMEL_UART_RTS); | 
| Eric Bénard | 10233a9 | 2009-07-30 07:23:42 +0100 | [diff] [blame] | 160 | 	at91_add_device_serial(); | 
 | 161 | 	/* LEDs. */ | 
 | 162 | 	at91_gpio_leds(cpuat91_leds, ARRAY_SIZE(cpuat91_leds)); | 
 | 163 | 	/* Ethernet */ | 
 | 164 | 	at91_add_device_eth(&cpuat91_eth_data); | 
 | 165 | 	/* USB Host */ | 
 | 166 | 	at91_add_device_usbh(&cpuat91_usbh_data); | 
 | 167 | 	/* USB Device */ | 
 | 168 | 	at91_add_device_udc(&cpuat91_udc_data); | 
 | 169 | 	/* MMC */ | 
 | 170 | 	at91_add_device_mmc(0, &cpuat91_mmc_data); | 
 | 171 | 	/* I2C */ | 
 | 172 | 	at91_add_device_i2c(NULL, 0); | 
 | 173 | 	/* Platform devices */ | 
 | 174 | 	platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices)); | 
 | 175 | } | 
 | 176 |  | 
 | 177 | MACHINE_START(CPUAT91, "Eukrea") | 
 | 178 | 	/* Maintainer: Eric Benard - EUKREA Electromatique */ | 
| Eric Bénard | 10233a9 | 2009-07-30 07:23:42 +0100 | [diff] [blame] | 179 | 	.timer		= &at91rm9200_timer, | 
| Jean-Christophe PLAGNIOL-VILLARD | 21d08b9 | 2011-04-23 15:28:34 +0800 | [diff] [blame] | 180 | 	.map_io		= at91_map_io, | 
| Jean-Christophe PLAGNIOL-VILLARD | 1b021a3 | 2011-04-28 20:19:32 +0800 | [diff] [blame] | 181 | 	.init_early	= cpuat91_init_early, | 
| Jean-Christophe PLAGNIOL-VILLARD | 92100c1 | 2011-04-23 15:28:34 +0800 | [diff] [blame] | 182 | 	.init_irq	= at91_init_irq_default, | 
| Eric Bénard | 10233a9 | 2009-07-30 07:23:42 +0100 | [diff] [blame] | 183 | 	.init_machine	= cpuat91_board_init, | 
 | 184 | MACHINE_END |