diff mbox

spi: Add support for specifing 3-wire mode via device tree

Message ID 1342183427-23430-1-git-send-email-lars@metafoo.de (mailing list archive)
State Superseded, archived
Headers show

Commit Message

Lars-Peter Clausen July 13, 2012, 12:43 p.m. UTC
This patch allows to specify that a SPI device is connected in 3-wire mode via
the device tree.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
---
 Documentation/devicetree/bindings/spi/spi-bus.txt |    2 ++
 drivers/spi/spi.c                                 |    2 ++
 2 files changed, 4 insertions(+)

Comments

Rob Herring July 13, 2012, 12:44 p.m. UTC | #1
On 07/13/2012 07:43 AM, Lars-Peter Clausen wrote:
> This patch allows to specify that a SPI device is connected in 3-wire mode via
> the device tree.
> 
> Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
> ---

Might explain what 3-wire mode is, but otherwise

Acked-by: Rob Herring <rob.herring@calxeda.com>

>  Documentation/devicetree/bindings/spi/spi-bus.txt |    2 ++
>  drivers/spi/spi.c                                 |    2 ++
>  2 files changed, 4 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/spi/spi-bus.txt b/Documentation/devicetree/bindings/spi/spi-bus.txt
> index e782add..46f2f3b 100644
> --- a/Documentation/devicetree/bindings/spi/spi-bus.txt
> +++ b/Documentation/devicetree/bindings/spi/spi-bus.txt
> @@ -33,6 +33,8 @@ contain the following properties.
>      		shifted clock phase (CPHA) mode
>  - spi-cs-high     - (optional) Empty property indicating device requires
>      		chip select active high
> +- spi-3wire       - (optional) Empty property indicating device requires
> +    		    3-wire mode.
>  
>  SPI example for an MPC5200 SPI bus:
>  	spi@f00 {
> diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
> index fc0da39..09da7de 100644
> --- a/drivers/spi/spi.c
> +++ b/drivers/spi/spi.c
> @@ -856,6 +856,8 @@ static void of_register_spi_devices(struct spi_master *master)
>  			spi->mode |= SPI_CPOL;
>  		if (of_find_property(nc, "spi-cs-high", NULL))
>  			spi->mode |= SPI_CS_HIGH;
> +		if (of_find_property(nc, "spi-3wire", NULL))
> +			spi->mode |= SPI_3WIRE;
>  
>  		/* Device speed */
>  		prop = of_get_property(nc, "spi-max-frequency", &len);
> 


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
diff mbox

Patch

diff --git a/Documentation/devicetree/bindings/spi/spi-bus.txt b/Documentation/devicetree/bindings/spi/spi-bus.txt
index e782add..46f2f3b 100644
--- a/Documentation/devicetree/bindings/spi/spi-bus.txt
+++ b/Documentation/devicetree/bindings/spi/spi-bus.txt
@@ -33,6 +33,8 @@  contain the following properties.
     		shifted clock phase (CPHA) mode
 - spi-cs-high     - (optional) Empty property indicating device requires
     		chip select active high
+- spi-3wire       - (optional) Empty property indicating device requires
+    		    3-wire mode.
 
 SPI example for an MPC5200 SPI bus:
 	spi@f00 {
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index fc0da39..09da7de 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -856,6 +856,8 @@  static void of_register_spi_devices(struct spi_master *master)
 			spi->mode |= SPI_CPOL;
 		if (of_find_property(nc, "spi-cs-high", NULL))
 			spi->mode |= SPI_CS_HIGH;
+		if (of_find_property(nc, "spi-3wire", NULL))
+			spi->mode |= SPI_3WIRE;
 
 		/* Device speed */
 		prop = of_get_property(nc, "spi-max-frequency", &len);