All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mugunthan V N <mugunthanvnm@ti.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH re-send v6 05/17] spi: Add support for dual and quad mode
Date: Wed, 30 Dec 2015 11:25:18 +0530	[thread overview]
Message-ID: <568371C6.8030605@ti.com> (raw)
In-Reply-To: <CAD6G_RSLCtJ=2eJOUS7L2i54VL6FM54ZQmjdToTYUFmX5Bu2rw@mail.gmail.com>

On Monday 28 December 2015 08:19 PM, Jagan Teki wrote:
> On 23 December 2015 at 20:39, 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>
>> ---
>>  drivers/spi/spi-uclass.c | 31 +++++++++++++++++++++++++++++++
>>  include/spi.h            |  4 ++++
>>  2 files changed, 35 insertions(+)
>>
>> diff --git a/drivers/spi/spi-uclass.c b/drivers/spi/spi-uclass.c
>> index e0f6b25..e5df2c2 100644
>> --- a/drivers/spi/spi-uclass.c
>> +++ b/drivers/spi/spi-uclass.c
>> @@ -157,6 +157,7 @@ static int spi_child_pre_probe(struct udevice *dev)
>>
>>         slave->max_hz = plat->max_hz;
>>         slave->mode = plat->mode;
>> +       slave->mode_rx = plat->mode_rx;
>>
>>         return 0;
>>  }
>> @@ -369,6 +370,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);
>> @@ -382,6 +384,35 @@ int spi_slave_ofdata_to_platdata(const void *blob, int node,
>>                 mode |= SPI_3WIRE;
>>         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;
> 
> I think it missed case 2 for dual

I tried searching spi devices using dual mode for tx in kernel dt files,
but I found only single and quad mode, so I dropped dual mode parsing.

It can be added when there is a controller which supports max dual mode.

> 
>> +       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:
>> +               plat->mode_rx |= SPI_RX_DUAL;
>> +               break;
>> +       case 4:
>> +               plat->mode_rx |= 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 803fb40..94d8a32 100644
>> --- a/include/spi.h
>> +++ b/include/spi.h
>> @@ -38,11 +38,15 @@ struct dm_spi_bus {
>>   * @cs:                Chip select number (0..n-1)
>>   * @max_hz:    Maximum bus speed that this slave can tolerate
>>   * @mode:      SPI mode to use for this device (see SPI mode flags)
>> + * @mode_rx:   SPI RX operation mode.
>> + * @mode_tx:   SPI TX operation mode.
>>   */
>>  struct dm_spi_slave_platdata {
>>         unsigned int cs;
>>         uint max_hz;
>>         uint mode;
>> +       u8 mode_rx;
>> +       u8 mode_tx;
> 
> mode_tx not required and you defined but not used.

Oops, missed removing this unused. Do you want me to post this patch
only as a followup patch or the entire series as v7?

Regards
Mugunthan V N

> 
>>  };
>>
>>  #endif /* CONFIG_DM_SPI */
>> --
>> 2.7.0.rc1.5.gf3adf45
> 
> thanks!
> 

  reply	other threads:[~2015-12-30  5:55 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-23 15:09 [U-Boot] [PATCH re-send v6 00/17] device model bring-up of ti-qspi on dra72, dra74 and am437x-sk evm Mugunthan V N
2015-12-23 15:09 ` [U-Boot] [PATCH re-send v6 01/17] drivers: spi: ti_qspi: do not hard code chip select for memory map configuration Mugunthan V N
2015-12-23 15:09 ` [U-Boot] [PATCH re-send v6 02/17] drivers: spi:ti_qspi: change ti_qspi_slave to ti_qspi_priv for driver model conversion Mugunthan V N
2015-12-23 15:09 ` [U-Boot] [PATCH re-send v6 03/17] drivers: spi: ti_qspi: prepare driver for DM conversion Mugunthan V N
2015-12-23 15:09 ` [U-Boot] [PATCH re-send v6 04/17] dm: core: Add a new api to get indexed device address Mugunthan V N
2015-12-23 15:09 ` [U-Boot] [PATCH re-send v6 05/17] spi: Add support for dual and quad mode Mugunthan V N
2015-12-28 14:49   ` Jagan Teki
2015-12-30  5:55     ` Mugunthan V N [this message]
2015-12-23 15:09 ` [U-Boot] [PATCH re-send v6 06/17] dra7xx_evm: qspi: do not define DM_SPI and DM_SPI_FLASH for spl Mugunthan V N
2015-12-23 15:09 ` [U-Boot] [PATCH re-send v6 07/17] dts: dra7: add spi alias for qspi Mugunthan V N
2015-12-23 15:09 ` [U-Boot] [PATCH re-send v6 08/17] drivers: spi: ti_qspi: convert driver to adopt device driver model Mugunthan V N
2015-12-23 15:09 ` [U-Boot] [PATCH re-send v6 09/17] arm: dts: dra7: add qspi register maps for memory map and control module Mugunthan V N
2015-12-23 15:09 ` [U-Boot] [PATCH re-send v6 10/17] arm: dts: am437x-gp-evm: add spi-flash comaptible for flash Mugunthan V N
2015-12-23 15:09 ` [U-Boot] [PATCH re-send v6 11/17] arm: dts: dra7-evm: " Mugunthan V N
2015-12-23 15:09 ` [U-Boot] [PATCH re-send v6 12/17] arm: dts: dra72-evm: " Mugunthan V N
2015-12-23 15:09 ` [U-Boot] [PATCH re-send v6 13/17] defconfig: dra72_evm: enable spi driver model Mugunthan V N
2015-12-23 15:09 ` [U-Boot] [PATCH re-send v6 14/17] defconfig: dra74_evm: " Mugunthan V N
2015-12-23 15:09 ` [U-Boot] [PATCH re-send v6 15/17] am43xx_evm: qspi: do not define DM_SPI and DM_SPI_FLASH for spl Mugunthan V N
2015-12-23 15:09 ` [U-Boot] [PATCH re-send v6 16/17] arm: dts: am4372: add qspi register maps for memory map Mugunthan V N
2015-12-23 15:09 ` [U-Boot] [PATCH re-send v6 17/17] defconfig: am437x_sk_evm: enable spi driver model Mugunthan V N
2015-12-29  6:45 ` [U-Boot] [PATCH re-send v6 00/17] device model bring-up of ti-qspi on dra72, dra74 and am437x-sk evm 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=568371C6.8030605@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 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.