aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-at91
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
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')
-rw-r--r--arch/arm/mach-at91/Makefile4
-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)56
3 files changed, 52 insertions, 238 deletions
diff --git a/arch/arm/mach-at91/Makefile b/arch/arm/mach-at91/Makefile
index ecd6479208c5..0b1b3793bbc6 100644
--- a/arch/arm/mach-at91/Makefile
+++ b/arch/arm/mach-at91/Makefile
@@ -42,7 +42,7 @@ obj-$(CONFIG_MACH_RSI_EWS) += board-rsi-ews.o
42obj-$(CONFIG_MACH_AT91SAM9260EK) += board-sam9260ek.o 42obj-$(CONFIG_MACH_AT91SAM9260EK) += board-sam9260ek.o
43obj-$(CONFIG_MACH_CAM60) += board-cam60.o 43obj-$(CONFIG_MACH_CAM60) += board-cam60.o
44obj-$(CONFIG_MACH_SAM9_L9260) += board-sam9-l9260.o 44obj-$(CONFIG_MACH_SAM9_L9260) += board-sam9-l9260.o
45obj-$(CONFIG_MACH_USB_A9260) += board-usb-a9260.o 45obj-$(CONFIG_MACH_USB_A9260) += board-usb-a926x.o
46obj-$(CONFIG_MACH_QIL_A9260) += board-qil-a9260.o 46obj-$(CONFIG_MACH_QIL_A9260) += board-qil-a9260.o
47obj-$(CONFIG_MACH_AFEB9260) += board-afeb-9260v1.o 47obj-$(CONFIG_MACH_AFEB9260) += board-afeb-9260v1.o
48obj-$(CONFIG_MACH_CPU9260) += board-cpu9krea.o 48obj-$(CONFIG_MACH_CPU9260) += board-cpu9krea.o
@@ -54,7 +54,7 @@ obj-$(CONFIG_MACH_AT91SAM9G10EK) += board-sam9261ek.o
54 54
55# AT91SAM9263 board-specific support 55# AT91SAM9263 board-specific support
56obj-$(CONFIG_MACH_AT91SAM9263EK) += board-sam9263ek.o 56obj-$(CONFIG_MACH_AT91SAM9263EK) += board-sam9263ek.o
57obj-$(CONFIG_MACH_USB_A9263) += board-usb-a9263.o 57obj-$(CONFIG_MACH_USB_A9263) += board-usb-a926x.o
58obj-$(CONFIG_MACH_NEOCORE926) += board-neocore926.o 58obj-$(CONFIG_MACH_NEOCORE926) += board-neocore926.o
59 59
60# AT91SAM9RL board-specific support 60# AT91SAM9RL board-specific support
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 8c4c1a02c4be..000000000000
--- 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/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#include <linux/clk.h>
32
33#include <asm/setup.h>
34#include <asm/mach-types.h>
35#include <asm/irq.h>
36
37#include <asm/mach/arch.h>
38#include <asm/mach/map.h>
39#include <asm/mach/irq.h>
40
41#include <mach/hardware.h>
42#include <mach/board.h>
43#include <mach/gpio.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 25e793782a4e..b9b9847fa55d 100644
--- a/arch/arm/mach-at91/board-usb-a9263.c
+++ b/arch/arm/mach-at91/board-usb-a926x.c
@@ -1,5 +1,5 @@
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.
@@ -74,6 +74,14 @@ static struct at91_udc_data __initdata ek_udc_data = {
74 .pullup_pin = 0, /* pull-up driven by UDC */ 74 .pullup_pin = 0, /* pull-up driven by UDC */
75}; 75};
76 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
77/* 85/*
78 * SPI devices. 86 * SPI devices.
79 */ 87 */
@@ -88,6 +96,12 @@ static struct spi_board_info ek_spi_devices[] = {
88#endif 96#endif
89}; 97};
90 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
91/* 105/*
92 * MACB Ethernet device 106 * MACB Ethernet device
93 */ 107 */
@@ -96,12 +110,20 @@ static struct at91_eth_data __initdata ek_macb_data = {
96 .is_rmii = 1, 110 .is_rmii = 1,
97}; 111};
98 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
99/* 121/*
100 * NAND flash 122 * NAND flash
101 */ 123 */
102static struct mtd_partition __initdata ek_nand_partition[] = { 124static struct mtd_partition __initdata ek_nand_partition[] = {
103 { 125 {
104 .name = "Linux Kernel", 126 .name = "Uboot & Kernel",
105 .offset = 0, 127 .offset = 0,
106 .size = SZ_16M, 128 .size = SZ_16M,
107 }, 129 },
@@ -152,6 +174,11 @@ static struct sam9_smc_config __initdata ek_nand_smc_config = {
152 174
153static void __init ek_add_device_nand(void) 175static void __init ek_add_device_nand(void)
154{ 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
155 /* configure chip-select 3 (NAND) */ 182 /* configure chip-select 3 (NAND) */
156 sam9_smc_configure(3, &ek_nand_smc_config); 183 sam9_smc_configure(3, &ek_nand_smc_config);
157 184
@@ -210,6 +237,14 @@ static struct gpio_led ek_leds[] = {
210 } 237 }
211}; 238};
212 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
213 248
214static void __init ek_board_init(void) 249static void __init ek_board_init(void)
215{ 250{
@@ -218,11 +253,11 @@ static void __init ek_board_init(void)
218 /* USB Host */ 253 /* USB Host */
219 at91_add_device_usbh(&ek_usbh_data); 254 at91_add_device_usbh(&ek_usbh_data);
220 /* USB Device */ 255 /* USB Device */
221 at91_add_device_udc(&ek_udc_data); 256 ek_add_device_udc();
222 /* SPI */ 257 /* SPI */
223 at91_add_device_spi(ek_spi_devices, ARRAY_SIZE(ek_spi_devices)); 258 ek_add_device_spi();
224 /* Ethernet */ 259 /* Ethernet */
225 at91_add_device_eth(&ek_macb_data); 260 ek_add_device_eth();
226 /* NAND */ 261 /* NAND */
227 ek_add_device_nand(); 262 ek_add_device_nand();
228 /* I2C */ 263 /* I2C */
@@ -230,7 +265,7 @@ static void __init ek_board_init(void)
230 /* Push Buttons */ 265 /* Push Buttons */
231 ek_add_device_buttons(); 266 ek_add_device_buttons();
232 /* LEDs */ 267 /* LEDs */
233 at91_gpio_leds(ek_leds, ARRAY_SIZE(ek_leds)); 268 ek_add_device_leds();
234 /* shutdown controller, wakeup button (5 msec low) */ 269 /* shutdown controller, wakeup button (5 msec low) */
235 at91_sys_write(AT91_SHDW_MR, AT91_SHDW_CPTWK0_(10) | AT91_SHDW_WKMODE0_LOW 270 at91_sys_write(AT91_SHDW_MR, AT91_SHDW_CPTWK0_(10) | AT91_SHDW_WKMODE0_LOW
236 | AT91_SHDW_RTTWKEN); 271 | AT91_SHDW_RTTWKEN);
@@ -244,3 +279,12 @@ MACHINE_START(USB_A9263, "CALAO USB_A9263")
244 .init_irq = at91_init_irq_default, 279 .init_irq = at91_init_irq_default,
245 .init_machine = ek_board_init, 280 .init_machine = ek_board_init,
246MACHINE_END 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