linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] spi: davinci: move eventq parameter to platform data
@ 2011-02-04  0:34 Michael Williamson
  2011-02-04  0:34 ` [PATCH 1/3] davinci: spi: move event_q " Michael Williamson
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Michael Williamson @ 2011-02-04  0:34 UTC (permalink / raw)
  To: spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	davinci-linux-open-source-VycZQUHpC/PFrsHnngEfi1aTQe2KTcn/
  Cc: khilman-1D3HCaltpLuhEniVeURVKkEOCMrvLtNR,
	grant.likely-s3s/WqlpOiPyB63q8FvJNQ

For DMA operation, the davinci spi driver needs an eventq number.
Currently, this number is passed as a IORESOURCE_DMA.  This is not
correct, as the eventq is not a DMA channel.  Pass the eventq
via the platform data structure instead as is done with davinci
devices such as the McASP.

Two platforms (dm355 and dm365) are using the davinci spi driver 
with DMA's enabled, move the eventq parameter out of the resources
and into the platform data.

I have tested this patch with an OMAP-L138 (patch submission for this
platform is in progress).  I do not have a dm355 or dm365, so these
platforms have not been tested.

Michael Williamson (3):
  davinci: spi: move event_q parameter to platform data
  davinci: dm355: move spi0 eventq assignment from resources to
    platform data
  davinci: dm365: move spi0 eventq assignment from resources to
    platform data

 arch/arm/mach-davinci/dm355.c            |    5 +----
 arch/arm/mach-davinci/dm365.c            |    5 +----
 arch/arm/mach-davinci/include/mach/spi.h |   15 ++++++++++-----
 drivers/spi/davinci_spi.c                |   11 +++--------
 4 files changed, 15 insertions(+), 21 deletions(-)

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

* [PATCH 1/3] davinci: spi: move event_q parameter to platform data
  2011-02-04  0:34 [PATCH 0/3] spi: davinci: move eventq parameter to platform data Michael Williamson
@ 2011-02-04  0:34 ` Michael Williamson
       [not found]   ` <1296779690-9723-2-git-send-email-michael.williamson-wZX4cNJlHJ2sVWG7oymsAA@public.gmane.org>
  2011-02-04  0:34 ` [PATCH 2/3] davinci: dm355: move spi0 eventq assignment from resources " Michael Williamson
  2011-02-04  0:34 ` [PATCH 3/3] davinci: dm365: " Michael Williamson
  2 siblings, 1 reply; 6+ messages in thread
From: Michael Williamson @ 2011-02-04  0:34 UTC (permalink / raw)
  To: spi-devel-general, linux-arm-kernel, davinci-linux-open-source
  Cc: khilman, grant.likely, Michael Williamson

For DMA operation, the davinci spi driver needs an eventq number.
Currently, this number is passed as a IORESOURCE_DMA.  This is not
correct, as the eventq is not a DMA channel.  Pass the eventq
via the platform data structure instead.

Signed-off-by: Michael Williamson <michael.williamson@criticallink.com>
---
 arch/arm/mach-davinci/include/mach/spi.h |   15 ++++++++++-----
 drivers/spi/davinci_spi.c                |   11 +++--------
 2 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/arch/arm/mach-davinci/include/mach/spi.h b/arch/arm/mach-davinci/include/mach/spi.h
index 38f4da5..0853a5f 100644
--- a/arch/arm/mach-davinci/include/mach/spi.h
+++ b/arch/arm/mach-davinci/include/mach/spi.h
@@ -19,6 +19,8 @@
 #ifndef __ARCH_ARM_DAVINCI_SPI_H
 #define __ARCH_ARM_DAVINCI_SPI_H
 
+#include <mach/edma.h>
+
 #define SPI_INTERN_CS	0xFF
 
 enum {
@@ -39,13 +41,16 @@ enum {
  *		to populate if all chip-selects are internal.
  * @cshold_bug:	set this to true if the SPI controller on your chip requires
  *		a write to CSHOLD bit in between transfers (like in DM355).
+ * @dma_event_q: DMA event_q to use if SPI_IO_TYPE_DMA is used for any device
+ *		on the bus.
  */
 struct davinci_spi_platform_data {
-	u8	version;
-	u8	num_chipselect;
-	u8	intr_line;
-	u8	*chip_sel;
-	bool	cshold_bug;
+	u8			version;
+	u8			num_chipselect;
+	u8			intr_line;
+	u8			*chip_sel;
+	bool			cshold_bug;
+	enum dma_event_q	dma_event_q;
 };
 
 /**
diff --git a/drivers/spi/davinci_spi.c b/drivers/spi/davinci_spi.c
index 6beab99..166a879 100644
--- a/drivers/spi/davinci_spi.c
+++ b/drivers/spi/davinci_spi.c
@@ -790,7 +790,6 @@ static int davinci_spi_probe(struct platform_device *pdev)
 	struct resource *r, *mem;
 	resource_size_t dma_rx_chan = SPI_NO_RESOURCE;
 	resource_size_t	dma_tx_chan = SPI_NO_RESOURCE;
-	resource_size_t	dma_eventq = SPI_NO_RESOURCE;
 	int i = 0, ret = 0;
 	u32 spipc0;
 
@@ -878,17 +877,13 @@ static int davinci_spi_probe(struct platform_device *pdev)
 	r = platform_get_resource(pdev, IORESOURCE_DMA, 1);
 	if (r)
 		dma_tx_chan = r->start;
-	r = platform_get_resource(pdev, IORESOURCE_DMA, 2);
-	if (r)
-		dma_eventq = r->start;
 
 	dspi->bitbang.txrx_bufs = davinci_spi_bufs;
 	if (dma_rx_chan != SPI_NO_RESOURCE &&
-	    dma_tx_chan != SPI_NO_RESOURCE &&
-	    dma_eventq != SPI_NO_RESOURCE) {
+	    dma_tx_chan != SPI_NO_RESOURCE) {
 		dspi->dma.rx_channel = dma_rx_chan;
 		dspi->dma.tx_channel = dma_tx_chan;
-		dspi->dma.eventq = dma_eventq;
+		dspi->dma.eventq = pdata->dma_event_q;
 
 		ret = davinci_spi_request_dma(dspi);
 		if (ret)
@@ -897,7 +892,7 @@ static int davinci_spi_probe(struct platform_device *pdev)
 		dev_info(&pdev->dev, "DMA: supported\n");
 		dev_info(&pdev->dev, "DMA: RX channel: %d, TX channel: %d, "
 				"event queue: %d\n", dma_rx_chan, dma_tx_chan,
-				dma_eventq);
+				pdata->dma_event_q);
 	}
 
 	dspi->get_rx = davinci_spi_rx_buf_u8;
-- 
1.7.0.4

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

* [PATCH 2/3] davinci: dm355: move spi0 eventq assignment from resources to platform data
  2011-02-04  0:34 [PATCH 0/3] spi: davinci: move eventq parameter to platform data Michael Williamson
  2011-02-04  0:34 ` [PATCH 1/3] davinci: spi: move event_q " Michael Williamson
@ 2011-02-04  0:34 ` Michael Williamson
  2011-02-04  0:34 ` [PATCH 3/3] davinci: dm365: " Michael Williamson
  2 siblings, 0 replies; 6+ messages in thread
From: Michael Williamson @ 2011-02-04  0:34 UTC (permalink / raw)
  To: spi-devel-general, linux-arm-kernel, davinci-linux-open-source
  Cc: khilman, grant.likely, Michael Williamson

Move the eventq assignment for spi0 out of resources and into platform data.

Signed-off-by: Michael Williamson <michael.williamson@criticallink.com>
---
 arch/arm/mach-davinci/dm355.c |    5 +----
 1 files changed, 1 insertions(+), 4 deletions(-)

diff --git a/arch/arm/mach-davinci/dm355.c b/arch/arm/mach-davinci/dm355.c
index a5f8a80..76364d1 100644
--- a/arch/arm/mach-davinci/dm355.c
+++ b/arch/arm/mach-davinci/dm355.c
@@ -403,16 +403,13 @@ static struct resource dm355_spi0_resources[] = {
 		.start = 16,
 		.flags = IORESOURCE_DMA,
 	},
-	{
-		.start = EVENTQ_1,
-		.flags = IORESOURCE_DMA,
-	},
 };
 
 static struct davinci_spi_platform_data dm355_spi0_pdata = {
 	.version 	= SPI_VERSION_1,
 	.num_chipselect = 2,
 	.cshold_bug	= true,
+	.dma_event_q	= EVENTQ_1,
 };
 static struct platform_device dm355_spi0_device = {
 	.name = "spi_davinci",
-- 
1.7.0.4

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

* [PATCH 3/3] davinci: dm365: move spi0 eventq assignment from resources to platform data
  2011-02-04  0:34 [PATCH 0/3] spi: davinci: move eventq parameter to platform data Michael Williamson
  2011-02-04  0:34 ` [PATCH 1/3] davinci: spi: move event_q " Michael Williamson
  2011-02-04  0:34 ` [PATCH 2/3] davinci: dm355: move spi0 eventq assignment from resources " Michael Williamson
@ 2011-02-04  0:34 ` Michael Williamson
  2 siblings, 0 replies; 6+ messages in thread
From: Michael Williamson @ 2011-02-04  0:34 UTC (permalink / raw)
  To: spi-devel-general, linux-arm-kernel, davinci-linux-open-source
  Cc: khilman, grant.likely, Michael Williamson

Move the spi0 eventq assignment out of resources array and into platform data.

Signed-off-by: Michael Williamson <michael.williamson@criticallink.com>
---
 arch/arm/mach-davinci/dm365.c |    5 +----
 1 files changed, 1 insertions(+), 4 deletions(-)

diff --git a/arch/arm/mach-davinci/dm365.c b/arch/arm/mach-davinci/dm365.c
index 02d2cc3..4604e72 100644
--- a/arch/arm/mach-davinci/dm365.c
+++ b/arch/arm/mach-davinci/dm365.c
@@ -625,6 +625,7 @@ 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,
+	.dma_event_q	= EVENTQ_3,
 };
 
 static struct resource dm365_spi0_resources[] = {
@@ -645,10 +646,6 @@ static struct resource dm365_spi0_resources[] = {
 		.start = 16,
 		.flags = IORESOURCE_DMA,
 	},
-	{
-		.start = EVENTQ_3,
-		.flags = IORESOURCE_DMA,
-	},
 };
 
 static struct platform_device dm365_spi0_device = {
-- 
1.7.0.4

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

* Re: [PATCH 1/3] davinci: spi: move event_q parameter to platform data
       [not found]   ` <1296779690-9723-2-git-send-email-michael.williamson-wZX4cNJlHJ2sVWG7oymsAA@public.gmane.org>
@ 2011-02-04 12:03     ` Sergei Shtylyov
       [not found]       ` <4D4BEB1F.6060200-Igf4POYTYCDQT0dZR+AlfA@public.gmane.org>
  0 siblings, 1 reply; 6+ messages in thread
From: Sergei Shtylyov @ 2011-02-04 12:03 UTC (permalink / raw)
  To: Michael Williamson
  Cc: khilman-1D3HCaltpLuhEniVeURVKkEOCMrvLtNR,
	spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f,
	davinci-linux-open-source-VycZQUHpC/PFrsHnngEfi1aTQe2KTcn/,
	grant.likely-s3s/WqlpOiPyB63q8FvJNQ,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r

Hello.

On 04-02-2011 3:34, Michael Williamson wrote:

> For DMA operation, the davinci spi driver needs an eventq number.
> Currently, this number is passed as a IORESOURCE_DMA.  This is not
> correct, as the eventq is not a DMA channel.  Pass the eventq
> via the platform data structure instead.

> Signed-off-by: Michael Williamson<michael.williamson-wZX4cNJlHJ2sVWG7oymsAA@public.gmane.org>
[...]

> diff --git a/arch/arm/mach-davinci/include/mach/spi.h b/arch/arm/mach-davinci/include/mach/spi.h
> index 38f4da5..0853a5f 100644
> --- a/arch/arm/mach-davinci/include/mach/spi.h
> +++ b/arch/arm/mach-davinci/include/mach/spi.h
[...]
> @@ -39,13 +41,16 @@ enum {
>    *		to populate if all chip-selects are internal.
>    * @cshold_bug:	set this to true if the SPI controller on your chip requires
>    *		a write to CSHOLD bit in between transfers (like in DM355).
> + * @dma_event_q: DMA event_q to use if SPI_IO_TYPE_DMA is used for any device

    s/event_q/event queue/?

> + *		on the bus.
>    */
>   struct davinci_spi_platform_data {
> -	u8	version;
> -	u8	num_chipselect;
> -	u8	intr_line;
> -	u8	*chip_sel;
> -	bool	cshold_bug;
> +	u8			version;
> +	u8			num_chipselect;
> +	u8			intr_line;
> +	u8			*chip_sel;
> +	bool			cshold_bug;
> +	enum dma_event_q	dma_event_q;
>   };
>
>   /**
> diff --git a/drivers/spi/davinci_spi.c b/drivers/spi/davinci_spi.c
> index 6beab99..166a879 100644
> --- a/drivers/spi/davinci_spi.c
> +++ b/drivers/spi/davinci_spi.c
[...]
> @@ -878,17 +877,13 @@ static int davinci_spi_probe(struct platform_device *pdev)
>   	r = platform_get_resource(pdev, IORESOURCE_DMA, 1);
>   	if (r)
>   		dma_tx_chan = r->start;
> -	r = platform_get_resource(pdev, IORESOURCE_DMA, 2);
> -	if (r)
> -		dma_eventq = r->start;
>
>   	dspi->bitbang.txrx_bufs = davinci_spi_bufs;
>   	if (dma_rx_chan != SPI_NO_RESOURCE&&
> -	    dma_tx_chan != SPI_NO_RESOURCE&&
> -	    dma_eventq != SPI_NO_RESOURCE) {
> +	    dma_tx_chan != SPI_NO_RESOURCE) {
>   		dspi->dma.rx_channel = dma_rx_chan;
>   		dspi->dma.tx_channel = dma_tx_chan;
> -		dspi->dma.eventq = dma_eventq;
> +		dspi->dma.eventq = pdata->dma_event_q;

    It makes sense to merge this patch with the patches 2 and 3 as otherwise 
the bisectability is prevented for DM3[56]5 -- their 'dma_event_q' field will 
be anonymously initialized to 0 after this patch but should be 1 and 3 instead 
correspondingly. Although, this doesn't seem to be a fatal defect, so the 
patches can be kept separate... Don't know what's better.

WBR, Sergei

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

* Re: [PATCH 1/3] davinci: spi: move event_q parameter to platform data
       [not found]       ` <4D4BEB1F.6060200-Igf4POYTYCDQT0dZR+AlfA@public.gmane.org>
@ 2011-02-04 12:27         ` Michael Williamson
  0 siblings, 0 replies; 6+ messages in thread
From: Michael Williamson @ 2011-02-04 12:27 UTC (permalink / raw)
  To: Sergei Shtylyov
  Cc: khilman-1D3HCaltpLuhEniVeURVKkEOCMrvLtNR,
	spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f,
	davinci-linux-open-source-VycZQUHpC/PFrsHnngEfi1aTQe2KTcn/,
	grant.likely-s3s/WqlpOiPyB63q8FvJNQ,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r

Hi Sergei,

On 2/4/2011 7:03 AM, Sergei Shtylyov wrote:

> Hello.
> 
> On 04-02-2011 3:34, Michael Williamson wrote:
> 
>> For DMA operation, the davinci spi driver needs an eventq number.
>> Currently, this number is passed as a IORESOURCE_DMA.  This is not
>> correct, as the eventq is not a DMA channel.  Pass the eventq
>> via the platform data structure instead.
> 
>> Signed-off-by: Michael Williamson<michael.williamson-wZX4cNJlHJ2sVWG7oymsAA@public.gmane.org>
> [...]
> 
>> diff --git a/arch/arm/mach-davinci/include/mach/spi.h b/arch/arm/mach-davinci/include/mach/spi.h
>> index 38f4da5..0853a5f 100644
>> --- a/arch/arm/mach-davinci/include/mach/spi.h
>> +++ b/arch/arm/mach-davinci/include/mach/spi.h
> [...]
>> @@ -39,13 +41,16 @@ enum {
>>    *        to populate if all chip-selects are internal.
>>    * @cshold_bug:    set this to true if the SPI controller on your chip requires
>>    *        a write to CSHOLD bit in between transfers (like in DM355).
>> + * @dma_event_q: DMA event_q to use if SPI_IO_TYPE_DMA is used for any device
> 
>    s/event_q/event queue/?
> 
>> + *        on the bus.
>>    */
>>   struct davinci_spi_platform_data {
>> -    u8    version;
>> -    u8    num_chipselect;
>> -    u8    intr_line;
>> -    u8    *chip_sel;
>> -    bool    cshold_bug;
>> +    u8            version;
>> +    u8            num_chipselect;
>> +    u8            intr_line;
>> +    u8            *chip_sel;
>> +    bool            cshold_bug;
>> +    enum dma_event_q    dma_event_q;
>>   };
>>
>>   /**
>> diff --git a/drivers/spi/davinci_spi.c b/drivers/spi/davinci_spi.c
>> index 6beab99..166a879 100644
>> --- a/drivers/spi/davinci_spi.c
>> +++ b/drivers/spi/davinci_spi.c
> [...]
>> @@ -878,17 +877,13 @@ static int davinci_spi_probe(struct platform_device *pdev)
>>       r = platform_get_resource(pdev, IORESOURCE_DMA, 1);
>>       if (r)
>>           dma_tx_chan = r->start;
>> -    r = platform_get_resource(pdev, IORESOURCE_DMA, 2);
>> -    if (r)
>> -        dma_eventq = r->start;
>>
>>       dspi->bitbang.txrx_bufs = davinci_spi_bufs;
>>       if (dma_rx_chan != SPI_NO_RESOURCE&&
>> -        dma_tx_chan != SPI_NO_RESOURCE&&
>> -        dma_eventq != SPI_NO_RESOURCE) {
>> +        dma_tx_chan != SPI_NO_RESOURCE) {
>>           dspi->dma.rx_channel = dma_rx_chan;
>>           dspi->dma.tx_channel = dma_tx_chan;
>> -        dspi->dma.eventq = dma_eventq;
>> +        dspi->dma.eventq = pdata->dma_event_q;
> 
>    It makes sense to merge this patch with the patches 2 and 3 as otherwise the bisectability is prevented for DM3[56]5 -- their 'dma_event_q' field will be anonymously initialized to 0 after this patch but should be 1 and 3 instead correspondingly. Although, this doesn't seem to be a fatal defect, so the patches can be kept separate... Don't know what's better.
> 


Barring any other comments, I will collapse the patches and resend.  
I will correct the typo you mentioned above as well.

Thanks.

-Mike


> WBR, Sergei

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

end of thread, other threads:[~2011-02-04 12:27 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-02-04  0:34 [PATCH 0/3] spi: davinci: move eventq parameter to platform data Michael Williamson
2011-02-04  0:34 ` [PATCH 1/3] davinci: spi: move event_q " Michael Williamson
     [not found]   ` <1296779690-9723-2-git-send-email-michael.williamson-wZX4cNJlHJ2sVWG7oymsAA@public.gmane.org>
2011-02-04 12:03     ` Sergei Shtylyov
     [not found]       ` <4D4BEB1F.6060200-Igf4POYTYCDQT0dZR+AlfA@public.gmane.org>
2011-02-04 12:27         ` Michael Williamson
2011-02-04  0:34 ` [PATCH 2/3] davinci: dm355: move spi0 eventq assignment from resources " Michael Williamson
2011-02-04  0:34 ` [PATCH 3/3] davinci: dm365: " Michael Williamson

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