lkml.org 
[lkml]   [2018]   [Mar]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 3.18 18/68] spi: omap2-mcspi: poll OMAP2_MCSPI_CHSTAT_RXS for PIO transfer
    Date
    3.18-stable review patch.  If anyone has any objections, please let me know.

    ------------------

    From: Akinobu Mita <akinobu.mita@gmail.com>


    [ Upstream commit 812613591cb652344186c4cd912304ed02138566 ]

    When running the spi-loopback-test with slower clock rate like 10 KHz,
    the test for 251 bytes transfer was failed. This failure triggered an
    spi-omap2-mcspi's error message "DMA RX last word empty".

    This message means that PIO for reading the remaining bytes due to the
    DMA transfer length reduction is failed. This problem can be fixed by
    polling OMAP2_MCSPI_CHSTAT_RXS bit in channel status register to wait
    until the receive buffer register is filled.

    Cc: Mark Brown <broonie@kernel.org>
    Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
    Signed-off-by: Mark Brown <broonie@kernel.org>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    ---
    drivers/spi/spi-omap2-mcspi.c | 9 +++++----
    1 file changed, 5 insertions(+), 4 deletions(-)

    --- a/drivers/spi/spi-omap2-mcspi.c
    +++ b/drivers/spi/spi-omap2-mcspi.c
    @@ -441,6 +441,8 @@ omap2_mcspi_rx_dma(struct spi_device *sp
    int elements = 0;
    int word_len, element_count;
    struct omap2_mcspi_cs *cs = spi->controller_state;
    + void __iomem *chstat_reg = cs->base + OMAP2_MCSPI_CHSTAT0;
    +
    mcspi = spi_master_get_devdata(spi->master);
    mcspi_dma = &mcspi->dma_channels[spi->chip_select];
    count = xfer->len;
    @@ -501,8 +503,8 @@ omap2_mcspi_rx_dma(struct spi_device *sp
    if (l & OMAP2_MCSPI_CHCONF_TURBO) {
    elements--;

    - if (likely(mcspi_read_cs_reg(spi, OMAP2_MCSPI_CHSTAT0)
    - & OMAP2_MCSPI_CHSTAT_RXS)) {
    + if (!mcspi_wait_for_reg_bit(chstat_reg,
    + OMAP2_MCSPI_CHSTAT_RXS)) {
    u32 w;

    w = mcspi_read_cs_reg(spi, OMAP2_MCSPI_RX0);
    @@ -520,8 +522,7 @@ omap2_mcspi_rx_dma(struct spi_device *sp
    return count;
    }
    }
    - if (likely(mcspi_read_cs_reg(spi, OMAP2_MCSPI_CHSTAT0)
    - & OMAP2_MCSPI_CHSTAT_RXS)) {
    + if (!mcspi_wait_for_reg_bit(chstat_reg, OMAP2_MCSPI_CHSTAT_RXS)) {
    u32 w;

    w = mcspi_read_cs_reg(spi, OMAP2_MCSPI_RX0);

    \
     
     \ /
      Last update: 2018-03-19 21:50    [W:4.061 / U:0.080 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site