1. 10 6月, 2015 1 次提交
    • C
      spi: atmel: add support for the internal chip-select of the spi controller · 48203034
      Cyrille Pitchen 提交于
      This patch relies on the CSAAT (Chip Select Active After Transfer) feature
      introduced by the version 2 of the spi controller. This new mode allows to
      use properly the internal chip-select output pin of the spi controller
      instead of using external gpios. Consequently, the "cs-gpios" device-tree
      property becomes optional.
      
      When the new CSAAT bit is set into the Chip Select Register, the internal
      chip-select output pin remains asserted till both the following conditions
      become true:
      - the LASTXFER bit is set into the Control Register (or the Transmit Data
        Register)
      - the Transmit Data Register and its shift register are empty.
      
      WARNING: if the LASTXFER bit is set into the Control Register then new
      data are written into the Transmit Data Register fast enough to keep its
      shifter not empty, the chip-select output pin remains asserted. Only when
      the shifter becomes empty, the chip-select output pin is unasserted.
      
      When the CSAAT bit is clear in the Chip Select Register, the LASTXFER bit
      is ignored in both the Control Register and the Transmit Data Register.
      The internal chip-select output pin remains active as long as the Transmit
      Data Register or its shift register are not empty.
      Signed-off-by: NCyrille Pitchen <cyrille.pitchen@atmel.com>
      Acked-by: NNicolas Ferre <nicolas.ferre@atmel.com>
      Signed-off-by: NMark Brown <broonie@kernel.org>
      48203034
  2. 11 4月, 2015 2 次提交
    • M
      spi: bcm2835: enabling polling mode for transfers shorter than 30us · 704f32d4
      Martin Sperl 提交于
      In cases of short transfer times the CPU is spending lots of time
      in the interrupt handler and scheduler to reschedule the worker thread.
      
      Measurements show that we have times where it takes 29.32us to between
      the last clock change and the time that the worker-thread is running again
      returning from wait_for_completion_timeout().
      
      During this time the interrupt-handler is running calling complete()
      and then also the scheduler is rescheduling the worker thread.
      
      This time can vary depending on how much of the code is still in
      CPU-caches, when there is a burst of spi transfers the subsequent delays
      are in the order of 25us, so the value of 30us seems reasonable.
      
      With polling the whole transfer of 4 bytes at 10MHz finishes after 6.16us
      (CS down to up) with the real transfer (clock running) taking 3.56us.
      So the efficiency has much improved and is also freeing CPU cycles,
      reducing interrupts and context switches.
      
      Because of the above 30us seems to be a reasonable limit for polling.
      Signed-off-by: NMartin Sperl <kernel@martin.sperl.org>
      Signed-off-by: NMark Brown <broonie@kernel.org>
      704f32d4
    • M
      spi: bcm2835: transform native-cs to gpio-cs on first spi_setup · a30a555d
      Martin Sperl 提交于
      Transforms the bcm-2835 native SPI-chip select to their gpio-cs equivalent.
      
      This allows for some support of some optimizations that are not
      possible due to HW-gliches on the CS line - especially filling
      the FIFO before enabling SPI interrupts (by writing to CS register)
      while the transfer is already in progress (See commit: e3a2be30)
      
      This patch also works arround some issues in bcm2835-pinctrl which does not
      set the value when setting the GPIO as output - it just sets up output and
      (typically) leaves the GPIO as low.  When a fix for this is merged then this
      gpio_set_value can get removed from bcm2835_spi_setup.
      Signed-off-by: NMartin Sperl <kernel@martin.sperl.org>
      Signed-off-by: NMark Brown <broonie@kernel.org>
      a30a555d
  3. 09 4月, 2015 3 次提交
  4. 08 4月, 2015 2 次提交
  5. 07 4月, 2015 5 次提交
  6. 02 4月, 2015 2 次提交
    • L
      spi: imx: read back the RX/TX watermark levels earlier · f511ab09
      Lucas Stach 提交于
      They are used to decide if the controller can do DMA on a buffer
      of a specific length and thus are needed before any transfer is attempted.
      
      This fixes a memory leak where the SPI core uses the drivers can_dma()
      callback to determine if a buffer needs to be mapped. As the watermark
      levels aren't correct at that point the driver falsely claims to be able to
      DMA the buffer when it fact it isn't.
      After the transfer has been done the core uses the same callback to
      determine if it needs to unmap the buffers. As the driver now correctly
      claims to not being able to DMA the buffer the core doesn't attempt to
      unmap the buffer which leaves the SGT leaking.
      
      Fixes: f62caccd (spi: spi-imx: add DMA support)
      Signed-off-by: NLucas Stach <l.stach@pengutronix.de>
      Signed-off-by: NMark Brown <broonie@kernel.org>
      Cc: stable@vger.kernel.org
      f511ab09
    • C
      spi: spi-bfin5xx: Initialize cr_width in bfin_spi_pump_transfers() · 057f6061
      Chen Gang 提交于
      cr_width may be not initialized before using by cr, the related warning
      (with defconfig under blackfin by gcc5):
      
          CC      drivers/spi/spi-bfin5xx.o
        drivers/spi/spi-bfin5xx.c: In function 'bfin_spi_pump_transfers':
        drivers/spi/spi-bfin5xx.c:655:5: warning: 'cr_width' may be used uninitialized in this function [-Wmaybe-uninitialized]
          cr |= cr_width;
             ^
      Signed-off-by: NChen Gang <gang.chen.5i5j@gmail.com>
      Signed-off-by: NMark Brown <broonie@kernel.org>
      057f6061
  7. 01 4月, 2015 1 次提交
  8. 31 3月, 2015 2 次提交
  9. 30 3月, 2015 3 次提交
  10. 28 3月, 2015 1 次提交
    • M
      spi: spidev: Warn loudly if instantiated from DT as "spidev" · 956b200a
      Mark Brown 提交于
      Since spidev is a detail of how Linux controls a device rather than a
      description of the hardware in the system we should never have a node
      described as "spidev" in DT, any SPI device could be a spidev so this
      is just not a useful description.
      
      In order to help prevent users from writing such device trees generate a
      warning if spidev is instantiated as a DT node without an ID in the match
      table.
      Signed-off-by: NMark Brown <broonie@kernel.org>
      956b200a
  11. 27 3月, 2015 3 次提交
    • M
      spi: bcm2835: move to the transfer_one driver model · e34ff011
      Martin Sperl 提交于
      This also allows for GPIO-CS to get used removing the limitation of
      2/3 SPI devises on the SPI bus.
      
      Fixes: spi-cs-high with native CS with multiple devices on the spi-bus
      resetting the chip selects to "normal" polarity after a finished
      transfer.
      
      No other functionality/improvements added.
      
      Tested with the following 4 devices on the spi-bus:
      * mcp2515 with native CS
      * mcp2515 with gpio CS
      * fb_st7735r with native CS
          (plus spi-cs-high via transistor inverting polarity)
      * enc28j60 with gpio-CS
      Tested-by: NMartin Sperl <kernel@martin.sperl.org>
      Signed-off-by: NMartin Sperl <kernel@martin.sperl.org>
      Signed-off-by: NMark Brown <broonie@kernel.org>
      e34ff011
    • J
      spi/rockchip: Add device tree property to configure Rx Sample Delay · 76b17e6e
      Julius Werner 提交于
      We have found that we can sometimes see read failures on boards with
      high-capacitance SPI lines. It seems that the controller samples the Rx
      data line too early, and its register interface has an "Rx Sample Delay"
      setting to fine-tune against this issue.
      
      This patch adds a new optional device tree entry that can configure this
      delay in terms of nanoseconds. The kernel will calculate the
      best-fitting amount of parent clock ticks to program the controller with
      based on that.
      Signed-off-by: NJulius Werner <jwerner@chromium.org>
      Signed-off-by: NMark Brown <broonie@kernel.org>
      76b17e6e
    • J
      spi/rockchip: Round up clock rate divisor to err on the safe side · 754ec43c
      Julius Werner 提交于
      The Rockchip SPI driver currently calculates its clock rate divisor by
      integer dividing the parent rate by the target rate, and then rounding
      the result up to the next even number (since the divisor must be
      even).
      
      Clock rate divisors should always be rounded up, so that the resulting
      frequency is lower or equal to the target. This is correctly done in the
      second step here but not in the first, so we still have a risk of
      exceeding the desired target frequency (e.g. setting spi-max-frequency
      to 40000000 with a parent clock of 99000000 could lead to a divisor of
      99000000 / 40000000 == 2 (which is even) that then results in an
      effective frequency of 99000000 / 2 == 49500000 (potentially exceeding
      the flash chip's specifications).
      
      This patch changes the division to round up to fix this problem.
      Signed-off-by: NJulius Werner <jwerner@chromium.org>
      Signed-off-by: NMark Brown <broonie@kernel.org>
      754ec43c
  12. 26 3月, 2015 2 次提交
  13. 25 3月, 2015 2 次提交
  14. 24 3月, 2015 6 次提交
  15. 23 3月, 2015 1 次提交
  16. 21 3月, 2015 1 次提交
    • M
      spi: bcm2835: fix all checkpath --strict messages · 342f948a
      Martin Sperl 提交于
      The following errors/warnings issued by checkpatch.pl --strict have been fixed:
      drivers/spi/spi-bcm2835.c:182: CHECK: Alignment should match open parenthesis
      drivers/spi/spi-bcm2835.c:191: CHECK: braces {} should be used on all arms of this statement
      drivers/spi/spi-bcm2835.c:234: CHECK: Alignment should match open parenthesis
      drivers/spi/spi-bcm2835.c:256: CHECK: Alignment should match open parenthesis
      drivers/spi/spi-bcm2835.c:271: CHECK: Alignment should match open parenthesis
      drivers/spi/spi-bcm2835.c:346: CHECK: Alignment should match open parenthesis
      total: 0 errors, 0 warnings, 6 checks, 403 lines checked
      
      In 2 locations the arguments had to get split/moved to the next line so that the
      line width stays below 80 chars.
      Signed-off-by: NMartin Sperl <kernel@martin.sperl.org>
      Signed-off-by: NMark Brown <broonie@kernel.org>
      342f948a
  17. 18 3月, 2015 1 次提交
  18. 17 3月, 2015 2 次提交
    • T
      spi: dw-spi: Convert 16bit accesses to 32bit accesses · dd114443
      Thor Thayer 提交于
      Altera's Arria10 SoC interconnect requires a 32-bit write for APB
      peripherals. The current spi-dw driver uses 16-bit accesses in
      some locations. This patch converts all the 16-bit reads and
      writes to 32-bit reads and writes.
      
      Additional Documentation to Support this Change:
      The DW_apb_ssi databook states:
      "All registers in the DW_apb_ssi are addressed at 32-bit boundaries
      to remain consistent with the AHB bus. Where the physical size of
      any register is less than 32-bits wide, the upper unused bits of
      the 32-bit boundary are reserved. Writing to these bits has no
      effect; reading from these bits returns 0." [1]
      
      [1] Section 6.1 of dw_apb_ssi.pdf (version 3.22a)
      
      Request for test with platforms using the DesignWare SPI IP.
      
      Tested On:
      Altera CycloneV development kit
      Altera Arria10 development kit
      Compile tested for build errors on x86_64 (allyesconfigs)
      Signed-off-by: NThor Thayer <tthayer@opensource.altera.com>
      Reviewed-and-tested-by: NAndy Shevchenko <andriy.shevchenko@linux.intel.com>
      Signed-off-by: NMark Brown <broonie@kernel.org>
      dd114443
    • M
      spi/omap100k: Convert to runtime PM · db91841b
      Mark Brown 提交于
      Currently the omap100k driver uses prepare and unprepare transfer hardware
      to enable and disable clocks for the IP block. Since these functions are
      called along with runtime PM and end up duplicating its functionality in a
      less flexible fashion we are trying to phase them out so convert this
      driver to do runtime PM instead.
      
      While doing so add missing error handling and remove a redundant NULL
      assignment.
      Signed-off-by: NMark Brown <broonie@kernel.org>
      db91841b