DaVinci DM365: Adding support for SPI EEPROM
Sandeep Paulraj [Mon, 1 Feb 2010 14:51:45 +0000 (09:51 -0500)]
The DM365 Spectrum Digital EVM comes with an EEPROM
connected to SPI0.
This patch adds support for the SPI EEPROM.

Signed-off-by: Sandeep Paulraj <s-paulraj@ti.com>
Signed-off-by: Kevin Hilman <khilman@deeprootsystems.com>

arch/arm/mach-davinci/board-dm365-evm.c

index 38e9033..d15bece 100644 (file)
@@ -24,6 +24,8 @@
 #include <linux/mtd/partitions.h>
 #include <linux/mtd/nand.h>
 #include <linux/input.h>
+#include <linux/spi/spi.h>
+#include <linux/spi/eeprom.h>
 
 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
@@ -571,6 +573,24 @@ static void __init dm365_evm_map_io(void)
        dm365_init();
 }
 
+static struct spi_eeprom at25640 = {
+       .byte_len       = SZ_64K / 8,
+       .name           = "at25640",
+       .page_size      = 32,
+       .flags          = EE_ADDR2,
+};
+
+static struct spi_board_info dm365_evm_spi_info[] __initconst = {
+       {
+               .modalias       = "at25",
+               .platform_data  = &at25640,
+               .max_speed_hz   = 10 * 1000 * 1000,
+               .bus_num        = 0,
+               .chip_select    = 0,
+               .mode           = SPI_MODE_0,
+       },
+};
+
 static __init void dm365_evm_init(void)
 {
        evm_init_i2c();
@@ -587,6 +607,9 @@ static __init void dm365_evm_init(void)
        dm365_init_asp(&dm365_evm_snd_data);
        dm365_init_rtc();
        dm365_init_ks(&dm365evm_ks_data);
+
+       dm365_init_spi0(BIT(0), dm365_evm_spi_info,
+                       ARRAY_SIZE(dm365_evm_spi_info));
 }
 
 static __init void dm365_evm_irq_init(void)