1. 11 4月, 2015 1 次提交
    • 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
  2. 30 3月, 2015 2 次提交
  3. 27 3月, 2015 1 次提交
  4. 24 3月, 2015 3 次提交
  5. 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
  6. 07 3月, 2015 1 次提交
    • A
      spi: pl022: Fix race in giveback() leading to driver lock-up · cd6fa8d2
      Alexander Sverdlin 提交于
      Commit fd316941 ("spi/pl022: disable port when unused") introduced a race,
      which leads to possible driver lock up (easily reproducible on SMP).
      
      The problem happens in giveback() function where the completion of the transfer
      is signalled to SPI subsystem and then the HW SPI controller is disabled. Another
      transfer might be setup in between, which brings driver in locked-up state.
      
      Exact event sequence on SMP:
      
      core0                                   core1
      
                                              => pump_transfers()
                                              /* message->state == STATE_DONE */
                                                => giveback()
                                                  => spi_finalize_current_message()
      
      => pl022_unprepare_transfer_hardware()
      => pl022_transfer_one_message
        => flush()
        => do_interrupt_dma_transfer()
          => set_up_next_transfer()
          /* Enable SSP, turn on interrupts */
          writew((readw(SSP_CR1(pl022->virtbase)) |
                 SSP_CR1_MASK_SSE), SSP_CR1(pl022->virtbase));
      
      ...
      
      => pl022_interrupt_handler()
        => readwriter()
      
                                              /* disable the SPI/SSP operation */
                                              => writew((readw(SSP_CR1(pl022->virtbase)) &
                                                        (~SSP_CR1_MASK_SSE)), SSP_CR1(pl022->virtbase));
      
      Lockup! SPI controller is disabled and the data will never be received. Whole
      SPI subsystem is waiting for transfer ACK and blocked.
      
      So, only signal transfer completion after disabling the controller.
      
      Fixes: fd316941 (spi/pl022: disable port when unused)
      Signed-off-by: NAlexander Sverdlin <alexander.sverdlin@nokia.com>
      Signed-off-by: NMark Brown <broonie@kernel.org>
      Cc: stable@vger.kernel.org
      cd6fa8d2
  7. 06 3月, 2015 1 次提交
  8. 03 3月, 2015 1 次提交
  9. 26 2月, 2015 2 次提交
    • T
      spi: atmel: Fix interrupt setup for PDC transfers · 76e1d14b
      Torsten Fleischer 提交于
      Additionally to the current DMA transfer the PDC allows to set up a next DMA
      transfer. This is useful for larger SPI transfers.
      
      The driver currently waits for ENDRX as end of the transfer. But ENDRX is set
      when the current DMA transfer is done (RCR = 0), i.e. it doesn't include the
      next DMA transfer.
      Thus a subsequent SPI transfer could be started although there is currently a
      transfer in progress. This can cause invalid accesses to the SPI slave devices
      and to SPI transfer errors.
      
      This issue has been observed on a hardware with a M25P128 SPI NOR flash.
      
      So instead of ENDRX we should wait for RXBUFF. This flag is set if there is
      no more DMA transfer in progress (RCR = RNCR = 0).
      Signed-off-by: NTorsten Fleischer <torfl6749@gmail.com>
      Signed-off-by: NMark Brown <broonie@kernel.org>
      Cc: stable@vger.kernel.org
      76e1d14b
    • A
      spi: dw: revisit FIFO size detection again · 9d239d35
      Andy Shevchenko 提交于
      The commit d297933c (spi: dw: Fix detecting FIFO depth) tries to fix the
      logic of the FIFO detection based on the description on the comments. However,
      there is a slight difference between numbers in TX Level and TX FIFO size.
      
      So, by specification the FIFO size would be in a range 2-256 bytes. From TX
      Level prospective it means we can set threshold in the range 0-(FIFO size - 1)
      bytes. Hence there are currently two issues:
        a) FIFO size 2 bytes is actually skipped since TX Level is 1 bit and could be
           either 0 or 1 byte;
        b) FIFO size is incorrectly decreased by 1 which already done by meaning of
           TX Level register.
      
      This patch fixes it eventually right.
      
      Fixes: d297933c (spi: dw: Fix detecting FIFO depth)
      Reviewed-by: NAxel Lin <axel.lin@ingics.com>
      Signed-off-by: NAndy Shevchenko <andriy.shevchenko@linux.intel.com>
      Signed-off-by: NMark Brown <broonie@kernel.org>
      Cc: stable@vger.kernel.org
      9d239d35
  10. 24 2月, 2015 1 次提交
    • A
      spi: dw-pci: correct number of chip selects · 307ed83c
      Andy Shevchenko 提交于
      The commit d58cf5ff brought a second controller to the list of supported
      devices and changed a number of the chip selects. Besides the previous number
      was wrong anyway the mentioned patch makes it wrong again meanwhile has a
      proper numbers in the commit message. Indeed, SPI1 has 5 bits and SPI2 has 2
      bits, but it does not mean to have power of two of this bits as a possible
      number of the chip selects. So, this patch fixes it eventually.
      
      Fixes: d58cf5ff (spi: dw-pci: describe Intel MID controllers better)
      Signed-off-by: NAndy Shevchenko <andriy.shevchenko@linux.intel.com>
      Signed-off-by: NMark Brown <broonie@kernel.org>
      Cc: stable@vger.kernel.org
      307ed83c
  11. 21 2月, 2015 1 次提交
  12. 12 2月, 2015 1 次提交
  13. 06 2月, 2015 2 次提交
  14. 05 2月, 2015 4 次提交
  15. 04 2月, 2015 1 次提交
  16. 03 2月, 2015 4 次提交
    • R
      spi: imx: use pio mode for i.mx6dl · a02bb401
      Robin Gong 提交于
      For TKT238285 hardware issue which may cause txfifo store data twice can only
      be caught on i.mx6dl, we use pio mode instead of DMA mode on i.mx6dl.
      
      Fixes: f62caccd (spi: spi-imx: add DMA support)
      Signed-off-by: NRobin Gong <b38343@freescale.com>
      Signed-off-by: NMark Brown <broonie@kernel.org>
      Cc: stable@vger.kernel.org
      a02bb401
    • B
      spi: fsl-dspi: Remove possible memory leak of 'chip' · ceadfd8d
      Bhuvanchandra DV 提交于
      Move the check for spi->bits_per_word
      before allocation, to avoid memory leak.
      Reported-by: NDan Carpenter <dan.carpenter@oracle.com>
      Signed-off-by: NBhuvanchandra DV <bhuvanchandra.dv@toradex.com>
      Signed-off-by: NMark Brown <broonie@kernel.org>
      ceadfd8d
    • N
      spi: sh-msiof: Update calculation of frequency dividing · 65d5665b
      Nobuhiro Iwamatsu 提交于
      sh-msiof of frequency dividing does not perform the calculation, driver have
      to manage setting value in the table. It is not possible to set frequency
      dividing value close to the actual data in this way. This changes from
      frequency dividing of table management to setting by calculation.
      This driver is able to set a value close to the actual data.
      Signed-off-by: NNobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com>
      Signed-off-by: NMark Brown <broonie@kernel.org>
      65d5665b
    • I
      spi: spidev: Convert buf pointers for 32-bit compat SPI_IOC_MESSAGE(n) · 7782a1a9
      Ian Abbott 提交于
      The SPI_IOC_MESSAGE(n) ioctl commands' argument points to an array of n
      struct spi_ioc_transfer elements.  The spidev's compat_ioctl handler
      just converts this pointer and passes it on to the unlocked_ioctl
      handler to process it.
      
      The tx_buf and rx_buf members of struct spi_ioc_transfer are of type
      __u64 and hold pointer values.  A 32-bit userspace application running
      in a 64-bit kernel might not have widened the 32-bit pointers correctly
      for the kernel.  The application might have sign-extended the pointer to
      when the kernel expects it to be zero-extended, or vice versa, leading
      to an -EFAULT being returned by spidev_message() if the widened pointer
      is invalid.
      
      Handle the SPI_IOC_MESSAGE(n) ioctl commands specially in the
      compat_ioctl handler, calling new function spidev_compat_ioctl_message()
      to handle them.  This processes them in the same way as the
      unlocked_ioctl handler except that it uses compat_ptr() to convert the
      tx_buf and rx_buf members of each struct spi_ioc_transfer element.
      
      To save code, factor out part of the unlocked_ioctl handler into a new
      function spidev_get_ioc_message().  This checks the ioctl command code
      is a valid SPI_IOC_MESSAGE(n), determines n and copies the array of n
      struct spi_ioc_transfer elements from userspace into dynamically
      allocated memory, returning either a pointer to the memory, an
      ERR_PTR(-err) value, or NULL (for SPI_IOC_MESSAGE(0)).
      Signed-off-by: NIan Abbott <abbotti@mev.co.uk>
      Signed-off-by: NMark Brown <broonie@kernel.org>
      7782a1a9
  17. 02 2月, 2015 1 次提交
  18. 30 1月, 2015 1 次提交
  19. 29 1月, 2015 11 次提交