From: Chin Liang See <clsee@altera.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] spi: cadence_qspi: Ensure spi_calibration is run when sclk change
Date: Tue, 1 Sep 2015 04:13:38 -0500 [thread overview]
Message-ID: <1441098818.1901.4.camel@clsee-VirtualBox> (raw)
In-Reply-To: <201509011101.55689.marex@denx.de>
On Tue, 2015-09-01 at 11:01 +0200, marex at denx.de wrote:
> On Tuesday, September 01, 2015 at 10:46:47 AM, Chin Liang See wrote:
> > Ensuring spi_calibration is run when there is a change of sclk
> > frequency. This will ensure the qspi flash access works for high
> > sclk frequency
> >
> > Signed-off-by: Chin Liang See <clsee@altera.com>
> > Cc: Dinh Nguyen <dinguyen@opensource.altera.com>
> > Cc: Marek Vasut <marex@denx.de>
> > Cc: Stefan Roese <sr@denx.de>
> > Cc: Vikas Manocha <vikas.manocha@st.com>
> > Cc: Jagannadh Teki <jteki@openedev.com>
> > Cc: Pavel Machek <pavel@denx.de>
> > ---
> > drivers/spi/cadence_qspi.c | 3 +++
> > 1 files changed, 3 insertions(+), 0 deletions(-)
> >
> > diff --git a/drivers/spi/cadence_qspi.c b/drivers/spi/cadence_qspi.c
> > index 34a0f46..512bf2d 100644
> > --- a/drivers/spi/cadence_qspi.c
> > +++ b/drivers/spi/cadence_qspi.c
> > @@ -128,6 +128,9 @@ static int cadence_spi_set_speed(struct udevice *bus,
> > uint hz)
> >
> > cadence_spi_write_speed(bus, hz);
> >
> > + /* to ensure spi_calibration is run when SCLK frequency change */
> > + plat->max_hz = hz;
> > +
>
> This looks like a hack, doesn't this change just subvert the condition
> below to enforce the calibration ?
Nope. I checked through debugger where plat->max_hz is initialized once
with the value from device tree. When you use sf probe to change
frequency, the value is not reflected to plat->max_hz. Hence the
calibration is not run when frequency change. That lead to the sf probe
fail when running at 80MHz or higher. Note the priv->qspi_calibrated_hz
is updated after calibration succeed.
Thanks
Chin Liang
>
> > /* Calibration required for different SCLK speed or chip select */
> > if (priv->qspi_calibrated_hz != plat->max_hz ||
> > priv->qspi_calibrated_cs != spi_chip_select(bus)) {
>
> Best regards,
> Marek Vasut
next prev parent reply other threads:[~2015-09-01 9:13 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-01 8:46 [U-Boot] [PATCH] spi: cadence_qspi: Ensure spi_calibration is run when sclk change Chin Liang See
2015-09-01 9:01 ` Marek Vasut
2015-09-01 9:13 ` Chin Liang See [this message]
2015-09-01 9:14 ` Chin Liang See
2015-09-01 9:19 ` Marek Vasut
2015-09-01 9:30 ` Chin Liang See
2015-09-01 9:34 ` Marek Vasut
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=1441098818.1901.4.camel@clsee-VirtualBox \
--to=clsee@altera.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