devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: wangyuhang <wangyuhang2014@gmail.com>
To: broonie@kernel.org, linux-spi@vger.kernel.org,
	devicetree@vger.kernel.org, linux-mtd@lists.infradead.org
Cc: sourav.poddar@ti.com, pekon@ti.com,
	wangyuhang <wangyuhang2014@gmail.com>
Subject: [PATCH 2/2] spi: dual and quad support(device tree)
Date: Mon, 26 Aug 2013 13:48:00 +0800	[thread overview]
Message-ID: <1377496080-14356-2-git-send-email-wangyuhang2014@gmail.com> (raw)
In-Reply-To: <1377496080-14356-1-git-send-email-wangyuhang2014@gmail.com>

fix one thing in patch:
commit id:f477b7fb13df2b843997559ff34e87d054ba6538

change property spi-tx-nbits and spi-rx-nbits to optional.
If User don't set spi-tx-nbits or spi-rx-nbits, spi device mode
should be regarded as SINGLE, not return an error.

Signed-off-by: wangyuhang <wangyuhang2014@gmail.com>
---
 drivers/spi/spi.c |   68 +++++++++++++++++++++++++----------------------------
 1 file changed, 32 insertions(+), 36 deletions(-)

diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index 50f7fc3..46a55f0 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -872,46 +872,42 @@ static void of_register_spi_devices(struct spi_master *master)
 		/* Device DUAL/QUAD mode */
 		prop = of_get_property(nc, "spi-tx-nbits", &len);
 		if (!prop || len < sizeof(*prop)) {
-			dev_err(&master->dev, "%s has no 'spi-tx-nbits' property\n",
-				nc->full_name);
-			spi_dev_put(spi);
-			continue;
-		}
-		switch (be32_to_cpup(prop)) {
-		case SPI_NBITS_SINGLE:
-			break;
-		case SPI_NBITS_DUAL:
-			spi->mode |= SPI_TX_DUAL;
-			break;
-		case SPI_NBITS_QUAD:
-			spi->mode |= SPI_TX_QUAD;
-			break;
-		default:
-			dev_err(&master->dev, "spi-tx-nbits value is not supported\n");
-			spi_dev_put(spi);
-			continue;
+			/* set tx mode in SINGLE as default */
+		} else {
+			switch (be32_to_cpup(prop)) {
+			case SPI_NBITS_SINGLE:
+				break;
+			case SPI_NBITS_DUAL:
+				spi->mode |= SPI_TX_DUAL;
+				break;
+			case SPI_NBITS_QUAD:
+				spi->mode |= SPI_TX_QUAD;
+				break;
+			default:
+				dev_err(&master->dev,
+					"spi-tx-nbits value is not supported\n");
+				spi_dev_put(spi);
+				continue;
 		}
 
 		prop = of_get_property(nc, "spi-rx-nbits", &len);
 		if (!prop || len < sizeof(*prop)) {
-			dev_err(&master->dev, "%s has no 'spi-rx-nbits' property\n",
-				nc->full_name);
-			spi_dev_put(spi);
-			continue;
-		}
-		switch (be32_to_cpup(prop)) {
-		case SPI_NBITS_SINGLE:
-			break;
-		case SPI_NBITS_DUAL:
-			spi->mode |= SPI_RX_DUAL;
-			break;
-		case SPI_NBITS_QUAD:
-			spi->mode |= SPI_RX_QUAD;
-			break;
-		default:
-			dev_err(&master->dev, "spi-rx-nbits value is not supported\n");
-			spi_dev_put(spi);
-			continue;
+			/* set rx mode in SINGLE as default */
+		} else {
+			switch (be32_to_cpup(prop)) {
+			case SPI_NBITS_SINGLE:
+				break;
+			case SPI_NBITS_DUAL:
+				spi->mode |= SPI_RX_DUAL;
+				break;
+			case SPI_NBITS_QUAD:
+				spi->mode |= SPI_RX_QUAD;
+				break;
+			default:
+				dev_err(&master->dev,
+					"spi-rx-nbits value is not supported\n");
+				spi_dev_put(spi);
+				continue;
 		}
 
 		/* Device speed */
-- 
1.7.9.5


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

  reply	other threads:[~2013-08-26  5:48 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-26  5:47 [PATCH 1/2] spi: dual and quad support(device tree) wangyuhang
2013-08-26  5:48 ` wangyuhang [this message]
2013-08-26  7:18   ` [PATCH 2/2] " Gupta, Pekon
2013-08-26 12:50     ` Gupta, Pekon
2013-08-27  6:11     ` yuhang wang
2013-08-27  6:31       ` Gupta, Pekon
2013-08-26  6:59 ` [PATCH 1/2] " Gupta, Pekon
2013-08-26  8:09   ` yuhang wang
2013-08-26  9:29     ` Gupta, Pekon
2013-08-26  9:45       ` Gupta, Pekon
2013-08-26 10:41         ` yuhang wang
2013-08-26 12:20           ` Gupta, Pekon
2013-08-26 13:23             ` yuhang wang
2013-08-26 11:13       ` yuhang wang
2013-08-26 12:37         ` Gupta, Pekon
2013-08-26 13:35           ` yuhang wang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1377496080-14356-2-git-send-email-wangyuhang2014@gmail.com \
    --to=wangyuhang2014@gmail.com \
    --cc=broonie@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=linux-spi@vger.kernel.org \
    --cc=pekon@ti.com \
    --cc=sourav.poddar@ti.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).