public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Miquel Raynal <miquel.raynal@bootlin.com>
To: Michael Nazzareno Trimarchi <michael@amarulasolutions.com>
Cc: hs@denx.de, Dario Binacchi <dario.binacchi@amarulasolutions.com>,
	u-boot@lists.denx.de, Fabio Estevam <festevam@denx.de>,
	linux-amarula@amarulasolutions.com, Ye Li <ye.li@nxp.com>,
	AKASHI Takahiro <akashi.tkhro@gmail.com>,
	Jaehoon Chung <jh80.chung@samsung.com>,
	Tom Rini <trini@konsulko.com>
Subject: Re: [PATCH 08/26] power: Add iMX8M block ctrl driver for dispmix
Date: Tue, 1 Oct 2024 22:54:58 +0200	[thread overview]
Message-ID: <20241001225458.2642801f@xps-13> (raw)
In-Reply-To: <CAOf5uw=jQEtQUGWzd40shLidcMNfkTsPjSbCQ7L=MJdBUTUbTw@mail.gmail.com>

Hi Michael,

michael@amarulasolutions.com wrote on Tue, 1 Oct 2024 15:02:56 +0200:

> Hi
> 
> On Tue, Oct 1, 2024 at 12:01 PM Miquel Raynal <miquel.raynal@bootlin.com> wrote:
> >
> > Hi Michael,
> >  
> > > > >>>> Ported the patch from patchset
> > > > >>>>
> > > > >>>> "[PATCH 05/26] clk: imx8mm: Mark IMX8MM_SYS_PLL2 and IMX8MM_SYS_PLL3 as enabled"
> > > > >>>>
> > > > >>>> to imx8mp [2] and fec ethernet works again for me on imx8mp!
> > > > >>>>
> > > > >>>> Could you add this if you post a v2 ?  
> > > > >>>
> > > > >>> TBH I don't feel like the below change is the correct one, it is too
> > > > >>> specific. The clock core is recursive and thus should handle the
> > > > >>> reparenting situations gracefully.
> > > > >>>
> > > > >>> I posted a series that is targeting the LVDS output on imx8mp. You
> > > > >>> should probably consider checking these patches as well if you work
> > > > >>> on imx8mp as well. I also had similar breakages with Ethernet which
> > > > >>> happened during the assigned-clocks handling. This patch, which is more
> > > > >>> future and platform agnostic, fixed it:
> > > > >>>
> > > > >>> https://lore.kernel.org/u-boot/20240910101344.110633-3-miquel.raynal@bootlin.com/
> > > > >>>  
> > > > >>
> > > > >> The clock patches are not specific at all. You need to have it working
> > > > >> for the parent for each component.  
> > > > >
> > > > > The diff shown by Heiko is explicitly enabling PLLs by naming them in
> > > > > the iMX driver. This is not the correct approach. The problem of
> > > > > having non-enabled new parents is global. Parent clocks should be
> > > > > enabled before changing muxes, and this should be enforced
> > > > > by the clock core/uclass, not the SoC drivers.  
> > > >
> > > > Okay, valid argument.
> > > >  
> > > > >  
> > > > >> This is a standard way to do it and nothing magic compared to other
> > > > >> implementations.  
> > > > >
> > > > > No, naming PLLs explicitly is not the correct approach.
> > > > >  
> > > > >> I don't see
> > > > >> in your series any addressing or reparent clock or take in account
> > > > >> that a clock should be enable before
> > > > >> reparenting.  
> > > > >
> > > > > That's exactly the link above, whose diff is pasted here for reference:
> > > > >
> > > > > @@ -595,6 +595,10 @@ int clk_set_parent(struct clk *clk, struct clk *parent)
> > > > >       if (!ops->set_parent)
> > > > >               return -ENOSYS;
> > > > >
> > > > > +     ret = clk_enable(parent);
> > > > > +     if (ret)
> > > > > +             return ret;  
> > > >
> > > > As I said before, I had *exact* the same patch and thought I made a big
> > > > hack :-P
> > > >
> > > > But I wonder ... if this a generic "problem", why nobody had yet problems
> > > > with it...  
> > >
> > > I think that a generic approach that takes into account the reparent
> > > is more valuable, then
> > > this.  
> >
> > I'm sorry I don't fully understand your answer. I assume you agree with
> > the generic approach quoted above.
> >  
> > > If a clock is enabled by another stage and we don't aware about
> > > it we need to mark
> > > as enabled.  
> >
> > clk_enable() already handles this kind of situation.
> >  
> > > I think that this force of enable it's just a short path
> > > that does not solve the generic
> > > problem.  
> >
> > What "force of enable"? The parent needs to be enabled before we use it
> > as parent. The logic is always the same:
> > - clk_enable() the new parent
> > - change the parent
> > - clk_disable() the old parent
> > I don't see any short path here.
> >  
> > > I really tried to abstract what is really implemented in
> > > other OS on the same topic.  
> >
> > FYI, Linux does the clk_enable(parent) like above.
> >  
> 
> You mean linux enables a clock in set_parent even if the clock_chain
> is not yet enabled.
> clock a disable
> clock b disable
> 
> clk_set_parent(a, b) b->a now b is enabled?

Actually you're right Linux does the enable call only if a flag is set
(and anyway it's not in the faulty case reported above) or when the
reparented clock is already clocking. I'll have to check again with
this clk_enable() solves the situation and what could be done instead.

Thanks,
Miquèl

  reply	other threads:[~2024-10-01 20:55 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-13  9:55 [PATCH 00/26] Support display (and even more) on the BSH SMM S2/PRO boards Dario Binacchi
2024-09-13  9:55 ` [PATCH 01/26] clk: Propagate clk_set_rate() if CLK_SET_PARENT_RATE present for gate and mux Dario Binacchi
2024-09-13  9:55 ` [PATCH 02/26] clk: imx8mn: Prevent clock critical path from disabling during reparent and set_rate Dario Binacchi
2024-09-13  9:55 ` [PATCH 03/26] clk: imx8mm: " Dario Binacchi
2024-09-13 10:09   ` Marek Vasut
2024-09-13  9:55 ` [PATCH 04/26] clk: clk-uclass: Implement CLK_OPS_PARENT_ENABLE Dario Binacchi
2024-09-13  9:55 ` [PATCH 05/26] clk: imx8mm: Mark IMX8MM_SYS_PLL2 and IMX8MM_SYS_PLL3 as enabled Dario Binacchi
2024-09-13 10:07   ` Marek Vasut
2024-09-13  9:55 ` [PATCH 06/26] clk: imx8mn: Mark IMX8MN_SYS_PLL2 and IMX8MN_SYS_PLL3 " Dario Binacchi
2024-09-13  9:55 ` [PATCH 07/26] clk: imx8mn: add video clocks support Dario Binacchi
2024-09-13  9:55 ` [PATCH 08/26] power: Add iMX8M block ctrl driver for dispmix Dario Binacchi
2024-09-24  9:05   ` Heiko Schocher
2024-09-30 13:20     ` Dario Binacchi
2024-10-01  4:21       ` Heiko Schocher
2024-10-01  5:01         ` Michael Nazzareno Trimarchi
2024-10-01  5:14           ` Heiko Schocher
2024-10-01  5:51             ` Heiko Schocher
2024-10-01  8:29               ` Miquel Raynal
2024-10-01  8:33                 ` Michael Nazzareno Trimarchi
2024-10-01  8:50                   ` Miquel Raynal
2024-10-01  8:57                     ` Heiko Schocher
2024-10-01  9:50                       ` Michael Nazzareno Trimarchi
2024-10-01 10:01                         ` Miquel Raynal
2024-10-01 13:02                           ` Michael Nazzareno Trimarchi
2024-10-01 20:54                             ` Miquel Raynal [this message]
2024-10-01  9:55                       ` Miquel Raynal
2024-10-01  8:47                 ` Heiko Schocher
2024-10-01  8:56                   ` Miquel Raynal
2024-09-13  9:55 ` [PATCH 09/26] video: Add video link framework Dario Binacchi
2024-09-13  9:55 ` [PATCH 10/26] video: bridge: Add check_timing interface Dario Binacchi
2024-09-13  9:55 ` [PATCH 11/26] video: dsi_host: add disable host interface Dario Binacchi
2024-09-13  9:55 ` [PATCH 12/26] video: Update mxsfb video drivers for iMX8MM/iMX8MN display Dario Binacchi
2024-09-13  9:55 ` [PATCH 13/26] video: Enable DM_UC_FLAG_SEQ_ALIAS for display and bridge Dario Binacchi
2024-09-13  9:55 ` [PATCH 14/26] phy: dphy: add support to calculate the timing based on hs_clk_rate Dario Binacchi
2024-09-13  9:55 ` [PATCH 15/26] phy: dphy: Correct lpx parameter and its derivatives(ta_{get, go, sure}) Dario Binacchi
2024-09-13  9:55 ` [PATCH 16/26] phy: dphy: Correct clk_pre parameter Dario Binacchi
2024-09-13  9:55 ` [PATCH 17/26] lib: div64: sync with Linux Dario Binacchi
2024-09-13  9:56 ` [PATCH 18/26] video: bridge: Add Samsung DSIM bridge Dario Binacchi
2024-09-13  9:56 ` [PATCH 19/26] video: Add Synaptics R63353 panel driver Dario Binacchi
2024-09-13  9:56 ` [PATCH 20/26] imx8mn_bsh_smm_s2/pro: Enable display on reference design Dario Binacchi
2024-09-13  9:56 ` [PATCH 21/26] boot: fdt_simplefb: add a debug message Dario Binacchi
2024-09-13  9:56 ` [PATCH 22/26] video: mxsfb: support simple frame-buffer Dario Binacchi
2024-09-13  9:56 ` [PATCH 23/26] video: bridge: samsung: " Dario Binacchi
2024-09-13  9:56 ` [PATCH 24/26] imx8mn_bsh_smm_s2/pro: " Dario Binacchi
2024-09-13  9:56 ` [PATCH 25/26] imx8mn_bsh_smm_s2/pro: enable " Dario Binacchi
2024-09-13  9:56 ` [PATCH 26/26] imx8mn_bsh_smm_s2/pro: add splash screen with BSH logo Dario Binacchi
2024-09-30  9:43 ` [PATCH 00/26] Support display (and even more) on the BSH SMM S2/PRO boards Miquel Raynal
2024-09-30 13:07   ` Dario Binacchi

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=20241001225458.2642801f@xps-13 \
    --to=miquel.raynal@bootlin.com \
    --cc=akashi.tkhro@gmail.com \
    --cc=dario.binacchi@amarulasolutions.com \
    --cc=festevam@denx.de \
    --cc=hs@denx.de \
    --cc=jh80.chung@samsung.com \
    --cc=linux-amarula@amarulasolutions.com \
    --cc=michael@amarulasolutions.com \
    --cc=trini@konsulko.com \
    --cc=u-boot@lists.denx.de \
    --cc=ye.li@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox