Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/shaggy...
[pandora-kernel.git] / arch / arm / mach-at91rm9200 / board-sam9260ek.c
1 /*
2  * linux/arch/arm/mach-at91rm9200/board-ek.c
3  *
4  *  Copyright (C) 2005 SAN People
5  *  Copyright (C) 2006 Atmel
6  *
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.
11  *
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.
16  *
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
20  */
21
22 #include <linux/types.h>
23 #include <linux/init.h>
24 #include <linux/mm.h>
25 #include <linux/module.h>
26 #include <linux/platform_device.h>
27 #include <linux/spi/spi.h>
28
29 #include <asm/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 <asm/arch/board.h>
39 #include <asm/arch/gpio.h>
40 #include <asm/arch/at91sam926x_mc.h>
41
42 #include "generic.h"
43
44
45 /*
46  * Serial port configuration.
47  *    0 .. 5 = USART0 .. USART5
48  *    6      = DBGU
49  */
50 static struct at91_uart_config __initdata ek_uart_config = {
51         .console_tty    = 0,                            /* ttyS0 */
52         .nr_tty         = 3,
53         .tty_map        = { 6, 0, 1, -1, -1, -1, -1 }   /* ttyS0, ..., ttyS6 */
54 };
55
56 static void __init ek_map_io(void)
57 {
58         /* Initialize processor: 18.432 MHz crystal */
59         at91sam9260_initialize(18432000);
60
61         /* Setup the serial ports and console */
62         at91_init_serial(&ek_uart_config);
63 }
64
65 static void __init ek_init_irq(void)
66 {
67         at91sam9260_init_interrupts(NULL);
68 }
69
70
71 /*
72  * USB Host port
73  */
74 static struct at91_usbh_data __initdata ek_usbh_data = {
75         .ports          = 2,
76 };
77
78 /*
79  * USB Device port
80  */
81 static struct at91_udc_data __initdata ek_udc_data = {
82         .vbus_pin       = AT91_PIN_PC5,
83         .pullup_pin     = 0,            /* pull-up driven by UDC */
84 };
85
86
87 /*
88  * SPI devices.
89  */
90 static struct spi_board_info ek_spi_devices[] = {
91 #if !defined(CONFIG_MMC_AT91)
92         {       /* DataFlash chip */
93                 .modalias       = "mtd_dataflash",
94                 .chip_select    = 1,
95                 .max_speed_hz   = 15 * 1000 * 1000,
96                 .bus_num        = 0,
97         },
98 #if defined(CONFIG_MTD_AT91_DATAFLASH_CARD)
99         {       /* DataFlash card */
100                 .modalias       = "mtd_dataflash",
101                 .chip_select    = 0,
102                 .max_speed_hz   = 15 * 1000 * 1000,
103                 .bus_num        = 0,
104         },
105 #endif
106 #endif
107 #if defined(CONFIG_SND_AT73C213)
108         {       /* AT73C213 DAC */
109                 .modalias       = "snd_at73c213",
110                 .chip_select    = 0,
111                 .max_speed_hz   = 10 * 1000 * 1000,
112                 .bus_num        = 1,
113         },
114 #endif
115 };
116
117
118 /*
119  * MACB Ethernet device
120  */
121 static struct __initdata eth_platform_data ek_macb_data = {
122         .is_rmii        = 1,
123 };
124
125
126 /*
127  * NAND flash
128  */
129 static struct mtd_partition __initdata ek_nand_partition[] = {
130         {
131                 .name   = "Partition 1",
132                 .offset = 0,
133                 .size   = 256 * 1024,
134         },
135         {
136                 .name   = "Partition 2",
137                 .offset = 256 * 1024,
138                 .size   = MTDPART_SIZ_FULL,
139         },
140 };
141
142 static struct mtd_partition *nand_partitions(int size, int *num_partitions)
143 {
144         *num_partitions = ARRAY_SIZE(ek_nand_partition);
145         return ek_nand_partition;
146 }
147
148 static struct at91_nand_data __initdata ek_nand_data = {
149         .ale            = 21,
150         .cle            = 22,
151 //      .det_pin        = ... not connected
152         .rdy_pin        = AT91_PIN_PC13,
153         .enable_pin     = AT91_PIN_PC14,
154         .partition_info = nand_partitions,
155 #if defined(CONFIG_MTD_NAND_AT91_BUSWIDTH_16)
156         .bus_width_16   = 1,
157 #else
158         .bus_width_16   = 0,
159 #endif
160 };
161
162
163 /*
164  * MCI (SD/MMC)
165  */
166 static struct at91_mmc_data __initdata ek_mmc_data = {
167         .slot_b         = 1,
168         .wire4          = 1,
169 //      .det_pin        = ... not connected
170 //      .wp_pin         = ... not connected
171 //      .vcc_pin        = ... not connected
172 };
173
174 static void __init ek_board_init(void)
175 {
176         /* Serial */
177         at91_add_device_serial();
178         /* USB Host */
179         at91_add_device_usbh(&ek_usbh_data);
180         /* USB Device */
181         at91_add_device_udc(&ek_udc_data);
182         /* SPI */
183         at91_add_device_spi(ek_spi_devices, ARRAY_SIZE(ek_spi_devices));
184         /* NAND */
185         at91_add_device_nand(&ek_nand_data);
186         /* Ethernet */
187         at91_add_device_eth(&ek_macb_data);
188         /* MMC */
189         at91_add_device_mmc(&ek_mmc_data);
190 }
191
192 MACHINE_START(AT91SAM9260EK, "Atmel AT91SAM9260-EK")
193         /* Maintainer: Atmel */
194         .phys_io        = AT91_BASE_SYS,
195         .io_pg_offst    = (AT91_VA_BASE_SYS >> 18) & 0xfffc,
196         .boot_params    = AT91_SDRAM_BASE + 0x100,
197         .timer          = &at91sam926x_timer,
198         .map_io         = ek_map_io,
199         .init_irq       = ek_init_irq,
200         .init_machine   = ek_board_init,
201 MACHINE_END