All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jagan Teki <jteki@openedev.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v2 05/16] spi: Add support for dual and quad mode
Date: Tue, 17 Nov 2015 11:59:21 +0530	[thread overview]
Message-ID: <CAD6G_RRoHqzpF9w+7w_gRhqd5qjceEeYPPhpZseimE1sp5VeqQ@mail.gmail.com> (raw)
In-Reply-To: <1446624984-11033-6-git-send-email-mugunthanvnm@ti.com>

On 4 November 2015 at 13:46, 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>
> ---
>  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..be365e4 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_int(blob, node, "spi-tx-bus-width", 1);

Value never be negative so better to use fdtdec_get_uint, comments?

> +       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_int(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;
> +       }
> +
>         plat->mode = mode;
>
>         return 0;
> diff --git a/include/spi.h b/include/spi.h
> index b4d2723..40dbb4d 100644
> --- a/include/spi.h
> +++ b/include/spi.h
> @@ -23,6 +23,10 @@
>  #define        SPI_LOOP        0x20                    /* loopback mode */
>  #define        SPI_SLAVE       0x40                    /* slave mode */
>  #define        SPI_PREAMBLE    0x80                    /* Skip preamble bytes */
> +#define        SPI_TX_DUAL     0x100                   /* transmit with 2 wires */
> +#define        SPI_TX_QUAD     0x200                   /* transmit with 4 wires */
> +#define        SPI_RX_DUAL     0x400                   /* receive with 2 wires */
> +#define        SPI_RX_QUAD     0x800                   /* receive with 4 wires */
>
>  /* SPI transfer flags */
>  #define SPI_XFER_BEGIN         0x01    /* Assert CS before transfer */
> --
> 2.6.2.280.g74301d6
>
> _______________________________________________
> U-Boot mailing list
> U-Boot at lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot



-- 
Jagan | openedev.

  parent reply	other threads:[~2015-11-17  6:29 UTC|newest]

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

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=CAD6G_RRoHqzpF9w+7w_gRhqd5qjceEeYPPhpZseimE1sp5VeqQ@mail.gmail.com \
    --to=jteki@openedev.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.