diff options
author | Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> | 2012-11-15 17:21:16 +0100 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2012-11-16 15:33:50 +0100 |
commit | 272a5d738ab152347d67be062e8a4e771825493a (patch) | |
tree | d233f56d87922964ac46a48aacf0a3860921f5e9 /arch/arm/boards/at91rm9200ek | |
parent | c9a3e431a648caf0b012262103367e4303dcce81 (diff) | |
download | barebox-272a5d738ab152347d67be062e8a4e771825493a.tar.gz barebox-272a5d738ab152347d67be062e8a4e771825493a.tar.xz |
at91rm9200ek: add spi support
as the support atmel mci drivers does not work on rm9200 and we have the
possibility to use it as spi use it
Originally on rm9200 when the interface mci is in SPI mode we use a DataFlash Card
so allow it but if no dataflash card option is enable use as mmc spi.
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'arch/arm/boards/at91rm9200ek')
-rw-r--r-- | arch/arm/boards/at91rm9200ek/init.c | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/arch/arm/boards/at91rm9200ek/init.c b/arch/arm/boards/at91rm9200ek/init.c index 20e9ad15f9..439ee9e101 100644 --- a/arch/arm/boards/at91rm9200ek/init.c +++ b/arch/arm/boards/at91rm9200ek/init.c @@ -30,6 +30,7 @@ #include <mach/board.h> #include <mach/gpio.h> #include <mach/io.h> +#include <spi/spi.h> static struct at91_ether_platform_data ether_pdata = { .flags = AT91SAM_ETHER_RMII, @@ -103,6 +104,53 @@ static void ek_add_device_udc(void) static void ek_add_device_udc(void) {} #endif +static struct spi_board_info ek_dataflash_spi_devices[] = { + { /* DataFlash chip */ + .name = "mtd_dataflash", + .chip_select = 0, + .max_speed_hz = 15 * 1000 * 1000, + }, +#ifdef CONFIG_MTD_AT91_DATAFLASH_CARD + { /* DataFlash card */ + .name = "mtd_dataflash", + .chip_select = 1, + .max_speed_hz = 15 * 1000 * 1000, + }, +#endif +}; + +static struct spi_board_info ek_mmc_spi_devices[] = { +#if !defined(CONFIG_MTD_DATAFLASH) + { + .name = "spi_mci", + .chip_select = 0, + .max_speed_hz = 20 * 1000 * 1000, + }, +#endif +#if !defined(CONFIG_MTD_AT91_DATAFLASH_CARD) + { + .name = "spi_mci", + .chip_select = 1, + .max_speed_hz = 20 * 1000 * 1000, + }, +#endif +}; + +static unsigned spi0_standard_cs[] = { AT91_PIN_PA3, AT91_PIN_PA6 }; +static struct at91_spi_platform_data spi_pdata = { + .chipselect = spi0_standard_cs, + .num_chipselect = ARRAY_SIZE(spi0_standard_cs), +}; + +static void ek_add_device_spi(void) +{ + /* select mci0 as spi */ + at91_set_gpio_output(AT91_PIN_PB22, 0); + spi_register_board_info(ek_dataflash_spi_devices, ARRAY_SIZE(ek_dataflash_spi_devices)); + spi_register_board_info(ek_mmc_spi_devices, ARRAY_SIZE(ek_mmc_spi_devices)); + at91_add_device_spi(0, &spi_pdata); +} + static int at91rm9200ek_devices_init(void) { /* @@ -118,6 +166,7 @@ static int at91rm9200ek_devices_init(void) at91_add_device_usbh_ohci(&ek_usbh_data); ek_device_add_leds(); ek_add_device_udc(); + ek_add_device_spi(); #if defined(CONFIG_DRIVER_CFI) || defined(CONFIG_DRIVER_CFI_OLD) devfs_add_partition("nor0", 0x00000, 0x40000, DEVFS_PARTITION_FIXED, "self"); |