aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-at91/board-usb-a926x.c
diff options
context:
space:
mode:
authorNico Erfurth <ne@erfurth.eu>2011-08-30 12:25:52 -0400
committerNicolas Ferre <nicolas.ferre@atmel.com>2011-09-07 10:33:56 -0400
commit6939fd49787e233fd0d7640a4de72815bc8c649a (patch)
treee8caeb5c0532f990a073df7cbaba9fdd6254341a /arch/arm/mach-at91/board-usb-a926x.c
parent82cb86548259a71c154b1c2df728d8526b79846a (diff)
at91: merge board USB-A9260 and USB-A9263 together
Merge boards together as they are barely the same. Signed-off-by: Nico Erfurth <ne@erfurth.eu> Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> [nicolas.ferre@atmel.com: updated to new machine_desc structure] Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com> Cc: Gregory Hermant <gregory.hermant@calao-systems.com>
Diffstat (limited to 'arch/arm/mach-at91/board-usb-a926x.c')
-rw-r--r--arch/arm/mach-at91/board-usb-a926x.c290
1 files changed, 290 insertions, 0 deletions
diff --git a/arch/arm/mach-at91/board-usb-a926x.c b/arch/arm/mach-at91/board-usb-a926x.c
new file mode 100644
index 000000000000..b9b9847fa55d
--- /dev/null
+++ b/arch/arm/mach-at91/board-usb-a926x.c
@@ -0,0 +1,290 @@
1/*
2 * linux/arch/arm/mach-at91/board-usb-a926x.c
3 *
4 * Copyright (C) 2005 SAN People
5 * Copyright (C) 2007 Atmel Corporation.
6 * Copyright (C) 2007 Calao-systems
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 */
22
23#include <linux/types.h>
24#include <linux/init.h>
25#include <linux/mm.h>
26#include <linux/module.h>
27#include <linux/platform_device.h>
28#include <linux/spi/spi.h>
29#include <linux/gpio_keys.h>
30#include <linux/input.h>
31
32#include <asm/setup.h>
33#include <asm/mach-types.h>
34#include <asm/irq.h>
35
36#include <asm/mach/arch.h>
37#include <asm/mach/map.h>
38#include <asm/mach/irq.h>
39
40#include <mach/hardware.h>
41#include <mach/board.h>
42#include <mach/gpio.h>
43#include <mach/at91sam9_smc.h>
44#include <mach/at91_shdwc.h>
45
46#include "sam9_smc.h"
47#include "generic.h"
48
49
50static void __init ek_init_early(void)
51{
52 /* Initialize processor: 12.00 MHz crystal */
53 at91_initialize(12000000);
54
55 /* DBGU on ttyS0. (Rx & Tx only) */
56 at91_register_uart(0, 0, 0);
57
58 /* set serial console to ttyS0 (ie, DBGU) */
59 at91_set_serial_console(0);
60}
61
62/*
63 * USB Host port
64 */
65static struct at91_usbh_data __initdata ek_usbh_data = {
66 .ports = 2,
67};
68
69/*
70 * USB Device port
71 */
72static struct at91_udc_data __initdata ek_udc_data = {
73 .vbus_pin = AT91_PIN_PB11,
74 .pullup_pin = 0, /* pull-up driven by UDC */
75};
76
77void ek_add_device_udc(void)
78{
79 if (machine_is_usb_a9260())
80 ek_udc_data.vbus_pin = AT91_PIN_PC5;
81
82 at91_add_device_udc(&ek_udc_data);
83}
84
85/*
86 * SPI devices.
87 */
88static struct spi_board_info ek_spi_devices[] = {
89#if !defined(CONFIG_MMC_AT91)
90 { /* DataFlash chip */
91 .modalias = "mtd_dataflash",
92 .chip_select = 0,
93 .max_speed_hz = 15 * 1000 * 1000,
94 .bus_num = 0,
95 }
96#endif
97};
98
99void ek_add_device_spi(void)
100{
101 if (machine_is_usb_a9263())
102 at91_add_device_spi(ek_spi_devices, ARRAY_SIZE(ek_spi_devices));
103}
104
105/*
106 * MACB Ethernet device
107 */
108static struct at91_eth_data __initdata ek_macb_data = {
109 .phy_irq_pin = AT91_PIN_PE31,
110 .is_rmii = 1,
111};
112
113void ek_add_device_eth(void)
114{
115 if (machine_is_usb_a9260())
116 ek_macb_data.phy_irq_pin = AT91_PIN_PA31;
117
118 at91_add_device_eth(&ek_macb_data);
119}
120
121/*
122 * NAND flash
123 */
124static struct mtd_partition __initdata ek_nand_partition[] = {
125 {
126 .name = "Uboot & Kernel",
127 .offset = 0,
128 .size = SZ_16M,
129 },
130 {
131 .name = "Root FS",
132 .offset = MTDPART_OFS_NXTBLK,
133 .size = 120 * SZ_1M,
134 },
135 {
136 .name = "FS",
137 .offset = MTDPART_OFS_NXTBLK,
138 .size = 120 * SZ_1M,
139 }
140};
141
142static struct mtd_partition * __init nand_partitions(int size, int *num_partitions)
143{
144 *num_partitions = ARRAY_SIZE(ek_nand_partition);
145 return ek_nand_partition;
146}
147
148static struct atmel_nand_data __initdata ek_nand_data = {
149 .ale = 21,
150 .cle = 22,
151// .det_pin = ... not connected
152 .rdy_pin = AT91_PIN_PA22,
153 .enable_pin = AT91_PIN_PD15,
154 .partition_info = nand_partitions,
155};
156
157static struct sam9_smc_config __initdata ek_nand_smc_config = {
158 .ncs_read_setup = 0,
159 .nrd_setup = 1,
160 .ncs_write_setup = 0,
161 .nwe_setup = 1,
162
163 .ncs_read_pulse = 3,
164 .nrd_pulse = 3,
165 .ncs_write_pulse = 3,
166 .nwe_pulse = 3,
167
168 .read_cycle = 5,
169 .write_cycle = 5,
170
171 .mode = AT91_SMC_READMODE | AT91_SMC_WRITEMODE | AT91_SMC_EXNWMODE_DISABLE | AT91_SMC_DBW_8,
172 .tdf_cycles = 2,
173};
174
175static void __init ek_add_device_nand(void)
176{
177 if (machine_is_usb_a9260()) {
178 ek_nand_data.rdy_pin = AT91_PIN_PC13;
179 ek_nand_data.enable_pin = AT91_PIN_PC14;
180 }
181
182 /* configure chip-select 3 (NAND) */
183 sam9_smc_configure(3, &ek_nand_smc_config);
184
185 at91_add_device_nand(&ek_nand_data);
186}
187
188
189/*
190 * GPIO Buttons
191 */
192#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
193static struct gpio_keys_button ek_buttons[] = {
194 { /* USER PUSH BUTTON */
195 .code = KEY_ENTER,
196 .gpio = AT91_PIN_PB10,
197 .active_low = 1,
198 .desc = "user_pb",
199 .wakeup = 1,
200 }
201};
202
203static struct gpio_keys_platform_data ek_button_data = {
204 .buttons = ek_buttons,
205 .nbuttons = ARRAY_SIZE(ek_buttons),
206};
207
208static struct platform_device ek_button_device = {
209 .name = "gpio-keys",
210 .id = -1,
211 .num_resources = 0,
212 .dev = {
213 .platform_data = &ek_button_data,
214 }
215};
216
217static void __init ek_add_device_buttons(void)
218{
219 at91_set_GPIO_periph(AT91_PIN_PB10, 1); /* user push button, pull up enabled */
220 at91_set_deglitch(AT91_PIN_PB10, 1);
221
222 platform_device_register(&ek_button_device);
223}
224#else
225static void __init ek_add_device_buttons(void) {}
226#endif
227
228/*
229 * LEDs
230 */
231static struct gpio_led ek_leds[] = {
232 { /* user_led (green) */
233 .name = "user_led",
234 .gpio = AT91_PIN_PB21,
235 .active_low = 1,
236 .default_trigger = "heartbeat",
237 }
238};
239
240void ek_add_device_leds(void)
241{
242 if (machine_is_usb_a9260())
243 ek_leds[0].active_low = 0;
244
245 at91_gpio_leds(ek_leds, ARRAY_SIZE(ek_leds));
246}
247
248
249static void __init ek_board_init(void)
250{
251 /* Serial */
252 at91_add_device_serial();
253 /* USB Host */
254 at91_add_device_usbh(&ek_usbh_data);
255 /* USB Device */
256 ek_add_device_udc();
257 /* SPI */
258 ek_add_device_spi();
259 /* Ethernet */
260 ek_add_device_eth();
261 /* NAND */
262 ek_add_device_nand();
263 /* I2C */
264 at91_add_device_i2c(NULL, 0);
265 /* Push Buttons */
266 ek_add_device_buttons();
267 /* LEDs */
268 ek_add_device_leds();
269 /* shutdown controller, wakeup button (5 msec low) */
270 at91_sys_write(AT91_SHDW_MR, AT91_SHDW_CPTWK0_(10) | AT91_SHDW_WKMODE0_LOW
271 | AT91_SHDW_RTTWKEN);
272}
273
274MACHINE_START(USB_A9263, "CALAO USB_A9263")
275 /* Maintainer: calao-systems */
276 .timer = &at91sam926x_timer,
277 .map_io = at91_map_io,
278 .init_early = ek_init_early,
279 .init_irq = at91_init_irq_default,
280 .init_machine = ek_board_init,
281MACHINE_END
282
283MACHINE_START(USB_A9260, "CALAO USB_A9260")
284 /* Maintainer: calao-systems */
285 .timer = &at91sam926x_timer,
286 .map_io = at91_map_io,
287 .init_early = ek_init_early,
288 .init_irq = at91_init_irq_default,
289 .init_machine = ek_board_init,
290MACHINE_END