1. 16 2月, 2016 1 次提交
  2. 13 2月, 2016 1 次提交
  3. 10 2月, 2016 3 次提交
    • M
      spi: core: add spi_split_transfers_maxsize · d9f12122
      Martin Sperl 提交于
      Add spi_split_transfers_maxsize method that splits
      spi_transfers transparently into multiple transfers
      that are below the given max-size.
      
      This makes use of the spi_res framework via
      spi_replace_transfers to allocate/free the extra
      transfers as well as reverting back the changes applied
      while processing the spi_message.
      Signed-off-by: NMartin Sperl <kernel@martin.sperl.org>
      Signed-off-by: NMark Brown <broonie@kernel.org>
      d9f12122
    • M
      spi: core: add spi_replace_transfers method · 523baf5a
      Martin Sperl 提交于
      Add the spi_replace_transfers method that can get used
      to replace some spi_transfers from a spi_message with other
      transfers.
      Signed-off-by: NMartin Sperl <kernel@martin.sperl.org>
      Signed-off-by: NMark Brown <broonie@kernel.org>
      523baf5a
    • M
      spi: core: added spi_resource management · d780c371
      Martin Sperl 提交于
      SPI resource management framework used while processing a spi_message
      via the spi-core.
      
      The basic idea is taken from devres, but as the allocation may happen
      fairly frequently, some provisioning (in the form of an unused spi_device
      pointer argument to spi_res_alloc) has been made so that at a later stage
      we may implement reuse objects allocated earlier avoiding the repeated
      allocation by keeping a cache of objects that we can reuse.
      
      This framework can get used for:
      * rewriting spi_messages
        * to fullfill alignment requirements of the spi_master HW
        * to fullfill transfer length requirements
          (e.g: transfers need to be less than 64k)
        * consolidate spi_messages with multiple transfers into a single transfer
        when the total transfer length is below a threshold.
      * reimplement spi_unmap_buf without explicitly needing to check if it has
        been mapped
      Signed-off-by: NMartin Sperl <kernel@martin.sperl.org>
      Signed-off-by: NMark Brown <broonie@kernel.org>
      d780c371
  4. 01 1月, 2016 1 次提交
  5. 23 12月, 2015 1 次提交
  6. 16 12月, 2015 1 次提交
  7. 02 12月, 2015 2 次提交
  8. 27 11月, 2015 1 次提交
  9. 11 11月, 2015 1 次提交
  10. 28 10月, 2015 2 次提交
  11. 24 10月, 2015 1 次提交
  12. 21 10月, 2015 1 次提交
  13. 16 10月, 2015 1 次提交
  14. 13 10月, 2015 1 次提交
    • J
      spi: Map SPI OF client IRQ at probe time · 44af7927
      Jon Hunter 提交于
      Currently the IRQs for SPI client devices, registered via device-tree,
      are mapped when the client devices are registered. If the corresponding
      irq-chip has not been probed yet, then the probing of the client device
      will fail and will not be retried. Resolve this by mapping the IRQ at
      probe time and allow the probe to be deferred if the IRQ is not yet
      available.
      
      If of_irq_get() returns an error that is not -EPROBE_DEFER, then assume
      that the SPI client does not have an IRQ and set the IRQ number to zero
      (which is equivalent to irq_of_parse_and_map()).
      
      This is based on some inputs from Thierry Reding <treding@nvidia.com>.
      
      Cc: Thierry Reding <treding@nvidia.com>
      Cc: Tomeu Vizoso <tomeu.vizoso@collabora.com>
      Signed-off-by: NJon Hunter <jonathanh@nvidia.com>
      Signed-off-by: NMark Brown <broonie@kernel.org>
      44af7927
  15. 20 9月, 2015 1 次提交
  16. 06 9月, 2015 1 次提交
  17. 27 8月, 2015 1 次提交
  18. 22 8月, 2015 1 次提交
  19. 25 7月, 2015 1 次提交
  20. 07 7月, 2015 2 次提交
    • M
      spi: expose spi_master and spi_device statistics via sysfs · eca2ebc7
      Martin Sperl 提交于
      per spi-master statistics accessible as:
        /sys/class/spi_master/spi*/statistics/*
      
      per spi-device statistics accessible via:
        /sys/class/spi_master/spi*/spi*.*/statistics/*
      
      The following statistics are exposed as separate "files" inside
      these directories:
      * messages              number of spi_messages
      * transfers             number of spi_transfers
      * bytes                 number of bytes transferred
      * bytes_rx              number of bytes transmitted
      * bytes_tx              number of bytes received
      * errors                number of errors encounterd
      * timedout              number of messages that have timed out
      * spi_async             number of spi_messages submitted using spi_async
      * spi_sync              number of spi_messages submitted using spi_sync
      * spi_sync_immediate    number of spi_messages submitted using spi_sync,
                              that are handled immediately without a context switch
                              to the spi_pump worker-thread
      Signed-off-by: NMartin Sperl <kernel@martin.sperl.org>
      Signed-off-by: NMark Brown <broonie@kernel.org>
      eca2ebc7
    • A
      spi: Fix per-page mapping of unaligned vmalloc-ed buffer · 65598c13
      Andrew Gabbasov 提交于
      spi_map_buf() processes mapping of vmalloc-ed buffers in a special way,
      making mapping of every page separately. However, if the buffer is not
      aligned to page boundary (e.g. sub-array in a vmalloc-ed array), it
      fills the scatter table with page-size unaligned pieces, that cross
      page boundaries. This is incorrect and can, for example, cause memory
      corruption and various crashes when working with ubifs on spi-nor chips
      (though those drivers are themselves buggy in that they should be
      providing DMAable memory to the SPI framework).
      
      Fix this by using proper scatter table size and intra-page buffer lengths,
      so that the whole buffer splits into separate scatter table entries on
      page boundaries.
      Signed-off-by: NAndrew Gabbasov <andrew_gabbasov@mentor.com>
      Signed-off-by: NMark Brown <broonie@kernel.org>
      65598c13
  21. 03 6月, 2015 1 次提交
    • M
      spi: restore rx/tx_buf in case of unset CONFIG_HAS_DMA · 4b786458
      Martin Sperl 提交于
      The case where spi_master sets the flags SPI_MASTER_MUST_RX/TX while
      CONFIG_HAS_DMA is unset (which is unlikley) together with a driver
      that reuses spi_messages with rx/tx_buff set to NULL, can result in:
      * data disclosure over the SPI (for tx_buf == NULL)
      * memory corruption (for rx_buf == NULL)
      
      This happenes when dummy_rx/dummy_tx are changing address due to krealloc
      or free and an allocation of the memory by a different part of the kernel.
      Signed-off-by: NMartin Sperl <kernel@martin.sperl.org>
      Signed-off-by: NMark Brown <broonie@kernel.org>
      4b786458
  22. 12 5月, 2015 1 次提交
  23. 17 4月, 2015 1 次提交
    • R
      spi: check tx_buf and rx_buf in spi_unmap_msg · f8bb820d
      Robin Gong 提交于
      Some spi device drivers use the same tx_buf and rx_buf repeatly for better
      performance such as driver/input/touchsreen/ads7846.c, but spi core grab tx_buf
      /rx_buf of transfer and set them as dummy_tx/dummy_rx once they are NULL. Thus,
      in the second time the tx_buf/rx_buf will be replaced by dummy_tx/dummy_rx and
      the data which produced by the last tx or rx may be wrongly sent to the device
      or handled by the upper level protocol. This patch just keep the orignal value
      of tx_buf/rx_buf if they are NULL after this transfer processed.
      Signed-off-by: NRobin Gong <b38343@freescale.com>
      Signed-off-by: NMark Brown <broonie@kernel.org>
      f8bb820d
  24. 08 4月, 2015 1 次提交
    • G
      spi: Make master->handle_err() callback optional to avoid crashes · ff61eb42
      Geert Uytterhoeven 提交于
      If a driver doesn't implement the master->handle_err() callback and an
      SPI transfer fails, the kernel will crash with a NULL pointer
      dereference:
      
          Unable to handle kernel NULL pointer dereference at virtual address 00000000
          pgd = c0003000
          [00000000] *pgd=80000040004003, *pmd=00000000
          Internal error: Oops: 80000206 [#1] SMP ARM
          Modules linked in:
          CPU: 1 PID: 1 Comm: swapper/0 Not tainted 4.0.0-rc7-koelsch-05861-g1fc9fdd4add4f783 #1046
          Hardware name: Generic R8A7791 (Flattened Device Tree)
          task: eec359c0 ti: eec54000 task.ti: eec54000
          PC is at 0x0
          LR is at spi_transfer_one_message+0x1cc/0x1f0
      
      Make the master->handle_err() callback optional to avoid the crash.
      
      Also fix a spelling mistake in the callback documentation while we're at
      it.
      
      Fixes: b716c4ff ("spi: introduce master->handle_err() callback")
      Signed-off-by: NGeert Uytterhoeven <geert+renesas@glider.be>
      Signed-off-by: NMark Brown <broonie@kernel.org>
      ff61eb42
  25. 26 3月, 2015 1 次提交
    • D
      spi: of: do explicitly request modules for of-registered devices · 22de3ef9
      Dmitry Torokhov 提交于
      Trying to register an SPI device asynchronously (via async_schedule() call)
      results in an ugly complaint from request_module() warning about potential
      deadlock (because request_module tries to wait for async works to
      complete, the caller is also an async work in this case).
      
      While we could try to switch to using request_module_nowait(), other buses,
      as well as SPI itself when not using device tree, do not try to load
      modules explicitly, but rather rely on the standard infrastructure (such as
      udev) to execute module loading. There is no reason why SPI OF-described
      devices should be treated differently.
      Signed-off-by: NDmitry Torokhov <dmitry.torokhov@gmail.com>
      Signed-off-by: NMark Brown <broonie@kernel.org>
      22de3ef9
  26. 18 3月, 2015 1 次提交
  27. 16 3月, 2015 1 次提交
  28. 09 3月, 2015 1 次提交
    • L
      spi: Remove support for legacy PM · ea022bbb
      Lars-Peter Clausen 提交于
      All SPI drivers have been converted from legacy suspend/resume callbacks to
      dev_pm_ops. So we can finally remove support for legacy PM from the SPI
      core.
      
      Since there aren't any special bus specific things to do during
      suspend/resume and since the PM core will automatically fallback directly to
      using the device's PM ops if no bus PM ops are specified there is no need to
      have any special SPI bus PM ops.
      Signed-off-by: NLars-Peter Clausen <lars@metafoo.de>
      Signed-off-by: NMark Brown <broonie@kernel.org>
      ea022bbb
  29. 07 3月, 2015 1 次提交
  30. 05 2月, 2015 1 次提交
  31. 22 12月, 2014 1 次提交
  32. 11 12月, 2014 4 次提交
    • M
      spi: Only idle the message pump in the worker kthread · fc9e0f71
      Mark Brown 提交于
      In order to avoid the situation where the kthread is waiting for another
      context to make the hardware idle let the message pump know if it's being
      called from the worker thread context and if it isn't then defer to the
      worker thread instead of idling the hardware immediately. This will ensure
      that if this situation happens we block rather than busy waiting.
      Signed-off-by: NMark Brown <broonie@kernel.org>
      fc9e0f71
    • 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
    • M
      spi: Check to see if the device is processing a message before we idle · 983aee5d
      Mark Brown 提交于
      cur_msg is updated under the queue lock and holds the message we are
      currently processing. Since currently we only ever do removals in the
      pump kthread it doesn't matter in what order we do things but we want
      to be able to push things out from the submitting thread so pull the
      check to see if we're currently handling a message before we check to
      see if the queue is idle.
      Signed-off-by: NMark Brown <broonie@kernel.org>
      983aee5d
    • M
      spi: Move queue data structure initialisation to main master init · 5424d43e
      Mark Brown 提交于
      Since most devices now do use the standard queue and in order to avoid
      initialisation ordering issues being introduced by further refactorings
      to improve performance move the initialisation of the queue and the lock
      for it to the main master allocation.
      Signed-off-by: NMark Brown <broonie@kernel.org>
      5424d43e