diff mbox

spi: quad: fix the name of DT property

Message ID 1378028181-5409-1-git-send-email-wangyuhang2014@gmail.com
State New, archived
Headers show

Commit Message

王宇航 Sept. 1, 2013, 9:36 a.m. UTC
spi: quad: fix the name of DT property in patch

The previous property name spi-tx-nbits and spi-rx-nbits looks not
human-readable. To make it consistent with other devices, using property
name spi-tx-bus-width and spi-rx-bus-width instead of the previous one
specify the number of data wires that spi controller will work in.
Add the specification in spi-bus.txt.

Signed-off-by: wangyuhang <wangyuhang2014@gmail.com>
---
 Documentation/devicetree/bindings/spi/spi-bus.txt |   10 ++++++++++
 drivers/spi/spi.c                                 |    8 ++++----
 2 files changed, 14 insertions(+), 4 deletions(-)

Comments

Mark Brown Sept. 1, 2013, 12:46 p.m. UTC | #1
On Sun, Sep 01, 2013 at 05:36:21PM +0800, wangyuhang wrote:
> spi: quad: fix the name of DT property in patch
> 
> The previous property name spi-tx-nbits and spi-rx-nbits looks not
> human-readable. To make it consistent with other devices, using property
> name spi-tx-bus-width and spi-rx-bus-width instead of the previous one
> specify the number of data wires that spi controller will work in.
> Add the specification in spi-bus.txt.

Applied, thanks - if there's disagreement about the DT bindings (or
indeed other problems) then I can not send this in the final pull
request but if it is OK I wanted it to be in -next on Monday.
Stephen Warren Sept. 3, 2013, 4:53 p.m. UTC | #2
On 09/01/2013 03:36 AM, wangyuhang wrote:
> spi: quad: fix the name of DT property in patch
> 
> The previous property name spi-tx-nbits and spi-rx-nbits looks not
> human-readable. To make it consistent with other devices, using property
> name spi-tx-bus-width and spi-rx-bus-width instead of the previous one
> specify the number of data wires that spi controller will work in.
> Add the specification in spi-bus.txt.

> diff --git a/Documentation/devicetree/bindings/spi/spi-bus.txt b/Documentation/devicetree/bindings/spi/spi-bus.txt

>  - spi-3wire       - (optional) Empty property indicating device requires
>      		    3-wire mode.
> +- spi-tx-bus-width - (optional) The bus width(number of data wires) that
> +                      used for MOSI. Defaults to 1 if not present.
> +- spi-rx-bus-width - (optional) The bus width(number of data wires) that
> +                      used for MISO. Defaults to 1 if not present.

The binding,
Acked-by: Stephen Warren <swarren@nvidia.com>

I would have preferred my original wording rather than the unqualified
"MOSI"/"MISO", since the meaning of those terms depends on whether
you're looking at the host controller or the device, but I guess we can
assume that since this is documentation for the host controller binding,
the naming is in terms of the host controller's signals.
Mark Brown Sept. 3, 2013, 11:01 p.m. UTC | #3
On Tue, Sep 03, 2013 at 10:53:11AM -0600, Stephen Warren wrote:

> I would have preferred my original wording rather than the unqualified
> "MOSI"/"MISO", since the meaning of those terms depends on whether
> you're looking at the host controller or the device, but I guess we can

No, MOSI and MISO have fixed meanings at all ends - they expand to
Master Out Slave In and Master In Slave Out so it's always clear which
side should be transmitting.
diff mbox

Patch

diff --git a/Documentation/devicetree/bindings/spi/spi-bus.txt b/Documentation/devicetree/bindings/spi/spi-bus.txt
index 296015e..800dafe 100644
--- a/Documentation/devicetree/bindings/spi/spi-bus.txt
+++ b/Documentation/devicetree/bindings/spi/spi-bus.txt
@@ -55,6 +55,16 @@  contain the following properties.
     		chip select active high
 - spi-3wire       - (optional) Empty property indicating device requires
     		    3-wire mode.
+- spi-tx-bus-width - (optional) The bus width(number of data wires) that
+                      used for MOSI. Defaults to 1 if not present.
+- spi-rx-bus-width - (optional) The bus width(number of data wires) that
+                      used for MISO. Defaults to 1 if not present.
+
+Some SPI controllers and devices support Dual and Quad SPI transfer mode.
+It allows data in SPI system transfered in 2 wires(DUAL) or 4 wires(QUAD).
+Now the value that spi-tx-bus-width and spi-rx-bus-width can receive is
+only 1(SINGLE), 2(DUAL) and 4(QUAD).
+Dual/Quad mode is not allowed when 3-wire mode is used.
 
 If a gpio chipselect is used for the SPI slave the gpio number will be passed
 via the cs_gpio
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index 7557f61..0075318 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -870,7 +870,7 @@  static void of_register_spi_devices(struct spi_master *master)
 			spi->mode |= SPI_3WIRE;
 
 		/* Device DUAL/QUAD mode */
-		prop = of_get_property(nc, "spi-tx-nbits", &len);
+		prop = of_get_property(nc, "spi-tx-bus-width", &len);
 		if (prop && len == sizeof(*prop)) {
 			switch (be32_to_cpup(prop)) {
 			case SPI_NBITS_SINGLE:
@@ -883,14 +883,14 @@  static void of_register_spi_devices(struct spi_master *master)
 				break;
 			default:
 				dev_err(&master->dev,
-					"spi-tx-nbits %d not supported\n",
+					"spi-tx-bus-width %d not supported\n",
 					be32_to_cpup(prop));
 				spi_dev_put(spi);
 				continue;
 			}
 		}
 
-		prop = of_get_property(nc, "spi-rx-nbits", &len);
+		prop = of_get_property(nc, "spi-rx-bus-width", &len);
 		if (prop && len == sizeof(*prop)) {
 			switch (be32_to_cpup(prop)) {
 			case SPI_NBITS_SINGLE:
@@ -903,7 +903,7 @@  static void of_register_spi_devices(struct spi_master *master)
 				break;
 			default:
 				dev_err(&master->dev,
-					"spi-rx-nbits %d not supported\n",
+					"spi-rx-bus-width %d not supported\n",
 					be32_to_cpup(prop));
 				spi_dev_put(spi);
 				continue;