From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Stephen Boyd <sboyd@codeaurora.org>,
Michael Turquette <mturquette@baylibre.com>,
Geert Uytterhoeven <geert+renesas@glider.be>,
Magnus Damm <damm+renesas@opensource.se>,
Simon Horman <horms+renesas@verge.net.au>,
Rob Herring <robh+dt@kernel.org>, Pawel Moll <pawel.moll@arm.com>,
Mark Rutland <mark.rutland@arm.com>,
Ian Campbell <ijc+devicetree@hellion.org.uk>,
Kumar Gala <galak@codeaurora.org>,
linux-clk <linux-clk@vger.kernel.org>,
"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
Linux-sh list <linux-sh@vger.kernel.org>
Subject: Re: [PATCH v4 5/5] [RFC] clk: shmobile: r8a7795: Add new CPG/MSSR driver
Date: Mon, 26 Oct 2015 04:25:51 +0200 [thread overview]
Message-ID: <1577230.N3FJlP7ehB@avalon> (raw)
In-Reply-To: <CAMuHMdUyu6w0LAoH78H2+VHczrWwozDKMX2j8_A4V=jgz0snwA@mail.gmail.com>
Hi Geert,
On Saturday 24 October 2015 19:34:03 Geert Uytterhoeven wrote:
> On Sat, Oct 24, 2015 at 3:10 AM, Stephen Boyd <sboyd@codeaurora.org> wrote:
> > On 10/22, Geert Uytterhoeven wrote:
> >> On Tue, Oct 20, 2015 at 3:07 PM, Geert Uytterhoeven wrote:
> >>> On Tue, Oct 20, 2015 at 3:00 PM, Michael Turquette wrote:
> >>>> Quoting Geert Uytterhoeven (2015-10-20 05:31:12)
> >>>>> On Tue, Oct 20, 2015 at 2:24 PM, Michael Turquette wrote:
> >>>> The bindings should go in for 4.4, but if the driver is slated for 4.5
> >>>> then can you investigate this some more? Stephen and I are on a
> >>>> mission to have _real_ clk drivers.
> >>>
> >>> Sure, I'll have a deeper look.
> >>
> >> And so I did (on r8a7791/koelsch).
> >>
> >> As I want to have as much clock data/code __init as possible (think
> >> multi-platform kernels --- pinmux data is a disaster here), I have to use
> >> platform_driver_probe().
That sounds like an __init issue, doesn't it ? The CPG driver will always be
builtin and probed during the init process, what's preventing us from using
normal driver probing ?
> >> - Calling platform_driver_probe() from core_initcall() or
> >> postcore_initcall() is too early, as the platform device for the CPG
> >> hasn't been created yet. Hence the CPG Clock Domain isn't registered,
> >> and all devices fail to probe as they can't be attached to their
> >> Clock Domain.
> >>
> >> -> This is where the -ENOENT came from (I incorrectly assumed it
> >> came from the clock code; sorry for that), and it's converted
> >> into -EPROBE_DEFER by genpd_dev_pm_attach().
> >>
> >> - Calling platform_driver_probe() from arch_initcall() is too late, as
> >> the IRQC is initialized first (it's located before the CPG in .dtsi).
> >> Hence the IRQC can't find it's Clock Domain, and its probe is
> >> deferred. IRQC will be reprobed later, but in the mean time the
> >> Ethernet PHY can't find its IRQ, as the of_mdio code uses
> >> irq_of_parse_and_map(), which plainly ignores EPROBE_DEFER :-(
> >> Nevertheless, Ethernet works...
> >>
> >> - Using subsys_initcall() and later causes even more probe deferral.
> >>
> >> So that's why I went with CLK_OF_DECLARE() again...
> >
> > Understandable for the few clocks that are used by the interrupt
> > controller, but for the other clocks, could those be registered
> > from a real platform device driver probe path? I've been
>
> In this particular case, that would be the IRQC module clocks and its
> parent, the CP clock, which is derived directly from the external crystal.
>
> If we ever have to do this for the GIC, that's gonna be several more
> clocks (INTC-SYS / ZS / PLL1 / MAIN / external crystal).
>
> > considering making some API that lets devices associate with the
> > clocks that the file had to register with CLK_OF_DECLARE(). The
> > driver would have to be builtin then (no modules) but otherwise
> > we would be able to benefit from the device driver model for most
> > other clocks.
>
> To be honest, that still feels like a hack to me.
>
> I hope dependencies and probe order, and obscure drivers not handling
> deferred probe correctly, will be solved later sooner or later,
> so hacks like that are no longer needed.
>
> For new SoCs like r8a7795 we can probably just make it a real platform
> driver, and make sure the irqc node is located after the cpg node in the
> .dtsi.
That's another hack :-) We really shouldn't depend on DT nodes order.
I'm all for getting rid of CLK_OF_DECLARE
> Upon second thought, that may even be feasible for existing SoCs, as
> they would need a DTS update to make use of the new bindings/driver anyway,
> so the irqc node can be moved at the same time. Backwards compatibility
> through the old bindings/drivers would keep on using CLK_OF_DECLARE().
--
Regards,
Laurent Pinchart
next prev parent reply other threads:[~2015-10-26 2:25 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-16 12:49 [PATCH/RFC v4 0/5] clk: shmobile: Add new Renesas CPG/MSSR DT bindings Geert Uytterhoeven
2015-10-16 12:49 ` [PATCH v4 1/5] [RFC] " Geert Uytterhoeven
2015-10-20 10:15 ` Michael Turquette
[not found] ` <1444999760-15750-2-git-send-email-geert+renesas-gXvu3+zWzMSzQB+pC5nmwQ@public.gmane.org>
2015-10-20 12:16 ` Geert Uytterhoeven
[not found] ` <CAMuHMdVhBipbf13o0jb3H6qmcewh6CCtq3=Hj-9nvgar+AYdFg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-10-20 16:01 ` Magnus Damm
[not found] ` <CANqRtoS6QpWJY99aD8KyGHgySxqzzBPic-k_a-VcZE6LVFFRow-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-10-23 11:05 ` Laurent Pinchart
2015-10-23 11:09 ` Geert Uytterhoeven
2015-10-23 11:11 ` Laurent Pinchart
2015-10-23 11:10 ` Laurent Pinchart
2015-10-26 19:02 ` Geert Uytterhoeven
2015-10-27 1:34 ` Laurent Pinchart
2015-10-27 8:14 ` Geert Uytterhoeven
2015-10-30 13:30 ` Laurent Pinchart
2015-10-16 12:49 ` [PATCH v4 2/5] [RFC] clk: shmobile: Add r8a7795 CPG Core Clock Definitions Geert Uytterhoeven
2015-10-20 10:09 ` Geert Uytterhoeven
2015-10-20 16:21 ` Magnus Damm
2015-10-23 11:21 ` Laurent Pinchart
2015-10-23 11:25 ` Geert Uytterhoeven
2015-10-16 12:49 ` [PATCH v4 3/5] [RFC] clk: shmobile: div6: Extract cpg_div6_register() Geert Uytterhoeven
2015-10-23 11:28 ` Laurent Pinchart
2015-10-16 12:49 ` [PATCH v4 4/5] [RFC] clk: shmobile: cpg-mssr: Add new CPG/MSSR driver core Geert Uytterhoeven
2015-10-16 12:49 ` [PATCH v4 5/5] [RFC] clk: shmobile: r8a7795: Add new CPG/MSSR driver Geert Uytterhoeven
2015-10-20 12:24 ` Michael Turquette
2015-10-20 12:31 ` Geert Uytterhoeven
2015-10-20 13:00 ` Michael Turquette
2015-10-20 13:07 ` Geert Uytterhoeven
2015-10-22 12:58 ` Geert Uytterhoeven
2015-10-24 1:10 ` Stephen Boyd
2015-10-24 17:34 ` Geert Uytterhoeven
2015-10-26 2:25 ` Laurent Pinchart [this message]
2015-10-26 8:03 ` Geert Uytterhoeven
2015-10-30 13:12 ` Laurent Pinchart
2015-10-29 14:03 ` Geert Uytterhoeven
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=1577230.N3FJlP7ehB@avalon \
--to=laurent.pinchart@ideasonboard.com \
--cc=damm+renesas@opensource.se \
--cc=devicetree@vger.kernel.org \
--cc=galak@codeaurora.org \
--cc=geert+renesas@glider.be \
--cc=geert@linux-m68k.org \
--cc=horms+renesas@verge.net.au \
--cc=ijc+devicetree@hellion.org.uk \
--cc=linux-clk@vger.kernel.org \
--cc=linux-sh@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=mturquette@baylibre.com \
--cc=pawel.moll@arm.com \
--cc=robh+dt@kernel.org \
--cc=sboyd@codeaurora.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).