1. 09 10月, 2020 9 次提交
  2. 30 9月, 2020 6 次提交
  3. 08 9月, 2020 1 次提交
  4. 29 5月, 2020 5 次提交
  5. 26 5月, 2020 1 次提交
    • L
      spi: dw: Fix controller unregister order · ca8b19d6
      Lukas Wunner 提交于
      The Designware SPI driver uses devm_spi_register_controller() on bind.
      As a consequence, on unbind, __device_release_driver() first invokes
      dw_spi_remove_host() before unregistering the SPI controller via
      devres_release_all().
      
      This order is incorrect:  dw_spi_remove_host() shuts down the chip,
      rendering the SPI bus inaccessible even though the SPI controller is
      still registered.  When the SPI controller is subsequently unregistered,
      it unbinds all its slave devices.  Because their drivers cannot access
      the SPI bus, e.g. to quiesce interrupts, the slave devices may be left
      in an improper state.
      
      As a rule, devm_spi_register_controller() must not be used if the
      ->remove() hook performs teardown steps which shall be performed after
      unregistering the controller and specifically after unbinding of slaves.
      
      Fix by reverting to the non-devm variant of spi_register_controller().
      
      An alternative approach would be to use device-managed functions for all
      steps in dw_spi_remove_host(), e.g. by calling devm_add_action_or_reset()
      on probe.  However that approach would add more LoC to the driver and
      it wouldn't lend itself as well to backporting to stable.
      
      Fixes: 04f421e7 ("spi: dw: use managed resources")
      Signed-off-by: NLukas Wunner <lukas@wunner.de>
      Reviewed-by: NAndy Shevchenko <andriy.shevchenko@linux.intel.com>
      Cc: stable@vger.kernel.org # v3.14+
      Cc: Baruch Siach <baruch@tkos.co.il>
      Link: https://lore.kernel.org/r/3fff8cb8ae44a9893840d0688be15bb88c090a14.1590408496.git.lukas@wunner.deSigned-off-by: NMark Brown <broonie@kernel.org>
      ca8b19d6
  6. 22 5月, 2020 1 次提交
    • S
      spi: dw: Discard dma_width member of the dw_spi structure · 4fdc03a9
      Serge Semin 提交于
      This member has exactly the same value as n_bytes of the DW SPI private
      data object, it's calculated at the same point of the transfer method,
      n_bytes isn't changed during the whole transfer, and they even serve for
      the same purpose - keep number of bytes per transfer word, though the
      dma_width is used only to calculate the DMA source/destination addresses
      width, which n_bytes could be also utilized for. Taking all of these
      into account let's replace the dma_width member usage with n_bytes one
      and remove the former.
      Signed-off-by: NSerge Semin <Sergey.Semin@baikalelectronics.ru>
      Reviewed-by: NAndy Shevchenko <andriy.shevchenko@linux.intel.com>
      Cc: Georgy Vlasov <Georgy.Vlasov@baikalelectronics.ru>
      Cc: Ramil Zaripov <Ramil.Zaripov@baikalelectronics.ru>
      Cc: Alexey Malahov <Alexey.Malahov@baikalelectronics.ru>
      Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
      Cc: Paul Burton <paulburton@kernel.org>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Rob Herring <robh+dt@kernel.org>
      Cc: linux-mips@vger.kernel.org
      Cc: devicetree@vger.kernel.org
      
      Link: https://lore.kernel.org/r/20200522000806.7381-6-Sergey.Semin@baikalelectronics.ruSigned-off-by: NMark Brown <broonie@kernel.org>
      4fdc03a9
  7. 16 5月, 2020 1 次提交
    • S
      spi: dw: Fix native CS being unset · 9aea644c
      Serge Semin 提交于
      Commit 6e0a32d6 ("spi: dw: Fix default polarity of native
      chipselect") attempted to fix the problem when GPIO active-high
      chip-select is utilized to communicate with some SPI slave. It fixed
      the problem, but broke the normal native CS support. At the same time
      the reversion commit ada9e3fc ("spi: dw: Correct handling of native
      chipselect") didn't solve the problem either, since it just inverted
      the set_cs() polarity perception without taking into account that
      CS-high might be applicable. Here is what is done to finally fix the
      problem.
      
      DW SPI controller demands any native CS being set in order to proceed
      with data transfer. So in order to activate the SPI communications we
      must set any bit in the Slave Select DW SPI controller register no
      matter whether the platform requests the GPIO- or native CS. Preferably
      it should be the bit corresponding to the SPI slave CS number. But
      currently the dw_spi_set_cs() method activates the chip-select
      only if the second argument is false. Since the second argument of the
      set_cs callback is expected to be a boolean with "is-high" semantics
      (actual chip-select pin state value), the bit in the DW SPI Slave
      Select register will be set only if SPI core requests the driver
      to set the CS in the low state. So this will work for active-low
      GPIO-based CS case, and won't work for active-high CS setting
      the bit when SPI core actually needs to deactivate the CS.
      
      This commit fixes the problem for all described cases. So no matter
      whether an SPI slave needs GPIO- or native-based CS with active-high
      or low signal the corresponding bit will be set in SER.
      Signed-off-by: NSerge Semin <Sergey.Semin@baikalelectronics.ru>
      Fixes: ada9e3fc ("spi: dw: Correct handling of native chipselect")
      Fixes: 6e0a32d6 ("spi: dw: Fix default polarity of native chipselect")
      Reviewed-by: NCharles Keepax <ckeepax@opensource.cirrus.com>
      Reviewed-by: NAndy Shevchenko <andriy.shevchenko@linux.intel.com>
      Acked-by: NLinus Walleij <linus.walleij@linaro.org>
      
      Link: https://lore.kernel.org/r/20200515104758.6934-5-Sergey.Semin@baikalelectronics.ruSigned-off-by: NMark Brown <broonie@kernel.org>
      9aea644c
  8. 07 5月, 2020 3 次提交
  9. 05 5月, 2020 3 次提交
  10. 16 4月, 2020 2 次提交
  11. 07 1月, 2020 1 次提交
  12. 03 1月, 2020 1 次提交
    • W
      spi: spi-dw: Add lock protect dw_spi rx/tx to prevent concurrent calls · 19b61392
      wuxu.wu 提交于
      dw_spi_irq() and dw_spi_transfer_one concurrent calls.
      
      I find a panic in dw_writer(): txw = *(u8 *)(dws->tx), when dw->tx==null,
      dw->len==4, and dw->tx_end==1.
      
      When tpm driver's message overtime dw_spi_irq() and dw_spi_transfer_one
      may concurrent visit dw_spi, so I think dw_spi structure lack of protection.
      
      Otherwise dw_spi_transfer_one set dw rx/tx buffer and then open irq,
      store dw rx/tx instructions and other cores handle irq load dw rx/tx
      instructions may out of order.
      
      	[ 1025.321302] Call trace:
      	...
      	[ 1025.321319]  __crash_kexec+0x98/0x148
      	[ 1025.321323]  panic+0x17c/0x314
      	[ 1025.321329]  die+0x29c/0x2e8
      	[ 1025.321334]  die_kernel_fault+0x68/0x78
      	[ 1025.321337]  __do_kernel_fault+0x90/0xb0
      	[ 1025.321346]  do_page_fault+0x88/0x500
      	[ 1025.321347]  do_translation_fault+0xa8/0xb8
      	[ 1025.321349]  do_mem_abort+0x68/0x118
      	[ 1025.321351]  el1_da+0x20/0x8c
      	[ 1025.321362]  dw_writer+0xc8/0xd0
      	[ 1025.321364]  interrupt_transfer+0x60/0x110
      	[ 1025.321365]  dw_spi_irq+0x48/0x70
      	...
      Signed-off-by: Nwuxu.wu <wuxu.wu@huawei.com>
      Link: https://lore.kernel.org/r/1577849981-31489-1-git-send-email-wuxu.wu@huawei.comSigned-off-by: NMark Brown <broonie@kernel.org>
      19b61392
  13. 12 12月, 2019 1 次提交
  14. 28 11月, 2019 1 次提交
    • C
      spi: dw: Correct handling of native chipselect · ada9e3fc
      Charles Keepax 提交于
      This patch reverts commit 6e0a32d6 ("spi: dw: Fix default polarity
      of native chipselect").
      
      The SPI framework always called the set_cs callback with the logic
      level it desired on the chip select line, which is what the drivers
      original handling supported. commit f3186dd8 ("spi: Optionally
      use GPIO descriptors for CS GPIOs") changed these symantics, but only
      in the case of drivers that also support GPIO chip selects, to true
      meaning apply slave select rather than logic high. This left things in
      an odd state where a driver that only supports hardware chip selects,
      the core would handle polarity but if the driver supported GPIOs as
      well the driver should handle polarity.  At this point the reverted
      change was applied to change the logic in the driver to match new
      system.
      
      This was then broken by commit 3e5ec1db ("spi: Fix SPI_CS_HIGH
      setting when using native and GPIO CS") which reverted the core back
      to consistently calling set_cs with a logic level.
      
      This fix reverts the driver code back to its original state to match
      the current core code. This is probably a better fix as a) the set_cs
      callback is always called with consistent symantics and b) the
      inversion for SPI_CS_HIGH can be handled in the core and doesn't need
      to be coded in each driver supporting it.
      
      Fixes: 3e5ec1db ("spi: Fix SPI_CS_HIGH setting when using native and GPIO CS")
      Signed-off-by: NCharles Keepax <ckeepax@opensource.cirrus.com>
      Acked-by: NLinus Walleij <linus.walleij@linaro.org>
      Link: https://lore.kernel.org/r/20191127153936.29719-1-ckeepax@opensource.cirrus.comSigned-off-by: NMark Brown <broonie@kernel.org>
      ada9e3fc
  15. 06 11月, 2019 1 次提交
  16. 30 10月, 2019 1 次提交
  17. 01 10月, 2019 1 次提交
  18. 05 6月, 2019 1 次提交