summaryrefslogtreecommitdiff
path: root/drivers/spi/spi-gpio.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2025-03-25 19:28:14 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2025-03-25 19:28:14 -0700
commit47618bc875407b54296285e21d92d79889ce503a (patch)
tree75c2e380e78c0a50848f94a392bc2e4aac047753 /drivers/spi/spi-gpio.c
parente2ae6e14d7c43e955580de81edb025e7fe56bb6a (diff)
parentee2ecf2cf501eaa69dcd723d76b434767195b64e (diff)
Merge tag 'spi-v6.15' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi
Pull spi updates from Mark Brown: "The biggest change for SPI this release is the addition of offload support from David Lechner, allowing the hardware to trigger SPI transactions autonomously. The initial use case is for triggering IIO operations but there are other applications where having the hardware ready to go at a minimal signal is useful for synchronising with external inputs (eg, interrupt handling) or reducing latency (eg, CAN networking). Otherwise there's the usual fixes, improvements and cleanups, plus support for a bunch of new devices. - Support for offloading support from David Lechner - Support for GOcontrol1 Moduline modules, Mediatek MT7988, NXP i.MX94, Qualcomm SPI NAMD, Rockchip RK3562, Sophogo SG2044 and ST STM32 OSPI" * tag 'spi-v6.15' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi: (59 commits) spi: spi-mem: Introduce a default ->exec_op() debug log spi: dt-bindings: cdns,qspi-nor: Require some peripheral properties spi: dt-bindings: cdns,qspi-nor: Deprecate the Cadence compatible alone spi: dt-bindings: cdns,qspi-nor: Be more descriptive regarding what this controller is spi: stm32-ospi: Include "gpio/consumer.h" MAINTAINERS: adjust the file entry in GOCONTROLL MODULINE MODULE SLOT spi: spi-qpic-snand: avoid memleak in qcom_spi_ecc_init_ctx_pipelined() spi: spi-mux: Fix coverity issue, unchecked return value spi: sophgo: fix incorrect type for ret in sg2044_spifmc_write() spi: sg2044-nor: fix uninitialized variable in probe spi: sg2044-nor: fix signedness bug in sg2044_spifmc_write() spi: sg2044-nor: Convert to dev_err_probe() spi: sg2044-nor: Fully convert to device managed resources dt-bindings: spi: add compatibles for mt7988 spi: spidev: Add an entry for the gocontroll moduline module slot MAINTAINERS: add maintainer for the GOcontroll Moduline module slot dt-bindings: connector: Add the GOcontroll Moduline module slot bindings dt-bindings: vendor-prefixes: add GOcontroll spi: Use inclusive language spi: cadence-qspi: Improve spi memory performance ...
Diffstat (limited to 'drivers/spi/spi-gpio.c')
-rw-r--r--drivers/spi/spi-gpio.c45
1 files changed, 7 insertions, 38 deletions
diff --git a/drivers/spi/spi-gpio.c b/drivers/spi/spi-gpio.c
index 4f192e013cd6..405deb6677c1 100644
--- a/drivers/spi/spi-gpio.c
+++ b/drivers/spi/spi-gpio.c
@@ -39,36 +39,8 @@ struct spi_gpio {
/*----------------------------------------------------------------------*/
-/*
- * Because the overhead of going through four GPIO procedure calls
- * per transferred bit can make performance a problem, this code
- * is set up so that you can use it in either of two ways:
- *
- * - The slow generic way: set up platform_data to hold the GPIO
- * numbers used for MISO/MOSI/SCK, and issue procedure calls for
- * each of them. This driver can handle several such busses.
- *
- * - The quicker inlined way: only helps with platform GPIO code
- * that inlines operations for constant GPIOs. This can give
- * you tight (fast!) inner loops, but each such bus needs a
- * new driver. You'll define a new C file, with Makefile and
- * Kconfig support; the C code can be a total of six lines:
- *
- * #define DRIVER_NAME "myboard_spi2"
- * #define SPI_MISO_GPIO 119
- * #define SPI_MOSI_GPIO 120
- * #define SPI_SCK_GPIO 121
- * #define SPI_N_CHIPSEL 4
- * #include "spi-gpio.c"
- */
-
-#ifndef DRIVER_NAME
#define DRIVER_NAME "spi_gpio"
-#define GENERIC_BITBANG /* vs tight inlines */
-
-#endif
-
/*----------------------------------------------------------------------*/
static inline struct spi_gpio *__pure
@@ -341,16 +313,14 @@ static int spi_gpio_probe_pdata(struct platform_device *pdev,
struct spi_gpio *spi_gpio = spi_controller_get_devdata(host);
int i;
-#ifdef GENERIC_BITBANG
- if (!pdata || !pdata->num_chipselect)
+ if (!pdata)
return -ENODEV;
-#endif
- /*
- * The host needs to think there is a chipselect even if not
- * connected
- */
- host->num_chipselect = pdata->num_chipselect ?: 1;
+ /* It's just one always-selected device, fine to continue */
+ if (!pdata->num_chipselect)
+ return 0;
+
+ host->num_chipselect = pdata->num_chipselect;
spi_gpio->cs_gpios = devm_kcalloc(dev, host->num_chipselect,
sizeof(*spi_gpio->cs_gpios),
GFP_KERNEL);
@@ -445,8 +415,6 @@ static int spi_gpio_probe(struct platform_device *pdev)
return devm_spi_register_controller(&pdev->dev, host);
}
-MODULE_ALIAS("platform:" DRIVER_NAME);
-
static const struct of_device_id spi_gpio_dt_ids[] = {
{ .compatible = "spi-gpio" },
{}
@@ -465,3 +433,4 @@ module_platform_driver(spi_gpio_driver);
MODULE_DESCRIPTION("SPI host driver using generic bitbanged GPIO ");
MODULE_AUTHOR("David Brownell");
MODULE_LICENSE("GPL");
+MODULE_ALIAS("platform:" DRIVER_NAME);