aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-at91
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mach-at91')
-rw-r--r--arch/arm/mach-at91/Kconfig13
-rw-r--r--arch/arm/mach-at91/Makefile6
-rw-r--r--arch/arm/mach-at91/board-rsi-ews.c233
-rw-r--r--arch/arm/mach-at91/board-usb-a9260.c230
-rw-r--r--arch/arm/mach-at91/board-usb-a926x.c (renamed from arch/arm/mach-at91/board-usb-a9263.c)181
-rw-r--r--arch/arm/mach-at91/include/mach/timex.h5
6 files changed, 414 insertions, 254 deletions
diff --git a/arch/arm/mach-at91/Kconfig b/arch/arm/mach-at91/Kconfig
index 22484670e7b..04a85c546ab 100644
--- a/arch/arm/mach-at91/Kconfig
+++ b/arch/arm/mach-at91/Kconfig
@@ -182,6 +182,11 @@ config MACH_ECO920
182 help 182 help
183 Select this if you are using the eco920 board 183 Select this if you are using the eco920 board
184 184
185config MACH_RSI_EWS
186 bool "RSI Embedded Webserver"
187 depends on ARCH_AT91RM9200
188 help
189 Select this if you are using RSIs EWS board.
185endif 190endif
186 191
187# ---------------------------------------------------------- 192# ----------------------------------------------------------
@@ -381,6 +386,14 @@ config MACH_GSIA18S
381 This enables support for the GS_IA18_S board 386 This enables support for the GS_IA18_S board
382 produced by GeoSIG Ltd company. This is an internet accelerograph. 387 produced by GeoSIG Ltd company. This is an internet accelerograph.
383 <http://www.geosig.com> 388 <http://www.geosig.com>
389
390config MACH_USB_A9G20
391 bool "CALAO USB-A9G20"
392 depends on ARCH_AT91SAM9G20
393 help
394 Select this if you are using a Calao Systems USB-A9G20.
395 <http://www.calao-systems.com>
396
384endif 397endif
385 398
386if (ARCH_AT91SAM9260 || ARCH_AT91SAM9G20) 399if (ARCH_AT91SAM9260 || ARCH_AT91SAM9G20)
diff --git a/arch/arm/mach-at91/Makefile b/arch/arm/mach-at91/Makefile
index bf57e8b1c9d..d992dd5d932 100644
--- a/arch/arm/mach-at91/Makefile
+++ b/arch/arm/mach-at91/Makefile
@@ -36,12 +36,13 @@ obj-$(CONFIG_MACH_ECBAT91) += board-ecbat91.o
36obj-$(CONFIG_MACH_YL9200) += board-yl-9200.o 36obj-$(CONFIG_MACH_YL9200) += board-yl-9200.o
37obj-$(CONFIG_MACH_CPUAT91) += board-cpuat91.o 37obj-$(CONFIG_MACH_CPUAT91) += board-cpuat91.o
38obj-$(CONFIG_MACH_ECO920) += board-eco920.o 38obj-$(CONFIG_MACH_ECO920) += board-eco920.o
39obj-$(CONFIG_MACH_RSI_EWS) += board-rsi-ews.o
39 40
40# AT91SAM9260 board-specific support 41# AT91SAM9260 board-specific support
41obj-$(CONFIG_MACH_AT91SAM9260EK) += board-sam9260ek.o 42obj-$(CONFIG_MACH_AT91SAM9260EK) += board-sam9260ek.o
42obj-$(CONFIG_MACH_CAM60) += board-cam60.o 43obj-$(CONFIG_MACH_CAM60) += board-cam60.o
43obj-$(CONFIG_MACH_SAM9_L9260) += board-sam9-l9260.o 44obj-$(CONFIG_MACH_SAM9_L9260) += board-sam9-l9260.o
44obj-$(CONFIG_MACH_USB_A9260) += board-usb-a9260.o 45obj-$(CONFIG_MACH_USB_A9260) += board-usb-a926x.o
45obj-$(CONFIG_MACH_QIL_A9260) += board-qil-a9260.o 46obj-$(CONFIG_MACH_QIL_A9260) += board-qil-a9260.o
46obj-$(CONFIG_MACH_AFEB9260) += board-afeb-9260v1.o 47obj-$(CONFIG_MACH_AFEB9260) += board-afeb-9260v1.o
47obj-$(CONFIG_MACH_CPU9260) += board-cpu9krea.o 48obj-$(CONFIG_MACH_CPU9260) += board-cpu9krea.o
@@ -53,7 +54,7 @@ obj-$(CONFIG_MACH_AT91SAM9G10EK) += board-sam9261ek.o
53 54
54# AT91SAM9263 board-specific support 55# AT91SAM9263 board-specific support
55obj-$(CONFIG_MACH_AT91SAM9263EK) += board-sam9263ek.o 56obj-$(CONFIG_MACH_AT91SAM9263EK) += board-sam9263ek.o
56obj-$(CONFIG_MACH_USB_A9263) += board-usb-a9263.o 57obj-$(CONFIG_MACH_USB_A9263) += board-usb-a926x.o
57obj-$(CONFIG_MACH_NEOCORE926) += board-neocore926.o 58obj-$(CONFIG_MACH_NEOCORE926) += board-neocore926.o
58 59
59# AT91SAM9RL board-specific support 60# AT91SAM9RL board-specific support
@@ -67,6 +68,7 @@ obj-$(CONFIG_MACH_STAMP9G20) += board-stamp9g20.o
67obj-$(CONFIG_MACH_PORTUXG20) += board-stamp9g20.o 68obj-$(CONFIG_MACH_PORTUXG20) += board-stamp9g20.o
68obj-$(CONFIG_MACH_PCONTROL_G20) += board-pcontrol-g20.o board-stamp9g20.o 69obj-$(CONFIG_MACH_PCONTROL_G20) += board-pcontrol-g20.o board-stamp9g20.o
69obj-$(CONFIG_MACH_GSIA18S) += board-gsia18s.o board-stamp9g20.o 70obj-$(CONFIG_MACH_GSIA18S) += board-gsia18s.o board-stamp9g20.o
71obj-$(CONFIG_MACH_USB_A9G20) += board-usb-a926x.o
70 72
71# AT91SAM9260/AT91SAM9G20 board-specific support 73# AT91SAM9260/AT91SAM9G20 board-specific support
72obj-$(CONFIG_MACH_SNAPPER_9260) += board-snapper9260.o 74obj-$(CONFIG_MACH_SNAPPER_9260) += board-snapper9260.o
diff --git a/arch/arm/mach-at91/board-rsi-ews.c b/arch/arm/mach-at91/board-rsi-ews.c
new file mode 100644
index 00000000000..e927df0175d
--- /dev/null
+++ b/arch/arm/mach-at91/board-rsi-ews.c
@@ -0,0 +1,233 @@
1/*
2 * board-rsi-ews.c
3 *
4 * Copyright (C)
5 * 2005 SAN People,
6 * 2008-2011 R-S-I Elektrotechnik GmbH & Co. KG
7 *
8 * Licensed under GPLv2 or later.
9 */
10
11#include <linux/types.h>
12#include <linux/init.h>
13#include <linux/mm.h>
14#include <linux/module.h>
15#include <linux/platform_device.h>
16#include <linux/spi/spi.h>
17#include <linux/mtd/physmap.h>
18
19#include <asm/setup.h>
20#include <asm/mach-types.h>
21#include <asm/irq.h>
22
23#include <asm/mach/arch.h>
24#include <asm/mach/map.h>
25#include <asm/mach/irq.h>
26
27#include <mach/hardware.h>
28#include <mach/board.h>
29
30#include <linux/gpio.h>
31
32#include "generic.h"
33
34static void __init rsi_ews_init_early(void)
35{
36 /* Initialize processor: 18.432 MHz crystal */
37 at91_initialize(18432000);
38
39 /* Setup the LEDs */
40 at91_init_leds(AT91_PIN_PB6, AT91_PIN_PB9);
41
42 /* DBGU on ttyS0. (Rx & Tx only) */
43 /* This one is for debugging */
44 at91_register_uart(0, 0, 0);
45
46 /* USART1 on ttyS2. (Rx, Tx, CTS, RTS, DTR, DSR, DCD, RI) */
47 /* Dialin/-out modem interface */
48 at91_register_uart(AT91RM9200_ID_US1, 2, ATMEL_UART_CTS | ATMEL_UART_RTS
49 | ATMEL_UART_DTR | ATMEL_UART_DSR | ATMEL_UART_DCD
50 | ATMEL_UART_RI);
51
52 /* USART3 on ttyS4. (Rx, Tx, RTS) */
53 /* RS485 communication */
54 at91_register_uart(AT91RM9200_ID_US3, 4, ATMEL_UART_RTS);
55
56 /* set serial console to ttyS0 (ie, DBGU) */
57 at91_set_serial_console(0);
58}
59
60/*
61 * Ethernet
62 */
63static struct at91_eth_data rsi_ews_eth_data __initdata = {
64 .phy_irq_pin = AT91_PIN_PC4,
65 .is_rmii = 1,
66};
67
68/*
69 * USB Host
70 */
71static struct at91_usbh_data rsi_ews_usbh_data __initdata = {
72 .ports = 1,
73};
74
75/*
76 * SD/MC
77 */
78static struct at91_mmc_data rsi_ews_mmc_data __initdata = {
79 .slot_b = 0,
80 .wire4 = 1,
81 .det_pin = AT91_PIN_PB27,
82 .wp_pin = AT91_PIN_PB29,
83};
84
85/*
86 * I2C
87 */
88static struct i2c_board_info rsi_ews_i2c_devices[] __initdata = {
89 {
90 I2C_BOARD_INFO("ds1337", 0x68),
91 },
92 {
93 I2C_BOARD_INFO("24c01", 0x50),
94 }
95};
96
97/*
98 * LEDs
99 */
100static struct gpio_led rsi_ews_leds[] = {
101 {
102 .name = "led0",
103 .gpio = AT91_PIN_PB6,
104 .active_low = 0,
105 },
106 {
107 .name = "led1",
108 .gpio = AT91_PIN_PB7,
109 .active_low = 0,
110 },
111 {
112 .name = "led2",
113 .gpio = AT91_PIN_PB8,
114 .active_low = 0,
115 },
116 {
117 .name = "led3",
118 .gpio = AT91_PIN_PB9,
119 .active_low = 0,
120 },
121};
122
123/*
124 * DataFlash
125 */
126static struct spi_board_info rsi_ews_spi_devices[] = {
127 { /* DataFlash chip 1*/
128 .modalias = "mtd_dataflash",
129 .chip_select = 0,
130 .max_speed_hz = 5 * 1000 * 1000,
131 },
132 { /* DataFlash chip 2*/
133 .modalias = "mtd_dataflash",
134 .chip_select = 1,
135 .max_speed_hz = 5 * 1000 * 1000,
136 },
137};
138
139/*
140 * NOR flash
141 */
142static struct mtd_partition rsiews_nor_partitions[] = {
143 {
144 .name = "boot",
145 .offset = 0,
146 .size = 3 * SZ_128K,
147 .mask_flags = MTD_WRITEABLE
148 },
149 {
150 .name = "kernel",
151 .offset = MTDPART_OFS_NXTBLK,
152 .size = SZ_2M - (3 * SZ_128K)
153 },
154 {
155 .name = "root",
156 .offset = MTDPART_OFS_NXTBLK,
157 .size = SZ_8M
158 },
159 {
160 .name = "kernelupd",
161 .offset = MTDPART_OFS_NXTBLK,
162 .size = 3 * SZ_512K,
163 .mask_flags = MTD_WRITEABLE
164 },
165 {
166 .name = "rootupd",
167 .offset = MTDPART_OFS_NXTBLK,
168 .size = 9 * SZ_512K,
169 .mask_flags = MTD_WRITEABLE
170 },
171};
172
173static struct physmap_flash_data rsiews_nor_data = {
174 .width = 2,
175 .parts = rsiews_nor_partitions,
176 .nr_parts = ARRAY_SIZE(rsiews_nor_partitions),
177};
178
179#define NOR_BASE AT91_CHIPSELECT_0
180#define NOR_SIZE SZ_16M
181
182static struct resource nor_flash_resources[] = {
183 {
184 .start = NOR_BASE,
185 .end = NOR_BASE + NOR_SIZE - 1,
186 .flags = IORESOURCE_MEM,
187 }
188};
189
190static struct platform_device rsiews_nor_flash = {
191 .name = "physmap-flash",
192 .id = 0,
193 .dev = {
194 .platform_data = &rsiews_nor_data,
195 },
196 .resource = nor_flash_resources,
197 .num_resources = ARRAY_SIZE(nor_flash_resources),
198};
199
200/*
201 * Init Func
202 */
203static void __init rsi_ews_board_init(void)
204{
205 /* Serial */
206 at91_add_device_serial();
207 at91_set_gpio_output(AT91_PIN_PA21, 0);
208 /* Ethernet */
209 at91_add_device_eth(&rsi_ews_eth_data);
210 /* USB Host */
211 at91_add_device_usbh(&rsi_ews_usbh_data);
212 /* I2C */
213 at91_add_device_i2c(rsi_ews_i2c_devices,
214 ARRAY_SIZE(rsi_ews_i2c_devices));
215 /* SPI */
216 at91_add_device_spi(rsi_ews_spi_devices,
217 ARRAY_SIZE(rsi_ews_spi_devices));
218 /* MMC */
219 at91_add_device_mmc(0, &rsi_ews_mmc_data);
220 /* NOR Flash */
221 platform_device_register(&rsiews_nor_flash);
222 /* LEDs */
223 at91_gpio_leds(rsi_ews_leds, ARRAY_SIZE(rsi_ews_leds));
224}
225
226MACHINE_START(RSI_EWS, "RSI EWS")
227 /* Maintainer: Josef Holzmayr <holzmayr@rsi-elektrotechnik.de> */
228 .timer = &at91rm9200_timer,
229 .map_io = at91_map_io,
230 .init_early = rsi_ews_init_early,
231 .init_irq = at91_init_irq_default,
232 .init_machine = rsi_ews_board_init,
233MACHINE_END
diff --git a/arch/arm/mach-at91/board-usb-a9260.c b/arch/arm/mach-at91/board-usb-a9260.c
deleted file mode 100644
index bac9b65cf55..00000000000
--- a/arch/arm/mach-at91/board-usb-a9260.c
+++ /dev/null
@@ -1,230 +0,0 @@
1/*
2 * linux/arch/arm/mach-at91/board-usb-a9260.c
3 *
4 * Copyright (C) 2005 SAN People
5 * Copyright (C) 2006 Atmel
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/gpio.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/input.h>
32#include <linux/clk.h>
33
34#include <asm/setup.h>
35#include <asm/mach-types.h>
36#include <asm/irq.h>
37
38#include <asm/mach/arch.h>
39#include <asm/mach/map.h>
40#include <asm/mach/irq.h>
41
42#include <mach/hardware.h>
43#include <mach/board.h>
44#include <mach/at91sam9_smc.h>
45#include <mach/at91_shdwc.h>
46
47#include "sam9_smc.h"
48#include "generic.h"
49
50
51static void __init ek_init_early(void)
52{
53 /* Initialize processor: 12.000 MHz crystal */
54 at91_initialize(12000000);
55
56 /* DBGU on ttyS0. (Rx & Tx only) */
57 at91_register_uart(0, 0, 0);
58
59 /* set serial console to ttyS0 (ie, DBGU) */
60 at91_set_serial_console(0);
61}
62
63/*
64 * USB Host port
65 */
66static struct at91_usbh_data __initdata ek_usbh_data = {
67 .ports = 2,
68};
69
70/*
71 * USB Device port
72 */
73static struct at91_udc_data __initdata ek_udc_data = {
74 .vbus_pin = AT91_PIN_PC5,
75 .pullup_pin = 0, /* pull-up driven by UDC */
76};
77
78/*
79 * MACB Ethernet device
80 */
81static struct at91_eth_data __initdata ek_macb_data = {
82 .phy_irq_pin = AT91_PIN_PA31,
83 .is_rmii = 1,
84};
85
86/*
87 * NAND flash
88 */
89static struct mtd_partition __initdata ek_nand_partition[] = {
90 {
91 .name = "Uboot & Kernel",
92 .offset = 0,
93 .size = SZ_16M,
94 },
95 {
96 .name = "Root FS",
97 .offset = MTDPART_OFS_NXTBLK,
98 .size = 120 * SZ_1M,
99 },
100 {
101 .name = "FS",
102 .offset = MTDPART_OFS_NXTBLK,
103 .size = 120 * SZ_1M,
104 }
105};
106
107static struct mtd_partition * __init nand_partitions(int size, int *num_partitions)
108{
109 *num_partitions = ARRAY_SIZE(ek_nand_partition);
110 return ek_nand_partition;
111}
112
113static struct atmel_nand_data __initdata ek_nand_data = {
114 .ale = 21,
115 .cle = 22,
116// .det_pin = ... not connected
117 .rdy_pin = AT91_PIN_PC13,
118 .enable_pin = AT91_PIN_PC14,
119 .partition_info = nand_partitions,
120};
121
122static struct sam9_smc_config __initdata ek_nand_smc_config = {
123 .ncs_read_setup = 0,
124 .nrd_setup = 1,
125 .ncs_write_setup = 0,
126 .nwe_setup = 1,
127
128 .ncs_read_pulse = 3,
129 .nrd_pulse = 3,
130 .ncs_write_pulse = 3,
131 .nwe_pulse = 3,
132
133 .read_cycle = 5,
134 .write_cycle = 5,
135
136 .mode = AT91_SMC_READMODE | AT91_SMC_WRITEMODE | AT91_SMC_EXNWMODE_DISABLE | AT91_SMC_DBW_8,
137 .tdf_cycles = 2,
138};
139
140static void __init ek_add_device_nand(void)
141{
142 /* configure chip-select 3 (NAND) */
143 sam9_smc_configure(3, &ek_nand_smc_config);
144
145 at91_add_device_nand(&ek_nand_data);
146}
147
148/*
149 * GPIO Buttons
150 */
151
152#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
153static struct gpio_keys_button ek_buttons[] = {
154 { /* USER PUSH BUTTON */
155 .code = KEY_ENTER,
156 .gpio = AT91_PIN_PB10,
157 .active_low = 1,
158 .desc = "user_pb",
159 .wakeup = 1,
160 }
161};
162
163static struct gpio_keys_platform_data ek_button_data = {
164 .buttons = ek_buttons,
165 .nbuttons = ARRAY_SIZE(ek_buttons),
166};
167
168static struct platform_device ek_button_device = {
169 .name = "gpio-keys",
170 .id = -1,
171 .num_resources = 0,
172 .dev = {
173 .platform_data = &ek_button_data,
174 }
175};
176
177static void __init ek_add_device_buttons(void)
178{
179 at91_set_GPIO_periph(AT91_PIN_PB10, 1); /* user push button, pull up enabled */
180 at91_set_deglitch(AT91_PIN_PB10, 1);
181
182 platform_device_register(&ek_button_device);
183}
184#else
185static void __init ek_add_device_buttons(void) {}
186#endif
187
188/*
189 * LEDs
190 */
191static struct gpio_led ek_leds[] = {
192 { /* user_led (green) */
193 .name = "user_led",
194 .gpio = AT91_PIN_PB21,
195 .active_low = 0,
196 .default_trigger = "heartbeat",
197 }
198};
199
200static void __init ek_board_init(void)
201{
202 /* Serial */
203 at91_add_device_serial();
204 /* USB Host */
205 at91_add_device_usbh(&ek_usbh_data);
206 /* USB Device */
207 at91_add_device_udc(&ek_udc_data);
208 /* NAND */
209 ek_add_device_nand();
210 /* I2C */
211 at91_add_device_i2c(NULL, 0);
212 /* Ethernet */
213 at91_add_device_eth(&ek_macb_data);
214 /* Push Buttons */
215 ek_add_device_buttons();
216 /* LEDs */
217 at91_gpio_leds(ek_leds, ARRAY_SIZE(ek_leds));
218 /* shutdown controller, wakeup button (5 msec low) */
219 at91_sys_write(AT91_SHDW_MR, AT91_SHDW_CPTWK0_(10) | AT91_SHDW_WKMODE0_LOW
220 | AT91_SHDW_RTTWKEN);
221}
222
223MACHINE_START(USB_A9260, "CALAO USB_A9260")
224 /* Maintainer: calao-systems */
225 .timer = &at91sam926x_timer,
226 .map_io = at91_map_io,
227 .init_early = ek_init_early,
228 .init_irq = at91_init_irq_default,
229 .init_machine = ek_board_init,
230MACHINE_END
diff --git a/arch/arm/mach-at91/board-usb-a9263.c b/arch/arm/mach-at91/board-usb-a926x.c
index 5bd735787d6..5852d3d9890 100644
--- a/arch/arm/mach-at91/board-usb-a9263.c
+++ b/arch/arm/mach-at91/board-usb-a926x.c
@@ -1,9 +1,10 @@
1/* 1/*
2 * linux/arch/arm/mach-at91/board-usb-a9263.c 2 * linux/arch/arm/mach-at91/board-usb-a926x.c
3 * 3 *
4 * Copyright (C) 2005 SAN People 4 * Copyright (C) 2005 SAN People
5 * Copyright (C) 2007 Atmel Corporation. 5 * Copyright (C) 2007 Atmel Corporation.
6 * Copyright (C) 2007 Calao-systems 6 * Copyright (C) 2007 Calao-systems
7 * Copyright (C) 2011 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
7 * 8 *
8 * This program is free software; you can redistribute it and/or modify 9 * 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 * it under the terms of the GNU General Public License as published by
@@ -21,14 +22,15 @@
21 */ 22 */
22 23
23#include <linux/types.h> 24#include <linux/types.h>
24#include <linux/gpio.h>
25#include <linux/init.h> 25#include <linux/init.h>
26#include <linux/mm.h> 26#include <linux/mm.h>
27#include <linux/module.h> 27#include <linux/module.h>
28#include <linux/platform_device.h> 28#include <linux/platform_device.h>
29#include <linux/spi/spi.h> 29#include <linux/spi/spi.h>
30#include <linux/gpio_keys.h> 30#include <linux/gpio_keys.h>
31#include <linux/gpio.h>
31#include <linux/input.h> 32#include <linux/input.h>
33#include <linux/spi/mmc_spi.h>
32 34
33#include <asm/setup.h> 35#include <asm/setup.h>
34#include <asm/mach-types.h> 36#include <asm/mach-types.h>
@@ -74,10 +76,42 @@ static struct at91_udc_data __initdata ek_udc_data = {
74 .pullup_pin = 0, /* pull-up driven by UDC */ 76 .pullup_pin = 0, /* pull-up driven by UDC */
75}; 77};
76 78
79static void __init ek_add_device_udc(void)
80{
81 if (machine_is_usb_a9260() || machine_is_usb_a9g20())
82 ek_udc_data.vbus_pin = AT91_PIN_PC5;
83
84 at91_add_device_udc(&ek_udc_data);
85}
86
87#if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)
88#define MMC_SPI_CARD_DETECT_INT AT91_PIN_PC4
89static int at91_mmc_spi_init(struct device *dev,
90 irqreturn_t (*detect_int)(int, void *), void *data)
91{
92 /* Configure Interrupt pin as input, no pull-up */
93 at91_set_gpio_input(MMC_SPI_CARD_DETECT_INT, 0);
94 return request_irq(gpio_to_irq(MMC_SPI_CARD_DETECT_INT), detect_int,
95 IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING,
96 "mmc-spi-detect", data);
97}
98
99static void at91_mmc_spi_exit(struct device *dev, void *data)
100{
101 free_irq(gpio_to_irq(MMC_SPI_CARD_DETECT_INT), data);
102}
103
104static struct mmc_spi_platform_data at91_mmc_spi_pdata = {
105 .init = at91_mmc_spi_init,
106 .exit = at91_mmc_spi_exit,
107 .detect_delay = 100, /* msecs */
108};
109#endif
110
77/* 111/*
78 * SPI devices. 112 * SPI devices.
79 */ 113 */
80static struct spi_board_info ek_spi_devices[] = { 114static struct spi_board_info usb_a9263_spi_devices[] = {
81#if !defined(CONFIG_MMC_AT91) 115#if !defined(CONFIG_MMC_AT91)
82 { /* DataFlash chip */ 116 { /* DataFlash chip */
83 .modalias = "mtd_dataflash", 117 .modalias = "mtd_dataflash",
@@ -88,6 +122,27 @@ static struct spi_board_info ek_spi_devices[] = {
88#endif 122#endif
89}; 123};
90 124
125static struct spi_board_info usb_a9g20_spi_devices[] = {
126#if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)
127 {
128 .modalias = "mmc_spi",
129 .max_speed_hz = 20000000, /* max spi clock (SCK) speed in HZ */
130 .bus_num = 1,
131 .chip_select = 0,
132 .platform_data = &at91_mmc_spi_pdata,
133 .mode = SPI_MODE_3,
134 },
135#endif
136};
137
138static void __init ek_add_device_spi(void)
139{
140 if (machine_is_usb_a9263())
141 at91_add_device_spi(usb_a9263_spi_devices, ARRAY_SIZE(usb_a9263_spi_devices));
142 else if (machine_is_usb_a9g20())
143 at91_add_device_spi(usb_a9g20_spi_devices, ARRAY_SIZE(usb_a9g20_spi_devices));
144}
145
91/* 146/*
92 * MACB Ethernet device 147 * MACB Ethernet device
93 */ 148 */
@@ -96,24 +151,42 @@ static struct at91_eth_data __initdata ek_macb_data = {
96 .is_rmii = 1, 151 .is_rmii = 1,
97}; 152};
98 153
154static void __init ek_add_device_eth(void)
155{
156 if (machine_is_usb_a9260() || machine_is_usb_a9g20())
157 ek_macb_data.phy_irq_pin = AT91_PIN_PA31;
158
159 at91_add_device_eth(&ek_macb_data);
160}
161
99/* 162/*
100 * NAND flash 163 * NAND flash
101 */ 164 */
102static struct mtd_partition __initdata ek_nand_partition[] = { 165static struct mtd_partition __initdata ek_nand_partition[] = {
103 { 166 {
104 .name = "Linux Kernel", 167 .name = "barebox",
105 .offset = 0, 168 .offset = 0,
106 .size = SZ_16M, 169 .size = 3 * SZ_128K,
107 }, 170 }, {
108 { 171 .name = "bareboxenv",
109 .name = "Root FS",
110 .offset = MTDPART_OFS_NXTBLK, 172 .offset = MTDPART_OFS_NXTBLK,
111 .size = 120 * SZ_1M, 173 .size = SZ_128K,
112 }, 174 }, {
113 { 175 .name = "bareboxenv2",
114 .name = "FS", 176 .offset = MTDPART_OFS_NXTBLK,
177 .size = SZ_128K,
178 }, {
179 .name = "kernel",
180 .offset = MTDPART_OFS_NXTBLK,
181 .size = 4 * SZ_1M,
182 }, {
183 .name = "rootfs",
115 .offset = MTDPART_OFS_NXTBLK, 184 .offset = MTDPART_OFS_NXTBLK,
116 .size = 120 * SZ_1M, 185 .size = 120 * SZ_1M,
186 }, {
187 .name = "data",
188 .offset = MTDPART_OFS_NXTBLK,
189 .size = MTDPART_SIZ_FULL,
117 } 190 }
118}; 191};
119 192
@@ -132,7 +205,7 @@ static struct atmel_nand_data __initdata ek_nand_data = {
132 .partition_info = nand_partitions, 205 .partition_info = nand_partitions,
133}; 206};
134 207
135static struct sam9_smc_config __initdata ek_nand_smc_config = { 208static struct sam9_smc_config __initdata usb_a9260_nand_smc_config = {
136 .ncs_read_setup = 0, 209 .ncs_read_setup = 0,
137 .nrd_setup = 1, 210 .nrd_setup = 1,
138 .ncs_write_setup = 0, 211 .ncs_write_setup = 0,
@@ -150,10 +223,36 @@ static struct sam9_smc_config __initdata ek_nand_smc_config = {
150 .tdf_cycles = 2, 223 .tdf_cycles = 2,
151}; 224};
152 225
226static struct sam9_smc_config __initdata usb_a9g20_nand_smc_config = {
227 .ncs_read_setup = 0,
228 .nrd_setup = 2,
229 .ncs_write_setup = 0,
230 .nwe_setup = 2,
231
232 .ncs_read_pulse = 4,
233 .nrd_pulse = 4,
234 .ncs_write_pulse = 4,
235 .nwe_pulse = 4,
236
237 .read_cycle = 7,
238 .write_cycle = 7,
239
240 .mode = AT91_SMC_READMODE | AT91_SMC_WRITEMODE | AT91_SMC_EXNWMODE_DISABLE | AT91_SMC_DBW_8,
241 .tdf_cycles = 3,
242};
243
153static void __init ek_add_device_nand(void) 244static void __init ek_add_device_nand(void)
154{ 245{
246 if (machine_is_usb_a9260() || machine_is_usb_a9g20()) {
247 ek_nand_data.rdy_pin = AT91_PIN_PC13;
248 ek_nand_data.enable_pin = AT91_PIN_PC14;
249 }
250
155 /* configure chip-select 3 (NAND) */ 251 /* configure chip-select 3 (NAND) */
156 sam9_smc_configure(3, &ek_nand_smc_config); 252 if (machine_is_usb_a9g20())
253 sam9_smc_configure(3, &usb_a9g20_nand_smc_config);
254 else
255 sam9_smc_configure(3, &usb_a9260_nand_smc_config);
157 256
158 at91_add_device_nand(&ek_nand_data); 257 at91_add_device_nand(&ek_nand_data);
159} 258}
@@ -210,6 +309,19 @@ static struct gpio_led ek_leds[] = {
210 } 309 }
211}; 310};
212 311
312static struct i2c_board_info __initdata ek_i2c_devices[] = {
313 {
314 I2C_BOARD_INFO("rv3029c2", 0x56),
315 },
316};
317
318static void __init ek_add_device_leds(void)
319{
320 if (machine_is_usb_a9260() || machine_is_usb_a9g20())
321 ek_leds[0].active_low = 0;
322
323 at91_gpio_leds(ek_leds, ARRAY_SIZE(ek_leds));
324}
213 325
214static void __init ek_board_init(void) 326static void __init ek_board_init(void)
215{ 327{
@@ -218,22 +330,29 @@ static void __init ek_board_init(void)
218 /* USB Host */ 330 /* USB Host */
219 at91_add_device_usbh(&ek_usbh_data); 331 at91_add_device_usbh(&ek_usbh_data);
220 /* USB Device */ 332 /* USB Device */
221 at91_add_device_udc(&ek_udc_data); 333 ek_add_device_udc();
222 /* SPI */ 334 /* SPI */
223 at91_add_device_spi(ek_spi_devices, ARRAY_SIZE(ek_spi_devices)); 335 ek_add_device_spi();
224 /* Ethernet */ 336 /* Ethernet */
225 at91_add_device_eth(&ek_macb_data); 337 ek_add_device_eth();
226 /* NAND */ 338 /* NAND */
227 ek_add_device_nand(); 339 ek_add_device_nand();
228 /* I2C */
229 at91_add_device_i2c(NULL, 0);
230 /* Push Buttons */ 340 /* Push Buttons */
231 ek_add_device_buttons(); 341 ek_add_device_buttons();
232 /* LEDs */ 342 /* LEDs */
233 at91_gpio_leds(ek_leds, ARRAY_SIZE(ek_leds)); 343 ek_add_device_leds();
234 /* shutdown controller, wakeup button (5 msec low) */ 344
235 at91_sys_write(AT91_SHDW_MR, AT91_SHDW_CPTWK0_(10) | AT91_SHDW_WKMODE0_LOW 345 if (machine_is_usb_a9g20()) {
346 /* I2C */
347 at91_add_device_i2c(ek_i2c_devices, ARRAY_SIZE(ek_i2c_devices));
348 } else {
349 /* I2C */
350 at91_add_device_i2c(NULL, 0);
351 /* shutdown controller, wakeup button (5 msec low) */
352 at91_sys_write(AT91_SHDW_MR, AT91_SHDW_CPTWK0_(10)
353 | AT91_SHDW_WKMODE0_LOW
236 | AT91_SHDW_RTTWKEN); 354 | AT91_SHDW_RTTWKEN);
355 }
237} 356}
238 357
239MACHINE_START(USB_A9263, "CALAO USB_A9263") 358MACHINE_START(USB_A9263, "CALAO USB_A9263")
@@ -244,3 +363,21 @@ MACHINE_START(USB_A9263, "CALAO USB_A9263")
244 .init_irq = at91_init_irq_default, 363 .init_irq = at91_init_irq_default,
245 .init_machine = ek_board_init, 364 .init_machine = ek_board_init,
246MACHINE_END 365MACHINE_END
366
367MACHINE_START(USB_A9260, "CALAO USB_A9260")
368 /* Maintainer: calao-systems */
369 .timer = &at91sam926x_timer,
370 .map_io = at91_map_io,
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 .timer = &at91sam926x_timer,
379 .map_io = at91_map_io,
380 .init_early = ek_init_early,
381 .init_irq = at91_init_irq_default,
382 .init_machine = ek_board_init,
383MACHINE_END
diff --git a/arch/arm/mach-at91/include/mach/timex.h b/arch/arm/mach-at91/include/mach/timex.h
index 31ac2d97f14..85820ad801c 100644
--- a/arch/arm/mach-at91/include/mach/timex.h
+++ b/arch/arm/mach-at91/include/mach/timex.h
@@ -64,7 +64,12 @@
64 64
65#elif defined(CONFIG_ARCH_AT91SAM9G20) 65#elif defined(CONFIG_ARCH_AT91SAM9G20)
66 66
67#if defined(CONFIG_MACH_USB_A9G20)
68#define AT91SAM9_MASTER_CLOCK 133000000
69#else
67#define AT91SAM9_MASTER_CLOCK 132096000 70#define AT91SAM9_MASTER_CLOCK 132096000
71#endif
72
68#define CLOCK_TICK_RATE (AT91SAM9_MASTER_CLOCK/16) 73#define CLOCK_TICK_RATE (AT91SAM9_MASTER_CLOCK/16)
69 74
70#elif defined(CONFIG_ARCH_AT91SAM9G45) 75#elif defined(CONFIG_ARCH_AT91SAM9G45)