* [PATCH RESEND 0/3] Add dma_alignment field to spi_master
@ 2009-02-22 12:19 Mike Rapoport
2009-02-22 12:19 ` [PATCH RESEND 1/3] SPI: add " Mike Rapoport
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Mike Rapoport @ 2009-02-22 12:19 UTC (permalink / raw)
To: dbrownell; +Cc: spi-devel-general, linux-kernel, dcbw, andrey, Mike Rapoport
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(-)
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH RESEND 1/3] SPI: add dma_alignment field to spi_master
2009-02-22 12:19 [PATCH RESEND 0/3] Add dma_alignment field to spi_master Mike Rapoport
@ 2009-02-22 12:19 ` Mike Rapoport
2009-02-22 12:19 ` [PATCH RESEND 2/3] pxa2xx_spi: set spi_master.dma_alignment = 8 Mike Rapoport
2009-02-22 12:19 ` [PATCH RESEND 3/3] spi_imx: set spi_master.dma_alignment = 4 Mike Rapoport
2 siblings, 0 replies; 4+ messages in thread
From: Mike Rapoport @ 2009-02-22 12:19 UTC (permalink / raw)
To: dbrownell; +Cc: spi-devel-general, linux-kernel, dcbw, andrey, Mike Rapoport
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@compulab.co.il>
---
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
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH RESEND 2/3] pxa2xx_spi: set spi_master.dma_alignment = 8
2009-02-22 12:19 [PATCH RESEND 0/3] Add dma_alignment field to spi_master Mike Rapoport
2009-02-22 12:19 ` [PATCH RESEND 1/3] SPI: add " Mike Rapoport
@ 2009-02-22 12:19 ` Mike Rapoport
2009-02-22 12:19 ` [PATCH RESEND 3/3] spi_imx: set spi_master.dma_alignment = 4 Mike Rapoport
2 siblings, 0 replies; 4+ messages in thread
From: Mike Rapoport @ 2009-02-22 12:19 UTC (permalink / raw)
To: dbrownell; +Cc: spi-devel-general, linux-kernel, dcbw, andrey, Mike Rapoport
Signed-off-by: Mike Rapoport <mike@compulab.co.il>
---
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
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH RESEND 3/3] spi_imx: set spi_master.dma_alignment = 4
2009-02-22 12:19 [PATCH RESEND 0/3] Add dma_alignment field to spi_master Mike Rapoport
2009-02-22 12:19 ` [PATCH RESEND 1/3] SPI: add " Mike Rapoport
2009-02-22 12:19 ` [PATCH RESEND 2/3] pxa2xx_spi: set spi_master.dma_alignment = 8 Mike Rapoport
@ 2009-02-22 12:19 ` Mike Rapoport
2 siblings, 0 replies; 4+ messages in thread
From: Mike Rapoport @ 2009-02-22 12:19 UTC (permalink / raw)
To: dbrownell; +Cc: spi-devel-general, linux-kernel, dcbw, andrey, Mike Rapoport
Signed-off-by: Mike Rapoport <mike@compulab.co.il>
---
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
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2009-02-22 12:20 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-02-22 12:19 [PATCH RESEND 0/3] Add dma_alignment field to spi_master Mike Rapoport
2009-02-22 12:19 ` [PATCH RESEND 1/3] SPI: add " Mike Rapoport
2009-02-22 12:19 ` [PATCH RESEND 2/3] pxa2xx_spi: set spi_master.dma_alignment = 8 Mike Rapoport
2009-02-22 12:19 ` [PATCH RESEND 3/3] spi_imx: set spi_master.dma_alignment = 4 Mike Rapoport
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox