]>
Commit | Line | Data |
---|---|---|
e6d92e63 AV |
1 | /* |
2 | * linux/arch/arm/mach-at91/board-sam9263ek.c | |
3 | * | |
4 | * Copyright (C) 2005 SAN People | |
5 | * Copyright (C) 2007 Atmel Corporation. | |
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> | |
7c73628f | 28 | #include <linux/spi/ads7846.h> |
e6d92e63 AV |
29 | |
30 | #include <asm/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 <asm/arch/board.h> | |
40 | #include <asm/arch/gpio.h> | |
41 | #include <asm/arch/at91sam926x_mc.h> | |
42 | ||
43 | #include "generic.h" | |
44 | ||
45 | ||
46 | /* | |
47 | * Serial port configuration. | |
48 | * 0 .. 2 = USART0 .. USART2 | |
49 | * 3 = DBGU | |
50 | */ | |
51 | static struct at91_uart_config __initdata ek_uart_config = { | |
52 | .console_tty = 0, /* ttyS0 */ | |
53 | .nr_tty = 2, | |
54 | .tty_map = { 3, 0, -1, -1, } /* ttyS0, ..., ttyS3 */ | |
55 | }; | |
56 | ||
57 | static void __init ek_map_io(void) | |
58 | { | |
59 | /* Initialize processor: 16.367 MHz crystal */ | |
60 | at91sam9263_initialize(16367660); | |
61 | ||
62 | /* Setup the serial ports and console */ | |
63 | at91_init_serial(&ek_uart_config); | |
64 | } | |
65 | ||
66 | static void __init ek_init_irq(void) | |
67 | { | |
68 | at91sam9263_init_interrupts(NULL); | |
69 | } | |
70 | ||
71 | ||
72 | /* | |
73 | * USB Host port | |
74 | */ | |
75 | static struct at91_usbh_data __initdata ek_usbh_data = { | |
76 | .ports = 2, | |
77 | .vbus_pin = { AT91_PIN_PA24, AT91_PIN_PA21 }, | |
78 | }; | |
79 | ||
80 | /* | |
81 | * USB Device port | |
82 | */ | |
83 | static struct at91_udc_data __initdata ek_udc_data = { | |
84 | .vbus_pin = AT91_PIN_PA25, | |
85 | .pullup_pin = 0, /* pull-up driven by UDC */ | |
86 | }; | |
87 | ||
88 | ||
7c73628f AV |
89 | /* |
90 | * ADS7846 Touchscreen | |
91 | */ | |
92 | #if defined(CONFIG_TOUCHSCREEN_ADS7846) || defined(CONFIG_TOUCHSCREEN_ADS7846_MODULE) | |
93 | static int ads7843_pendown_state(void) | |
94 | { | |
95 | return !at91_get_gpio_value(AT91_PIN_PA15); /* Touchscreen PENIRQ */ | |
96 | } | |
97 | ||
98 | static struct ads7846_platform_data ads_info = { | |
99 | .model = 7843, | |
100 | .x_min = 150, | |
101 | .x_max = 3830, | |
102 | .y_min = 190, | |
103 | .y_max = 3830, | |
104 | .vref_delay_usecs = 100, | |
105 | .x_plate_ohms = 450, | |
106 | .y_plate_ohms = 250, | |
107 | .pressure_max = 15000, | |
108 | .debounce_max = 1, | |
109 | .debounce_rep = 0, | |
110 | .debounce_tol = (~0), | |
111 | .get_pendown_state = ads7843_pendown_state, | |
112 | }; | |
113 | ||
114 | static void __init ek_add_device_ts(void) | |
115 | { | |
116 | at91_set_B_periph(AT91_PIN_PA15, 1); /* External IRQ1, with pullup */ | |
117 | at91_set_gpio_input(AT91_PIN_PA31, 1); /* Touchscreen BUSY signal */ | |
118 | } | |
119 | #else | |
120 | static void __init ek_add_device_ts(void) {} | |
121 | #endif | |
122 | ||
e6d92e63 AV |
123 | /* |
124 | * SPI devices. | |
125 | */ | |
126 | static struct spi_board_info ek_spi_devices[] = { | |
127 | #if defined(CONFIG_MTD_AT91_DATAFLASH_CARD) | |
128 | { /* DataFlash card */ | |
129 | .modalias = "mtd_dataflash", | |
130 | .chip_select = 0, | |
131 | .max_speed_hz = 15 * 1000 * 1000, | |
132 | .bus_num = 0, | |
133 | }, | |
134 | #endif | |
7c73628f AV |
135 | #if defined(CONFIG_TOUCHSCREEN_ADS7846) || defined(CONFIG_TOUCHSCREEN_ADS7846_MODULE) |
136 | { | |
137 | .modalias = "ads7846", | |
138 | .chip_select = 3, | |
139 | .max_speed_hz = 125000 * 26, /* (max sample rate @ 3V) * (cmd + data + overhead) */ | |
140 | .bus_num = 0, | |
141 | .platform_data = &ads_info, | |
142 | .irq = AT91SAM9263_ID_IRQ1, | |
143 | }, | |
144 | #endif | |
e6d92e63 AV |
145 | }; |
146 | ||
147 | ||
148 | /* | |
149 | * MCI (SD/MMC) | |
150 | */ | |
151 | static struct at91_mmc_data __initdata ek_mmc_data = { | |
152 | .wire4 = 1, | |
153 | .det_pin = AT91_PIN_PE18, | |
154 | .wp_pin = AT91_PIN_PE19, | |
155 | // .vcc_pin = ... not connected | |
156 | }; | |
157 | ||
158 | ||
93afa752 AV |
159 | /* |
160 | * MACB Ethernet device | |
161 | */ | |
162 | static struct at91_eth_data __initdata ek_macb_data = { | |
163 | .is_rmii = 1, | |
164 | }; | |
165 | ||
166 | ||
e6d92e63 AV |
167 | /* |
168 | * NAND flash | |
169 | */ | |
170 | static struct mtd_partition __initdata ek_nand_partition[] = { | |
171 | { | |
172 | .name = "Partition 1", | |
173 | .offset = 0, | |
174 | .size = 64 * 1024 * 1024, | |
175 | }, | |
176 | { | |
177 | .name = "Partition 2", | |
178 | .offset = 64 * 1024 * 1024, | |
179 | .size = MTDPART_SIZ_FULL, | |
180 | }, | |
181 | }; | |
182 | ||
cdea4606 | 183 | static struct mtd_partition * __init nand_partitions(int size, int *num_partitions) |
e6d92e63 AV |
184 | { |
185 | *num_partitions = ARRAY_SIZE(ek_nand_partition); | |
186 | return ek_nand_partition; | |
187 | } | |
188 | ||
189 | static struct at91_nand_data __initdata ek_nand_data = { | |
190 | .ale = 21, | |
191 | .cle = 22, | |
192 | // .det_pin = ... not connected | |
193 | .rdy_pin = AT91_PIN_PA22, | |
194 | .enable_pin = AT91_PIN_PD15, | |
195 | .partition_info = nand_partitions, | |
196 | #if defined(CONFIG_MTD_NAND_AT91_BUSWIDTH_16) | |
197 | .bus_width_16 = 1, | |
198 | #else | |
199 | .bus_width_16 = 0, | |
200 | #endif | |
201 | }; | |
202 | ||
203 | ||
93afa752 AV |
204 | /* |
205 | * AC97 | |
206 | */ | |
207 | static struct atmel_ac97_data ek_ac97_data = { | |
208 | .reset_pin = AT91_PIN_PA13, | |
209 | }; | |
210 | ||
211 | ||
e6d92e63 AV |
212 | static void __init ek_board_init(void) |
213 | { | |
214 | /* Serial */ | |
215 | at91_add_device_serial(); | |
216 | /* USB Host */ | |
217 | at91_add_device_usbh(&ek_usbh_data); | |
218 | /* USB Device */ | |
219 | at91_add_device_udc(&ek_udc_data); | |
220 | /* SPI */ | |
7c73628f | 221 | at91_set_gpio_output(AT91_PIN_PE20, 1); /* select spi0 clock */ |
e6d92e63 | 222 | at91_add_device_spi(ek_spi_devices, ARRAY_SIZE(ek_spi_devices)); |
7c73628f AV |
223 | /* Touchscreen */ |
224 | ek_add_device_ts(); | |
e6d92e63 AV |
225 | /* MMC */ |
226 | at91_add_device_mmc(1, &ek_mmc_data); | |
93afa752 AV |
227 | /* Ethernet */ |
228 | at91_add_device_eth(&ek_macb_data); | |
e6d92e63 AV |
229 | /* NAND */ |
230 | at91_add_device_nand(&ek_nand_data); | |
93afa752 AV |
231 | /* I2C */ |
232 | at91_add_device_i2c(); | |
233 | /* AC97 */ | |
234 | at91_add_device_ac97(&ek_ac97_data); | |
e6d92e63 AV |
235 | } |
236 | ||
237 | MACHINE_START(AT91SAM9263EK, "Atmel AT91SAM9263-EK") | |
238 | /* Maintainer: Atmel */ | |
239 | .phys_io = AT91_BASE_SYS, | |
240 | .io_pg_offst = (AT91_VA_BASE_SYS >> 18) & 0xfffc, | |
241 | .boot_params = AT91_SDRAM_BASE + 0x100, | |
242 | .timer = &at91sam926x_timer, | |
243 | .map_io = ek_map_io, | |
244 | .init_irq = ek_init_irq, | |
245 | .init_machine = ek_board_init, | |
246 | MACHINE_END |