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 1/2] spi: ti_qspi: Add dummy readl for bus sync
Date: Tue, 17 Nov 2015 23:55:29 +0530	[thread overview]
Message-ID: <CAD6G_RQT2rFf0K4NQ9szRU-vy3mcLnQXOfnfG7RoMs3B7Bzwfw@mail.gmail.com> (raw)
In-Reply-To: <CAD6G_RSbVTt3r6=-t1oCwHjncdxdpdTxnQ0pCGqYVHNuzhEfSw@mail.gmail.com>

On 17 November 2015 at 12:16, Jagan Teki <jteki@openedev.com> wrote:
> On 17 November 2015 at 11:57, Vignesh R <vigneshr@ti.com> wrote:
>>
>>
>> On 11/17/2015 11:33 AM, Jagan Teki wrote:
>>> On 10 November 2015 at 11:52, Vignesh R <vigneshr@ti.com> wrote:
>>>> Add dummy readl after invalidating cmd field of QSPI_CMD_REG to ensure
>>>> bus sync. Without this device's CS is not deactivated reliably leading
>>>> to failure to enumerate flash or failure to set quad enable bit on
>>>> Macronix flash present on am437x-sk and am437x-idk evms.
>>>>
>>>> Signed-off-by: Vignesh R <vigneshr@ti.com>
>>>> ---
>>>>  drivers/spi/ti_qspi.c | 2 ++
>>>>  1 file changed, 2 insertions(+)
>>>>
>>>> diff --git a/drivers/spi/ti_qspi.c b/drivers/spi/ti_qspi.c
>>>> index bd63db8a2acc..ba2da017c21a 100644
>>>> --- a/drivers/spi/ti_qspi.c
>>>> +++ b/drivers/spi/ti_qspi.c
>>>> @@ -170,6 +170,8 @@ void spi_cs_deactivate(struct spi_slave *slave)
>>>>         debug("spi_cs_deactivate: 0x%08x\n", (u32)slave);
>>>>
>>>>         writel(qslave->cmd | QSPI_INVAL, &qslave->base->cmd);
>>>> +       /* dummy readl to ensure bus sync */
>>>> +       readl(&qslave->base->cmd);
>>>
>>> Isn't effect anything for non-quad case? and dummy bytes might changed
>>> based on quad and quadio does this single dummy readl is same for
>>> those cases as well?
>>
>> No, this dummy readl is not related as dummy bytes used in QUAD mode.
>>
>> In ti_qspi controller, in order to end a read/write request (ie to
>> deassert ChipSelect) invalid cmd(0x4) needs to be written to CMD field
>> of QSPI_CMD_REG (which is done by above function) in all modes.
>> Sometimes, this write may have been flushed out of ARM but may not have
>> reached the QSPI IP yet (ie bus/interconnect is not flushed yet) hence
>> ChipSelect is not deactivated. Therefore, the successive write/read
>> operation may overlaps resulting in wrong data being read from flash.
>> Reading back QSPI_CMD_REG makes sure that the bus/interconnect is
>> flushed and register write is affected making sure CS is deactivated.
>
> Thanks for the info.
>
> Reviewed-by: Jagan Teki <jteki@openedev.com>

Applied to u-boot-spi/master

thanks!
-- 
Jagan | openedev.

  reply	other threads:[~2015-11-17 18:25 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-10  6:22 [U-Boot] [PATCH 0/2] am43xx: Enable QUAD mode and DMA support for QSPI Vignesh R
2015-11-10  6:22 ` [U-Boot] [PATCH 1/2] spi: ti_qspi: Add dummy readl for bus sync Vignesh R
2015-11-12  9:48   ` Mugunthan V N
2015-11-17  6:03   ` Jagan Teki
2015-11-17  6:27     ` Vignesh R
2015-11-17  6:46       ` Jagan Teki
2015-11-17 18:25         ` Jagan Teki [this message]
2015-11-10  6:22 ` [U-Boot] [PATCH 2/2] ARM: am43xx: Enable QUAD read and EDMA support for ti_qspi Vignesh R
2015-11-12  9:47   ` Mugunthan V N
2015-11-17  5:59     ` Jagan Teki
2015-11-17 18:27       ` Jagan Teki
2015-11-17  5:03 ` [U-Boot] [PATCH 0/2] am43xx: Enable QUAD mode and DMA support for QSPI Vignesh R

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_RQT2rFf0K4NQ9szRU-vy3mcLnQXOfnfG7RoMs3B7Bzwfw@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.