summaryrefslogtreecommitdiff
path: root/drivers/spi
AgeCommit message (Collapse)Author
2023-03-22spi: f_ospi: Add missing spi_mem_default_supports_op() helperKunihiko Hayashi
The .supports_op() callback function returns true by default after performing driver-specific checks. Therefore the driver cannot apply the buswidth in devicetree. Call spi_mem_default_supports_op() helper to handle the buswidth in devicetree. Fixes: 1b74dd64c861 ("spi: Add Socionext F_OSPI SPI flash controller driver") Signed-off-by: Kunihiko Hayashi <hayashi.kunihiko@socionext.com> Link: https://lore.kernel.org/r/20230322023101.24490-1-hayashi.kunihiko@socionext.com Signed-off-by: Mark Brown <broonie@kernel.org>
2023-03-22spi: spi-nxp-fspi: use DLL calibration when clock rate > 100MHzHaibo Chen
When clock rate > 100MHz, use the DLL calibration mode, and finally add the suggested half of the current clock cycle to sample the data. Signed-off-by: Haibo Chen <haibo.chen@nxp.com> Link: https://lore.kernel.org/r/20230322090451.3179431-2-haibo.chen@nxp.com Signed-off-by: Mark Brown <broonie@kernel.org>
2023-03-22spi: spi-nxp-fspi: correct the comment for the DLL configHaibo Chen
Current DLL config is just to use the default setting, this means enable the DLL override mode, and use 1 fixed delay cell in the DLL delay chain, not means "reset" the DLL, so correct this to avoid confuse. Signed-off-by: Haibo Chen <haibo.chen@nxp.com> Link: https://lore.kernel.org/r/20230322090451.3179431-1-haibo.chen@nxp.com Signed-off-by: Mark Brown <broonie@kernel.org>
2023-03-20spi: sprd: Convert to platform remove callbackMark Brown
Merge series from Uwe Kleine-König <u.kleine-koenig@pengutronix.de>: An early error return from a remove callback is usally wrong. In the case of the spi-sprd driver it's not that critical because the skipped steps are mainly undoing the things that a successful runtime-resume would have done. Still it's cleaner to not exit early and not return an (mostly ignored) error value. The second patch converts to .remove_new (which is the motivation for this series).
2023-03-20spi: imx: Convert to platform remove callback returning voidUwe Kleine-König
The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is (mostly) ignored and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Link: https://lore.kernel.org/r/20230306065733.2170662-3-u.kleine-koenig@pengutronix.de Signed-off-by: Mark Brown <broonie@kernel.org>
2023-03-20spi: imx: Don't skip cleanup in remove's error pathUwe Kleine-König
Returning early in a platform driver's remove callback is wrong. In this case the dma resources are not released in the error path. this is never retried later and so this is a permanent leak. To fix this, only skip hardware disabling if waking the device fails. Fixes: d593574aff0a ("spi: imx: do not access registers while clocks disabled") Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Link: https://lore.kernel.org/r/20230306065733.2170662-2-u.kleine-koenig@pengutronix.de Signed-off-by: Mark Brown <broonie@kernel.org>
2023-03-20spi: sprd: Convert to platform remove callback returning voidUwe Kleine-König
The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is (mostly) ignored and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Link: https://lore.kernel.org/r/20230307211426.2331483-3-u.kleine-koenig@pengutronix.de Signed-off-by: Mark Brown <broonie@kernel.org>
2023-03-20spi: sprd: Don't skip cleanup in remove's error pathUwe Kleine-König
If pm_runtime_resume_and_get() failed before this change, two error messages were printed. One directly in sprd_spi_remove() and another by the device core as the return value is non-zero. The better handling of a failure to resume the device is to do the software related cleanup anyhow and only skip hardware accesses. This leaves the device in an unknown state, but there is nothing that can be done about that. Even in the error case, return zero to suppress the device core's error message. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Link: https://lore.kernel.org/r/20230307211426.2331483-2-u.kleine-koenig@pengutronix.de Signed-off-by: Mark Brown <broonie@kernel.org>
2023-03-17spi: atmel-quadspi: Convert to platform removeMark Brown
Merge series from Uwe Kleine-König <u.kleine-koenig@pengutronix.de>: This series converts the atmel-quadspi driver to use the .remove_new() callback that doesn't return an int but void. The motivation is to not give driver authors a reason to (wrongly) believe that returning an error code was sensible error handling. In fact the spi core only emits a warning message in this case and otherwise continues as if the return value was zero. This usually yields resource leaks that sometimes can lead to exceptions later on. The atmel-quadspi driver is one of these drivers that got error handling wrong, this is fixed here and in the last patch the driver is converted to .remove_new() with the eventual goal to change .remove() to return void once all drivers are converted this way.
2023-03-17spi: atmel-quadspi: Convert to platform remove callback returning voidUwe Kleine-König
The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is (mostly) ignored and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Reviewed-by: Tudor Ambarus <tudor.ambarus@linaro.org> Link: https://lore.kernel.org/r/20230317084232.142257-4-u.kleine-koenig@pengutronix.de Signed-off-by: Mark Brown <broonie@kernel.org>
2023-03-17spi: atmel-quadspi: Free resources even if runtime resume failed in .remove()Uwe Kleine-König
An early error exit in atmel_qspi_remove() doesn't prevent the device unbind. So this results in an spi controller with an unbound parent and unmapped register space (because devm_ioremap_resource() is undone). So using the remaining spi controller probably results in an oops. Instead unregister the controller unconditionally and only skip hardware access and clk disable. Also add a warning about resume failing and return zero unconditionally. The latter has the only effect to suppress a less helpful error message by the spi core. Fixes: 4a2f83b7f780 ("spi: atmel-quadspi: add runtime pm support") Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Reviewed-by: Tudor Ambarus <tudor.ambarus@linaro.org> Link: https://lore.kernel.org/r/20230317084232.142257-3-u.kleine-koenig@pengutronix.de Signed-off-by: Mark Brown <broonie@kernel.org>
2023-03-17spi: atmel-quadspi: Don't leak clk enable count in pm resumeUwe Kleine-König
The pm resume call is supposed to enable two clocks. If the second enable fails the callback reports failure but doesn't undo the first enable. So call clk_disable() for the first clock when clk_enable() for the second one fails. Fixes: 4a2f83b7f780 ("spi: atmel-quadspi: add runtime pm support") Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Reviewed-by: Tudor Ambarus <tudor.ambarus@linaro.org> Link: https://lore.kernel.org/r/20230317084232.142257-2-u.kleine-koenig@pengutronix.de Signed-off-by: Mark Brown <broonie@kernel.org>
2023-03-17driver core: class: remove module * from class_create()Greg Kroah-Hartman
The module pointer in class_create() never actually did anything, and it shouldn't have been requred to be set as a parameter even if it did something. So just remove it and fix up all callers of the function in the kernel tree at the same time. Cc: "Rafael J. Wysocki" <rafael@kernel.org> Acked-by: Benjamin Tissoires <benjamin.tissoires@redhat.com> Link: https://lore.kernel.org/r/20230313181843.1207845-4-gregkh@linuxfoundation.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-03-17drivers: remove struct module * setting from struct classGreg Kroah-Hartman
There is no need to manually set the owner of a struct class, as the registering function does it automatically, so remove all of the explicit settings from various drivers that did so as it is unneeded. This allows us to remove this pointer entirely from this structure going forward. Cc: "Rafael J. Wysocki" <rafael@kernel.org> Link: https://lore.kernel.org/r/20230313181843.1207845-2-gregkh@linuxfoundation.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-03-16spi: stm32: split large transfers based on word size instead of bytesLeonard Göhrs
The TSIZE register in CR2, to which the number of words to transfer is written, is only 16 Bit. This limits transfers to 65535 SPI _words_ at a time. The existing code uses spi_split_transfers_maxsize to limit transfers to 65535 _bytes_ at a time. This breaks large transfers with bits_per_word > 8, as they are split inside of a word boundary by the odd size limit. Split transfers based on the number of words instead. This has the added benefit of not artificially limiting the maximum length of bpw > 8 transfers to half or a quarter of the actual limit. The combination of very large transfers and bits_per_word = 16 is triggered e.g. by MIPI DBI displays when updating large parts of the screen. Signed-off-by: Leonard Göhrs <l.goehrs@pengutronix.de> Acked-by: Alain Volmat <alain.volmat@foss.st.com> Link: https://lore.kernel.org/r/20230310092053.1006459-2-l.goehrs@pengutronix.de Signed-off-by: Mark Brown <broonie@kernel.org>
2023-03-16spi: core: add spi_split_transfers_maxwordsLeonard Göhrs
Add spi_split_transfers_maxwords() function that splits spi_transfers transparently into multiple transfers that are below a given number of SPI words. This function reuses most of its code from spi_split_transfers_maxsize() and for transfers with eight or less bits per word actually behaves the same. Signed-off-by: Leonard Göhrs <l.goehrs@pengutronix.de> Link: https://lore.kernel.org/r/20230310092053.1006459-1-l.goehrs@pengutronix.de Signed-off-by: Mark Brown <broonie@kernel.org>
2023-03-13spi: struct spi_device constificationMark Brown
Merge series from Geert Uytterhoeven <geert+renesas@glider.be>: After noticing new cases of casting away constness, I went over all spi_get_*() functions and their callers, and made the following changes: 1. Make all pointer parameters const where possible, 2. Remove unneeded casts, some not even related to constness.
2023-03-13spi: nxp-flexspi: Add i.MX platform dependencyAlexander Stein
This driver also supports various i.MX8 platforms. Add ARCH_MXC for selecting this driver without Layerscape support. Fixes: c6b15b2437a10 ("spi: nxp-flexspi: Fix ARCH_LAYERSCAPE dependency") Signed-off-by: Alexander Stein <alexander.stein@ew.tq-group.com> Link: https://lore.kernel.org/r/20230313083621.154729-1-alexander.stein@ew.tq-group.com Signed-off-by: Mark Brown <broonie@kernel.org>
2023-03-13spi: rspi: Mark OF related data as maybe unusedKrzysztof Kozlowski
Driver can match via ID or OF ID table, thus several OF-related methods will be unused. Mark the OF structures as __maybe_unused so compiler can drop them: drivers/spi/spi-rspi.c:1203:29: error: ‘qspi_ops’ defined but not used [-Werror=unused-const-variable=] Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Link: https://lore.kernel.org/r/20230310222857.315629-16-krzysztof.kozlowski@linaro.org Signed-off-by: Mark Brown <broonie@kernel.org>
2023-03-13spi: sc18is602: Mark OF related data as maybe unusedKrzysztof Kozlowski
The driver can be compile tested with !CONFIG_OF making certain data unused: drivers/spi/spi-sc18is602.c:318:34: error: ‘sc18is602_of_match’ defined but not used [-Werror=unused-const-variable=] Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Link: https://lore.kernel.org/r/20230310222857.315629-15-krzysztof.kozlowski@linaro.org Signed-off-by: Mark Brown <broonie@kernel.org>
2023-03-13spi: sh-msiof: Mark OF related data as maybe unusedKrzysztof Kozlowski
The driver can be compile tested with !CONFIG_OF making certain data unused: drivers/spi/spi-sh-msiof.c:1076:34: error: ‘sh_msiof_match’ defined but not used [-Werror=unused-const-variable=] Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Link: https://lore.kernel.org/r/20230310222857.315629-14-krzysztof.kozlowski@linaro.org Signed-off-by: Mark Brown <broonie@kernel.org>
2023-03-13spi: bcm-qspi: Mark OF related data as maybe unusedKrzysztof Kozlowski
The driver can be compile tested with !CONFIG_OF making certain data unused: drivers/spi/spi-bcm-qspi.c:1460:34: error: ‘bcm_qspi_of_match’ defined but not used [-Werror=unused-const-variable=] Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Acked-by: Florian Fainelli <f.fainelli@gmail.com> Link: https://lore.kernel.org/r/20230310222857.315629-13-krzysztof.kozlowski@linaro.org Signed-off-by: Mark Brown <broonie@kernel.org>
2023-03-13spi: pxa2xx: Mark OF related data as maybe unusedKrzysztof Kozlowski
The driver can be compile tested with !CONFIG_OF making certain data unused: drivers/spi/spi-pxa2xx.c:1757:34: error: ‘pxa2xx_spi_of_match’ defined but not used [-Werror=unused-const-variable=] Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Link: https://lore.kernel.org/r/20230310222857.315629-12-krzysztof.kozlowski@linaro.org Signed-off-by: Mark Brown <broonie@kernel.org>
2023-03-13spi: sh-msiof: Remove casts to drop constnessGeert Uytterhoeven
Now the chip select APIs take const pointers, there is no longer a need to cast away constness. Fixes: 9e264f3f85a56cc1 ("spi: Replace all spi->chip_select and spi->cs_gpiod references with function call") Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> Link: https://lore.kernel.org/r/bc14c7c75f8d63c5c11f61f80daaa53b12bb15fb.1678704562.git.geert+renesas@glider.be Signed-off-by: Mark Brown <broonie@kernel.org>
2023-03-13spi: fsl-dspi: Remove unneeded cast to same typeGeert Uytterhoeven
There is never a need to cast a pointer to the same pointer type. Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> Link: https://lore.kernel.org/r/a417735ca3ff629ee897327b163b23414673f0a3.1678704562.git.geert+renesas@glider.be Signed-off-by: Mark Brown <broonie@kernel.org>
2023-03-11Add support for stacked/parallel memoriesMark Brown
Merge series from Amit Kumar Mahapatra <amit.kumar-mahapatra@amd.com>: This patch is in the continuation to the discussions which happened on 'commit f89504300e94 ("spi: Stacked/parallel memories bindings")' for adding dt-binding support for stacked/parallel memories. This patch series updated the spi-nor, spi core and the spi drivers to add stacked and parallel memories support. The first patch https://lore.kernel.org/all/20230119185342.2093323-1-amit.kumar-mahapatra@amd.com/ of the previous series got applied to https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-next But the rest of the patches in the series did not get applied due to merge conflict, so send the remaining patches in the series after rebasing it on top of for-next branch. --- BRANCH: for-next Changes in v6: - Rebased on top of latest v6.3-rc1 and fixed merge conflicts in spi-mpc512x-psc.c, sfdp.c, spansion.c files and removed spi-omap-100k.c. - Updated spi_dev_check( ) to reject new devices if any one of the chipselect is used by another device. Changes in v5: - Rebased the patches on top of v6.3-rc1 and fixed the merge conflicts. - Fixed compilation warnings in spi-sh-msiof.c with shmobile_defconfig Changes in v4: - Fixed build error in spi-pl022.c file - reported by Mark. - Fixed build error in spi-sn-f-ospi.c file. - Added Reviewed-by: Serge Semin <fancer.lancer@gmail.com> tag. - Added two more patches to replace spi->chip_select with API calls in mpc832x_rdb.c & cs35l41_hda_spi.c files. Changes in v3: - Rebased the patches on top of https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-next - Added a patch to convert spi_nor_otp_region_len(nor) & spi_nor_otp_n_regions(nor) macros into inline functions - Added Reviewed-by & Acked-by tags Changes in v2: - Rebased the patches on top of v6.2-rc1 - Created separate patch to add get & set APIs for spi->chip_select & spi->cs_gpiod, and replaced all spi->chip_select and spi->cs_gpiod references with the API calls. - Created separate patch to add get & set APIs for nor->params. --- Amit Kumar Mahapatra (15): spi: Replace all spi->chip_select and spi->cs_gpiod references with function call net: Replace all spi->chip_select and spi->cs_gpiod references with function call iio: imu: Replace all spi->chip_select and spi->cs_gpiod references with function call mtd: devices: Replace all spi->chip_select and spi->cs_gpiod references with function call staging: Replace all spi->chip_select and spi->cs_gpiod references with function call platform/x86: serial-multi-instantiate: Replace all spi->chip_select and spi->cs_gpiod references with function call powerpc/83xx/mpc832x_rdb: Replace all spi->chip_select references with function call ALSA: hda: cs35l41: Replace all spi->chip_select references with function call spi: Add stacked and parallel memories support in SPI core mtd: spi-nor: Convert macros with inline functions mtd: spi-nor: Add APIs to set/get nor->params mtd: spi-nor: Add stacked memories support in spi-nor spi: spi-zynqmp-gqspi: Add stacked memories support in GQSPI driver mtd: spi-nor: Add parallel memories support in spi-nor spi: spi-zynqmp-gqspi: Add parallel memories support in GQSPI driver arch/powerpc/platforms/83xx/mpc832x_rdb.c | 2 +- drivers/iio/imu/adis16400.c | 2 +- drivers/mtd/devices/mtd_dataflash.c | 2 +- drivers/mtd/spi-nor/atmel.c | 17 +- drivers/mtd/spi-nor/core.c | 665 +++++++++++++++--- drivers/mtd/spi-nor/core.h | 8 + drivers/mtd/spi-nor/debugfs.c | 4 +- drivers/mtd/spi-nor/gigadevice.c | 4 +- drivers/mtd/spi-nor/issi.c | 11 +- drivers/mtd/spi-nor/macronix.c | 6 +- drivers/mtd/spi-nor/micron-st.c | 39 +- drivers/mtd/spi-nor/otp.c | 48 +- drivers/mtd/spi-nor/sfdp.c | 29 +- drivers/mtd/spi-nor/spansion.c | 50 +- drivers/mtd/spi-nor/sst.c | 7 +- drivers/mtd/spi-nor/swp.c | 22 +- drivers/mtd/spi-nor/winbond.c | 10 +- drivers/mtd/spi-nor/xilinx.c | 18 +- drivers/net/ethernet/adi/adin1110.c | 2 +- drivers/net/ethernet/asix/ax88796c_main.c | 2 +- drivers/net/ethernet/davicom/dm9051.c | 2 +- drivers/net/ethernet/qualcomm/qca_debug.c | 2 +- drivers/net/ieee802154/ca8210.c | 2 +- drivers/net/wan/slic_ds26522.c | 2 +- .../net/wireless/marvell/libertas/if_spi.c | 2 +- drivers/net/wireless/silabs/wfx/bus_spi.c | 2 +- drivers/net/wireless/st/cw1200/cw1200_spi.c | 2 +- .../platform/x86/serial-multi-instantiate.c | 3 +- drivers/spi/spi-altera-core.c | 2 +- drivers/spi/spi-amd.c | 4 +- drivers/spi/spi-ar934x.c | 2 +- drivers/spi/spi-armada-3700.c | 4 +- drivers/spi/spi-aspeed-smc.c | 13 +- drivers/spi/spi-at91-usart.c | 2 +- drivers/spi/spi-ath79.c | 4 +- drivers/spi/spi-atmel.c | 26 +- drivers/spi/spi-au1550.c | 4 +- drivers/spi/spi-axi-spi-engine.c | 2 +- drivers/spi/spi-bcm-qspi.c | 10 +- drivers/spi/spi-bcm2835.c | 19 +- drivers/spi/spi-bcm2835aux.c | 4 +- drivers/spi/spi-bcm63xx-hsspi.c | 30 +- drivers/spi/spi-bcm63xx.c | 2 +- drivers/spi/spi-bcmbca-hsspi.c | 30 +- drivers/spi/spi-cadence-quadspi.c | 5 +- drivers/spi/spi-cadence-xspi.c | 4 +- drivers/spi/spi-cadence.c | 4 +- drivers/spi/spi-cavium.c | 8 +- drivers/spi/spi-coldfire-qspi.c | 8 +- drivers/spi/spi-davinci.c | 18 +- drivers/spi/spi-dln2.c | 6 +- drivers/spi/spi-dw-core.c | 2 +- drivers/spi/spi-dw-mmio.c | 4 +- drivers/spi/spi-falcon.c | 2 +- drivers/spi/spi-fsi.c | 2 +- drivers/spi/spi-fsl-dspi.c | 16 +- drivers/spi/spi-fsl-espi.c | 6 +- drivers/spi/spi-fsl-lpspi.c | 2 +- drivers/spi/spi-fsl-qspi.c | 6 +- drivers/spi/spi-fsl-spi.c | 2 +- drivers/spi/spi-geni-qcom.c | 6 +- drivers/spi/spi-gpio.c | 4 +- drivers/spi/spi-gxp.c | 4 +- drivers/spi/spi-hisi-sfc-v3xx.c | 2 +- drivers/spi/spi-img-spfi.c | 14 +- drivers/spi/spi-imx.c | 30 +- drivers/spi/spi-ingenic.c | 4 +- drivers/spi/spi-intel.c | 2 +- drivers/spi/spi-jcore.c | 4 +- drivers/spi/spi-lantiq-ssc.c | 6 +- drivers/spi/spi-mem.c | 4 +- drivers/spi/spi-meson-spicc.c | 2 +- drivers/spi/spi-microchip-core.c | 6 +- drivers/spi/spi-mpc512x-psc.c | 8 +- drivers/spi/spi-mpc52xx.c | 2 +- drivers/spi/spi-mt65xx.c | 6 +- drivers/spi/spi-mt7621.c | 2 +- drivers/spi/spi-mux.c | 8 +- drivers/spi/spi-mxic.c | 10 +- drivers/spi/spi-mxs.c | 2 +- drivers/spi/spi-npcm-fiu.c | 20 +- drivers/spi/spi-nxp-fspi.c | 10 +- drivers/spi/spi-omap-uwire.c | 8 +- drivers/spi/spi-omap2-mcspi.c | 24 +- drivers/spi/spi-orion.c | 4 +- drivers/spi/spi-pci1xxxx.c | 4 +- drivers/spi/spi-pic32-sqi.c | 2 +- drivers/spi/spi-pic32.c | 4 +- drivers/spi/spi-pl022.c | 4 +- drivers/spi/spi-pxa2xx.c | 6 +- drivers/spi/spi-qcom-qspi.c | 2 +- drivers/spi/spi-rb4xx.c | 2 +- drivers/spi/spi-rockchip-sfc.c | 2 +- drivers/spi/spi-rockchip.c | 26 +- drivers/spi/spi-rspi.c | 10 +- drivers/spi/spi-s3c64xx.c | 2 +- drivers/spi/spi-sc18is602.c | 4 +- drivers/spi/spi-sh-msiof.c | 6 +- drivers/spi/spi-sh-sci.c | 2 +- drivers/spi/spi-sifive.c | 6 +- drivers/spi/spi-sn-f-ospi.c | 2 +- drivers/spi/spi-st-ssc4.c | 2 +- drivers/spi/spi-stm32-qspi.c | 12 +- drivers/spi/spi-sun4i.c | 2 +- drivers/spi/spi-sun6i.c | 2 +- drivers/spi/spi-synquacer.c | 6 +- drivers/spi/spi-tegra114.c | 28 +- drivers/spi/spi-tegra20-sflash.c | 2 +- drivers/spi/spi-tegra20-slink.c | 6 +- drivers/spi/spi-tegra210-quad.c | 8 +- drivers/spi/spi-ti-qspi.c | 16 +- drivers/spi/spi-topcliff-pch.c | 4 +- drivers/spi/spi-wpcm-fiu.c | 12 +- drivers/spi/spi-xcomm.c | 2 +- drivers/spi/spi-xilinx.c | 6 +- drivers/spi/spi-xlp.c | 4 +- drivers/spi/spi-zynq-qspi.c | 2 +- drivers/spi/spi-zynqmp-gqspi.c | 58 +- drivers/spi/spi.c | 225 ++++-- drivers/spi/spidev.c | 6 +- drivers/staging/fbtft/fbtft-core.c | 2 +- drivers/staging/greybus/spilib.c | 2 +- include/linux/mtd/spi-nor.h | 18 +- include/linux/spi/spi.h | 34 +- include/trace/events/spi.h | 10 +- sound/pci/hda/cs35l41_hda_spi.c | 2 +- 126 files changed, 1350 insertions(+), 615 deletions(-) -- 2.25.1
2023-03-11spi: Replace all spi->chip_select and spi->cs_gpiod references with function ↵Amit Kumar Mahapatra via Alsa-devel
call Supporting multi-cs in spi drivers would require the chip_select & cs_gpiod members of struct spi_device to be an array. But changing the type of these members to array would break the spi driver functionality. To make the transition smoother introduced four new APIs to get/set the spi->chip_select & spi->cs_gpiod and replaced all spi->chip_select and spi->cs_gpiod references with get or set API calls. While adding multi-cs support in further patches the chip_select & cs_gpiod members of the spi_device structure would be converted to arrays & the "idx" parameter of the APIs would be used as array index i.e., spi->chip_select[idx] & spi->cs_gpiod[idx] respectively. Signed-off-by: Amit Kumar Mahapatra <amit.kumar-mahapatra@amd.com> Acked-by: Heiko Stuebner <heiko@sntech.de> # Rockchip drivers Reviewed-by: Michal Simek <michal.simek@amd.com> Reviewed-by: Cédric Le Goater <clg@kaod.org> # Aspeed driver Reviewed-by: Dhruva Gole <d-gole@ti.com> # SPI Cadence QSPI Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com> # spi-stm32-qspi Acked-by: William Zhang <william.zhang@broadcom.com> # bcm63xx-hsspi driver Reviewed-by: Serge Semin <fancer.lancer@gmail.com> # DW SSI part Link: https://lore.kernel.org/r/167847070432.26.15076794204368669839@mailman-core.alsa-project.org Signed-off-by: Mark Brown <broonie@kernel.org>
2023-03-11spi: omap2-mcspi: Use of_property_read_bool() for boolean propertiesRob Herring
It is preferred to use typed property access functions (i.e. of_property_read_<type> functions) rather than low-level of_get_property/of_find_property functions for reading properties. Convert reading boolean properties to to of_property_read_bool(). Signed-off-by: Rob Herring <robh@kernel.org> Link: https://lore.kernel.org/r/20230310144736.1547110-1-robh@kernel.org Signed-off-by: Mark Brown <broonie@kernel.org>
2023-03-11spi: fsi: restore CONFIG_FSI dependencyArnd Bergmann
The assumption that the build dependency was not necessary turned out to be wrong, as building SPI_FSI without FSI results in a link failure: aarch64-linux-ld: drivers/spi/spi-fsi.o: in function `fsi_spi_check_status': spi-fsi.c:(.text+0x54): undefined reference to `fsi_device_read' aarch64-linux-ld: drivers/spi/spi-fsi.o: in function `fsi_spi_read_reg': spi-fsi.c:(.text+0x120): undefined reference to `fsi_device_write' aarch64-linux-ld: spi-fsi.c:(.text+0x170): undefined reference to `fsi_device_read' Fixes: f916c7080d28 ("spi: fsi: Make available for build test") Signed-off-by: Arnd Bergmann <arnd@arndb.de> Link: https://lore.kernel.org/r/20230310140605.569363-1-arnd@kernel.org Signed-off-by: Mark Brown <broonie@kernel.org>
2023-03-10spi: mpc5xxx-psc: Remove goto to the unexisted labelAndy Shevchenko
The previous cleanup patch had lost one of its parts in a crack, Finish the cleanup by removing the leftovers. Reported-by: kernel test robot <lkp@intel.com> Fixes: 9e21720a4958 ("spi: mpc5xxx-psc: use devm_clk_get_enabled() for core clock") Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/20230310111544.57342-1-andriy.shevchenko@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
2023-03-07spi: mpc5xxx-psc: Clean up even more and fixMark Brown
Merge series from Andy Shevchenko <andriy.shevchenko@linux.intel.com>: The recent cleanup series broke the error path in the drivers. So fix it and do even more cleanups.
2023-03-07spi: Convert to platform remove callback returningMark Brown
Merge series from Uwe Kleine-König <u.kleine-koenig@pengutronix.de>: This patch series adapts the platform drivers below drivers/spi to use the .remove_new() callback. Compared to the traditional .remove() callback .remove_new() returns no value. This is a good thing because the driver core doesn't (and cannot) cope for errors during remove. The only effect of a non-zero return value in .remove() is that the driver core emits a warning. The device is removed anyhow and an early return from .remove() usually yields a resource leak. By changing the remove callback to return void driver authors cannot reasonably assume any more that there is some kind of cleanup later. All drivers touched here returned zero unconditionally in their remove callback, so they could all be converted trivially to .remove_new().
2023-03-07spi: Fix cocci warningsWilliam Zhang
cocci reported warning: !A || A && B is equivalent to !A || B. This fix simplified the condition check to !A || B. Fixes: 76a85704cb91 ("spi: spi-mem: Allow controller supporting mem_ops without exec_op") Reported-by: kernel test robot <lkp@intel.com> Link: https://lore.kernel.org/oe-kbuild-all/202303010051.HrHWSr9y-lkp@intel.com/ Signed-off-by: William Zhang <william.zhang@broadcom.com> Link: https://lore.kernel.org/r/20230307012004.414502-1-william.zhang@broadcom.com Signed-off-by: Mark Brown <broonie@kernel.org>
2023-03-07spi: qup: Use devm_platform_get_and_ioremap_resource()Md Sadre Alam
Convert platform_get_resource(), devm_ioremap_resource() to a single call to devm_platform_get_and_ioremap_resource(), as this is exactly what this function does. Signed-off-by: Md Sadre Alam <quic_mdalam@quicinc.com> Link: https://lore.kernel.org/r/20230306144404.15517-1-quic_mdalam@quicinc.com Signed-off-by: Mark Brown <broonie@kernel.org>
2023-03-07spi: mpc5xxx-psc: Consistently use device property APIsAndy Shevchenko
Instead of calling the OF APIs mixed with device property APIs, just switch to use the latter everywhere. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/20230306183115.87314-6-andriy.shevchenko@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
2023-03-07spi: mpc5xxx-psc: Propagate firmware nodeAndy Shevchenko
Propagate firmware node by using a specific API call, i.e. device_set_node(). Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/20230306183115.87314-5-andriy.shevchenko@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
2023-03-07spi: mpc5xxx-psc: use devm_clk_get_enabled() for core clockAndy Shevchenko
Use devm_clk_get_enabled() to simplify the code. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/20230306183115.87314-4-andriy.shevchenko@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
2023-03-07spi: mpc5xxx-psc: Return immediately if IRQ resource is unavailableAndy Shevchenko
Return immediately if IRQ resource is unavailable. This will also propagate the correct error code in such cases. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/20230306183115.87314-3-andriy.shevchenko@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
2023-03-07spi: mpc5xxx-psc: Correct error check for ↵Andy Shevchenko
devm_platform_get_and_ioremap_resource() devm_platform_get_and_ioremap_resource() may return pointer or error pointer, never the NULL. Correct error check for it. Fixes: 60a6c8257f41 ("spi: mpc5xxx-psc: Use platform resources instead of parsing DT properties") Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/20230306183115.87314-2-andriy.shevchenko@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
2023-03-06spi: zynqmp-gqspi: Convert to platform remove callback returning voidUwe Kleine-König
The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is (mostly) ignored and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Link: https://lore.kernel.org/r/20230303172041.2103336-88-u.kleine-koenig@pengutronix.de Signed-off-by: Mark Brown <broonie@kernel.org>
2023-03-06spi: zynq-qspi: Convert to platform remove callback returning voidUwe Kleine-König
The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is (mostly) ignored and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Link: https://lore.kernel.org/r/20230303172041.2103336-87-u.kleine-koenig@pengutronix.de Signed-off-by: Mark Brown <broonie@kernel.org>
2023-03-06spi: xtensa-xtfpga: Convert to platform remove callback returning voidUwe Kleine-König
The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is (mostly) ignored and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Link: https://lore.kernel.org/r/20230303172041.2103336-86-u.kleine-koenig@pengutronix.de Signed-off-by: Mark Brown <broonie@kernel.org>
2023-03-06spi: xilinx: Convert to platform remove callback returning voidUwe Kleine-König
The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is (mostly) ignored and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Link: https://lore.kernel.org/r/20230303172041.2103336-85-u.kleine-koenig@pengutronix.de Signed-off-by: Mark Brown <broonie@kernel.org>
2023-03-06spi: uniphier: Convert to platform remove callback returning voidUwe Kleine-König
The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is (mostly) ignored and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Link: https://lore.kernel.org/r/20230303172041.2103336-84-u.kleine-koenig@pengutronix.de Signed-off-by: Mark Brown <broonie@kernel.org>
2023-03-06spi: topcliff-pch: Convert to platform remove callback returning voidUwe Kleine-König
The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is (mostly) ignored and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Link: https://lore.kernel.org/r/20230303172041.2103336-83-u.kleine-koenig@pengutronix.de Signed-off-by: Mark Brown <broonie@kernel.org>
2023-03-06spi: tegra210-quad: Convert to platform remove callback returning voidUwe Kleine-König
The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is (mostly) ignored and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Link: https://lore.kernel.org/r/20230303172041.2103336-82-u.kleine-koenig@pengutronix.de Signed-off-by: Mark Brown <broonie@kernel.org>
2023-03-06spi: tegra20-slink: Convert to platform remove callback returning voidUwe Kleine-König
The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is (mostly) ignored and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Link: https://lore.kernel.org/r/20230303172041.2103336-81-u.kleine-koenig@pengutronix.de Signed-off-by: Mark Brown <broonie@kernel.org>
2023-03-06spi: tegra20-sflash: Convert to platform remove callback returning voidUwe Kleine-König
The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is (mostly) ignored and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Link: https://lore.kernel.org/r/20230303172041.2103336-80-u.kleine-koenig@pengutronix.de Signed-off-by: Mark Brown <broonie@kernel.org>
2023-03-06spi: tegra114: Convert to platform remove callback returning voidUwe Kleine-König
The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is (mostly) ignored and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Link: https://lore.kernel.org/r/20230303172041.2103336-79-u.kleine-koenig@pengutronix.de Signed-off-by: Mark Brown <broonie@kernel.org>
2023-03-06spi: synquacer: Convert to platform remove callback returning voidUwe Kleine-König
The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is (mostly) ignored and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Link: https://lore.kernel.org/r/20230303172041.2103336-78-u.kleine-koenig@pengutronix.de Signed-off-by: Mark Brown <broonie@kernel.org>