Commit Graph

7864 Commits

Author SHA1 Message Date
Mark Brown
46e001c003
Add devm_dma_request_chan() to simplify probe
Merge series from Bence Csókás <csokas.bence@prolan.hu>:

The probe function of the atmel-quadspi driver got quite convoluted,
especially since the addition of SAMA7G5 support, that was forward-ported
from an older vendor kernel. To alleivate this - and similar problems in
the future - an effort was made to migrate as many functions as possible,
to their devm_ managed counterparts. Patch 1/2 adds the new
`devm_dma_request_chan()` function. Patch 2/2 then uses this APIs to
simplify the probe() function.
2025-06-27 12:07:07 +01:00
Bence Csókás
2555691165
spi: atmel-quadspi: Use devm_dma_request_chan()
Leave releasing of DMA channels up to the devm facilities. This way we can
eliminate the rest of the "goto ladder".

Signed-off-by: Bence Csókás <csokas.bence@prolan.hu>
Link: https://patch.msgid.link/20250610082256.400492-3-csokas.bence@prolan.hu
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-06-27 00:29:14 +01:00
Mark Brown
e6352bfae9
Add few updates to the STM32 SPI driver
Merge series from Clément Le Goffic <clement.legoffic@foss.st.com>:

This series aims to improve the STM32 SPI driver in different areas.
It adds SPI_READY mode, fixes an issue raised by a kernel bot,
add the ability to use DMA-MDMA chaining for RX and deprecate an ST bindings
vendor property.
2025-06-25 19:23:44 +01:00
Clément Le Goffic
4956bf4452
spi: stm32: deprecate st,spi-midi-ns property
The `st,spi-midi-ns` property, which was used to set a nanosecond delay
between transferred words, is now deprecated.
This functionality is now supported by the SPI framework through the
`spi_transfer` struct's `word_delay` variable.
Therefore, the private `st,spi-midi-ns` property is no longer needed and
has been deprecated in favor of the generic solution.

Signed-off-by: Clément Le Goffic <clement.legoffic@foss.st.com>
Link: https://patch.msgid.link/20250616-spi-upstream-v1-5-7e8593f3f75d@foss.st.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-06-24 16:43:01 +01:00
Clément Le Goffic
d17dd2f1d8
spi: stm32: use STM32 DMA with STM32 MDMA to enhance DDR use
The STM32 DMA doesn't have the ability to generate convenient burst
transfer on the DDR, ensuring the best load of the AXI & DDR.
To avoid this bad load of the AXI & DDR, STM32 MDMA can be used to transfer
data to the DDR, being triggered by STM32 DMA channel transfer
completion.
An SRAM buffer is used between DMA and MDMA. So the MDMA always does
MEM_TO_MEM transfers (from/to SRAM to/from DDR), and the DMA uses SRAM
instead of DDR with DEV_TO_MEM transfers.
SPI RX DMA (DEV_TO_MEM) becomes:
SPI RX FIFO ==DMA==> SRAM ==MDMA==> DDR

In RX (DEV_TO_MEM), EOT interrupt is used to pause the DMA channel (which
will raise a transfer complete) to trigger the MDMA to flush the SRAM (when
transfer length is not aligned on SRAM period).
TX remains on the former implementation.

Signed-off-by: Clément Le Goffic <clement.legoffic@foss.st.com>
Link: https://patch.msgid.link/20250616-spi-upstream-v1-4-7e8593f3f75d@foss.st.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-06-24 16:43:00 +01:00
Clément Le Goffic
21f1c800f6
spi: stm32: Check for cfg availability in stm32_spi_probe
The stm32_spi_probe function now includes a check to ensure that the
pointer returned by of_device_get_match_data is not NULL before
accessing its members. This resolves a warning where a potential NULL
pointer dereference could occur when accessing cfg->has_device_mode.

Before accessing the 'has_device_mode' member, we verify that 'cfg' is
not NULL. If 'cfg' is NULL, an error message is logged.

This change ensures that the driver does not attempt to access
configuration data if it is not available, thus preventing a potential
system crash due to a NULL pointer dereference.

Signed-off-by: Clément Le Goffic <clement.legoffic@foss.st.com>
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202310191831.MLwx1c6x-lkp@intel.com/
Fixes: fee681646f ("spi: stm32: disable device mode with st,stm32f4-spi compatible")
Link: https://patch.msgid.link/20250616-spi-upstream-v1-2-7e8593f3f75d@foss.st.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-06-24 16:42:59 +01:00
Clément Le Goffic
e4feefa5c7
spi: stm32: Add SPI_READY mode to spi controller
The spi ready functionality is supported by our peripheral in host and
target modes on STM32MP2x SoCs.
Update our spi controller driver to allow devices to use this
functionality.

Signed-off-by: Clément Le Goffic <clement.legoffic@foss.st.com>
Link: https://patch.msgid.link/20250616-spi-upstream-v1-1-7e8593f3f75d@foss.st.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-06-24 16:42:58 +01:00
Khairul Anuar Romli
b07f349d18
spi: spi-cadence-quadspi: Fix pm runtime unbalance
Having PM put sync in remove function is causing PM underflow during
remove operation. This is caused by the function, runtime_pm_get_sync,
not being called anywhere during the op. Ensure that calls to
pm_runtime_enable()/pm_runtime_disable() and
pm_runtime_get_sync()/pm_runtime_put_sync() match.

echo 108d2000.spi > /sys/bus/platform/drivers/cadence-qspi/unbind
[   49.644256] Deleting MTD partitions on "108d2000.spi.0":
[   49.649575] Deleting u-boot MTD partition
[   49.684087] Deleting root MTD partition
[   49.724188] cadence-qspi 108d2000.spi: Runtime PM usage count underflow!

Continuous bind/unbind will result in an "Unbalanced pm_runtime_enable" error.
Subsequent unbind attempts will return a "No such device" error, while bind
attempts will return a "Resource temporarily unavailable" error.

[   47.592434] cadence-qspi 108d2000.spi: Runtime PM usage count underflow!
[   49.592233] cadence-qspi 108d2000.spi: detected FIFO depth (1024) different from config (128)
[   53.232309] cadence-qspi 108d2000.spi: Runtime PM usage count underflow!
[   55.828550] cadence-qspi 108d2000.spi: detected FIFO depth (1024) different from config (128)
[   57.940627] cadence-qspi 108d2000.spi: Runtime PM usage count underflow!
[   59.912490] cadence-qspi 108d2000.spi: detected FIFO depth (1024) different from config (128)
[   61.876243] cadence-qspi 108d2000.spi: Runtime PM usage count underflow!
[   61.883000] platform 108d2000.spi: Unbalanced pm_runtime_enable!
[  532.012270] cadence-qspi 108d2000.spi: probe with driver cadence-qspi failed1

Also, change clk_disable_unprepare() to clk_disable() since continuous
bind and unbind operations will trigger a warning indicating that the clock is
already unprepared.

Fixes: 4892b374c9 ("mtd: spi-nor: cadence-quadspi: Add runtime PM support")
cc: stable@vger.kernel.org # 6.6+
Signed-off-by: Khairul Anuar Romli <khairul.anuar.romli@altera.com>
Reviewed-by: Matthew Gerlach <matthew.gerlach@altera.com>
Link: https://patch.msgid.link/4e7a4b8aba300e629b45a04f90bddf665fbdb335.1749601877.git.khairul.anuar.romli@altera.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-06-24 16:40:31 +01:00
Thangaraj Samynathan
3e36c82250
spi: spi-pci1xxxx: Add support for per-instance DMA interrupt vectors
Add support for dedicated DMA interrupt vectors for each SPI hardware
instance in the pci1xxxx driver. This improves scalability and interrupt
handling for systems using multiple SPI instances with DMA.

Introduce a constant `NUM_VEC_PER_INST` to define the number of IRQ
vectors per instance (main, DMA write, DMA read). Update the
`pci1xxxx_spi_internal` structure to use an IRQ array.

Refactor IRQ allocation and DMA initialization logic:
- Assign separate IRQ vectors for DMA read and write interrupts.
- Split the original DMA ISR into two handlers:
  `pci1xxxx_spi_isr_dma_rd` and `pci1xxxx_spi_isr_dma_wr`.
- Configure IMWR registers per instance using cached MSI data.
- Move DMA register configuration into a new helper function,
  `pci1xxxx_spi_dma_config()`.

Invoke the DMA initialization after all instances are configured to
ensure correct IRQ vector mapping.

Signed-off-by: Thangaraj Samynathan <thangaraj.s@microchip.com>
Link: https://patch.msgid.link/20250624033028.74389-1-thangaraj.s@microchip.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-06-24 13:14:30 +01:00
Mark Brown
1256eb42db
spi: microchip-core-qspi: Add regular transfers
Merge series from Conor Dooley <conor@kernel.org>:

This is a v2 of a patchset I sent about this time last year, adding the
regular transfer_one_message op to the microchip-core-qspi driver. In that
v1 Mark expressed his dislike for that op, so v2 is using
prepare/unprepare/transfer_one instead. The unprepare implementation still
contains the 750 us delay that the driver had back in v1. I've heard a
suggestion internally as to why this is needed, but it was unsubstantiated,
so I still have no justification for it. I held off on sending a v2 because
of a lack of explanation for the delay, but I don't wanna hold off forever
for something I might never understand.
2025-06-23 23:30:49 +01:00
Cyril Jean
8f9cf02c88
spi: microchip-core-qspi: Add regular transfers
The driver for CoreQSPI only supports memory operations at present, so
add support for regular transfers so that the SD card slot and ADC on
the BeagleV Fire can be used.

Signed-off-by: Cyril Jean <cyril.jean@microchip.com>
Co-developed-by: Conor Dooley <conor.dooley@microchip.com>
Signed-off-by: Conor Dooley <conor.dooley@microchip.com>
Link: https://patch.msgid.link/20250620-splice-shelter-310771564886@spud
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-06-23 21:33:54 +01:00
Conor Dooley
75ca45c472
spi: microchip-core-qspi: remove unused param from mchp_coreqspi_write_op()
"word" is unused in mchp_coreqspi_write_op(), so delete it.

Signed-off-by: Conor Dooley <conor.dooley@microchip.com>
Link: https://patch.msgid.link/20250620-starry-excusably-25e6be957d9d@spud
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-06-23 21:33:54 +01:00
Conor Dooley
76f03ce1c6
spi: microchip-core-qspi: set min_speed_hz during probe
The controller's minimum possible bus clock is 1/30 the rate of the
input clock. Naively set the minimum bus clock speed the controller
is capable of during probe, assuming that the rate will never reduce
further.

Signed-off-by: Conor Dooley <conor.dooley@microchip.com>
Link: https://patch.msgid.link/20250620-drained-widen-ac311bd5f172@spud
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-06-23 21:33:53 +01:00
Shiji Yang
5fc2c38312
spi: falcon: mark falcon_sflash_xfer() as static
Fix the following missing-prototypes build warning:

drivers/spi/spi-falcon.c:97:5: error: no previous prototype for 'falcon_sflash_xfer' [-Werror=missing-prototypes]
   97 | int falcon_sflash_xfer(struct spi_device *spi, struct spi_transfer *t,
      |     ^~~~~~~~~~~~~~~~~~

Signed-off-by: Shiji Yang <yangshiji66@outlook.com>
Link: https://patch.msgid.link/OSBPR01MB16705BE87E549B6210CD6BCABC72A@OSBPR01MB1670.jpnprd01.prod.outlook.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-06-18 17:23:10 +01:00
Lukas Bulwahn
dce4bc30f4
spi: spi-fsl-dspi: Revert unintended dependency change in config SPI_FSL_DSPI
Commit 9a30e332c3 ("spi: spi-fsl-dspi: Enable support for S32G
platforms") reworks the dependencies of config SPI_FSL_DSPI, but introduces
a typo changing the dependency to M5441x to a dependency on a non-existing
config M54541x.

Revert the unintended change to depend on the config M5441x.

Fixes: 9a30e332c3 ("spi: spi-fsl-dspi: Enable support for S32G platforms")
Signed-off-by: Lukas Bulwahn <lukas.bulwahn@redhat.com>
Reviewed-by: James Clark <james.clark@linaro.org>
Link: https://patch.msgid.link/20250616091955.20547-1-lukas.bulwahn@redhat.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-06-16 13:26:56 +01:00
Thierry Reding
d57e92dd66
spi: tegra210-qspi: Remove cache operations
The DMA memory for this driver is allocated using dma_alloc_coherent(),
which ends up mapping the allocated memory as uncached. Performing the
various dma_sync_*() operations on this memory causes issues during SPI
flashing:

[    7.818017] pc : dcache_inval_poc+0x40/0x58
[    7.822128] lr : arch_sync_dma_for_cpu+0x2c/0x4c
[    7.826854] sp : ffff80008193bcf0
[    7.830267] x29: ffff80008193bcf0 x28: ffffa3fe5ff1e908 x27: ffffa3fe627bb130
[    7.837528] x26: ffff000086952180 x25: ffff00008015c8ac x24: ffff000086c9b480
[    7.844878] x23: ffff00008015c800 x22: 0000000000000002 x21: 0000000000010000
[    7.852229] x20: 0000000106dae000 x19: ffff000080112410 x18: 0000000000000001
[    7.859580] x17: ffff000080159400 x16: ffffa3fe607a9bd8 x15: ffff0000eac1b180
[    7.866753] x14: 000000000000000c x13: 0000000000000001 x12: 000000000000025a
[    7.874104] x11: 0000000000000000 x10: 7f73e96357f6a07f x9 : db1fc8072a7f5e3a
[    7.881365] x8 : ffff000086c9c588 x7 : ffffa3fe607a9bd8 x6 : ffff80008193bc28
[    7.888630] x5 : 000000000000ffff x4 : 0000000000000009 x3 : 000000000000003f
[    7.895892] x2 : 0000000000000040 x1 : ffff000086dbe000 x0 : ffff000086db0000
[    7.903155] Call trace:
[    7.905606]  dcache_inval_poc+0x40/0x58 (P)
[    7.909804]  iommu_dma_sync_single_for_cpu+0xb4/0xb8
[    7.914617]  __dma_sync_single_for_cpu+0x158/0x194
[    7.919428]  __this_module+0x5b020/0x5baf8 [spi_tegra210_quad]
[    7.925291]  irq_thread_fn+0x2c/0xc0
[    7.928966]  irq_thread+0x16c/0x318
[    7.932467]  kthread+0x12c/0x214

Fix this by removing all calls to the dma_sync_*() functions. This isn't
ideal because DMA is used only for relatively large (> 64 words or 256
bytes) and using uncached memory for this might be slow. Reworking this
to use cached memory for faster access and reintroducing the cache
maintenance calls is probably worth a follow-up patch.

Reported-by: Brad Griffis <bgriffis@nvidia.com>
Fixes: 017f1b0bae ("spi: tegra210-quad: Add support for internal DMA")
Signed-off-by: Thierry Reding <treding@nvidia.com>
Link: https://patch.msgid.link/20250613123037.2082788-1-thierry.reding@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-06-13 17:30:56 +01:00
Thangaraj Samynathan
9f0ad43b15
spi: spi-pci1xxxx: Drop MSI-X usage as unsupported by DMA engine
Removes MSI-X from the interrupt request path, as the DMA engine used by
the SPI controller does not support MSI-X interrupts.

Signed-off-by: Thangaraj Samynathan <thangaraj.s@microchip.com>
Link: https://patch.msgid.link/20250612023059.71726-1-thangaraj.s@microchip.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-06-13 12:25:31 +01:00
Mark Brown
22a6456727
spi: Merge up fixes
Needed for new development of the pci1xxxx driver.
2025-06-13 12:13:16 +01:00
Dan Carpenter
83f066fac3
spi: stm32-ospi: clean up on error in probe()
If reset_control_acquire() fails, then we can't return directly.
We need to do a little clean up first.

Fixes: cf2c3eceb7 ("spi: stm32-ospi: Make usage of reset_control_acquire/release() API")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Link: https://patch.msgid.link/aEmAGTUzzKZlLe3K@stanley.mountain
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-06-11 16:47:53 +01:00
AngeloGioacchino Del Regno
6cafcc53eb
spi: spi-mt65xx: Add support for MT6991 Dimensity 9400 SPI IPM
Add support for the SPI IPM controller found in the MediaTek
Dimensity 9400 (MT6991) SoC. As a note, this is the same SPI
IPM Controller IP found on the MT8196 Kompanio counterpart.

Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Link: https://patch.msgid.link/20250611110747.458090-2-angelogioacchino.delregno@collabora.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-06-11 12:46:21 +01:00
Mark Brown
bd30b995df
SPI: omap2-mcspi: Fix SPI CS behaviour around
Merge series from Félix Piédallu <felix.piedallu@non.se.com>:

These patches fix the behaviour of the SPI Chip Select of the OMAP2 MCSPI
driver used on TI SoCs.

The omap2-mcspi driver supports the use of multi mode (multichannel in TI
documentation). In this mode, the CS is asserted and deasserted by the
hardware.

The multi mode is disabled for messages when cs_change=0 for all transfers
(e.g when CS is kept asserted between transfers of a same message).

The multi mode also needs to be disabled for messages when cs_change=1 on the
last transfer (e.g when CS is kept asserted after the WHOLE message), and the
message right after.

Currently, that is not the case and it CS is deasserted by hardware when it
shouldn't.
This breaks peripheral drivers that send multiple messages with the CS asserted
in between.

Patch 1 ensures that multi mode is disabled when cs_change=1 on the last
transfer of the message.

Patch 2 ensures that multi mode is disable on a message following one with
cs_change=1 on the last transfer.

This is the case for the TPM TIS SPI driver that uses this logic for flow
control purposes.

Tested on an AM6442 platform with a TPM ST33HTPH2X32AHE4.
2025-06-09 18:45:20 +01:00
Mark Brown
3d594a648b
spi: spi-fsl-dspi: DSPI support for NXP S32G
Merge series from James Clark <james.clark@linaro.org>:

DT and driver changes for DSPI on S32G platforms. First 3 commits are
fixes for various edge cases which also apply to other platforms.
Remaining commits add new S32G registers and device settings, some S32G
specific fixes and then finally add the DT compatibles and binding docs.

Tested in both host and target mode on S32G-VNP-RDB3 by transferring to
an external device over spi1 using spidev_test.c
2025-06-09 18:17:44 +01:00
Patrice Chotard
cf2c3eceb7
spi: stm32-ospi: Make usage of reset_control_acquire/release() API
As ospi reset is consumed by both OMM and OSPI drivers, use the reset
acquire/release mechanism which ensure exclusive reset usage.

This avoid to call reset_control_get/put() in OMM driver each time
we need to reset OSPI children and guarantee the reset line stays
deasserted.

During resume, OMM driver takes temporarily control of reset.

Fixes: 79b8a705e2 ("spi: stm32: Add OSPI driver")
Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>
Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de>
Link: https://patch.msgid.link/20250609-b4-upstream_ospi_reset_update-v6-1-5b602b567e8a@foss.st.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-06-09 16:21:29 +01:00
Andres Urian Florez
e51a086117
spi: offload: check offload ops existence before disabling the trigger
Add a safe guard in spi_offload_trigger to check the existence of
offload->ops before invoking the trigger_disable callback

Signed-off-by: Andres Urian Florez <andres.emb.sys@gmail.com>
Link: https://patch.msgid.link/20250608230422.325360-1-andres.emb.sys@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-06-09 13:31:50 +01:00
Thangaraj Samynathan
c459262159
spi: spi-pci1xxxx: Add support for 25MHz Clock frequency in C0
Adds support for 25MHz clock frequency. Support for this frequency
is added in C0.

Signed-off-by: Thangaraj Samynathan <thangaraj.s@microchip.com>
Link: https://patch.msgid.link/20250526104908.404564-1-thangaraj.s@microchip.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-06-08 23:38:45 +01:00
Gabor Juhos
f73dc37ebf
spi: spi-qpic-snand: remove 'qpic_snand_op' structure
The 'qpic_snand_op' structure is used only in the qcom_spi_send_cmdaddr()
function as a type of a local variable. Additionally, the sole purpose of
that variable is to keep some interim values before those gets passed as
arguments for cpu_to_le32() calls.

In order to simplify the code, remove the definition of the structure
along with the local variable, and use the corresponding values directly
as parameters for cpu_to_le32() calls.

No functional changes intended.

Signed-off-by: Gabor Juhos <j4g8y7@gmail.com>
Link: https://patch.msgid.link/20250529-qpic-snand-remove-qpic_snand_op-v1-1-6e42b772d748@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-06-08 23:38:43 +01:00
Gabor Juhos
6c1ca9928e
spi: spi-qpic-snand: use NANDC_STEP_SIZE consistently
Change the qcom_spi_read_page_ecc() function to use NANDC_STEP_SIZE
instead of a magic number while calculating the data size to keep it
consistent with other functions like qcom_spi_program_{raw,ecc,oob}
and qcom_spi_read_cw_{raw,page_oob}.

No functional changes.

Signed-off-by: Gabor Juhos <j4g8y7@gmail.com>
Reviewed-by: Md Sadre Alam <quic_mdalam@quicinc.com>
Link: https://patch.msgid.link/20250525-qpic-snand-nandc_step_size-v1-1-6039e9bfe1c6@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-06-08 23:38:42 +01:00
Ciprian Marian Costea
9a30e332c3
spi: spi-fsl-dspi: Enable support for S32G platforms
Add compatible for S32G platforms, allowing DSPI to be used.

Add a depends for ARCH_NXP which can replace LAYERSCAPE and also
includes the new ARCH_S32 for S32G. Similarly, ARCH_MXC can replace
SOC_VF610 || SOC_LS1021A which should avoid updating this for every new
sub-platform in the future.

Signed-off-by: Ciprian Marian Costea <ciprianmarian.costea@nxp.com>
Signed-off-by: Stoica Cosmin-Stefan <cosmin.stoica@nxp.com>
Signed-off-by: Dan Nica <dan.nica@nxp.com>
Signed-off-by: Larisa Grigore <Larisa.Grigore@nxp.com>
Signed-off-by: Stefan-Gabriel Mirea <stefan-gabriel.mirea@nxp.com>
Signed-off-by: James Clark <james.clark@linaro.org>
Link: https://patch.msgid.link/20250522-james-nxp-spi-v2-13-bea884630cfb@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-06-08 23:35:39 +01:00
Andra-Teodora Ilie
0cb9ca1187
spi: spi-fsl-dspi: Enable modified transfer protocol on S32G
S32G supports modified transfer protocol where both host and target
devices sample later in the SCK period than in Classic SPI mode to allow
the logic to tolerate more delays in device pads and board traces. Set
MTFE bit in MCR register for frequencies higher than 25MHz.

Signed-off-by: Andra-Teodora Ilie <andra.ilie@nxp.com>
Signed-off-by: Bogdan-Gabriel Roman <bogdan-gabriel.roman@nxp.com>
Signed-off-by: Larisa Grigore <larisa.grigore@nxp.com>
Signed-off-by: James Clark <james.clark@linaro.org>
Link: https://patch.msgid.link/20250522-james-nxp-spi-v2-11-bea884630cfb@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-06-08 23:35:36 +01:00
Larisa Grigore
c5412ec5f6
spi: spi-fsl-dspi: Reinitialize DSPI regs after resuming for S32G
After resuming, DSPI registers (MCR and SR) need to be reinitialized for
S32G platforms.

Signed-off-by: Larisa Grigore <larisa.grigore@nxp.com>
Signed-off-by: James Clark <james.clark@linaro.org>
Link: https://patch.msgid.link/20250522-james-nxp-spi-v2-10-bea884630cfb@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-06-08 23:35:35 +01:00
Larisa Grigore
870d6fda18
spi: spi-fsl-dspi: Use DMA for S32G controller in target mode
Switch to DMA for target mode otherwise the controller is too slow to
feed TX FIFO and UNDERFLOW occurs frequently. DMA can work only with 8
and 16 bits per word. 32bits per word is not supported, this is a
hardware limitation, so we keep the controller mode in TCFQ mode.

Signed-off-by: Larisa Grigore <larisa.grigore@nxp.com>
Signed-off-by: Ciprian Marian Costea <ciprianmarian.costea@nxp.com>
Signed-off-by: James Clark <james.clark@linaro.org>
Link: https://patch.msgid.link/20250522-james-nxp-spi-v2-9-bea884630cfb@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-06-08 23:35:34 +01:00
Larisa Grigore
cac7e50541
spi: spi-fsl-dspi: Avoid setup_accel logic for DMA transfers
Repacking multiple smaller words into larger ones to make use of the
full FIFO doesn't save anything in DMA mode, so don't bother doing it.

Signed-off-by: Larisa Grigore <larisa.grigore@nxp.com>
Signed-off-by: James Clark <james.clark@linaro.org>
Link: https://patch.msgid.link/20250522-james-nxp-spi-v2-8-bea884630cfb@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-06-08 23:35:33 +01:00
Marius Trifu
e7397e4d3b
spi: spi-fsl-dspi: Use spi_alloc_target for target
spi_alloc_target should be used for target devices. This also sets
ctlr->target automatically so delete that line.

Signed-off-by: Marius Trifu <marius.trifu@nxp.com>
Signed-off-by: Larisa Grigore <larisa.grigore@nxp.com>
Signed-off-by: James Clark <james.clark@linaro.org>
Link: https://patch.msgid.link/20250522-james-nxp-spi-v2-7-bea884630cfb@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-06-08 23:35:32 +01:00
Larisa Grigore
70c0b17ee3
spi: spi-fsl-dspi: Add config and regmaps for S32G platforms
S32G adds SPI_{T,R}XFR4 and extends SPI_CTAR registers to 5. Add the
new regmaps, configs and bits.

dspi_volatile_ranges gets SPI_{T,R}XFR4 added which affects all
platforms, however they are further limited by dspi_yes_ranges.

Signed-off-by: Larisa Grigore <larisa.grigore@nxp.com>
Signed-off-by: James Clark <james.clark@linaro.org>
Link: https://patch.msgid.link/20250522-james-nxp-spi-v2-6-bea884630cfb@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-06-08 23:35:31 +01:00
James Clark
1672b06532
spi: spi-fsl-dspi: Define regmaps per device
Refactor the regmaps so they can be defined per device rather than
programmatically. This will allow us to add two new regmaps for S32G in
a later commit.

No functional changes.

Reviewed-by: Vladimir Oltean <olteanv@gmail.com>
Signed-off-by: James Clark <james.clark@linaro.org>
Link: https://patch.msgid.link/20250522-james-nxp-spi-v2-5-bea884630cfb@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-06-08 23:35:29 +01:00
James Clark
87a14a96bc
spi: spi-fsl-dspi: Re-use one volatile regmap for both device types
max_register overrides anything in the volatile ranges, so we can get
away with sharing the same one for both types. In a later commit we'll
add more devices so this avoids adding even more duplication. Also
replace the max_register magic numbers with their register definitions
so it's clearer what's going on.

No functional changes.

Reviewed-by: Vladimir Oltean <olteanv@gmail.com>
Signed-off-by: James Clark <james.clark@linaro.org>
Link: https://patch.msgid.link/20250522-james-nxp-spi-v2-4-bea884630cfb@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-06-08 23:35:28 +01:00
Dan Carpenter
2b74aea6d0
spi: spi-pci1xxxx: Fix error code in probe
Return the error code if pci_alloc_irq_vectors() fails.  Don't return
success.

Fixes: b4608e9441 ("spi: spi-pci1xxxx: Fix Probe failure with Dual SPI instance with INTx interrupts")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Reviewed-by: Thangaraj Samynathan <thangaraj.s@microchip.com>
Link: https://patch.msgid.link/aEKvDrUxD19GWi0u@stanley.mountain
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-06-08 23:30:05 +01:00
Huacai Chen
1dd6300883
spi: loongson: Fix build warnings about export.h
After commit a934a57a42 ("scripts/misc-check: check missing #include
<linux/export.h> when W=1") and 7d95680d64 ("scripts/misc-check:
check unnecessary #include <linux/export.h> when W=1"), we get some build
warnings with W=1:

drivers/spi/spi-loongson-core.c: warning: EXPORT_SYMBOL() is used, but #include <linux/export.h> is missing

So fix these build warnings for SPI/Loongson.

Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
Link: https://patch.msgid.link/20250608142939.172108-1-chenhuacai@loongson.cn
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-06-08 23:30:04 +01:00
Félix Piédallu
10c24e0d2f
spi: omap2-mcspi: Disable multi-mode when the previous message kept CS asserted
When the last transfer of a SPI message has the cs_change flag, the CS is kept
asserted after the message.
The next message can't use multi-mode because the CS will be briefly deasserted
before the first transfer.

Remove the early exit of the list_for_each_entry because the last transfer
actually needs to be always checked.

Fixes: d153ff4056 ("spi: omap2-mcspi: Add support for MULTI-mode")
Signed-off-by: Félix Piédallu <felix.piedallu@non.se.com>
Link: https://patch.msgid.link/20250606-cs_change_fix-v1-2-27191a98a2e5@non.se.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-06-08 23:29:52 +01:00
Félix Piédallu
a5bf527229
spi: omap2-mcspi: Disable multi mode when CS should be kept asserted after message
When the last transfer of a SPI message has the cs_change flag, the CS is kept
asserted after the message.
Multi-mode can't respect this as CS is deasserted by the hardware at the end of
the message.

Disable multi-mode when not applicable to the current message.

Fixes: d153ff4056 ("spi: omap2-mcspi: Add support for MULTI-mode")
Signed-off-by: Félix Piédallu <felix.piedallu@non.se.com>
Link: https://patch.msgid.link/20250606-cs_change_fix-v1-1-27191a98a2e5@non.se.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-06-08 23:29:51 +01:00
Linus Torvalds
7a912d0441 spi: Updates for v6.16
A small set of updates that came in during the merge window, we've got:
 
  - Some small fixes for the Broadcom and spi-pci1xxxx drivers
  - A change to the QPIC SNAND driver to flag that the error correction
    features are less useful than people might be expecting.
  - A new device ID for the SOPHGO SG2042.
  - The addition of Yang Shen as a Huawei maintainer.
 -----BEGIN PGP SIGNATURE-----
 
 iQEzBAABCgAdFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAmhBmMAACgkQJNaLcl1U
 h9BvAwf/dkfLLmAUNPhex0hQaj8aKbiN3NWMRbZPApPAdy+s9u3d6zW1BlZI6liK
 97PEgxQ1d60lxwKdPiYjhLuJTDGeEDSsGTUI5OXqz2hW08mfYQaRN96xZKwJf67G
 8y8u3rEZLbDs0vKorf3TG8KHTj1lBbfl9GwwzEFQlMUNdEDXnBadd+C08PMwIhdR
 PYJrARKV3aZ4GhaQwF6JsvLV2JomQ/ALES4RaW8hDgDdzjiqda0fKV0YWDZwa8E1
 08Pea9uUr78iAoohqO6rCQBqWCFms8HEpgz2NerY2CGMhrjnA64XTfSyRNp9q2O5
 gllrngHhluRPl2vM3JuO3fdiVk+xmA==
 =dFS2
 -----END PGP SIGNATURE-----

Merge tag 'spi-v6.16-merge-window' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi

Pull more spi updates from Mark Brown:
 "A small set of updates that came in during the merge window, we've
  got:

   - Some small fixes for the Broadcom and spi-pci1xxxx drivers

   - A change to the QPIC SNAND driver to flag that the error correction
     features are less useful than people might be expecting

   - A new device ID for the SOPHGO SG2042

   - The addition of Yang Shen as a Huawei maintainer"

* tag 'spi-v6.16-merge-window' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi:
  spi: spi-qpic-snand: document the limited bit error reporting capability
  spi: bcm63xx-hsspi: fix shared reset
  spi: bcm63xx-spi: fix shared reset
  MAINTAINERS: Update HiSilicon SFC driver maintainer
  MAINTAINERS: Update HiSilicon SPI Controller driver maintainer
  spi: dt-bindings: spi-sg2044-nor: Add SOPHGO SG2042
  spi: spi-pci1xxxx: Fix Probe failure with Dual SPI instance with INTx interrupts
2025-06-06 13:22:31 -07:00
Linus Torvalds
4c3b7df784 A big core MTD change is the introduction of a new class to always
register a master device. This is a problem that has been there forever:
 the "master" device was not always present depending on a number of
 heuristics such as the presence of fixed partitions and the absence of a
 Kconfig symbol to force its presence. This was a problem for runtime PM
 operations which might not have the "master" device available in all
 situation.
 
 The SPI NAND subsystem has seen the introduction of DTR operations (the
 equivalent of DDR transfers), which involved quite a few preparation
 patches for clarifying macro names.
 
 In the raw NAND subsystem, the brcmnand driver has been "fixed" for old
 legacy SoCs with an update of the ->exec_op() hook, there has been the
 introduction of a new controller driver named Loongson-1, and the
 Qualcomm driver has received quite a few misc fixes as well as a new
 compatible.
 
 Finally, Macornix SPI NOR entries have been cleaned-up and some SFDP
 table fixups for Macronix MX25L3255E have been merged.
 
 Aside from this, there is the usual load of misc improvement, fixes,
 and yaml conversion.
 -----BEGIN PGP SIGNATURE-----
 
 iQEzBAABCAAdFiEE9HuaYnbmDhq/XIDIJWrqGEe9VoQFAmg91NEACgkQJWrqGEe9
 VoR8egf+JPTtykQ+Bip9bHStgfpxi0+OKL81PUuPBsbs5C546u5t6ZRhoPsU+KqL
 ZTyUk3ys7HcSwZCuiS9V6ea6TNV1FvAVZm+ONpkuPnU60++z8YfVr8ZvtgT0IUXx
 COi+5ksdsTFZMyRG+VybRKnYNrTYB7j7CqVL8ifxq1XYWnYdhjy5PH4DgAKnBhGL
 523kN2eR85AhvJ4aulsKbcqQQYKvJIQbhjAKklA3yQVarDmoOdiSmndoZlRy+MDu
 B9DaRMvRRa/g1nI0stvR9K7FtdSrMYTg4kowR9jPRx0zEZXFFsZbASgcC+3G7HdK
 7rLFWrN+G6fitcEjeAnfyV+sKF48LA==
 =tW1t
 -----END PGP SIGNATURE-----

Merge tag 'mtd/for-6.16' of git://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux

Pull MTD updates from Miquel Raynal:
 "A big core MTD change is the introduction of a new class to always
  register a master device. This is a problem that has been there
  forever: the "master" device was not always present depending on a
  number of heuristics such as the presence of fixed partitions and the
  absence of a Kconfig symbol to force its presence. This was a problem
  for runtime PM operations which might not have the "master" device
  available in all situation.

  The SPI NAND subsystem has seen the introduction of DTR operations
  (the equivalent of DDR transfers), which involved quite a few
  preparation patches for clarifying macro names.

  In the raw NAND subsystem, the brcmnand driver has been "fixed" for
  old legacy SoCs with an update of the ->exec_op() hook, there has been
  the introduction of a new controller driver named Loongson-1, and the
  Qualcomm driver has received quite a few misc fixes as well as a new
  compatible.

  Finally, Macornix SPI NOR entries have been cleaned-up and some SFDP
  table fixups for Macronix MX25L3255E have been merged.

  Aside from this, there is the usual load of misc improvement, fixes,
  and yaml conversion"

* tag 'mtd/for-6.16' of git://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux: (42 commits)
  mtd: rawnand: brcmnand: legacy exec_op implementation
  mtd: rawnand: sunxi: Add randomizer configuration in sunxi_nfc_hw_ecc_write_chunk
  mtd: nand: brcmnand: fix NAND timeout when accessing eMMC
  mtd: nand: sunxi: Add randomizer configuration before randomizer enable
  mtd: spinand: esmt: fix id code for F50D1G41LB
  mtd: rawnand: brcmnand: remove unused parameters
  mtd: core: always create master device
  mtd: rawnand: loongson1: Fix inconsistent refcounting in ls1x_nand_chip_init()
  mtd: rawnand: loongson1: Fix error code in ls1x_nand_dma_transfer()
  mtd: rawnand: qcom: Fix read len for onfi param page
  mtd: rawnand: qcom: Fix last codeword read in qcom_param_page_type_exec()
  mtd: rawnand: qcom: Pass 18 bit offset from NANDc base to BAM base
  dt-bindings: mtd: qcom,nandc: Document the SDX75 NAND controller
  mtd: bcm47xxnflash: Add error handling for bcm47xxnflash_ops_bcm4706_ctl_cmd()
  mtd: rawnand: Use non-hybrid PCI devres API
  mtd: nand: ecc-mxic: Fix use of uninitialized variable ret
  mtd: spinand: winbond: Add support for W35N02JW and W35N04JW chips
  mtd: spinand: winbond: Add octal support
  mtd: spinand: winbond: Add support for W35N01JW in single mode
  mtd: spinand: winbond: Rename DTR variants
  ...
2025-06-02 11:08:17 -07:00
Gabor Juhos
57cf46cd1f
spi: spi-qpic-snand: document the limited bit error reporting capability
The QPIC hardware is not capable of reporting the exact number of the
corrected bit errors, it only reports the number of the corrected bytes.

Document this behaviour in the code, and also issue a warning message
to inform the user about it.

No functional changes.

Signed-off-by: Gabor Juhos <j4g8y7@gmail.com>
Link: https://patch.msgid.link/20250527-qpic-snand-limited-biterr-caps-v1-1-61f7cf87be1e@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-06-02 12:27:51 +01:00
Álvaro Fernández Rojas
3d6d84c8f2
spi: bcm63xx-hsspi: fix shared reset
Some bmips SoCs (bcm6362, bcm63268) share the same SPI reset for both SPI
and HSSPI controllers, so reset shouldn't be exclusive.

Fixes: 0eeadddbf0 ("spi: bcm63xx-hsspi: add reset support")
Reported-by: Jonas Gorski <jonas.gorski@gmail.com>
Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
Link: https://patch.msgid.link/20250529130915.2519590-3-noltari@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-05-30 11:42:38 +01:00
Álvaro Fernández Rojas
5ad20e3d8c
spi: bcm63xx-spi: fix shared reset
Some bmips SoCs (bcm6362, bcm63268) share the same SPI reset for both SPI
and HSSPI controllers, so reset shouldn't be exclusive.

Fixes: 38807adeaf ("spi: bcm63xx-spi: add reset support")
Reported-by: Jonas Gorski <jonas.gorski@gmail.com>
Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
Link: https://patch.msgid.link/20250529130915.2519590-2-noltari@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-05-30 11:42:38 +01:00
Linus Torvalds
5722a6cecf spi: Updates for v6.16
This bulk of the changes in this release are driver work, as well as
 new device support we have some important work on performance over
 several drivers, and big overhauls for maintainability on a couple too.
 Highlights include:
 
  - Big cleanups of the sh-msiof driver from Geert Uytterhoeven, and of
    the NXP FSPI driver from Haibo Chen.
  - Performance improvements for the AXI SPI engine.
  - Support for writes to memory mapped flashes on Renesas devices.
  - Integrated DMA support for Tegra210 QSPI, used by the Tegra234.
  - DMA support for Amlogic SPI controllers.
  - Support for AMD HID2, Qualcomm IPQ5018, Renesas RZ/G3E, Rockchip
    RK3528 and Samsung Exynos Autov920.
 
 An update to fix some issues with the Atmel QSPI driver runtime PM
 pulled in a new API from the PM core, and the Renesas memory mapped
 write changes pull in some code that's shared in drivers/memory.
 -----BEGIN PGP SIGNATURE-----
 
 iQEzBAABCgAdFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAmgzCzkACgkQJNaLcl1U
 h9DF5gf+MlaB2j6ggH/OnXdV6aQTcjta357+ptWH3CDQbx0nsMj50i+eqxhzOK69
 tyOMX0gcqo8bBQq1mhm3Z2fDYbYYRKwf7OwymHD1KGNGn9zegORNw790/XGTeoMo
 m5f9Trz9UNP+7NjWuOioKoy6zghp4Ti2WAAUPhGUQBnyaV269bonNvisRtqnDP5u
 nOu1DYANZqL3icuUIdJ3Aklmn4On1svUPuE9HOn/GNocZZWegcCHfBjmSRuLUAGO
 RR1jP/d+RfSvTSrdqZGwrfWLFBBirjSLXNB1g7sjiVTnSseuBnOZ/z7PuBQQ+NuB
 ENyoQXNLFZKMTQ5wmuQpXnwIIXsxYg==
 =FmJ2
 -----END PGP SIGNATURE-----

Merge tag 'spi-v6.16' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi

Pull spi updates from Mark Brown:
 "The bulk of the changes in this release are driver work, as well as
  new device support we have some important work on performance over
  several drivers, and big overhauls for maintainability on a couple
  too. Highlights include:

   - Big cleanups of the sh-msiof driver from Geert Uytterhoeven, and of
     the NXP FSPI driver from Haibo Chen

   - Performance improvements for the AXI SPI engine

   - Support for writes to memory mapped flashes on Renesas devices

   - Integrated DMA support for Tegra210 QSPI, used by the Tegra234

   - DMA support for Amlogic SPI controllers

   - Support for AMD HID2, Qualcomm IPQ5018, Renesas RZ/G3E, Rockchip
     RK3528 and Samsung Exynos Autov920

  An update to fix some issues with the Atmel QSPI driver runtime PM
  pulled in a new API from the PM core, and the Renesas memory mapped
  write changes pull in some code that's shared in drivers/memory"

* tag 'spi-v6.16' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi: (90 commits)
  spi: spi-qpic-snand: return early on error from qcom_spi_io_op()
  spi: loopback-test: fix up const pointer issue in rx_ranges_cmp()
  spi: gpio: fix const issue in spi_to_spi_gpio()
  spi: spi-qpic-snand: remove superfluous parameters of qcom_spi_check_error()
  dt-bindings: spi: samsung: add exynosautov920-spi compatible
  spi: spi-qpic-snand: reuse qcom_spi_check_raw_flash_errors()
  spi: dt-bindings: Add rk3528-spi compatible
  spi: spi_amd: Update Kconfig dependencies
  spi: spi_amd: Add HIDDMA basic write support
  spi: spi_amd: Remove read{q,b} usage on DMA buffer
  spi: sh-msiof: Move register definitions to <linux/spi/sh_msiof.h>
  spi: sh-msiof: Document frame start sync pulse mode
  spi: sh-msiof: Double maximum DMA transfer size using two groups
  spi: sh-msiof: Simplify BRG's Division Ratio
  spi: sh-msiof: Increase TX FIFO size for R-Car V4H/V4M
  spi: sh-msiof: Correct RX FIFO size for R-Car Gen3
  spi: sh-msiof: Correct RX FIFO size for R-Car Gen2
  spi: sh-msiof: Add core support for dual-group transfers
  spi: sh-msiof: Correct SIMDR2_GRPMASK
  spi: sh-msiof: SIFCTR bitfield conversion
  ...
2025-05-27 15:53:55 -07:00
Linus Torvalds
a9e6060bb2 sound updates for 6.16-rc1
We've received a lot of activities in this cycle, mostly about leaf
 driver codes rather than the core part, but with a good mixture of
 code cleanups and new driver additions.  Below are some highlights:
 
 * ASoC:
 - Support for automatically enumerating DAIs from standards conforming
   SoundWire SDCA devices; not much used as of this writing, rather for
   future implementations
 - Conversion of quite a few drivers to newer GPIO APIs
 - Continued cleanups and helper usages in allover places
 - Support for a wider range of Intel AVS platforms
 - Support for AMD ACP 7.x platforms, Cirrus Logic CS35L63 and CS48L32
   Everest Semiconductor ES8375 and ES8389, Longsoon-1 AC'97
   controllers, nVidia Tegra264, Richtek ALC203 and RT9123 and Rockchip
   SAI controllers
 
 * HD-audio:
 - Lots of cleanups of TAS2781 codec drivers
 - A new HD-audio control bound via ACPI for Nvidia
 - Support for Tegra264, Intel WCL, usual new codec quirks
 
 * USB-audio:
 - Fix a race at removal of MIDI device
 - Pioneer DJM-V10 support, Scarlett2 driver cleanups
 
 * Misc:
 - Cleanups of deprecated PCI functions
 - Removal of unused / dead function codes
 -----BEGIN PGP SIGNATURE-----
 
 iQJCBAABCAAsFiEEIXTw5fNLNI7mMiVaLtJE4w1nLE8FAmg0KfoOHHRpd2FpQHN1
 c2UuZGUACgkQLtJE4w1nLE/Opg/9H5ZaQpuSj9z5YiG6q3gNzy7lsfcvCqoAqgLW
 w9tVo5cXFH7t9+9EZUhB73sxI0VWNJsF83l+vnMqxCn/SkUzey3CPThiGQuhJtjh
 oRsqeTxxhuHjOXDapnbHJ2r9rMoAqmnabATdQYKKkYZEV8bBeBQQWFLNGtoBCE24
 xmIsyvM7lycOTZaf43uUQVJNqV86ZxV78y7Zoit5l11iZZY78j0c7i7naxSHd+Vr
 WVsxd90urSHBo6EsXyHMtaqBrWLTQmhA5v9UU0k6wm7DLKrNmb1fUo0vQlKk/EXn
 VipFz6V90IzHRbti6nZefSi2UjwaTneHa+FTspPZjOPG19q+h4MCF0s1gUNou6YG
 nqSLU+T37TEZeWpNurhiAwDNKax3/F4Pt7Hz+u4pMcnx25bNvKCb5LMgNU9l9stV
 Ar9X4rC5zfqdSsHTFOUgndV+GilqTgUk2efCW89fH2BmkZGM4Xd0JRp+xy2ECvzl
 RQq4PPvKcqt0/9GphLkLhpQCh5rWpXahVsmxH7GVrtMUlvRYd+FbKUrlalwOfJqE
 j8SJLQKe3yHztH+AXIaIigLaDA0qtCGjnEGSokKGXmCdFH1Pmdm+mnrPFw/wrCXv
 9uvWZvEAhqP5TiH5n8Yw50n8p4X7IDNBALeKFukQVi7qKV4R/aYWN1IaQMoZfVUZ
 duVWPZg=
 =ApEf
 -----END PGP SIGNATURE-----

Merge tag 'sound-6.16-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound

Pull sound updates from Takashi Iwai:
 "We've received a lot of activities in this cycle, mostly about leaf
  driver codes rather than the core part, but with a good mixture of
  code cleanups and new driver additions. Below are some highlights:

  ASoC:
   - Support for automatically enumerating DAIs from standards
     conforming SoundWire SDCA devices; not much used as of this
     writing, rather for future implementations
   - Conversion of quite a few drivers to newer GPIO APIs
   - Continued cleanups and helper usages in allover places
   - Support for a wider range of Intel AVS platforms
   - Support for AMD ACP 7.x platforms, Cirrus Logic CS35L63 and CS48L32
     Everest Semiconductor ES8375 and ES8389, Longsoon-1 AC'97
     controllers, nVidia Tegra264, Richtek ALC203 and RT9123 and
     Rockchip SAI controllers

  HD-audio:
   - Lots of cleanups of TAS2781 codec drivers
   - A new HD-audio control bound via ACPI for Nvidia
   - Support for Tegra264, Intel WCL, usual new codec quirks

  USB-audio:
   - Fix a race at removal of MIDI device
   - Pioneer DJM-V10 support, Scarlett2 driver cleanups

  Misc:
   - Cleanups of deprecated PCI functions
   - Removal of unused / dead function codes"

* tag 'sound-6.16-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound: (364 commits)
  firmware: cs_dsp: Fix OOB memory read access in KUnit test
  ASoC: codecs: add support for ES8375
  ASoC: dt-bindings: Add Everest ES8375 audio CODEC
  ALSA: hda: acpi: Make driver's match data const static
  ALSA: hda: acpi: Use SYSTEM_SLEEP_PM_OPS()
  ALSA: atmel: Replace deprecated strcpy() with strscpy()
  ALSA: core: fix up bus match const issues.
  ASoC: wm_adsp: Make cirrus_dir const
  ASoC: tegra: Tegra264 support in isomgr_bw
  ASoC: tegra: AHUB: Add Tegra264 support
  ASoC: tegra: ADX: Add Tegra264 support
  ASoC: tegra: AMX: Add Tegra264 support
  ASoC: tegra: I2S: Add Tegra264 support
  ASoC: tegra: Update PLL rate for Tegra264
  ASoC: tegra: ASRC: Update ARAM address
  ASoC: tegra: ADMAIF: Add Tegra264 support
  ASoC: tegra: CIF: Add Tegra264 support
  dt-bindings: ASoC: Document Tegra264 APE support
  dt-bindings: ASoC: admaif: Add missing properties
  ASoC: dt-bindings: audio-graph-card2: reference audio-graph routing property
  ...
2025-05-27 15:05:18 -07:00
Thangaraj Samynathan
b4608e9441
spi: spi-pci1xxxx: Fix Probe failure with Dual SPI instance with INTx interrupts
Fixes a probe failure that occurs when dual SPI controllers are
enabled and INTx interrupts are used. Reduces the minimum required
number of interrupt vectors to 1 and registers a shared ISR when
the allocated vectors are fewer than the number of controllers.
This change ensures that the probe succeeds even with limited
vectors, restoring INTx functionality when multiple SPI
controllers are present.

Signed-off-by: Thangaraj Samynathan <thangaraj.s@microchip.com>
Link: https://patch.msgid.link/20250527103244.26861-1-thangaraj.s@microchip.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-05-27 12:14:27 +01:00
Mark Brown
b00d6864a4
spi: spi-qpic-snand: extend bitmasks usage
Merge series from Gabor Juhos <j4g8y7@gmail.com>:

The two patches in the series are extending the usage of FIELD_PREP()
macro and predefined bitmasks usage in the driver.
2025-05-23 16:51:35 +01:00
Gabor Juhos
72b17676d3
spi: spi-qpic-snand: return early on error from qcom_spi_io_op()
When submitting of the descriptors fails, it is quite likely that
the register read buffer contains no valid data. Even if the data
is valid the function returns with an error code anyway.

Change the code to return early if qcom_submit_descs() fails to
avoid superfluously copying possibly invalid data.

Also change the return statement at the end of the function to use
zero value to indicate success obviusly.

Signed-off-by: Gabor Juhos <j4g8y7@gmail.com>
Link: https://patch.msgid.link/20250515-qpic-snand-early-error-v1-1-681c87611213@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-05-23 16:51:22 +01:00
Larisa Grigore
7aba292eb1
spi: spi-fsl-dspi: Reset SR flags before sending a new message
If, in a previous transfer, the controller sends more data than expected
by the DSPI target, SR.RFDF (RX FIFO is not empty) will remain asserted.
When flushing the FIFOs at the beginning of a new transfer (writing 1
into MCR.CLR_TXF and MCR.CLR_RXF), SR.RFDF should also be cleared.
Otherwise, when running in target mode with DMA, if SR.RFDF remains
asserted, the DMA callback will be fired before the controller sends any
data.

Take this opportunity to reset all Status Register fields.

Fixes: 5ce3cc5674 ("spi: spi-fsl-dspi: Provide support for DSPI slave mode operation (Vybryd vf610)")
Signed-off-by: Larisa Grigore <larisa.grigore@nxp.com>
Signed-off-by: James Clark <james.clark@linaro.org>
Link: https://patch.msgid.link/20250522-james-nxp-spi-v2-3-bea884630cfb@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-05-22 16:05:26 +01:00
Bogdan-Gabriel Roman
8a30a6d35a
spi: spi-fsl-dspi: Halt the module after a new message transfer
The XSPI mode implementation in this driver still uses the EOQ flag to
signal the last word in a transmission and deassert the PCS signal.
However, at speeds lower than ~200kHZ, the PCS signal seems to remain
asserted even when SR[EOQF] = 1 indicates the end of a transmission.
This is a problem for target devices which require the deassertation of
the PCS signal between transfers.

Hence, this commit 'forces' the deassertation of the PCS by stopping the
module through MCR[HALT] after completing a new transfer. According to
the reference manual, the module stops or transitions from the Running
state to the Stopped state after the current frame, when any one of the
following conditions exist:
- The value of SR[EOQF] = 1.
- The chip is in Debug mode and the value of MCR[FRZ] = 1.
- The value of MCR[HALT] = 1.

This shouldn't be done if the last transfer in the message has cs_change
set.

Fixes: ea93ed4c18 ("spi: spi-fsl-dspi: Use EOQ for last word in buffer even for XSPI mode")
Signed-off-by: Bogdan-Gabriel Roman <bogdan-gabriel.roman@nxp.com>
Signed-off-by: Larisa Grigore <larisa.grigore@nxp.com>
Signed-off-by: James Clark <james.clark@linaro.org>
Link: https://patch.msgid.link/20250522-james-nxp-spi-v2-2-bea884630cfb@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-05-22 16:05:25 +01:00
Larisa Grigore
283ae0c65e
spi: spi-fsl-dspi: restrict register range for regmap access
DSPI registers are NOT continuous, some registers are reserved and
accessing them from userspace will trigger external abort, add regmap
register access table to avoid below abort.

  For example on S32G:

  # cat /sys/kernel/debug/regmap/401d8000.spi/registers

  Internal error: synchronous external abort: 96000210 1 PREEMPT SMP
  ...
  Call trace:
  regmap_mmio_read32le+0x24/0x48
  regmap_mmio_read+0x48/0x70
  _regmap_bus_reg_read+0x38/0x48
  _regmap_read+0x68/0x1b0
  regmap_read+0x50/0x78
  regmap_read_debugfs+0x120/0x338

Fixes: 1acbdeb92c ("spi/fsl-dspi: Convert to use regmap and add big-endian support")
Co-developed-by: Xulin Sun <xulin.sun@windriver.com>
Signed-off-by: Xulin Sun <xulin.sun@windriver.com>
Signed-off-by: Larisa Grigore <larisa.grigore@nxp.com>
Signed-off-by: James Clark <james.clark@linaro.org>
Link: https://patch.msgid.link/20250522-james-nxp-spi-v2-1-bea884630cfb@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-05-22 16:05:24 +01:00
Greg Kroah-Hartman
e7f3d11567
spi: loopback-test: fix up const pointer issue in rx_ranges_cmp()
When a list head is a const pointer, the list entry for that head also
must remain a const pointer, otherwise we are just "throwing it away"
for no good reason.  Fix this up by properly marking these structures as
const.

Cc: Mark Brown <broonie@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Link: https://patch.msgid.link/2025052213-semifinal-sublevel-d631@gregkh
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-05-22 12:03:35 +01:00
Greg Kroah-Hartman
2712a7d362
spi: gpio: fix const issue in spi_to_spi_gpio()
While the struct spi_device * passed into spi_to_spi_gpio() is a const
one, the struct spi_bitbang * that is retrieved from the controller
field in the spi_device is NOT a const pointer, as it is coming from the
spi_controller_get_devdata() call, and then passed to container_of()
which would strip off the const attribute for no good reason (i.e. if a
const pointer is passed to container_of() it still is const coming out).

Fix this all up by properly declaring the struct spi_bitbang * as not
const.

Cc: Mark Brown <broonie@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Link: https://patch.msgid.link/2025052225-scallion-ritzy-dbbd@gregkh
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-05-22 12:03:34 +01:00
Gabor Juhos
0f529570ec
spi: spi-qpic-snand: remove superfluous parameters of qcom_spi_check_error()
The qcom_spi_check_error() function determines the errors of a previous
page read operation solely by using the cached register values in the
register read buffer. The data pointed by the 'data_buf' and the 'oob_buf'
parameters are not used for that at all.

Remove the superfluous parameters of the function along with the related
local variables to simplify the code. Also, remove the variables from the
caller functions which became unused due to the change.

Note:
Althought the similar parse_read_errors() function in the 'qcom_nand'
driver has the same parameters, but that function passes down the
pointers to check_for_erased_page() at the end of the function.

It is not clear, that a similar call is missing here, or the superfluous
parameters are simply leftovers of the development process. Nevertheless,
if additional code is needed, the parameters can be added back later.

Signed-off-by: Gabor Juhos <j4g8y7@gmail.com>
Link: https://patch.msgid.link/20250520-qpic-snand-superfluous-params-v1-1-86dd4963e90f@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-05-21 18:56:08 +01:00
Gabor Juhos
4026c6b51c
spi: spi-qpic-snand: reuse qcom_spi_check_raw_flash_errors()
The qcom_spi_check_raw_flash_errors() function can be used to
verify the flash status after raw operations.

Move the function slightly up in the code and change the
qcom_spi_read_last_cw() function to call it instead of using
an open coded implementation of the same check.

Signed-off-by: Gabor Juhos <j4g8y7@gmail.com>
Link: https://patch.msgid.link/20250514-qpic-snand-error-check-v1-1-c0ebd3aae72a@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-05-21 18:56:06 +01:00
Mark Brown
5b31d2d81a
spi: sh-msiof: Transfer size improvements and I2S
Merge series from Geert Uytterhoeven <geert+renesas@glider.be>:

This patch series (A) improves single transfer sizes in the MSIOF
driver, using two methods:
  - By increasing the assumed FIFO sizes, impacting both PIO and DMA
    transfers,
  - By using two groups, impacting DMA transfers,
and (B) lets the recently-introduced MSIOF I2S drive reuse the SPI
driver's register definitions.  All of this is covered with a thick
sauce of fixes for (harmless) bugs, cleanups, and refactorings.

Note that the driver uses the limitations as specified in the hardware
documentation.  For discovering the actual FIFO sizes, I wrote some
crude test code that can be found at [2].

This is based on spi/for-next and sound-asoc/for-next, and has been
tested on a variery of R-Car SoCs.

[1] https://lore.kernel.org/cover.1746180072.git.geert+renesas@glider.be
[2] https://git.kernel.org/pub/scm/linux/kernel/git/geert/renesas-drivers.git/log/?h=topic/msiof-fifo
2025-05-20 10:34:25 +01:00
Mark Brown
831962e9d7
Add sound card support for QCS9100 and QCS9075
Merge series from Mohammad Rafi Shaik <mohammad.rafi.shaik@oss.qualcomm.com>:

This patchset adds support for sound card on Qualcomm QCS9100 and
QCS9075 boards.
2025-05-20 10:34:09 +01:00
Raju Rangoju
dbb7997419
spi: spi_amd: Update Kconfig dependencies
Add X86 and SPI_MEM as dependencies for the spi_amd driver to ensure it is
built only on relevant platforms and with the required SPI memory
framework.

Co-developed-by: Akshata MukundShetty <akshata.mukundshetty@amd.com>
Signed-off-by: Akshata MukundShetty <akshata.mukundshetty@amd.com>
Signed-off-by: Raju Rangoju <Raju.Rangoju@amd.com>
Link: https://patch.msgid.link/20250516100658.585654-4-Raju.Rangoju@amd.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-05-19 13:13:38 +01:00
Raju Rangoju
a5733666c7
spi: spi_amd: Add HIDDMA basic write support
SPI index mode has hardware limitation of transferring only 64 bytes per
transaction due to fixed number of FIFO registers. This constraint leads to
performance issues when reading/writing data to/from NAND/NOR flash
devices, as the controller must issue multiple requests to read/write
64-byte chunks, even if the slave can transfer up to 2 or 4 KB in a single
transaction.

The AMD HID2 SPI controller supports DMA mode, allowing for reading/writing
up to 4 KB of data in a single transaction. The existing spi_amd driver
already supports HID2 DMA read operations.

This patch introduces changes to implement HID2 DMA single mode basic write
support for the HID2 SPI controller.

Co-developed-by: Krishnamoorthi M <krishnamoorthi.m@amd.com>
Signed-off-by: Krishnamoorthi M <krishnamoorthi.m@amd.com>
Co-developed-by: Akshata MukundShetty <akshata.mukundshetty@amd.com>
Signed-off-by: Akshata MukundShetty <akshata.mukundshetty@amd.com>
Signed-off-by: Raju Rangoju <Raju.Rangoju@amd.com>
Link: https://patch.msgid.link/20250516100658.585654-3-Raju.Rangoju@amd.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-05-19 13:13:37 +01:00
Raju Rangoju
8cd079e69d
spi: spi_amd: Remove read{q,b} usage on DMA buffer
Add changes to replace the usage of read{q,b} MMIO accessors with direct
memory copy logic for reading data from DMA buffer.

Co-developed-by: Krishnamoorthi M <krishnamoorthi.m@amd.com>
Signed-off-by: Krishnamoorthi M <krishnamoorthi.m@amd.com>
Signed-off-by: Raju Rangoju <Raju.Rangoju@amd.com>
Link: https://patch.msgid.link/20250516100658.585654-2-Raju.Rangoju@amd.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-05-19 13:13:36 +01:00
Geert Uytterhoeven
ec23a899d9
spi: sh-msiof: Move register definitions to <linux/spi/sh_msiof.h>
Move the MSIOF register and register bit definitions from the MSIOF SPI
driver to the existing header file <linux/spi/sh_msiof.h>, so they can
be shared with the MSIOF I2S driver.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://patch.msgid.link/066d1086973eb309006258484e9fe8138807e565.1747401908.git.geert+renesas@glider.be
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-05-19 11:55:37 +01:00
Geert Uytterhoeven
8f836868d8
spi: sh-msiof: Document frame start sync pulse mode
Unused, but nice to have it documented.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://patch.msgid.link/3d3acaab4a4125106a0655d28c09c050341c5eeb.1747401908.git.geert+renesas@glider.be
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-05-19 11:55:36 +01:00
Geert Uytterhoeven
acb47aa9b1
spi: sh-msiof: Double maximum DMA transfer size using two groups
The maximum DMA transfer size is limited by the maximum values that can
be written to the word count fields (WDLENx) in the Transmit and Control
Data Registers (SITDR2/SIRDR2).  As all MSIOF variants support
transferring data of multiple (two or four) groups, the maximum size can
be doubled by using two groups instead of one, thus reducing setup
overhead for very large SPI transfers.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://patch.msgid.link/bad522c76b8d225c195433977b22f95015cf2612.1747401908.git.geert+renesas@glider.be
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-05-19 11:55:35 +01:00
Geert Uytterhoeven
39d0856f41
spi: sh-msiof: Simplify BRG's Division Ratio
As FIELD_PREP() masks the value to be stored in the field, the Baud Rate
Generator's Division Ratio handling can be simplified from a look-up
table to a single subtraction.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://patch.msgid.link/e736221942b0381fb53dc64109a1389f7ec5f44a.1747401908.git.geert+renesas@glider.be
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-05-19 11:55:34 +01:00
Geert Uytterhoeven
5b91dc7e3e
spi: sh-msiof: Increase TX FIFO size for R-Car V4H/V4M
The MSIOF transmit FIFOs on R-Car V4H and V4M have 256 stages.
Add a new family-specific match entry to handle this.
Add quirk match entries for older R-Car Gen4 Socs (R-Car V3U and S4-8)
that have transmit FIFOs with only 64 stages, just like on R-Car Gen3.

Update the (unused) definition of SIFCTR_TFUA for consistency.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://patch.msgid.link/69cb5fc48f034d37484fa127b9864a1971a83417.1747401908.git.geert+renesas@glider.be
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-05-19 11:55:33 +01:00
Geert Uytterhoeven
f669c2827d
spi: sh-msiof: Correct RX FIFO size for R-Car Gen3
According to the R-Car Gen3 Hardware Manual Errata for Rev 0.55 of
September 28, 2017, the MSIOF receive FIFOs on R-Car Gen3 SoCs have room
for 256 words of 32 bits.

Note that this change has no actual impact on the behavior of the
driver, as SPI_CONTROLLER_MUST_TX is set, and transfer size is currenty
limited to the minimum of the transmit and receive FIFO sizes.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://patch.msgid.link/6f74508ea4681aa0b7c6bf6810eab026725e75a3.1747401908.git.geert+renesas@glider.be
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-05-19 11:55:32 +01:00
Geert Uytterhoeven
1ab2c8c45f
spi: sh-msiof: Correct RX FIFO size for R-Car Gen2
According to Renesas Technical Updates TN-RCS-S068A/E, the MSIOF receive
FIFOs on R-Car Gen2 SoCs have room for 128 words of 32 bits.

Note that this change has no actual impact on the behavior of the
driver, as SPI_CONTROLLER_MUST_TX is set, and transfer size is currenty
limited to the minimum of the transmit and receive FIFO sizes.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://patch.msgid.link/fd11933f932df81d84f417a21e2179bd4fdcfdc1.1747401908.git.geert+renesas@glider.be
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-05-19 11:55:32 +01:00
Geert Uytterhoeven
955f7ce668
spi: sh-msiof: Add core support for dual-group transfers
All MSIOF variants support transferring data of multiple (2 or 4)
groups.  Add definitions for the register bits related to multiple
groups, and enhance sh_msiof_spi_set_mode_regs() to accept a second
group size.

For now the second group is unused.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://patch.msgid.link/be75e20cfcd2a6c0d73ab09e0126f902911adc69.1747401908.git.geert+renesas@glider.be
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-05-19 11:55:31 +01:00
Geert Uytterhoeven
acedbff0f0
spi: sh-msiof: Correct SIMDR2_GRPMASK
The Group Output Mask is not a single bit, but a bit field, containing
one bit for each of the four possible groups.  Correct the definition.

Note that this change has no direct impact, as the driver only uses
the first group.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://patch.msgid.link/ad268d67807cb7e544eddaf7a056793482a965d4.1747401908.git.geert+renesas@glider.be
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-05-19 11:55:30 +01:00
Geert Uytterhoeven
8f3903b382
spi: sh-msiof: SIFCTR bitfield conversion
Convert MSIOF FIFO Control Register field accesses to use the
FIELD_PREP() bitfield access macro.

This gets rid of explicit shifts and custom field preparation macros.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://patch.msgid.link/0bf4c366381a8999c9755285272897300852bc18.1747401908.git.geert+renesas@glider.be
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-05-19 11:55:29 +01:00
Geert Uytterhoeven
bd8d6658e7
spi: sh-msiof: SICTR bitfield conversion
Convert MSIOF Control Register field accesses to use the FIELD_PREP()
bitfield access macro.

This gets rid of explicit shifts.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://patch.msgid.link/4511c678c8fce5969eb50ffa7372d53396ff80ff.1747401908.git.geert+renesas@glider.be
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-05-19 11:55:28 +01:00
Geert Uytterhoeven
c2cc4b72fc
spi: sh-msiof: SITSCR/SIRSCR bitfield conversion
Convert MSIOF Transmit and Receive Clock Select Register field accesses
to use the FIELD_PREP() bitfield access macro.

This gets rid of explicit shifts and custom field preparation macros.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://patch.msgid.link/f2462c99b6ea2e45b995ab4509c2f039043da032.1747401908.git.geert+renesas@glider.be
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-05-19 11:55:27 +01:00
Geert Uytterhoeven
386cc5207b
spi: sh-msiof: SITMDR2 and SIRMDR2 bitfield conversion
Convert MSIOF Transmit and Receive Mode Register 2 field accesses to use
the FIELD_PREP() bitfield access macro.

This gets rid of explicit shifts and custom field preparation macros.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://patch.msgid.link/135b92d010a71e2c224feab3a5792724b4e60ff1.1747401908.git.geert+renesas@glider.be
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-05-19 11:55:26 +01:00
Geert Uytterhoeven
6bae252a94
spi: sh-msiof: SITMDR1/SIRMDR1 bitfield conversion
Convert MSIOF Transmit and Receive Mode Register 1 field accesses to use
the FIELD_PREP() bitfield access macro.

This gets rid of explicit shifts.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://patch.msgid.link/9685c54e752b8ef4256c9b281e9d8292e71d222e.1747401908.git.geert+renesas@glider.be
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-05-19 11:55:25 +01:00
Geert Uytterhoeven
74cb19c943
spi: sh-msiof: Make words/fs unsigned in FIFO helpers
Make the words and fs parameters of the various FIFO filler and
emptier functions unsigned, as they can never be negative.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://patch.msgid.link/a7b13ecb1811148227ec8c883079085ed1ea6eac.1747401908.git.geert+renesas@glider.be
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-05-19 11:55:24 +01:00
Geert Uytterhoeven
b4eec5cdf1
spi: sh-msiof: Make words/bits unsigned in sh_msiof_spi_txrx_once()
Make the words and bits parameters of sh_msiof_spi_txrx_once() unsigned,
as that matches what is passed by the caller.

This allows us to replace min_t() by the safer min().

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://patch.msgid.link/30eff1052642a4bcb0f1bc4bed7aae25d355a7dc.1747401908.git.geert+renesas@glider.be
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-05-19 11:55:23 +01:00
Geert Uytterhoeven
3dd5ed19a2
spi: sh-msiof: Use bool for boolean flags
Use bools instead of integers for boolean flags, which allows us to
remove the "!!" idiom from several expressions.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://patch.msgid.link/35cd51bdfb3c810911a5be757e0ce5bb29dcc755.1747401908.git.geert+renesas@glider.be
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-05-19 11:55:22 +01:00
Geert Uytterhoeven
74df74ee83
spi: sh-msiof: Complete using dev in sh_msiof_spi_probe()
Commit c4887bd4b3 ("spi: sh-msiof: use dev in
sh_msiof_spi_probe()") forgot to convert one instance.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Acked-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://patch.msgid.link/88d271b2d16c6ad7f174858894573f91cec1bc90.1747401908.git.geert+renesas@glider.be
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-05-19 11:55:21 +01:00
Geert Uytterhoeven
0941d51666
spi: sh-msiof: Fix maximum DMA transfer size
The maximum amount of data to transfer in a single DMA request is
calculated from the FIFO sizes (which is technically not 100% correct,
but a simplification, as it is limited by the maximum word count values
in the Transmit and Control Data Registers).  However, in case there is
both data to transmit and to receive, the transmit limit is overwritten
by the receive limit.

Fix this by using the minimum applicable FIFO size instead.  Move the
calculation outside the loop, so it is not repeated for each individual
DMA transfer.

As currently tx_fifo_size is always equal to rx_fifo_size, this bug had
no real impact.

Fixes: fe78d0b769 ("spi: sh-msiof: Fix FIFO size to 64 word from 256 word")
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://patch.msgid.link/d9961767a97758b2614f2ee8afe1bd56dc900a60.1747401908.git.geert+renesas@glider.be
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-05-19 11:55:20 +01:00
Geert Uytterhoeven
ee44d3fc9d
spi: sh-msiof: Remove unneeded compatible values
The Clock-Synchronized Serial Interfaces with FIFO (MSIOF) driver
matches against both SoC-specific and family-specific compatible values
to maintain backwards-compatibility with old DTBs predating the
introduction of the family-specific compatible values.

For RZ/G1, the SoC-specific compatible match entry can be removed from
the driver: their DT always had the family-specific compatible values,
and thus there was never a need to add the SoC-specific compatible
values to the driver.

For R-Car Gen2 and M3-W, the SoC-specific compatible match entries can
be removed, too, as there are a few points in time where DT
backwards-compatibility was broken for other reasons:
  - Legacy DT clock support is no longer supported since commit
    58256143cf ("clk: renesas: Remove R-Car Gen2 legacy DT clock
    support") in v5.5, and the addition of "renesas,rcar-gen2-msiof" to
    DTS in v4.11 predates the completion of the clock conversion in
    v4.15,
  - Legacy DT LVDS support is no longer supported since commit
    841281fe52 ("drm: rcar-du: Drop LVDS device tree backward
    compatibility") in v5.18, and the addition of
    "renesas,rcar-gen3-msiof" in commit 8b51f97138 ("arm64: dts:
    r8a7796: Use R-Car Gen 3 fallback binding for msiof nodes") in v4.11
    predates the LVDS conversion in commit 58e8ed2ee9 ("arm64:
    dts: renesas: Convert to new LVDS DT bindings") in v4.20.

For R-Car H3, the SoC-specific compatible match entry cannot be removed,
as its purpose is to handle an SoC-specific quirk.

Suggested-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://patch.msgid.link/d33393ac7536bc3f0f624b079f70d80dd19843db.1747401908.git.geert+renesas@glider.be
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-05-19 11:55:19 +01:00
Geert Uytterhoeven
0e1c7d0591
spi: sh-msiof: Drop comma after OF match table sentinel
It does not make sense to have a comma after a sentinel, as any new
elements must be added before the sentinel.

Add a comment to clarify the purpose of the empty element.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://patch.msgid.link/2ab5745407339ba54b63c3e6410082c7c566bf95.1747401908.git.geert+renesas@glider.be
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-05-19 11:55:18 +01:00
Gabor Juhos
76ebfa371f
spi: spi-qpic-snand: extend FIELD_PREP() macro usage
Large part of the code uses the FIELD_PREP() macro already to construct
values to be written to hardware registers. Change the code to use also
the macro for more registers of which the corresponding bitmasks are
defined already.

This makes the code more readable. It also syncs the affected
codes with their counterparts in the 'qcom_nandc' driver, so it
makes it easier to spot the differences between the two
implementations.

No functional changes intended.

Signed-off-by: Gabor Juhos <j4g8y7@gmail.com>
Reviewed-by: Md Sadre Alam <quic_mdalam@quicinc.com>
Link: https://patch.msgid.link/20250515-qpic-snand-use-bitmasks-v1-2-11729aeae73b@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-05-16 13:18:21 +02:00
Gabor Juhos
2abf107dcd
spi: spi-qpic-snand: use CW_PER_PAGE_MASK bitmask
Change the code to use the already defined CW_PER_PAGE_MASK
bitmask along with the FIELD_PREP() macro instead of using
magic values.

This makes the code more readable. It also syncs the affected
codes with their counterparts in the 'qcom_nandc' driver, so it
makes it easier to spot the differences between the two
implementations.

No functional changes intended.

Signed-off-by: Gabor Juhos <j4g8y7@gmail.com>
Reviewed-by: Md Sadre Alam <quic_mdalam@quicinc.com>
Link: https://patch.msgid.link/20250515-qpic-snand-use-bitmasks-v1-1-11729aeae73b@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-05-16 13:18:21 +02:00
Vishwaroop A
017f1b0bae
spi: tegra210-quad: Add support for internal DMA
Add support for internal DMA in Tegra234 devices. Tegra234 has an
internal DMA controller, while Tegra241 continues to use an external
DMA controller (GPCDMA). This patch adds support for both internal
and external DMA controllers.

Signed-off-by: Vishwaroop A <va@nvidia.com>
Reviewed-by: Jon Hunter <jonathanh@nvidia.com>
Link: https://patch.msgid.link/20250513200043.608292-2-va@nvidia.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-05-15 09:37:15 +02:00
Gabor Juhos
65cb56d49f
spi: spi-qpic-snand: validate user/chip specific ECC properties
The driver only supports 512 bytes ECC step size and 4 bit ECC strength
at the moment, however it does not reject unsupported step/strength
configurations. Due to this, whenever the driver is used with a flash
chip which needs stronger ECC protection, the following warning is shown
in the kernel log:

  [    0.574648] spi-nand spi0.0: GigaDevice SPI NAND was found.
  [    0.635748] spi-nand spi0.0: 256 MiB, block size: 128 KiB, page size: 2048, OOB size: 128
  [    0.649079] nand: WARNING: (null): the ECC used on your system is too weak compared to the one required by the NAND chip

Although the message indicates that something is wrong, but it often gets
unnoticed, which can cause serious problems. For example when the user
writes something into the flash chip despite the warning, the written data
may won't be readable by the bootloader or by the boot ROM. In the worst
case, when the attached SPI NAND chip is the boot device, the board may not
be able to boot anymore.

Also, it is not even possible to create a backup of the flash, because
reading its content results in bogus data. For example, dumping the first
page of the flash gives this:

  # hexdump -C -n 2048 /dev/mtd0
  00000000  0f 0f 0f 0f 0f 0f 0f 0f  0f 0f 0f 0f 0f 0f 0f 0f  |................|
  *
  00000040  0f 0f 0f 0f 0f 0f 0f 0d  0f 0f 0f 0f 0f 0f 0f 0f  |................|
  00000050  0f 0f 0f 0f 0f 0f 0f 0f  0f 0f 0f 0f 0f 0f 0f 0f  |................|
  *
  000001c0  0f 0f 0f 0f ff 0f 0f 0f  0f 0f 0f 0f 0f 0f 0f 0f  |................|
  000001d0  0f 0f 0f 0f 0f 0f 0f 0f  0f 0f 0f 0f 0f 0f 0f 0f  |................|
  *
  00000200  0f 0f 0f 0f f5 5b ff ff  0f 0f 0f 0f 0f 0f 0f 0f  |.....[..........|
  00000210  0f 0f 0f 0f 0f 0f 0f 0f  0f 0f 0f 0f 0f 0f 0f 0f  |................|
  *
  000002f0  0f 0f 0f 0f 0f 0f 0f 0f  0f 0f 0f 0f 0f 1f 0f 0f  |................|
  00000300  0f 0f 0f 0f 0f 0f 0f 0f  0f 0f 0f 0f 0f 0f 0f 0f  |................|
  *
  000003c0  0f 0f 0f 0f 0f 0f 0f 0f  0f 0f 0f 0f ff 0f 0f 0f  |................|
  000003d0  0f 0f 0f 0f 0f 0f 0f 0f  0f 0f 0f 0f 0f 0f 0f 0f  |................|
  *
  00000400  0f 0f 0f 0f 0f 0f 0f 0f  e9 74 c9 06 f5 5b ff ff  |.........t...[..|
  00000410  0f 0f 0f 0f 0f 0f 0f 0f  0f 0f 0f 0f 0f 0f 0f 0f  |................|
  *
  000005d0  0f 0f 0f 0f ff 0f 0f 0f  0f 0f 0f 0f 0f 0f 0f 0f  |................|
  000005e0  0f 0f 0f 0f 0f 0f 0f 0f  0f 0f 0f 0f 0f 0f 0f 0f  |................|
  *
  00000600  0f 0f 0f 0f 0f 0f 0f 0f  0f 0f 0f 0f c6 be 0f c3  |................|
  00000610  e9 74 c9 06 f5 5b ff ff  0f 0f 0f 0f 0f 0f 0f 0f  |.t...[..........|
  00000620  0f 0f 0f 0f 0f 0f 0f 0f  0f 0f 0f 0f 0f 0f 0f 0f  |................|
  *
  00000770  0f 0f 0f 0f 8f 0f 0f 0f  0f 0f 0f 0f 0f 0f 0f 0f  |................|
  00000780  0f 0f 0f 0f 0f 0f 0f 0f  0f 0f 0f 0f 0f 0f 0f 0f  |................|
  *
  00000800
  #

Doing the same by using the downstream kernel results in different output:

  # hexdump -C -n 2048 /dev/mtd0
  00000000  0f 0f 0f 0f 0f 0f 0f 0f  0f 0f 0f 0f 0f 0f 0f 0f  |................|
  *
  00000800
  #

This patch adds some sanity checks to the code to prevent using the driver
with unsupported ECC step/strength configurations. After the change, probing
of the driver fails in such cases:

  [    0.655038] spi-nand spi0.0: GigaDevice SPI NAND was found.
  [    0.659159] spi-nand spi0.0: 256 MiB, block size: 128 KiB, page size: 2048, OOB size: 128
  [    0.669138] qcom_snand 79b0000.spi: only 4 bits ECC strength is supported
  [    0.677476] nand: No suitable ECC configuration
  [    0.689909] spi-nand spi0.0: probe with driver spi-nand failed with error -95

This helps to avoid the aforementioned hassles until support for 8 bit ECC
strength gets implemented.

Fixes: 7304d19090 ("spi: spi-qpic: add driver for QCOM SPI NAND flash Interface")
Signed-off-by: Gabor Juhos <j4g8y7@gmail.com>
Link: https://patch.msgid.link/20250501-qpic-snand-validate-ecc-v1-1-532776581a66@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-05-14 10:56:48 +02:00
Alessandro Grassi
fb98bd0a13
spi: spi-sun4i: fix early activation
The SPI interface is activated before the CPOL setting is applied. In
that moment, the clock idles high and CS goes low. After a short delay,
CPOL and other settings are applied, which may cause the clock to change
state and idle low. This transition is not part of a clock cycle, and it
can confuse the receiving device.

To prevent this unexpected transition, activate the interface while CPOL
and the other settings are being applied.

Signed-off-by: Alessandro Grassi <alessandro.grassi@mailbox.org>
Link: https://patch.msgid.link/20250502095520.13825-1-alessandro.grassi@mailbox.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-05-14 10:56:43 +02:00
Mark Brown
d43eef5309
Add more devm_ functions to fix PM imbalance in
Merge series from Bence Csókás <csokas.bence@prolan.hu>:

The probe() function of the atmel-quadspi driver got quite convoluted,
especially since the addition of SAMA7G5 support, that was forward-ported
from an older vendor kernel. During the port, a bug was introduced, where
the PM get() and put() calls were imbalanced. To alleivate this - and
similar problems in the future - an effort was made to migrate as many
functions as possible, to their devm_ managed counterparts. The few
functions, which did not yet have a devm_ variant, are added in patch 1 of
this series. Patch 2 then uses these APIs to fix the probe() function.
2025-05-12 11:28:54 +09:00
Bence Csókás
8856eafcc0
spi: atmel-quadspi: Fix unbalanced pm_runtime by using devm_ API
Fix unbalanced PM in error path of `atmel_qspi_probe()`
by using `devm_pm_runtime_*()` functions.

Reported-by: Alexander Dahl <ada@thorsis.com>
Closes: https://lore.kernel.org/linux-spi/20250110-paycheck-irregular-bcddab1276c7@thorsis.com/
Fixes: 5af42209a4 ("spi: atmel-quadspi: Add support for sama7g5 QSPI")
Signed-off-by: Bence Csókás <csokas.bence@prolan.hu>
Link: https://patch.msgid.link/20250327195928.680771-4-csokas.bence@prolan.hu
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-05-11 10:30:02 +09:00
Mark Brown
09fd04daed
Add RZ/G3E xSPI support
Merge series from Biju Das <biju.das.jz@bp.renesas.com>:

The xSPI IP found on RZ/G3E SoC similar to RPC-IF interface, but it
can support writes on memory-mapped area. Even though the registers are
different, the rpcif driver code can be reused for xSPI by adding wrapper
functions.
2025-05-09 18:06:17 +09:00
Biju Das
b0b8d3aead
spi: rpc-if: Add write support for memory-mapped area
Add write support for memory-mapped area as xSPI interface require
it.

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
Link: https://patch.msgid.link/20250424090000.136804-8-biju.das.jz@bp.renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-05-08 23:12:38 +09:00
Aaron Kling
e979a7c79f
spi: tegra114: Use value to check for invalid delays
A delay unit of 0 is a valid entry, thus it is not valid to check for
unused delays. Instead, check the value field; if that is zero, the
given delay is unset.

Fixes: 4426e6b4ec ("spi: tegra114: Don't fail set_cs_timing when delays are zero")
Cc: stable@vger.kernel.org
Signed-off-by: Aaron Kling <webgeek1234@gmail.com>
Reviewed-by: Jon Hunter <jonathanh@nvidia.com>
Link: https://patch.msgid.link/20250506-spi-tegra114-fixup-v1-1-136dc2f732f3@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-05-08 10:32:40 +09:00
Mark Brown
9fbae052f6
This patch set did some clean up and add runtime pm
Merge series from Haibo Chen <haibo.chen@nxp.com>:

PATCH1/3/4 to clean up the code, make the code more readable
PATCH2 add the runtime pm support
PATCH5 use devm_add_action_or_reset() to replace remove() callback, this can avoid
       oops when do bind/unbind test
2025-05-07 09:47:05 +09:00
Han Xu
9f7cd1bcb6
spi: nxp-fspi: use devm instead of remove for driver detach
fspi driver use devm APIs to manage clk/irq/resources and register the spi
controller, but the legacy remove function will be called first during
device detach and trigger kernel panic. Drop the remove function and use
devm_add_action_or_reset() for driver cleanup to ensure the release
sequence.

Signed-off-by: Han Xu <han.xu@nxp.com>
Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
Link: https://patch.msgid.link/20250428-flexspipatch-v3-5-61d5e8f591bc@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-05-06 23:17:31 +09:00
Haibo Chen
e0558eb74c
spi: spi-nxp-fspi: remove the unchecked return value for nxp_fspi_clk_disable_unprep
For nxp_fspi_clk_disable_unprep(), no caller check the return value,
so remove the unchecked return value.

Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
Link: https://patch.msgid.link/20250428-flexspipatch-v3-4-61d5e8f591bc@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-05-06 23:17:30 +09:00
Haibo Chen
93be516f81
spi: spi-nxp-fspi: use guard(mutex) to simplify the code
Use guard(mutex) to simplify the code logic.

Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
Link: https://patch.msgid.link/20250428-flexspipatch-v3-3-61d5e8f591bc@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-05-06 23:17:29 +09:00
Haibo Chen
97be4b919a
spi: spi-nxp-fspi: enable runtime pm for fspi
Enable the runtime PM in fspi driver.
Also for system PM, On some board like i.MX8ULP-EVK board,
after system suspend, IOMUX module will lost power, so all
the pinctrl setting will lost when system resume back, need
driver to save/restore the pinctrl setting.

Signed-off-by: Han Xu <han.xu@nxp.com>
Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
Link: https://patch.msgid.link/20250428-flexspipatch-v3-2-61d5e8f591bc@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-05-06 23:17:29 +09:00
Haibo Chen
48900813ab
spi: spi-nxp-fspi: remove the goto in probe
Remove all the goto in probe to simplify the driver.

Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
Link: https://patch.msgid.link/20250428-flexspipatch-v3-1-61d5e8f591bc@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-05-06 23:17:28 +09:00
Mark Brown
02ca789818
AsoC: Phase out hybrid PCI devres
Merge series from Philipp Stanner <phasta@kernel.org>:

A year ago we spent quite some work trying to get PCI into better shape.
Some pci_ functions can be sometimes managed with devres, which is
obviously bad. We want to provide an obvious API, where pci_ functions
are never, and pcim_ functions are always managed.

Thus, everyone enabling his device with pcim_enable_device() must be
ported to pcim_ functions. Porting all users will later enable us to
significantly simplify parts of the PCI subsystem. See here [1] for
details.

This patch series does that for sound.

Feel free to squash the commits as you see fit.

P.

[1] https://elixir.bootlin.com/linux/v6.14-rc4/source/drivers/pci/devres.c#L18
2025-05-06 08:42:25 +09:00