RE: [PATCH 3/3] davinci: spi: modify platform data for updated SPIdriver

2010-07-22 Thread Emilio C

Hi,
I'm using an Omap L137 based board
I've applied Brian's patch (the final version, v4) and I've modified the
board configuration file (board_d830_evm.c) according to your post, but I
don't see any spi nor mtd device in /dev

Do you have any hint about how to modify the udev configuration in order to
se the new mtd partitions?
Thanks!


-- 
View this message in context: 
http://davinci-linux-open-source.1494791.n2.nabble.com/PATCH-0-3-davinci-spi-replace-existing-SPI-driver-tp5149493p5325095.html
Sent from the davinci-linux-open-source mailing list archive at Nabble.com.
___
Davinci-linux-open-source mailing list
Davinci-linux-open-source@linux.davincidsp.com
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source


RE: [PATCH 3/3] davinci: spi: modify platform data for updated SPIdriver

2010-06-16 Thread Sudhakar Rajashekhara
Brian,

On Wed, Jun 16, 2010 at 23:07:45, Nicolas Luna wrote:
> Brian,
> 
> I changed .io_type from SPI_IO_TYPE_DMA to SPI_IO_TYPE_INTR with
> ".intr_level = 1". My kernel it not freezing at startup and both devices
> (CS1 and CS2) are still working fine. Anything else you would like to check?
> 
> Nicolas
> 
> 
> 
> On Wed, Jun 16, 2010 at 12:54 PM, Brian Niebuhr 
> wrote:
> 
> 
>   > I modified board-da850-evm.c with what you proposed and it's
>   > working very well. I didn't test the spi flash (because I do
>   > not have one on my custum hardware), but my 2 SPI CS
>   > (spidev1.1 and spidev1.2) are working.
>   
>   
>   Nicolas -
>   
>   Would you mind taking a few minutes and testing interrupt mode for the
>   devices on your board?  I'm trying to reproduce the issue that Sudhakar
>   was seeing, and I would appreciate additional testing if you've got the
>   time.
>   

My mistake, I had not set "intr_level" to 1. When I set intr_level to 1,
even interrupt mode is working fine. Are you planning to submit any new
version of this patch series to the list after addressing the minor comments
I had?

Thanks,
Sudhakar


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


Re: [PATCH 3/3] davinci: spi: modify platform data for updated SPIdriver

2010-06-16 Thread Nicolas Luna
Brian,

I changed .io_type from SPI_IO_TYPE_DMA to SPI_IO_TYPE_INTR with
".intr_level = 1". My kernel it not freezing at startup and both devices
(CS1 and CS2) are still working fine. Anything else you would like to check?

Nicolas


On Wed, Jun 16, 2010 at 12:54 PM, Brian Niebuhr wrote:

> > I modified board-da850-evm.c with what you proposed and it's
> > working very well. I didn't test the spi flash (because I do
> > not have one on my custum hardware), but my 2 SPI CS
> > (spidev1.1 and spidev1.2) are working.
>
> Nicolas -
>
> Would you mind taking a few minutes and testing interrupt mode for the
> devices on your board?  I'm trying to reproduce the issue that Sudhakar
> was seeing, and I would appreciate additional testing if you've got the
> time.
>
> Thanks,
>
> Brian
>
>
___
Davinci-linux-open-source mailing list
Davinci-linux-open-source@linux.davincidsp.com
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source


RE: [PATCH 3/3] davinci: spi: modify platform data for updated SPIdriver

2010-06-16 Thread Brian Niebuhr
> I modified board-da850-evm.c with what you proposed and it's 
> working very well. I didn't test the spi flash (because I do 
> not have one on my custum hardware), but my 2 SPI CS 
> (spidev1.1 and spidev1.2) are working.

Nicolas - 

Would you mind taking a few minutes and testing interrupt mode for the
devices on your board?  I'm trying to reproduce the issue that Sudhakar
was seeing, and I would appreciate additional testing if you've got the
time.

Thanks,

Brian 

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


Re: [PATCH 3/3] davinci: spi: modify platform data for updated SPIdriver

2010-06-16 Thread Nicolas Luna
Brian,

I modified board-da850-evm.c with what you proposed and it's working very
well. I didn't test the spi flash (because I do not have one on my custum
hardware), but my 2 SPI CS (spidev1.1 and spidev1.2) are working.

Thanks for your time.

Nicolas


On Wed, Jun 16, 2010 at 11:57 AM, Brian Niebuhr wrote:

> > 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 
>  #include 
>  #include 
> +#include 
> +#include 
>
>  #include 
>  #include 
> @@ -35,6 +37,7 @@
>  #include 
>  #include 
>  #include 
> +#include 
>
>  #define DA850_EVM_PHY_MASK 0x1
>  #define DA850_EVM_MDIO_FREQUENCY   220 /* 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 = 3000,
> +   .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_s

RE: [PATCH 3/3] davinci: spi: modify platform data for updated SPIdriver

2010-06-16 Thread Brian Niebuhr
> 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 
 #include 
 #include 
+#include 
+#include 
 
 #include 
 #include 
@@ -35,6 +37,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #define DA850_EVM_PHY_MASK 0x1
 #define DA850_EVM_MDIO_FREQUENCY   220 /* 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 = 3000,
+   .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,
+  

Re: [PATCH 3/3] davinci: spi: modify platform data for updated SPIdriver

2010-06-16 Thread Nicolas Luna
Hi,

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 :

#include 

[...]

static struct davinci_spi_config spidev_cfg = {
.parity_enable  = 0,
.intr_level = 0,
.io_type= SPI_IO_TYPE_DMA,
.wdelay = 0,
.timer_disable  = 1,
};

static struct spi_board_info da850_spi_board_info[] = {

[0] = {
.modalias = "spidev",
.controller_data = &spidev_cfg,
.mode = SPI_MODE_0,
.max_speed_hz = 1000,
.bus_num = 1,
.chip_select = 1,
},
};

[...]

static __init void da850_evm_init(void)
{
int ret;

[...]

ret = davinci_cfg_reg_list(da850_spi1_pins);
if (ret)
pr_warning("da850_evm_init: spi1 mux setup failed: %d\n", ret);

da850_init_spi1(NULL, 2, da850_spi_board_info,
ARRAY_SIZE(da850_spi_board_info));

[...]
}

I do not see spidev1.1 in /dev. Any clue?

Thank you.

Regards,

Nicolas



On Mon, Jun 14, 2010 at 3:13 PM, Brian Niebuhr wrote:

> > > diff --git a/arch/arm/mach-davinci/dm365.c
> > b/arch/arm/mach-davinci/dm365.c
> > > index a146849..0bd9f93 100644
> > > --- a/arch/arm/mach-davinci/dm365.c
> > > +++ b/arch/arm/mach-davinci/dm365.c
> > > @@ -625,12 +625,6 @@ static u64 dm365_spi0_dma_mask =
> > DMA_BIT_MASK(32);
> > >  static struct davinci_spi_platform_data dm365_spi0_pdata = {
> > > .version= SPI_VERSION_1,
> > > .num_chipselect = 2,
> > > -   .clk_internal   = 1,
> > > -   .cs_hold= 1,
> > > -   .intr_level = 0,
> > > -   .poll_mode  = 1,/* 0 -> interrupt mode 1->
> > polling mode */
> > > -   .c2tdelay   = 0,
> > > -   .t2cdelay   = 0,
> > >  };
> > >
> > >  static struct resource dm365_spi0_resources[] = {
> >
> > This patch does not contain modifications to resource
> > structure to 'or' the
> > IORESOURCE_DMA_RX_CHAN, IORESOURCE_DMA_TX_CHAN and
> > IORESOURCE_DMA_EVENT_Q
> > flags with IORESOURCE_DMA. I don't think without this
> > modification driver
> > will work.
>
> You are right - my mistake.  I will include that in the next version.  I
> assume you added these flags when you were testing?
>
> ___
> Davinci-linux-open-source mailing list
> Davinci-linux-open-source@linux.davincidsp.com
> http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source
>
___
Davinci-linux-open-source mailing list
Davinci-linux-open-source@linux.davincidsp.com
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source


RE: [PATCH 3/3] davinci: spi: modify platform data for updated SPIdriver

2010-06-14 Thread Brian Niebuhr
> > diff --git a/arch/arm/mach-davinci/dm365.c 
> b/arch/arm/mach-davinci/dm365.c
> > index a146849..0bd9f93 100644
> > --- a/arch/arm/mach-davinci/dm365.c
> > +++ b/arch/arm/mach-davinci/dm365.c
> > @@ -625,12 +625,6 @@ static u64 dm365_spi0_dma_mask = 
> DMA_BIT_MASK(32);
> >  static struct davinci_spi_platform_data dm365_spi0_pdata = {
> > .version= SPI_VERSION_1,
> > .num_chipselect = 2,
> > -   .clk_internal   = 1,
> > -   .cs_hold= 1,
> > -   .intr_level = 0,
> > -   .poll_mode  = 1,/* 0 -> interrupt mode 1-> 
> polling mode */
> > -   .c2tdelay   = 0,
> > -   .t2cdelay   = 0,
> >  };
> >  
> >  static struct resource dm365_spi0_resources[] = {
> 
> This patch does not contain modifications to resource 
> structure to 'or' the
> IORESOURCE_DMA_RX_CHAN, IORESOURCE_DMA_TX_CHAN and 
> IORESOURCE_DMA_EVENT_Q
> flags with IORESOURCE_DMA. I don't think without this 
> modification driver
> will work.

You are right - my mistake.  I will include that in the next version.  I
assume you added these flags when you were testing?

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