@@ -39,36 +39,8 @@ struct spi_gpio {
3939
4040/*----------------------------------------------------------------------*/
4141
42- /*
43- * Because the overhead of going through four GPIO procedure calls
44- * per transferred bit can make performance a problem, this code
45- * is set up so that you can use it in either of two ways:
46- *
47- * - The slow generic way: set up platform_data to hold the GPIO
48- * numbers used for MISO/MOSI/SCK, and issue procedure calls for
49- * each of them. This driver can handle several such busses.
50- *
51- * - The quicker inlined way: only helps with platform GPIO code
52- * that inlines operations for constant GPIOs. This can give
53- * you tight (fast!) inner loops, but each such bus needs a
54- * new driver. You'll define a new C file, with Makefile and
55- * Kconfig support; the C code can be a total of six lines:
56- *
57- * #define DRIVER_NAME "myboard_spi2"
58- * #define SPI_MISO_GPIO 119
59- * #define SPI_MOSI_GPIO 120
60- * #define SPI_SCK_GPIO 121
61- * #define SPI_N_CHIPSEL 4
62- * #include "spi-gpio.c"
63- */
64-
65- #ifndef DRIVER_NAME
6642#define DRIVER_NAME "spi_gpio"
6743
68- #define GENERIC_BITBANG /* vs tight inlines */
69-
70- #endif
71-
7244/*----------------------------------------------------------------------*/
7345
7446static inline struct spi_gpio * __pure
@@ -341,16 +313,14 @@ static int spi_gpio_probe_pdata(struct platform_device *pdev,
341313 struct spi_gpio * spi_gpio = spi_controller_get_devdata (host );
342314 int i ;
343315
344- #ifdef GENERIC_BITBANG
345- if (!pdata || !pdata -> num_chipselect )
316+ if (!pdata )
346317 return - ENODEV ;
347- #endif
348- /*
349- * The host needs to think there is a chipselect even if not
350- * connected
351- */
352- host -> num_chipselect = pdata -> num_chipselect ?: 1 ;
353318
319+ /* It's just one always-selected device, fine to continue */
320+ if (!pdata -> num_chipselect )
321+ return 0 ;
322+
323+ host -> num_chipselect = pdata -> num_chipselect ;
354324 spi_gpio -> cs_gpios = devm_kcalloc (dev , host -> num_chipselect ,
355325 sizeof (* spi_gpio -> cs_gpios ),
356326 GFP_KERNEL );
@@ -445,8 +415,6 @@ static int spi_gpio_probe(struct platform_device *pdev)
445415 return devm_spi_register_controller (& pdev -> dev , host );
446416}
447417
448- MODULE_ALIAS ("platform:" DRIVER_NAME );
449-
450418static const struct of_device_id spi_gpio_dt_ids [] = {
451419 { .compatible = "spi-gpio" },
452420 {}
@@ -465,3 +433,4 @@ module_platform_driver(spi_gpio_driver);
465433MODULE_DESCRIPTION ("SPI host driver using generic bitbanged GPIO " );
466434MODULE_AUTHOR ("David Brownell" );
467435MODULE_LICENSE ("GPL" );
436+ MODULE_ALIAS ("platform:" DRIVER_NAME );
0 commit comments