1. 11 10月, 2016 1 次提交
    • T
      spi: Add Flag to Enable Slave Select with GPIO Chip Select. · 6b1576aa
      Thor Thayer 提交于
      Some SPI masters require slave selection before the transfer
      can begin [1]. The SPI framework currently selects the chip using
      either 1) the internal CS mechanism or 2) the GPIO CS, but not both.
      
      This patch adds a new master->flags define to indicate both the GPIO
      CS and the internal chip select mechanism should be used.
      
      Tested On:
          Altera CycloneV development kit
          Compile tested for build errors on x86_64 (allyesconfigs)
      
      [1] DesignWare dw_apb_ssi Databook, Version 3.20a (page 39)
      Signed-off-by: NThor Thayer <tthayer@opensource.altera.com>
      Signed-off-by: NMark Brown <broonie@kernel.org>
      6b1576aa
  2. 03 9月, 2016 1 次提交
  3. 17 8月, 2016 1 次提交
  4. 10 8月, 2016 1 次提交
  5. 25 7月, 2016 1 次提交
    • M
      spi: Split bus and I/O locking · ef4d96ec
      Mark Brown 提交于
      The current SPI code attempts to use bus_lock_mutex for two purposes. One
      is to implement spi_bus_lock() which grants exclusive access to the bus.
      The other is to serialize access to the physical hardware. This duplicate
      purpose causes confusion which leads to cases where access is not locked
      when a caller holds the bus lock mutex. Fix this by splitting out the I/O
      functionality into a new io_mutex.
      
      This means taking both mutexes in the DMA path, replacing the existing
      mutex with the new I/O one in the message pump (the mutex now always
      being taken in the message pump) and taking the bus lock mutex in
      spi_sync(), allowing __spi_sync() to have no mutex handling.
      
      While we're at it hoist the mutex further up the message pump before we
      power up the device so that all power up/down of the block is covered by
      it and there are no races with in-line pumping of messages.
      Reported-by: NRich Felker <dalias@libc.org>
      Tested-by: NRich Felker <dalias@libc.org>
      Signed-off-by: NMark Brown <broonie@kernel.org>
      ef4d96ec
  6. 09 7月, 2016 1 次提交
    • O
      spi / ACPI: add support for ACPI reconfigure notifications · 7f24467f
      Octavian Purdila 提交于
      This patch adds supports for SPI device enumeration and removal via
      ACPI reconfiguration notifications that are send as a result of an
      ACPI table load or unload operation.
      
      The code is very similar with the device tree reconfiguration code
      with only small differences in the way we test and set the enumerated
      state of the device:
      
       * the equivalent of device tree's OF_POPULATED flag is the
         flags.visited field in the ACPI device and the following wrappers
         are used to manipulate it: acpi_device_enumerated(),
         acpi_device_set_enumerated() and acpi_device_clear_enumerated()
      
       * the device tree code checks of status of the OF_POPULATED flag to
         avoid trying to create duplicate Linux devices in two places: once
         when the controller is probed, and once when the reconfigure event
         is received; in the ACPI code the check is performed only once when
         the ACPI namespace is searched because this code path is invoked in
         both of the two mentioned cases
      
      The rest of the enumeration handling is similar with device tree: when
      the Linux device is unregistered the ACPI device is marked as not
      enumerated; also, when a device remove notification is received we
      check that the device is in the enumerated state before continuing
      with the removal of the Linux device.
      Signed-off-by: NOctavian Purdila <octavian.purdila@intel.com>
      Reviewed-by: NMika Westerberg <mika.westerberg@linux.intel.com>
      Acked-by: NMark Brown <broonie@kernel.org>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      7f24467f
  7. 08 6月, 2016 1 次提交
    • V
      spi: Add DMA support for spi_flash_read() · f4502dd1
      Vignesh R 提交于
      Few SPI devices provide accelerated read interfaces to read from
      SPI-NOR flash devices. These hardwares also support DMA to transfer data
      from flash to memory either via mem-to-mem DMA or dedicated slave DMA
      channels. Hence, add support for DMA in order to improve throughput and
      reduce CPU load.
      Use spi_map_buf() to get sg table for the buffer and pass it to SPI
      driver.
      Signed-off-by: NVignesh R <vigneshr@ti.com>
      Signed-off-by: NMark Brown <broonie@kernel.org>
      f4502dd1
  8. 04 5月, 2016 1 次提交
  9. 26 4月, 2016 1 次提交
  10. 12 4月, 2016 1 次提交
  11. 18 3月, 2016 1 次提交
  12. 11 3月, 2016 1 次提交
  13. 09 3月, 2016 2 次提交
    • A
      spi: respect the maximum segment size of DMA device · df88e91b
      Andy Shevchenko 提交于
      The device which is actually does DMA may have a limitation of the maximum
      segment size. Respect this setting when preparing scatter-gather list.
      Signed-off-by: NAndy Shevchenko <andriy.shevchenko@linux.intel.com>
      Signed-off-by: NMark Brown <broonie@kernel.org>
      df88e91b
    • J
      spi: core: Fix deadlock when sending messages · 49023d2e
      Jon Hunter 提交于
      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: NJon Hunter <jonathanh@nvidia.com>
      Signed-off-by: NMark Brown <broonie@kernel.org>
      49023d2e
  14. 22 2月, 2016 1 次提交
  15. 19 2月, 2016 2 次提交
  16. 18 2月, 2016 2 次提交
  17. 16 2月, 2016 1 次提交
  18. 13 2月, 2016 1 次提交
  19. 10 2月, 2016 5 次提交
    • V
      spi: introduce accelerated read support for spi flash devices · 556351f1
      Vignesh R 提交于
      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: NVignesh R <vigneshr@ti.com>
      Signed-off-by: NMark Brown <broonie@kernel.org>
      556351f1
    • 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
    • M
      spi: Let drivers translate ACPI DeviceSelection to suitable Linux chip select · a0a90718
      Mika Westerberg 提交于
      In Windows it is up to the SPI host controller driver to handle the ACPI
      DeviceSelection as it likes. The SPI core does not take any part in it.
      This is different in Linux because we always expect to have chip select in
      range of 0 .. master->num_chipselect - 1.
      
      In order to support this in Linux we need a way to allow the driver to
      translate between ACPI DeviceSelection field and Linux chip select number
      so provide a new optional hook ->fw_translate_cs() that can be used by a
      driver to handle translation and call this hook if set during SPI slave
      ACPI enumeration.
      Signed-off-by: NMika Westerberg <mika.westerberg@linux.intel.com>
      Reviewed-by: NJarkko Nikula <jarkko.nikula@linux.intel.com>
      Signed-off-by: NMark Brown <broonie@kernel.org>
      a0a90718
  20. 01 1月, 2016 1 次提交
  21. 23 12月, 2015 1 次提交
  22. 16 12月, 2015 1 次提交
  23. 02 12月, 2015 2 次提交
  24. 27 11月, 2015 1 次提交
  25. 11 11月, 2015 1 次提交
  26. 28 10月, 2015 2 次提交
  27. 24 10月, 2015 1 次提交
  28. 21 10月, 2015 1 次提交
  29. 16 10月, 2015 1 次提交
  30. 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
  31. 20 9月, 2015 1 次提交