[PATCH 1/2] spi: dual and quad support(add single macro)
wangyuhang
wangyuhang2014 at gmail.com
Fri Aug 30 06:05:09 EDT 2013
fix using default value to specify single mode in patch:
commit id:f477b7fb13df2b843997559ff34e87d054ba6538
Using mode & ~(DUAL | QUAD) to specify SINGLE mode, instead
of using default value in mode. Which means if select neither
DUAL nor QUAD, SINGLE will be in use.
Signed-off-by: wangyuhang <wangyuhang2014 at gmail.com>
---
drivers/spi/spi.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index 8d191f2..6653913 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -872,10 +872,15 @@ static void of_register_spi_devices(struct spi_master *master)
/* Device DUAL/QUAD mode */
prop = of_get_property(nc, "spi-tmax-nbits", &len);
if (!prop || len < sizeof(*prop)) {
- /* set tx mode in SINGLE as default */
+ /*
+ * set tx mode in SINGLE as default
+ * if select neither DUAL nor QUAD, regarded as single.
+ */
+ spi->mode &= ~(SPI_TX_DUAL | SPI_TX_QUAD);
} else {
switch (be32_to_cpup(prop)) {
case SPI_NBITS_SINGLE:
+ spi->mode &= ~(SPI_TX_DUAL | SPI_TX_QUAD);
break;
case SPI_NBITS_DUAL:
spi->mode |= SPI_TX_DUAL;
@@ -893,9 +898,11 @@ static void of_register_spi_devices(struct spi_master *master)
prop = of_get_property(nc, "spi-rmax-nbits", &len);
if (!prop || len < sizeof(*prop)) {
/* set rx mode in SINGLE as default */
+ spi->mode &= ~(SPI_RX_DUAL | SPI_RX_QUAD);
} else {
switch (be32_to_cpup(prop)) {
case SPI_NBITS_SINGLE:
+ spi->mode &= ~(SPI_RX_DUAL | SPI_RX_QUAD);
break;
case SPI_NBITS_DUAL:
spi->mode |= SPI_RX_DUAL;
--
1.7.9.5
More information about the linux-mtd
mailing list