diff mbox

[U-Boot,3/6] spi: Support half-duplex mode in FDT decode

Message ID 1404749802-22450-3-git-send-email-sjg@chromium.org
State Accepted
Delegated to: Jagannadha Sutradharudu Teki
Headers show

Commit Message

Simon Glass July 7, 2014, 4:16 p.m. UTC
This parameter should also be supported.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 doc/device-tree-bindings/spi/spi-bus.txt | 2 ++
 drivers/spi/spi.c                        | 2 ++
 2 files changed, 4 insertions(+)

Comments

Ajay kumar July 8, 2014, 6:11 a.m. UTC | #1
On Mon, Jul 7, 2014 at 9:46 PM, Simon Glass <sjg@chromium.org> wrote:
> This parameter should also be supported.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
>
>  doc/device-tree-bindings/spi/spi-bus.txt | 2 ++
>  drivers/spi/spi.c                        | 2 ++
>  2 files changed, 4 insertions(+)
>
> diff --git a/doc/device-tree-bindings/spi/spi-bus.txt b/doc/device-tree-bindings/spi/spi-bus.txt
> index 800dafe..5c8720a 100644
> --- a/doc/device-tree-bindings/spi/spi-bus.txt
> +++ b/doc/device-tree-bindings/spi/spi-bus.txt
> @@ -59,6 +59,8 @@ contain the following properties.
>                        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.
> +- spi-half-duplex  - (optional) Indicates that the SPI bus should wait for
> +                     a header byte before reading data from the slave.
>
>  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).
> diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
> index 7ddea9b..7d81fbd 100644
> --- a/drivers/spi/spi.c
> +++ b/drivers/spi/spi.c
> @@ -53,6 +53,8 @@ struct spi_slave *spi_base_setup_slave_fdt(const void *blob, int busnum,
>                 mode |= SPI_CPHA;
>         if (fdtdec_get_bool(blob, node, "spi-cs-high"))
>                 mode |= SPI_CS_HIGH;
> +       if (fdtdec_get_bool(blob, node, "spi-half-duplex"))
> +               mode |= SPI_PREAMBLE;
>         return spi_setup_slave(busnum, cs, max_hz, mode);
>  }
>  #endif
> --
> 2.0.0.526.g5318336
>
> _______________________________________________
> U-Boot mailing list
> U-Boot@lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot
Able to test display on peach_pit(which needs tps65090) with these patches.
Also, crosec commands from u-boot prompt works as expected on peach_pit.

Tested-by: Ajay Kumar <ajaykumar.rs@samsung.com>
Jagan Teki July 13, 2014, 2:41 p.m. UTC | #2
On Tue, Jul 8, 2014 at 11:41 AM, Ajay kumar <ajaynumb@gmail.com> wrote:
> On Mon, Jul 7, 2014 at 9:46 PM, Simon Glass <sjg@chromium.org> wrote:
>> This parameter should also be supported.
>>
>> Signed-off-by: Simon Glass <sjg@chromium.org>
>> ---
>>
>>  doc/device-tree-bindings/spi/spi-bus.txt | 2 ++
>>  drivers/spi/spi.c                        | 2 ++
>>  2 files changed, 4 insertions(+)
>>
>> diff --git a/doc/device-tree-bindings/spi/spi-bus.txt b/doc/device-tree-bindings/spi/spi-bus.txt
>> index 800dafe..5c8720a 100644
>> --- a/doc/device-tree-bindings/spi/spi-bus.txt
>> +++ b/doc/device-tree-bindings/spi/spi-bus.txt
>> @@ -59,6 +59,8 @@ contain the following properties.
>>                        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.
>> +- spi-half-duplex  - (optional) Indicates that the SPI bus should wait for
>> +                     a header byte before reading data from the slave.
>>
>>  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).
>> diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
>> index 7ddea9b..7d81fbd 100644
>> --- a/drivers/spi/spi.c
>> +++ b/drivers/spi/spi.c
>> @@ -53,6 +53,8 @@ struct spi_slave *spi_base_setup_slave_fdt(const void *blob, int busnum,
>>                 mode |= SPI_CPHA;
>>         if (fdtdec_get_bool(blob, node, "spi-cs-high"))
>>                 mode |= SPI_CS_HIGH;
>> +       if (fdtdec_get_bool(blob, node, "spi-half-duplex"))
>> +               mode |= SPI_PREAMBLE;
>>         return spi_setup_slave(busnum, cs, max_hz, mode);
>>  }
>>  #endif
>> --
>> 2.0.0.526.g5318336
>>
>> _______________________________________________
>> U-Boot mailing list
>> U-Boot@lists.denx.de
>> http://lists.denx.de/mailman/listinfo/u-boot
> Able to test display on peach_pit(which needs tps65090) with these patches.
> Also, crosec commands from u-boot prompt works as expected on peach_pit.
>
> Tested-by: Ajay Kumar <ajaykumar.rs@samsung.com>

Applied to u-boot-spi/master

thanks!
diff mbox

Patch

diff --git a/doc/device-tree-bindings/spi/spi-bus.txt b/doc/device-tree-bindings/spi/spi-bus.txt
index 800dafe..5c8720a 100644
--- a/doc/device-tree-bindings/spi/spi-bus.txt
+++ b/doc/device-tree-bindings/spi/spi-bus.txt
@@ -59,6 +59,8 @@  contain the following properties.
                       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.
+- spi-half-duplex  - (optional) Indicates that the SPI bus should wait for
+		      a header byte before reading data from the slave.
 
 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).
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index 7ddea9b..7d81fbd 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -53,6 +53,8 @@  struct spi_slave *spi_base_setup_slave_fdt(const void *blob, int busnum,
 		mode |= SPI_CPHA;
 	if (fdtdec_get_bool(blob, node, "spi-cs-high"))
 		mode |= SPI_CS_HIGH;
+	if (fdtdec_get_bool(blob, node, "spi-half-duplex"))
+		mode |= SPI_PREAMBLE;
 	return spi_setup_slave(busnum, cs, max_hz, mode);
 }
 #endif