1. 03 3月, 2015 1 次提交
  2. 05 2月, 2015 1 次提交
  3. 24 12月, 2014 1 次提交
  4. 22 12月, 2014 1 次提交
  5. 11 12月, 2014 1 次提交
    • M
      spi: Pump transfers inside calling context for spi_sync() · 0461a414
      Mark Brown 提交于
      If we are using the standard SPI message pump (which all drivers should be
      transitioning over to) then special case the message enqueue and instead of
      starting the worker thread to push messages to the hardware do so in the
      context of the caller if the controller is idle. This avoids a context
      switch in the common case where the controller has a single user in a
      single thread, for short PIO transfers there may be no need to context
      switch away from the calling context to complete the transfer.
      
      The code is a bit more complex than is desirable in part due to the need
      to handle drivers not using the standard queue and in part due to handling
      the various combinations of bus locking and asynchronous submission in
      interrupt context.
      
      It is still suboptimal since it will still wake the message pump for each
      transfer in order to schedule idling of the hardware and if multiple
      contexts are using the controller simultaneously a caller may end up
      pumping a message for some random other thread rather than for itself,
      and if the thread ends up deferring due to another context idling the
      hardware then it will just busy wait.  It can, however, have the benefit
      of aggregating power up and down of the hardware when a caller performs
      a series of transfers back to back without any need for the use of
      spi_async().
      Signed-off-by: NMark Brown <broonie@kernel.org>
      0461a414
  6. 25 11月, 2014 1 次提交
  7. 18 9月, 2014 1 次提交
  8. 05 9月, 2014 1 次提交
  9. 13 8月, 2014 1 次提交
  10. 01 7月, 2014 1 次提交
    • G
      spi: sh-msiof: Add DMA support · b0d0ce8b
      Geert Uytterhoeven 提交于
      Add DMA support to the MSIOF driver using platform data.
      
      As MSIOF DMA is limited to 32-bit words (requiring byte/wordswapping for
      smaller wordsizes), and the group length is limited to 256 words, DMA is
      performed on two fixed pages, allocated and mapped at driver initialization
      time.
      
      Performance figures (in Mbps) on r8a7791/koelsch at different SPI clock
      frequencies for 1024-byte and 4096-byte transfers:
      
                         1024 bytes           4096 bytes
        -  3.25 MHz: PIO  2.1, DMA  2.6 | PIO  2.8, DMA  3.1
        -  6.5  MHz: PIO  3.2, DMA  4.4 | PIO  5.0, DMA  5.9
        - 13    MHz: PIO  4.2, DMA  6.6 | PIO  8.2, DMA 10.7
        - 26    MHz: PIO  5.9, DMA 10.4 | PIO 12.4, DMA 18.4
      
      Note that DMA is only faster than PIO for transfers that exceed the FIFO
      size (typically 64 words / 256 bytes).
      
      Also note that large transfers (larger than the group length for DMA, or
      larger than the FIFO size for PIO), should use cs-gpio (with the
      appropriate pinmux setup), as the hardware chipselect will be deasserted in
      between chunks.
      Signed-off-by: NGeert Uytterhoeven <geert+renesas@glider.be>
      Signed-off-by: NMark Brown <broonie@linaro.org>
      b0d0ce8b
  11. 23 6月, 2014 1 次提交
  12. 02 6月, 2014 1 次提交
  13. 27 4月, 2014 1 次提交
  14. 15 4月, 2014 1 次提交
  15. 29 3月, 2014 1 次提交
  16. 19 2月, 2014 1 次提交
  17. 05 2月, 2014 2 次提交
    • M
      spi: Make core DMA mapping functions generate scatterlists · 6ad45a27
      Mark Brown 提交于
      We cannot unconditionally use dma_map_single() to map data for use with
      SPI since transfers may exceed a page and virtual addresses may not be
      provided with physically contiguous pages. Further, addresses allocated
      using vmalloc() need to be mapped differently to other addresses.
      
      Currently only the MXS driver handles all this, a few drivers do handle
      the possibility that buffers may not be physically contiguous which is
      the main potential problem but many don't even do that. Factoring this
      out into the core will make it easier for drivers to do a good job so if
      the driver is using the core DMA code then generate a scatterlist
      instead of mapping to a single address so do that.
      
      This code is mainly based on a combination of the existing code in the MXS
      and PXA2xx drivers. In future we should be able to extend it to allow the
      core to concatenate adjacent transfers if they are compatible, improving
      performance.
      
      Currently for simplicity clients are not allowed to use the scatterlist
      when they do DMA mapping, in the future the existing single address
      mappings will be replaced with use of the scatterlist most likely as
      part of pre-verifying transfers.
      
      This change makes it mandatory to use scatterlists when using the core DMA
      mapping so update the s3c64xx driver to do this when used with dmaengine.
      Doing so makes the code more ugly but it is expected that the old s3c-dma
      code can be removed very soon.
      Signed-off-by: NMark Brown <broonie@linaro.org>
      6ad45a27
    • M
      spi: Provide core support for full duplex devices · 3a2eba9b
      Mark Brown 提交于
      It is fairly common for SPI devices to require that one or both transfer
      directions is always active. Currently drivers open code this in various
      ways with varying degrees of efficiency. Start factoring this out by
      providing flags SPI_MASTER_MUST_TX and SPI_MASTER_MUST_RX. These will cause
      the core to provide buffers for the requested direction if none are
      specified in the underlying transfer.
      
      Currently this is fairly inefficient since we actually allocate a data
      buffer which may get large, support for mapping transfers using a
      scatterlist will allow us to avoid this for DMA based transfers.
      Signed-off-by: NMark Brown <broonie@linaro.org>
      3a2eba9b
  18. 03 2月, 2014 1 次提交
    • M
      spi: Provide core support for DMA mapping transfers · 99adef31
      Mark Brown 提交于
      The process of DMA mapping buffers for SPI transfers does not vary between
      devices so in order to save duplication of code in drivers this can be
      factored out into the core, allowing it to be integrated with the work that
      is being done on factoring out the common elements from the data path
      including more sharing of dmaengine code.
      
      In order to use this masters need to provide a can_dma() operation and while
      the hardware is prepared they should ensure that DMA channels are provided
      in tx_dma and rx_dma. The core will then ensure that the buffers are mapped
      for DMA prior to calling transfer_one_message().
      
      Currently the cleanup on error is not complete, this needs to be improved.
      Signed-off-by: NMark Brown <broonie@linaro.org>
      99adef31
  19. 28 1月, 2014 2 次提交
  20. 22 1月, 2014 2 次提交
  21. 13 1月, 2014 2 次提交
  22. 08 1月, 2014 1 次提交
  23. 17 12月, 2013 1 次提交
  24. 12 12月, 2013 1 次提交
  25. 12 10月, 2013 2 次提交
    • M
      spi: Provide common spi_message processing loop · b158935f
      Mark Brown 提交于
      The loops which SPI controller drivers use to process the list of transfers
      in a spi_message are typically very similar and have some error prone areas
      such as the handling of /CS. Help simplify drivers by factoring this code
      out into the core - if drivers provide a transfer_one() function instead
      of a transfer_one_message() function the core will handle processing at the
      message level.
      
      /CS can be controlled by either setting cs_gpio or providing a set_cs
      function. If this is not possible for hardware reasons then both can be
      omitted and the driver should continue to implement manual /CS handling.
      
      This is a first step in refactoring and it is expected that there will be
      further enhancements, for example factoring out of the mapping of transfers
      for DMA and the initiation and completion of interrupt driven transfers.
      Signed-off-by: NMark Brown <broonie@linaro.org>
      b158935f
    • M
      spi: Provide per-message prepare and unprepare operations · 2841a5fc
      Mark Brown 提交于
      Many SPI drivers perform setup and tear down on every message, usually
      doing things like DMA mapping the message. Provide hooks for them to use
      to provide such operations.
      
      This is of limited value for drivers that implement transfer_one_message()
      but will be of much greater utility with future factoring out of standard
      implementations of that function.
      Signed-off-by: NMark Brown <broonie@linaro.org>
      2841a5fc
  26. 03 10月, 2013 1 次提交
    • L
      spi: Add a spi_w8r16be() helper · 05071aa8
      Lars-Peter Clausen 提交于
      This patch adds a new spi_w8r16be() helper, which is similar to spi_w8r16()
      except that it converts the read data word from big endian to native endianness
      before returning it. The reason for introducing this new helper is that for SPI
      slave devices it is quite common that the read 16 bit data word is in big
      endian. So users of spi_w8r16() have to convert the result to native endianness
      manually. A second reason is that in this case the endianness of the return
      value of spi_w8r16() depends on its sign. If it is negative (i.e. a error code)
      it is already in native endianness, if it is positive it is in big endian. The
      sparse code checker doesn't like this kind of mixed endianness and special
      annotations are necessary to keep it quiet (E.g. casting to be16 using __force).
      Doing the conversion to native endianness in the helper function does not
      require such annotations since we are not mixing different endiannesses in the
      same variable.
      Signed-off-by: NLars-Peter Clausen <lars@metafoo.de>
      Signed-off-by: NMark Brown <broonie@linaro.org>
      05071aa8
  27. 17 9月, 2013 2 次提交
  28. 25 8月, 2013 2 次提交
  29. 22 8月, 2013 1 次提交
    • W
      spi: DUAL and QUAD support · f477b7fb
      wangyuhang 提交于
      fix the previous patch some mistake below:
      1. DT in slave node, use "spi-tx-nbits = <1/2/4>" in place of using
         "spi-tx-dual, spi-tx-quad" directly, same to rx. So correct the
         previous way to get the property in @of_register_spi_devices().
      2. Change the value of transfer bit macro(SPI_NBITS_SINGLE, SPI_NBITS_DUAL
         SPI_NBITS_QUAD) to 0x01, 0x02 and 0x04 to match the actual wires.
      3. Add the following check
         (1)keep the tx_nbits and rx_nbits in spi_transfer is not beyond the
            single, dual and quad.
         (2)keep tx_nbits and rx_nbits are contained by @spi_device->mode
            example: if @spi_device->mode = DUAL, then tx/rx_nbits can not be set
                     to QUAD(SPI_NBITS_QUAD)
         (3)if "@spi_device->mode & SPI_3WIRE", then tx/rx_nbits should be in
            single(SPI_NBITS_SINGLE)
      Signed-off-by: Nwangyuhang <wangyuhang2014@gmail.com>
      Signed-off-by: NMark Brown <broonie@linaro.org>
      f477b7fb
  30. 02 8月, 2013 1 次提交
  31. 30 7月, 2013 1 次提交
  32. 18 7月, 2013 2 次提交