diff options
author | Mark Brown <broonie@linaro.org> | 2013-09-01 08:49:07 -0400 |
---|---|---|
committer | Mark Brown <broonie@linaro.org> | 2013-09-01 08:49:07 -0400 |
commit | 278ac33bbd8b3ff70f9518665c892c1b6f5625b7 (patch) | |
tree | 5a5a1e6d7ae2d4105774c55d9c5cd0ee25bd6ce1 /drivers/spi | |
parent | 85cac431329bd09f7d30d489591d7af0d658b008 (diff) | |
parent | a110f93d8b4672c4ad18d911f62b9e861010e83b (diff) |
Merge remote-tracking branch 'spi/topic/quad' into spi-next
Diffstat (limited to 'drivers/spi')
-rw-r--r-- | drivers/spi/spi.c | 77 |
1 files changed, 37 insertions, 40 deletions
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index 6ef349f82b5f..9e039c60c068 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c | |||
@@ -886,48 +886,44 @@ static void of_register_spi_devices(struct spi_master *master) | |||
886 | spi->mode |= SPI_3WIRE; | 886 | spi->mode |= SPI_3WIRE; |
887 | 887 | ||
888 | /* Device DUAL/QUAD mode */ | 888 | /* Device DUAL/QUAD mode */ |
889 | prop = of_get_property(nc, "spi-tx-nbits", &len); | 889 | prop = of_get_property(nc, "spi-tx-bus-width", &len); |
890 | if (!prop || len < sizeof(*prop)) { | 890 | if (prop && len == sizeof(*prop)) { |
891 | dev_err(&master->dev, "%s has no 'spi-tx-nbits' property\n", | 891 | switch (be32_to_cpup(prop)) { |
892 | nc->full_name); | 892 | case SPI_NBITS_SINGLE: |
893 | spi_dev_put(spi); | 893 | break; |
894 | continue; | 894 | case SPI_NBITS_DUAL: |
895 | } | 895 | spi->mode |= SPI_TX_DUAL; |
896 | switch (be32_to_cpup(prop)) { | 896 | break; |
897 | case SPI_NBITS_SINGLE: | 897 | case SPI_NBITS_QUAD: |
898 | break; | 898 | spi->mode |= SPI_TX_QUAD; |
899 | case SPI_NBITS_DUAL: | 899 | break; |
900 | spi->mode |= SPI_TX_DUAL; | 900 | default: |
901 | break; | 901 | dev_err(&master->dev, |
902 | case SPI_NBITS_QUAD: | 902 | "spi-tx-bus-width %d not supported\n", |
903 | spi->mode |= SPI_TX_QUAD; | 903 | be32_to_cpup(prop)); |
904 | break; | 904 | spi_dev_put(spi); |
905 | default: | 905 | continue; |
906 | dev_err(&master->dev, "spi-tx-nbits value is not supported\n"); | 906 | } |
907 | spi_dev_put(spi); | ||
908 | continue; | ||
909 | } | 907 | } |
910 | 908 | ||
911 | prop = of_get_property(nc, "spi-rx-nbits", &len); | 909 | prop = of_get_property(nc, "spi-rx-bus-width", &len); |
912 | if (!prop || len < sizeof(*prop)) { | 910 | if (prop && len == sizeof(*prop)) { |
913 | dev_err(&master->dev, "%s has no 'spi-rx-nbits' property\n", | 911 | switch (be32_to_cpup(prop)) { |
914 | nc->full_name); | 912 | case SPI_NBITS_SINGLE: |
915 | spi_dev_put(spi); | 913 | break; |
916 | continue; | 914 | case SPI_NBITS_DUAL: |
917 | } | 915 | spi->mode |= SPI_RX_DUAL; |
918 | switch (be32_to_cpup(prop)) { | 916 | break; |
919 | case SPI_NBITS_SINGLE: | 917 | case SPI_NBITS_QUAD: |
920 | break; | 918 | spi->mode |= SPI_RX_QUAD; |
921 | case SPI_NBITS_DUAL: | 919 | break; |
922 | spi->mode |= SPI_RX_DUAL; | 920 | default: |
923 | break; | 921 | dev_err(&master->dev, |
924 | case SPI_NBITS_QUAD: | 922 | "spi-rx-bus-width %d not supported\n", |
925 | spi->mode |= SPI_RX_QUAD; | 923 | be32_to_cpup(prop)); |
926 | break; | 924 | spi_dev_put(spi); |
927 | default: | 925 | continue; |
928 | dev_err(&master->dev, "spi-rx-nbits value is not supported\n"); | 926 | } |
929 | spi_dev_put(spi); | ||
930 | continue; | ||
931 | } | 927 | } |
932 | 928 | ||
933 | /* Device speed */ | 929 | /* Device speed */ |
@@ -1480,6 +1476,7 @@ static int __spi_async(struct spi_device *spi, struct spi_message *message) | |||
1480 | return -EINVAL; | 1476 | return -EINVAL; |
1481 | if (xfer->speed_hz && master->max_speed_hz && | 1477 | if (xfer->speed_hz && master->max_speed_hz && |
1482 | xfer->speed_hz > master->max_speed_hz) | 1478 | xfer->speed_hz > master->max_speed_hz) |
1479 | return -EINVAL; | ||
1483 | 1480 | ||
1484 | if (xfer->tx_buf && !xfer->tx_nbits) | 1481 | if (xfer->tx_buf && !xfer->tx_nbits) |
1485 | xfer->tx_nbits = SPI_NBITS_SINGLE; | 1482 | xfer->tx_nbits = SPI_NBITS_SINGLE; |