public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Jagan Teki <jteki@openedev.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v2 3/5] spi: Use mode instead of op_mode_tx
Date: Mon, 14 Dec 2015 13:09:26 +0530	[thread overview]
Message-ID: <566E722E.9070800@openedev.com> (raw)
In-Reply-To: <CAEUhbmVLVG1SDo6s9C=DDunnGiOne5dh+8vsMM-wVSR-egPD2w@mail.gmail.com>

Hi Bin,

On Monday 14 December 2015 01:04 PM, Bin Meng wrote:
> On Mon, Dec 14, 2015 at 2:57 PM, Jagan Teki <jteki@openedev.com> wrote:
>> Used mode member from spi_slave{} instead of op_mode_tx.
>>
>> Cc: Bin Meng <bmeng.cn@gmail.com>
>> Cc: Simon Glass <sjg@chromium.org>
>> Signed-off-by: Jagan Teki <jteki@openedev.com>
>> ---
>> Changes for v2:
>>          - none
>>
>>   drivers/mtd/spi/sf_probe.c  | 2 +-
>>   drivers/mtd/spi/spi_flash.c | 4 ++--
>>   drivers/spi/ich.c           | 2 +-
>>   include/spi.h               | 8 ++------
>>   4 files changed, 6 insertions(+), 10 deletions(-)
>>
>> diff --git a/drivers/mtd/spi/sf_probe.c b/drivers/mtd/spi/sf_probe.c
>> index 0cafc29..3519ffd 100644
>> --- a/drivers/mtd/spi/sf_probe.c
>> +++ b/drivers/mtd/spi/sf_probe.c
>> @@ -128,7 +128,7 @@ static int spi_flash_std_write(struct udevice *dev, u32 offset, size_t len,
>>
>>   #if defined(CONFIG_SPI_FLASH_SST)
>>          if (flash->flags & SNOR_F_SST_WR) {
>> -               if (flash->spi->op_mode_tx & SPI_OPM_TX_BP)
>> +               if (flash->spi->mode & SPI_TX_BP)
>>                          return sst_write_bp(flash, offset, len, buf);
>>                  else
>>                          return sst_write_wp(flash, offset, len, buf);
>> diff --git a/drivers/mtd/spi/spi_flash.c b/drivers/mtd/spi/spi_flash.c
>> index 30a381b..836aad9 100644
>> --- a/drivers/mtd/spi/spi_flash.c
>> +++ b/drivers/mtd/spi/spi_flash.c
>> @@ -968,7 +968,7 @@ int spi_flash_scan(struct spi_flash *flash)
>>          flash->write = spi_flash_cmd_write_ops;
>>   #if defined(CONFIG_SPI_FLASH_SST)
>>          if (flash->flags & SNOR_F_SST_WR) {
>> -               if (spi->op_mode_tx & SPI_OPM_TX_BP)
>> +               if (spi->mode & SPI_TX_BP)
>>                          flash->write = sst_write_bp;
>>                  else
>>                          flash->write = sst_write_wp;
>> @@ -1042,7 +1042,7 @@ int spi_flash_scan(struct spi_flash *flash)
>>          }
>>
>>          /* Not require to look for fastest only two write cmds yet */
>> -       if (params->flags & WR_QPP && spi->op_mode_tx & SPI_OPM_TX_QPP)
>> +       if (params->flags & WR_QPP && spi->mode & SPI_TX_QPP)
>>                  flash->write_cmd = CMD_QUAD_PAGE_PROGRAM;
>>          else
>>                  /* Go for default supported write cmd */
>> diff --git a/drivers/spi/ich.c b/drivers/spi/ich.c
>> index f85af9c..64322dd 100644
>> --- a/drivers/spi/ich.c
>> +++ b/drivers/spi/ich.c
>> @@ -753,7 +753,7 @@ static int ich_spi_child_pre_probe(struct udevice *dev)
>>           */
>>          if (plat->ich_version == 7) {
>>                  slave->op_mode_rx = SPI_OPM_RX_AS;
>> -               slave->op_mode_tx = SPI_OPM_TX_BP;
>> +               slave->mode = SPI_TX_BP;
>>          }
>>
>>          return 0;
>> diff --git a/include/spi.h b/include/spi.h
>> index 713bab9..2b36c5a 100644
>> --- a/include/spi.h
>> +++ b/include/spi.h
>> @@ -23,6 +23,8 @@
>>   #define        SPI_LOOP        0x20                    /* loopback mode */
>>   #define        SPI_SLAVE       0x40                    /* slave mode */
>>   #define        SPI_PREAMBLE    0x80                    /* Skip preamble bytes */
>> +#define SPI_TX_BP      0x100                   /* transmit with 1 wire byte */
>> +#define SPI_TX_QPP     0x200                   /* transmit with 4 wires */
>>
>>   /* SPI transfer flags */
>>   #define SPI_XFER_BEGIN         0x01    /* Assert CS before transfer */
>> @@ -32,10 +34,6 @@
>>   #define SPI_XFER_ONCE          (SPI_XFER_BEGIN | SPI_XFER_END)
>>   #define SPI_XFER_U_PAGE        (1 << 5)
>>
>> -/* SPI TX operation modes */
>> -#define SPI_OPM_TX_QPP         (1 << 0)
>> -#define SPI_OPM_TX_BP          (1 << 1)
>> -
>>   /* SPI RX operation modes */
>>   #define SPI_OPM_RX_AS          (1 << 0)
>>   #define SPI_OPM_RX_AF          (1 << 1)
>
> And what about RX mode flags? Do you have plan to merge op_mode_rx
> into spi->mode as well?

Tried the same but for rx there is simple algo for finding fastest read 
using fls, so that fls in-deed need rx as separate member.

thanks!
-- 
Jagan

  reply	other threads:[~2015-12-14  7:39 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-14  6:57 [U-Boot] [PATCH v2 1/5] sf: Get spi locally from spi_flash Jagan Teki
2015-12-14  6:57 ` [U-Boot] [PATCH v2 2/5] spi: make mode visible to both dm and non-dm Jagan Teki
2015-12-14  6:57 ` [U-Boot] [PATCH v2 3/5] spi: Use mode instead of op_mode_tx Jagan Teki
2015-12-14  7:31   ` Bin Meng
2015-12-14  7:35     ` Jagan Teki
2015-12-14  7:34   ` Bin Meng
2015-12-14  7:39     ` Jagan Teki [this message]
2015-12-14  6:57 ` [U-Boot] [PATCH v2 4/5] spi: Rename SPI_TX_BP|QPP to SPI_TX_BYTE|QUAD Jagan Teki
2015-12-14  6:57 ` [U-Boot] [PATCH v2 5/5] sf: Move spi_read_cmds_array locally 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=566E722E.9070800@openedev.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox