diff options
-rw-r--r-- | Documentation/devicetree/bindings/spi/spi-bus.txt | 10 | ||||
-rw-r--r-- | drivers/spi/spi.c | 8 |
2 files changed, 14 insertions, 4 deletions
diff --git a/Documentation/devicetree/bindings/spi/spi-bus.txt b/Documentation/devicetree/bindings/spi/spi-bus.txt index 296015e3c632..800dafe5b01b 100644 --- a/Documentation/devicetree/bindings/spi/spi-bus.txt +++ b/Documentation/devicetree/bindings/spi/spi-bus.txt | |||
@@ -55,6 +55,16 @@ contain the following properties. | |||
55 | chip select active high | 55 | chip select active high |
56 | - spi-3wire - (optional) Empty property indicating device requires | 56 | - spi-3wire - (optional) Empty property indicating device requires |
57 | 3-wire mode. | 57 | 3-wire mode. |
58 | - spi-tx-bus-width - (optional) The bus width(number of data wires) that | ||
59 | used for MOSI. Defaults to 1 if not present. | ||
60 | - spi-rx-bus-width - (optional) The bus width(number of data wires) that | ||
61 | used for MISO. Defaults to 1 if not present. | ||
62 | |||
63 | Some SPI controllers and devices support Dual and Quad SPI transfer mode. | ||
64 | It allows data in SPI system transfered in 2 wires(DUAL) or 4 wires(QUAD). | ||
65 | Now the value that spi-tx-bus-width and spi-rx-bus-width can receive is | ||
66 | only 1(SINGLE), 2(DUAL) and 4(QUAD). | ||
67 | Dual/Quad mode is not allowed when 3-wire mode is used. | ||
58 | 68 | ||
59 | If a gpio chipselect is used for the SPI slave the gpio number will be passed | 69 | If a gpio chipselect is used for the SPI slave the gpio number will be passed |
60 | via the cs_gpio | 70 | via the cs_gpio |
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index 7557f611457f..0075318f4fa1 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c | |||
@@ -870,7 +870,7 @@ static void of_register_spi_devices(struct spi_master *master) | |||
870 | spi->mode |= SPI_3WIRE; | 870 | spi->mode |= SPI_3WIRE; |
871 | 871 | ||
872 | /* Device DUAL/QUAD mode */ | 872 | /* Device DUAL/QUAD mode */ |
873 | prop = of_get_property(nc, "spi-tx-nbits", &len); | 873 | prop = of_get_property(nc, "spi-tx-bus-width", &len); |
874 | if (prop && len == sizeof(*prop)) { | 874 | if (prop && len == sizeof(*prop)) { |
875 | switch (be32_to_cpup(prop)) { | 875 | switch (be32_to_cpup(prop)) { |
876 | case SPI_NBITS_SINGLE: | 876 | case SPI_NBITS_SINGLE: |
@@ -883,14 +883,14 @@ static void of_register_spi_devices(struct spi_master *master) | |||
883 | break; | 883 | break; |
884 | default: | 884 | default: |
885 | dev_err(&master->dev, | 885 | dev_err(&master->dev, |
886 | "spi-tx-nbits %d not supported\n", | 886 | "spi-tx-bus-width %d not supported\n", |
887 | be32_to_cpup(prop)); | 887 | be32_to_cpup(prop)); |
888 | spi_dev_put(spi); | 888 | spi_dev_put(spi); |
889 | continue; | 889 | continue; |
890 | } | 890 | } |
891 | } | 891 | } |
892 | 892 | ||
893 | prop = of_get_property(nc, "spi-rx-nbits", &len); | 893 | prop = of_get_property(nc, "spi-rx-bus-width", &len); |
894 | if (prop && len == sizeof(*prop)) { | 894 | if (prop && len == sizeof(*prop)) { |
895 | switch (be32_to_cpup(prop)) { | 895 | switch (be32_to_cpup(prop)) { |
896 | case SPI_NBITS_SINGLE: | 896 | case SPI_NBITS_SINGLE: |
@@ -903,7 +903,7 @@ static void of_register_spi_devices(struct spi_master *master) | |||
903 | break; | 903 | break; |
904 | default: | 904 | default: |
905 | dev_err(&master->dev, | 905 | dev_err(&master->dev, |
906 | "spi-rx-nbits %d not supported\n", | 906 | "spi-rx-bus-width %d not supported\n", |
907 | be32_to_cpup(prop)); | 907 | be32_to_cpup(prop)); |
908 | spi_dev_put(spi); | 908 | spi_dev_put(spi); |
909 | continue; | 909 | continue; |