spi: Add support for specifying 3-wire mode via device tree

This patch allows to specify that a SPI device is connected in 3-wire mode via
device tree.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Acked-by: Rob Herring <rob.herring@calxeda.com>
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
This commit is contained in:
Lars-Peter Clausen 2012-12-06 16:55:33 +01:00 committed by Grant Likely
parent 5323f49853
commit c20151dff8
2 changed files with 4 additions and 0 deletions

View File

@ -53,6 +53,8 @@ contain the following properties.
shifted clock phase (CPHA) mode shifted clock phase (CPHA) mode
- spi-cs-high - (optional) Empty property indicating device requires - spi-cs-high - (optional) Empty property indicating device requires
chip select active high chip select active high
- spi-3wire - (optional) Empty property indicating device requires
3-wire mode.
If a gpio chipselect is used for the SPI slave the gpio number will be passed If a gpio chipselect is used for the SPI slave the gpio number will be passed
via the cs_gpio via the cs_gpio

View File

@ -861,6 +861,8 @@ static void of_register_spi_devices(struct spi_master *master)
spi->mode |= SPI_CPOL; spi->mode |= SPI_CPOL;
if (of_find_property(nc, "spi-cs-high", NULL)) if (of_find_property(nc, "spi-cs-high", NULL))
spi->mode |= SPI_CS_HIGH; spi->mode |= SPI_CS_HIGH;
if (of_find_property(nc, "spi-3wire", NULL))
spi->mode |= SPI_3WIRE;
/* Device speed */ /* Device speed */
prop = of_get_property(nc, "spi-max-frequency", &len); prop = of_get_property(nc, "spi-max-frequency", &len);