aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-at91/board-sam9g20ek.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mach-at91/board-sam9g20ek.c')
-rw-r--r--arch/arm/mach-at91/board-sam9g20ek.c74
1 files changed, 66 insertions, 8 deletions
diff --git a/arch/arm/mach-at91/board-sam9g20ek.c b/arch/arm/mach-at91/board-sam9g20ek.c
index 6ea9808b886..ca8198b3c16 100644
--- a/arch/arm/mach-at91/board-sam9g20ek.c
+++ b/arch/arm/mach-at91/board-sam9g20ek.c
@@ -47,6 +47,18 @@
47#include "sam9_smc.h" 47#include "sam9_smc.h"
48#include "generic.h" 48#include "generic.h"
49 49
50/*
51 * board revision encoding
52 * bit 0:
53 * 0 => 1 sd/mmc slot
54 * 1 => 2 sd/mmc slots connectors (board from revision C)
55 */
56#define HAVE_2MMC (1 << 0)
57static int inline ek_have_2mmc(void)
58{
59 return machine_is_at91sam9g20ek_2mmc() || (system_rev & HAVE_2MMC);
60}
61
50 62
51static void __init ek_map_io(void) 63static void __init ek_map_io(void)
52{ 64{
@@ -94,7 +106,7 @@ static struct at91_udc_data __initdata ek_udc_data = {
94 * SPI devices. 106 * SPI devices.
95 */ 107 */
96static struct spi_board_info ek_spi_devices[] = { 108static struct spi_board_info ek_spi_devices[] = {
97#if !defined(CONFIG_MMC_AT91) 109#if !(defined(CONFIG_MMC_ATMELMCI) || defined(CONFIG_MMC_AT91))
98 { /* DataFlash chip */ 110 { /* DataFlash chip */
99 .modalias = "mtd_dataflash", 111 .modalias = "mtd_dataflash",
100 .chip_select = 1, 112 .chip_select = 1,
@@ -121,6 +133,13 @@ static struct at91_eth_data __initdata ek_macb_data = {
121 .is_rmii = 1, 133 .is_rmii = 1,
122}; 134};
123 135
136static void __init ek_add_device_macb(void)
137{
138 if (ek_have_2mmc())
139 ek_macb_data.phy_irq_pin = AT91_PIN_PB0;
140
141 at91_add_device_eth(&ek_macb_data);
142}
124 143
125/* 144/*
126 * NAND flash 145 * NAND flash
@@ -198,13 +217,36 @@ static void __init ek_add_device_nand(void)
198 217
199/* 218/*
200 * MCI (SD/MMC) 219 * MCI (SD/MMC)
201 * det_pin, wp_pin and vcc_pin are not connected 220 * wp_pin and vcc_pin are not connected
202 */ 221 */
222#if defined(CONFIG_MMC_ATMELMCI) || defined(CONFIG_MMC_ATMELMCI_MODULE)
223static struct mci_platform_data __initdata ek_mmc_data = {
224 .slot[1] = {
225 .bus_width = 4,
226 .detect_pin = AT91_PIN_PC9,
227 },
228
229};
230#else
203static struct at91_mmc_data __initdata ek_mmc_data = { 231static struct at91_mmc_data __initdata ek_mmc_data = {
204 .slot_b = 1, 232 .slot_b = 1, /* Only one slot so use slot B */
205 .wire4 = 1, 233 .wire4 = 1,
234 .det_pin = AT91_PIN_PC9,
206}; 235};
236#endif
207 237
238static void __init ek_add_device_mmc(void)
239{
240#if defined(CONFIG_MMC_ATMELMCI) || defined(CONFIG_MMC_ATMELMCI_MODULE)
241 if (ek_have_2mmc()) {
242 ek_mmc_data.slot[0].bus_width = 4;
243 ek_mmc_data.slot[0].detect_pin = AT91_PIN_PC2;
244 }
245 at91_add_device_mci(0, &ek_mmc_data);
246#else
247 at91_add_device_mmc(0, &ek_mmc_data);
248#endif
249}
208 250
209/* 251/*
210 * LEDs 252 * LEDs
@@ -223,6 +265,15 @@ static struct gpio_led ek_leds[] = {
223 } 265 }
224}; 266};
225 267
268static void __init ek_add_device_gpio_leds(void)
269{
270 if (ek_have_2mmc()) {
271 ek_leds[0].gpio = AT91_PIN_PB8;
272 ek_leds[1].gpio = AT91_PIN_PB9;
273 }
274
275 at91_gpio_leds(ek_leds, ARRAY_SIZE(ek_leds));
276}
226 277
227/* 278/*
228 * GPIO Buttons 279 * GPIO Buttons
@@ -336,15 +387,15 @@ static void __init ek_board_init(void)
336 /* NAND */ 387 /* NAND */
337 ek_add_device_nand(); 388 ek_add_device_nand();
338 /* Ethernet */ 389 /* Ethernet */
339 at91_add_device_eth(&ek_macb_data); 390 ek_add_device_macb();
340 /* Regulators */ 391 /* Regulators */
341 ek_add_regulators(); 392 ek_add_regulators();
342 /* MMC */ 393 /* MMC */
343 at91_add_device_mmc(0, &ek_mmc_data); 394 ek_add_device_mmc();
344 /* I2C */ 395 /* I2C */
345 at91_add_device_i2c(ek_i2c_devices, ARRAY_SIZE(ek_i2c_devices)); 396 at91_add_device_i2c(ek_i2c_devices, ARRAY_SIZE(ek_i2c_devices));
346 /* LEDs */ 397 /* LEDs */
347 at91_gpio_leds(ek_leds, ARRAY_SIZE(ek_leds)); 398 ek_add_device_gpio_leds();
348 /* Push Buttons */ 399 /* Push Buttons */
349 ek_add_device_buttons(); 400 ek_add_device_buttons();
350 /* PCK0 provides MCLK to the WM8731 */ 401 /* PCK0 provides MCLK to the WM8731 */
@@ -355,8 +406,15 @@ static void __init ek_board_init(void)
355 406
356MACHINE_START(AT91SAM9G20EK, "Atmel AT91SAM9G20-EK") 407MACHINE_START(AT91SAM9G20EK, "Atmel AT91SAM9G20-EK")
357 /* Maintainer: Atmel */ 408 /* Maintainer: Atmel */
358 .phys_io = AT91_BASE_SYS, 409 .boot_params = AT91_SDRAM_BASE + 0x100,
359 .io_pg_offst = (AT91_VA_BASE_SYS >> 18) & 0xfffc, 410 .timer = &at91sam926x_timer,
411 .map_io = ek_map_io,
412 .init_irq = ek_init_irq,
413 .init_machine = ek_board_init,
414MACHINE_END
415
416MACHINE_START(AT91SAM9G20EK_2MMC, "Atmel AT91SAM9G20-EK 2 MMC Slot Mod")
417 /* Maintainer: Atmel */
360 .boot_params = AT91_SDRAM_BASE + 0x100, 418 .boot_params = AT91_SDRAM_BASE + 0x100,
361 .timer = &at91sam926x_timer, 419 .timer = &at91sam926x_timer,
362 .map_io = ek_map_io, 420 .map_io = ek_map_io,