OSDN Git Service

spi: atmel: Remove platform data support
authorGregory CLEMENT <gregory.clement@bootlin.com>
Thu, 17 Oct 2019 14:18:44 +0000 (16:18 +0200)
committerMark Brown <broonie@kernel.org>
Fri, 18 Oct 2019 17:33:40 +0000 (18:33 +0100)
This driver is now only used through the device tree. Simplify code
by explicitly depend on device tree.

Signed-off-by: Gregory CLEMENT <gregory.clement@bootlin.com>
Link: https://lore.kernel.org/r/20191017141846.7523-6-gregory.clement@bootlin.com
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/spi/Kconfig
drivers/spi/spi-atmel.c

index 6f7fdcb..6c0c1f5 100644 (file)
@@ -80,6 +80,7 @@ config SPI_ARMADA_3700
 config SPI_ATMEL
        tristate "Atmel SPI Controller"
        depends on ARCH_AT91 || COMPILE_TEST
+       depends on OF
        help
          This selects a driver for the Atmel SPI Controller, present on
          many AT91 ARM chips.
index 19600de..1ff5b20 100644 (file)
@@ -1500,7 +1500,7 @@ static int atmel_spi_probe(struct platform_device *pdev)
        master->bits_per_word_mask = SPI_BPW_RANGE_MASK(8, 16);
        master->dev.of_node = pdev->dev.of_node;
        master->bus_num = pdev->id;
-       master->num_chipselect = master->dev.of_node ? 0 : 4;
+       master->num_chipselect = 4;
        master->setup = atmel_spi_setup;
        master->flags = (SPI_MASTER_MUST_RX | SPI_MASTER_MUST_TX);
        master->transfer_one_message = atmel_spi_transfer_one_message;
@@ -1528,16 +1528,6 @@ static int atmel_spi_probe(struct platform_device *pdev)
 
        atmel_get_caps(as);
 
-       /*
-        * If there are chip selects in the device tree, those will be
-        * discovered by the SPI core when registering the SPI master
-        * and assigned to each SPI device.
-        */
-       if (atmel_spi_is_v2(as) &&
-           pdev->dev.of_node &&
-           !of_get_property(pdev->dev.of_node, "cs-gpios", NULL))
-               master->num_chipselect = 4;
-
        as->use_dma = false;
        as->use_pdc = false;
        if (as->caps.has_dma_support) {
@@ -1745,20 +1735,18 @@ static const struct dev_pm_ops atmel_spi_pm_ops = {
 #define ATMEL_SPI_PM_OPS       NULL
 #endif
 
-#if defined(CONFIG_OF)
 static const struct of_device_id atmel_spi_dt_ids[] = {
        { .compatible = "atmel,at91rm9200-spi" },
        { /* sentinel */ }
 };
 
 MODULE_DEVICE_TABLE(of, atmel_spi_dt_ids);
-#endif
 
 static struct platform_driver atmel_spi_driver = {
        .driver         = {
                .name   = "atmel_spi",
                .pm     = ATMEL_SPI_PM_OPS,
-               .of_match_table = of_match_ptr(atmel_spi_dt_ids),
+               .of_match_table = atmel_spi_dt_ids,
        },
        .probe          = atmel_spi_probe,
        .remove         = atmel_spi_remove,