Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

staging: mt7621-spi: drop support for SPI mode 1/2/3

As explained in previous patch, this SPI controller seems to be
tested on SPI flash only before mass production and some bits are
swizzled under other SPI modes probably due to incorrect wiring
inside the silicon. Drop implementation of SPI mode 1/2/3 since
they are broken.

Also drop RT2880_SPI_MODE_BITS macro because we now have only
SPI_LSB_FIRST implemented and the mode_bits is so short that we
don't need a macro there.

Signed-off-by: Chuanhong Guo <gch981213@gmail.com>
Reviewed-by: NeilBrown <neil@brown.name>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Chuanhong Guo and committed by
Greg Kroah-Hartman
354ea2ee 108d9dd5

+7 -17
+7 -17
drivers/staging/mt7621-spi/spi-mt7621.c
··· 55 55 #define MT7621_CPOL BIT(4) 56 56 #define MT7621_LSB_FIRST BIT(3) 57 57 58 - #define RT2880_SPI_MODE_BITS (SPI_CPOL | SPI_CPHA | \ 59 - SPI_LSB_FIRST | SPI_CS_HIGH) 60 - 61 58 struct mt7621_spi; 62 59 63 60 struct mt7621_spi { ··· 133 136 if (spi->mode & SPI_LSB_FIRST) 134 137 reg |= MT7621_LSB_FIRST; 135 138 139 + /* This SPI controller seems to be tested on SPI flash only 140 + * and some bits are swizzled under other SPI modes probably 141 + * due to incorrect wiring inside the silicon. Only mode 0 142 + * works correctly. 143 + */ 136 144 reg &= ~(MT7621_CPHA | MT7621_CPOL); 137 - switch (spi->mode & (SPI_CPOL | SPI_CPHA)) { 138 - case SPI_MODE_0: 139 - break; 140 - case SPI_MODE_1: 141 - reg |= MT7621_CPHA; 142 - break; 143 - case SPI_MODE_2: 144 - reg |= MT7621_CPOL; 145 - break; 146 - case SPI_MODE_3: 147 - reg |= MT7621_CPOL | MT7621_CPHA; 148 - break; 149 - } 145 + 150 146 mt7621_spi_write(rs, MT7621_SPI_MASTER, reg); 151 147 152 148 return 0; ··· 358 368 return -ENOMEM; 359 369 } 360 370 361 - master->mode_bits = RT2880_SPI_MODE_BITS; 371 + master->mode_bits = SPI_LSB_FIRST; 362 372 363 373 master->setup = mt7621_spi_setup; 364 374 master->transfer_one_message = mt7621_spi_transfer_one_message;