spi: move more spi_setup() functionality into core
[firefly-linux-kernel-4.4.55.git] / drivers / spi / omap_uwire.c
index 747d29be45d572ae063dc244fa6513dcc9f8cb5d..aa90ddb370662b7d13b787febb0fa8f569b3bad0 100644 (file)
@@ -447,19 +447,10 @@ done:
        return status;
 }
 
-/* the spi->mode bits understood by this driver: */
-#define MODEBITS (SPI_CPOL | SPI_CPHA | SPI_CS_HIGH)
-
 static int uwire_setup(struct spi_device *spi)
 {
        struct uwire_state *ust = spi->controller_state;
 
-       if (spi->mode & ~MODEBITS) {
-               dev_dbg(&spi->dev, "setup: unsupported mode bits %x\n",
-                       spi->mode & ~MODEBITS);
-               return -EINVAL;
-       }
-
        if (ust == NULL) {
                ust = kzalloc(sizeof(*ust), GFP_KERNEL);
                if (ust == NULL)
@@ -520,6 +511,9 @@ static int __init uwire_probe(struct platform_device *pdev)
 
        uwire_write_reg(UWIRE_SR3, 1);
 
+       /* the spi->mode bits understood by this driver: */
+       master->mode_bits = SPI_CPOL | SPI_CPHA | SPI_CS_HIGH;
+
        master->bus_num = 2;    /* "official" */
        master->num_chipselect = 4;
        master->setup = uwire_setup;