1. 05 9月, 2018 2 次提交
    • G
      spi: rspi: Fix interrupted DMA transfers · 8dbbaa47
      Geert Uytterhoeven 提交于
      When interrupted, wait_event_interruptible_timeout() returns
      -ERESTARTSYS, and the SPI transfer in progress will fail, as expected:
      
          m25p80 spi0.0: SPI transfer failed: -512
          spi_master spi0: failed to transfer one message from queue
      
      However, as the underlying DMA transfers may not have completed, all
      subsequent SPI transfers may start to fail:
      
          spi_master spi0: receive timeout
          qspi_transfer_out_in() returned -110
          m25p80 spi0.0: SPI transfer failed: -110
          spi_master spi0: failed to transfer one message from queue
      
      Fix this by calling dmaengine_terminate_all() not only for timeouts, but
      also for errors.
      
      This can be reproduced on r8a7991/koelsch, using "hd /dev/mtd0" followed
      by CTRL-C.
      Signed-off-by: NGeert Uytterhoeven <geert+renesas@glider.be>
      Signed-off-by: NMark Brown <broonie@kernel.org>
      Cc: stable@vger.kernel.org
      8dbbaa47
    • G
      spi: rspi: Fix invalid SPI use during system suspend · c1ca59c2
      Geert Uytterhoeven 提交于
      If the SPI queue is running during system suspend, the system may lock
      up.
      
      Fix this by stopping/restarting the queue during system suspend/resume,
      by calling spi_master_suspend()/spi_master_resume() from the PM
      callbacks.  In-kernel users will receive an -ESHUTDOWN error while
      system suspend/resume is in progress.
      
      Based on a patch for sh-msiof by Gaku Inami.
      Signed-off-by: NGeert Uytterhoeven <geert+renesas@glider.be>
      Signed-off-by: NMark Brown <broonie@kernel.org>
      Cc: stable@vger.kernel.org
      c1ca59c2
  2. 20 3月, 2018 1 次提交
    • S
      spi: rspi: use correct enum for DMA transfer direction · 768d59f5
      Stefan Agner 提交于
      Use enum dma_transfer_direction as required by dmaengine_prep_slave_sg
      instead of enum dma_data_direction. This won't change behavior in
      practice as the enum values are equivalent.
      
      This fixes two warnings when building with clang:
        drivers/spi/spi-rspi.c:538:26: warning: implicit conversion from enumeration
            type 'enum dma_data_direction' to different enumeration type
            'enum dma_transfer_direction' [-Wenum-conversion]
                                              rx->sgl, rx->nents, DMA_FROM_DEVICE,
                                                                  ^~~~~~~~~~~~~~~
        drivers/spi/spi-rspi.c:558:26: warning: implicit conversion from enumeration
            type 'enum dma_data_direction' to different enumeration type
            'enum dma_transfer_direction' [-Wenum-conversion]
                                              tx->sgl, tx->nents, DMA_TO_DEVICE,
                                                                  ^~~~~~~~~~~~~
      Signed-off-by: NStefan Agner <stefan@agner.ch>
      Signed-off-by: NMark Brown <broonie@kernel.org>
      768d59f5
  3. 07 12月, 2017 1 次提交
  4. 04 10月, 2017 1 次提交
  5. 17 2月, 2017 2 次提交
    • D
      spi: rspi: Replaces "n" by "len" in qspi_transfer_*() · ad16d4a8
      DongCV 提交于
      This patch replaced "n" by "len" bytes of data in qspi_transfer_in() and
      qspi_transfer_out() function. This will make improving readability.
      Signed-off-by: NDongCV <cv-dong@jinso.co.jp>
      Reviewed-by: NGeert Uytterhoeven <geert+renesas@glider.be>
      Signed-off-by: NMark Brown <broonie@kernel.org>
      ad16d4a8
    • D
      spi: rspi: Fixes bogus received byte in qspi_transfer_in() · 7264abc7
      DongCV 提交于
      In qspi_transfer_in(), when receiving the last n (or len) bytes of data,
      one bogus byte was written in the receive buffer.
      This code leads to a buffer overflow.
      
      "jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found
      at 0x03b40000: 0x1900 instead
      jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found
      at 0x03b40004: 0x000c instead"
      
      The error message above happens when trying to mount, unmount,
      and remount a jffs2-formatted device.
      This patch removed the bogus write to fixes: 3be09bec
      "spi: rspi: supports 32bytes buffer for DUAL and QUAD"
      
      And here is Geert's comment:
      
      "spi: rspi: Fix bogus received byte in qspi_transfer_in()
      When there are less than QSPI_BUFFER_SIZE remaining bytes to be received,
      qspi_transfer_in() writes one bogus byte in the receive buffer, possibly
      leading to a buffer overflow.
      This can be reproduced by mounting, unmounting, and remounting a
      jffs2-formatted device, causing lots of warnings like:
      
      "jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found
      at 0x03b40000: 0x1900 instead"
      
      Remove the bogus write to fix this. "
      Signed-off-by: NDongCV <cv-dong@jinso.co.jp>
      Reviewed-by: NGeert Uytterhoeven <geert+renesas@glider.be>
      Signed-off-by: NMark Brown <broonie@kernel.org>
      7264abc7
  6. 05 1月, 2017 1 次提交
  7. 09 11月, 2016 1 次提交
    • A
      spi: rspi: avoid uninitialized variable access · db300838
      Arnd Bergmann 提交于
      The newly introduced rspi_pio_transfer_in_or_our() function must
      take either a valid 'rx' or 'tx' pointer, and has undefined behavior
      if both are NULL, as found by 'gcc -Wmaybe-unintialized':
      
      drivers/spi/spi-rspi.c: In function 'rspi_pio_transfer_in_or_our':
      drivers/spi/spi-rspi.c:558:5: error: 'len' may be used uninitialized in this function [-Werror=maybe-uninitialized]
      
      The analysis of the function is correct in principle, but the code
      is currently safe because both callers always pass exactly one
      of the two pointers.
      
      Looking closer at this function shows that having a combined
      method for rx and tx here actually increases the complexity
      and the size of the file. This simplifies it again by keeping
      the two separate, which then ends up avoiding that warning.
      
      Fixes: 3be09bec ("spi: rspi: supports 32bytes buffer for DUAL and QUAD")
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      Signed-off-by: NMark Brown <broonie@kernel.org>
      db300838
  8. 05 11月, 2016 1 次提交
  9. 08 8月, 2016 1 次提交
  10. 03 7月, 2015 2 次提交
  11. 02 6月, 2015 2 次提交
  12. 07 5月, 2015 1 次提交
  13. 02 5月, 2015 1 次提交
  14. 07 4月, 2015 1 次提交
  15. 30 3月, 2015 1 次提交
  16. 23 2月, 2015 1 次提交
  17. 22 12月, 2014 1 次提交
  18. 20 10月, 2014 1 次提交
  19. 28 8月, 2014 1 次提交
  20. 17 8月, 2014 5 次提交
  21. 17 7月, 2014 1 次提交
  22. 07 7月, 2014 2 次提交
  23. 02 6月, 2014 9 次提交