1. 09 Mar, 2016 1 commit
    • Jon Hunter's avatar
      spi: core: Fix deadlock when sending messages · 49023d2e
      Jon Hunter authored
      The function __spi_pump_messages() is called by spi_pump_messages() and
      __spi_sync(). The function __spi_sync() has an argument 'bus_locked'
      that indicates if it is called with the SPI bus mutex held or not. If
      'bus_locked' is false then __spi_sync() will acquire the mutex itself.
      
      Commit 556351f1 ("spi: introduce accelerated read support for spi
      flash devices") made a change to acquire the SPI bus mutex within
      __spi_pump_messages(). However, this change did not check to see if the
      mutex is already held. If __spi_sync() is called with the mutex held
      (ie. 'bus_locked' is true), then a deadlock occurs when
      __spi_pump_messages() is called.
      
      Fix this deadlock by passing the 'bus_locked' state from __spi_sync() to
      __spi_pump_messages() and only acquire the mutex if not already held. In
      the case where __spi_pump_messages() is called from spi_pump_messages()
      it is assumed that the mutex is not held and so call
      __spi_pump_messages() with 'bus_locked' set to false. Finally, move the
      unlocking of the mutex to the end of the __spi_pump_messages() function
      to simplify the code and only call cond_resched() if there are no
      errors.
      
      Fixes: 556351f1 ("spi: introduce accelerated read support for spi flash devices")
      Signed-off-by: default avatarJon Hunter <jonathanh@nvidia.com>
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      49023d2e
  2. 18 Feb, 2016 1 commit
  3. 09 Feb, 2016 1 commit
    • Vignesh R's avatar
      spi: introduce accelerated read support for spi flash devices · 556351f1
      Vignesh R authored
      In addition to providing direct access to SPI bus, some spi controller
      hardwares (like ti-qspi) provide special port (like memory mapped port)
      that are optimized to improve SPI flash read performance.
      This means the controller can automatically send the SPI signals
      required to read data from the SPI flash device.
      For this, SPI controller needs to know flash specific information like
      read command to use, dummy bytes and address width.
      
      Introduce spi_flash_read() interface to support accelerated read
      over SPI flash devices. SPI master drivers can implement this callback to
      support interfaces such as memory mapped read etc. m25p80 flash driver
      and other flash drivers can call this make use of such interfaces. The
      interface should only be used with SPI flashes and cannot be used with
      other SPI devices.
      Signed-off-by: default avatarVignesh R <vigneshr@ti.com>
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      556351f1
  4. 24 Jan, 2016 37 commits