diff options
-rw-r--r-- | drivers/spi/spi.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index 4eb9bf02996c..1534fa1dac34 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c | |||
@@ -1756,7 +1756,7 @@ EXPORT_SYMBOL_GPL(spi_busnum_to_master); | |||
1756 | */ | 1756 | */ |
1757 | int spi_setup(struct spi_device *spi) | 1757 | int spi_setup(struct spi_device *spi) |
1758 | { | 1758 | { |
1759 | unsigned bad_bits; | 1759 | unsigned bad_bits, ugly_bits; |
1760 | int status = 0; | 1760 | int status = 0; |
1761 | 1761 | ||
1762 | /* check mode to prevent that DUAL and QUAD set at the same time | 1762 | /* check mode to prevent that DUAL and QUAD set at the same time |
@@ -1776,6 +1776,15 @@ int spi_setup(struct spi_device *spi) | |||
1776 | * that aren't supported with their current master | 1776 | * that aren't supported with their current master |
1777 | */ | 1777 | */ |
1778 | bad_bits = spi->mode & ~spi->master->mode_bits; | 1778 | bad_bits = spi->mode & ~spi->master->mode_bits; |
1779 | ugly_bits = bad_bits & | ||
1780 | (SPI_TX_DUAL | SPI_TX_QUAD | SPI_RX_DUAL | SPI_RX_QUAD); | ||
1781 | if (ugly_bits) { | ||
1782 | dev_warn(&spi->dev, | ||
1783 | "setup: ignoring unsupported mode bits %x\n", | ||
1784 | ugly_bits); | ||
1785 | spi->mode &= ~ugly_bits; | ||
1786 | bad_bits &= ~ugly_bits; | ||
1787 | } | ||
1779 | if (bad_bits) { | 1788 | if (bad_bits) { |
1780 | dev_err(&spi->dev, "setup: unsupported mode bits %x\n", | 1789 | dev_err(&spi->dev, "setup: unsupported mode bits %x\n", |
1781 | bad_bits); | 1790 | bad_bits); |