public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Mugunthan V N <mugunthanvnm@ti.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v3 05/16] spi: Add support for dual and quad mode
Date: Sun, 6 Dec 2015 11:33:23 +0530	[thread overview]
Message-ID: <5663CFAB.3070207@ti.com> (raw)
In-Reply-To: <CAD6G_RR_3ZzD72ybOgnW8AGvrA+Ru+DKxCpxkZmQ5iP9LRBDuw@mail.gmail.com>

On Thursday 03 December 2015 09:37 PM, Jagan Teki wrote:
> On 19 November 2015 at 12:35, Mugunthan V N <mugunthanvnm@ti.com> wrote:
>> spi bus can support dual and quad wire data transfers for tx and
>> rx. So defining dual and quad modes for both tx and rx. Also add
>> support to parse bus width used for spi tx and rx transfers.
>>
>> Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com>
>> Reviewed-by: Simon Glass <sjg@chromium.org>
>> Reviewed-by: Tom Rini <trini@konsulko.com>
>> ---
>>  drivers/spi/spi-uclass.c | 33 +++++++++++++++++++++++++++++++++
>>  include/spi.h            |  4 ++++
>>  2 files changed, 37 insertions(+)
>>
>> diff --git a/drivers/spi/spi-uclass.c b/drivers/spi/spi-uclass.c
>> index 58388ef..62d8da7 100644
>> --- a/drivers/spi/spi-uclass.c
>> +++ b/drivers/spi/spi-uclass.c
>> @@ -349,6 +349,7 @@ int spi_slave_ofdata_to_platdata(const void *blob, int node,
>>                                  struct dm_spi_slave_platdata *plat)
>>  {
>>         int mode = 0;
>> +       int value;
>>
>>         plat->cs = fdtdec_get_int(blob, node, "reg", -1);
>>         plat->max_hz = fdtdec_get_int(blob, node, "spi-max-frequency", 0);
>> @@ -360,6 +361,38 @@ int spi_slave_ofdata_to_platdata(const void *blob, int node,
>>                 mode |= SPI_CS_HIGH;
>>         if (fdtdec_get_bool(blob, node, "spi-half-duplex"))
>>                 mode |= SPI_PREAMBLE;
>> +
>> +       /* Device DUAL/QUAD mode */
>> +       value = fdtdec_get_uint(blob, node, "spi-tx-bus-width", 1);
>> +       switch (value) {
>> +       case 1:
>> +               break;
>> +       case 2:
>> +               mode |= SPI_TX_DUAL;
>> +               break;
>> +       case 4:
>> +               mode |= SPI_TX_QUAD;
>> +               break;
>> +       default:
>> +               error("spi-tx-bus-width %d not supported\n", value);
>> +               break;
>> +       }
>> +
>> +       value = fdtdec_get_uint(blob, node, "spi-rx-bus-width", 1);
>> +       switch (value) {
>> +       case 1:
>> +               break;
>> +       case 2:
>> +               mode |= SPI_RX_DUAL;
>> +               break;
>> +       case 4:
>> +               mode |= SPI_RX_QUAD;
>> +               break;
>> +       default:
>> +               error("spi-rx-bus-width %d not supported\n", value);
>> +               break;
>> +       }
>> +
> 
> I think these are similar to SPI TX/RX operation modes in spi.h and I
> understand this is similar approach as with Linux but before this we
> need to do many changes on u-boot as well.

I agree that op_mode_rx/op_mode_tx can be used. I just tried to follow
Linux way of implementation to have consistency between Linux and
U-Boot. If you feel that using op_mode_(rx/tx) will be the best
approach, I can repost the series with the changes.

Regards
Mugunthan V N

  reply	other threads:[~2015-12-06  6:03 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-19  7:05 [U-Boot] [PATCH v3 00/16] device model bring-up of ti-qspi on dra72, dra74 and am437x-sk evm Mugunthan V N
2015-11-19  7:05 ` [U-Boot] [PATCH v3 01/16] drivers: spi: ti_qspi: do not hard code chip select for memory map configuration Mugunthan V N
2015-11-19  7:05 ` [U-Boot] [PATCH v3 02/16] drivers: spi:ti_qspi: change ti_qspi_slave to ti_qspi_priv for driver model conversion Mugunthan V N
2015-11-19  7:05 ` [U-Boot] [PATCH v3 03/16] drivers: spi: ti_qspi: prepare driver for DM conversion Mugunthan V N
2015-11-19  7:05 ` [U-Boot] [PATCH v3 04/16] dm: core: Add a new api to get indexed device address Mugunthan V N
2015-11-19  7:05 ` [U-Boot] [PATCH v3 05/16] spi: Add support for dual and quad mode Mugunthan V N
2015-12-03 16:07   ` Jagan Teki
2015-12-06  6:03     ` Mugunthan V N [this message]
2015-12-06 14:43       ` Jagan Teki
2015-12-08 15:05         ` Mugunthan V N
2015-12-08 15:48           ` Jagan Teki
2015-12-15  7:52   ` [U-Boot] [PATCH v4 " Mugunthan V N
2015-12-15  8:13     ` Jagan Teki
2015-12-17  6:30       ` Mugunthan V N
2015-12-17  6:49         ` Jagan Teki
2015-12-17 16:40           ` Jagan Teki
2015-12-20  3:24             ` Mugunthan V N
2015-11-19  7:05 ` [U-Boot] [PATCH v3 06/16] dra7xx_evm: qspi: do not define DM_SPI and DM_SPI_FLASH for spl Mugunthan V N
2015-11-19  7:05 ` [U-Boot] [PATCH v3 07/16] dts: dra7: add spi alias for qspi Mugunthan V N
2015-11-19  7:05 ` [U-Boot] [PATCH v3 08/16] drivers: spi: ti_qspi: convert driver to adopt device driver model Mugunthan V N
2015-12-15  7:52   ` [U-Boot] [PATCH v4 " Mugunthan V N
2015-11-19  7:05 ` [U-Boot] [PATCH v3 09/16] arm: dts: dra7: add qspi register maps for memory map and control module Mugunthan V N
2015-11-19  7:05 ` [U-Boot] [PATCH v3 10/16] drivers: mtd: spi: sf_probe: add compatible for spansion spi flash Mugunthan V N
2015-11-19 10:10   ` Jagan Teki
2015-11-20  6:01     ` Mugunthan V N
2015-11-20 12:27       ` Jagan Teki
2015-11-23 11:29         ` Mugunthan V N
2015-11-23 13:12           ` Jagan Teki
2015-12-03 16:02             ` Jagan Teki
2015-12-06  6:57               ` Mugunthan V N
2015-11-23 15:24           ` Tom Rini
2015-11-19  7:05 ` [U-Boot] [PATCH v3 11/16] drivers: mtd: spi: sf_probe: add compatible for Macronix " Mugunthan V N
2015-11-19  7:05 ` [U-Boot] [PATCH v3 12/16] defconfig: dra72_evm: enable spi driver model Mugunthan V N
2015-11-19  7:05 ` [U-Boot] [PATCH v3 13/16] defconfig: dra74_evm: " Mugunthan V N
2015-11-19  7:05 ` [U-Boot] [PATCH v3 14/16] am43xx_evm: qspi: do not define DM_SPI and DM_SPI_FLASH for spl Mugunthan V N
2015-11-21  1:20   ` Tom Rini
2015-11-19  7:05 ` [U-Boot] [PATCH v3 15/16] arm: dts: am4372: add qspi register maps for memory map Mugunthan V N
2015-11-19  7:05 ` [U-Boot] [PATCH v3 16/16] defconfig: am437x_sk_evm: enable spi driver model Mugunthan V N
2015-12-01  6:31 ` [U-Boot] [PATCH v3 00/16] device model bring-up of ti-qspi on dra72, dra74 and am437x-sk evm Mugunthan V N

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=5663CFAB.3070207@ti.com \
    --to=mugunthanvnm@ti.com \
    --cc=u-boot@lists.denx.de \
    /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