linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tim Harvey <tharvey@gateworks.com>
To: Jacky Bai <ping.bai@nxp.com>
Cc: Frieder Schrempf <frieder.schrempf@kontron.de>,
	Abel Vesa <abel.vesa@nxp.com>, Dong Aisheng <dongas86@gmail.com>,
	Aisheng Dong <aisheng.dong@nxp.com>,
	Rob Herring <robh@kernel.org>, Peng Fan <peng.fan@nxp.com>,
	Philipp Zabel <p.zabel@pengutronix.de>,
	Anson Huang <anson.huang@nxp.com>,
	devicetree <devicetree@vger.kernel.org>,
	Stephen Boyd <sboyd@kernel.org>, Adam Ford <aford173@gmail.com>,
	Mike Turquette <mturquette@baylibre.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Marek Vasut <marek.vasut@gmail.com>,
	dl-linux-imx <linux-imx@nxp.com>,
	Sascha Hauer <kernel@pengutronix.de>,
	Fabio Estevam <fabio.estevam@nxp.com>,
	Shawn Guo <shawnguo@kernel.org>,
	linux-clk <linux-clk@vger.kernel.org>,
	"moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE" 
	<linux-arm-kernel@lists.infradead.org>,
	Lucas Stach <l.stach@pengutronix.de>
Subject: Re: [PATCH v5 10/14] clk: imx: Add generic blk-ctl driver
Date: Thu, 18 Mar 2021 12:58:08 -0700	[thread overview]
Message-ID: <CAJ+vNU27TUQC4Dt=RHKDkOZFzCV2kWEoxOy-RYyv0+O=fLE+LQ@mail.gmail.com> (raw)
In-Reply-To: <DBBPR04MB7930D839D5595BB692CB26DA879E9@DBBPR04MB7930.eurprd04.prod.outlook.com>

On Thu, Feb 25, 2021 at 12:28 AM Jacky Bai <ping.bai@nxp.com> wrote:
>
>
>
> > -----Original Message-----
> > From: Frieder Schrempf [mailto:frieder.schrempf@kontron.de]
> > Sent: Thursday, February 25, 2021 4:23 PM
> > To: Abel Vesa <abel.vesa@nxp.com>; Dong Aisheng <dongas86@gmail.com>
> > Cc: Aisheng Dong <aisheng.dong@nxp.com>; Rob Herring <robh@kernel.org>;
> > Peng Fan <peng.fan@nxp.com>; Jacky Bai <ping.bai@nxp.com>; Anson Huang
> > <anson.huang@nxp.com>; devicetree <devicetree@vger.kernel.org>;
> > Stephen Boyd <sboyd@kernel.org>; Shawn Guo <shawnguo@kernel.org>;
> > Mike Turquette <mturquette@baylibre.com>; Linux Kernel Mailing List
> > <linux-kernel@vger.kernel.org>; Marek Vasut <marek.vasut@gmail.com>;
> > dl-linux-imx <linux-imx@nxp.com>; Sascha Hauer <kernel@pengutronix.de>;
> > Fabio Estevam <fabio.estevam@nxp.com>; Philipp Zabel
> > <p.zabel@pengutronix.de>; Adam Ford <aford173@gmail.com>; linux-clk
> > <linux-clk@vger.kernel.org>; moderated list:ARM/FREESCALE IMX / MXC
> > ARM ARCHITECTURE <linux-arm-kernel@lists.infradead.org>; Lucas Stach
> > <l.stach@pengutronix.de>
> > Subject: Re: [PATCH v5 10/14] clk: imx: Add generic blk-ctl driver
> >
> > Hi Abel,
> >
> > On 17.11.20 15:48, Abel Vesa wrote:
> > > On 20-11-11 17:13:25, Dong Aisheng wrote:
> > >> On Tue, Nov 3, 2020 at 7:22 PM Abel Vesa <abel.vesa@nxp.com> wrote:
> > >> ...
> > >>> +static int imx_blk_ctl_reset_set(struct reset_controller_dev *rcdev,
> > >>> +                                 unsigned long id, bool assert) {
> > >>> +       struct imx_blk_ctl_drvdata *drvdata = container_of(rcdev,
> > >>> +                       struct imx_blk_ctl_drvdata, rcdev);
> > >>> +       unsigned int offset = drvdata->rst_hws[id].offset;
> > >>> +       unsigned int shift = drvdata->rst_hws[id].shift;
> > >>> +       unsigned int mask = drvdata->rst_hws[id].mask;
> > >>> +       void __iomem *reg_addr = drvdata->base + offset;
> > >>> +       unsigned long flags;
> > >>> +       u32 reg;
> > >>> +
> > >>> +       if (!assert && !test_bit(1, &drvdata->rst_hws[id].asserted))
> > >>> +               return -ENODEV;
> > >>
> > >> What if consumers call deassert first in probe which seems common in
> > kernel?
> > >> It seems will fail.
> > >> e.g.
> > >> probe() {
> > >>      reset_control_get()
> > >>      reset_control_deassert()
> > >> }
> > >>
> > >> Regards
> > >> Aisheng
> > >>
> > >
> > > OK, I'm trying to explain here how I know the resets are supposed to
> > > be working and how the BLK_CTL IP is working.
> > >
> > >
> > > First of, the BLK_CTL bits (resets and clocks) all have the HW init
> > > (default) values as 0. Basically, after the blk_ctl PD is powered on,
> > > the resets are deasserted and clocks are gated by default. Since the
> > > blk_ctl is not the parent of any of the consumers in devicetree (the
> > > reg maps are entirely different anyway), there is no way of ordering
> > > the runtime callbacks between the consumer and the blk_ctl. So we
> > > might end up having the runtime resume callback after the one from
> > > EARC (consumer), for example, which will basically overwrite the value
> > written by EARC driver with whatever was saved on suspend.
> > >
> > > Now, about the usage of the reset bits. AFAICT, it would make more
> > > sense to assert the reset, then enable the clock, then deassert. This
> > > way, you're keeping the EARC (consumer) in reset (with the clocks on)
> > > until you eventually release it out of reset by deasserting. This is
> > > how the runtime resume should deal with the reset and the clock. As
> > > for the runtime suspend, the reset can be entirely ignored as long as you're
> > disabling the clock.
> > >
> > > This last part will allow the blk_ctl to make the following assumption:
> > > if all the clocks are disabled and none of the reset bits are asserted, I can
> > power off.
> > >
> > > Now, I know there are drivers outthere that do assert on suspend, but
> > > as long as the clocks are disabled, the assert will have no impact.
> > > But maybe in their case the reset controller cannot power down itself.
> > >
> > > As for the safekeeping of the register, I'll just drop it due to the following
> > arguments:
> > > 1. all the clocks are gated by default 2. all resets are deasserted by
> > > default 3. when blk_ctl goes down, all the consumers go down. (all
> > > have the same PD)
> > >
> > >  From 1 and 2 results the IP will not be running and from 3 results
> > > the HW state of every IP becomes HW init state.
> >
> > Are there any plans to continue this work? As BLK-CTL it is not only relevant
> > for the i.MX8MP, but also for i.MX8MM and i.MX8MN, it would be nice to get
> > this ready in order to prepare for proper graphics/display support.
> >
>
> Before continuing this work, we need to find out a way to resolve the cycling dependency issue between power domain and blk-ctrl.
> it is indeed introduced some troubles in NXP latest internal release when the blk-ctrl driver is added.
>

Jacky,

Any update on this? This is still blocking several drivers and major
functionality of the i.MX8 SoC's in mainline and I would hope this
would be a top priority for NXP.

Best regards,

Tim

  reply	other threads:[~2021-03-18 19:59 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-03 11:18 [PATCH v5 00/14] Add BLK_CTL support for i.MX8MP Abel Vesa
2020-11-03 11:18 ` [PATCH v5 01/14] dt-bindings: clocks: imx8mp: Rename audiomix ids clocks to audio_blk_ctl Abel Vesa
2020-11-05  1:05   ` Stephen Boyd
2020-11-03 11:18 ` [PATCH v5 02/14] dt-bindings: reset: imx8mp: Add audio blk_ctl reset IDs Abel Vesa
2020-11-05  1:05   ` Stephen Boyd
2020-11-03 11:18 ` [PATCH v5 03/14] dt-bindings: clock: imx8mp: Add ids for the audio shared gate Abel Vesa
2020-11-05  1:05   ` Stephen Boyd
2020-11-03 11:18 ` [PATCH v5 04/14] dt-bindings: clock: imx8mp: Add media blk_ctl clock IDs Abel Vesa
2020-11-05  1:05   ` Stephen Boyd
2020-11-03 11:18 ` [PATCH v5 05/14] dt-bindings: reset: imx8mp: Add media blk_ctl reset IDs Abel Vesa
2020-11-05  1:06   ` Stephen Boyd
2020-11-03 11:18 ` [PATCH v5 06/14] dt-bindings: clock: imx8mp: Add hdmi blk_ctl clock IDs Abel Vesa
2020-11-05  1:06   ` Stephen Boyd
2020-11-03 11:18 ` [PATCH v5 07/14] dt-bindings: reset: imx8mp: Add hdmi blk_ctl reset IDs Abel Vesa
2020-11-05  1:06   ` Stephen Boyd
2020-11-03 11:18 ` [PATCH v5 08/14] clk: imx8mp: Add audio shared gate Abel Vesa
2020-11-05  1:07   ` Stephen Boyd
2020-11-03 11:18 ` [PATCH v5 09/14] Documentation: bindings: clk: Add bindings for i.MX BLK_CTL Abel Vesa
2020-11-04 19:01   ` Rob Herring
2020-11-05  1:08   ` Stephen Boyd
2020-11-03 11:18 ` [PATCH v5 10/14] clk: imx: Add generic blk-ctl driver Abel Vesa
2020-11-05  0:59   ` Stephen Boyd
2020-11-09  5:45   ` Jacky Bai
2020-11-11  9:13   ` Dong Aisheng
2020-11-17 14:48     ` Abel Vesa
2021-02-25  8:23       ` Frieder Schrempf
2021-02-25  8:27         ` Jacky Bai
2021-03-18 19:58           ` Tim Harvey [this message]
2020-11-03 11:18 ` [PATCH v5 11/14] clk: imx: Add blk-ctl driver for i.MX8MP Abel Vesa
2020-11-05  1:09   ` Stephen Boyd
2020-11-03 11:18 ` [PATCH v5 12/14] arm64: dts: imx8mp: Add audio_blk_ctl node Abel Vesa
2020-11-03 11:18 ` [PATCH v5 13/14] arm64: dts: imx8mp: Add media_blk_ctl node Abel Vesa
2020-11-03 11:18 ` [PATCH v5 14/14] arm64: dts: imx8mp: Add hdmi_blk_ctl node Abel Vesa
2021-03-03 10:47 ` [PATCH v5 00/14] Add BLK_CTL support for i.MX8MP Abel Vesa
2021-03-03 10:54   ` Marek Vasut
2021-03-22 23:49     ` Adam Ford

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='CAJ+vNU27TUQC4Dt=RHKDkOZFzCV2kWEoxOy-RYyv0+O=fLE+LQ@mail.gmail.com' \
    --to=tharvey@gateworks.com \
    --cc=abel.vesa@nxp.com \
    --cc=aford173@gmail.com \
    --cc=aisheng.dong@nxp.com \
    --cc=anson.huang@nxp.com \
    --cc=devicetree@vger.kernel.org \
    --cc=dongas86@gmail.com \
    --cc=fabio.estevam@nxp.com \
    --cc=frieder.schrempf@kontron.de \
    --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=marek.vasut@gmail.com \
    --cc=mturquette@baylibre.com \
    --cc=p.zabel@pengutronix.de \
    --cc=peng.fan@nxp.com \
    --cc=ping.bai@nxp.com \
    --cc=robh@kernel.org \
    --cc=sboyd@kernel.org \
    --cc=shawnguo@kernel.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;
as well as URLs for NNTP newsgroup(s).