1. 18 10月, 2013 3 次提交
    • T
      spi: spi-mxs: Always clear INGORE_CRC, to keep CS asserted · 75e73fa2
      Trent Piepho 提交于
      INGORE_CRC, better named DEASSERT_CS, should be cleared on all tranfers
      except the last.  So instead of only clearing it on the first transfer, we
      can just always clear it.  It will set on the last transfer.
      
      This removes the only use of the "first" flag in the transfer functions, so
      that flag can be then be removed.
      Signed-off-by: NTrent Piepho <tpiepho@gmail.com>
      Cc: Marek Vasut <marex@denx.de>
      Cc: Fabio Estevam <fabio.estevam@freescale.com>
      Cc: Shawn Guo <shawn.guo@linaro.org>
      Signed-off-by: NMark Brown <broonie@linaro.org>
      75e73fa2
    • T
      spi: spi-mxs: Remove mxs_spi_enable and mxs_spi_disable · f5bc7384
      Trent Piepho 提交于
      These functions consist of nothing but one single writel call and are
      only called once.  And the names really aren't accurate or clear,
      since they don't enable or disble SPI.  Rather they set the bit that
      controls the state of CS at the end of transfer.  It easier to follow
      the code to just set this bit with a writel() along with all the other
      bits being set in the same function.
      Signed-off-by: NTrent Piepho <tpiepho@gmail.com>
      Cc: Marek Vasut <marex@denx.de>
      Cc: Fabio Estevam <fabio.estevam@freescale.com>
      Cc: Shawn Guo <shawn.guo@linaro.org>
      Signed-off-by: NMark Brown <broonie@linaro.org>
      f5bc7384
    • T
      spi: spi-mxs: Always set LOCK_CS · 58f46e41
      Trent Piepho 提交于
      There are two bits which control the CS line in the CTRL0 register:
      LOCK_CS and IGNORE_CRC.  The latter would be better named DEASSERT_CS
      in SPI mode.
      
      LOCK_CS keeps CS asserted though the entire transfer.  This should
      always be set.  The DMA code will always set it, explicitly on the
      first segment of the first transfer, and then implicitly on all the
      rest by never clearing the bit from the value read from the ctrl0
      register.
      
      The PIO code will explicitly set it for the first transfer, leave it
      set for intermediate transfers, and then clear it for the final
      transfer.  It should not clear it.
      
      The only reason to not set LOCK_CS would be to attempt an altered
      protocol where CS pulses between each word.  Though don't get your
      hopes up if you want to do this, as the hardware doesn't appear to do
      this in any sane manner.  It appears to be related to the hardware
      FIFO fill level.
      
      The code can be simplified by just setting LOCK_CS once and then not
      needing to deal with it at all in the PIO and DMA transfer functions.
      Signed-off-by: NTrent Piepho <tpiepho@gmail.com>
      Cc: Marek Vasut <marex@denx.de>
      Cc: Fabio Estevam <fabio.estevam@freescale.com>
      Cc: Shawn Guo <shawn.guo@linaro.org>
      Signed-off-by: NMark Brown <broonie@linaro.org>
      58f46e41
  2. 07 8月, 2013 1 次提交
  3. 22 7月, 2013 1 次提交
  4. 15 7月, 2013 3 次提交
  5. 30 5月, 2013 1 次提交
  6. 13 5月, 2013 1 次提交
  7. 04 4月, 2013 2 次提交
  8. 05 2月, 2013 1 次提交
  9. 26 1月, 2013 1 次提交
  10. 08 12月, 2012 1 次提交
  11. 17 10月, 2012 2 次提交
  12. 06 9月, 2012 5 次提交
    • M
      spi/mxs: Make the SPI block clock speed configurable via DT · e64d07a2
      Marek Vasut 提交于
      Add "clock-frequency" property, which allows configuring the SPI block's
      base speed.
      Signed-off-by: NMarek Vasut <marex@denx.de>
      Signed-off-by: NMark Brown <broonie@opensource.wolfsonmicro.com>
      e64d07a2
    • M
      mxs/spi: Rework the mxs_ssp_timeout to be more readable · f13639dc
      Marek Vasut 提交于
      Rework the mxs_ssp_timeout() function to make it a bit more readable
      and hopefully less error prone. Also, have only one successful exit
      from the function and one failing exit instead of two.
      
      Finally, discard the udelay() from this function altogether, as this
      tightloop is quick enough it's pointless.
      Signed-off-by: NMarek Vasut <marex@denx.de>
      Signed-off-by: NMark Brown <broonie@opensource.wolfsonmicro.com>
      f13639dc
    • M
      mxs/spi: Decrement the DMA/PIO border · 727c10e3
      Marek Vasut 提交于
      This driver checks the length of transfer to be made and based
      on this information, either chooses to transfer data via DMA or
      PIO. Decrement this border further to gain better performace eg.
      during SPI flash writes.
      
      Empiric measurement shows that this gives extra 3kB/s write speed
      with a M25P80 flash clocked at 40MHz.
      Signed-off-by: NMarek Vasut <marex@denx.de>
      Signed-off-by: NMark Brown <broonie@opensource.wolfsonmicro.com>
      727c10e3
    • M
      mxs/spi: Increment the transfer length only if transfer succeeded · 204e706f
      Marek Vasut 提交于
      The transfer function incremented (struct spi_message)->actual_length
      unconditionally, even if the transfer failed. Rectify this by incrementing
      this only if transfer succeeded.
      Signed-off-by: NMarek Vasut <marex@denx.de>
      Signed-off-by: NMark Brown <broonie@opensource.wolfsonmicro.com>
      204e706f
    • M
      mxs/spi: Fix issues when doing long continuous transfer · 010b4818
      Marek Vasut 提交于
      When doing long continuous transfer, eg. from SPI flash via /dev/mtd,
      the driver dies. This is caused by a bug in the DMA chaining. Rework
      the DMA transfer code so that this issue does not happen any longer.
      
      This involves proper allocation of correct amount of sg-list members.
      Also, this means proper creation of DMA descriptors. There is actually an
      important catch to this, the data transfer descriptors must be interleaved
      with PIO register write descriptor, otherwise the transfer stalls. This
      can be done in one descriptor, but due to the limitation of the DMA API,
      it's not possible.
      
      It turns out that in order for the SPI DMA to properly support
      continuous transfers longer than 65280 bytes, there are some very
      important parts that were left out from the documentation about about
      the PIO transfer that is used.
      
      Firstly, the XFER_SIZE register is not written with the whole length
      of a transfer, but is written by each and every chained descriptor
      with the length of the descriptors data buffer.
      
      Next, unlike the demo code supplied by FSL, which only writes one PIO
      word per descriptor, this does not apply if the descriptors are chained,
      since the XFER_SIZE register must be written. Therefore, it is essential
      to use four PIO words, CTRL0, CMD0, CMD1, XFER_SIZE. CMD0 and CMD1 are
      written with zero, since they don't apply. The DMA programs the PIO words
      in an incrementing order, so four PIO words.
      
      Finally, unlike the demo code supplied by FSL, the SSP_CTRL0_IGNORE_CRC
      must not be set during the whole transfer, but it must be set only on the
      last descriptor in the chain.
      
      Lastly, this code lends code from drivers/mtd/nand/omap2.c, which solves
      trouble when the buffer supplied to the DMA transfer was vmalloc()'d. So
      with this patch, it's safe to use /dev/mtdblockX interface again.
      Signed-off-by: NMarek Vasut <marex@denx.de>
      Signed-off-by: NMark Brown <broonie@opensource.wolfsonmicro.com>
      010b4818
  13. 28 8月, 2012 3 次提交
    • G
      spi/mxs: Fix device remove function · 7d520d28
      Guenter Roeck 提交于
      The call sequence spi_alloc_master/spi_register_master/spi_unregister_master
      is complete; it reduces the device reference count to zero, which results in
      device memory being freed. The remove function accesses the freed memory after
      the call to spi_unregister_master(), _and_ it calls spi_master_put on the freed
      memory.
      
      Acquire a reference to the SPI master device and release it after cleanup is
      complete (with the existing spi_master_put) to solve the problem.
      
      Also, the device subsystem ensures that the remove function is only called once,
      and resets device driver data to NULL. Remove the unnecessaary calls to
      platform_set_drvdata().
      Signed-off-by: NGuenter Roeck <linux@roeck-us.net>
      Reviewed-by: NMarek Vasut <marex@denx.de>
      Signed-off-by: NMark Brown <broonie@opensource.wolfsonmicro.com>
      7d520d28
    • M
      mxs/spi: Fix misuse of init_completion · 41682e03
      Marek Vasut 提交于
      The init_completion() call does reinit not only the variable carrying
      the flag that the completion finished, but also initialized the
      waitqueue associated with the completion. On the contrary, the
      INIT_COMPLETION() call only reinits the flag.
      
      In case there was anything still stuck in the waitqueue, subsequent call
      to init_completion() would be able to create possible race condition. This
      patch uses the proper function and moves init_completion() into .probe() call
      of the driver, to be issued only once.
      
      Note that such scenario is impossible, since two threads can never enter the
      mxs_spi_txrx_dma(), since whole this section is protected by mutex in SPI core.
      This by no means allows this issue to exit though.
      Signed-off-by: NMarek Vasut <marex@denx.de>
      Cc: Chris Ball <cjb@laptop.org>
      Cc: Shawn Guo <shawn.guo@linaro.org>
      Cc: Mark Brown <broonie@opensource.wolfsonmicro.com>
      Cc: Fabio Estevam <fabio.estevam@freescale.com>
      Signed-off-by: NMark Brown <broonie@opensource.wolfsonmicro.com>
      41682e03
    • M
      mxs/spi: Restart the block after unsuccessful transfer · c895db0f
      Marek Vasut 提交于
      Restart the SSP block in case the SSP transfer failed in any way.
      The block hung in some cases otherwise.
      Signed-off-by: NMarek Vasut <marex@denx.de>
      Cc: Chris Ball <cjb@laptop.org>
      Cc: Shawn Guo <shawn.guo@linaro.org>
      Cc: Mark Brown <broonie@opensource.wolfsonmicro.com>
      Cc: Fabio Estevam <fabio.estevam@freescale.com>
      Signed-off-by: NMark Brown <broonie@opensource.wolfsonmicro.com>
      c895db0f
  14. 18 8月, 2012 3 次提交