linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] Add dma_alignment field to spi_master
@ 2009-02-09  8:12 Mike Rapoport
       [not found] ` <cover.1234167048.git.mike-UTxiZqZC01RS1MOuV/RT9w@public.gmane.org>
  0 siblings, 1 reply; 5+ messages in thread
From: Mike Rapoport @ 2009-02-09  8:12 UTC (permalink / raw)
  To: dbrownell-Rn4VEauK+AKRv+LV9MX5uipxlwaOVQ5f
  Cc: dcbw-H+wXaHxf7aLQT0dZR+AlfA,
	spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f,
	andrey-W/OLz77bvjtBDgjK7y7TUQ, mike-UTxiZqZC01RS1MOuV/RT9w

Some SPI controllers have restrictions on DMAable buffers alignemt.
Currently if the buffer supplied by protocol driver is not properly
aligned, the controller silently performs transfer in PIO mode.
Addition of dma_alignment field to spi_master allows protocol drivers to
perform proper alignment.

Mike Rapoport (3):
  SPI: add dma_alignment field to spi_master
  pxa2xx_spi: set spi_master.dma_alignment = 8
  spi_imx: set spi_master.dma_alignment = 4

 drivers/spi/pxa2xx_spi.c |    2 ++
 drivers/spi/spi_imx.c    |    2 ++
 include/linux/spi/spi.h  |    6 ++++++
 3 files changed, 10 insertions(+), 0 deletions(-)


------------------------------------------------------------------------------
Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM)
software. With Adobe AIR, Ajax developers can use existing skills and code to
build responsive, highly engaging applications that combine the power of local
resources and data with the reach of the web. Download the Adobe AIR SDK and
Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com

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

* [PATCH 1/3] SPI: add dma_alignment field to spi_master
       [not found] ` <cover.1234167048.git.mike-UTxiZqZC01RS1MOuV/RT9w@public.gmane.org>
@ 2009-02-09  8:12   ` Mike Rapoport
       [not found]   ` <b9186e380ae53df7b4ce65a552b39d34879f3dd6.1234167048.git.mike-UTxiZqZC01RS1MOuV/RT9w@public.gmane.org>
                     ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Mike Rapoport @ 2009-02-09  8:12 UTC (permalink / raw)
  To: dbrownell-Rn4VEauK+AKRv+LV9MX5uipxlwaOVQ5f
  Cc: dcbw-H+wXaHxf7aLQT0dZR+AlfA,
	spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f,
	andrey-W/OLz77bvjtBDgjK7y7TUQ, mike-UTxiZqZC01RS1MOuV/RT9w

Some SPI controllers have restrictions on DMAable buffers alignemt.
Currently if the buffer supplied by protocol driver is not properly
aligned, the controller silently performs transfer in PIO mode.
Addition of dma_alignment field to spi_master allows protocol drivers to
perform proper alignment.

Signed-off-by: Mike Rapoport <mike-UTxiZqZC01RS1MOuV/RT9w@public.gmane.org>
---
 include/linux/spi/spi.h |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h
index 68bb1c5..2cc43fa 100644
--- a/include/linux/spi/spi.h
+++ b/include/linux/spi/spi.h
@@ -204,6 +204,7 @@ static inline void spi_unregister_driver(struct spi_driver *sdrv)
  *	SPI slaves, and are numbered from zero to num_chipselects.
  *	each slave has a chipselect signal, but it's common that not
  *	every chipselect is connected to a slave.
+ * @dma_alignment: SPI controller constraint on DMA buffers alignment.
  * @setup: updates the device mode and clocking records used by a
  *	device's SPI controller; protocol code may call this.  This
  *	must fail if an unrecognized or unsupported mode is requested.
@@ -239,6 +240,11 @@ struct spi_master {
 	 */
 	u16			num_chipselect;
 
+	/* some SPI controllers pose alignment requirements on DMAable
+	 * buffers; let protocol drivers know about these requirements.
+	 */
+	u16			dma_alignment;
+
 	/* setup mode and clock, etc (spi driver may call many times) */
 	int			(*setup)(struct spi_device *spi);
 
-- 
1.5.6.4


------------------------------------------------------------------------------
Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM)
software. With Adobe AIR, Ajax developers can use existing skills and code to
build responsive, highly engaging applications that combine the power of local
resources and data with the reach of the web. Download the Adobe AIR SDK and
Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com

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

* [PATCH 2/3] pxa2xx_spi: set spi_master.dma_alignment = 8
       [not found]   ` <b9186e380ae53df7b4ce65a552b39d34879f3dd6.1234167048.git.mike-UTxiZqZC01RS1MOuV/RT9w@public.gmane.org>
@ 2009-02-09  8:12     ` Mike Rapoport
  0 siblings, 0 replies; 5+ messages in thread
From: Mike Rapoport @ 2009-02-09  8:12 UTC (permalink / raw)
  To: dbrownell-Rn4VEauK+AKRv+LV9MX5uipxlwaOVQ5f
  Cc: dcbw-H+wXaHxf7aLQT0dZR+AlfA,
	spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f,
	andrey-W/OLz77bvjtBDgjK7y7TUQ, mike-UTxiZqZC01RS1MOuV/RT9w

Signed-off-by: Mike Rapoport <mike-UTxiZqZC01RS1MOuV/RT9w@public.gmane.org>
---
 drivers/spi/pxa2xx_spi.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/drivers/spi/pxa2xx_spi.c b/drivers/spi/pxa2xx_spi.c
index d0fc4ca..e38f6e0 100644
--- a/drivers/spi/pxa2xx_spi.c
+++ b/drivers/spi/pxa2xx_spi.c
@@ -55,6 +55,7 @@ MODULE_ALIAS("platform:pxa2xx-spi");
 #define RESET_DMA_CHANNEL	(DCSR_NODESC | DMA_INT_MASK)
 #define IS_DMA_ALIGNED(x)	((((u32)(x)) & 0x07) == 0)
 #define MAX_DMA_LEN		8191
+#define DMA_ALIGNMENT		8
 
 /*
  * for testing SSCR1 changes that require SSP restart, basically
@@ -1440,6 +1441,7 @@ static int __init pxa2xx_spi_probe(struct platform_device *pdev)
 
 	master->bus_num = pdev->id;
 	master->num_chipselect = platform_info->num_chipselect;
+	master->dma_alignment = DMA_ALIGNMENT;
 	master->cleanup = cleanup;
 	master->setup = setup;
 	master->transfer = transfer;
-- 
1.5.6.4


------------------------------------------------------------------------------
Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM)
software. With Adobe AIR, Ajax developers can use existing skills and code to
build responsive, highly engaging applications that combine the power of local
resources and data with the reach of the web. Download the Adobe AIR SDK and
Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com

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

* [PATCH 3/3] spi_imx: set spi_master.dma_alignment = 4
       [not found]   ` <60c923e5a328f72fee1e7f91eccb31f120329eb3.1234167048.git.mike-UTxiZqZC01RS1MOuV/RT9w@public.gmane.org>
@ 2009-02-09  8:12     ` Mike Rapoport
  0 siblings, 0 replies; 5+ messages in thread
From: Mike Rapoport @ 2009-02-09  8:12 UTC (permalink / raw)
  To: dbrownell-Rn4VEauK+AKRv+LV9MX5uipxlwaOVQ5f
  Cc: dcbw-H+wXaHxf7aLQT0dZR+AlfA,
	spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f,
	andrey-W/OLz77bvjtBDgjK7y7TUQ, mike-UTxiZqZC01RS1MOuV/RT9w

Signed-off-by: Mike Rapoport <mike-UTxiZqZC01RS1MOuV/RT9w@public.gmane.org>
---
 drivers/spi/spi_imx.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/drivers/spi/spi_imx.c b/drivers/spi/spi_imx.c
index 269a55e..b36b5a1 100644
--- a/drivers/spi/spi_imx.c
+++ b/drivers/spi/spi_imx.c
@@ -186,6 +186,7 @@
 #define QUEUE_STOPPED			(1)
 
 #define IS_DMA_ALIGNED(x) 		(((u32)(x) & 0x03) == 0)
+#define DMA_ALIGNMENT			4
 /*-------------------------------------------------------------------------*/
 
 
@@ -1481,6 +1482,7 @@ static int __init spi_imx_probe(struct platform_device *pdev)
 
 	master->bus_num = pdev->id;
 	master->num_chipselect = platform_info->num_chipselect;
+	master->dma_alignment = DMA_ALIGNMENT;
 	master->cleanup = cleanup;
 	master->setup = setup;
 	master->transfer = transfer;
-- 
1.5.6.4


------------------------------------------------------------------------------
Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM)
software. With Adobe AIR, Ajax developers can use existing skills and code to
build responsive, highly engaging applications that combine the power of local
resources and data with the reach of the web. Download the Adobe AIR SDK and
Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com

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

* Re: [PATCH 0/3] Add dma_alignment field to spi_master
       [not found] ` <cover.1234167048.git.mike-UTxiZqZC01RS1MOuV/RT9w@public.gmane.org>
                     ` (2 preceding siblings ...)
       [not found]   ` <60c923e5a328f72fee1e7f91eccb31f120329eb3.1234167048.git.mike-UTxiZqZC01RS1MOuV/RT9w@public.gmane.org>
@ 2009-02-16  9:05   ` Mike Rapoport
  3 siblings, 0 replies; 5+ messages in thread
From: Mike Rapoport @ 2009-02-16  9:05 UTC (permalink / raw)
  To: dbrownell-Rn4VEauK+AKRv+LV9MX5uipxlwaOVQ5f
  Cc: dcbw-H+wXaHxf7aLQT0dZR+AlfA,
	spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f,
	andrey-W/OLz77bvjtBDgjK7y7TUQ

David,
Any comments?

Mike Rapoport wrote:
> Some SPI controllers have restrictions on DMAable buffers alignemt.
> Currently if the buffer supplied by protocol driver is not properly
> aligned, the controller silently performs transfer in PIO mode.
> Addition of dma_alignment field to spi_master allows protocol drivers to
> perform proper alignment.
> 
> Mike Rapoport (3):
>   SPI: add dma_alignment field to spi_master
>   pxa2xx_spi: set spi_master.dma_alignment = 8
>   spi_imx: set spi_master.dma_alignment = 4
> 
>  drivers/spi/pxa2xx_spi.c |    2 ++
>  drivers/spi/spi_imx.c    |    2 ++
>  include/linux/spi/spi.h  |    6 ++++++
>  3 files changed, 10 insertions(+), 0 deletions(-)
> 

-- 
Sincerely yours,
Mike.


------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H

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

end of thread, other threads:[~2009-02-16  9:05 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-02-09  8:12 [PATCH 0/3] Add dma_alignment field to spi_master Mike Rapoport
     [not found] ` <cover.1234167048.git.mike-UTxiZqZC01RS1MOuV/RT9w@public.gmane.org>
2009-02-09  8:12   ` [PATCH 1/3] SPI: add " Mike Rapoport
     [not found]   ` <b9186e380ae53df7b4ce65a552b39d34879f3dd6.1234167048.git.mike-UTxiZqZC01RS1MOuV/RT9w@public.gmane.org>
2009-02-09  8:12     ` [PATCH 2/3] pxa2xx_spi: set spi_master.dma_alignment = 8 Mike Rapoport
     [not found]   ` <60c923e5a328f72fee1e7f91eccb31f120329eb3.1234167048.git.mike-UTxiZqZC01RS1MOuV/RT9w@public.gmane.org>
2009-02-09  8:12     ` [PATCH 3/3] spi_imx: set spi_master.dma_alignment = 4 Mike Rapoport
2009-02-16  9:05   ` [PATCH 0/3] Add dma_alignment field to spi_master Mike Rapoport

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