1. 21 8月, 2020 1 次提交
  2. 19 8月, 2020 1 次提交
  3. 27 7月, 2020 1 次提交
  4. 14 7月, 2020 1 次提交
    • L
      spi: imx/fsl-lpspi: Convert to GPIO descriptors · 8cdcd8ae
      Linus Walleij 提交于
      This converts the two Freescale i.MX SPI drivers
      Freescale i.MX (CONFIG_SPI_IMX) and Freescale i.MX LPSPI
      (CONFIG_SPI_FSL_LPSPI) to use GPIO descriptors handled in
      the SPI core for GPIO chip selects whether defined in
      the device tree or a board file.
      
      The reason why both are converted at the same time is
      that they were both using the same platform data and
      platform device population helpers when using
      board files intertwining the code so this gives a cleaner
      cut.
      
      The platform device creation was passing a platform data
      container from each boardfile down to the driver using
      struct spi_imx_master from <linux/platform_data/spi-imx.h>,
      but this was only conveying the number of chipselects and
      an int * array of the chipselect GPIO numbers.
      
      The imx27 and imx31 platforms had code passing the
      now-unused platform data when creating the platform devices,
      this has been repurposed to pass around GPIO descriptor
      tables. The platform data struct that was just passing an
      array of integers and number of chip selects for the GPIO
      lines has been removed.
      
      The number of chipselects used to be passed from the board
      file, because this number also limits the number of native
      chipselects that the platform can use. To deal with this we
      just augment the i.MX (CONFIG_SPI_IMX) driver to support 3
      chipselects if the platform does not define "num-cs" as a
      device property (such as from the device tree). This covers
      all the legacy boards as these use <= 3 native chip selects
      (or GPIO lines, and in that case the number of chip selects
      is determined by the core from the number of available
      GPIO lines). Any new boards should use device tree, so
      this is a reasonable simplification to cover all old
      boards.
      
      The LPSPI driver never assigned the number of chipselects
      and thus always fall back to the core default of 1 chip
      select if no GPIOs are defined in the device tree.
      
      The Freescale i.MX driver was already partly utilizing
      the SPI core to obtain the GPIO numbers from the device tree,
      so this completes the transtion to let the core handle all
      of it.
      
      All board files and the core i.MX boardfile registration
      code is augmented to account for these changes.
      
      This has been compile-tested with the imx_v4_v5_defconfig
      and the imx_v6_v7_defconfig.
      Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
      Acked-by: NShawn Guo <shawnguo@kernel.org>
      Cc: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
      Cc: Robin Gong <yibin.gong@nxp.com>
      Cc: Trent Piepho <tpiepho@impinj.com>
      Cc: Clark Wang <xiaoning.wang@nxp.com>
      Cc: Shawn Guo <shawnguo@kernel.org>
      Cc: Sascha Hauer <s.hauer@pengutronix.de>
      Cc: Pengutronix Kernel Team <kernel@pengutronix.de>
      Cc: Fabio Estevam <festevam@gmail.com>
      Cc: NXP Linux Team <linux-imx@nxp.com>
      Link: https://lore.kernel.org/r/20200625200252.207614-1-linus.walleij@linaro.orgSigned-off-by: NMark Brown <broonie@kernel.org>
      8cdcd8ae
  5. 23 6月, 2020 1 次提交
  6. 28 5月, 2020 1 次提交
  7. 26 12月, 2019 1 次提交
  8. 15 11月, 2019 1 次提交
  9. 13 3月, 2019 1 次提交
    • T
      spi: imx: stop buffer overflow in RX FIFO flush · c842749e
      Trent Piepho 提交于
      Commit 71abd290 ("spi: imx: Add support for SPI Slave mode") added
      an RX FIFO flush before start of a transfer.  In slave mode, the master
      may have sent more data than expected and this data will still be in the
      RX FIFO at the start of the next transfer, and so needs to be flushed.
      
      However, the code to do the flush was accidentally saving this data into
      the previous transfer's RX buffer, clobbering the contents of whatever
      followed that buffer.
      
      Change it to empty the FIFO and throw away the data.  Every one of the
      RX functions for the different eCSPI versions and modes reads the RX
      FIFO data using the same readl() call, so just use that, rather than
      using the spi_imx->rx function pointer and making sure all the different
      rx functions have a working "throw away" mode.
      
      There is another issue, which affects master mode when switching from
      DMA to PIO.  There can be extra data in the RX FIFO which triggers this
      flush code, causing memory corruption in the same manner.  I don't know
      why this data is unexpectedly in the FIFO.  It's likely there is a
      different bug or erratum responsible for that.  But regardless of that,
      I think this is proper fix the for bug at hand here.
      
      Fixes: 71abd290 ("spi: imx: Add support for SPI Slave mode")
      Cc: Jiada Wang <jiada_wang@mentor.com>
      Cc: Fabio Estevam <festevam@gmail.com>
      Cc: Stefan Agner <stefan@agner.ch>
      Cc: Shawn Guo <shawnguo@kernel.org>
      Signed-off-by: NTrent Piepho <tpiepho@impinj.com>
      Signed-off-by: NMark Brown <broonie@kernel.org>
      c842749e
  10. 12 3月, 2019 1 次提交
    • T
      spi: imx: add module parameter to control DMA use · 0a9c8998
      Trent Piepho 提交于
      Add the boolean module parameter "use_dma" to control the use of DMA by
      the driver.  There are about two dozen other drivers with a "use_dma"
      parameter of some sort.
      
      DMA may allow faster and more efficient transfers than using PIO, but it
      also adds overhead for small transfers.
      
      High speed receive operations may be less likely to have issues with
      FIFO overflow when using DMA than when using PIO.
      
      The eCSPI appears to insert a 4 bit pause after each word in DMA mode,
      not done in PIO mode, which can make DMA transfers 50% slower than PIO.
      
      In some cases DMA may be a net win while in others PIO might be.  It
      depends on the application.  So allow DMA to be enabled or disabled at
      the driver level.  The default will be to have it enabled when possible.
      Signed-off-by: NTrent Piepho <tpiepho@impinj.com>
      Signed-off-by: NMark Brown <broonie@kernel.org>
      0a9c8998
  11. 11 12月, 2018 5 次提交
  12. 13 10月, 2018 3 次提交
    • R
      spi: imx: use PIO mode if size is small · 133eb8e3
      Robin Gong 提交于
      Use PIO mode instead if size is smaller than fifo size, since
      dma may be less efficient.
      Signed-off-by: NRobin Gong <yibin.gong@nxp.com>
      Signed-off-by: NMark Brown <broonie@kernel.org>
      133eb8e3
    • R
      spi: imx: correct wml as the last sg length · 5ba5a373
      Robin Gong 提交于
      Correct wml as the last rx sg length instead of the whole transfer
      length. Otherwise, mtd_stresstest will be failed as below:
      
      insmod mtd_stresstest.ko dev=0
      =================================================
      mtd_stresstest: MTD device: 0
      mtd_stresstest: not NAND flash, assume page size is 512 bytes.
      mtd_stresstest: MTD device size 4194304, eraseblock size 65536, page size 512, count of eraseblocks 64, pa0
      mtd_stresstest: doing operations
      mtd_stresstest: 0 operations done
      mtd_test: mtd_read from 1ff532, size 880
      mtd_test: mtd_read from 20c267, size 64998
      spi_master spi0: I/O Error in DMA RX
      m25p80 spi0.0: SPI transfer failed: -110
      spi_master spi0: failed to transfer one message from queue
      mtd_test: error: read failed at 0x20c267
      mtd_stresstest: error -110 occurred
      =================================================
      insmod: ERROR: could not insert module mtd_stresstest.ko: Connection timed out
      Signed-off-by: NRobin Gong <yibin.gong@nxp.com>
      Signed-off-by: NMark Brown <broonie@kernel.org>
      5ba5a373
    • R
      spi: imx: move wml setting to later than setup_transfer · 987a2dfe
      Robin Gong 提交于
      Current dynamic burst length is based on the whole transfer length,
      that's ok if there is only one sg, but is not right in case multi sgs
      in one transfer,because the tail data should be based on the last sg
      length instead of the whole transfer length. Move wml setting for DMA
      to the later place, thus, the next patch could get the right last sg
      length for wml setting. This patch is a preparation one, no any
      function change involved.
      Signed-off-by: NRobin Gong <yibin.gong@nxp.com>
      Signed-off-by: NMark Brown <broonie@kernel.org>
      987a2dfe
  13. 24 7月, 2018 5 次提交
  14. 13 6月, 2018 1 次提交
    • K
      treewide: devm_kzalloc() -> devm_kcalloc() · a86854d0
      Kees Cook 提交于
      The devm_kzalloc() function has a 2-factor argument form, devm_kcalloc().
      This patch replaces cases of:
      
              devm_kzalloc(handle, a * b, gfp)
      
      with:
              devm_kcalloc(handle, a * b, gfp)
      
      as well as handling cases of:
      
              devm_kzalloc(handle, a * b * c, gfp)
      
      with:
      
              devm_kzalloc(handle, array3_size(a, b, c), gfp)
      
      as it's slightly less ugly than:
      
              devm_kcalloc(handle, array_size(a, b), c, gfp)
      
      This does, however, attempt to ignore constant size factors like:
      
              devm_kzalloc(handle, 4 * 1024, gfp)
      
      though any constants defined via macros get caught up in the conversion.
      
      Any factors with a sizeof() of "unsigned char", "char", and "u8" were
      dropped, since they're redundant.
      
      Some manual whitespace fixes were needed in this patch, as Coccinelle
      really liked to write "=devm_kcalloc..." instead of "= devm_kcalloc...".
      
      The Coccinelle script used for this was:
      
      // Fix redundant parens around sizeof().
      @@
      expression HANDLE;
      type TYPE;
      expression THING, E;
      @@
      
      (
        devm_kzalloc(HANDLE,
      -	(sizeof(TYPE)) * E
      +	sizeof(TYPE) * E
        , ...)
      |
        devm_kzalloc(HANDLE,
      -	(sizeof(THING)) * E
      +	sizeof(THING) * E
        , ...)
      )
      
      // Drop single-byte sizes and redundant parens.
      @@
      expression HANDLE;
      expression COUNT;
      typedef u8;
      typedef __u8;
      @@
      
      (
        devm_kzalloc(HANDLE,
      -	sizeof(u8) * (COUNT)
      +	COUNT
        , ...)
      |
        devm_kzalloc(HANDLE,
      -	sizeof(__u8) * (COUNT)
      +	COUNT
        , ...)
      |
        devm_kzalloc(HANDLE,
      -	sizeof(char) * (COUNT)
      +	COUNT
        , ...)
      |
        devm_kzalloc(HANDLE,
      -	sizeof(unsigned char) * (COUNT)
      +	COUNT
        , ...)
      |
        devm_kzalloc(HANDLE,
      -	sizeof(u8) * COUNT
      +	COUNT
        , ...)
      |
        devm_kzalloc(HANDLE,
      -	sizeof(__u8) * COUNT
      +	COUNT
        , ...)
      |
        devm_kzalloc(HANDLE,
      -	sizeof(char) * COUNT
      +	COUNT
        , ...)
      |
        devm_kzalloc(HANDLE,
      -	sizeof(unsigned char) * COUNT
      +	COUNT
        , ...)
      )
      
      // 2-factor product with sizeof(type/expression) and identifier or constant.
      @@
      expression HANDLE;
      type TYPE;
      expression THING;
      identifier COUNT_ID;
      constant COUNT_CONST;
      @@
      
      (
      - devm_kzalloc
      + devm_kcalloc
        (HANDLE,
      -	sizeof(TYPE) * (COUNT_ID)
      +	COUNT_ID, sizeof(TYPE)
        , ...)
      |
      - devm_kzalloc
      + devm_kcalloc
        (HANDLE,
      -	sizeof(TYPE) * COUNT_ID
      +	COUNT_ID, sizeof(TYPE)
        , ...)
      |
      - devm_kzalloc
      + devm_kcalloc
        (HANDLE,
      -	sizeof(TYPE) * (COUNT_CONST)
      +	COUNT_CONST, sizeof(TYPE)
        , ...)
      |
      - devm_kzalloc
      + devm_kcalloc
        (HANDLE,
      -	sizeof(TYPE) * COUNT_CONST
      +	COUNT_CONST, sizeof(TYPE)
        , ...)
      |
      - devm_kzalloc
      + devm_kcalloc
        (HANDLE,
      -	sizeof(THING) * (COUNT_ID)
      +	COUNT_ID, sizeof(THING)
        , ...)
      |
      - devm_kzalloc
      + devm_kcalloc
        (HANDLE,
      -	sizeof(THING) * COUNT_ID
      +	COUNT_ID, sizeof(THING)
        , ...)
      |
      - devm_kzalloc
      + devm_kcalloc
        (HANDLE,
      -	sizeof(THING) * (COUNT_CONST)
      +	COUNT_CONST, sizeof(THING)
        , ...)
      |
      - devm_kzalloc
      + devm_kcalloc
        (HANDLE,
      -	sizeof(THING) * COUNT_CONST
      +	COUNT_CONST, sizeof(THING)
        , ...)
      )
      
      // 2-factor product, only identifiers.
      @@
      expression HANDLE;
      identifier SIZE, COUNT;
      @@
      
      - devm_kzalloc
      + devm_kcalloc
        (HANDLE,
      -	SIZE * COUNT
      +	COUNT, SIZE
        , ...)
      
      // 3-factor product with 1 sizeof(type) or sizeof(expression), with
      // redundant parens removed.
      @@
      expression HANDLE;
      expression THING;
      identifier STRIDE, COUNT;
      type TYPE;
      @@
      
      (
        devm_kzalloc(HANDLE,
      -	sizeof(TYPE) * (COUNT) * (STRIDE)
      +	array3_size(COUNT, STRIDE, sizeof(TYPE))
        , ...)
      |
        devm_kzalloc(HANDLE,
      -	sizeof(TYPE) * (COUNT) * STRIDE
      +	array3_size(COUNT, STRIDE, sizeof(TYPE))
        , ...)
      |
        devm_kzalloc(HANDLE,
      -	sizeof(TYPE) * COUNT * (STRIDE)
      +	array3_size(COUNT, STRIDE, sizeof(TYPE))
        , ...)
      |
        devm_kzalloc(HANDLE,
      -	sizeof(TYPE) * COUNT * STRIDE
      +	array3_size(COUNT, STRIDE, sizeof(TYPE))
        , ...)
      |
        devm_kzalloc(HANDLE,
      -	sizeof(THING) * (COUNT) * (STRIDE)
      +	array3_size(COUNT, STRIDE, sizeof(THING))
        , ...)
      |
        devm_kzalloc(HANDLE,
      -	sizeof(THING) * (COUNT) * STRIDE
      +	array3_size(COUNT, STRIDE, sizeof(THING))
        , ...)
      |
        devm_kzalloc(HANDLE,
      -	sizeof(THING) * COUNT * (STRIDE)
      +	array3_size(COUNT, STRIDE, sizeof(THING))
        , ...)
      |
        devm_kzalloc(HANDLE,
      -	sizeof(THING) * COUNT * STRIDE
      +	array3_size(COUNT, STRIDE, sizeof(THING))
        , ...)
      )
      
      // 3-factor product with 2 sizeof(variable), with redundant parens removed.
      @@
      expression HANDLE;
      expression THING1, THING2;
      identifier COUNT;
      type TYPE1, TYPE2;
      @@
      
      (
        devm_kzalloc(HANDLE,
      -	sizeof(TYPE1) * sizeof(TYPE2) * COUNT
      +	array3_size(COUNT, sizeof(TYPE1), sizeof(TYPE2))
        , ...)
      |
        devm_kzalloc(HANDLE,
      -	sizeof(TYPE1) * sizeof(THING2) * (COUNT)
      +	array3_size(COUNT, sizeof(TYPE1), sizeof(TYPE2))
        , ...)
      |
        devm_kzalloc(HANDLE,
      -	sizeof(THING1) * sizeof(THING2) * COUNT
      +	array3_size(COUNT, sizeof(THING1), sizeof(THING2))
        , ...)
      |
        devm_kzalloc(HANDLE,
      -	sizeof(THING1) * sizeof(THING2) * (COUNT)
      +	array3_size(COUNT, sizeof(THING1), sizeof(THING2))
        , ...)
      |
        devm_kzalloc(HANDLE,
      -	sizeof(TYPE1) * sizeof(THING2) * COUNT
      +	array3_size(COUNT, sizeof(TYPE1), sizeof(THING2))
        , ...)
      |
        devm_kzalloc(HANDLE,
      -	sizeof(TYPE1) * sizeof(THING2) * (COUNT)
      +	array3_size(COUNT, sizeof(TYPE1), sizeof(THING2))
        , ...)
      )
      
      // 3-factor product, only identifiers, with redundant parens removed.
      @@
      expression HANDLE;
      identifier STRIDE, SIZE, COUNT;
      @@
      
      (
        devm_kzalloc(HANDLE,
      -	(COUNT) * STRIDE * SIZE
      +	array3_size(COUNT, STRIDE, SIZE)
        , ...)
      |
        devm_kzalloc(HANDLE,
      -	COUNT * (STRIDE) * SIZE
      +	array3_size(COUNT, STRIDE, SIZE)
        , ...)
      |
        devm_kzalloc(HANDLE,
      -	COUNT * STRIDE * (SIZE)
      +	array3_size(COUNT, STRIDE, SIZE)
        , ...)
      |
        devm_kzalloc(HANDLE,
      -	(COUNT) * (STRIDE) * SIZE
      +	array3_size(COUNT, STRIDE, SIZE)
        , ...)
      |
        devm_kzalloc(HANDLE,
      -	COUNT * (STRIDE) * (SIZE)
      +	array3_size(COUNT, STRIDE, SIZE)
        , ...)
      |
        devm_kzalloc(HANDLE,
      -	(COUNT) * STRIDE * (SIZE)
      +	array3_size(COUNT, STRIDE, SIZE)
        , ...)
      |
        devm_kzalloc(HANDLE,
      -	(COUNT) * (STRIDE) * (SIZE)
      +	array3_size(COUNT, STRIDE, SIZE)
        , ...)
      |
        devm_kzalloc(HANDLE,
      -	COUNT * STRIDE * SIZE
      +	array3_size(COUNT, STRIDE, SIZE)
        , ...)
      )
      
      // Any remaining multi-factor products, first at least 3-factor products,
      // when they're not all constants...
      @@
      expression HANDLE;
      expression E1, E2, E3;
      constant C1, C2, C3;
      @@
      
      (
        devm_kzalloc(HANDLE, C1 * C2 * C3, ...)
      |
        devm_kzalloc(HANDLE,
      -	(E1) * E2 * E3
      +	array3_size(E1, E2, E3)
        , ...)
      |
        devm_kzalloc(HANDLE,
      -	(E1) * (E2) * E3
      +	array3_size(E1, E2, E3)
        , ...)
      |
        devm_kzalloc(HANDLE,
      -	(E1) * (E2) * (E3)
      +	array3_size(E1, E2, E3)
        , ...)
      |
        devm_kzalloc(HANDLE,
      -	E1 * E2 * E3
      +	array3_size(E1, E2, E3)
        , ...)
      )
      
      // And then all remaining 2 factors products when they're not all constants,
      // keeping sizeof() as the second factor argument.
      @@
      expression HANDLE;
      expression THING, E1, E2;
      type TYPE;
      constant C1, C2, C3;
      @@
      
      (
        devm_kzalloc(HANDLE, sizeof(THING) * C2, ...)
      |
        devm_kzalloc(HANDLE, sizeof(TYPE) * C2, ...)
      |
        devm_kzalloc(HANDLE, C1 * C2 * C3, ...)
      |
        devm_kzalloc(HANDLE, C1 * C2, ...)
      |
      - devm_kzalloc
      + devm_kcalloc
        (HANDLE,
      -	sizeof(TYPE) * (E2)
      +	E2, sizeof(TYPE)
        , ...)
      |
      - devm_kzalloc
      + devm_kcalloc
        (HANDLE,
      -	sizeof(TYPE) * E2
      +	E2, sizeof(TYPE)
        , ...)
      |
      - devm_kzalloc
      + devm_kcalloc
        (HANDLE,
      -	sizeof(THING) * (E2)
      +	E2, sizeof(THING)
        , ...)
      |
      - devm_kzalloc
      + devm_kcalloc
        (HANDLE,
      -	sizeof(THING) * E2
      +	E2, sizeof(THING)
        , ...)
      |
      - devm_kzalloc
      + devm_kcalloc
        (HANDLE,
      -	(E1) * E2
      +	E1, E2
        , ...)
      |
      - devm_kzalloc
      + devm_kcalloc
        (HANDLE,
      -	(E1) * (E2)
      +	E1, E2
        , ...)
      |
      - devm_kzalloc
      + devm_kcalloc
        (HANDLE,
      -	E1 * E2
      +	E1, E2
        , ...)
      )
      Signed-off-by: NKees Cook <keescook@chromium.org>
      a86854d0
  15. 03 5月, 2018 1 次提交
  16. 13 4月, 2018 1 次提交
  17. 08 1月, 2018 1 次提交
  18. 11 11月, 2017 3 次提交
    • T
      spi: imx: Don't require platform data chipselect array · ffd4db9e
      Trent Piepho 提交于
      If the array is not present, assume all chip selects are native.  This
      is the standard behavior for SPI masters configured via the device
      tree and the behavior of this driver as well when it is configured via
      device tree.
      
      This reduces platform data vs DT differences and allows most of the
      platform data based boards to remove their chip select arrays.
      
      CC: Shawn Guo <shawnguo@kernel.org>
      CC: Sascha Hauer <kernel@pengutronix.de>
      CC: Fabio Estevam <fabio.estevam@nxp.com>
      CC: Mark Brown <broonie@kernel.org>
      Signed-off-by: NTrent Piepho <tpiepho@impinj.com>
      Signed-off-by: NMark Brown <broonie@kernel.org>
      ffd4db9e
    • T
      spi: imx: Fix failure path leak on GPIO request error · 4e21791e
      Trent Piepho 提交于
      If the code that requests any chip select GPIOs fails, the cleanup of
      spi_bitbang_start() by calling spi_bitbang_stop() is not done.  Add this
      to the failure path.
      
      Note that spi_bitbang_start() has to be called before requesting GPIOs
      because the GPIO data in the spi master is populated when the master is
      registed, and that doesn't happen until spi_bitbang_start() is called.
      
      CC: Shawn Guo <shawnguo@kernel.org>
      CC: Sascha Hauer <kernel@pengutronix.de>
      CC: Fabio Estevam <fabio.estevam@nxp.com>
      CC: Mark Brown <broonie@kernel.org>
      CC: Oleksij Rempel <o.rempel@pengutronix.de>
      Signed-off-by: NTrent Piepho <tpiepho@impinj.com>
      Signed-off-by: NMark Brown <broonie@kernel.org>
      4e21791e
    • T
      spi: imx: GPIO based chip selects should not be required · 881a0b99
      Trent Piepho 提交于
      The driver will fail to load if no gpio chip selects are specified,
      this patch changes this so that it no longer fails.
      
      It's possible to use all native chip selects, in which case there is
      no reason to have a gpio chip select array.  This is what happens if
      the *optional* device tree property "cs-gpios" is omitted.
      
      The spi core already checks for the absence of gpio chip selects in
      the master and assigns any slaves the gpio_cs value of -ENOENT.
      
      Also have the driver respect the standard SPI device tree property "num-cs"
      to allow setting the number of chip selects without using cs-gpios.
      
      CC: Mark Brown <broonie@kernel.org>
      CC: Shawn Guo <shawnguo@kernel.org>
      CC: Sascha Hauer <kernel@pengutronix.de>
      CC: Fabio Estevam <fabio.estevam@nxp.com>
      CC: Oleksij Rempel <o.rempel@pengutronix.de>
      Signed-off-by: NTrent Piepho <tpiepho@impinj.com>
      Signed-off-by: NMark Brown <broonie@kernel.org>
      881a0b99
  19. 07 11月, 2017 1 次提交
    • T
      spi: imx: Fix failure path leak on GPIO request error correctly · 8197f489
      Trent Piepho 提交于
      In commit 974488e4 ("spi: imx: Fix failure path leak on GPIO request
      error"), spi_bitbang_start() was moved later in the probe sequence.  But
      this doesn't work, as spi_bitbang_start() has to be called before
      requesting GPIOs because the GPIO data in the spi master is populated when
      the master is registed, and that doesn't happen until spi_bitbang_start()
      is called.  The default only works if one uses one CS.
      
      So add a failure path call to spi_bitbang_stop() to fix the leak.
      
      CC: Shawn Guo <shawnguo@kernel.org>
      CC: Sascha Hauer <kernel@pengutronix.de>
      CC: Fabio Estevam <fabio.estevam@nxp.com>
      CC: Mark Brown <broonie@kernel.org>
      CC: Oleksij Rempel <o.rempel@pengutronix.de>
      Signed-off-by: NTrent Piepho <tpiepho@impinj.com>
      Reviewed-by: NOleksij Rempel <o.rempel@pengutronix.de>
      Signed-off-by: NMark Brown <broonie@kernel.org>
      8197f489
  20. 31 10月, 2017 1 次提交
  21. 19 9月, 2017 1 次提交
    • J
      spi: imx: Add support for SPI Slave mode · 71abd290
      jiada wang 提交于
      Previously i.MX SPI controller only works in Master mode.
      This patch adds support to i.MX51, i.MX53 and i.MX6 ECSPI
      controller to work also in Slave mode.
      
      Currently SPI Slave mode support patch has the following limitations:
      1. The stale data in RXFIFO will be dropped when the Slave does any new
         transfer.
      2. One transfer can be finished only after all transfer->len data been
         transferred to master device
      3. Slave device only accepts transfer->len data. Any data longer than this
         from master device will be dropped. Any data shorter than this from
         master will cause SPI to stuck due to mentioned HW limitation 2.
      4. Only PIO transfer is supported in Slave mode.
      5. Dynamic burst size adjust isn't supported in Slave mode.
      
      Following HW limitation applies:
      1.  ECSPI has a HW issue when works in Slave mode, after 64
          words written to TXFIFO, even TXFIFO becomes empty,
          ECSPI_TXDATA keeps shift out the last word data,
          so we have to disable ECSPI when in slave mode after the
          transfer completes
      2.  Due to Freescale errata ERR003775 "eCSPI: Burst completion by Chip
          Select (SS) signal in Slave mode is not functional" burst size must
          be set exactly to the size of the transfer. This limit SPI transaction
          with maximum 2^12 bits. This errata affects i.MX53 and i.MX6 ECSPI
          controllers.
      Signed-off-by: NJiada Wang <jiada_wang@mentor.com>
      Signed-off-by: NMark Brown <broonie@kernel.org>
      71abd290
  22. 30 8月, 2017 1 次提交
    • G
      spi: imx: fix use of native chip-selects with devicetree · 602c8f44
      Greg Ungerer 提交于
      The commonly used mechanism of specifying the hardware or native
      chip-select on an SPI device in devicetree (that is "cs-gpios = <0>")
      does not result in the native chip-select being configured for use.
      So external SPI devices that require use of the native chip-select
      will not work.
      
      You can successfully specify native chip-selects if using a platform
      setup by specifying the cs-gpio as negative offset by 32. And that
      works correctly. You cannot use the same method in devicetree.
      
      The logic in the spi-imx.c driver during probe uses core spi function
      of_spi_register_master() in spi.c to parse the "cs-gpios" devicetree tag.
      For valid GPIO values that will be recorded for use, all other entries in
      the cs_gpios list will be set to -ENOENT. So entries like "<0>" will be
      set to -ENOENT in the cs_gpios list.
      
      When the SPI device registers are setup the code will use the GPIO
      listed in the cs_gpios list for the desired chip-select. If the cs_gpio
      is less then 0 then it is intended to be for a native chip-select, and
      its cs_gpio value is added to 32 to get the chipselect number to use.
      Problem is that with devicetree this can only ever be -ENOENT (which
      is -2), and that alone results in an invalid chip-select number. But also
      doesn't allow selection of the native chip-select at all.
      
      To fix, if the cs_gpio specified for this spi device is not a
      valid GPIO then use the "chip_select" (that is the native chip-select
      number) for hardware setup.
      Signed-off-by: NGreg Ungerer <gerg@linux-m68k.org>
      Reviewed-by: NVladimir Zapolskiy <vz@mleia.com>
      Tested-by: NVladimir Zapolskiy <vz@mleia.com>
      Signed-off-by: NMark Brown <broonie@kernel.org>
      602c8f44
  23. 23 8月, 2017 1 次提交
    • A
      spi: imx: fix little-endian build · 5904c9d3
      Arnd Bergmann 提交于
      The newly added dynamic burst code produces a harmless warning
      on big-endian configurations:
      
      drivers/spi/spi-imx.c: In function 'spi_imx_buf_rx_swap_u32':
      drivers/spi/spi-imx.c:284:15: error: unused variable 'bytes_per_word' [-Werror=unused-variable]
        unsigned int bytes_per_word;
                     ^~~~~~~~~~~~~~
      drivers/spi/spi-imx.c: In function 'spi_imx_buf_tx_swap_u32':
      drivers/spi/spi-imx.c:319:15: error: unused variable 'bytes_per_word' [-Werror=unused-variable]
        unsigned int bytes_per_word;
      
      This adds another #ifdef around the variable declaration matching
      the one on the use.
      
      Fixes: 1673c81d ("spi: imx: dynamic burst length adjust for PIO mode")
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      Signed-off-by: NMark Brown <broonie@kernel.org>
      5904c9d3
  24. 17 8月, 2017 1 次提交
  25. 26 7月, 2017 1 次提交
  26. 17 7月, 2017 2 次提交
  27. 21 6月, 2017 1 次提交