1. 12 5月, 2015 1 次提交
    • M
      spi: bcm2835: enable dma modes for transfers meeting certain conditions · 3ecd37ed
      Martin Sperl 提交于
      Conditions per spi_transfer are:
      * transfer.len >= 96 bytes (to avoid mapping overhead costs)
      * transfer.len < 65536 bytes (limitaion by spi-hw block - could get extended)
      * an individual scatter/gather transfer length must be a multiple of 4
        for anything but the last transfer - spi-hw block limit.
        (some shortcut has been taken in can_dma to avoid unnecessary mapping of
         pages which, for which there is a chance that there is a split with a
         transfer length not a multiple of 4)
      
      If it becomes a necessity these restrictions can get removed by additional
      code.
      
      Note that this patch requires a patch to dma-bcm2835.c by Noralf to
      enable scatter-gather mode inside the dmaengine, which has not been
      merged yet.
      
      That is why no patch to arch/arm/boot/dts/bcm2835.dtsi is included - the
      code works as before without dma when tx/rx are not set, but it writes
      a message warning about dma not used:
      spi-bcm2835 20204000.spi: no tx-dma configuration found - not using dma mode
      
      To enable dma-mode add the following lines to the device-tree:
              dmas = <&dma 6>, <&dma 7>;
              dma-names = "tx", "rx";
      
      Tested-by: Noralf Trønnes <noralf@tronnes.org> (private communication)
      Signed-off-by: NMartin Sperl <kernel@martin.sperl.org>
      Signed-off-by: NMark Brown <broonie@kernel.org>
      3ecd37ed
  2. 27 4月, 2015 2 次提交
  3. 17 4月, 2015 1 次提交
  4. 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
  5. 30 3月, 2015 2 次提交
  6. 27 3月, 2015 1 次提交
  7. 24 3月, 2015 3 次提交
  8. 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
  9. 22 12月, 2014 1 次提交
  10. 20 10月, 2014 1 次提交
  11. 16 2月, 2014 1 次提交
  12. 18 12月, 2013 1 次提交
  13. 15 11月, 2013 2 次提交
  14. 26 9月, 2013 1 次提交
  15. 23 8月, 2013 1 次提交
  16. 05 8月, 2013 1 次提交
  17. 24 7月, 2013 1 次提交
  18. 13 5月, 2013 1 次提交
  19. 01 4月, 2013 1 次提交
  20. 13 3月, 2013 1 次提交
    • C
      spi: add driver for BCM2835 · f8043872
      Chris Boot 提交于
      The BCM2835 contains two forms of SPI master controller (one known
      simply as SPI0, and the other known as the "Universal SPI Master", in
      the auxilliary block) and one form of SPI slave controller. This patch
      adds support for the SPI0 controller.
      
      This driver is taken from Chris Boot's repository at
      git://github.com/bootc/linux.git rpi-linear
      as of commit 6de2905 "spi-bcm2708: fix printf with spurious %s".
      In the first SPI-related commit there, Chris wrote:
      
      Thanks to csoutreach / A Robinson for his driver which I used as an
      inspiration. You can find his version here:
      http://piface.openlx.org.uk/raspberry-pi-spi-kernel-driver-available-for
      
      Changes made during upstreaming:
      * Renamed bcm2708 to bcm2835 as per upstream naming for this SoC.
      * Removed support for brcm,realtime property.
      * Increased transfer timeout to 30 seconds.
      * Return IRQ_NONE from the IRQ handler if no interrupt was handled.
      * Disable TA (Transfer Active) and clear FIFOs on a transfer timeout.
      * Wrote device tree binding documentation.
      * Request unnamed clock rather than "sys_pclk"; the DT will provide the
        correct clock.
      * Assume that tfr->speed_hz and tfr->bits_per_word are always set in
        bcm2835_spi_start_transfer(), bcm2835_spi_transfer_one(), so no need
        to check spi->speed_hz or tft->bits_per_word.
      * Re-ordered probe() to remove the need for temporary variables.
      * Call clk_disable_unprepare() rather than just clk_unprepare() on probe()
        failure.
      * Don't use devm_request_irq(), to ensure that the IRQ doesn't fire after
        we've torn down the device, but not unhooked the IRQ.
      * Moved probe()'s call to clk_prepare_enable() so we can be sure the clock
        is enabled if the IRQ handler fires immediately.
      * Remove redundant checks from bcm2835_spi_check_transfer() and
        bcm2835_spi_setup().
      * Re-ordered IRQ handler to check for RXR before DONE. Added comments to
        ISR.
      * Removed empty prepare/unprepare implementations.
      * Removed use of devinit/devexit.
      * Added BCM2835_ prefix to defines.
      Signed-off-by: NChris Boot <bootc@bootc.net>
      Signed-off-by: NStephen Warren <swarren@wwwdotorg.org>
      Signed-off-by: NMark Brown <broonie@opensource.wolfsonmicro.com>
      f8043872