> I got OMAP-L138 EVM and I'm running kernel v2.6.34 from 
> khilman/linux-davinci.git and I would like to try the SPI 
> patch. I successfully applied the patch to the driver, and 
> now I'm trying to modify platform data in board-da850-evm.c. 
> I added the following lines :
>
> [...]
> 
> I do not see spidev1.1 in /dev. Any clue?

Following is a diff of changes I made to the board configuration to add
the M25P64 SPI flash to the DA850 EVM.  Note that this is NOT
recommended as a patch - I just put in some quick and dirty code to
reproduce Sudhakar's issue with the driver.  See diff below:

diff --git a/arch/arm/mach-davinci/board-da850-evm.c
b/arch/arm/mach-davinci/boa
index 2ec3095..4ecae04 100644
--- a/arch/arm/mach-davinci/board-da850-evm.c
+++ b/arch/arm/mach-davinci/board-da850-evm.c
@@ -27,6 +27,8 @@
 #include <linux/regulator/machine.h>
 #include <linux/mfd/tps6507x.h>
 #include <linux/input/tps6507x-ts.h>
+#include <linux/spi/spi.h>
+#include <linux/spi/flash.h>
 
 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
@@ -35,6 +37,7 @@
 #include <mach/da8xx.h>
 #include <mach/nand.h>
 #include <mach/mux.h>
+#include <mach/spi.h>
 
 #define DA850_EVM_PHY_MASK             0x1
 #define DA850_EVM_MDIO_FREQUENCY       2200000 /* PHY bus frequency */
@@ -92,6 +95,59 @@ static struct platform_device
da850_evm_norflash_device = {
        .resource       = da850_evm_norflash_resource,
 };
 
+static struct mtd_partition spi_flash_partitions[] = {
+       [0] = {
+               .name = "U-Boot",
+               .offset = 0,
+               .size = SZ_256K,
+               .mask_flags = MTD_WRITEABLE,
+       },
+       [1] = {
+               .name = "U-Boot Environment",
+               .offset = MTDPART_OFS_APPEND,
+               .size = SZ_64K,
+               .mask_flags = MTD_WRITEABLE,
+       },
+       [2] = {
+               .name = "Linux",
+               .offset = MTDPART_OFS_NXTBLK,
+               .size = SZ_8M - (SZ_256K + SZ_64K + SZ_64K),
+               .mask_flags = 0,
+       },
+};
+
+struct davinci_spi_config m25p64_spi_cfg = {
+       .odd_parity     = 0,
+       .parity_enable  = 0,
+       .intr_level     = 1,
+       .io_type        = SPI_IO_TYPE_DMA,
+       .wdelay         = 0,
+       .timer_disable  = 1,
+       .c2t_delay      = 0,
+       .t2c_delay      = 0,
+       .t2e_delay      = 0,
+       .c2e_delay      = 0,    
+};
+
+static struct flash_platform_data spi_flash_data = {
+       .name = "m25p80",
+       .parts = spi_flash_partitions,
+       .nr_parts = ARRAY_SIZE(spi_flash_partitions),
+       .type = "m25p64",
+};
+
+static struct spi_board_info da850_spi_board_info[] = {
+       [0] = {
+               .modalias = "m25p80",
+               .platform_data = &spi_flash_data,
+               .controller_data = &m25p64_spi_cfg,
+               .mode = SPI_MODE_0,
+               .max_speed_hz = 30000000,
+               .bus_num = 1,
+               .chip_select = 0,
+       },
+};
+
 static struct davinci_pm_config da850_pm_pdata = {
        .sleepcount = 128,
 };
@@ -629,6 +685,61 @@ static int __init da850_evm_config_emac(void)
 }
 device_initcall(da850_evm_config_emac);

+static struct davinci_spi_platform_data da850_spi_pdata1 = {
+       .version = SPI_VERSION_2,
+};
+
+static struct resource da850_spi_resources1[] = {
+       [0] = {
+               .start = 0x01F0E000,
+               .end = 0x01F0E000 + 0xfff,
+               .flags = IORESOURCE_MEM,
+       },
+       [1] = {
+               .start = IRQ_DA8XX_SPINT1,
+               .end = IRQ_DA8XX_SPINT1,
+               .flags = IORESOURCE_IRQ,
+       },
+       [2] = {
+               .start = EDMA_CTLR_CHAN(0, 18),
+               .end = EDMA_CTLR_CHAN(0, 18),
+               .flags = IORESOURCE_DMA | IORESOURCE_DMA_RX_CHAN,
+       },
+       [3] = {
+               .start = EDMA_CTLR_CHAN(0, 19),
+               .end = EDMA_CTLR_CHAN(0, 19),
+               .flags = IORESOURCE_DMA | IORESOURCE_DMA_TX_CHAN,
+       },
+       [4] = {
+               .start = 1,
+               .end = 1,
+               .flags = IORESOURCE_DMA | IORESOURCE_DMA_EVENT_Q,
+       },
+};
+
+static struct platform_device da850_spi_pdev1 = {
+       .name = "spi_davinci",
+       .id = 1,
+       .resource = da850_spi_resources1,
+       .num_resources = ARRAY_SIZE(da850_spi_resources1),
+       .dev = {
+               .platform_data = &da850_spi_pdata1,
+       },
+};
+
+static void __init da850_init_spi1(unsigned char* chip_sel,
+       unsigned int num_sel, struct spi_board_info *info, unsigned
num_dev)
+{
+       struct davinci_spi_platform_data *pdata =
+                       da850_spi_pdev1.dev.platform_data;
+
+       spi_register_board_info(info, num_dev);
+
+       pdata->chip_sel = chip_sel;
+       pdata->num_chipselect = num_sel;
+       platform_device_register(&da850_spi_pdev1);
+}
+
 static __init void da850_evm_init(void)
 {
        int ret;
@@ -739,6 +850,9 @@ static __init void da850_evm_init(void)
                pr_warning("da850_evm_init: cpuidle registration failed:
%d\n",
                                ret);
 
+       da850_init_spi1(NULL, 1, da850_spi_board_info,
+                       ARRAY_SIZE(da850_spi_board_info));
+
        ret = da850_register_pm(&da850_pm_device);
        if (ret)
                pr_warning("da850_evm_init: suspend registration failed:
%d\n",


diff --git a/arch/arm/mach-davinci/da850.c
b/arch/arm/mach-davinci/da850.c
index 6b8331b..311c447 100644
--- a/arch/arm/mach-davinci/da850.c
+++ b/arch/arm/mach-davinci/da850.c
@@ -336,6 +336,13 @@ static struct clk aemif_clk = {
        .flags          = ALWAYS_ENABLED,
 };
 
+static struct clk spi1_clk = {
+       .name   = "spi1",
+       .parent = &pll0_sysclk2,
+       .lpsc   = DA8XX_LPSC1_SPI1,
+       .gpsc   = 1,
+};
+
 static struct clk_lookup da850_clks[] = {
        CLK(NULL,               "ref",          &ref_clk),
        CLK(NULL,               "pll0",         &pll0_clk),
@@ -377,6 +384,7 @@ static struct clk_lookup da850_clks[] = {
        CLK("da8xx_lcdc.0",     NULL,           &lcdc_clk),
        CLK("davinci_mmc.0",    NULL,           &mmcsd_clk),
        CLK(NULL,               "aemif",        &aemif_clk),
+       CLK("spi_davinci.1",    NULL,           &spi1_clk),
        CLK(NULL,               NULL,           NULL),
 };



In addition to the changes to those 2 files, I made the following
configuration changes (from the DA850 defconfig):

- Added SPI support
- Added Davinci SPI driver
- Added user-space SPI support (if you want spidev to work)
- Added MTD
- Added MTD partitioning
- Added character and block access to MTD
- Added the M25P MTD driver


Note that for the spidev device node to appear automatically you will
need to have udev or mdev configured correctly.

Good luck, 

Brian

_______________________________________________
Davinci-linux-open-source mailing list
Davinci-linux-open-source@linux.davincidsp.com
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source

Reply via email to