Commit Graph

7971 Commits (09cfd3c52ea76f43b3cb15e570aeddf633d65e80)

Author SHA1 Message Date
Linus Torvalds 38057e3236 soc: driver updates for 6.18
Lots of platform specific updates for Qualcomm SoCs, including a
 new TEE subsystem driver for the Qualcomm QTEE firmware interface.
 
 Added support for the Apple A11 SoC in drivers that are shared with the
 M1/M2 series, among more updates for those.
 
 Smaller platform specific driver updates for Renesas, ASpeed, Broadcom,
 Nvidia, Mediatek, Amlogic, TI, Allwinner, and Freescale SoCs.
 
 Driver updates in the cache controller, memory controller and reset
 controller subsystems.
 
 SCMI firmware updates to add more features and improve robustness.
 This includes support for having multiple SCMI providers in a single
 system.
 
 TEE subsystem support for protected DMA-bufs, allowing hardware to
 access memory areas that managed by the kernel but remain inaccessible
 from the CPU in EL1/EL0.
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEo6/YBQwIrVS28WGKmmx57+YAGNkFAmjdpaoACgkQmmx57+YA
 GNnBXA//QgmFXYGG7QfB825mt0orKZxpfpLcwvqO7hkWgbXtl7Gokw2lGYN6bwLu
 zvY4MQ/bVoZ8R5uTVmuaSHBRsttSen8mBf+V0vzsBM/DRRVxvIN/7TESrY3J7Dtx
 J5syHKIBiUtdkDebWWC6jIElczIBItsd03Ln4Xjjt8Vas5YOO4n44zFrPo+FwlN/
 I6D2K86AiNZTtUCDMtB6VfJ6YtjYBWcWnJm7FXw/vE8FAXdZUnNWnZ8hbdQ5GaME
 JZGepUhONaOMUoGNZNaDGw511RdPhYzPjj9rCsIx2qdsRO9/4tJ8ccpW2aUMYh8c
 nA6w8Hj8jCwco6aYYrDUDV9uRtURDrmyJgTJBNLU05e/L+MuJ3IZNlzHFWlsxIAE
 vhyTdmg/P04ClQyixCl67IH/66F/0smX9C+1761LrD7GTdfR92KPl5W6q+DPBg/x
 yf+s2p3+f7ItV5XobKOrbf3w0xazeDb5o/EK8BufMx9vSe9bpzJ0gOf0CmNXEpyZ
 owAhbh6wXX1YwPcyA9LHv6gthyJwc/3fLu49ggMZP2rU01ccKOYn9H0cr7C8NVmy
 wEpJR0lp5aSw2oRkPkxB6sFmUohcpr8/OXGGJuvCXkYsUY1BEup4lewvbIWK4WoE
 c84kbbaHsjgFhe3IRlQw3G4KLYQT3jRtF7fH+gPx556BcI6K+lg=
 =mcZR
 -----END PGP SIGNATURE-----

Merge tag 'soc-drivers-6.18' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc

Pull SoC driver updates from Arnd Bergmann:
 "Lots of platform specific updates for Qualcomm SoCs, including a new
  TEE subsystem driver for the Qualcomm QTEE firmware interface.

  Added support for the Apple A11 SoC in drivers that are shared with
  the M1/M2 series, among more updates for those.

  Smaller platform specific driver updates for Renesas, ASpeed,
  Broadcom, Nvidia, Mediatek, Amlogic, TI, Allwinner, and Freescale
  SoCs.

  Driver updates in the cache controller, memory controller and reset
  controller subsystems.

  SCMI firmware updates to add more features and improve robustness.
  This includes support for having multiple SCMI providers in a single
  system.

  TEE subsystem support for protected DMA-bufs, allowing hardware to
  access memory areas that managed by the kernel but remain inaccessible
  from the CPU in EL1/EL0"

* tag 'soc-drivers-6.18' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc: (139 commits)
  soc/fsl/qbman: Use for_each_online_cpu() instead of for_each_cpu()
  soc: fsl: qe: Drop legacy-of-mm-gpiochip.h header from GPIO driver
  soc: fsl: qe: Change GPIO driver to a proper platform driver
  tee: fix register_shm_helper()
  pmdomain: apple: Add "apple,t8103-pmgr-pwrstate"
  dt-bindings: spmi: Add Apple A11 and T2 compatible
  serial: qcom-geni: Load UART qup Firmware from linux side
  spi: geni-qcom: Load spi qup Firmware from linux side
  i2c: qcom-geni: Load i2c qup Firmware from linux side
  soc: qcom: geni-se: Add support to load QUP SE Firmware via Linux subsystem
  soc: qcom: geni-se: Cleanup register defines and update copyright
  dt-bindings: qcom: se-common: Add QUP Peripheral-specific properties for I2C, SPI, and SERIAL bus
  Documentation: tee: Add Qualcomm TEE driver
  tee: qcom: enable TEE_IOC_SHM_ALLOC ioctl
  tee: qcom: add primordial object
  tee: add Qualcomm TEE driver
  tee: increase TEE_MAX_ARG_SIZE to 4096
  tee: add TEE_IOCTL_PARAM_ATTR_TYPE_OBJREF
  tee: add TEE_IOCTL_PARAM_ATTR_TYPE_UBUF
  tee: add close_context to TEE driver operation
  ...
2025-10-01 17:32:51 -07:00
Linus Torvalds ea1c6c5925 spi: Updates for v6.18
There's one big core change in this release, Jonas Gorski has addressed
 the issues with multiple chip selects which makes things more robust and
 stable.  Otherwise there's quite a bit of driver work, as well as some
 new drivers several existing drivers have had quite a bit of work done
 on them.
 
 Possibly the most interesting thing is the VirtIO driver, this is
 apparently useful for some automotive applications which want to keep as
 small and robust a host system as they can, moving less critical
 functionality into guests.
 
  - James Clark has done some substantial updates on the Freescale DSPI
    driver, porting in code from the BSP and building onm top of that to
    fix some bugs and increase performance.
  - Jonas Gorski has fixed the issues with handling multple chip selects,
    making things more robust and scalable.
  - Support for higher performance modes in the NXP FSPI driver from
    Haibo Chen.
  - Removal of the obsolete S3C2443 driver, the underlying SoC support
    has been removed from the kernel.
  - Support for Amlogic AL113L2, Atmel SAMA7D65 and SAM9x7 and for VirtIO
    controllers.
 -----BEGIN PGP SIGNATURE-----
 
 iQEzBAABCgAdFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAmjacIwACgkQJNaLcl1U
 h9CueQf/abv7rjoK4EbGeQBp3V3lQWAmB6en8SatMGf3ff8mKwsZLsePWYqpd8ir
 e4Dk5mj+R6HYEDKdXg5SW6+5BpMyiiBkfJpUq7OMQg+86wOsBGHPuZw/65+sGc+R
 hyy6AGf0YahmPiqeQVqJubYeqwWbFFCaOBWR3Q45aWhGQhRGG04vRESks1F247cl
 EAuPhhBpS30o5NzhBanqW6s5scQ4dYFIIl/KTHZQyaRgG2lT4CvRObmhco+Yyl/O
 4Mge0h/MMBx+UliuwQaPCp72h7DfA4iTeKdsnUYcfQW/OB3DZDye9HKN29k3CZyf
 6brBp14ZZ+fvseg8GW/pAsT3YQIHwg==
 =XwEA
 -----END PGP SIGNATURE-----

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

Pull spi updates from Mark Brown:
 "There's one big core change in this release, Jonas Gorski has
  addressed the issues with multiple chip selects which makes things
  more robust and stable. Otherwise there's quite a bit of driver work,
  as well as some new drivers several existing drivers have had quite a
  bit of work done on them.

  Possibly the most interesting thing is the VirtIO driver, this is
  apparently useful for some automotive applications which want to keep
  as small and robust a host system as they can, moving less critical
  functionality into guests.

   - James Clark has done some substantial updates on the Freescale DSPI
     driver, porting in code from the BSP and building onm top of that
     to fix some bugs and increase performance

   - Jonas Gorski has fixed the issues with handling multple chip
     selects, making things more robust and scalable

   - Support for higher performance modes in the NXP FSPI driver from
     Haibo Chen

   - Removal of the obsolete S3C2443 driver, the underlying SoC support
     has been removed from the kernel

   - Support for Amlogic AL113L2, Atmel SAMA7D65 and SAM9x7 and for
     VirtIO controllers"

* tag 'spi-v6.18' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi: (74 commits)
  spi: ljca: Remove Wentong's e-mail address
  spi: rename SPI_CS_CNT_MAX => SPI_DEVICE_CS_CNT_MAX
  spi: reduce device chip select limit again
  spi: don't check spi_controller::num_chipselect when parsing a dt device
  spi: drop check for validity of device chip selects
  spi: move unused device CS initialization to __spi_add_device()
  spi: keep track of number of chipselects in spi_device
  spi: fix return code when spi device has too many chipselects
  SPI: Add virtio SPI driver
  virtio-spi: Add virtio-spi.h
  virtio: Add ID for virtio SPI
  spi: rpc-if: Add resume support for RZ/G3E
  spi: rpc-if: Drop deprecated SIMPLE_DEV_PM_OPS
  spi: spi-qpic-snand: simplify clock handling by using devm_clk_get_enabled()
  spi: spi-nxp-fspi: Add OCT-DTR mode support
  spi: spi-nxp-fspi: add the support for sample data from DQS pad
  spi: spi-nxp-fspi: Add the DDR LUT command support
  spi: spi-nxp-fspi: set back to dll override mode when clock rate < 100MHz
  spi: spi-nxp-fspi: extract function nxp_fspi_dll_override()
  spi: atmel-quadspi: Add support for sama7d65 QSPI
  ...
2025-10-01 11:46:31 -07:00
Arnd Bergmann 72af4030be Apple SoC driver updates for 6.18
Krzysztof Kozlowski asked us to move away from generic compatibles:
 - Adjust all dt-bindings to use apple,t8103-XXXX instead of apple,XXXX
   as fallback and add a comment that the old generic list should no
   longer be extended.
 - Add new fallback compatibles to pinctrl, pmdomain, spi, and mca
   drivers. These changes have been Acked by their subsystem maintainers
   to be merged through our tree together with the dt-bindings.
 
 Support for pre-M1 Apple Silicon:
 - SART and mailbox gain support for Apple's A11, which are both
   required for NVMe.
 - NVMe also gains support for Apple's A11 and the nvme maintainers
   prefer that we merge this through the soc tree together with
   the mailbox and SART changes.
 - SPMI compatibles for A11 and T2 have been added, also going through
   the soc tree due to conflicts with the generic compatible removal and
   because no driver change is required.
 
 Signed-off-by: Sven Peter <sven@kernel.org>
 -----BEGIN PGP SIGNATURE-----
 
 iHUEABYKAB0WIQS3vz815OHsEaWy0u9EEX0kKnUe6QUCaM6aiAAKCRBEEX0kKnUe
 6bCKAQDv0wBDcOKPVGXqsUMEk9rGlPh89f2P420LH4NbuCy10QEAhB5kBM1qT97o
 1IbIFWlngNyk3a4B2LSUQcj7pdbvBQU=
 =e1Ed
 -----END PGP SIGNATURE-----
gpgsig -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEo6/YBQwIrVS28WGKmmx57+YAGNkFAmjTCjQACgkQmmx57+YA
 GNm7qA//Ykk5570mzFoeAOKj6Vcf8WstyoVllgdfU07WOUYbiX+KnleUZcfHu8gw
 3bWdbKKNOX/PMjVIESCSJrwIzgVBmFRbD2SMuxJs4XTpbw77cDvBl1JV/nzmiSX8
 Q+mco/RoYOqU8/ZmQKbUt4TduVlYgVEGGgypXWZ/xedpNGtRmk7u1OyUVj7qFNna
 Mb6O1UXxigCJanbU3yAwJna0yofslu0bnjf6MG62Dq9mZLmuVDIgQ6V9c7CjGT06
 00ucWkyLr/Ktpjqa+KObrMBQa/wOA5HGQm3kSCIn4EEf62DPM11IlUhDuoP7nbFp
 gIpYaWIcPUaExktMEyMiIDMyiszThkg0+dFOfkKl4gaFVmSNAuSAROcbMhxPaPpa
 ORGYJozIwIpmnfuZbyUySiGizwBcj855Jo7pgMvvXeBQ9JUKUyNZ2PbIR571jLFc
 Hjqmp2BzE+K0R2uQm8r+DnLNVLM1jMXI8VE1oDbil5PLyx8oWrQ/hZM6cigZ2xkc
 oTgtFrpQk6waBOxbr7JHUoADGX4VtnVpjguQxrtH6OVPVF1mCw0XDXXqMR038rT+
 ttyQSLYCYNve4lYWtYov2YsUsLKPawyK75JXKiKCkgxJaRn5nzah8klX8xkEJyTF
 UY6W/CnDhM792w+mYgin5xAZ7m5p6EGOiCsTaeGmUd4Vd07T4E0=
 =Nq7L
 -----END PGP SIGNATURE-----

Merge tag 'apple-soc-drivers-6.18' of https://git.kernel.org/pub/scm/linux/kernel/git/sven/linux into soc/drivers

Apple SoC driver updates for 6.18

Krzysztof Kozlowski asked us to move away from generic compatibles:
- Adjust all dt-bindings to use apple,t8103-XXXX instead of apple,XXXX
  as fallback and add a comment that the old generic list should no
  longer be extended.
- Add new fallback compatibles to pinctrl, pmdomain, spi, and mca
  drivers. These changes have been Acked by their subsystem maintainers
  to be merged through our tree together with the dt-bindings.

Support for pre-M1 Apple Silicon:
- SART and mailbox gain support for Apple's A11, which are both
  required for NVMe.
- NVMe also gains support for Apple's A11 and the nvme maintainers
  prefer that we merge this through the soc tree together with
  the mailbox and SART changes.
- SPMI compatibles for A11 and T2 have been added, also going through
  the soc tree due to conflicts with the generic compatible removal and
  because no driver change is required.

Signed-off-by: Sven Peter <sven@kernel.org>

* tag 'apple-soc-drivers-6.18' of https://git.kernel.org/pub/scm/linux/kernel/git/sven/linux: (32 commits)
  pmdomain: apple: Add "apple,t8103-pmgr-pwrstate"
  dt-bindings: spmi: Add Apple A11 and T2 compatible
  spi: apple: Add "apple,t8103-spi" compatible
  ASoC: apple: mca: Add "apple,t8103-mca" compatible
  pinctrl: apple: Add "apple,t8103-pinctrl" as compatible
  spi: dt-bindings: apple,spi: Add t6020-spi compatible
  ASoC: dt-bindings: apple,mca: Add t6020-mca compatible
  dt-bindings: dma: apple,admac: Add t6020-admac compatible
  dt-bindings: clock: apple,nco: Add t6020-nco compatible
  dt-bindings: watchdog: apple,wdt: Add t6020-wdt compatible
  dt-bindings: spmi: apple,spmi: Add t6020-spmi compatible
  dt-bindings: mfd: apple,smc: Add t6020-smc compatible
  dt-bindings: net: bcm4329-fmac: Add BCM4388 PCI compatible
  dt-bindings: net: bcm4377-bluetooth: Add BCM4388 compatible
  dt-bindings: nvme: apple: Add apple,t6020-nvme-ans2 compatible
  dt-bindings: iommu: apple,sart: Add apple,t6020-sart compatible
  dt-bindings: gpu: apple,agx: Add agx-{g14s,g14c,g14d} compatibles
  dt-bindings: mailbox: apple,mailbox: Add t6020 compatible
  dt-bindings: pinctrl: apple,pinctrl: Add apple,t6020-pinctrl compatible
  dt-bindings: iommu: dart: Add apple,t6020-dart compatible
  ...

Link: https://lore.kernel.org/r/20250920123028.49973-1-sven@kernel.org
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
2025-09-23 22:59:32 +02:00
Arnd Bergmann 3783cdc1df More Qualcomm device driver updates for v6.18
Introduce support for loading firmware into the QUP serial engines from
 Linux, which allows deferring selection of which protocol (uart, i2c,
 spi, etc) a given SE should have until the OS loads.
 
 Also introduce the "object invoke" interface in the SCM driver, to
 provide interface to the Qualcomm TEE driver.
 -----BEGIN PGP SIGNATURE-----
 
 iQJJBAABCgAzFiEEBd4DzF816k8JZtUlCx85Pw2ZrcUFAmjPXH0VHGFuZGVyc3Nv
 bkBrZXJuZWwub3JnAAoJEAsfOT8Nma3Fn/8P/2cgGz6MOdQJA45IEk7Staab/XA4
 5l4p8gde3vro9JR/mB+zC/wg5ULg1fhmQwBAFNUfvuyCChyPVoIgtaHXh2z5yvrt
 nKwjmeetw4OHw53edBApll8r5ahu4dtJyiK3WcMhFV6hHle4lIaBjYBLLQ3ZRNpd
 1OY/AO5yYxStzQvYaEBVRbDMZF+i1mIzbeIjVPwe8gy1MaGreGzpXCvmf6eVbgMt
 SVN8bhTXsmg2zEh9Fi8mzDKgkhT9jK7HrE4n0/Hum8jER6o+ClgPW2OjpVJHIVPO
 TTeKy3Qd0EDFnI8Sbn+BcxRmWlKAXXmhosQxEnP+2/okpegPGJEfyQufpKOoyUcz
 qshJUX8/BP8M72Pm8LBnbWq0bqFQSW60b5HNC67Ih0edfIgpqB+xpgMTtgR8WwHZ
 KVsoGiE+yWfR+qPk+lBtZD0zWqKYT/qj5575YGxNvlWc//Itcy+NIg6Y2wkEvX8O
 BZI28+RZFoeBSKa3FqyBLHozul+WcZB3mK5SUiZFLWQlJb5mrgfE0yVyvVw/UgN3
 jhJ8QQCI9x/Enm7OhXkWsZik93YwdFl0P4CRALGVr4wqnD3n0IjkmeXoq6r4265B
 LuoI5P41wWRR3x7Qam0neOk930pgZ95punGM4/geWW0nMGbIXCNoU7yJ64czS9Xo
 hbYXWu9OXys+nCF8
 =TulG
 -----END PGP SIGNATURE-----
gpgsig -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEo6/YBQwIrVS28WGKmmx57+YAGNkFAmjTCYQACgkQmmx57+YA
 GNlD5RAAsWpUIaZsu3S1aBl/B2qHJJAIuDsluJ4kvCSlVT+51ctRqyTd/7vxup7Q
 zBUojCCAmdLnAkym5H1y9qx3Jen1dC7BE9tYAbAjFi0NQYKdMaueik2EVffdQjoJ
 69BBpmGU/moABY/+bU2OH7xfECq2ZCim0pPmQ2jMEekpGRfVV4glzjzKItyIFBsj
 2C/sIccnr9jlyrtMkrh/ACitnyIvLstZpR70SXY8Y1yNdkYyNn7DTj+H7bWhLaZG
 35VmqIWcxmXUBckxBagQr8lgAFsOGAYF7psJnVZRR9r/ivlA1V92giE92wLh5mO9
 NBCz8f2zhz1IhHfywUBU2f6zHb4xI3UATyHxeFZ7XUHBw/FIMI/x+JyZgrkxIszZ
 mFs2Q/T9SxHmwIL5qfxQvQ6zHOE/My4oTQrchP5d2fQcQ2j00xVpB29K9QZVbwpR
 gmEhdFOBmnaZRPVrD6kQRaQdqaEbgOxxJOWLfTe1ezuS7x716CUcp/AoSZYzEqTh
 dEr8c+rXr4bg+okk6y6zl9gn4qBWOYmzs1H+2r1Duh5tVms7LkmESlY0/ciEGaX7
 /fvaVS4LeSXMcUckJ6guGdhXNAKQD7l4ZCz7xmnyPgu8urf9pukUZ81ajZiXAC0d
 bTStK3btx9AEvFK2b/MzEoN3Tcz9f+eGCHJbjI8cjQpmNnqYDgk=
 =JuVO
 -----END PGP SIGNATURE-----

Merge tag 'qcom-drivers-for-6.18-2' of https://git.kernel.org/pub/scm/linux/kernel/git/qcom/linux into soc/drivers

More Qualcomm device driver updates for v6.18

Introduce support for loading firmware into the QUP serial engines from
Linux, which allows deferring selection of which protocol (uart, i2c,
spi, etc) a given SE should have until the OS loads.

Also introduce the "object invoke" interface in the SCM driver, to
provide interface to the Qualcomm TEE driver.

* tag 'qcom-drivers-for-6.18-2' of https://git.kernel.org/pub/scm/linux/kernel/git/qcom/linux:
  serial: qcom-geni: Load UART qup Firmware from linux side
  spi: geni-qcom: Load spi qup Firmware from linux side
  i2c: qcom-geni: Load i2c qup Firmware from linux side
  soc: qcom: geni-se: Add support to load QUP SE Firmware via Linux subsystem
  soc: qcom: geni-se: Cleanup register defines and update copyright
  dt-bindings: qcom: se-common: Add QUP Peripheral-specific properties for I2C, SPI, and SERIAL bus
  firmware: qcom: scm: add support for object invocation
  firmware: qcom: tzmem: export shm_bridge create/delete

Link: https://lore.kernel.org/r/20250921020225.595403-1-andersson@kernel.org
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
2025-09-23 22:56:36 +02:00
Mark Brown 2bfb20b65d
spi: rpc-if: Add resume support for RZ/G3E
Merge series from Biju Das <biju.das.jz@bp.renesas.com>:

On RZ/G3E using PSCI, s2ram powers down the SoC. After resume,
reinitialize the hardware for SPI operations.

Also Replace the macro SIMPLE_DEV_PM_OPS->DEFINE_SIMPLE_DEV_PM_OPS macro
and use pm_sleep_ptr(). This lets us drop the check for CONFIG_PM_SLEEP
and __maybe_unused attribute from PM functions.
2025-09-23 10:57:52 +02:00
Mark Brown 089558a9ba
Virtio SPI Linux driver
Merge series from Haixu Cui <quic_haixcui@quicinc.com>:

This is the 10th version of the virtio SPI Linux driver patch series which is
intended to be compliant with the upcoming virtio specification
version 1.4. The specification can be found in repository:
https://github.com/oasis-tcs/virtio-spec.git branch virtio-1.4.
2025-09-23 10:57:45 +02:00
Mark Brown 7ea79f5366
spi: multi CS cleanup and controller CS limit
Merge series from Jonas Gorski <jonas.gorski@gmail.com>:

This series aims at cleaning up the current multi CS parts and removing
the CS limit per controller that was introduced with the multi CS
support.

To do this, store the assigned chip selects per device in
spi_device::num_chipselects, which allows us to use that instead of
SPI_CS_CNT_MAX for most loops, as well as remove the check for
SPI_INVALID_CS for any chip select.

This should hopefully make it obvious that SPI_CS_CNT_MAX only limits
accesses to arrays indexed by the number of chip selects of a device,
not the controller, and we can remove the check for
spi_controller::num_chipselects being less than SPI_CS_CNT_MAX in device
registration (which was the wrong place to do that anyway).

After having done that, we can reduce SPI_CS_CNT_MAX again to 4 without
breaking devices on higher CS lines.

Finally, rename SPI_CS_CNT_MAX to SPI_DEVICE_CNT_MAX to make it more
clear that this limit only applies to devices, not controllers.

There are still more issues left, but these can be addressed in future
submissions:

* The code allows multi-cs devices for any controller, as long as the
  device does not set parallel-memories.
* No current spi controller driver handles logical chip selects other
  than the first one, and always use it, regardless what cs_index_mask
  says.
* While most spi controllers should be able to handle devices that have
  multiple cs that just get enabled selectively, but not at the same
  time, there is no way to tell that to the core (ties into the above).
* There is no parallel memories/multi cs flag for devices, so any
  implementing driver needs to check the device tree node, making it
  impossible to register these kind of devices via platform code.
2025-09-23 10:29:10 +02:00
Sakari Ailus 878702702d
spi: ljca: Remove Wentong's e-mail address
Wentong's e-mail address no longer works, remove it.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Link: https://patch.msgid.link/20250922120632.10460-4-sakari.ailus@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-09-22 14:23:41 +02:00
Jonas Gorski e336ab509b
spi: rename SPI_CS_CNT_MAX => SPI_DEVICE_CS_CNT_MAX
Rename SPI_CS_CNT_MAX to SPI_DEVICE_CS_CNT_MAX to make it more obvious
that this is the max number of CS per device supported, not per
controller.

Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
Link: https://patch.msgid.link/20250915183725.219473-8-jonas.gorski@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-09-22 09:29:45 +01:00
Jonas Gorski 83c522fb64
spi: don't check spi_controller::num_chipselect when parsing a dt device
Do not validate spi_controller::num_chipselect against SPI_CS_CNT_MAX
when parsing an spi device firmware node.

Firstly this is the wrong place, and this should be done while
registering/validating the controller. Secondly, there is no reason for
that check, as SPI_CS_CNT_MAX controls the amount of chipselects a
device may have, not a controller may have.

So drop that check as it needlessly limits controllers to SPI_CS_CNT_MAX
number of chipselects.

Likewise, drop the check for number of device chipselects larger than
controller's number of chipselects, as __spi_add_device() will already
catch that as either one of the chip selects will be out of range, or
there is a duplicate one.

Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
Link: https://patch.msgid.link/20250915183725.219473-6-jonas.gorski@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-09-22 09:29:43 +01:00
Jonas Gorski f3982daccf
spi: drop check for validity of device chip selects
Now that we know the number of chip selects of a device, we can assume
these are valid, and do not need to check them first.

Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
Link: https://patch.msgid.link/20250915183725.219473-5-jonas.gorski@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-09-22 09:29:42 +01:00
Jonas Gorski 1c923f6244
spi: move unused device CS initialization to __spi_add_device()
Using spi_device::num_chipselect, initialize unused device CS as invalid
at registration time in __spi_add_device(), and drop it from the
different allocation paths.

Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
Link: https://patch.msgid.link/20250915183725.219473-4-jonas.gorski@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-09-22 09:29:42 +01:00
Jonas Gorski 099f942182
spi: keep track of number of chipselects in spi_device
There are several places where we need to iterate over a device's
chipselect. To be able to do it efficiently, store the number of
chipselects in spi_device, like we do for controllers.

Since we now use a device supplied value, add a check to make sure it
isn't more than we can support.

Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
Link: https://patch.msgid.link/20250915183725.219473-3-jonas.gorski@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-09-22 09:29:41 +01:00
Jonas Gorski 188f63235b
spi: fix return code when spi device has too many chipselects
Don't return a positive value when there are too many chipselects.

Fixes: 4d8ff6b099 ("spi: Add multi-cs memories support in SPI core")
Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
Link: https://patch.msgid.link/20250915183725.219473-2-jonas.gorski@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-09-22 09:29:40 +01:00
Haixu Cui f98cabe3f6
SPI: Add virtio SPI driver
This is the virtio SPI Linux kernel driver.

Signed-off-by: Haixu Cui <quic_haixcui@quicinc.com>
Link: https://patch.msgid.link/20250908092348.1283552-4-quic_haixcui@quicinc.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-09-22 09:29:30 +01:00
Bastien Curutchet (Schneider Electric) 398a8a4e51
spi: omap2-mcspi: drive SPI_CLK on transfer_setup()
If the cached contents of the CHCONF register doesn't have the FORCE bit
set, the setup() function failed to set the relevant idle state of the
SPI_CLK pin. In such case, the SPI_CLK's idle state is reached later with
set_cs(), but it's too late for the first SPI transfer which fails since
the CS is asserted before the clock reaching its idle state.

Add a first write in setup() that always sets the FORCE bit.
Keep the current write afterwards to ensure the FORCE bit won't stay in
the cached contents of the CHCONF register unless it's intended.

Signed-off-by: Bastien Curutchet (Schneider Electric) <bastien.curutchet@bootlin.com>
Link: https://patch.msgid.link/20250912-omap-spi-fix-v1-1-f925b0d27ede@bootlin.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-09-22 09:28:50 +01:00
Biju Das ad4728740b
spi: rpc-if: Add resume support for RZ/G3E
On RZ/G3E using PSCI, s2ram powers down the SoC. After resume,
reinitialize the hardware for SPI operations.

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
Link: https://patch.msgid.link/20250921112649.104516-3-biju.das.jz@bp.renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-09-22 09:21:18 +01:00
Biju Das 81ef2022b3
spi: rpc-if: Drop deprecated SIMPLE_DEV_PM_OPS
Replace SIMPLE_DEV_PM_OPS->DEFINE_SIMPLE_DEV_PM_OPS macro and use
pm_sleep_ptr(). This lets us drop the check for CONFIG_PM_SLEEP, and
reduces kernel size in case CONFIG_PM or CONFIG_PM_SLEEP is disabled,
while increasing build coverage.

Also drop the __maybe_unused attribute from PM functions.

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
Link: https://patch.msgid.link/20250921112649.104516-2-biju.das.jz@bp.renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-09-22 09:21:17 +01:00
Mark Brown 40987a08ba
Add QSPI support for sam9x7 and sama7d65 SoCs
Merge series from Dharma Balasubiramani <dharma.b@microchip.com>:

This patch series adds support for SAM9X7 and sama7d65 QSPI controller
along with the SoC-specific capabilities.
2025-09-19 15:11:58 +01:00
Mark Brown faef0c6cce
spi: spi-nxp-fspi: add DTR mode support
Merge series from Haibo Chen <haibo.chen@nxp.com>:

this patch set add DTR mode support for flexspi.
For DTR mode, flexspi only support 8D-8D-8D mode.

Patch 1~2 extract nxp_fspi_dll_override(), prepare for adding the DTR mode.
        in nor suspend, it will disable DTR mode, and enable DTR mode back
	in nor resume. this require the flexspi driver has the ability to
	set back to dll override mode in STR mode when clock rate < 100MHz.
Patch 3 Add the DDR LUT command support. flexspi use LUT command to handle
	the dtr/str mode.
Patch 4 add the logic of sample clock source selection for STR/DTR mode
	STR use the default mode 0, sample based on the internal dummy pad.
	DTR use the mode 3, sample based on the external DQS pad, so this
	board and device connect the DQS pad.
	adjust the clock rate for DTR mode, when detect the DDR LUT command,
	flexspi will automatically div 2 of the root clock and output to device.
Patch 5 finally add the DTR support in default after the upper 4 patches's
	prepareation. Since lx2160a do not implement DQS pad, so can't support
	this DTR mode.
2025-09-19 15:11:53 +01:00
Gabor Juhos a24802b0a2
spi: spi-qpic-snand: simplify clock handling by using devm_clk_get_enabled()
The devm_clk_get_enabled() function prepares and enables the
particular clock, which then automatically gets disabled and
unprepared on probe failure and on device removal.

Use that function instead of devm_clk_get() and remove the
clk_prepare_enable()/clk_disable_unprepare() calls in order
to simplify the code.

This also ensures that the clocks are handled in the correct
order during device removal.

Signed-off-by: Gabor Juhos <j4g8y7@gmail.com>
Link: https://patch.msgid.link/20250916-qpic-snand-devm_clk_get_enabled-v1-1-09953493b7f1@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-09-18 22:26:57 +01:00
Haibo Chen 0f67557763
spi: spi-nxp-fspi: Add OCT-DTR mode support
Add OCT-DTR mode support in default, since flexspi do not supports
swapping bytes on a 16 bit boundary in OCT-DTR mode, so mark swap16
as false.

lx2160a do not support DQS, so add a quirk to disable DTR mode for this
platform.

Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
Link: https://patch.msgid.link/20250917-flexspi-ddr-v2-5-bb9fe2a01889@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-09-18 22:26:52 +01:00
Haibo Chen c07f270323
spi: spi-nxp-fspi: add the support for sample data from DQS pad
flexspi define four mode for sample clock source selection.
Here is the list of modes:
mode 0: Dummy Read strobe generated by FlexSPI Controller and loopback
        internally
mode 1: Dummy Read strobe generated by FlexSPI Controller and loopback
        from DQS pad
mode 2: Reserved
mode 3: Flash provided Read strobe and input from DQS pad

In default, flexspi use mode 0 after reset. And for DTR mode, flexspi
only support 8D-8D-8D mode. For 8D-8D-8D mode, IC suggest to use mode 3,
otherwise read always get incorrect data.

For DTR mode, flexspi will automatically div 2 of the root clock
and output to device. the formula is:
    device_clock = root_clock / (is_dtr ? 2 : 1)
So correct the clock rate setting for DTR mode to get the max
performance.

Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
Link: https://patch.msgid.link/20250917-flexspi-ddr-v2-4-bb9fe2a01889@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-09-18 22:26:51 +01:00
Haibo Chen 3c1000e15f
spi: spi-nxp-fspi: Add the DDR LUT command support
For DTR mode, flexspi need to use DDR LUT command, flexspi will switch
to DDR mode when detect the DDR LUT command.

Reviewed-by: Frank Li <Frank.Li@nxp.com>
Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
Link: https://patch.msgid.link/20250917-flexspi-ddr-v2-3-bb9fe2a01889@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-09-18 22:26:50 +01:00
Haibo Chen a9888b3222
spi: spi-nxp-fspi: set back to dll override mode when clock rate < 100MHz
Preparation of supportting DTR mode. In nor suspend, driver will disable
DTR mode, and enable DTR mode back in nor resume. This require the flexspi
driver has the ability to set back to dll override mode in STR mode when
clock rate < 100MHz.

Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
Link: https://patch.msgid.link/20250917-flexspi-ddr-v2-2-bb9fe2a01889@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-09-18 22:26:49 +01:00
Haibo Chen 614180a54d
spi: spi-nxp-fspi: extract function nxp_fspi_dll_override()
Extract function nxp_fspi_dll_override(), this is the suggested setting
when clock rate < 100MHz. Just the preparation of supportting DTR mode.

Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
Link: https://patch.msgid.link/20250917-flexspi-ddr-v2-1-bb9fe2a01889@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-09-18 22:26:48 +01:00
Varshini Rajendran 20253f8068
spi: atmel-quadspi: Add support for sama7d65 QSPI
Add support for sama7d65 QSPI controller and define its caps.

Signed-off-by: Varshini Rajendran <varshini.rajendran@microchip.com>
Link: https://patch.msgid.link/20250908-microchip-qspi-v2-5-8f3d69fdd5c9@microchip.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-09-18 22:26:42 +01:00
Varshini Rajendran 65a977d752
spi: atmel-quadspi: add support for SAM9X7 QSPI controller
Add support for the QuadSPI controller found on the SAM9X7 SoC.

This controller does not implement pad calibration. It supports
operation up to 100 MHz, and requires the GCK to run at twice
the data rate.

Signed-off-by: Varshini Rajendran <varshini.rajendran@microchip.com>
Signed-off-by: Dharma Balasubiramani <dharma.b@microchip.com>
Link: https://patch.msgid.link/20250908-microchip-qspi-v2-4-8f3d69fdd5c9@microchip.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-09-18 22:26:41 +01:00
Varshini Rajendran 86d074921e
spi: atmel-quadspi: add padcalib, 2xgclk, and dllon capabilities
Introduce capability flags for SoC-specific variations of the QuadSPI
controller:

  - has_padcalib: controller supports pad calibration
  - has_2xgclk: requires GCLK at half the data rate (2x clocking)
  - has_dllon: controller supports DLL clock

Set `has_padcalib` for Octal controllers that provide pad calibration
support. Use `has_2xgclk` for controllers that require the GCLK to run
at twice the data rate. Differentiate SoC integration variants with the
`has_dllon` flag and set it as needed.

Signed-off-by: Varshini Rajendran <varshini.rajendran@microchip.com>
Signed-off-by: Dharma Balasubiramani <dharma.b@microchip.com>
Link: https://patch.msgid.link/20250908-microchip-qspi-v2-3-8f3d69fdd5c9@microchip.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-09-18 22:26:40 +01:00
Khairul Anuar Romli 30dbc1c8d5
spi: cadence-qspi: defer runtime support on socfpga if reset bit is enabled
Enabling runtime PM allows the kernel to gate clocks and power to idle
devices. On SoCFPGA, a warm reset does not fully reinitialize these
domains.This leaves devices suspended and powered down, preventing U-Boot
or the kernel from reusing them after a warm reset, which breaks the boot
process.

Fixes: 4892b374c9 ("mtd: spi-nor: cadence-quadspi: Add runtime PM support")
CC: stable@vger.kernel.org # 6.12+
Signed-off-by: Khairul Anuar Romli <khairul.anuar.romli@altera.com>
Signed-off-by: Adrian Ng Ho Yin <adrianhoyin.ng@altera.com>
Reviewed-by: Niravkumar L Rabara <nirav.rabara@altera.com>
Reviewed-by: Matthew Gerlach <matthew.gerlach@altera.com>
Link: https://patch.msgid.link/910aad68ba5d948919a7b90fa85a2fadb687229b.1757491372.git.khairul.anuar.romli@altera.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-09-18 22:24:03 +01:00
Viken Dadhaniya 99cf351ee1 spi: geni-qcom: Load spi qup Firmware from linux side
Add provision to load firmware of Serial engine for SPI protocol from
Linux Execution Environment on running on APPS processor.

Co-developed-by: Mukesh Kumar Savaliya <mukesh.savaliya@oss.qualcomm.com>
Signed-off-by: Mukesh Kumar Savaliya <mukesh.savaliya@oss.qualcomm.com>
Signed-off-by: Viken Dadhaniya <viken.dadhaniya@oss.qualcomm.com>
Acked-by: Mark Brown <broonie@kernel.org>
Link: https://lore.kernel.org/r/20250911043256.3523057-6-viken.dadhaniya@oss.qualcomm.com
Signed-off-by: Bjorn Andersson <andersson@kernel.org>
2025-09-17 13:50:23 -05:00
Tim Kuo ab63e9910d
spi: mt65xx: add dual and quad mode for standard spi device
Mediatek SPI hardware natively supports dual and quad modes, and these
modes are already enabled for SPI flash devices under spi-mem framework
in MTK SPI controller spi-mt65xx. However, other SPI devices, such as
touch panels, are limited to single mode because spi-mt65xx lacks SPI
mode argument parsing from SPI framework for these SPI devices outside
spi-mem framework.

This patch adds dual and quad mode support for these SPI devices by
introducing a new API, mtk_spi_set_nbits, for SPI mode argument parsing.

Signed-off-by: Tim Kuo <Tim.Kuo@mediatek.com>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Link: https://patch.msgid.link/20250917055839.500615-1-Tim.Kuo@mediatek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-09-17 12:53:47 +01:00
Mark Brown b28a55db45
Miscellaneous fixes and clean-ups
Merge series from Santhosh Kumar K <s-k6@ti.com>:

This series introduces some small but important fixes and cleanups in
the Cadence QSPI Controller.

Tested on TI's AM62A SK and AM62P SK:
Logs: https://gist.github.com/santhosh21/0d25767b58d9a1d9624f2c502dd8f36b
2025-09-16 14:17:33 +01:00
Arnd Bergmann dc16fd9dd0 Microchip ARM64 SoC updates for v6.18:
This update includes:
 - basic infrastructure support for Microchip LAN969x SoC
 - SoC ARCH symbols (existing SparX-5, new LAN969x) under the
   ARCH_MICROCHIP hidden symbol (already in use by AT91 in 6.17)
 - addition of that new symbol for drivers that are shared by
   Microchip SoC-s now and in the future
 -----BEGIN PGP SIGNATURE-----
 
 iHUEABYKAB0WIQQ5TRCVIBiyi/S+BG4fOrpwrNPNDAUCaMgFkQAKCRAfOrpwrNPN
 DFEbAQDg6iMOzL+C2tqu9eTfBZv9DCKcbfVFeHnwGqSbH8L/WgD/ZOq4UKIBMXpA
 MGtwDDkDKBPVv3clF461/nS+VtAOaAE=
 =upTs
 -----END PGP SIGNATURE-----
gpgsig -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEo6/YBQwIrVS28WGKmmx57+YAGNkFAmjIIW4ACgkQmmx57+YA
 GNlxCxAAgg82/SVuK6pB+Whj3JRn5Wt/grTLymy9gxPYqfbTMGnYEu2gG1nO9LBw
 EhoDi9N2PH91qZ2PQwQGev+dLddK43CocPdPM+sYt0E4f7MGd9OS7jtxNKrJompr
 DmIqwTwUMJu4dUhLkWkBBxrLjgisFQqAGFpVePgO8XJv2VmZ5DNzeub8e+3CeP3F
 ogfcfc3TC3Si30SJtbJBnUZ1leod4Q7E2pzRjBLpdWEiJH5Otzh/WW4Q+n2BjLvd
 fxHWPRri6UuEQGCdLbP6aa6U57C8JB69QbRIulmmjKdz2xtg/5FQqDpRFvTqBAGN
 OBQVZaaV24ZHl1yXfqX/m08WTkUneHP9LNI+y0cunaHtX2z6Slr6DKhBU7Pj2XTS
 B4M61lL4e/TUJHXbG+AZgqYTv6RCWf1vkYDRBa37We2sDUGgAsIZ4wmhKe2o4slT
 TnRs0f2q3vGrbv3nz9F0PpS9WOZ6NJ+XSOpDofL0Qbb2DE8QfE5lzIT1tpqS9YRQ
 xcPYfSwl0QFZxmflBhLaB4rRJxK76qYPipSi+uuWAJHy+BMOR6Yon9IUAoxATCE4
 NREHCggb2QXAbbuqkKQJktnl7/gvEpbwKrN8WEq/oxqiPrFBZ5vsnjF7RGyXT2SB
 tGcZ0F1dxFfA59R9BKVCLcVtpi9RHIux6to6PSsSHB2BvWDyBZw=
 =zZ1l
 -----END PGP SIGNATURE-----

Merge tag 'microchip-soc-6.18' of git://git.kernel.org/pub/scm/linux/kernel/git/at91/linux into soc/drivers

Microchip ARM64 SoC updates for v6.18:

This update includes:
- basic infrastructure support for Microchip LAN969x SoC
- SoC ARCH symbols (existing SparX-5, new LAN969x) under the
  ARCH_MICROCHIP hidden symbol (already in use by AT91 in 6.17)
- addition of that new symbol for drivers that are shared by
  Microchip SoC-s now and in the future

* tag 'microchip-soc-6.18' of git://git.kernel.org/pub/scm/linux/kernel/git/at91/linux:
  crypto: atmel-aes: make it selectable for ARCH_MICROCHIP
  char: hw_random: atmel: make it selectable for ARCH_MICROCHIP
  i2c: at91: make it selectable for ARCH_MICROCHIP
  spi: atmel: make it selectable for ARCH_MICROCHIP
  tty: serial: atmel: make it selectable for ARCH_MICROCHIP
  mfd: at91-usart: Make it selectable for ARCH_MICROCHIP
  arm64: lan969x: Add support for Microchip LAN969x SoC
  arm64: Add config for Microchip SoC platforms

Link: https://lore.kernel.org/r/20250915123548.13722-1-nicolas.ferre@microchip.com
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
2025-09-15 16:23:42 +02:00
Colin Ian King 18dda9eb9e
spi: amlogic: Fix error checking on regmap_write call
Currently a call to regmap_write is not being error checked because the
return checke is being performed on the variable ret and this variable
is not assigned the return value from the regmap_write call. Fix this
by adding in the missing assignment.

Fixes: 4670db6f32 ("spi: amlogic: add driver for Amlogic SPI Flash Controller")
Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
Link: https://patch.msgid.link/20250913201612.1338217-1-colin.i.king@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-09-15 12:47:14 +01:00
Janne Grunau 989ca853dd spi: apple: Add "apple,t8103-spi" compatible
After discussion with the devicetree maintainers we agreed to not extend
lists with the generic compatible "apple,spi" anymore [1]. Use
"apple,t8103-spi" as base compatible as it is the SoC the driver and
bindings were written for.

[1]: https://lore.kernel.org/asahi/12ab93b7-1fc2-4ce0-926e-c8141cfe81bf@kernel.org/

Acked-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Janne Grunau <j@jannau.net>
2025-09-14 21:51:35 +02:00
Mark Brown 34c2202f5c
spi: axi-spi-engine: improve version checks
Merge series from David Lechner <dlechner@baylibre.com>:

We have a pending major version bump for the axi-spi-engine so to
prepare for that, improve the existing version checks for feature
enablement.
2025-09-12 03:25:40 +01:00
Mark Brown 9ca01e9226
support for Amlogic SPI Flash Controller IP
Merge series from Xianwei Zhao <xianwei.zhao@amlogic.com>:

This Flash Controller is derived by adding an SPI path to the original
raw NAND controller. This controller supports two modes: raw mode and
SPI mode. The raw mode has already been implemented in the community
(drivers/mtd/nand/raw/meson_nand.c).
This submission supports the SPI mode.

Add the drivers and bindings corresponding to the SPI Flash Controller.
2025-09-12 00:54:56 +01:00
David Lechner 30db1b21fa
spi: axi-spi-engine: use adi_axi_pcore_ver_gteq()
Make use of the adi_axi_pcore_ver_gteq() helper to make version checks
more readable and robust against a major version bump.

Signed-off-by: David Lechner <dlechner@baylibre.com>
Reviewed-by: Nuno Sá <nuno.sa@analog.com>
Link: https://patch.msgid.link/20250815-spi-axi-spi-enigne-improve-version-checks-v1-2-13bde357d5b6@baylibre.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-09-11 17:52:15 +01:00
Feng Chen 4670db6f32
spi: amlogic: add driver for Amlogic SPI Flash Controller
This driver provides support for the SPI mode of the Amlogic
Flash Controller. It supports both SPI NOR flash and SPI NAND
flash. For SPI NAND, the Host ECC hardware engine can be enabled.

The controller implements the SPI-MEM interface and does not
support generic SPI.

Signed-off-by: Feng Chen <feng.chen@amlogic.com>
Signed-off-by: Xianwei Zhao <xianwei.zhao@amlogic.com>
Link: https://patch.msgid.link/20250910-spifc-v6-2-1574aa9baebd@amlogic.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-09-10 14:11:19 +01:00
Vignesh Raghavendra d9e33b38c8
spi: cadence-quadspi: Use BIT() macros where possible
Convert few open coded bit shifts to BIT() macro for better readability.
No functional changes intended.

Signed-off-by: Vignesh Raghavendra <vigneshr@ti.com>
Signed-off-by: Santhosh Kumar K <s-k6@ti.com>
Message-ID: <20250905185958.3575037-5-s-k6@ti.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-09-09 14:17:35 +01:00
Santhosh Kumar K 858d4d9e0a
spi: cadence-quadspi: Fix cqspi_setup_flash()
The 'max_cs' stores the largest chip select number. It should only
be updated when the current 'cs' is greater than existing 'max_cs'. So,
fix the condition accordingly.

Also, return failure if there are no flash device declared.

Fixes: 0f3841a5e1 ("spi: cadence-qspi: report correct number of chip-select")
CC: stable@vger.kernel.org
Reviewed-by: Pratyush Yadav <pratyush@kernel.org>
Reviewed-by: Théo Lebrun <theo.lebrun@bootlin.com>
Signed-off-by: Santhosh Kumar K <s-k6@ti.com>
Message-ID: <20250905185958.3575037-4-s-k6@ti.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-09-09 14:17:34 +01:00
Pratyush Yadav 1ad55767e7
spi: cadence-quadspi: Flush posted register writes before DAC access
cqspi_read_setup() and cqspi_write_setup() program the address width as
the last step in the setup. This is likely to be immediately followed by
a DAC region read/write. On TI K3 SoCs the DAC region is on a different
endpoint from the register region. This means that the order of the two
operations is not guaranteed, and they might be reordered at the
interconnect level. It is possible that the DAC read/write goes through
before the address width update goes through. In this situation if the
previous command used a different address width the OSPI command is sent
with the wrong number of address bytes, resulting in an invalid command
and undefined behavior.

Read back the size register to make sure the write gets flushed before
accessing the DAC region.

Fixes: 1406234105 ("mtd: spi-nor: Add driver for Cadence Quad SPI Flash Controller")
CC: stable@vger.kernel.org
Reviewed-by: Pratyush Yadav <pratyush@kernel.org>
Signed-off-by: Pratyush Yadav <pratyush@kernel.org>
Signed-off-by: Santhosh Kumar K <s-k6@ti.com>
Message-ID: <20250905185958.3575037-3-s-k6@ti.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-09-09 14:17:33 +01:00
Pratyush Yadav 29e0b471cc
spi: cadence-quadspi: Flush posted register writes before INDAC access
cqspi_indirect_read_execute() and cqspi_indirect_write_execute() first
set the enable bit on APB region and then start reading/writing to the
AHB region. On TI K3 SoCs these regions lie on different endpoints. This
means that the order of the two operations is not guaranteed, and they
might be reordered at the interconnect level.

It is possible for the AHB write to be executed before the APB write to
enable the indirect controller, causing the transaction to be invalid
and the write erroring out. Read back the APB region write before
accessing the AHB region to make sure the write got flushed and the race
condition is eliminated.

Fixes: 1406234105 ("mtd: spi-nor: Add driver for Cadence Quad SPI Flash Controller")
CC: stable@vger.kernel.org
Reviewed-by: Pratyush Yadav <pratyush@kernel.org>
Signed-off-by: Pratyush Yadav <pratyush@kernel.org>
Signed-off-by: Santhosh Kumar K <s-k6@ti.com>
Message-ID: <20250905185958.3575037-2-s-k6@ti.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-09-09 14:17:32 +01:00
Robert Marko cb6f687ecf spi: atmel: make it selectable for ARCH_MICROCHIP
LAN969x uses the Atmel SPI, so make it selectable for ARCH_MICROCHIP to
avoid needing to update depends in future if other Microchip SoC-s use it
as well.

Signed-off-by: Robert Marko <robert.marko@sartura.hr>
Acked-by: Mark Brown <broonie@kernel.org>
Acked-by: Daniel Machon <daniel.machon@microchip.com>
Signed-off-by: Nicolas Ferre <nicolas.ferre@microchip.com>
2025-09-09 10:34:22 +02:00
Krzysztof Kozlowski 6248c95eef
spi: s3c64xx: Drop S3C2443
Samsung S3C24xx family of SoCs was removed the Linux kernel in the
commit 61b7f8920b ("ARM: s3c: remove all s3c24xx support"), in January
2023.  There are no in-kernel users of remaining S3C24xx compatibles or
platform data ID.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Message-ID: <20250830132605.311115-3-krzysztof.kozlowski@linaro.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-09-08 16:22:15 +01:00
Mark Brown 73e4e7087a
spi: spi-fsl-dspi: Target mode improvements
Merge series from James Clark <james.clark@linaro.org>:

Improve usability of target mode by reporting FIFO errors and increasing
the buffer size when DMA is used. While we're touching DMA stuff also
switch to non-coherent memory, although this is unrelated to target
mode.

With the combination of the commit to increase the DMA buffer size and
the commit to use non-coherent memory, the host mode performance figures
are as follows on S32G3:

  # spidev_test --device /dev/spidev1.0 --bpw 8 --size <test_size> --cpha --iter 10000000 --speed 10000000

  Coherent (4096 byte transfers): 6534 kbps
  Non-coherent:                   7347 kbps

  Coherent (16 byte transfers):    447 kbps
  Non-coherent:                    448 kbps

Just for comparison running the same test in XSPI mode:

  4096 byte transfers:            2143 kbps
  16 byte transfers:               637 kbps

These tests required hacking S32G3 to use DMA in host mode, although
the figures should be representative of target mode too where DMA is
used. And the other devices that use DMA in host mode should see similar
improvements.
2025-09-03 20:15:02 +01:00
Gabor Juhos 1991a45852
spi: spi-qpic-snand: unregister ECC engine on probe error and device remove
The on-host hardware ECC engine remains registered both when
the spi_register_controller() function returns with an error
and also on device removal.

Change the qcom_spi_probe() function to unregister the engine
on the error path, and add the missing unregistering call to
qcom_spi_remove() to avoid possible use-after-free issues.

Fixes: 7304d19090 ("spi: spi-qpic: add driver for QCOM SPI NAND flash Interface")
Signed-off-by: Gabor Juhos <j4g8y7@gmail.com>
Message-ID: <20250903-qpic-snand-unregister-ecceng-v1-1-ef5387b0abdc@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-09-03 14:49:58 +01:00
James Clark 5cc49b5a36
spi: spi-fsl-dspi: Report FIFO overflows as errors
In target mode, the host sending more data than can be consumed would be
a common problem for any message exceeding the FIFO or DMA buffer size.
Cancel the whole message as soon as this condition is hit as the message
will be corrupted.

Only do this for target mode in a DMA transfer, it's not likely these
flags will be set in host mode so it's not worth adding extra checks. In
IRQ and polling modes we use the same transfer functions for hosts and
targets so the error flags always get checked. This is slightly
inconsistent but it's not worth doing the check conditionally because it
may catch some host programming errors in the future.

Signed-off-by: James Clark <james.clark@linaro.org>
Reviewed-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Message-ID: <20250902-james-nxp-spi-dma-v6-7-f7aa2c5e56e2@linaro.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-09-03 14:30:34 +01:00
James Clark 7d9baf1e53
spi: spi-fsl-dspi: Increase target mode DMA buffer size
When the device is configured as a target, the host won't stop sending
data while we're draining the buffer which leads to FIFO underflows
and corruption.

Increase the DMA buffer size to the maximum words that edma can
transfer once to reduce the chance of this happening.

In host mode, the driver is able to split up a transfer into smaller
chunks so we don't need to increase the size. While in target mode, the
length of the transfer is determined by the remote host and can be
larger than whatever default buffer size we pick. Keeping the buffer
small in host mode avoids wasting memory, but allocating the largest
possible in target mode gives the lowest possible chance of dropping any
data from the host.

While we could allocate per-transfer using the exact size of the
transfer, 128K is quite a large allocation and there is a chance it
could fail due to memory fragmentation unless it's allocated once at
init time.

Signed-off-by: Larisa Grigore <larisa.grigore@nxp.com>
Signed-off-by: James Clark <james.clark@linaro.org>
Reviewed-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Message-ID: <20250902-james-nxp-spi-dma-v6-6-f7aa2c5e56e2@linaro.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-09-03 14:30:33 +01:00