linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2 v3] OMAP-McSPI: Update platform McSPI files
@ 2010-08-13 13:58 Govindraj.R
  2010-08-13 22:25 ` Grant Likely
  0 siblings, 1 reply; 3+ messages in thread
From: Govindraj.R @ 2010-08-13 13:58 UTC (permalink / raw)
  To: spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f,
	linux-omap-u79uwXL29TY76Z2rM5mHXA
  Cc: Tony Lindgren, Hemanth V,
	dbrownell-Rn4VEauK+AKRv+LV9MX5uipxlwaOVQ5f


From: Hemanth V <hemanthv-l0cyMroinI0@public.gmane.org>

This patch updates platform files for fifo, slave support.

Cc: Grant Likely <grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org>
Signed-off-by: Hemanth V <hemanthv-l0cyMroinI0@public.gmane.org>
Acked-by: Tony Lindgren <tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
Signed-off-by: Govindraj.R <govindraj.raja-l0cyMroinI0@public.gmane.org>
---
 arch/arm/mach-omap2/devices.c           |    5 +++++
 arch/arm/plat-omap/include/plat/mcspi.h |   29 ++++++++++++++++++++++++++++-
 2 files changed, 33 insertions(+), 1 deletions(-)

diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-omap2/devices.c
index 2dbb265..fa99da1 100644
--- a/arch/arm/mach-omap2/devices.c
+++ b/arch/arm/mach-omap2/devices.c
@@ -251,6 +251,7 @@ static inline void omap_init_sti(void) {}

 static struct omap2_mcspi_platform_config omap2_mcspi1_config = {
 	.num_cs		= 4,
+	.force_cs_mode	= 1,
 };

 static struct resource omap2_mcspi1_resources[] = {
@@ -273,6 +274,10 @@ static struct platform_device omap2_mcspi1 = {

 static struct omap2_mcspi_platform_config omap2_mcspi2_config = {
 	.num_cs		= 2,
+	.mode		= OMAP2_MCSPI_MASTER,
+	.dma_mode	= 0,
+	.force_cs_mode	= 0,
+	.fifo_depth	= 0,
 };

 static struct resource omap2_mcspi2_resources[] = {
diff --git a/arch/arm/plat-omap/include/plat/mcspi.h b/arch/arm/plat-omap/include/plat/mcspi.h
index 1254e49..23b928b 100644
--- a/arch/arm/plat-omap/include/plat/mcspi.h
+++ b/arch/arm/plat-omap/include/plat/mcspi.h
@@ -1,8 +1,35 @@
 #ifndef _OMAP2_MCSPI_H
 #define _OMAP2_MCSPI_H

+#define OMAP2_MCSPI_MASTER		0
+#define OMAP2_MCSPI_SLAVE		1
+
+/**
+ * struct omap2_mcspi_platform_config - McSPI controller configuration
+ * @num_cs: Number of chip selects or channels supported
+ * @mode: SPI is master or slave
+ * @dma_mode: Use only DMA for data transfers
+ * @force_cs_mode: Use force chip select mode or auto chip select mode
+ * @fifo_depth: FIFO depth in bytes, max value 64
+ *
+ * @dma_mode when set to 1 uses only dma for data transfers
+ * else the default behaviour is to use PIO mode for transfer
+ * size of 8 bytes or less. This mode is useful when mcspi
+ * is configured as slave
+ *
+ * @force_cs_mode when set to 1 allows continuous transfer of multiple
+ * spi words without toggling the chip select line.
+ *
+ * @fifo_depth when set to non zero values enables FIFO. fifo_depth
+ * should be set as a multiple of buffer size used for read/write.
+ */
+
 struct omap2_mcspi_platform_config {
-	unsigned short	num_cs;
+	u8	num_cs;
+	u8	mode;
+	u8	dma_mode;
+	u8	force_cs_mode;
+	unsigned short fifo_depth;
 };

 struct omap2_mcspi_device_config {
-- 
1.6.3.3





------------------------------------------------------------------------------
This SF.net email is sponsored by 

Make an app they can't live without
Enter the BlackBerry Developer Challenge
http://p.sf.net/sfu/RIM-dev2dev 

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/2 v3] OMAP-McSPI: Update platform McSPI files
  2010-08-13 13:58 [PATCH 1/2 v3] OMAP-McSPI: Update platform McSPI files Govindraj.R
@ 2010-08-13 22:25 ` Grant Likely
  2010-08-13 22:27   ` Grant Likely
  0 siblings, 1 reply; 3+ messages in thread
From: Grant Likely @ 2010-08-13 22:25 UTC (permalink / raw)
  To: Govindraj.R
  Cc: spi-devel-general, linux-omap, Tony Lindgren, dbrownell,
	Hemanth V

Hi Hermanth,

A few comments below.  I imagine to avoid ordering issues, both of
these patches should be merged through the spi tree?

On Fri, Aug 13, 2010 at 7:58 AM, Govindraj.R <govindraj.raja@ti.com> wrote:
>
> From: Hemanth V <hemanthv@ti.com>
>
> This patch updates platform files for fifo, slave support.
>
> Cc: Grant Likely <grant.likely@secretlab.ca>
> Signed-off-by: Hemanth V <hemanthv@ti.com>
> Acked-by: Tony Lindgren <tony@atomide.com>
> Signed-off-by: Govindraj.R <govindraj.raja@ti.com>
> ---
>  arch/arm/mach-omap2/devices.c           |    5 +++++
>  arch/arm/plat-omap/include/plat/mcspi.h |   29 ++++++++++++++++++++++++++++-
>  2 files changed, 33 insertions(+), 1 deletions(-)
>
> diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-omap2/devices.c
> index 2dbb265..fa99da1 100644
> --- a/arch/arm/mach-omap2/devices.c
> +++ b/arch/arm/mach-omap2/devices.c
> @@ -251,6 +251,7 @@ static inline void omap_init_sti(void) {}
>
>  static struct omap2_mcspi_platform_config omap2_mcspi1_config = {
>        .num_cs         = 4,
> +       .force_cs_mode  = 1,
>  };
>
>  static struct resource omap2_mcspi1_resources[] = {
> @@ -273,6 +274,10 @@ static struct platform_device omap2_mcspi1 = {
>
>  static struct omap2_mcspi_platform_config omap2_mcspi2_config = {
>        .num_cs         = 2,
> +       .mode           = OMAP2_MCSPI_MASTER,
> +       .dma_mode       = 0,
> +       .force_cs_mode  = 0,
> +       .fifo_depth     = 0,
>  };
>
>  static struct resource omap2_mcspi2_resources[] = {
> diff --git a/arch/arm/plat-omap/include/plat/mcspi.h b/arch/arm/plat-omap/include/plat/mcspi.h
> index 1254e49..23b928b 100644
> --- a/arch/arm/plat-omap/include/plat/mcspi.h
> +++ b/arch/arm/plat-omap/include/plat/mcspi.h
> @@ -1,8 +1,35 @@
>  #ifndef _OMAP2_MCSPI_H
>  #define _OMAP2_MCSPI_H
>
> +#define OMAP2_MCSPI_MASTER             0
> +#define OMAP2_MCSPI_SLAVE              1
> +
> +/**
> + * struct omap2_mcspi_platform_config - McSPI controller configuration
> + * @num_cs: Number of chip selects or channels supported
> + * @mode: SPI is master or slave

There is currently no infrastructure for supporting SPI slave mode in
drivers/spi.  How is this intended to be implemented?

> + * @dma_mode: Use only DMA for data transfers
> + * @force_cs_mode: Use force chip select mode or auto chip select mode
> + * @fifo_depth: FIFO depth in bytes, max value 64
> + *
> + * @dma_mode when set to 1 uses only dma for data transfers
> + * else the default behaviour is to use PIO mode for transfer
> + * size of 8 bytes or less. This mode is useful when mcspi
> + * is configured as slave
> + *
> + * @force_cs_mode when set to 1 allows continuous transfer of multiple
> + * spi words without toggling the chip select line.

The SPI subsystem already supports exactly this.  The spi bus driver
must support sending a single spi message with multiple words and
transfers without toggling the CS line.  If it doesn't, then the
driver is buggy.

> + *
> + * @fifo_depth when set to non zero values enables FIFO. fifo_depth
> + * should be set as a multiple of buffer size used for read/write.
> + */
> +
>  struct omap2_mcspi_platform_config {
> -       unsigned short  num_cs;
> +       u8      num_cs;
> +       u8      mode;
> +       u8      dma_mode;
> +       u8      force_cs_mode;
> +       unsigned short fifo_depth;
>  };
>
>  struct omap2_mcspi_device_config {
> --
> 1.6.3.3
>
>
>
>
>



-- 
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/2 v3] OMAP-McSPI: Update platform McSPI files
  2010-08-13 22:25 ` Grant Likely
@ 2010-08-13 22:27   ` Grant Likely
  0 siblings, 0 replies; 3+ messages in thread
From: Grant Likely @ 2010-08-13 22:27 UTC (permalink / raw)
  To: Govindraj.R
  Cc: spi-devel-general, linux-omap, Tony Lindgren, dbrownell,
	Hemanth V

On Fri, Aug 13, 2010 at 4:25 PM, Grant Likely <grant.likely@secretlab.ca> wrote:
> On Fri, Aug 13, 2010 at 7:58 AM, Govindraj.R <govindraj.raja@ti.com> wrote:
>> + *
>> + * @fifo_depth when set to non zero values enables FIFO. fifo_depth
>> + * should be set as a multiple of buffer size used for read/write.
>> + */

Oh, and on this, which buffer size is being referred to?  The message
size, or something allocated internal to the bus driver?  The spi bus
driver will not have any foreknowledge of what buffer size is going to
be passed to it in spi messages.

g.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-08-13 22:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-08-13 13:58 [PATCH 1/2 v3] OMAP-McSPI: Update platform McSPI files Govindraj.R
2010-08-13 22:25 ` Grant Likely
2010-08-13 22:27   ` Grant Likely

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).