platform/kernel/linux-starfive.git
3 years agospi: Rename enable1 to activate in spi_set_cs()
Andy Shevchenko [Tue, 20 Apr 2021 13:18:46 +0000 (16:18 +0300)]
spi: Rename enable1 to activate in spi_set_cs()

The enable1 is confusing name. Change it to clearly show what is
the intention behind it. No functional changes.

Fixes: 25093bdeb6bc ("spi: implement SW control for CS times")
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20210420131846.75983-1-andriy.shevchenko@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agospi: Convert Freescale QSPI binding to json schema
Kuldeep Singh [Fri, 12 Mar 2021 05:40:38 +0000 (11:10 +0530)]
spi: Convert Freescale QSPI binding to json schema

Convert the Freescale QSPI binding to DT schema format using json-schema.

Signed-off-by: Kuldeep Singh <kuldeep.singh@nxp.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Link: https://lore.kernel.org/r/20210312054038.3586706-1-kuldeep.singh@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agospi: stm32-qspi: fix debug format string
Arnd Bergmann [Thu, 22 Apr 2021 13:38:57 +0000 (15:38 +0200)]
spi: stm32-qspi: fix debug format string

Printing size_t needs a special %zx format modifier to avoid a
warning like:

drivers/spi/spi-stm32-qspi.c:481:41: note: format string is defined here
  481 |         dev_dbg(qspi->dev, "%s len = 0x%x offs = 0x%llx buf = 0x%p\n", __func__, len, offs, buf);

Patrice already tried to fix this, but picked %lx instead of %zx,
which fixed some architectures but broke others in the same way.
Using %zx works everywhere.

Fixes: 18674dee3cd6 ("spi: stm32-qspi: Add dirmap support")
Fixes: 1b8a7d4282c0 ("spi: stm32-qspi: Fix compilation warning in ARM64")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Link: https://lore.kernel.org/r/20210422134955.1988316-1-arnd@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agospi: tools: make a symbolic link to the header file spi.h
Quanyang Wang [Thu, 22 Apr 2021 10:26:04 +0000 (18:26 +0800)]
spi: tools: make a symbolic link to the header file spi.h

The header file spi.h in include/uapi/linux/spi is needed for spidev.h,
so we also need make a symbolic link to it to eliminate the error message
as below:

In file included from spidev_test.c:24:
include/linux/spi/spidev.h:28:10: fatal error: linux/spi/spi.h: No such file or directory
   28 | #include <linux/spi/spi.h>
      |          ^~~~~~~~~~~~~~~~~
compilation terminated.

Fixes: f7005142dace ("spi: uapi: unify SPI modes into a single spi.h")
Signed-off-by: Quanyang Wang <quanyang.wang@windriver.com>
Link: https://lore.kernel.org/r/20210422102604.3034217-1-quanyang.wang@windriver.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agospi: fsi: add a missing of_node_put
Christophe JAILLET [Tue, 20 Apr 2021 19:46:13 +0000 (21:46 +0200)]
spi: fsi: add a missing of_node_put

'for_each_available_child_of_node' performs an of_node_get on each
iteration, so a return from the middle of the loop requires an of_node_put.

Fixes: bbb6b2f9865b ("spi: Add FSI-attached SPI controller driver")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Link: https://lore.kernel.org/r/504e431b900341249d331b868d90312cf41f415a.1618947919.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agospi: Make error handling of gpiod_count() call cleaner
Andy Shevchenko [Tue, 20 Apr 2021 16:40:40 +0000 (19:40 +0300)]
spi: Make error handling of gpiod_count() call cleaner

Each time we call spi_get_gpio_descs() the num_chipselect is overwritten
either by new value or by the old one. This is an extra operation in case
gpiod_count() returns an error. Besides that it slashes the error handling
of gpiod_count().

Refactor the code to make error handling of gpiod_count() call cleaner.

Note, that gpiod_count() never returns 0, take this into account as well.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20210420164040.40055-1-andriy.shevchenko@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoMerge series "spi: altera: Add DFL bus support for Altera SPI" from matthew.gerlach...
Mark Brown [Tue, 20 Apr 2021 18:30:54 +0000 (19:30 +0100)]
Merge series "spi: altera: Add DFL bus support for Altera SPI" from matthew.gerlach@linux.intel.com
Matthew Gerlach <matthew.gerlach@linux.intel.com>:

From: Matthew Gerlach <matthew.gerlach@linux.intel.com>

This patch set adds Device Feature List (DFL) bus support for
the Altera SPI Master controller.

Patch 1 separates spi-altera.c into spi-altera-core.c and
spi-altera-platform.c.

Patch 2 adds spi-altera-dfl.c.

Matthew Gerlach (2):
  spi: altera: separate core code from platform code
  spi: altera: Add DFL bus driver for Altera API Controller

 drivers/spi/Kconfig               |  18 +-
 drivers/spi/Makefile              |   4 +-
 drivers/spi/spi-altera-core.c     | 222 ++++++++++++++++++++++
 drivers/spi/spi-altera-dfl.c      | 204 ++++++++++++++++++++
 drivers/spi/spi-altera-platform.c | 172 +++++++++++++++++
 drivers/spi/spi-altera.c          | 378 --------------------------------------
 include/linux/spi/altera.h        |  21 +++
 7 files changed, 639 insertions(+), 380 deletions(-)
 create mode 100644 drivers/spi/spi-altera-core.c
 create mode 100644 drivers/spi/spi-altera-dfl.c
 create mode 100644 drivers/spi/spi-altera-platform.c
 delete mode 100644 drivers/spi/spi-altera.c

--
1.8.3.1

3 years agospidev: Add Micron SPI NOR Authenta device compatible
Shivamurthy Shastri [Mon, 19 Apr 2021 20:40:15 +0000 (20:40 +0000)]
spidev: Add Micron SPI NOR Authenta device compatible

Add compatible string for Micron SPI NOR Authenta device.

Signed-off-by: Shivamurthy Shastri <sshivamurthy@micron.com>
Link: https://lore.kernel.org/r/20210419204015.1769-1-sshivamurthy@micron.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agospi: brcm,spi-bcm-qspi: convert to the json-schema
Rafał Miłecki [Fri, 16 Apr 2021 19:47:23 +0000 (21:47 +0200)]
spi: brcm,spi-bcm-qspi: convert to the json-schema

This helps validating DTS files.

Changes that require mentioning:
1. reg-names
   "mspi_regs" and "bspi_regs" were renamed to "mspi" and "bspi" as that
   is what's used in DTS files and in Linux driver
2. interrupt-names
   Names were reordered. "mspi_done" has to go first as it's always
   required.
3. spi-rx-bus-width
   Property description was dropped as it's part of the
   spi-controller.yaml
4. Examples:
   * drop partitions as they are well documented elsewhere
   * regs and interrupts were formatted and reordered to match yaml
   * <0x1c> was replaced with <&gic>
   * "m25p80" node name became "flash"
   * dropped invalid "m25p,fast-read" property
   * dropped undocumented and Linux-unused "clock-names"

This rewritten binding validates cleanly using the  "dt_binding_check".
Some Linux stored DTS files will require reordering regs and interrupts
to make dtbs_check happy.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
Reviewed-by: Rob Herring <robh@kernel.org>
Link: https://lore.kernel.org/r/20210416194723.23855-1-zajec5@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agospi: altera: Add DFL bus driver for Altera API Controller
Matthew Gerlach [Fri, 16 Apr 2021 16:57:20 +0000 (09:57 -0700)]
spi: altera: Add DFL bus driver for Altera API Controller

This patch adds a Device Feature List (DFL) bus driver for the
Altera SPI Master controller.  The SPI master is connected to an
Intel SPI Slave to Avalon Bridge inside an Intel MAX10
BMC Chip.

Signed-off-by: Matthew Gerlach <matthew.gerlach@linux.intel.com>
Link: https://lore.kernel.org/r/20210416165720.554144-3-matthew.gerlach@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agospi: altera: separate core code from platform code
Matthew Gerlach [Fri, 16 Apr 2021 16:57:19 +0000 (09:57 -0700)]
spi: altera: separate core code from platform code

In preparation of adding support for a new bus type,
separate the core spi-altera code from the platform
driver code.

Signed-off-by: Matthew Gerlach <matthew.gerlach@linux.intel.com>
Link: https://lore.kernel.org/r/20210416165720.554144-2-matthew.gerlach@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agospi: stm32-qspi: Fix compilation warning in ARM64
Patrice Chotard [Tue, 20 Apr 2021 08:21:03 +0000 (10:21 +0200)]
spi: stm32-qspi: Fix compilation warning in ARM64

This fixes warnings detected when compiling in ARM64.
Introduced by 'commit 18674dee3cd6 ("spi: stm32-qspi: Add dirmap support")'

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>
Link: https://lore.kernel.org/r/20210420082103.1693-1-patrice.chotard@foss.st.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoMerge series "spi: stm32-qspi: Fix and update" from <patrice.chotard@foss.st.com>
Mark Brown [Mon, 19 Apr 2021 15:21:50 +0000 (16:21 +0100)]
Merge series "spi: stm32-qspi: Fix and update" from <patrice.chotard@foss.st.com>
Patrice Chotard <patrice.chotard@foss.st.com>:

From: Patrice Chotard <patrice.chotard@foss.st.com>

Christophe Kerello (1):
  spi: stm32-qspi: fix pm_runtime usage_count counter

Patrice Chotard (2):
  spi: stm32-qspi: Trigger DMA only if more than 4 bytes to transfer
  spi: stm32-qspi: Add dirmap support

 drivers/spi/spi-stm32-qspi.c | 106 +++++++++++++++++++++++++++--------
 1 file changed, 84 insertions(+), 22 deletions(-)

--
2.17.1

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

3 years agospi: Handle SPI device setup callback failure.
Joe Burmeister [Mon, 19 Apr 2021 13:06:31 +0000 (14:06 +0100)]
spi: Handle SPI device setup callback failure.

If the setup callback failed, but the controller has auto_runtime_pm
and set_cs, the setup failure could be missed.

Signed-off-by: Joe Burmeister <joe.burmeister@devtank.co.uk>
Link: https://lore.kernel.org/r/20210419130631.4586-1-joe.burmeister@devtank.co.uk
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agospi: sync up initial chipselect state
David Bauer [Fri, 16 Apr 2021 19:59:56 +0000 (21:59 +0200)]
spi: sync up initial chipselect state

When initially probing the SPI slave device, the call for disabling an
SPI device without the SPI_CS_HIGH flag is not applied, as the
condition for checking whether or not the state to be applied equals the
one currently set evaluates to true.

This however might not necessarily be the case, as the chipselect might
be active.

Add a force flag to spi_set_cs which allows to override this
early exit condition. Set it to false everywhere except when called
from spi_setup to sync up the initial CS state.

Fixes commit d40f0b6f2e21 ("spi: Avoid setting the chip select if we don't
need to")

Signed-off-by: David Bauer <mail@david-bauer.net>
Link: https://lore.kernel.org/r/20210416195956.121811-1-mail@david-bauer.net
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agospi: stm32-qspi: Add dirmap support
Patrice Chotard [Mon, 19 Apr 2021 12:15:41 +0000 (14:15 +0200)]
spi: stm32-qspi: Add dirmap support

Add stm32_qspi_dirmap_read() and stm32_qspi_dirmap_create()
to get dirmap support.

Update the exec_op callback which doens't allow anymore memory map
access. Memory map access are only available through the dirmap_read
callback.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>
Link: https://lore.kernel.org/r/20210419121541.11617-4-patrice.chotard@foss.st.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agospi: stm32-qspi: Trigger DMA only if more than 4 bytes to transfer
Patrice Chotard [Mon, 19 Apr 2021 12:15:40 +0000 (14:15 +0200)]
spi: stm32-qspi: Trigger DMA only if more than 4 bytes to transfer

In order to optimize accesses to spi flashes, trigger a DMA only
if more than 4 bytes has to be transferred.

DMA transfer preparation's cost becomes negligible above 4 bytes to
transfer. Below this threshold, indirect transfer give more throughput.

mtd_speedtest shows that page write throughtput increases :
  - from 779 to 853 KiB/s (~9.5%) with s25fl512s SPI-NOR.
  - from 5283 to 5666 KiB/s (~7.25%) with Micron SPI-NAND.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>
Link: https://lore.kernel.org/r/20210419121541.11617-3-patrice.chotard@foss.st.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agospi: stm32-qspi: fix pm_runtime usage_count counter
Christophe Kerello [Mon, 19 Apr 2021 12:15:39 +0000 (14:15 +0200)]
spi: stm32-qspi: fix pm_runtime usage_count counter

pm_runtime usage_count counter is not well managed.
pm_runtime_put_autosuspend callback drops the usage_counter but this
one has never been increased. Add pm_runtime_get_sync callback to bump up
the usage counter. It is also needed to use pm_runtime_force_suspend and
pm_runtime_force_resume APIs to handle properly the clock.

Fixes: 9d282c17b023 ("spi: stm32-qspi: Add pm_runtime support")
Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/r/20210419121541.11617-2-patrice.chotard@foss.st.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agospi: spi-zynqmp-gqspi: return -ENOMEM if dma_map_single fails
Quanyang Wang [Fri, 16 Apr 2021 00:46:52 +0000 (08:46 +0800)]
spi: spi-zynqmp-gqspi: return -ENOMEM if dma_map_single fails

The spi controller supports 44-bit address space on AXI in DMA mode,
so set dma_addr_t width to 44-bit to avoid using a swiotlb mapping.
In addition, if dma_map_single fails, it should return immediately
instead of continuing doing the DMA operation which bases on invalid
address.

This fixes the following crash which occurs in reading a big block
from flash:

[  123.633577] zynqmp-qspi ff0f0000.spi: swiotlb buffer is full (sz: 4194304 bytes), total 32768 (slots), used 0 (slots)
[  123.644230] zynqmp-qspi ff0f0000.spi: ERR:rxdma:memory not mapped
[  123.784625] Unable to handle kernel paging request at virtual address 00000000003fffc0
[  123.792536] Mem abort info:
[  123.795313]   ESR = 0x96000145
[  123.798351]   EC = 0x25: DABT (current EL), IL = 32 bits
[  123.803655]   SET = 0, FnV = 0
[  123.806693]   EA = 0, S1PTW = 0
[  123.809818] Data abort info:
[  123.812683]   ISV = 0, ISS = 0x00000145
[  123.816503]   CM = 1, WnR = 1
[  123.819455] user pgtable: 4k pages, 48-bit VAs, pgdp=0000000805047000
[  123.825887] [00000000003fffc0] pgd=0000000803b45003, p4d=0000000803b45003, pud=0000000000000000
[  123.834586] Internal error: Oops: 96000145 [#1] PREEMPT SMP

Fixes: 1c26372e5aa9 ("spi: spi-zynqmp-gqspi: Update driver to use spi-mem framework")
Signed-off-by: Quanyang Wang <quanyang.wang@windriver.com>
Link: https://lore.kernel.org/r/20210416004652.2975446-6-quanyang.wang@windriver.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agospi: spi-zynqmp-gqspi: fix use-after-free in zynqmp_qspi_exec_op
Quanyang Wang [Fri, 16 Apr 2021 00:46:51 +0000 (08:46 +0800)]
spi: spi-zynqmp-gqspi: fix use-after-free in zynqmp_qspi_exec_op

When handling op->addr, it is using the buffer "tmpbuf" which has been
freed. This will trigger a use-after-free KASAN warning. Let's use
temporary variables to store op->addr.val and op->cmd.opcode to fix
this issue.

Fixes: 1c26372e5aa9 ("spi: spi-zynqmp-gqspi: Update driver to use spi-mem framework")
Signed-off-by: Quanyang Wang <quanyang.wang@windriver.com>
Link: https://lore.kernel.org/r/20210416004652.2975446-5-quanyang.wang@windriver.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agospi: spi-zynqmp-gqspi: Resolved slab-out-of-bounds bug
Amit Kumar Mahapatra [Fri, 16 Apr 2021 00:46:50 +0000 (08:46 +0800)]
spi: spi-zynqmp-gqspi: Resolved slab-out-of-bounds bug

During a transfer the driver filled the fifo with 4bytes,
even if the data that needs to be transfer is less that 4bytes.
This resulted in slab-out-of-bounds bug in KernelAddressSanitizer.

This patch resolves slab-out-of-bounds bug by filling the fifo
with the number of bytes that needs to transferred.

Signed-off-by: Amit Kumar Mahapatra <amit.kumar-mahapatra@xilinx.com>
Link: https://lore.kernel.org/r/20210416004652.2975446-4-quanyang.wang@windriver.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agospi: spi-zynqmp-gqspi: fix hang issue when suspend/resume
Quanyang Wang [Fri, 16 Apr 2021 00:46:49 +0000 (08:46 +0800)]
spi: spi-zynqmp-gqspi: fix hang issue when suspend/resume

After calling platform_set_drvdata(pdev, xqspi) in probe, the return
value of dev_get_drvdata(dev) is a pointer to struct zynqmp_qspi but
not struct spi_controller. A wrong structure type passing to the
functions spi_controller_suspend/resume will hang the system.

And we should check the return value of spi_controller_suspend, if
an error is returned, return it to PM subsystem to stop suspend.

Also, GQSPI_EN_MASK should be written to GQSPI_EN_OFST to enable
the spi controller in zynqmp_qspi_resume since it was disabled in
zynqmp_qspi_suspend before.

Fixes: 1c26372e5aa9 ("spi: spi-zynqmp-gqspi: Update driver to use spi-mem framework")
Signed-off-by: Quanyang Wang <quanyang.wang@windriver.com>
Link: https://lore.kernel.org/r/20210416004652.2975446-3-quanyang.wang@windriver.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agospi: spi-zynqmp-gqspi: fix clk_enable/disable imbalance issue
Quanyang Wang [Fri, 16 Apr 2021 00:46:48 +0000 (08:46 +0800)]
spi: spi-zynqmp-gqspi: fix clk_enable/disable imbalance issue

The clks "pclk" and "ref_clk" are enabled twice during the probe. The
first time is in the function zynqmp_qspi_probe and the second time is
in zynqmp_qspi_setup_op which is called by devm_spi_register_controller.
Then calling zynqmp_qspi_remove (rmmod this module) to disable these clks
will trigger a warning as below:

[  309.124604] Unpreparing enabled qspi_ref
[  309.128641] WARNING: CPU: 1 PID: 537 at drivers/clk/clk.c:824 clk_core_unprepare+0x108/0x110

Since pm_runtime works now, clks can be enabled/disabled by calling
zynqmp_runtime_suspend/resume. So we don't need to enable these clks
explicitly in zynqmp_qspi_setup_op. Remove them to fix this issue.

And remove clk enabling/disabling in zynqmp_qspi_resume because there is
no spi transfer operation so enabling ref_clk is redundant meanwhile pclk
is not disabled for it is shared with other peripherals.

Furthermore replace clk_enable/disable with clk_prepare_enable and
clk_disable_unprepare in runtime_suspend/resume functions.

Fixes: 1c26372e5aa9 ("spi: spi-zynqmp-gqspi: Update driver to use spi-mem framework")
Signed-off-by: Quanyang Wang <quanyang.wang@windriver.com>
Link: https://lore.kernel.org/r/20210416004652.2975446-2-quanyang.wang@windriver.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoMerge branch 'for-5.12' of https://git.kernel.org/pub/scm/linux/kernel/git/broonie...
Mark Brown [Thu, 15 Apr 2021 18:29:40 +0000 (19:29 +0100)]
Merge branch 'for-5.12' of https://git./linux/kernel/git/broonie/spi into spi-5.13

3 years agospi: spi-zynqmp-gqspi: Fix runtime PM imbalance in zynqmp_qspi_probe
Dinghao Liu [Thu, 15 Apr 2021 07:46:44 +0000 (15:46 +0800)]
spi: spi-zynqmp-gqspi: Fix runtime PM imbalance in zynqmp_qspi_probe

There is a PM usage counter decrement after zynqmp_qspi_init_hw()
without any refcount increment, which leads to refcount leak.Add
a refcount increment to balance the refcount. Also set
auto_runtime_pm to resume suspended spi controller.

Fixes: 9e3a000362aec ("spi: zynqmp: Add pm runtime support")
Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn>
Tested-by: Quanyang Wang <quanyang.wang@windriver.com>
Link: https://lore.kernel.org/r/20210415074644.24646-1-dinghao.liu@zju.edu.cn
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agospi: s3c64xx: constify driver/match data
Krzysztof Kozlowski [Wed, 14 Apr 2021 20:33:43 +0000 (22:33 +0200)]
spi: s3c64xx: constify driver/match data

The match data (struct s3c64xx_spi_port_config) stored in of_device_id
and platform_device_id tables is not modified by the driver and can be
handled entirely in a const-way to increase the code safety.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
Reviewed-by: Sylwester Nawrocki <snawrocki@kernel.org>
Link: https://lore.kernel.org/r/20210414203343.203119-3-krzysztof.kozlowski@canonical.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agospi: s3c64xx: correct kerneldoc of s3c64xx_spi_port_config
Krzysztof Kozlowski [Wed, 14 Apr 2021 20:33:42 +0000 (22:33 +0200)]
spi: s3c64xx: correct kerneldoc of s3c64xx_spi_port_config

Correct the name of s3c64xx_spi_port_config structure in kerneldoc:

  drivers/spi/spi-s3c64xx.c:154: warning:
    expecting prototype for struct s3c64xx_spi_info. Prototype was for struct s3c64xx_spi_port_config instead

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
Reviewed-by: Sylwester Nawrocki <snawrocki@kernel.org>
Link: https://lore.kernel.org/r/20210414203343.203119-2-krzysztof.kozlowski@canonical.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agospi: s3c64xx: simplify getting of_device_id match data
Krzysztof Kozlowski [Wed, 14 Apr 2021 20:33:41 +0000 (22:33 +0200)]
spi: s3c64xx: simplify getting of_device_id match data

Use of_device_get_match_data() to make the code slightly smaller and to
remove the of_device_id table forward declaration.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
Reviewed-by: Sylwester Nawrocki <snawrocki@kernel.org>
Link: https://lore.kernel.org/r/20210414203343.203119-1-krzysztof.kozlowski@canonical.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agospi: pxa2xx: Add support for Intel Alder Lake PCH-M
Jarkko Nikula [Thu, 15 Apr 2021 13:59:17 +0000 (16:59 +0300)]
spi: pxa2xx: Add support for Intel Alder Lake PCH-M

Add support for LPSS SPI on Intel Alder Lake PCH-M.

Signed-off-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
Link: https://lore.kernel.org/r/20210415135917.54144-1-jarkko.nikula@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoMerge series "Minor updates for hisi-sfc-v3xx" from Yicong Yang <yangyicong@hisilicon...
Mark Brown [Mon, 12 Apr 2021 18:56:27 +0000 (19:56 +0100)]
Merge series "Minor updates for hisi-sfc-v3xx" from Yicong Yang <yangyicong@hisilicon.com>:

This series fix a potential interrupt race condition and
cleanup the ACPI protection for the driver.

Change since v1:
- reword the commit in patch #2
Link: https://lore.kernel.org/linux-spi/1617881505-51552-1-git-send-email-yangyicong@hisilicon.com/
Yicong Yang (2):
  spi: hisi-sfc-v3xx: fix potential irq race condition
  spi: hisi-sfc-v3xx: drop unnecessary ACPI_PTR and related ifendif
    protection

 drivers/spi/spi-hisi-sfc-v3xx.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

--
2.8.1

3 years agospi: spi-zynqmp-gqspi: Fix missing unlock on error in zynqmp_qspi_exec_op()
Wei Yongjun [Mon, 12 Apr 2021 16:00:25 +0000 (16:00 +0000)]
spi: spi-zynqmp-gqspi: Fix missing unlock on error in zynqmp_qspi_exec_op()

Add the missing unlock before return from function zynqmp_qspi_exec_op()
in the error handling case.

Fixes: a0f65be6e880 ("spi: spi-zynqmp-gqspi: add mutex locking for exec_op")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Link: https://lore.kernel.org/r/20210412160025.194171-1-weiyongjun1@huawei.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agospi: hisi-sfc-v3xx: drop unnecessary ACPI_PTR and related ifendif protection
Yicong Yang [Mon, 12 Apr 2021 11:58:28 +0000 (19:58 +0800)]
spi: hisi-sfc-v3xx: drop unnecessary ACPI_PTR and related ifendif protection

We use ACPI_PTR() and related ifendif protection for the id table.
This is unnecessary as the struct acpi_device_id is defined in
mod_devicetable.h and doesn't rely on ACPI. The driver doesn't
use any ACPI apis, so it can be compiled in the ACPI=n case
with no warnings.

So remove the ACPI_PTR and related ifendif protection, also
replace the header acpi.h with mod_devicetable.h.

Acked-by: John Garry <john.garry@huawei.com>
Signed-off-by: Yicong Yang <yangyicong@hisilicon.com>
Link: https://lore.kernel.org/r/1618228708-37949-3-git-send-email-yangyicong@hisilicon.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agospi: hisi-sfc-v3xx: fix potential irq race condition
Yicong Yang [Mon, 12 Apr 2021 11:58:27 +0000 (19:58 +0800)]
spi: hisi-sfc-v3xx: fix potential irq race condition

We mask the irq when the command completion is timeout. This won't
stop the already running irq handler. Use sychronize_irq() after
we mask the irq, to make sure there is no running handler.

Acked-by: John Garry <john.garry@huawei.com>
Signed-off-by: Yicong Yang <yangyicong@hisilicon.com>
Link: https://lore.kernel.org/r/1618228708-37949-2-git-send-email-yangyicong@hisilicon.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoMerge series "spi: spi-zynqmp-gpspi: fix some issues" from quanyang.wang@windriver.com
Mark Brown [Fri, 9 Apr 2021 15:28:09 +0000 (16:28 +0100)]
Merge series "spi: spi-zynqmp-gpspi: fix some issues" from quanyang.wang@windriver.com
Quanyang Wang <quanyang.wang@windriver.com>:

From: Quanyang Wang <quanyang.wang@windriver.com>

Hello,

This series fix some issues that occurs when the gqspi driver switches to spi-mem framework.

Hi Amit,
I rewrite the "Subject" and "commit message" of these patches, so they
look different from the ones which you reviewed before. I still keep
your "Reviewed-by" and hope you will not mind.

Regards,
Quanyang Wang

Quanyang Wang (4):
  spi: spi-zynqmp-gqspi: use wait_for_completion_timeout to make
    zynqmp_qspi_exec_op not interruptible
  spi: spi-zynqmp-gqspi: add mutex locking for exec_op
  spi: spi-zynqmp-gqspi: transmit dummy circles by using the
    controller's internal functionality
  spi: spi-zynqmp-gqspi: fix incorrect operating mode in
    zynqmp_qspi_read_op

 drivers/spi/spi-zynqmp-gqspi.c | 53 +++++++++++++++++-----------------
 1 file changed, 27 insertions(+), 26 deletions(-)

--
2.25.1

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

3 years agospi: davinci: Use device_get_match_data() helper
Tian Tao [Wed, 31 Mar 2021 00:58:39 +0000 (08:58 +0800)]
spi: davinci: Use device_get_match_data() helper

Use the device_get_match_data() helper instead of open coding.

Signed-off-by: Tian Tao <tiantao6@hisilicon.com>
Suggested-by: Fabio Estevam <festevam@gmail.com>
Link: https://lore.kernel.org/r/1617152319-17701-1-git-send-email-tiantao6@hisilicon.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agospi: qup: fix PM reference leak in spi_qup_remove()
Wang Li [Fri, 9 Apr 2021 09:54:58 +0000 (09:54 +0000)]
spi: qup: fix PM reference leak in spi_qup_remove()

pm_runtime_get_sync will increment pm usage counter even it failed.
Forgetting to putting operation will result in reference leak here.
Fix it by replacing it with pm_runtime_resume_and_get to keep usage
counter balanced.

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Wang Li <wangli74@huawei.com>
Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Link: https://lore.kernel.org/r/20210409095458.29921-1-wangli74@huawei.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agospi: orion: set devdata properly as it is being used later
Muhammad Usama Anjum [Thu, 8 Apr 2021 19:57:18 +0000 (00:57 +0500)]
spi: orion: set devdata properly as it is being used later

If device_get_match_data returns NULL, devdata isn't being updated
properly. It is being used later in the function. Both devdata and
spi->devdata should be updated to avoid NULL pointer dereference.

Addresses-Coverity: ("NULL pointer dereference")
Fixes: 0e6521f13c2 ("spi: orion: Use device_get_match_data() helper")
Signed-off-by: Muhammad Usama Anjum <musamaanjum@gmail.com>
Link: https://lore.kernel.org/r/20210408195718.GA3075166@LEGION
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agospi: imx: add a check for speed_hz before calculating the clock
Clark Wang [Thu, 8 Apr 2021 10:33:47 +0000 (18:33 +0800)]
spi: imx: add a check for speed_hz before calculating the clock

When some drivers use spi to send data, spi_transfer->speed_hz is
not assigned. If spidev->max_speed_hz is not assigned as well, it
will cause an error in configuring the clock.
Add a check for these two values before configuring the clock. An
error will be returned when they are not assigned.

Signed-off-by: Clark Wang <xiaoning.wang@nxp.com>
Link: https://lore.kernel.org/r/20210408103347.244313-2-xiaoning.wang@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agospi: omap-100k: Fix reference leak to master
Wei Yongjun [Fri, 9 Apr 2021 08:29:54 +0000 (08:29 +0000)]
spi: omap-100k: Fix reference leak to master

Call spi_master_get() holds the reference count to master device, thus
we need an additional spi_master_put() call to reduce the reference
count, otherwise we will leak a reference to master.

This commit fix it by removing the unnecessary spi_master_get().

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Link: https://lore.kernel.org/r/20210409082954.2906933-1-weiyongjun1@huawei.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agospi: fsl-lpspi: Fix PM reference leak in lpspi_prepare_xfer_hardware()
Wang Li [Fri, 9 Apr 2021 09:54:30 +0000 (09:54 +0000)]
spi: fsl-lpspi: Fix PM reference leak in lpspi_prepare_xfer_hardware()

pm_runtime_get_sync will increment pm usage counter even it failed.
Forgetting to putting operation will result in reference leak here.
Fix it by replacing it with pm_runtime_resume_and_get to keep usage
counter balanced.

Fixes: 944c01a889d9 ("spi: lpspi: enable runtime pm for lpspi")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Wang Li <wangli74@huawei.com>
Link: https://lore.kernel.org/r/20210409095430.29868-1-wangli74@huawei.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agospi: simplify devm_spi_register_controller
Tian Tao [Thu, 8 Apr 2021 00:55:07 +0000 (08:55 +0800)]
spi: simplify devm_spi_register_controller

Use devm_add_action_or_reset() instead of devres_alloc() and
devres_add(), which works the same. This will simplify the
code. There is no functional changes.

Signed-off-by: Tian Tao <tiantao6@hisilicon.com>
Signed-off-by: Yicong Yang <yangyicong@hisilicon.com>
Link: https://lore.kernel.org/r/1617843307-53853-1-git-send-email-tiantao6@hisilicon.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agospi: dln2: Fix reference leak to master
Wei Yongjun [Fri, 9 Apr 2021 08:29:55 +0000 (08:29 +0000)]
spi: dln2: Fix reference leak to master

Call spi_master_get() holds the reference count to master device, thus
we need an additional spi_master_put() call to reduce the reference
count, otherwise we will leak a reference to master.

This commit fix it by removing the unnecessary spi_master_get().

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Link: https://lore.kernel.org/r/20210409082955.2907950-1-weiyongjun1@huawei.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agospi: spi-zynqmp-gqspi: fix incorrect operating mode in zynqmp_qspi_read_op
Quanyang Wang [Thu, 8 Apr 2021 04:02:23 +0000 (12:02 +0800)]
spi: spi-zynqmp-gqspi: fix incorrect operating mode in zynqmp_qspi_read_op

When starting a read operation, we should call zynqmp_qspi_setuprxdma
first to set xqspi->mode according to xqspi->bytes_to_receive and
to calculate correct xqspi->dma_rx_bytes. Then in the function
zynqmp_qspi_fillgenfifo, generate the appropriate command with
operating mode and bytes to transfer, and fill the GENFIFO with
the command to perform the read operation.

Calling zynqmp_qspi_fillgenfifo before zynqmp_qspi_setuprxdma will
result in incorrect transfer length and operating mode. So change
the calling order to fix this issue.

Fixes: 1c26372e5aa9 ("spi: spi-zynqmp-gqspi: Update driver to use spi-mem framework")
Signed-off-by: Quanyang Wang <quanyang.wang@windriver.com>
Reviewed-by: Amit Kumar Mahapatra <amit.kumar-mahapatra@xilinx.com>
Link: https://lore.kernel.org/r/20210408040223.23134-5-quanyang.wang@windriver.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agospi: spi-zynqmp-gqspi: transmit dummy circles by using the controller's internal...
Quanyang Wang [Thu, 8 Apr 2021 04:02:22 +0000 (12:02 +0800)]
spi: spi-zynqmp-gqspi: transmit dummy circles by using the controller's internal functionality

There is a data corruption issue that occurs in the reading operation
(cmd:0x6c) when transmitting common data as dummy circles.

The gqspi controller has the functionality to send dummy clock circles.
When writing data with the fields [receive, transmit, data_xfer] = [0,0,1]
to the Generic FIFO, and configuring the correct SPI mode, the controller
will transmit dummy circles.

So let's switch to hardware dummy cycles transfer to fix this issue.

Fixes: 1c26372e5aa9 ("spi: spi-zynqmp-gqspi: Update driver to use spi-mem framework")
Signed-off-by: Quanyang Wang <quanyang.wang@windriver.com>
Reviewed-by: Amit Kumar Mahapatra <amit.kumar-mahapatra@xilinx.com>
Link: https://lore.kernel.org/r/20210408040223.23134-4-quanyang.wang@windriver.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agospi: spi-zynqmp-gqspi: add mutex locking for exec_op
Quanyang Wang [Thu, 8 Apr 2021 04:02:21 +0000 (12:02 +0800)]
spi: spi-zynqmp-gqspi: add mutex locking for exec_op

The spi-mem framework has no locking to prevent ctlr->mem_ops->exec_op
from concurrency. So add the locking to zynqmp_qspi_exec_op.

Fixes: 1c26372e5aa9 ("spi: spi-zynqmp-gqspi: Update driver to use spi-mem framework")
Signed-off-by: Quanyang Wang <quanyang.wang@windriver.com>
Reviewed-by: Amit Kumar Mahapatra <amit.kumar-mahapatra@xilinx.com>
Link: https://lore.kernel.org/r/20210408040223.23134-3-quanyang.wang@windriver.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agospi: spi-zynqmp-gqspi: use wait_for_completion_timeout to make zynqmp_qspi_exec_op...
Quanyang Wang [Thu, 8 Apr 2021 04:02:20 +0000 (12:02 +0800)]
spi: spi-zynqmp-gqspi: use wait_for_completion_timeout to make zynqmp_qspi_exec_op not interruptible

When Ctrl+C occurs during the process of zynqmp_qspi_exec_op, the function
wait_for_completion_interruptible_timeout will return a non-zero value
-ERESTARTSYS immediately. This will disrupt the SPI memory operation
because the data transmitting may begin before the command or address
transmitting completes. Use wait_for_completion_timeout to prevent
the process from being interruptible.

This patch fixes the error as below:
root@xilinx-zynqmp:~# flash_erase /dev/mtd3 0 0
Erasing 4 Kibyte @ 3d000 --  4 % complete
    (Press Ctrl+C)
[  169.581911] zynqmp-qspi ff0f0000.spi: Chip select timed out
[  170.585907] zynqmp-qspi ff0f0000.spi: Chip select timed out
[  171.589910] zynqmp-qspi ff0f0000.spi: Chip select timed out
[  172.593910] zynqmp-qspi ff0f0000.spi: Chip select timed out
[  173.597907] zynqmp-qspi ff0f0000.spi: Chip select timed out
[  173.603480] spi-nor spi0.0: Erase operation failed.
[  173.608368] spi-nor spi0.0: Attempted to modify a protected sector.

Fixes: 1c26372e5aa9 ("spi: spi-zynqmp-gqspi: Update driver to use spi-mem framework")
Signed-off-by: Quanyang Wang <quanyang.wang@windriver.com>
Reviewed-by: Amit Kumar Mahapatra <amit.kumar-mahapatra@xilinx.com>
Link: https://lore.kernel.org/r/20210408040223.23134-2-quanyang.wang@windriver.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agospi: fsl: add missing iounmap() on error in of_fsl_spi_probe()
Yang Yingliang [Thu, 1 Apr 2021 14:03:50 +0000 (22:03 +0800)]
spi: fsl: add missing iounmap() on error in of_fsl_spi_probe()

Add the missing iounmap() before return from of_fsl_spi_probe()
in the error handling case.

Fixes: 0f0581b24bd0 ("spi: fsl: Convert to use CS GPIO descriptors")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Link: https://lore.kernel.org/r/20210401140350.1677925-1-yangyingliang@huawei.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoARM/spi: spear: Drop PL022 num_chipselect
Linus Walleij [Thu, 8 Apr 2021 07:50:45 +0000 (09:50 +0200)]
ARM/spi: spear: Drop PL022 num_chipselect

A previous refactoring moved the chip select number handling
to the SPI core and we missed a leftover platform data user
in the ST spear platform. The spear is not using this
chipselect or PL022 for anything and should be using device
tree like the rest of the platform so just delete the
offending platform data.

Cc: Viresh Kumar <vireshk@kernel.org>
Cc: Shiraz Hashim <shiraz.linux.kernel@gmail.com>
Cc: linux-arm-kernel@lists.infradead.org
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Link: https://lore.kernel.org/r/20210408075045.3435046-1-linus.walleij@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agospi: Fix use-after-free with devm_spi_alloc_*
William A. Kennington III [Wed, 7 Apr 2021 09:55:27 +0000 (02:55 -0700)]
spi: Fix use-after-free with devm_spi_alloc_*

We can't rely on the contents of the devres list during
spi_unregister_controller(), as the list is already torn down at the
time we perform devres_find() for devm_spi_release_controller. This
causes devices registered with devm_spi_alloc_{master,slave}() to be
mistakenly identified as legacy, non-devm managed devices and have their
reference counters decremented below 0.

------------[ cut here ]------------
WARNING: CPU: 1 PID: 660 at lib/refcount.c:28 refcount_warn_saturate+0x108/0x174
[<b0396f04>] (refcount_warn_saturate) from [<b03c56a4>] (kobject_put+0x90/0x98)
[<b03c5614>] (kobject_put) from [<b0447b4c>] (put_device+0x20/0x24)
 r4:b6700140
[<b0447b2c>] (put_device) from [<b07515e8>] (devm_spi_release_controller+0x3c/0x40)
[<b07515ac>] (devm_spi_release_controller) from [<b045343c>] (release_nodes+0x84/0xc4)
 r5:b6700180 r4:b6700100
[<b04533b8>] (release_nodes) from [<b0454160>] (devres_release_all+0x5c/0x60)
 r8:b1638c54 r7:b117ad94 r6:b1638c10 r5:b117ad94 r4:b163dc10
[<b0454104>] (devres_release_all) from [<b044e41c>] (__device_release_driver+0x144/0x1ec)
 r5:b117ad94 r4:b163dc10
[<b044e2d8>] (__device_release_driver) from [<b044f70c>] (device_driver_detach+0x84/0xa0)
 r9:00000000 r8:00000000 r7:b117ad94 r6:b163dc54 r5:b1638c10 r4:b163dc10
[<b044f688>] (device_driver_detach) from [<b044d274>] (unbind_store+0xe4/0xf8)

Instead, determine the devm allocation state as a flag on the
controller which is guaranteed to be stable during cleanup.

Fixes: 5e844cc37a5c ("spi: Introduce device-managed SPI controller allocation")
Signed-off-by: William A. Kennington III <wak@google.com>
Link: https://lore.kernel.org/r/20210407095527.2771582-1-wak@google.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agospi: spi-zynqmp-gqspi: Fix runtime PM imbalance in zynqmp_qspi_probe
Dinghao Liu [Thu, 8 Apr 2021 09:25:59 +0000 (17:25 +0800)]
spi: spi-zynqmp-gqspi: Fix runtime PM imbalance in zynqmp_qspi_probe

When platform_get_irq() fails, a pairing PM usage counter
increment is needed to keep the counter balanced. It's the
same for the following error paths.

Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn>
Link: https://lore.kernel.org/r/20210408092559.3824-1-dinghao.liu@zju.edu.cn
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agospi: orion: Use device_get_match_data() helper
Tian Tao [Thu, 1 Apr 2021 06:24:48 +0000 (14:24 +0800)]
spi: orion: Use device_get_match_data() helper

Use the device_get_match_data() helper instead of open coding.

Signed-off-by: Tian Tao <tiantao6@hisilicon.com>
Link: https://lore.kernel.org/r/1617258288-1490-1-git-send-email-tiantao6@hisilicon.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agospi: hisi-kunpeng: Fix Woverflow warning on conversion
Jay Fang [Wed, 7 Apr 2021 02:31:00 +0000 (10:31 +0800)]
spi: hisi-kunpeng: Fix Woverflow warning on conversion

Fix warning Woverflow on type conversion reported on x86_64:

  drivers/spi/spi-hisi-kunpeng.c:361:9: warning: conversion from 'long unsigned int' to 'u32'
  {aka 'unsigned int'} changes value from '18446744073709551600' to '4294967280' [-Woverflow]

The registers are 32 bit, so fix by casting to u32.

Fixes: c770d8631e18 ("spi: Add HiSilicon SPI Controller Driver for Kunpeng SoCs")
Cc: Stephen Rothwell <sfr@canb.auug.org.au>
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Jay Fang <f.fangjian@huawei.com>
Link: https://lore.kernel.org/r/1617762660-54681-1-git-send-email-f.fangjian@huawei.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agospi: Remove repeated struct declaration
Wan Jiabing [Thu, 1 Apr 2021 06:59:04 +0000 (14:59 +0800)]
spi: Remove repeated struct declaration

struct spi_transfer is declared twice. One is declared at 24th line.
The blew one is not needed though. Remove the duplicate.

Signed-off-by: Wan Jiabing <wanjiabing@vivo.com>
Link: https://lore.kernel.org/r/20210401065904.994121-1-wanjiabing@vivo.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoMerge series "Convert Cadence QSPI bindings to yaml" from Pratyush Yadav <p.yadav...
Mark Brown [Thu, 1 Apr 2021 09:25:17 +0000 (10:25 +0100)]
Merge series "Convert Cadence QSPI bindings to yaml" from Pratyush Yadav <p.yadav@ti.com>:

Hi,

This series picks up Ramuthevar's effort on converting the Cadence QSPI
bindings to yaml [0]. During the conversion process, I discovered that
some TI device tree files were not using the compatible correctly. Those
are fixed in patches 1-3.

[0] https://patchwork.kernel.org/project/spi-devel-general/patch/20201116031003.19062-6-vadivel.muruganx.ramuthevar@linux.intel.com/

Pratyush Yadav (3):
  arm64: dts: ti: k3-j721e-mcu: Fix ospi compatible
  arm64: dts: ti: k3-j7200-mcu: Fix ospi compatible
  arm64: dts: ti: k3-am64-main: Fix ospi compatible

Ramuthevar Vadivel Murugan (1):
  dt-bindings: spi: Convert cadence-quadspi.txt to cadence-quadspi.yaml

 .../bindings/spi/cadence-quadspi.txt          |  68 ---------
 .../bindings/spi/cdns,qspi-nor.yaml           | 143 ++++++++++++++++++
 arch/arm64/boot/dts/ti/k3-am64-main.dtsi      |   2 +-
 .../boot/dts/ti/k3-j7200-mcu-wakeup.dtsi      |   2 +-
 .../boot/dts/ti/k3-j721e-mcu-wakeup.dtsi      |   4 +-
 5 files changed, 147 insertions(+), 72 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/spi/cadence-quadspi.txt
 create mode 100644 Documentation/devicetree/bindings/spi/cdns,qspi-nor.yaml

--
2.30.0

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

3 years agospi: Convert cadence-quadspi.txt to cadence-quadspi.yaml
Ramuthevar Vadivel Murugan [Fri, 26 Mar 2021 13:00:34 +0000 (18:30 +0530)]
spi: Convert cadence-quadspi.txt to cadence-quadspi.yaml

There is no way as of now to have a parent or bus defining properties
for child nodes. For now, avoid it in the example to silence warnings on
dt_schema_check. We can figure out how to deal with actual dts files
later.

[p.yadav@ti.com: Fix how compatible is defined, make reset optional, fix
minor typos, remove subnode properties in example, update commit
message.]

Signed-off-by: Ramuthevar Vadivel Murugan <vadivel.muruganx.ramuthevar@linux.intel.com>
Signed-off-by: Pratyush Yadav <p.yadav@ti.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Link: https://lore.kernel.org/r/20210326130034.15231-5-p.yadav@ti.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agospi: Add HiSilicon SPI Controller Driver for Kunpeng SoCs
Jay Fang [Sat, 27 Mar 2021 09:10:00 +0000 (17:10 +0800)]
spi: Add HiSilicon SPI Controller Driver for Kunpeng SoCs

This driver supports SPI Controller for HiSilicon Kunpeng SoCs. This
driver supports SPI operations using FIFO mode of transfer.

DMA is not supported, and we just use IRQ mode for operation completion
notification.

Only ACPI firmware is supported.

Signed-off-by: Jay Fang <f.fangjian@huawei.com>
Link: https://lore.kernel.org/r/1616836200-45827-1-git-send-email-f.fangjian@huawei.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agospi: pl022: Convert to use GPIO descriptors
Linus Walleij [Tue, 30 Mar 2021 16:49:07 +0000 (18:49 +0200)]
spi: pl022: Convert to use GPIO descriptors

This converts the PL022 driver to use GPIO descriptors
instead of the old global GPIO numberspace. Since the
driver handles messages on its own it needs to manage
the GPIO descriptor directly.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20210330164907.2346010-3-linus.walleij@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agospi: pl022: Use GPIOs looked up by the core
Linus Walleij [Tue, 30 Mar 2021 16:49:06 +0000 (18:49 +0200)]
spi: pl022: Use GPIOs looked up by the core

The SPI core looks up GPIO lines from the device tree,
so let's stop trying to do that on our own and rely
on the core to do this for us.

In addition to the GPIO line we also need to keep
track of the chip select index separately, as the native
chip select needs this index. The driver was reusing
the same GPIO array for native chip select indices,
so keep this in a separate state variable instead.

The facility to pass in custom GPIO lines from the
platform data can go, because even if we do have
out-of-tree code that want to use platform data, they
can soon pass in GPIOs using machine GPIO descriptor
tables which will be available after the next step
when we convert the driver to using GPIO descriptors.

The implicit inclusion of <linux/of.h> is made
explicit as we no longer need to include <linux/of_gpio.h>.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20210330164907.2346010-2-linus.walleij@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agospi: pl022: Drop custom per-chip cs_control
Linus Walleij [Tue, 30 Mar 2021 16:49:05 +0000 (18:49 +0200)]
spi: pl022: Drop custom per-chip cs_control

Drop the custom cs_control() assigned through platform data,
we have no in-tree users and the only out-of-tree use I have
ever seen of this facility is to pull GPIO lines, which is
something the driver can already do for us.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20210330164907.2346010-1-linus.walleij@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agospi: pl022: User more sensible defaults
Linus Walleij [Sun, 28 Mar 2021 12:15:30 +0000 (14:15 +0200)]
spi: pl022: User more sensible defaults

When using the device tree, which must be considered normal
these days, in order to get some kind of normal functionality
out of the PL022 users have to actively go into the device
tree and edit the SPI clients like this:

spi {
  compatible = "arm,pl022";
  num-cs = <1>;
  cs-gpios = <&gpio 0 GPIO_ACTIVE_LOW>;

  foo@0 {
    compatible = "foo";
    reg = <0>;
    pl022,interface = <0>;
    pl022,com-mode = <0>;
  };
};

Otherwise the PL022 will come up as a client (slave) and
using polling mode. This is quite unintuitive and many users
will get their device trees wrong.

Alter the defaults such that we come up in host mode
(master) and use interrupt mode.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20210328121530.1983081-1-linus.walleij@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoMerge series "enable flexspi support on imx8mp" from Heiko Schocher <hs@denx.de>:
Mark Brown [Thu, 25 Mar 2021 17:32:02 +0000 (17:32 +0000)]
Merge series "enable flexspi support on imx8mp" from Heiko Schocher <hs@denx.de>:

add compatible entry in nxp_fspi driver for imx8mp

@Shawn: If this series is accepted, can you apply the DTS patches from
series v2?
http://lists.infradead.org/pipermail/linux-arm-kernel/2021-March/643292.html
http://lists.infradead.org/pipermail/linux-arm-kernel/2021-March/643293.html

Changes in v4:
rebased against:
git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-next
a43e89624baea ("Merge remote-tracking branch 'spi/for-5.13' into spi-next")

Changes in v3:
- seperate spi changes from series:
  http://lists.infradead.org/pipermail/linux-arm-kernel/2021-March/643289.html
  into own series as Kuldeep suggested and rebased against
  git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-next
  144c79ef33536 ("Merge tag 'perf-tools-fixes-for-v5.12-2020-03-07' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux")
- no changes, rebased against
  git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-next
  144c79ef33536 Merge tag 'perf-tools-fixes-for-v5.12-2020-03-07' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux

Changes in v2:
- work in comments from Marco
  add own compatible entry for imx8mp

Heiko Schocher (2):
  spi: fspi: enable fspi driver for on imx8mp
  dt-bindings: spi: add compatible entry for imx8mp in FlexSPI
    controller

 Documentation/devicetree/bindings/spi/spi-nxp-fspi.txt | 1 +
 drivers/spi/spi-nxp-fspi.c                             | 1 +
 2 files changed, 2 insertions(+)

--
2.29.2

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

3 years agospi: fsi: Remove multiple sequenced ops for restricted chips
Eddie James [Wed, 24 Mar 2021 22:05:16 +0000 (17:05 -0500)]
spi: fsi: Remove multiple sequenced ops for restricted chips

Updated restricted chips have trouble processing multiple sequenced
operations. So remove the capability to sequence multiple operations and
reduce the maximum transfer size to 8 bytes.

Signed-off-by: Eddie James <eajames@linux.ibm.com>
Reviewed-by: Joel Stanley <joel@jms.id.au>
Link: https://lore.kernel.org/r/20210324220516.41192-1-eajames@linux.ibm.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agodt-bindings: spi: add compatible entry for imx8mp in FlexSPI controller
Heiko Schocher [Tue, 16 Mar 2021 07:59:28 +0000 (08:59 +0100)]
dt-bindings: spi: add compatible entry for imx8mp in FlexSPI controller

add compatible entry "nxp,imx8mp-fspi" in NXP FlexSPI controller

Signed-off-by: Heiko Schocher <hs@denx.de>
Link: https://lore.kernel.org/r/20210316075928.1763460-3-hs@denx.de
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agospi: fspi: enable fspi driver for on imx8mp
Heiko Schocher [Tue, 16 Mar 2021 07:59:27 +0000 (08:59 +0100)]
spi: fspi: enable fspi driver for on imx8mp

add compatible entry in nxp_fspi driver for imx8mp.

Signed-off-by: Heiko Schocher <hs@denx.de>
Link: https://lore.kernel.org/r/20210316075928.1763460-2-hs@denx.de
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agospi: pl022: Fix trailing whitespace
Jay Fang [Wed, 24 Mar 2021 06:16:42 +0000 (14:16 +0800)]
spi: pl022: Fix trailing whitespace

Fix checkpatch error:

  ERROR: trailing whitespace
  #1198: FILE: spi-pl022.c:1198:

Signed-off-by: Jay Fang <f.fangjian@huawei.com>
Link: https://lore.kernel.org/r/1616566602-13894-12-git-send-email-f.fangjian@huawei.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agospi: rockchip: Fix code indent should use tabs where possible
Jay Fang [Wed, 24 Mar 2021 06:16:41 +0000 (14:16 +0800)]
spi: rockchip: Fix code indent should use tabs where possible

Fix checkpatch errors:

  ERROR: code indent should use tabs where possible
  #484: FILE: spi-rockchip.c:484:
  +^I        | CR0_BHT_8BIT << CR0_BHT_OFFSET$
  ERROR: code indent should use tabs where possible
  #485: FILE: spi-rockchip.c:485:
  +^I        | CR0_SSD_ONE  << CR0_SSD_OFFSET$
  ERROR: code indent should use tabs where possible
  #486: FILE: spi-rockchip.c:486:
  +^I        | CR0_EM_BIG   << CR0_EM_OFFSET;$

Signed-off-by: Jay Fang <f.fangjian@huawei.com>
Link: https://lore.kernel.org/r/1616566602-13894-11-git-send-email-f.fangjian@huawei.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agospi: spi-mem: Fix code indent should use tabs where possible
Jay Fang [Wed, 24 Mar 2021 06:16:40 +0000 (14:16 +0800)]
spi: spi-mem: Fix code indent should use tabs where possible

Fix checkpatch errors:

  ERROR: code indent should use tabs where possible
  #624: FILE: spi-mem.c:624:
  ERROR: code indent should use tabs where possible
  #626: FILE: spi-mem.c:626:
  ERROR: code indent should use tabs where possible
  #627: FILE: spi-mem.c:627:

Signed-off-by: Jay Fang <f.fangjian@huawei.com>
Link: https://lore.kernel.org/r/1616566602-13894-10-git-send-email-f.fangjian@huawei.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agospi: jcore: Fix trailing statements should be on next line
Jay Fang [Wed, 24 Mar 2021 06:16:39 +0000 (14:16 +0800)]
spi: jcore: Fix trailing statements should be on next line

Fix checkpatch error:

  ERROR: trailing statements should be on next line
  #85: FILE: spi-jcore.c:85:
  + if (speed == hw->speed_hz) return;

Signed-off-by: Jay Fang <f.fangjian@huawei.com>
Link: https://lore.kernel.org/r/1616566602-13894-9-git-send-email-f.fangjian@huawei.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agospi: spi-bitbang: Fix open brace following function definitions go on the next line
Jay Fang [Wed, 24 Mar 2021 06:16:38 +0000 (14:16 +0800)]
spi: spi-bitbang: Fix open brace following function definitions go on the next line

Fix checkpatch errors:

  ERROR: open brace '{' following function definitions go on the next line
  #54: FILE: spi-bitbang.c:54:
  ERROR: open brace '{' following function definitions go on the next line
  #82: FILE: spi-bitbang.c:82:
  ERROR: open brace '{' following function definitions go on the next line
  #110: FILE: spi-bitbang.c:110:

Signed-off-by: Jay Fang <f.fangjian@huawei.com>
Link: https://lore.kernel.org/r/1616566602-13894-8-git-send-email-f.fangjian@huawei.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agospi: dln2: Fix open brace following function definitions go on the next line
Jay Fang [Wed, 24 Mar 2021 06:16:37 +0000 (14:16 +0800)]
spi: dln2: Fix open brace following function definitions go on the next line

Fix checkpatch error:

  ERROR: open brace '{' following function definitions go on the next line
  #545: FILE: spi-dln2.c:545:
  +static int dln2_spi_rdwr(struct dln2_spi *dln2, const u8 *tx_data,
  +  u8 *rx_data, u16 data_len, u8 attr) {

Signed-off-by: Jay Fang <f.fangjian@huawei.com>
Link: https://lore.kernel.org/r/1616566602-13894-7-git-send-email-f.fangjian@huawei.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agospi: spi-mtk-nor: Fix checkpatch spacing error
Jay Fang [Wed, 24 Mar 2021 06:16:36 +0000 (14:16 +0800)]
spi: spi-mtk-nor: Fix checkpatch spacing error

Fix checkpatch error:

  ERROR: space required before the open parenthesis '('
  #295: FILE: spi-mtk-nor.c:295:
  + switch(op->data.dir) {

Signed-off-by: Jay Fang <f.fangjian@huawei.com>
Link: https://lore.kernel.org/r/1616566602-13894-6-git-send-email-f.fangjian@huawei.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agospi: omap-100k: Fix checkpatch spacing errors
Jay Fang [Wed, 24 Mar 2021 06:16:35 +0000 (14:16 +0800)]
spi: omap-100k: Fix checkpatch spacing errors

Fix checkpatch errors:

  ERROR: space prohibited before that ',' (ctx:WxW)
  #113: FILE: spi-omap-100k.c:113:
  + writew(data , spi100k->base + SPI_TX_MSB);
              ^
  ERROR: space prohibited before that ',' (ctx:WxW)
  #249: FILE: spi-omap-100k.c:249:
  + writew(0x3e , spi100k->base + SPI_SETUP1);
              ^
  ERROR: space prohibited before that ',' (ctx:WxW)
  #250: FILE: spi-omap-100k.c:250:
  + writew(0x00 , spi100k->base + SPI_STATUS);
              ^
  ERROR: space prohibited before that ',' (ctx:WxW)
  #251: FILE: spi-omap-100k.c:251:
  + writew(0x3e , spi100k->base + SPI_CTRL);
              ^

Signed-off-by: Jay Fang <f.fangjian@huawei.com>
Link: https://lore.kernel.org/r/1616566602-13894-5-git-send-email-f.fangjian@huawei.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agospi: pxa2xx: Fix checkpatch spacing errors
Jay Fang [Wed, 24 Mar 2021 06:16:34 +0000 (14:16 +0800)]
spi: pxa2xx: Fix checkpatch spacing errors

Fix checkpatch errors:

  ERROR: space prohibited before that ',' (ctx:WxW)
  #255: FILE: spi-pxa2xx-pci.c:255:
  + ssp->clk = clk_register_fixed_rate(&dev->dev, buf , NULL, 0,
                                                    ^
  ERROR: "foo* bar" should be "foo *bar"
  #621: FILE: spi-pxa2xx.c:621:
  +static void int_error_stop(struct driver_data *drv_data, const char* msg)

Signed-off-by: Jay Fang <f.fangjian@huawei.com>
Link: https://lore.kernel.org/r/1616566602-13894-4-git-send-email-f.fangjian@huawei.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agospi: sprd: Fix checkpatch spacing error
Jay Fang [Wed, 24 Mar 2021 06:16:33 +0000 (14:16 +0800)]
spi: sprd: Fix checkpatch spacing error

Fix checkpatch error:

  ERROR: space prohibited before that close parenthesis ')'
  #213: FILE: spi-sprd-adi.c:213:
  + rd_addr = (val & RD_ADDR_MASK ) >> RD_ADDR_SHIFT;

Signed-off-by: Jay Fang <f.fangjian@huawei.com>
Link: https://lore.kernel.org/r/1616566602-13894-3-git-send-email-f.fangjian@huawei.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agospi: spi-topcliff-pch: Fix checkpatch spacing error
Jay Fang [Wed, 24 Mar 2021 06:16:32 +0000 (14:16 +0800)]
spi: spi-topcliff-pch: Fix checkpatch spacing error

Fix checkpatch error:

  ERROR: space prohibited before that '++' (ctx:WxB)
  #1204: FILE: spi-topcliff-pch.c:1204:
  + for (i = 0; i < cnt; i ++) {
                         ^

Signed-off-by: Jay Fang <f.fangjian@huawei.com>
Link: https://lore.kernel.org/r/1616566602-13894-2-git-send-email-f.fangjian@huawei.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agospi: mediatek: add mt8195 spi slave support
Leilk Liu [Mon, 22 Mar 2021 05:52:44 +0000 (13:52 +0800)]
spi: mediatek: add mt8195 spi slave support

this patch adds mt8195 spi slave compatible support.

Signed-off-by: Leilk Liu <leilk.liu@mediatek.com>
Link: https://lore.kernel.org/r/20210322055244.30179-5-leilk.liu@mediatek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agospi: mediatek: add mtk_spi_compatible support
Leilk Liu [Mon, 22 Mar 2021 05:52:43 +0000 (13:52 +0800)]
spi: mediatek: add mtk_spi_compatible support

this patch adds max_fifo_size and must_rx compat support.

Signed-off-by: Leilk Liu <leilk.liu@mediatek.com>
Link: https://lore.kernel.org/r/20210322055244.30179-4-leilk.liu@mediatek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agospi: update spi slave bindings for MT8195 SoC
Leilk Liu [Mon, 22 Mar 2021 05:52:42 +0000 (13:52 +0800)]
spi: update spi slave bindings for MT8195 SoC

Add a DT binding documentation for the MT8195 soc.

Signed-off-by: Leilk Liu <leilk.liu@mediatek.com>
Link: https://lore.kernel.org/r/20210322055244.30179-3-leilk.liu@mediatek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agospi: update spi master bindings for MT8195 SoC
Leilk Liu [Mon, 22 Mar 2021 05:52:41 +0000 (13:52 +0800)]
spi: update spi master bindings for MT8195 SoC

Add a DT binding documentation for the MT8195 soc.

Signed-off-by: leilk.liu <leilk.liu@mediatek.com>
Link: https://lore.kernel.org/r/20210322055244.30179-2-leilk.liu@mediatek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agospi: stm32: Fix use-after-free on unbind
Alain Volmat [Thu, 18 Mar 2021 07:24:50 +0000 (08:24 +0100)]
spi: stm32: Fix use-after-free on unbind

stm32_spi_remove() accesses the driver's private data after calling
spi_unregister_master() even though that function releases the last
reference on the spi_master and thereby frees the private data.

Fix by switching over to the new devm_spi_alloc_master() helper which
keeps the private data accessible until the driver has unbound.

Fixes: 8d559a64f00b ("spi: stm32: drop devres version of spi_register_master")

Reported-by: Lukas Wunner <lukas@wunner.de>
Signed-off-by: Alain Volmat <alain.volmat@foss.st.com>
Link: https://lore.kernel.org/r/1616052290-10887-1-git-send-email-alain.volmat@foss.st.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agospi: imx: Improve driver description
Fabio Estevam [Tue, 16 Mar 2021 18:09:22 +0000 (15:09 -0300)]
spi: imx: Improve driver description

"SPI Controller driver" is a too generic description.

Make it i.MX specific instead.

Signed-off-by: Fabio Estevam <festevam@gmail.com>
Link: https://lore.kernel.org/r/20210316180922.239805-1-festevam@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agospi: Fix spelling mistake "softwade" -> "software"
Colin Ian King [Wed, 17 Mar 2021 09:39:36 +0000 (09:39 +0000)]
spi: Fix spelling mistake "softwade" -> "software"

There is a spelling mistake in a dev_err message. Fix it.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Link: https://lore.kernel.org/r/20210317093936.5572-1-colin.king@canonical.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoMerge series "spi: Adding support for software nodes" from Heikki Krogerus <heikki...
Mark Brown [Tue, 16 Mar 2021 17:55:41 +0000 (17:55 +0000)]
Merge series "spi: Adding support for software nodes" from Heikki Krogerus <heikki.krogerus@linux.intel.com>:

Hi,

The older API used to supply additional device properties for the
devices - so mainly the function device_add_properties() - is going to
be removed. The reason why the API will be removed is because it gives
false impression that the properties are assigned directly to the
devices, which has actually never been the case - the properties have
always been assigned to a software fwnode which was then just directly
linked with the device when the old API was used. By only accepting
device properties instead of complete software nodes, the subsystems
remove any change of taking advantage of the other features the
software nodes have.

The change that is required from the spi subsystem and the drivers is
trivial. Basically only the "properties" member in struct
spi_board_info, which was a pointer to struct property_entry, is
replaced with a pointer to a complete software node.

thanks,

Heikki Krogerus (4):
  spi: Add support for software nodes
  ARM: pxa: icontrol: Constify the software node
  ARM: pxa: zeus: Constify the software node
  spi: Remove support for dangling device properties

 arch/arm/mach-pxa/icontrol.c | 12 ++++++++----
 arch/arm/mach-pxa/zeus.c     |  6 +++++-
 drivers/spi/spi.c            | 21 ++++++---------------
 include/linux/spi/spi.h      |  7 +++----
 4 files changed, 22 insertions(+), 24 deletions(-)

--
2.30.1

base-commit: a38fd8748464831584a19438cbb3082b5a2dab15

3 years agospi: Remove support for dangling device properties
Heikki Krogerus [Wed, 3 Mar 2021 15:28:14 +0000 (18:28 +0300)]
spi: Remove support for dangling device properties

>From now on only accepting complete software nodes.

Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Link: https://lore.kernel.org/r/20210303152814.35070-5-heikki.krogerus@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoARM: pxa: zeus: Constify the software node
Heikki Krogerus [Wed, 3 Mar 2021 15:28:13 +0000 (18:28 +0300)]
ARM: pxa: zeus: Constify the software node

When device properties are supplied to the devices, in
reality a software fwnode that holds those properties is
created which is then assigned to the device. If the device
properties are constant the software node can also be
constant.

Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Cc: Daniel Mack <daniel@zonque.org>
Cc: Haojian Zhuang <haojian.zhuang@gmail.com>
Cc: Robert Jarzmik <robert.jarzmik@free.fr>
Link: https://lore.kernel.org/r/20210303152814.35070-4-heikki.krogerus@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoARM: pxa: icontrol: Constify the software node
Heikki Krogerus [Wed, 3 Mar 2021 15:28:12 +0000 (18:28 +0300)]
ARM: pxa: icontrol: Constify the software node

When device properties are supplied to the devices, in
reality a software fwnode that holds those properties is
created which is then assigned to the device. If the device
properties are constant the software node can also be
constant.

Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Cc: Daniel Mack <daniel@zonque.org>
Cc: Haojian Zhuang <haojian.zhuang@gmail.com>
Cc: Robert Jarzmik <robert.jarzmik@free.fr>
Link: https://lore.kernel.org/r/20210303152814.35070-3-heikki.krogerus@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agospi: Add support for software nodes
Heikki Krogerus [Wed, 3 Mar 2021 15:28:11 +0000 (18:28 +0300)]
spi: Add support for software nodes

Making it possible for the drivers to assign complete
software fwnodes to the devices instead of only the device
properties in those nodes.

Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Link: https://lore.kernel.org/r/20210303152814.35070-2-heikki.krogerus@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agodt-bindings: spi: Add compatible for Mediatek MT8195
Seiya Wang [Tue, 16 Mar 2021 11:14:38 +0000 (19:14 +0800)]
dt-bindings: spi: Add compatible for Mediatek MT8195

This commit adds dt-binding documentation of spi nor for Mediatek MT8195 SoC
Platform.

Signed-off-by: Seiya Wang <seiya.wang@mediatek.com>
Link: https://lore.kernel.org/r/20210316111443.3332-6-seiya.wang@mediatek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoMerge series "spi: finalize 'delay_usecs' removal/transition" from Alexandru Ardelean...
Mark Brown [Fri, 12 Mar 2021 18:05:11 +0000 (18:05 +0000)]
Merge series "spi: finalize 'delay_usecs' removal/transition" from Alexandru Ardelean <aardelean@deviqon.com>:

A while back I started the introduction of the 'spi_delay' data type:
  https://lore.kernel.org/linux-spi/20190926105147.7839-1-alexandru.ardelean@analog.com/

Users of the 'delay_usecs' were removed from drivers.

Now it's time to remove the 'delay_usecs' from the SPI subsystem and use
only the 'delay' field.

This changeset adapts all SPI drivers to do without 'delay_usecs'.
Additionally, for greybus we need to adapt it to use the 'delay' in
nano-seconds and convert it to micro-seconds.

Alexandru Ardelean (10):
  spi: spi-axi-spi-engine: remove usage of delay_usecs
  spi: bcm63xx-spi: don't check 'delay_usecs' field
  spi: spi-bcm-qspi: replace 'delay_usecs' with 'delay.value' check
  spi: spi-sh: replace 'delay_usecs' with 'delay.value' in pr_debug
  spi: spi-tegra20-flash: don't check 'delay_usecs' field for spi
    transfer
  staging: greybus: spilib: use 'spi_delay_to_ns' for getting xfer delay
  spi: spi-falcon: remove check for 'delay_usecs'
  spi: fsl-espi: remove usage of 'delay_usecs' field
  spi: core: remove 'delay_usecs' field from spi_transfer
  spi: docs: update info about 'delay_usecs'

 Documentation/spi/spi-summary.rst |  7 +++++--
 drivers/spi/spi-axi-spi-engine.c  | 12 ++++--------
 drivers/spi/spi-bcm-qspi.c        |  2 +-
 drivers/spi/spi-bcm63xx.c         |  2 +-
 drivers/spi/spi-falcon.c          |  2 +-
 drivers/spi/spi-fsl-espi.c        | 17 +++++------------
 drivers/spi/spi-sh.c              |  4 ++--
 drivers/spi/spi-tegra20-sflash.c  |  3 +--
 drivers/spi/spi.c                 |  1 -
 drivers/staging/greybus/spilib.c  |  5 ++++-
 include/linux/spi/spi.h           | 12 ------------
 11 files changed, 24 insertions(+), 43 deletions(-)

--
2.29.2

_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

3 years agospi: stm32: avoid ifdef CONFIG_PM for pm callbacks
Alain Volmat [Fri, 12 Mar 2021 10:35:29 +0000 (11:35 +0100)]
spi: stm32: avoid ifdef CONFIG_PM for pm callbacks

Avoid CONFIG_PM preprocessor check for pm suspend/resume
callbacks and identify the functions with __maybe_unused.

Signed-off-by: Alain Volmat <alain.volmat@foss.st.com>
Link: https://lore.kernel.org/r/1615545329-5496-1-git-send-email-alain.volmat@foss.st.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agospi: docs: update info about 'delay_usecs'
Alexandru Ardelean [Mon, 8 Mar 2021 14:55:02 +0000 (16:55 +0200)]
spi: docs: update info about 'delay_usecs'

The 'delay_usecs' field is no longer present on the spi_transfer struct.
This change updates the doc to mention the usage of the (relatively) new
'delay' field.

Signed-off-by: Alexandru Ardelean <aardelean@deviqon.com>
Link: https://lore.kernel.org/r/20210308145502.1075689-11-aardelean@deviqon.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agospi: core: remove 'delay_usecs' field from spi_transfer
Alexandru Ardelean [Mon, 8 Mar 2021 14:55:01 +0000 (16:55 +0200)]
spi: core: remove 'delay_usecs' field from spi_transfer

The 'delay' field in the spi_transfer struct is meant to replace the
'delay_usecs' field. However some cleanup was required to remove the
uses of 'delay_usecs'. Now that it's been cleaned up, we can remove it
from the kernel tree.

Signed-off-by: Alexandru Ardelean <aardelean@deviqon.com>
Link: https://lore.kernel.org/r/20210308145502.1075689-10-aardelean@deviqon.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agospi: fsl-espi: remove usage of 'delay_usecs' field
Alexandru Ardelean [Mon, 8 Mar 2021 14:55:00 +0000 (16:55 +0200)]
spi: fsl-espi: remove usage of 'delay_usecs' field

The 'delay_usecs' field is being removed from the spi_transfer struct.
This change removes it from the SPI FSL ESPI driver.

Signed-off-by: Alexandru Ardelean <aardelean@deviqon.com>
Link: https://lore.kernel.org/r/20210308145502.1075689-9-aardelean@deviqon.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agospi: spi-falcon: remove check for 'delay_usecs'
Alexandru Ardelean [Mon, 8 Mar 2021 14:54:59 +0000 (16:54 +0200)]
spi: spi-falcon: remove check for 'delay_usecs'

The 'delay_usecs' field is being removed from the spi_transfer struct.
This change removes it from the SPI Falcon driver.

Signed-off-by: Alexandru Ardelean <aardelean@deviqon.com>
Link: https://lore.kernel.org/r/20210308145502.1075689-8-aardelean@deviqon.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agostaging: greybus: spilib: use 'spi_delay_to_ns' for getting xfer delay
Alexandru Ardelean [Mon, 8 Mar 2021 14:54:58 +0000 (16:54 +0200)]
staging: greybus: spilib: use 'spi_delay_to_ns' for getting xfer delay

The intent is the removal of the 'delay_usecs' field from the
spi_transfer struct, as there is a 'delay' field that does the same
thing.

The spi_delay_to_ns() can be used to get the transfer delay. It works by
using the 'delay_usecs' field first (if it is non-zero), and finally
uses the 'delay' field.

Since the 'delay_usecs' field is going away, this change makes use of the
spi_delay_to_ns() function. This also means dividing the return value of
the function by 1000, to convert it to microseconds.
To prevent any potential faults when converting to microseconds and since
the result of spi_delay_to_ns() is int, the delay is being computed in 32
bits and then clamped between 0 & U16_MAX.

Signed-off-by: Alexandru Ardelean <aardelean@deviqon.com>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Acked-by: Rui Miguel Silva <rmfrfs@gmail.com>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Link: https://lore.kernel.org/r/20210308145502.1075689-7-aardelean@deviqon.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agospi: spi-tegra20-flash: don't check 'delay_usecs' field for spi transfer
Alexandru Ardelean [Mon, 8 Mar 2021 14:54:57 +0000 (16:54 +0200)]
spi: spi-tegra20-flash: don't check 'delay_usecs' field for spi transfer

The 'delay_usecs' field was handled for backwards compatibility in case
there were some users that still configured SPI delay transfers with
this field.

They should all be removed by now. So we can remove the 'delay_usecs'
handling in this driver.

Signed-off-by: Alexandru Ardelean <aardelean@deviqon.com>
Link: https://lore.kernel.org/r/20210308145502.1075689-6-aardelean@deviqon.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agospi: spi-sh: replace 'delay_usecs' with 'delay.value' in pr_debug
Alexandru Ardelean [Mon, 8 Mar 2021 14:54:56 +0000 (16:54 +0200)]
spi: spi-sh: replace 'delay_usecs' with 'delay.value' in pr_debug

The 'delay_usecs' field is going away. The replacement for it is the
'delay' field. So, we should print the 'delay.value' value instead.

Signed-off-by: Alexandru Ardelean <aardelean@deviqon.com>
Link: https://lore.kernel.org/r/20210308145502.1075689-5-aardelean@deviqon.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agospi: spi-bcm-qspi: replace 'delay_usecs' with 'delay.value' check
Alexandru Ardelean [Mon, 8 Mar 2021 14:54:55 +0000 (16:54 +0200)]
spi: spi-bcm-qspi: replace 'delay_usecs' with 'delay.value' check

The 'delay_usecs' field is going away. The replacement for it is the
'delay' field. So, we should check for 'delay.value' being non-zero.

Signed-off-by: Alexandru Ardelean <aardelean@deviqon.com>
Link: https://lore.kernel.org/r/20210308145502.1075689-4-aardelean@deviqon.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agospi: bcm63xx-spi: don't check 'delay_usecs' field
Alexandru Ardelean [Mon, 8 Mar 2021 14:54:54 +0000 (16:54 +0200)]
spi: bcm63xx-spi: don't check 'delay_usecs' field

The 'delay_usecs' field was handled for backwards compatibility in case
there were some users that still configured SPI delay transfers with
this field.

They should all be removed by now.

Signed-off-by: Alexandru Ardelean <aardelean@deviqon.com>
Link: https://lore.kernel.org/r/20210308145502.1075689-3-aardelean@deviqon.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agospi: spi-axi-spi-engine: remove usage of delay_usecs
Alexandru Ardelean [Mon, 8 Mar 2021 14:54:53 +0000 (16:54 +0200)]
spi: spi-axi-spi-engine: remove usage of delay_usecs

The 'delay_usecs' field was handled for backwards compatibility in case
there were some users that still configured SPI delay transfers with
this field.

They should all be removed by now.

Signed-off-by: Alexandru Ardelean <aardelean@deviqon.com>
Link: https://lore.kernel.org/r/20210308145502.1075689-2-aardelean@deviqon.com
Signed-off-by: Mark Brown <broonie@kernel.org>