mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
To: Sam Ravnborg <sam@ravnborg.org>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH 0/2] spi: imx: don't loop endlessly
Date: Thu, 3 Aug 2017 20:41:18 +0200	[thread overview]
Message-ID: <20170803184118.6mkkhbhi64w2ce72@pengutronix.de> (raw)
In-Reply-To: <20170802203240.GA21641@ravnborg.org>

On Wed, Aug 02, 2017 at 10:32:40PM +0200, Sam Ravnborg wrote:
> Hi Uwe.
> > I havn't looked at it, but it is included in my barebox as I'm using
> > 2017.08.0 + some patches.
> And I did not expect it to solve your problem, only to give you
> inspiration what could be the issue.
> 
> > 
> > Reading through the patch description, it doesn't match my situation.
> OK
> 
> > I'm doing USB-Booting because when I made eMMC work all my available
> > remote hands already called it a day. So unless the boot ROM does
> > something strange (impossible!) barebox is the first spi user.
> > 
> > What seems to be similar is that TESTREG.TXCNT is != 0. For me this
> > smells clk-related. On i.MX6 I recently identified a problem (but didn't
> > come around yet to mainline a fix) that might match at least your
> > problem.
> > 
> > Can you still reproduce?
> We have used the patch from Sascha for a long time now (from before it
> hit barebox-next, and on our proprietary IMX6 target we never
> saw the SPI related error since.
> 
> 	Sam
> 
> > How does your clk-tree look like (clk_dump)?
> 
> This is with:
> $ version
> barebox 2017.03.0-1 #1 Sun May 14 16:17:24 CEST 2017
> + some of our own patches (nothing clk related).
> 
> $ clk_dump
> [...]
>             ecspi_root (rate 60000000, enabled)
>                 ecspi1 (rate 60000000, enabled)
>                 ecspi2 (rate 60000000, enabled)
>                 ecspi3 (rate 60000000, enabled)
>                 ecspi4 (rate 60000000, enabled)
>                 ecspi5 (rate 60000000, enabled)

ecspi_root is defined as:

	clks[IMX6QDL_CLK_ECSPI_ROOT] = imx_clk_divider("ecspi_root", "pll3_60m", base + 0x38, 19, 6);

The RM (Reference Manual) describes this register as follows:

	CCM_CSCDR2, bits 24–19: ... NOTE: Divider should be updated when
	output clock is gated.

It seems the BOOTROM in some older revisions of the chips didn't respect
this requirement (for a different clk though) which resulted in
ERR007117 (described in the ChipErrata document for the i.XM6DQ):

	For raw NAND boot, ROM switches the source of enfc_clk_root from
	PLL2_PFD2 to PLL3. The root clock is required to be gated before
	switching the source clock. If the root clock is not gated, clock
	glitches might be passed to the divider that follows the clock mux, and
	the divider might behave unpredictably. This can cause the clock
	generation to fail and the chip will not boot successfully.
	
	This problem can also occur elsewhere in application code if the
	root clock is not properly gated when the clock configuration is
	changed.

IMHO this fits nicely to your error description. i.MX6UL is affected for
sure as it does

        clk_set_parent(clks[IMX6UL_CLK_ENFC_SEL], clks[IMX6UL_CLK_PLL2_PFD2]);

without making sure that some affected clks are off. This resulted in
failures to probe the NAND occasionally on a customer machine.

For i.MX6SDL or i.MX6DQ I don't see a matching change for the ecspi_root
clk, but maybe this is triggered by setting the frequency on one of the
child clocks?!

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  parent reply	other threads:[~2017-08-03 18:41 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-02 19:39 Uwe Kleine-König
2017-08-02 19:39 ` [PATCH 1/2] spi: imx: add error checking Uwe Kleine-König
2017-08-02 19:39 ` [PATCH 2/2] spi: imx: add timeout to xchg_single Uwe Kleine-König
2017-08-02 19:54 ` [PATCH 0/2] spi: imx: don't loop endlessly Sam Ravnborg
2017-08-02 20:19   ` Uwe Kleine-König
2017-08-02 20:32     ` Sam Ravnborg
2017-08-03  9:07       ` Uwe Kleine-König
2017-08-03 10:43         ` Sam Ravnborg
2017-08-03 18:41       ` Uwe Kleine-König [this message]
2017-09-29 18:08 ` Alexander Kurz
2017-10-02  5:31   ` Uwe Kleine-König

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=20170803184118.6mkkhbhi64w2ce72@pengutronix.de \
    --to=u.kleine-koenig@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=sam@ravnborg.org \
    /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