2 * linux/arch/arm/mach-at91/board-at572d940hf_ek.c
4 * Copyright (C) 2008 Atmel Antonio R. Costa <costa.antonior@gmail.com>
5 * Copyright (C) 2005 SAN People
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 #include <linux/types.h>
23 #include <linux/init.h>
25 #include <linux/module.h>
26 #include <linux/platform_device.h>
27 #include <linux/spi/spi.h>
28 #include <linux/spi/ds1305.h>
29 #include <linux/irq.h>
30 #include <linux/mtd/physmap.h>
32 #include <mach/hardware.h>
33 #include <asm/setup.h>
34 #include <asm/mach-types.h>
37 #include <asm/mach/arch.h>
38 #include <asm/mach/map.h>
39 #include <asm/mach/irq.h>
41 #include <mach/board.h>
42 #include <mach/gpio.h>
43 #include <mach/at91sam9_smc.h>
49 static void __init
eb_map_io(void)
51 /* Initialize processor: 12.500 MHz crystal */
52 at572d940hf_initialize(12000000);
54 /* DBGU on ttyS0. (Rx & Tx only) */
55 at91_register_uart(0, 0, 0);
57 /* USART0 on ttyS1. (Rx & Tx only) */
58 at91_register_uart(AT572D940HF_ID_US0
, 1, 0);
60 /* USART1 on ttyS2. (Rx & Tx only) */
61 at91_register_uart(AT572D940HF_ID_US1
, 2, 0);
63 /* USART2 on ttyS3. (Tx & Rx only */
64 at91_register_uart(AT572D940HF_ID_US2
, 3, 0);
66 /* set serial console to ttyS0 (ie, DBGU) */
67 at91_set_serial_console(0);
70 static void __init
eb_init_irq(void)
72 at572d940hf_init_interrupts(NULL
);
79 static struct at91_usbh_data __initdata eb_usbh_data
= {
87 static struct at91_udc_data __initdata eb_udc_data
= {
88 .vbus_pin
= 0, /* no VBUS detection,UDC always on */
89 .pullup_pin
= 0, /* pull-up driven by UDC */
96 static struct at91_mmc_data __initdata eb_mmc_data
= {
98 /* .det_pin = ... not connected */
99 /* .wp_pin = ... not connected */
100 /* .vcc_pin = ... not connected */
105 * MACB Ethernet device
107 static struct at91_eth_data __initdata eb_eth_data
= {
108 .phy_irq_pin
= AT91_PIN_PB25
,
116 static struct mtd_partition eb_nor_partitions
[] = {
118 .name
= "Raw Environment",
125 .offset
= MTDPART_OFS_APPEND
,
131 .offset
= MTDPART_OFS_APPEND
,
132 .size
= MTDPART_SIZ_FULL
,
137 static void nor_flash_set_vpp(struct map_info
* mi
, int i
) {
140 static struct physmap_flash_data nor_flash_data
= {
142 .parts
= eb_nor_partitions
,
143 .nr_parts
= ARRAY_SIZE(eb_nor_partitions
),
144 .set_vpp
= nor_flash_set_vpp
,
147 static struct resource nor_flash_resources
[] = {
149 .start
= AT91_CHIPSELECT_0
,
150 .end
= AT91_CHIPSELECT_0
+ SZ_16M
- 1,
151 .flags
= IORESOURCE_MEM
,
155 static struct platform_device nor_flash
= {
156 .name
= "physmap-flash",
159 .platform_data
= &nor_flash_data
,
161 .resource
= nor_flash_resources
,
162 .num_resources
= ARRAY_SIZE(nor_flash_resources
),
165 static struct sam9_smc_config __initdata eb_nor_smc_config
= {
168 .ncs_write_setup
= 1,
173 .ncs_write_pulse
= 7,
179 .mode
= AT91_SMC_READMODE
| AT91_SMC_WRITEMODE
| AT91_SMC_EXNWMODE_DISABLE
| AT91_SMC_BAT_WRITE
| AT91_SMC_DBW_32
,
183 static void __init
eb_add_device_nor(void)
185 /* configure chip-select 0 (NOR) */
186 sam9_smc_configure(0, &eb_nor_smc_config
);
187 platform_device_register(&nor_flash
);
193 static struct mtd_partition __initdata eb_nand_partition
[] = {
195 .name
= "Partition 1",
200 .name
= "Partition 2",
201 .offset
= MTDPART_OFS_NXTBLK
,
202 .size
= MTDPART_SIZ_FULL
,
206 static struct mtd_partition
* __init
nand_partitions(int size
, int *num_partitions
)
208 *num_partitions
= ARRAY_SIZE(eb_nand_partition
);
209 return eb_nand_partition
;
212 static struct atmel_nand_data __initdata eb_nand_data
= {
215 /* .det_pin = ... not connected */
216 /* .rdy_pin = AT91_PIN_PC16, */
217 .enable_pin
= AT91_PIN_PA15
,
218 .partition_info
= nand_partitions
,
219 #if defined(CONFIG_MTD_NAND_ATMEL_BUSWIDTH_16)
226 static struct sam9_smc_config __initdata eb_nand_smc_config
= {
229 .ncs_write_setup
= 1,
234 .ncs_write_pulse
= 3,
240 .mode
= AT91_SMC_READMODE
| AT91_SMC_WRITEMODE
| AT91_SMC_EXNWMODE_DISABLE
,
244 static void __init
eb_add_device_nand(void)
246 /* setup bus-width (8 or 16) */
247 if (eb_nand_data
.bus_width_16
)
248 eb_nand_smc_config
.mode
|= AT91_SMC_DBW_16
;
250 eb_nand_smc_config
.mode
|= AT91_SMC_DBW_8
;
252 /* configure chip-select 3 (NAND) */
253 sam9_smc_configure(3, &eb_nand_smc_config
);
255 at91_add_device_nand(&eb_nand_data
);
262 static struct resource rtc_resources
[] = {
264 .start
= AT572D940HF_ID_IRQ1
,
265 .end
= AT572D940HF_ID_IRQ1
,
266 .flags
= IORESOURCE_IRQ
,
270 static struct ds1305_platform_data ds1306_data
= {
275 static struct spi_board_info eb_spi_devices
[] = {
276 { /* RTC Dallas DS1306 */
277 .modalias
= "rtc-ds1305",
279 .mode
= SPI_CS_HIGH
| SPI_CPOL
| SPI_CPHA
,
280 .max_speed_hz
= 500000,
282 .irq
= AT572D940HF_ID_IRQ1
,
283 .platform_data
= (void *) &ds1306_data
,
285 #if defined(CONFIG_MTD_AT91_DATAFLASH_CARD)
286 { /* Dataflash card */
287 .modalias
= "mtd_dataflash",
289 .max_speed_hz
= 15 * 1000 * 1000,
295 static void __init
eb_board_init(void)
298 at91_add_device_serial();
300 at91_add_device_usbh(&eb_usbh_data
);
302 at91_add_device_udc(&eb_udc_data
);
304 at91_add_device_i2c(NULL
, 0);
308 eb_add_device_nand();
310 at91_add_device_spi(eb_spi_devices
, ARRAY_SIZE(eb_spi_devices
));
312 at91_add_device_mmc(0, &eb_mmc_data
);
314 at91_add_device_eth(&eb_eth_data
);
316 at91_add_device_mAgic();
319 MACHINE_START(AT572D940HFEB
, "Atmel AT91D940HF-EB")
320 /* Maintainer: Atmel <costa.antonior@gmail.com> */
321 .boot_params
= AT91_SDRAM_BASE
+ 0x100,
322 .timer
= &at91sam926x_timer
,
324 .init_irq
= eb_init_irq
,
325 .init_machine
= eb_board_init
,