All of lore.kernel.org
 help / color / mirror / Atom feed
From: Leonard Crestez <leonard.crestez@nxp.com>
To: "festevam@gmail.com" <festevam@gmail.com>,
	"p.zabel@pengutronix.de" <p.zabel@pengutronix.de>
Cc: dl-linux-imx <linux-imx@nxp.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"mturquette@baylibre.com" <mturquette@baylibre.com>,
	"sboyd@kernel.org" <sboyd@kernel.org>,
	Fabio Estevam <fabio.estevam@nxp.com>,
	Jacky Bai <ping.bai@nxp.com>,
	"dri-devel@lists.freedesktop.org"
	<dri-devel@lists.freedesktop.org>,
	"shawnguo@kernel.org" <shawnguo@kernel.org>,
	Ying Liu <victor.liu@nxp.com>, Anson Huang <anson.huang@nxp.com>,
	"linux-clk@vger.kernel.org" <linux-clk@vger.kernel.org>,
	"l.stach@pengutronix.de" <l.stach@pengutronix.de>,
	"kernel@pengutronix.de" <kernel@pengutronix.de>,
	"linux-arm-kernel@lists.infradead.org" 
	<linux-arm-kernel@lists.infradead.org>
Subject: Re: [RFC] clk: imx6: Mark imx_clk_mux as glitchy by default
Date: Wed, 22 Aug 2018 06:53:14 +0000	[thread overview]
Message-ID: <c0966648ef0a15672ddd617de87692f71a19bad4.camel@nxp.com> (raw)
In-Reply-To: <CAOMZO5Dr9NUXuu+LECp2QHZLRhfbymHK23yCCFW-9jB=VXNn+A@mail.gmail.com>

On Tue, 2018-08-21 at 19:42 -0300, Fabio Estevam wrote:
> Hi Leonard,
> 
> On Tue, Aug 21, 2018 at 4:34 PM, Leonard Crestez
> <leonard.crestez@nxp.com> wrote:
> 
> > More concretely on 6qp-sdb blanking the display happens like this:
> >  * imx_ldb_encoder_disable switches ipu1_di0_sel to ipu1_di0_pre from ldb_di1_podf
> >  * reparenting to ipu1_di0_pre enables it and its parents up to pll5
> >  * possibly glitchy muxing
> >  * ipu_di_disable disables ipu1_di0 (and parents, up to pll5)

> We have already taken care of it in these commits:
>     clk: imx6: Fix procedure to switch the parent of LDB_DI_CLK
>     clk: imx6: Make the LDB_DI0 and LDB_DI1 clocks read-only

That's for ldb_di{0,1}_sel, this is for ipu{1,2}_di{0,1}_sel.

On imx6q the ldb_di{0,1}_sel mux has an improperly placed gate and a
special switch procedure needs to be performed at boot time. This
design was fixed on 6qp by moving the ldb_di{0,1} gate immediately
after the mux. My tests are on 6qp.

For ipu{1,2}_di{0,1}_sel the ipu{1,2}_di{0,1} gate can be used on all
chips, it's just that the drm driver doesn't do this. Adding the
CLK_SET_RATE_PARENT flag exposes the issue by returning errors.

> I think we should also take care of the other glitchy muxes as
> you propose here.
>
> Have you seen such glitch issue in practice with the LDB clocks?

If I run "while true; do rtcwake -m mem -s 5; done" it will hang in ~30
minutes because the "suspend devices" takes too long and RTC alarm
expires. I tracked this down to the clk_set_parent call inside
imx_ldb_encoder_disable: sometimes this takes many seconds.

As far as I can tell this live reparenting is unsafe (RM claims
glitches are possible) and not useful (we're deactivating the display
anyway). However I'm not sure this can be blamed on a "glitch".

What seems to be happening is that this triggers the enabling of pll5
(yes, on disable) and the usleep from clk_pllv3_wait_lock takes far too
much time to return. This might be an unrelated timekeeping issue, I'll
look into this further.

According to the RM this reparenting is unsafe anyway so we should
avoid it, probably by disabling ipu_di sooner.

--
Regards,
Leonard

WARNING: multiple messages have this Message-ID (diff)
From: Leonard Crestez <leonard.crestez@nxp.com>
To: "festevam@gmail.com" <festevam@gmail.com>,
	"p.zabel@pengutronix.de" <p.zabel@pengutronix.de>
Cc: dl-linux-imx <linux-imx@nxp.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"mturquette@baylibre.com" <mturquette@baylibre.com>,
	"sboyd@kernel.org" <sboyd@kernel.org>,
	Fabio Estevam <fabio.estevam@nxp.com>,
	Jacky Bai <ping.bai@nxp.com>,
	"dri-devel@lists.freedesktop.org"
	<dri-devel@lists.freedesktop.org>,
	"shawnguo@kernel.org" <shawnguo@kernel.org>,
	Ying Liu <victor.liu@nxp.com>, Anson Huang <anson.huang@nxp.com>,
	"linux-clk@vger.kernel.org" <linux-clk@vger.kernel.org>,
	"l.stach@pengutronix.de" <l.stach@pengutronix.de>,
	"kernel@pengutronix.de" <kernel@pengutronix.de>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>
Subject: Re: [RFC] clk: imx6: Mark imx_clk_mux as glitchy by default
Date: Wed, 22 Aug 2018 06:53:14 +0000	[thread overview]
Message-ID: <c0966648ef0a15672ddd617de87692f71a19bad4.camel@nxp.com> (raw)
In-Reply-To: <CAOMZO5Dr9NUXuu+LECp2QHZLRhfbymHK23yCCFW-9jB=VXNn+A@mail.gmail.com>

T24gVHVlLCAyMDE4LTA4LTIxIGF0IDE5OjQyIC0wMzAwLCBGYWJpbyBFc3RldmFtIHdyb3RlOg0K
PiBIaSBMZW9uYXJkLA0KPiANCj4gT24gVHVlLCBBdWcgMjEsIDIwMTggYXQgNDozNCBQTSwgTGVv
bmFyZCBDcmVzdGV6DQo+IDxsZW9uYXJkLmNyZXN0ZXpAbnhwLmNvbT4gd3JvdGU6DQo+IA0KPiA+
IE1vcmUgY29uY3JldGVseSBvbiA2cXAtc2RiIGJsYW5raW5nIHRoZSBkaXNwbGF5IGhhcHBlbnMg
bGlrZSB0aGlzOg0KPiA+ICAqIGlteF9sZGJfZW5jb2Rlcl9kaXNhYmxlIHN3aXRjaGVzIGlwdTFf
ZGkwX3NlbCB0byBpcHUxX2RpMF9wcmUgZnJvbSBsZGJfZGkxX3BvZGYNCj4gPiAgKiByZXBhcmVu
dGluZyB0byBpcHUxX2RpMF9wcmUgZW5hYmxlcyBpdCBhbmQgaXRzIHBhcmVudHMgdXAgdG8gcGxs
NQ0KPiA+ICAqIHBvc3NpYmx5IGdsaXRjaHkgbXV4aW5nDQo+ID4gICogaXB1X2RpX2Rpc2FibGUg
ZGlzYWJsZXMgaXB1MV9kaTAgKGFuZCBwYXJlbnRzLCB1cCB0byBwbGw1KQ0KDQo+IFdlIGhhdmUg
YWxyZWF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aGVyLg0KDQpBY2NvcmRpbmcgdG8gdGhlIFJNIHRoaXMgcmVwYXJl
bnRpbmcgaXMgdW5zYWZlIGFueXdheSBzbyB3ZSBzaG91bGQNCmF2b2lkIGl0LCBwcm9iYWJseSBi
eSBkaXNhYmxpbmcgaXB1X2RpIHNvb25lci4NCg0KLS0NClJlZ2FyZHMsDQpMZW9uYXJkDQo=

WARNING: multiple messages have this Message-ID (diff)
From: leonard.crestez@nxp.com (Leonard Crestez)
To: linux-arm-kernel@lists.infradead.org
Subject: [RFC] clk: imx6: Mark imx_clk_mux as glitchy by default
Date: Wed, 22 Aug 2018 06:53:14 +0000	[thread overview]
Message-ID: <c0966648ef0a15672ddd617de87692f71a19bad4.camel@nxp.com> (raw)
In-Reply-To: <CAOMZO5Dr9NUXuu+LECp2QHZLRhfbymHK23yCCFW-9jB=VXNn+A@mail.gmail.com>

On Tue, 2018-08-21 at 19:42 -0300, Fabio Estevam wrote:
> Hi Leonard,
> 
> On Tue, Aug 21, 2018 at 4:34 PM, Leonard Crestez
> <leonard.crestez@nxp.com> wrote:
> 
> > More concretely on 6qp-sdb blanking the display happens like this:
> >  * imx_ldb_encoder_disable switches ipu1_di0_sel to ipu1_di0_pre from ldb_di1_podf
> >  * reparenting to ipu1_di0_pre enables it and its parents up to pll5
> >  * possibly glitchy muxing
> >  * ipu_di_disable disables ipu1_di0 (and parents, up to pll5)

> We have already taken care of it in these commits:
>     clk: imx6: Fix procedure to switch the parent of LDB_DI_CLK
>     clk: imx6: Make the LDB_DI0 and LDB_DI1 clocks read-only

That's for ldb_di{0,1}_sel, this is for ipu{1,2}_di{0,1}_sel.

On imx6q the ldb_di{0,1}_sel mux has an improperly placed gate and a
special switch procedure needs to be performed at boot time. This
design was fixed on 6qp by moving the ldb_di{0,1} gate immediately
after the mux. My tests are on 6qp.

For ipu{1,2}_di{0,1}_sel the ipu{1,2}_di{0,1} gate can be used on all
chips, it's just that the drm driver doesn't do this. Adding the
CLK_SET_RATE_PARENT flag exposes the issue by returning errors.

> I think we should also take care of the other glitchy muxes as
> you propose here.
>
> Have you seen such glitch issue in practice with the LDB clocks?

If I run "while true; do rtcwake -m mem -s 5; done" it will hang in ~30
minutes because the "suspend devices" takes too long and RTC alarm
expires. I tracked this down to the clk_set_parent call inside
imx_ldb_encoder_disable: sometimes this takes many seconds.

As far as I can tell this live reparenting is unsafe (RM claims
glitches are possible) and not useful (we're deactivating the display
anyway). However I'm not sure this can be blamed on a "glitch".

What seems to be happening is that this triggers the enabling of pll5
(yes, on disable) and the usleep from clk_pllv3_wait_lock takes far too
much time to return. This might be an unrelated timekeeping issue, I'll
look into this further.

According to the RM this reparenting is unsafe anyway so we should
avoid it, probably by disabling ipu_di sooner.

--
Regards,
Leonard

  reply	other threads:[~2018-08-22  6:53 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-21 19:34 [RFC] clk: imx6: Mark imx_clk_mux as glitchy by default Leonard Crestez
2018-08-21 19:34 ` Leonard Crestez
2018-08-21 22:42 ` Fabio Estevam
2018-08-21 22:42   ` Fabio Estevam
2018-08-21 22:42   ` Fabio Estevam
2018-08-21 22:42   ` Fabio Estevam
2018-08-22  6:53   ` Leonard Crestez [this message]
2018-08-22  6:53     ` Leonard Crestez
2018-08-22  6:53     ` Leonard Crestez
2018-08-22  6:53     ` Leonard Crestez

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=c0966648ef0a15672ddd617de87692f71a19bad4.camel@nxp.com \
    --to=leonard.crestez@nxp.com \
    --cc=anson.huang@nxp.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=fabio.estevam@nxp.com \
    --cc=festevam@gmail.com \
    --cc=kernel@pengutronix.de \
    --cc=l.stach@pengutronix.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-imx@nxp.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mturquette@baylibre.com \
    --cc=p.zabel@pengutronix.de \
    --cc=ping.bai@nxp.com \
    --cc=sboyd@kernel.org \
    --cc=shawnguo@kernel.org \
    --cc=victor.liu@nxp.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.