LKML Archive on
help / color / mirror / Atom feed
From: David Lechner <>
To: Bartosz Golaszewski <>, Sekhar Nori <>
Cc: Kevin Hilman <>,
	Michael Turquette <>,
	Arnd Bergmann <>,
	Greg Kroah-Hartman <>,,,
	Bartosz Golaszewski <>,
	Stephen Boyd <>
Subject: Re: [RFC work-in-progress 0/7] of: platform: use early platform routines instead of OF_DECLARE
Date: Mon, 23 Apr 2018 16:38:30 -0500	[thread overview]
Message-ID: <> (raw)
In-Reply-To: <>

FYI: It looks like the CC for Stephen and Arnd was messed up, so I

On 04/23/2018 01:38 PM, Bartosz Golaszewski wrote:
> From: Bartosz Golaszewski <>
> Hi David, Sekhar,
> since platform devices are generally considered more desirable than
> CLK_OF_DECLARE, TIMER_OF_DECLARE etc. and we need to figure out how to
> handle the clocks that need to be initialized early in the boot
> process on DaVinci, I thought that I could give the early_platform
> mechanism a try.
> This API is only used on one architecture (sh) but seems to work just
> fine on ARM. It allows to register early platform drivers and then
> probe them early in the boot process. So far only machine code is
> supported but with a bit of hacking I was able to probe a DT device.
> This is a very dirty and far-from-upstream proof of concept that allows
> to probe the (so far dummy) davinci timer platform device during the
> call to init_time (from machine_desc).
> The idea is to have a special compatible fallback string: "earlydev"
> that similarily to "syscon" would be added to device nodes that need
> early probing. Then we'd call the of_early_platform_populate()
> function that would find all compatible nodes and populate them
> long before all the "normal" nodes.

FWIW, "earlydev" sounds like a driver implementation detail, so not
something that should be included in the device tree. We only need
this because Linux needs a clocksource early on, but that doesn't
mean that all device tree users need to do the same.

I'm sure it makes things easier for a proof of concept though. :-)

> This would allow us to make the davinci timer a normal platform device
> and possibly also probe the psc and pll drivers earlier than we do now.
> The early platform API even allows us to check if we're being probed
> early in probe() so we can possibly probe the driver twice if needed:
> only doing the critical stuff first and then completing the process
> later.
> If you think this is a good idea, I would like to continue on that
> and eventually make it an alternative to OF_DECLARE macros.
> For a quick conversion of the davinci timer to a platform driver
> I image we'd need to use platform data lookup that would be passed
> to of_early_platform_populate().

On the surface, it certainly sounds like a good idea to me. Do we have
access to struct device of the platform device when using this early
platform device? I remember when I was working on the clock drivers, I
tried registering a platform device in the init_time callback but the
kernel crashed because kobj stuff was not initialized yet. I'm guessing
that the early platform device somehow works around this.

       reply	other threads:[~2018-04-23 21:38 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <>
2018-04-23 21:38 ` David Lechner [this message]
2018-04-24  7:26   ` Bartosz Golaszewski
2018-04-24  8:18     ` Sekhar Nori
     [not found] ` <>
2018-04-24  8:10   ` [RFC work-in-progress 5/7] !WIP ARM: davinci: convert da850 to using the davinci clocksource driver Sekhar Nori
2018-04-24 16:12     ` Bartosz Golaszewski

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:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \ \ \ \ \ \ \ \ \ \ \ \ \
    --subject='Re: [RFC work-in-progress 0/7] of: platform: use early platform routines instead of OF_DECLARE' \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

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).