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: Heiko Schocher <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 10:50:57 +0200	[thread overview]
Message-ID: <20241001105057.2992e124@xps-13> (raw)
In-Reply-To: <CAOf5uwn8vhozjtMqXmWL=3Jaf05UhV7cnGn15Ywj07-PmwW_9w@mail.gmail.com>

Hi Michael,

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

> Hi Miguel
> 
> On Tue, Oct 1, 2024 at 10:29 AM Miquel Raynal <miquel.raynal@bootlin.com> wrote:
> >
> > Hi Heiko,
> >
> >  
> > > >>> Hmm.. unfortunately ... I had applied your 2 clock patches, which
> > > >>> fixed a problem with enabling parent clocks ... but they broke booting
> > > >>> on a carrier which has fec ethernet! After "Net: " output the board hang...
> > > >>>
> > > >>> I reverted your 2 clock patches and it bootet again ... so there is
> > > >>> a problem ... try to get some more time to look into...
> > > >>>  
> > > >>
> > > >> We have a fec, but we had I think two patches more on it. I forget to
> > > >> answer Marek
> > > >> about them because I don't have my board now and because he is
> > > >> partially right (or maybe right).
> > > >> Anyway when we boot we could have and we have clocks that are enabled
> > > >> by bootrom or SPL that
> > > >> we need to declare as enable like PLL2/PLL3 those clocks are parts or
> > > >> could be part of reparent so,
> > > >> you need to have a reference counter on them that allow to not disable
> > > >> during the down chain disable
> > > >> and up chain enable. I think that what happens to your ethernet it's
> > > >> that you disable some clock that is
> > > >> critical to the board to survive. I had a patch merged by Tom that  
> > > >
> > > > Yep, thats what I think too! If you access registers in a block for
> > > > which the clock is not enabled ... it just hang...
> > > >  
> > > >> prints the clock name so if you enable
> > > >> the debug of the clock you will find that your board stops working
> > > >> during one of this reparinting.  
> > > >
> > > > I currently work on 2024.07... will rebase if 2024.10 is out...
> > > >
> > > > Ah, you mean:
> > > >
> > > > commit a70d991212c9684e09ed80ece69ce1ff7bfd9f08
> > > > Author: Michael Trimarchi <michael@amarulasolutions.com>
> > > > Date:   Tue Jul 9 08:28:13 2024 +0200
> > > >
> > > >      clk: clk-uclass: Print clk name in clk_enable/clk_disable
> > > >
> > > >      Print clk name in clk_enable and clk_disable. Make sense to know
> > > >      what clock get disabled/enabled before a system crash or system
> > > >      hang.
> > > >
> > > >      Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
> > > >
> > > > I have the same change when I debug :-P
> > > >
> > > > IIRC I did not see the clock names ... but I will recheck!  
> > >
> > > I see with your patch the clock names, so fine... and see [1]
> > >
> > > Hmm... I am on imx8mp, and I think the changes the patchset do in
> > >
> > > "clk: imx8mn: Prevent clock critical path from disabling during reparent and set_rate"
> > >
> > > are in clk-imx8mp already ...
> > >
> > > 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.

> 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;

> 
> > My series is complimentary, even though there are some overlaps that we
> > need to merge.  
> 
> The only collision I can see from your series is that you re-write the
> imx approach of power domain.
> Can you please expand here a bit your point?

Well, that's what I'd call an overlap :) There are also similar changes
in the clock core IIRC. Well, there is a bit of merging that needs to
happen I guess, but if you don't think there is any then my series can
enter as-is (once the comments addressed, ofc).

Thanks,
Miquèl

  reply	other threads:[~2024-10-01  8:51 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 [this message]
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
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=20241001105057.2992e124@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