diff options
| author | Mark Brown <broonie@kernel.org> | 2019-11-22 19:56:33 +0000 |
|---|---|---|
| committer | Mark Brown <broonie@kernel.org> | 2019-11-22 19:56:33 +0000 |
| commit | 8f3ed6d0b0db04db8297d951c26c809dd7b4778d (patch) | |
| tree | 5813c89fa9245eb00e617b6dab89ddfe4a029184 /drivers/spi/spi.c | |
| parent | af42d3466bdc8f39806b26f593604fdc54140bcb (diff) | |
| parent | c5923243eb3208ea63b5ed7905610039c4ca5201 (diff) | |
| download | linux-8f3ed6d0b0db04db8297d951c26c809dd7b4778d.tar.gz linux-8f3ed6d0b0db04db8297d951c26c809dd7b4778d.tar.bz2 linux-8f3ed6d0b0db04db8297d951c26c809dd7b4778d.zip | |
Merge branch 'spi-5.4' into spi-linus
Diffstat (limited to 'drivers/spi/spi.c')
| -rw-r--r-- | drivers/spi/spi.c | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index f9502dbbb5c1..26b91ee0855d 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c @@ -1711,15 +1711,7 @@ static int of_spi_parse_dt(struct spi_controller *ctlr, struct spi_device *spi, spi->mode |= SPI_3WIRE; if (of_property_read_bool(nc, "spi-lsb-first")) spi->mode |= SPI_LSB_FIRST; - - /* - * For descriptors associated with the device, polarity inversion is - * handled in the gpiolib, so all chip selects are "active high" in - * the logical sense, the gpiolib will invert the line if need be. - */ - if (ctlr->use_gpio_descriptors) - spi->mode |= SPI_CS_HIGH; - else if (of_property_read_bool(nc, "spi-cs-high")) + if (of_property_read_bool(nc, "spi-cs-high")) spi->mode |= SPI_CS_HIGH; /* Device DUAL/QUAD mode */ @@ -1783,6 +1775,15 @@ static int of_spi_parse_dt(struct spi_controller *ctlr, struct spi_device *spi, } spi->chip_select = value; + /* + * For descriptors associated with the device, polarity inversion is + * handled in the gpiolib, so all gpio chip selects are "active high" + * in the logical sense, the gpiolib will invert the line if need be. + */ + if ((ctlr->use_gpio_descriptors) && ctlr->cs_gpiods && + ctlr->cs_gpiods[spi->chip_select]) + spi->mode |= SPI_CS_HIGH; + /* Device speed */ rc = of_property_read_u32(nc, "spi-max-frequency", &value); if (rc) { |
