From: Prasanth Mantena <p-mantena@ti.com>
To: Michal Simek <michal.simek@amd.com>
Cc: Venkatesh Yadav Abbarapu <venkatesh.abbarapu@amd.com>,
<u-boot@lists.denx.de>, <tudor.ambarus@linaro.org>,
<j-humphreys@ti.com>, <marex@denx.de>,
<jagan@amarulasolutions.com>, <vigneshr@ti.com>,
<u-kumar1@ti.com>, <trini@konsulko.com>, <seanga2@gmail.com>,
<caleb.connolly@linaro.org>, <sjg@chromium.org>,
<william.zhang@broadcom.com>, <stefan_b@posteo.net>,
<quentin.schulz@cherry.de>, <Takahiro.Kuwano@infineon.com>,
<git@amd.com>, Ashok Reddy Soma <ashok.reddy.soma@amd.com>
Subject: Re: [PATCH] spi: cadence_qspi: Set tshsl_ns to at least one sclk_ns
Date: Fri, 11 Jul 2025 02:00:15 +0530 [thread overview]
Message-ID: <20250710203015.ocrira24b2la2or2@prasanth-server> (raw)
In-Reply-To: <98275d4d-0644-4fc8-9ff6-8d5b8622fd9f@amd.com>
On 15:07, Michal Simek wrote:
>
>
> On 7/2/25 08:57, Venkatesh Yadav Abbarapu wrote:
> > tshsl_ns is the clock delay for chip select deassert. This is the delay in
> > master reference clocks for the length that the master mode chip select
> > outputs are de-asserted between transactions.
> >
> > The minimum delay is always SCLK period to ensure the chip select is never
> > re-asserted within one SCLK period.
> >
> > That is why tshsl_ns delay should be at least one sclk_ns value. If it is
> > less than sclk_ns, set it equal to sclk_ns.
> >
> > Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@amd.com>
> > Signed-off-by: Venkatesh Yadav Abbarapu <venkatesh.abbarapu@amd.com>
> > ---
> > drivers/spi/cadence_qspi_apb.c | 4 ++++
> > 1 file changed, 4 insertions(+)
> >
> > diff --git a/drivers/spi/cadence_qspi_apb.c b/drivers/spi/cadence_qspi_apb.c
> > index 65fb2d8f9fb..4696c09f754 100644
> > --- a/drivers/spi/cadence_qspi_apb.c
> > +++ b/drivers/spi/cadence_qspi_apb.c
> > @@ -303,6 +303,10 @@ void cadence_qspi_apb_delay(void *reg_base,
> > tshsl_ns -= sclk_ns + ref_clk_ns;
> > if (tchsh_ns >= sclk_ns + 3 * ref_clk_ns)
> > tchsh_ns -= sclk_ns + 3 * ref_clk_ns;
> > +
> > + if (tshsl_ns < sclk_ns)
> > + tshsl_ns = sclk_ns;
> > +
Hi Venkatesh,
Just referring to the Controller datasheet, I found this in the
register map for the tshsl delay register field.
Ref : 2.3.4. Device Delay Register
"
The minimum delay for chip select to be de-asserted (CSDA=0)
is:
1 sclk_out + 1 ref_clk to ensure the chip select is never re-
asserted within an sclk_out period.
"
if this delay configured is exactly equals to sclk_out, and if sclk_out
roundsup exactly to ref_clk without a headroom, then the next
transaction would start right after next spike, unless if the controller
adds any delay apart from whats configured in this register.
May be thats why it is having that one ref_clk tick extra added acc to reg map.
Please help me understand this.
Thanks,
Prasanth
> > tshsl = DIV_ROUND_UP(tshsl_ns, ref_clk_ns);
> > tchsh = DIV_ROUND_UP(tchsh_ns, ref_clk_ns);
> > tslch = DIV_ROUND_UP(tslch_ns, ref_clk_ns);
>
> Applied.
> M
next prev parent reply other threads:[~2025-07-10 20:30 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-02 6:57 [PATCH] spi: cadence_qspi: Set tshsl_ns to at least one sclk_ns Venkatesh Yadav Abbarapu
2025-07-08 13:07 ` Michal Simek
2025-07-10 20:30 ` Prasanth Mantena [this message]
2025-07-11 15:12 ` Abbarapu, Venkatesh
2025-07-14 5:37 ` Prasanth Mantena
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=20250710203015.ocrira24b2la2or2@prasanth-server \
--to=p-mantena@ti.com \
--cc=Takahiro.Kuwano@infineon.com \
--cc=ashok.reddy.soma@amd.com \
--cc=caleb.connolly@linaro.org \
--cc=git@amd.com \
--cc=j-humphreys@ti.com \
--cc=jagan@amarulasolutions.com \
--cc=marex@denx.de \
--cc=michal.simek@amd.com \
--cc=quentin.schulz@cherry.de \
--cc=seanga2@gmail.com \
--cc=sjg@chromium.org \
--cc=stefan_b@posteo.net \
--cc=trini@konsulko.com \
--cc=tudor.ambarus@linaro.org \
--cc=u-boot@lists.denx.de \
--cc=u-kumar1@ti.com \
--cc=venkatesh.abbarapu@amd.com \
--cc=vigneshr@ti.com \
--cc=william.zhang@broadcom.com \
/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.