aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-at91
diff options
context:
space:
mode:
authorOlof Johansson <olof@lixom.net>2013-06-01 03:38:04 -0400
committerOlof Johansson <olof@lixom.net>2013-06-01 03:38:04 -0400
commitfc20c6ffdd9875c42c9ff0d4233ed8960165633b (patch)
treea36b423c815efc859b833338a27b45011d4ad8c0 /arch/arm/mach-at91
parent3c09f4daeee83b76779dec766f57e9e883402bb1 (diff)
parent028633c238f91dc113520a7ad25d37b2ba9068af (diff)
Merge tag 'at91-dt' of git://github.com/at91linux/linux-at91 into next/dt
From Nicolas Ferre: Big DT-centric update for AT91: - Calao boards update, removal of one board C file and associated defconfig, Kconfig Makefile lines - several Acme boards updates - addition of watchdog, uart and pinctrl descriptions for several products - modification of RTC compatible string for 9x5 family * tag 'at91-dt' of git://github.com/at91linux/linux-at91: (21 commits) ARM: at91/dt: add pinctrl definition for at91 tc blocks ARM: at91/dts: add the watchdog nodes for at91 boards ARM: at91/dtsi: add the watchdog nodes for at91 SoC ARM: at91: drop non DT: Calao USB-A96x ARM: at91: dt: add Calao USB-A9G20 low power version ARM: at91: dt: usb-a9263: add dataflash support ARM: at91: dt: usb-a9263: update shutdown controller ARM: at91: dt: usb-a9260: update shutdown controller ARM: at91: dt: sam9260: add i2c gpio pinctrl ARM: at91: switch Fox G20 board .dts to pre-processor defines ARM: at91: add Acme Systems Fox G20 board ARM: at91/at91-ariag25.dts: UART0/1 nodes are disabled ARM: at91/at91sam9x5.dtsi: add UART0/1 nodes ARM: at91/at91-ariag25.dts: add RTC node ARM: at91: at91sam9x5 RTC is not compatible with at91rm9200 one ARM: at91: udpate defconfigs ARM: at91: dt: switch to standard IRQ flag defines ARM: at91: dt: switch to pinctrl to pre-processor ARM: at91: dt: add pinctrl pre-processor define ARM: at91: dt: switch to standard GPIO flag defines. ... Signed-off-by: Olof Johansson <olof@lixom.net>
Diffstat (limited to 'arch/arm/mach-at91')
-rw-r--r--arch/arm/mach-at91/Kconfig.non_dt162
-rw-r--r--arch/arm/mach-at91/Makefile5
-rw-r--r--arch/arm/mach-at91/board-sam9261ek.c28
-rw-r--r--arch/arm/mach-at91/board-usb-a926x.c384
4 files changed, 77 insertions, 502 deletions
diff --git a/arch/arm/mach-at91/Kconfig.non_dt b/arch/arm/mach-at91/Kconfig.non_dt
index 6c24985515a2..6cd554a4e73c 100644
--- a/arch/arm/mach-at91/Kconfig.non_dt
+++ b/arch/arm/mach-at91/Kconfig.non_dt
@@ -14,15 +14,11 @@ config ARCH_AT91RM9200
14 select SOC_AT91RM9200 14 select SOC_AT91RM9200
15 15
16config ARCH_AT91SAM9260 16config ARCH_AT91SAM9260
17 bool "AT91SAM9260 or AT91SAM9XE" 17 bool "AT91SAM9260 or AT91SAM9XE or AT91SAM9G20"
18 select SOC_AT91SAM9260 18 select SOC_AT91SAM9260
19 19
20config ARCH_AT91SAM9261 20config ARCH_AT91SAM9261
21 bool "AT91SAM9261" 21 bool "AT91SAM9261 or AT91SAM9G10"
22 select SOC_AT91SAM9261
23
24config ARCH_AT91SAM9G10
25 bool "AT91SAM9G10"
26 select SOC_AT91SAM9261 22 select SOC_AT91SAM9261
27 23
28config ARCH_AT91SAM9263 24config ARCH_AT91SAM9263
@@ -33,10 +29,6 @@ config ARCH_AT91SAM9RL
33 bool "AT91SAM9RL" 29 bool "AT91SAM9RL"
34 select SOC_AT91SAM9RL 30 select SOC_AT91SAM9RL
35 31
36config ARCH_AT91SAM9G20
37 bool "AT91SAM9G20"
38 select SOC_AT91SAM9260
39
40config ARCH_AT91SAM9G45 32config ARCH_AT91SAM9G45
41 bool "AT91SAM9G45" 33 bool "AT91SAM9G45"
42 select SOC_AT91SAM9G45 34 select SOC_AT91SAM9G45
@@ -50,6 +42,14 @@ config ARCH_AT91X40
50 42
51endchoice 43endchoice
52 44
45config ARCH_AT91SAM9G20
46 bool
47 select ARCH_AT91SAM9260
48
49config ARCH_AT91SAM9G10
50 bool
51 select ARCH_AT91SAM9261
52
53# ---------------------------------------------------------- 53# ----------------------------------------------------------
54 54
55if ARCH_AT91RM9200 55if ARCH_AT91RM9200
@@ -183,12 +183,6 @@ config MACH_AFEB9260
183 <svn://194.85.238.22/home/users/george/svn/arm9eb> 183 <svn://194.85.238.22/home/users/george/svn/arm9eb>
184 <http://groups.google.com/group/arm9fpga-evolution-board> 184 <http://groups.google.com/group/arm9fpga-evolution-board>
185 185
186config MACH_USB_A9260
187 bool "CALAO USB-A9260"
188 help
189 Select this if you are using a Calao Systems USB-A9260.
190 <http://www.calao-systems.com>
191
192config MACH_QIL_A9260 186config MACH_QIL_A9260
193 bool "CALAO QIL-A9260 board" 187 bool "CALAO QIL-A9260 board"
194 help 188 help
@@ -207,76 +201,6 @@ config MACH_FLEXIBITY
207 Select this if you are using Flexibity Connect board 201 Select this if you are using Flexibity Connect board
208 <http://www.flexibity.com> 202 <http://www.flexibity.com>
209 203
210endif
211
212# ----------------------------------------------------------
213
214if ARCH_AT91SAM9261
215
216comment "AT91SAM9261 Board Type"
217
218config MACH_AT91SAM9261EK
219 bool "Atmel AT91SAM9261-EK Evaluation Kit"
220 select HAVE_AT91_DATAFLASH_CARD
221 help
222 Select this if you are using Atmel's AT91SAM9261-EK Evaluation Kit.
223 <http://www.atmel.com/dyn/products/tools_card.asp?tool_id=3820>
224
225endif
226
227# ----------------------------------------------------------
228
229if ARCH_AT91SAM9G10
230
231comment "AT91SAM9G10 Board Type"
232
233config MACH_AT91SAM9G10EK
234 bool "Atmel AT91SAM9G10-EK Evaluation Kit"
235 select HAVE_AT91_DATAFLASH_CARD
236 help
237 Select this if you are using Atmel's AT91SAM9G10-EK Evaluation Kit.
238 <http://www.atmel.com/dyn/products/tools_card.asp?tool_id=4588>
239
240endif
241
242# ----------------------------------------------------------
243
244if ARCH_AT91SAM9263
245
246comment "AT91SAM9263 Board Type"
247
248config MACH_AT91SAM9263EK
249 bool "Atmel AT91SAM9263-EK Evaluation Kit"
250 select HAVE_AT91_DATAFLASH_CARD
251 help
252 Select this if you are using Atmel's AT91SAM9263-EK Evaluation Kit.
253 <http://www.atmel.com/dyn/products/tools_card.asp?tool_id=4057>
254
255config MACH_USB_A9263
256 bool "CALAO USB-A9263"
257 help
258 Select this if you are using a Calao Systems USB-A9263.
259 <http://www.calao-systems.com>
260
261endif
262
263# ----------------------------------------------------------
264
265if ARCH_AT91SAM9RL
266
267comment "AT91SAM9RL Board Type"
268
269config MACH_AT91SAM9RLEK
270 bool "Atmel AT91SAM9RL-EK Evaluation Kit"
271 help
272 Select this if you are using Atmel's AT91SAM9RL-EK Evaluation Kit.
273
274endif
275
276# ----------------------------------------------------------
277
278if ARCH_AT91SAM9G20
279
280comment "AT91SAM9G20 Board Type" 204comment "AT91SAM9G20 Board Type"
281 205
282config MACH_AT91SAM9G20EK 206config MACH_AT91SAM9G20EK
@@ -334,24 +258,64 @@ config MACH_GSIA18S
334 produced by GeoSIG Ltd company. This is an internet accelerograph. 258 produced by GeoSIG Ltd company. This is an internet accelerograph.
335 <http://www.geosig.com> 259 <http://www.geosig.com>
336 260
337config MACH_USB_A9G20 261config MACH_SNAPPER_9260
338 bool "CALAO USB-A9G20" 262 bool "Bluewater Systems Snapper 9260/9G20 module"
339 depends on ARCH_AT91SAM9G20
340 help 263 help
341 Select this if you are using a Calao Systems USB-A9G20. 264 Select this if you are using the Bluewater Systems Snapper 9260 or
342 <http://www.calao-systems.com> 265 Snapper 9G20 modules.
266 <http://www.bluewatersys.com/>
267endif
268
269# ----------------------------------------------------------
270
271if ARCH_AT91SAM9261
272
273comment "AT91SAM9261 Board Type"
274
275config MACH_AT91SAM9261EK
276 bool "Atmel AT91SAM9261-EK Evaluation Kit"
277 select HAVE_AT91_DATAFLASH_CARD
278 help
279 Select this if you are using Atmel's AT91SAM9261-EK Evaluation Kit.
280 <http://www.atmel.com/dyn/products/tools_card.asp?tool_id=3820>
281
282comment "AT91SAM9G10 Board Type"
283
284config MACH_AT91SAM9G10EK
285 bool "Atmel AT91SAM9G10-EK Evaluation Kit"
286 select HAVE_AT91_DATAFLASH_CARD
287 help
288 Select this if you are using Atmel's AT91SAM9G10-EK Evaluation Kit.
289 <http://www.atmel.com/dyn/products/tools_card.asp?tool_id=4588>
343 290
344endif 291endif
345 292
346if (ARCH_AT91SAM9260 || ARCH_AT91SAM9G20) 293# ----------------------------------------------------------
347comment "AT91SAM9260/AT91SAM9G20 boards" 294
295if ARCH_AT91SAM9263
296
297comment "AT91SAM9263 Board Type"
298
299config MACH_AT91SAM9263EK
300 bool "Atmel AT91SAM9263-EK Evaluation Kit"
301 select HAVE_AT91_DATAFLASH_CARD
302 help
303 Select this if you are using Atmel's AT91SAM9263-EK Evaluation Kit.
304 <http://www.atmel.com/dyn/products/tools_card.asp?tool_id=4057>
305
306endif
307
308# ----------------------------------------------------------
309
310if ARCH_AT91SAM9RL
311
312comment "AT91SAM9RL Board Type"
313
314config MACH_AT91SAM9RLEK
315 bool "Atmel AT91SAM9RL-EK Evaluation Kit"
316 help
317 Select this if you are using Atmel's AT91SAM9RL-EK Evaluation Kit.
348 318
349config MACH_SNAPPER_9260
350 bool "Bluewater Systems Snapper 9260/9G20 module"
351 help
352 Select this if you are using the Bluewater Systems Snapper 9260 or
353 Snapper 9G20 modules.
354 <http://www.bluewatersys.com/>
355endif 319endif
356 320
357# ---------------------------------------------------------- 321# ----------------------------------------------------------
diff --git a/arch/arm/mach-at91/Makefile b/arch/arm/mach-at91/Makefile
index 788562dccb43..d07bcfad4441 100644
--- a/arch/arm/mach-at91/Makefile
+++ b/arch/arm/mach-at91/Makefile
@@ -27,10 +27,8 @@ obj-$(CONFIG_SOC_SAMA5D3) += sama5d3.o
27obj-$(CONFIG_ARCH_AT91RM9200) += at91rm9200_devices.o 27obj-$(CONFIG_ARCH_AT91RM9200) += at91rm9200_devices.o
28obj-$(CONFIG_ARCH_AT91SAM9260) += at91sam9260_devices.o 28obj-$(CONFIG_ARCH_AT91SAM9260) += at91sam9260_devices.o
29obj-$(CONFIG_ARCH_AT91SAM9261) += at91sam9261_devices.o 29obj-$(CONFIG_ARCH_AT91SAM9261) += at91sam9261_devices.o
30obj-$(CONFIG_ARCH_AT91SAM9G10) += at91sam9261_devices.o
31obj-$(CONFIG_ARCH_AT91SAM9263) += at91sam9263_devices.o 30obj-$(CONFIG_ARCH_AT91SAM9263) += at91sam9263_devices.o
32obj-$(CONFIG_ARCH_AT91SAM9RL) += at91sam9rl_devices.o 31obj-$(CONFIG_ARCH_AT91SAM9RL) += at91sam9rl_devices.o
33obj-$(CONFIG_ARCH_AT91SAM9G20) += at91sam9260_devices.o
34obj-$(CONFIG_ARCH_AT91SAM9G45) += at91sam9g45_devices.o 32obj-$(CONFIG_ARCH_AT91SAM9G45) += at91sam9g45_devices.o
35obj-$(CONFIG_ARCH_AT91X40) += at91x40.o at91x40_time.o 33obj-$(CONFIG_ARCH_AT91X40) += at91x40.o at91x40_time.o
36 34
@@ -55,7 +53,6 @@ obj-$(CONFIG_MACH_RSI_EWS) += board-rsi-ews.o
55obj-$(CONFIG_MACH_AT91SAM9260EK) += board-sam9260ek.o 53obj-$(CONFIG_MACH_AT91SAM9260EK) += board-sam9260ek.o
56obj-$(CONFIG_MACH_CAM60) += board-cam60.o 54obj-$(CONFIG_MACH_CAM60) += board-cam60.o
57obj-$(CONFIG_MACH_SAM9_L9260) += board-sam9-l9260.o 55obj-$(CONFIG_MACH_SAM9_L9260) += board-sam9-l9260.o
58obj-$(CONFIG_MACH_USB_A9260) += board-usb-a926x.o
59obj-$(CONFIG_MACH_QIL_A9260) += board-qil-a9260.o 56obj-$(CONFIG_MACH_QIL_A9260) += board-qil-a9260.o
60obj-$(CONFIG_MACH_AFEB9260) += board-afeb-9260v1.o 57obj-$(CONFIG_MACH_AFEB9260) += board-afeb-9260v1.o
61obj-$(CONFIG_MACH_CPU9260) += board-cpu9krea.o 58obj-$(CONFIG_MACH_CPU9260) += board-cpu9krea.o
@@ -67,7 +64,6 @@ obj-$(CONFIG_MACH_AT91SAM9G10EK) += board-sam9261ek.o
67 64
68# AT91SAM9263 board-specific support 65# AT91SAM9263 board-specific support
69obj-$(CONFIG_MACH_AT91SAM9263EK) += board-sam9263ek.o 66obj-$(CONFIG_MACH_AT91SAM9263EK) += board-sam9263ek.o
70obj-$(CONFIG_MACH_USB_A9263) += board-usb-a926x.o
71 67
72# AT91SAM9RL board-specific support 68# AT91SAM9RL board-specific support
73obj-$(CONFIG_MACH_AT91SAM9RLEK) += board-sam9rlek.o 69obj-$(CONFIG_MACH_AT91SAM9RLEK) += board-sam9rlek.o
@@ -80,7 +76,6 @@ obj-$(CONFIG_MACH_STAMP9G20) += board-stamp9g20.o
80obj-$(CONFIG_MACH_PORTUXG20) += board-stamp9g20.o 76obj-$(CONFIG_MACH_PORTUXG20) += board-stamp9g20.o
81obj-$(CONFIG_MACH_PCONTROL_G20) += board-pcontrol-g20.o board-stamp9g20.o 77obj-$(CONFIG_MACH_PCONTROL_G20) += board-pcontrol-g20.o board-stamp9g20.o
82obj-$(CONFIG_MACH_GSIA18S) += board-gsia18s.o board-stamp9g20.o 78obj-$(CONFIG_MACH_GSIA18S) += board-gsia18s.o board-stamp9g20.o
83obj-$(CONFIG_MACH_USB_A9G20) += board-usb-a926x.o
84 79
85# AT91SAM9260/AT91SAM9G20 board-specific support 80# AT91SAM9260/AT91SAM9G20 board-specific support
86obj-$(CONFIG_MACH_SNAPPER_9260) += board-snapper9260.o 81obj-$(CONFIG_MACH_SNAPPER_9260) += board-snapper9260.o
diff --git a/arch/arm/mach-at91/board-sam9261ek.c b/arch/arm/mach-at91/board-sam9261ek.c
index b446645c7727..d3437624ca4e 100644
--- a/arch/arm/mach-at91/board-sam9261ek.c
+++ b/arch/arm/mach-at91/board-sam9261ek.c
@@ -264,11 +264,7 @@ static void __init ek_add_device_ts(void) {}
264 */ 264 */
265static struct at73c213_board_info at73c213_data = { 265static struct at73c213_board_info at73c213_data = {
266 .ssc_id = 1, 266 .ssc_id = 1,
267#if defined(CONFIG_MACH_AT91SAM9261EK) 267 .shortname = "AT91SAM9261/9G10-EK external DAC",
268 .shortname = "AT91SAM9261-EK external DAC",
269#else
270 .shortname = "AT91SAM9G10-EK external DAC",
271#endif
272}; 268};
273 269
274#if defined(CONFIG_SND_AT73C213) || defined(CONFIG_SND_AT73C213_MODULE) 270#if defined(CONFIG_SND_AT73C213) || defined(CONFIG_SND_AT73C213_MODULE)
@@ -412,9 +408,6 @@ static struct atmel_lcdfb_info __initdata ek_lcdc_data = {
412 .default_monspecs = &at91fb_default_stn_monspecs, 408 .default_monspecs = &at91fb_default_stn_monspecs,
413 .atmel_lcdfb_power_control = at91_lcdc_stn_power_control, 409 .atmel_lcdfb_power_control = at91_lcdc_stn_power_control,
414 .guard_time = 1, 410 .guard_time = 1,
415#if defined(CONFIG_MACH_AT91SAM9G10EK)
416 .lcd_wiring_mode = ATMEL_LCDC_WIRING_RGB,
417#endif
418}; 411};
419 412
420#else 413#else
@@ -468,9 +461,6 @@ static struct atmel_lcdfb_info __initdata ek_lcdc_data = {
468 .default_monspecs = &at91fb_default_tft_monspecs, 461 .default_monspecs = &at91fb_default_tft_monspecs,
469 .atmel_lcdfb_power_control = at91_lcdc_tft_power_control, 462 .atmel_lcdfb_power_control = at91_lcdc_tft_power_control,
470 .guard_time = 1, 463 .guard_time = 1,
471#if defined(CONFIG_MACH_AT91SAM9G10EK)
472 .lcd_wiring_mode = ATMEL_LCDC_WIRING_RGB,
473#endif
474}; 464};
475#endif 465#endif
476 466
@@ -574,6 +564,10 @@ static void __init ek_board_init(void)
574 /* DBGU on ttyS0. (Rx & Tx only) */ 564 /* DBGU on ttyS0. (Rx & Tx only) */
575 at91_register_uart(0, 0, 0); 565 at91_register_uart(0, 0, 0);
576 at91_add_device_serial(); 566 at91_add_device_serial();
567
568 if (cpu_is_at91sam9g10())
569 ek_lcdc_data.lcd_wiring_mode = ATMEL_LCDC_WIRING_RGB;
570
577 /* USB Host */ 571 /* USB Host */
578 at91_add_device_usbh(&ek_usbh_data); 572 at91_add_device_usbh(&ek_usbh_data);
579 /* USB Device */ 573 /* USB Device */
@@ -606,11 +600,17 @@ static void __init ek_board_init(void)
606 at91_gpio_leds(ek_leds, ARRAY_SIZE(ek_leds)); 600 at91_gpio_leds(ek_leds, ARRAY_SIZE(ek_leds));
607} 601}
608 602
609#if defined(CONFIG_MACH_AT91SAM9261EK)
610MACHINE_START(AT91SAM9261EK, "Atmel AT91SAM9261-EK") 603MACHINE_START(AT91SAM9261EK, "Atmel AT91SAM9261-EK")
611#else 604 /* Maintainer: Atmel */
605 .init_time = at91sam926x_pit_init,
606 .map_io = at91_map_io,
607 .handle_irq = at91_aic_handle_irq,
608 .init_early = ek_init_early,
609 .init_irq = at91_init_irq_default,
610 .init_machine = ek_board_init,
611MACHINE_END
612
612MACHINE_START(AT91SAM9G10EK, "Atmel AT91SAM9G10-EK") 613MACHINE_START(AT91SAM9G10EK, "Atmel AT91SAM9G10-EK")
613#endif
614 /* Maintainer: Atmel */ 614 /* Maintainer: Atmel */
615 .init_time = at91sam926x_pit_init, 615 .init_time = at91sam926x_pit_init,
616 .map_io = at91_map_io, 616 .map_io = at91_map_io,
diff --git a/arch/arm/mach-at91/board-usb-a926x.c b/arch/arm/mach-at91/board-usb-a926x.c
deleted file mode 100644
index 2487d944a1bc..000000000000
--- a/arch/arm/mach-at91/board-usb-a926x.c
+++ /dev/null
@@ -1,384 +0,0 @@
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 * Copyright (C) 2011 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 */
23
24#include <linux/types.h>
25#include <linux/init.h>
26#include <linux/mm.h>
27#include <linux/module.h>
28#include <linux/platform_device.h>
29#include <linux/spi/spi.h>
30#include <linux/gpio_keys.h>
31#include <linux/gpio.h>
32#include <linux/input.h>
33#include <linux/spi/mmc_spi.h>
34
35#include <asm/setup.h>
36#include <asm/mach-types.h>
37#include <asm/irq.h>
38
39#include <asm/mach/arch.h>
40#include <asm/mach/map.h>
41#include <asm/mach/irq.h>
42
43#include <mach/hardware.h>
44#include <mach/at91sam9_smc.h>
45
46#include "at91_aic.h"
47#include "at91_shdwc.h"
48#include "board.h"
49#include "sam9_smc.h"
50#include "generic.h"
51
52
53static void __init ek_init_early(void)
54{
55 /* Initialize processor: 12.00 MHz crystal */
56 at91_initialize(12000000);
57}
58
59/*
60 * USB Host port
61 */
62static struct at91_usbh_data __initdata ek_usbh_data = {
63 .ports = 2,
64 .vbus_pin = {-EINVAL, -EINVAL},
65 .overcurrent_pin= {-EINVAL, -EINVAL},
66};
67
68/*
69 * USB Device port
70 */
71static struct at91_udc_data __initdata ek_udc_data = {
72 .vbus_pin = AT91_PIN_PB11,
73 .pullup_pin = -EINVAL, /* pull-up driven by UDC */
74};
75
76static void __init ek_add_device_udc(void)
77{
78 if (machine_is_usb_a9260() || machine_is_usb_a9g20())
79 ek_udc_data.vbus_pin = AT91_PIN_PC5;
80
81 at91_add_device_udc(&ek_udc_data);
82}
83
84#if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)
85#define MMC_SPI_CARD_DETECT_INT AT91_PIN_PC4
86static int at91_mmc_spi_init(struct device *dev,
87 irqreturn_t (*detect_int)(int, void *), void *data)
88{
89 /* Configure Interrupt pin as input, no pull-up */
90 at91_set_gpio_input(MMC_SPI_CARD_DETECT_INT, 0);
91 return request_irq(gpio_to_irq(MMC_SPI_CARD_DETECT_INT), detect_int,
92 IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING,
93 "mmc-spi-detect", data);
94}
95
96static void at91_mmc_spi_exit(struct device *dev, void *data)
97{
98 free_irq(gpio_to_irq(MMC_SPI_CARD_DETECT_INT), data);
99}
100
101static struct mmc_spi_platform_data at91_mmc_spi_pdata = {
102 .init = at91_mmc_spi_init,
103 .exit = at91_mmc_spi_exit,
104 .detect_delay = 100, /* msecs */
105};
106#endif
107
108/*
109 * SPI devices.
110 */
111static struct spi_board_info usb_a9263_spi_devices[] = {
112 { /* DataFlash chip */
113 .modalias = "mtd_dataflash",
114 .chip_select = 0,
115 .max_speed_hz = 15 * 1000 * 1000,
116 .bus_num = 0,
117 }
118};
119
120static struct spi_board_info usb_a9g20_spi_devices[] = {
121#if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)
122 {
123 .modalias = "mmc_spi",
124 .max_speed_hz = 20000000, /* max spi clock (SCK) speed in HZ */
125 .bus_num = 1,
126 .chip_select = 0,
127 .platform_data = &at91_mmc_spi_pdata,
128 .mode = SPI_MODE_3,
129 },
130#endif
131};
132
133static void __init ek_add_device_spi(void)
134{
135 if (machine_is_usb_a9263())
136 at91_add_device_spi(usb_a9263_spi_devices, ARRAY_SIZE(usb_a9263_spi_devices));
137 else if (machine_is_usb_a9g20())
138 at91_add_device_spi(usb_a9g20_spi_devices, ARRAY_SIZE(usb_a9g20_spi_devices));
139}
140
141/*
142 * MACB Ethernet device
143 */
144static struct macb_platform_data __initdata ek_macb_data = {
145 .phy_irq_pin = AT91_PIN_PE31,
146 .is_rmii = 1,
147};
148
149static void __init ek_add_device_eth(void)
150{
151 if (machine_is_usb_a9260() || machine_is_usb_a9g20())
152 ek_macb_data.phy_irq_pin = AT91_PIN_PA31;
153
154 at91_add_device_eth(&ek_macb_data);
155}
156
157/*
158 * NAND flash
159 */
160static struct mtd_partition __initdata ek_nand_partition[] = {
161 {
162 .name = "barebox",
163 .offset = 0,
164 .size = 3 * SZ_128K,
165 }, {
166 .name = "bareboxenv",
167 .offset = MTDPART_OFS_NXTBLK,
168 .size = SZ_128K,
169 }, {
170 .name = "bareboxenv2",
171 .offset = MTDPART_OFS_NXTBLK,
172 .size = SZ_128K,
173 }, {
174 .name = "oftree",
175 .offset = MTDPART_OFS_NXTBLK,
176 .size = SZ_128K,
177 }, {
178 .name = "kernel",
179 .offset = MTDPART_OFS_NXTBLK,
180 .size = 4 * SZ_1M,
181 }, {
182 .name = "rootfs",
183 .offset = MTDPART_OFS_NXTBLK,
184 .size = 120 * SZ_1M,
185 }, {
186 .name = "data",
187 .offset = MTDPART_OFS_NXTBLK,
188 .size = MTDPART_SIZ_FULL,
189 }
190};
191
192static struct atmel_nand_data __initdata ek_nand_data = {
193 .ale = 21,
194 .cle = 22,
195 .det_pin = -EINVAL,
196 .rdy_pin = AT91_PIN_PA22,
197 .enable_pin = AT91_PIN_PD15,
198 .ecc_mode = NAND_ECC_SOFT,
199 .on_flash_bbt = 1,
200 .parts = ek_nand_partition,
201 .num_parts = ARRAY_SIZE(ek_nand_partition),
202};
203
204static struct sam9_smc_config __initdata usb_a9260_nand_smc_config = {
205 .ncs_read_setup = 0,
206 .nrd_setup = 1,
207 .ncs_write_setup = 0,
208 .nwe_setup = 1,
209
210 .ncs_read_pulse = 3,
211 .nrd_pulse = 3,
212 .ncs_write_pulse = 3,
213 .nwe_pulse = 3,
214
215 .read_cycle = 5,
216 .write_cycle = 5,
217
218 .mode = AT91_SMC_READMODE | AT91_SMC_WRITEMODE | AT91_SMC_EXNWMODE_DISABLE | AT91_SMC_DBW_8,
219 .tdf_cycles = 2,
220};
221
222static struct sam9_smc_config __initdata usb_a9g20_nand_smc_config = {
223 .ncs_read_setup = 0,
224 .nrd_setup = 2,
225 .ncs_write_setup = 0,
226 .nwe_setup = 2,
227
228 .ncs_read_pulse = 4,
229 .nrd_pulse = 4,
230 .ncs_write_pulse = 4,
231 .nwe_pulse = 4,
232
233 .read_cycle = 7,
234 .write_cycle = 7,
235
236 .mode = AT91_SMC_READMODE | AT91_SMC_WRITEMODE | AT91_SMC_EXNWMODE_DISABLE | AT91_SMC_DBW_8,
237 .tdf_cycles = 3,
238};
239
240static void __init ek_add_device_nand(void)
241{
242 if (machine_is_usb_a9260() || machine_is_usb_a9g20()) {
243 ek_nand_data.rdy_pin = AT91_PIN_PC13;
244 ek_nand_data.enable_pin = AT91_PIN_PC14;
245 }
246
247 /* configure chip-select 3 (NAND) */
248 if (machine_is_usb_a9g20())
249 sam9_smc_configure(0, 3, &usb_a9g20_nand_smc_config);
250 else
251 sam9_smc_configure(0, 3, &usb_a9260_nand_smc_config);
252
253 at91_add_device_nand(&ek_nand_data);
254}
255
256
257/*
258 * GPIO Buttons
259 */
260#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
261static struct gpio_keys_button ek_buttons[] = {
262 { /* USER PUSH BUTTON */
263 .code = KEY_ENTER,
264 .gpio = AT91_PIN_PB10,
265 .active_low = 1,
266 .desc = "user_pb",
267 .wakeup = 1,
268 }
269};
270
271static struct gpio_keys_platform_data ek_button_data = {
272 .buttons = ek_buttons,
273 .nbuttons = ARRAY_SIZE(ek_buttons),
274};
275
276static struct platform_device ek_button_device = {
277 .name = "gpio-keys",
278 .id = -1,
279 .num_resources = 0,
280 .dev = {
281 .platform_data = &ek_button_data,
282 }
283};
284
285static void __init ek_add_device_buttons(void)
286{
287 at91_set_GPIO_periph(AT91_PIN_PB10, 1); /* user push button, pull up enabled */
288 at91_set_deglitch(AT91_PIN_PB10, 1);
289
290 platform_device_register(&ek_button_device);
291}
292#else
293static void __init ek_add_device_buttons(void) {}
294#endif
295
296/*
297 * LEDs
298 */
299static struct gpio_led ek_leds[] = {
300 { /* user_led (green) */
301 .name = "user_led",
302 .gpio = AT91_PIN_PB21,
303 .active_low = 1,
304 .default_trigger = "heartbeat",
305 }
306};
307
308static struct i2c_board_info __initdata ek_i2c_devices[] = {
309 {
310 I2C_BOARD_INFO("rv3029c2", 0x56),
311 },
312};
313
314static void __init ek_add_device_leds(void)
315{
316 if (machine_is_usb_a9260() || machine_is_usb_a9g20())
317 ek_leds[0].active_low = 0;
318
319 at91_gpio_leds(ek_leds, ARRAY_SIZE(ek_leds));
320}
321
322static void __init ek_board_init(void)
323{
324 /* Serial */
325 /* DBGU on ttyS0. (Rx & Tx only) */
326 at91_register_uart(0, 0, 0);
327 at91_add_device_serial();
328 /* USB Host */
329 at91_add_device_usbh(&ek_usbh_data);
330 /* USB Device */
331 ek_add_device_udc();
332 /* SPI */
333 ek_add_device_spi();
334 /* Ethernet */
335 ek_add_device_eth();
336 /* NAND */
337 ek_add_device_nand();
338 /* Push Buttons */
339 ek_add_device_buttons();
340 /* LEDs */
341 ek_add_device_leds();
342
343 if (machine_is_usb_a9g20()) {
344 /* I2C */
345 at91_add_device_i2c(ek_i2c_devices, ARRAY_SIZE(ek_i2c_devices));
346 } else {
347 /* I2C */
348 at91_add_device_i2c(NULL, 0);
349 /* shutdown controller, wakeup button (5 msec low) */
350 at91_shdwc_write(AT91_SHDW_MR, AT91_SHDW_CPTWK0_(10)
351 | AT91_SHDW_WKMODE0_LOW
352 | AT91_SHDW_RTTWKEN);
353 }
354}
355
356MACHINE_START(USB_A9263, "CALAO USB_A9263")
357 /* Maintainer: calao-systems */
358 .init_time = at91sam926x_pit_init,
359 .map_io = at91_map_io,
360 .handle_irq = at91_aic_handle_irq,
361 .init_early = ek_init_early,
362 .init_irq = at91_init_irq_default,
363 .init_machine = ek_board_init,
364MACHINE_END
365
366MACHINE_START(USB_A9260, "CALAO USB_A9260")
367 /* Maintainer: calao-systems */
368 .init_time = at91sam926x_pit_init,
369 .map_io = at91_map_io,
370 .handle_irq = at91_aic_handle_irq,
371 .init_early = ek_init_early,
372 .init_irq = at91_init_irq_default,
373 .init_machine = ek_board_init,
374MACHINE_END
375
376MACHINE_START(USB_A9G20, "CALAO USB_A92G0")
377 /* Maintainer: Jean-Christophe PLAGNIOL-VILLARD */
378 .init_time = at91sam926x_pit_init,
379 .map_io = at91_map_io,
380 .handle_irq = at91_aic_handle_irq,
381 .init_early = ek_init_early,
382 .init_irq = at91_init_irq_default,
383 .init_machine = ek_board_init,
384MACHINE_END