From: Kevin Hilman <khilman@ti.com>
To: Michael Williamson <michael.williamson@criticallink.com>
Cc: grant.likely@secretlab.ca,
spi-devel-general@lists.sourceforge.net,
davinci-linux-open-source@linux.davincidsp.com,
linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v2] davinci: spi: move event queue parameter to platform data
Date: Tue, 08 Feb 2011 13:58:54 -0800 [thread overview]
Message-ID: <87k4hakx29.fsf@ti.com> (raw)
In-Reply-To: <1297169995-31321-1-git-send-email-michael.williamson@criticallink.com> (Michael Williamson's message of "Tue, 8 Feb 2011 07:59:55 -0500")
Michael Williamson <michael.williamson@criticallink.com> writes:
> For DMA operation, the davinci spi driver needs an event queue number.
> Currently, this number is passed as a IORESOURCE_DMA. This is not
> correct, as the event queue is not a DMA channel. Pass the event queue
> via the platform data structure instead.
>
> On dm355 and dm365, move the eventq assignment for spi0 out of resources
> array and into platform data.
>
> Signed-off-by: Michael Williamson <michael.williamson@criticallink.com>
> Acked-by: Sekhar Nori <nsekhar@ti.com>
With Grant's ack, will merge this through davinci tree.
Kevin
> ---
> Changes since v1:
> - Add Sekhar's Ack.
> - Really fix the typo. This time for sure (blew the format patch
> on last go around).
>
> 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(-)
>
> 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",
> 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 = {
> diff --git a/arch/arm/mach-davinci/include/mach/spi.h b/arch/arm/mach-davinci/include/mach/spi.h
> index 38f4da5..7af305b 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 queue 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;
WARNING: multiple messages have this Message-ID (diff)
From: khilman@ti.com (Kevin Hilman)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2] davinci: spi: move event queue parameter to platform data
Date: Tue, 08 Feb 2011 13:58:54 -0800 [thread overview]
Message-ID: <87k4hakx29.fsf@ti.com> (raw)
In-Reply-To: <1297169995-31321-1-git-send-email-michael.williamson@criticallink.com> (Michael Williamson's message of "Tue, 8 Feb 2011 07:59:55 -0500")
Michael Williamson <michael.williamson@criticallink.com> writes:
> For DMA operation, the davinci spi driver needs an event queue number.
> Currently, this number is passed as a IORESOURCE_DMA. This is not
> correct, as the event queue is not a DMA channel. Pass the event queue
> via the platform data structure instead.
>
> On dm355 and dm365, move the eventq assignment for spi0 out of resources
> array and into platform data.
>
> Signed-off-by: Michael Williamson <michael.williamson@criticallink.com>
> Acked-by: Sekhar Nori <nsekhar@ti.com>
With Grant's ack, will merge this through davinci tree.
Kevin
> ---
> Changes since v1:
> - Add Sekhar's Ack.
> - Really fix the typo. This time for sure (blew the format patch
> on last go around).
>
> 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(-)
>
> 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",
> 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 = {
> diff --git a/arch/arm/mach-davinci/include/mach/spi.h b/arch/arm/mach-davinci/include/mach/spi.h
> index 38f4da5..7af305b 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 queue 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;
next prev parent reply other threads:[~2011-02-08 21:58 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-02-08 12:59 [PATCH v2] davinci: spi: move event queue parameter to platform data Michael Williamson
2011-02-08 12:59 ` Michael Williamson
2011-02-08 21:58 ` Kevin Hilman [this message]
2011-02-08 21:58 ` Kevin Hilman
2011-02-08 22:04 ` Grant Likely
2011-02-08 22:04 ` Grant Likely
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87k4hakx29.fsf@ti.com \
--to=khilman@ti.com \
--cc=davinci-linux-open-source@linux.davincidsp.com \
--cc=grant.likely@secretlab.ca \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=michael.williamson@criticallink.com \
--cc=spi-devel-general@lists.sourceforge.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.