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 mach/spi.h

[...]

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 bnieb...@efjohnson.comwrote:

   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: [spi-devel-general] [PATCH 0/3] davinci: spi: replace existingSPI driver

2010-06-16 Thread Brian Niebuhr
 On Tue, Jun 15, 2010 at 00:43:06, Brian Niebuhr wrote:
I have compiled with the davinci_all_defconfig, but I don't 
   have EVMs
for the other davinci platforms to test with.

   
   I was testing this series on OMAP-L137, OMAP-L138 and 
 DM365 EVMs and I
   found that on all these EVMS, Interrupt mode has problems. 
   Driver works
   fine in DMA and POLL modes. Some problems which I had 
   observed with the
   old driver are gone now.
  
  Do you have any idea what errors you're seeing in interrupt mode?  I
  went and retested interrupt mode with several devices on my 
 custom board
  and it still appeared to be working fine.  It may be an 
 interaction with
  code outside the driver because I'm running the identical 
 driver code
  but I'm not running the latest kernel from the davinci git 
 repository.
  I'm trying to figure out if I can get my DA850 EVM back into a state
  where I can debug this.  Thanks for any hints you can give!  
  
 
 You may be knowing that on OMAP-L138 EVM, we have M25P64 
 Flash on SPI. When
 the driver is configured in Interrupt mode, kernel booting 
 just hangs. I
 noticed that the SPI probe function is not coming out of 
 spi_bitbang_start()
 call.

I configured the M25P64 on the DA850 EVM for both DMA and interrupt mode
and my kernel still booted correctly.  I wonder if your setting for
intr_level is correct?  For the DA850 it should be set to 1.  I'm
following up with a response to Nicolas showing the changes I made to
the kernel to test this.  Can you check if the changes you made match
mine?

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 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   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 

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 bnieb...@efjohnson.comwrote:

  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   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)
 +{
 

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 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 bnieb...@efjohnson.comwrote:

  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 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 bnieb...@efjohnson.com
 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 v2] rtc: omap: let device wakeup capability be configured from chip init logic

2010-06-16 Thread Nori, Sekhar
Hi Dave,

Any thoughts on my responses below? If you are
satisfied, would you please Ack my patch?

Thanks,
Sekhar

On Mon, May 24, 2010 at 11:36:45, Nori, Sekhar wrote:
 Hi Dave,

 On Thu, May 20, 2010 at 22:21:59, David Brownell wrote:
 
This patch lets the wakeup capability to be set from
   platform data and
does not override the setting from the driver. For
   DA850/OMAP-L138, this
is done from
   arch/arm/mach-davinci/devices-da8xx.c:da8xx_register_rtc()
   
Note that this patch does not change the behavior on
   any existing OMAP1
board since the platform device registration sets the
   wakeup capability
to 0 by default.

 Just to be clear, I was actually referring to the fact
 that the device_initialize() in drivers/base/core.c is
 already clearing the 'can wake-up' flag to 0, so there
 should be no need to do so again in the driver.

Dave, would you please ack this patch if you are
   satisfied?
 
  I don't see how it could work, since it always sets the
  wake capability to the default of can't wake...  Even if
  the board *can* wake...

 Are you referring to da8xx_register_rtc() here? It sets the
 'can wake' flag to true.

 ret = platform_device_register(da8xx_rtc_device);
 if (!ret)
 /* Atleast on DA850, RTC is a wakeup source */
 device_init_wakeup(da8xx_rtc_device.dev, true);

 
  The model I've worked with is that for devices which can issue
  wake events, the board init code sets that flag, and the driver
  responds appropriately.  Presumably that could work here too...

 Yes, except that the response to the wakeup event is really specific
 to DaVinci/DA850 and is handled in arch/arm/mach-davinci/sleep.S, not
 in the RTC driver.

 
 
   Can you please ack this patch if it looks good (or suggest
   any other changes you would like to see)?
  
  device_init_wakeup(pdev-dev, 0);
 
  Having that line seems to defeat the purpose...

 Agreed, and the patch removes it for that reason.

 Thanks,
 Sekhar
 ___
 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