* [PATCH] spi: omap2-mcspi: Reorder the wait_for_completion for tx
@ 2012-11-06 9:00 Shubhrajyoti D
2012-11-06 9:03 ` Mark Brown
0 siblings, 1 reply; 6+ messages in thread
From: Shubhrajyoti D @ 2012-11-06 9:00 UTC (permalink / raw)
To: spi-devel-general
Cc: broonie, grant.likely, linux-omap, linux-kernel, Shubhrajyoti D
The commit d7b4394e[Cleanup the omap2_mcspi_txrx_dma function]
changed the wait_for_completion order. Move the wait so that the
rx doesnot wait for the tx to complete.
Reported-and-tested-by: Sørensen, Stefan <Sorensen@polycom.com>
Signed-off-by: Shubhrajyoti D <shubhrajyoti@ti.com>
---
drivers/spi/spi-omap2-mcspi.c | 39 +++++++++++++++++++--------------------
1 files changed, 19 insertions(+), 20 deletions(-)
diff --git a/drivers/spi/spi-omap2-mcspi.c b/drivers/spi/spi-omap2-mcspi.c
index bcfd062..251f6d0 100644
--- a/drivers/spi/spi-omap2-mcspi.c
+++ b/drivers/spi/spi-omap2-mcspi.c
@@ -323,18 +323,13 @@ static void omap2_mcspi_tx_dma(struct spi_device *spi,
struct omap2_mcspi *mcspi;
struct omap2_mcspi_dma *mcspi_dma;
unsigned int count;
- u8 * rx;
const u8 * tx;
- void __iomem *chstat_reg;
- struct omap2_mcspi_cs *cs = spi->controller_state;
mcspi = spi_master_get_devdata(spi->master);
mcspi_dma = &mcspi->dma_channels[spi->chip_select];
count = xfer->len;
- rx = xfer->rx_buf;
tx = xfer->tx_buf;
- chstat_reg = cs->base + OMAP2_MCSPI_CHSTAT0;
if (mcspi_dma->dma_tx) {
struct dma_async_tx_descriptor *tx;
@@ -359,19 +354,6 @@ static void omap2_mcspi_tx_dma(struct spi_device *spi,
dma_async_issue_pending(mcspi_dma->dma_tx);
omap2_mcspi_set_dma_req(spi, 0, 1);
- wait_for_completion(&mcspi_dma->dma_tx_completion);
- dma_unmap_single(mcspi->dev, xfer->tx_dma, count,
- DMA_TO_DEVICE);
-
- /* for TX_ONLY mode, be sure all words have shifted out */
- if (rx == NULL) {
- if (mcspi_wait_for_reg_bit(chstat_reg,
- OMAP2_MCSPI_CHSTAT_TXS) < 0)
- dev_err(&spi->dev, "TXS timed out\n");
- else if (mcspi_wait_for_reg_bit(chstat_reg,
- OMAP2_MCSPI_CHSTAT_EOT) < 0)
- dev_err(&spi->dev, "EOT timed out\n");
- }
}
static unsigned
@@ -492,6 +474,7 @@ omap2_mcspi_txrx_dma(struct spi_device *spi, struct spi_transfer *xfer)
struct dma_slave_config cfg;
enum dma_slave_buswidth width;
unsigned es;
+ void __iomem *chstat_reg;
mcspi = spi_master_get_devdata(spi->master);
mcspi_dma = &mcspi->dma_channels[spi->chip_select];
@@ -526,8 +509,24 @@ omap2_mcspi_txrx_dma(struct spi_device *spi, struct spi_transfer *xfer)
omap2_mcspi_tx_dma(spi, xfer, cfg);
if (rx != NULL)
- return omap2_mcspi_rx_dma(spi, xfer, cfg, es);
-
+ count = omap2_mcspi_rx_dma(spi, xfer, cfg, es);
+
+ if (tx != NULL) {
+ chstat_reg = cs->base + OMAP2_MCSPI_CHSTAT0;
+ wait_for_completion(&mcspi_dma->dma_tx_completion);
+ dma_unmap_single(mcspi->dev, xfer->tx_dma, xfer->len,
+ DMA_TO_DEVICE);
+
+ /* for TX_ONLY mode, be sure all words have shifted out */
+ if (rx == NULL) {
+ if (mcspi_wait_for_reg_bit(chstat_reg,
+ OMAP2_MCSPI_CHSTAT_TXS) < 0)
+ dev_err(&spi->dev, "TXS timed out\n");
+ else if (mcspi_wait_for_reg_bit(chstat_reg,
+ OMAP2_MCSPI_CHSTAT_EOT) < 0)
+ dev_err(&spi->dev, "EOT timed out\n");
+ }
+ }
return count;
}
--
1.7.5.4
^ permalink raw reply related [flat|nested] 6+ messages in thread* Re: [PATCH] spi: omap2-mcspi: Reorder the wait_for_completion for tx
2012-11-06 9:00 [PATCH] spi: omap2-mcspi: Reorder the wait_for_completion for tx Shubhrajyoti D
@ 2012-11-06 9:03 ` Mark Brown
2012-11-06 9:17 ` Shubhrajyoti Datta
0 siblings, 1 reply; 6+ messages in thread
From: Mark Brown @ 2012-11-06 9:03 UTC (permalink / raw)
To: Shubhrajyoti D; +Cc: spi-devel-general, grant.likely, linux-omap, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 257 bytes --]
On Tue, Nov 06, 2012 at 02:30:19PM +0530, Shubhrajyoti D wrote:
> The commit d7b4394e[Cleanup the omap2_mcspi_txrx_dma function]
> changed the wait_for_completion order. Move the wait so that the
> rx doesnot wait for the tx to complete.
Applied, thanks.
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] spi: omap2-mcspi: Reorder the wait_for_completion for tx
2012-11-06 9:03 ` Mark Brown
@ 2012-11-06 9:17 ` Shubhrajyoti Datta
0 siblings, 0 replies; 6+ messages in thread
From: Shubhrajyoti Datta @ 2012-11-06 9:17 UTC (permalink / raw)
To: Mark Brown
Cc: Shubhrajyoti D, spi-devel-general, grant.likely, linux-omap,
linux-kernel
On Tue, Nov 6, 2012 at 2:33 PM, Mark Brown
<broonie@opensource.wolfsonmicro.com> wrote:
> On Tue, Nov 06, 2012 at 02:30:19PM +0530, Shubhrajyoti D wrote:
>> The commit d7b4394e[Cleanup the omap2_mcspi_txrx_dma function]
>> changed the wait_for_completion order. Move the wait so that the
>> rx doesnot wait for the tx to complete.
>
> Applied, thanks.
Thanks Mark,
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH] spi: omap2-mcspi: Reorder the wait_for_completion for tx
@ 2012-11-06 9:17 Shubhrajyoti D
2012-11-06 9:22 ` Mark Brown
0 siblings, 1 reply; 6+ messages in thread
From: Shubhrajyoti D @ 2012-11-06 9:17 UTC (permalink / raw)
To: spi-devel-general
Cc: broonie, grant.likely, linux-omap, linux-kernel, Shubhrajyoti D
The commit d7b4394e[Cleanup the omap2_mcspi_txrx_dma function]
changed the wait_for_completion order. Move the wait so that the
rx doesnot wait for the tx to complete.
Reported-and-tested-by: Sørensen, Stefan <Sorensen@polycom.com>
Signed-off-by: Shubhrajyoti D <shubhrajyoti@ti.com>
---
drivers/spi/spi-omap2-mcspi.c | 39 +++++++++++++++++++--------------------
1 files changed, 19 insertions(+), 20 deletions(-)
diff --git a/drivers/spi/spi-omap2-mcspi.c b/drivers/spi/spi-omap2-mcspi.c
index bcfd062..251f6d0 100644
--- a/drivers/spi/spi-omap2-mcspi.c
+++ b/drivers/spi/spi-omap2-mcspi.c
@@ -323,18 +323,13 @@ static void omap2_mcspi_tx_dma(struct spi_device *spi,
struct omap2_mcspi *mcspi;
struct omap2_mcspi_dma *mcspi_dma;
unsigned int count;
- u8 * rx;
const u8 * tx;
- void __iomem *chstat_reg;
- struct omap2_mcspi_cs *cs = spi->controller_state;
mcspi = spi_master_get_devdata(spi->master);
mcspi_dma = &mcspi->dma_channels[spi->chip_select];
count = xfer->len;
- rx = xfer->rx_buf;
tx = xfer->tx_buf;
- chstat_reg = cs->base + OMAP2_MCSPI_CHSTAT0;
if (mcspi_dma->dma_tx) {
struct dma_async_tx_descriptor *tx;
@@ -359,19 +354,6 @@ static void omap2_mcspi_tx_dma(struct spi_device *spi,
dma_async_issue_pending(mcspi_dma->dma_tx);
omap2_mcspi_set_dma_req(spi, 0, 1);
- wait_for_completion(&mcspi_dma->dma_tx_completion);
- dma_unmap_single(mcspi->dev, xfer->tx_dma, count,
- DMA_TO_DEVICE);
-
- /* for TX_ONLY mode, be sure all words have shifted out */
- if (rx == NULL) {
- if (mcspi_wait_for_reg_bit(chstat_reg,
- OMAP2_MCSPI_CHSTAT_TXS) < 0)
- dev_err(&spi->dev, "TXS timed out\n");
- else if (mcspi_wait_for_reg_bit(chstat_reg,
- OMAP2_MCSPI_CHSTAT_EOT) < 0)
- dev_err(&spi->dev, "EOT timed out\n");
- }
}
static unsigned
@@ -492,6 +474,7 @@ omap2_mcspi_txrx_dma(struct spi_device *spi, struct spi_transfer *xfer)
struct dma_slave_config cfg;
enum dma_slave_buswidth width;
unsigned es;
+ void __iomem *chstat_reg;
mcspi = spi_master_get_devdata(spi->master);
mcspi_dma = &mcspi->dma_channels[spi->chip_select];
@@ -526,8 +509,24 @@ omap2_mcspi_txrx_dma(struct spi_device *spi, struct spi_transfer *xfer)
omap2_mcspi_tx_dma(spi, xfer, cfg);
if (rx != NULL)
- return omap2_mcspi_rx_dma(spi, xfer, cfg, es);
-
+ count = omap2_mcspi_rx_dma(spi, xfer, cfg, es);
+
+ if (tx != NULL) {
+ chstat_reg = cs->base + OMAP2_MCSPI_CHSTAT0;
+ wait_for_completion(&mcspi_dma->dma_tx_completion);
+ dma_unmap_single(mcspi->dev, xfer->tx_dma, xfer->len,
+ DMA_TO_DEVICE);
+
+ /* for TX_ONLY mode, be sure all words have shifted out */
+ if (rx == NULL) {
+ if (mcspi_wait_for_reg_bit(chstat_reg,
+ OMAP2_MCSPI_CHSTAT_TXS) < 0)
+ dev_err(&spi->dev, "TXS timed out\n");
+ else if (mcspi_wait_for_reg_bit(chstat_reg,
+ OMAP2_MCSPI_CHSTAT_EOT) < 0)
+ dev_err(&spi->dev, "EOT timed out\n");
+ }
+ }
return count;
}
--
1.7.5.4
^ permalink raw reply related [flat|nested] 6+ messages in thread* Re: [PATCH] spi: omap2-mcspi: Reorder the wait_for_completion for tx
2012-11-06 9:17 Shubhrajyoti D
@ 2012-11-06 9:22 ` Mark Brown
2012-11-06 10:09 ` Shubhrajyoti Datta
0 siblings, 1 reply; 6+ messages in thread
From: Mark Brown @ 2012-11-06 9:22 UTC (permalink / raw)
To: Shubhrajyoti D; +Cc: spi-devel-general, grant.likely, linux-omap, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 316 bytes --]
On Tue, Nov 06, 2012 at 02:47:27PM +0530, Shubhrajyoti D wrote:
> The commit d7b4394e[Cleanup the omap2_mcspi_txrx_dma function]
> changed the wait_for_completion order. Move the wait so that the
> rx doesnot wait for the tx to complete.
Is this a resend of the patch I just applied, or is it something
different?
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] spi: omap2-mcspi: Reorder the wait_for_completion for tx
2012-11-06 9:22 ` Mark Brown
@ 2012-11-06 10:09 ` Shubhrajyoti Datta
0 siblings, 0 replies; 6+ messages in thread
From: Shubhrajyoti Datta @ 2012-11-06 10:09 UTC (permalink / raw)
To: Mark Brown
Cc: Shubhrajyoti D, spi-devel-general, grant.likely, linux-omap,
linux-kernel
On Tue, Nov 6, 2012 at 2:52 PM, Mark Brown
<broonie@opensource.wolfsonmicro.com> wrote:
> On Tue, Nov 06, 2012 at 02:47:27PM +0530, Shubhrajyoti D wrote:
>> The commit d7b4394e[Cleanup the omap2_mcspi_txrx_dma function]
>> changed the wait_for_completion order. Move the wait so that the
>> rx doesnot wait for the tx to complete.
>
> Is this a resend of the patch I just applied, or is it something
> different?
No please ignore this one.
Something wrong at my end it got sent twice.
Please ignore.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2012-11-06 10:09 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-11-06 9:00 [PATCH] spi: omap2-mcspi: Reorder the wait_for_completion for tx Shubhrajyoti D
2012-11-06 9:03 ` Mark Brown
2012-11-06 9:17 ` Shubhrajyoti Datta
-- strict thread matches above, loose matches on Subject: below --
2012-11-06 9:17 Shubhrajyoti D
2012-11-06 9:22 ` Mark Brown
2012-11-06 10:09 ` Shubhrajyoti Datta
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox