mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "André Draszik" <andre.draszik@linaro.org>
To: Peng Fan <peng.fan@nxp.com>,
	Michael Turquette <mturquette@baylibre.com>,
	 Stephen Boyd <sboyd@kernel.org>,
	Peter Griffin <peter.griffin@linaro.org>,
	Krzysztof Kozlowski <krzk@kernel.org>,
	Sylwester Nawrocki <s.nawrocki@samsung.com>,
	Chanwoo Choi <cw00.choi@samsung.com>,
	Alim Akhtar <alim.akhtar@samsung.com>,
	Sam Protsenko <semen.protsenko@linaro.org>,
	Tudor Ambarus <tudor.ambarus@linaro.org>,
	Abel Vesa <abelvesa@kernel.org>, Shawn Guo <shawnguo@kernel.org>,
	Sascha Hauer <s.hauer@pengutronix.de>,
	Pengutronix Kernel Team <kernel@pengutronix.de>,
	 Fabio Estevam <festevam@gmail.com>
Cc: Will McVicker <willmcvicker@google.com>,
	"kernel-team@android.com" <kernel-team@android.com>,
	"linux-clk@vger.kernel.org" <linux-clk@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>,
	"linux-samsung-soc@vger.kernel.org"
	<linux-samsung-soc@vger.kernel.org>,
	"imx@lists.linux.dev" <imx@lists.linux.dev>
Subject: Re: [PATCH v6 01/20] clk: bump stdout clock usage for earlycon
Date: Fri, 09 Aug 2024 10:02:25 +0100	[thread overview]
Message-ID: <d4580b33c195dcf1c3a0054b29555383d2e1606b.camel@linaro.org> (raw)
In-Reply-To: <PAXPR04MB8459F99475C289A827987AF588BA2@PAXPR04MB8459.eurprd04.prod.outlook.com>

Hi Peng,

On Fri, 2024-08-09 at 07:16 +0000, Peng Fan wrote:
> > +static int __init of_clk_drop_stdout_clocks(void) {
> > +	for (size_t i = 0; i < of_clk_stdout_clks.n_clks; ++i) {
> > +		clk_disable_unprepare(of_clk_stdout_clks.clks[i]);
> > +		clk_put(of_clk_stdout_clks.clks[i]);
> > +	}
> > +
> > +	kfree(of_clk_stdout_clks.clks);
> > +
> > +	/*
> > +	 * Do not try to acquire stdout clocks after late initcalls, e.g.
> > +	 * during further module loading, as we then wouldn't have a
> > way to
> > +	 * drop the references (and associated allocations) ever again.
> > +	 */
> > +	of_clk_stdout_clks.bump_refs = false;
> > +
> > +	return 0;
> > +}
> > +late_initcall_sync(of_clk_drop_stdout_clocks);
> 
> If the uart driver is built as module, this might break earlycon.
> Before uart driver loaded, clk disabled per my understanding.

You're right.

With this in mind, I'm not sure then if a generic solution is possible...

I guess it has to be duplicated into the platforms after all and platforms
can enable this if they opt to disallow uart as module?

Any other suggestions?

> > +
> >  /**
> >   * struct of_clk_provider - Clock provider registration structure
> >   * @link: Entry in global list of clock providers @@ -5031,6 +5156,8
> > @@ int of_clk_add_provider(struct device_node *np,
> > 
> >  	fwnode_dev_initialized(&np->fwnode, true);
> > 
> > +	of_clk_bump_stdout_clocks();
> > +
> >  	return ret;
> >  }
> >  EXPORT_SYMBOL_GPL(of_clk_add_provider);
> > @@ -5073,6 +5200,8 @@ int of_clk_add_hw_provider(struct
> > device_node *np,
> > 
> >  	fwnode_dev_initialized(&np->fwnode, true);
> > 
> > +	of_clk_bump_stdout_clocks();
> 
> If clock driver is built as module,  the will make the
> clocks will be always enabled, if my understanding is correct.

until late_initcall_sync(), at which point it'll be disabled before the uart
driver has probed, yes :-(

Cheers,
Andre'


  reply	other threads:[~2024-08-09  9:02 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-08 14:42 [PATCH v6 00/20] clk: help OF platforms with their stdout (earlycon) clocks during early boot André Draszik
2024-08-08 14:42 ` [PATCH v6 01/20] clk: bump stdout clock usage for earlycon André Draszik
2024-08-08 20:14   ` Stephen Boyd
2024-08-09  8:50     ` André Draszik
2024-08-09  7:16   ` Peng Fan
2024-08-09  9:02     ` André Draszik [this message]
2024-08-09  9:07       ` André Draszik
2024-08-10  9:43         ` Peng Fan
2024-08-10  9:48       ` Peng Fan
2024-08-08 14:42 ` [PATCH v6 02/20] clk: samsung: gs101: don't mark non-essential (UART) clocks critical André Draszik
2024-08-08 14:42 ` [PATCH v6 03/20] clk: imx: imx25: drop call to imx_register_uart_clocks() André Draszik
2024-08-08 14:42 ` [PATCH v6 04/20] clk: imx: imx27: " André Draszik
2024-08-08 14:42 ` [PATCH v6 05/20] clk: imx: imx35: " André Draszik
2024-08-08 14:42 ` [PATCH v6 06/20] clk: imx: imx5: " André Draszik
2024-08-08 14:42 ` [PATCH v6 07/20] clk: imx: imx6q: " André Draszik
2024-08-08 14:42 ` [PATCH v6 08/20] clk: imx: imx6sl: " André Draszik
2024-08-08 14:42 ` [PATCH v6 09/20] clk: imx: imx6sll: " André Draszik
2024-08-08 14:42 ` [PATCH v6 10/20] clk: imx: imx6sx: " André Draszik
2024-08-08 14:42 ` [PATCH v6 11/20] clk: imx: imx6ul: " André Draszik
2024-08-08 14:42 ` [PATCH v6 12/20] clk: imx: imx7d: " André Draszik
2024-08-08 14:42 ` [PATCH v6 13/20] clk: imx: imx7ulp: drop calls " André Draszik
2024-08-08 14:42 ` [PATCH v6 14/20] clk: imx: imx8mm: drop call " André Draszik
2024-08-08 14:42 ` [PATCH v6 15/20] clk: imx: imx8mn: " André Draszik
2024-08-08 14:42 ` [PATCH v6 16/20] clk: imx: imx8mp: " André Draszik
2024-08-08 14:42 ` [PATCH v6 17/20] clk: imx: imx8mq: " André Draszik
2024-08-08 14:42 ` [PATCH v6 18/20] clk: imx: imx8ulp: " André Draszik
2024-08-08 14:43 ` [PATCH v6 19/20] clk: imx: imx93: " André Draszik
2024-08-08 14:43 ` [PATCH v6 20/20] clk: imx: drop imx_register_uart_clocks() André Draszik

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=d4580b33c195dcf1c3a0054b29555383d2e1606b.camel@linaro.org \
    --to=andre.draszik@linaro.org \
    --cc=abelvesa@kernel.org \
    --cc=alim.akhtar@samsung.com \
    --cc=cw00.choi@samsung.com \
    --cc=festevam@gmail.com \
    --cc=imx@lists.linux.dev \
    --cc=kernel-team@android.com \
    --cc=kernel@pengutronix.de \
    --cc=krzk@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=mturquette@baylibre.com \
    --cc=peng.fan@nxp.com \
    --cc=peter.griffin@linaro.org \
    --cc=s.hauer@pengutronix.de \
    --cc=s.nawrocki@samsung.com \
    --cc=sboyd@kernel.org \
    --cc=semen.protsenko@linaro.org \
    --cc=shawnguo@kernel.org \
    --cc=tudor.ambarus@linaro.org \
    --cc=willmcvicker@google.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®