9
0
Fork 0

at91sam9261ek: add spi support

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
This commit is contained in:
Jean-Christophe PLAGNIOL-VILLARD 2013-01-22 17:20:27 +08:00 committed by Sascha Hauer
parent 41d3371741
commit dc2da4fef1
3 changed files with 45 additions and 1 deletions

View File

@ -37,6 +37,7 @@
#include <gpio_keys.h>
#include <readkey.h>
#include <led.h>
#include <spi/spi.h>
static struct atmel_nand_data nand_pdata = {
.ale = 22,
@ -309,6 +310,46 @@ static void ek_device_add_leds(void)
static void ek_device_add_leds(void) {}
#endif
/*
* SPI related devices
*/
#if defined(CONFIG_DRIVER_SPI_ATMEL)
/*
* SPI devices
*/
static struct spi_board_info ek_spi_devices[] = {
{ /* DataFlash chip */
.name = "mtd_dataflash",
.chip_select = 0,
.max_speed_hz = 15 * 1000 * 1000,
.bus_num = 0,
},
#if defined(CONFIG_MTD_AT91_DATAFLASH_CARD)
{ /* DataFlash card - jumper (J12) configurable to CS3 or CS0 */
.name = "mtd_dataflash",
.chip_select = 1,
.max_speed_hz = 15 * 1000 * 1000,
.bus_num = 0,
},
#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)
{
spi_register_board_info(ek_spi_devices,
ARRAY_SIZE(ek_spi_devices));
at91_add_device_spi(0, &spi_pdata);
}
#else
static void ek_add_device_spi(void) {}
#endif
static int at91sam9261ek_mem_init(void)
{
at91_add_device_sdram(0);
@ -326,6 +367,7 @@ static int at91sam9261ek_devices_init(void)
ek_add_device_buttons();
ek_device_add_leds();
ek_add_device_lcdc();
ek_add_device_spi();
devfs_add_partition("nand0", 0x00000, SZ_128K, DEVFS_PARTITION_FIXED, "at91bootstrap_raw");
devfs_add_partition("nand0", SZ_128K, SZ_256K, DEVFS_PARTITION_FIXED, "self_raw");

View File

@ -52,9 +52,10 @@ CONFIG_CMD_TFTP=y
CONFIG_FS_TFTP=y
CONFIG_NET_RESOLV=y
CONFIG_DRIVER_NET_DM9K=y
# CONFIG_SPI is not set
CONFIG_DRIVER_SPI_ATMEL=y
CONFIG_MTD=y
# CONFIG_MTD_OOB_DEVICE is not set
CONFIG_MTD_DATAFLASH=y
CONFIG_NAND=y
# CONFIG_NAND_ECC_HW is not set
# CONFIG_NAND_ECC_HW_SYNDROME is not set

View File

@ -289,6 +289,7 @@ choice
config MACH_AT91SAM9261EK
bool "Atmel AT91SAM9261-EK Evaluation Kit"
select HAS_DM9000
select HAVE_AT91_DATAFLASH_CARD
select HAVE_NAND_ATMEL_BUSWIDTH_16
help
Select this if you are using Atmel's AT91SAM9261-EK Evaluation Kit.