LKML Archive on lore.kernel.org help / color / mirror / Atom feed
From: Rob Herring <robh+dt@kernel.org> To: Bartosz Golaszewski <brgl@bgdev.pl> Cc: Sekhar Nori <nsekhar@ti.com>, Kevin Hilman <khilman@kernel.org>, David Lechner <david@lechnology.com>, Michael Turquette <mturquette@baylibre.com>, Stephen Boyd <sboyd@kernel.org>, Arnd Bergmann <arnd@arndb.de>, Greg Kroah-Hartman <gregkh@linuxfoundation.org>, Mark Rutland <mark.rutland@arm.com>, Yoshinori Sato <ysato@users.sourceforge.jp>, Rich Felker <dalias@libc.org>, Andy Shevchenko <andy.shevchenko@gmail.com>, Marc Zyngier <marc.zyngier@arm.com>, "Rafael J . Wysocki" <rafael.j.wysocki@intel.com>, Peter Rosin <peda@axentia.se>, Jiri Slaby <jslaby@suse.com>, Thomas Gleixner <tglx@linutronix.de>, Daniel Lezcano <daniel.lezcano@linaro.org>, Geert Uytterhoeven <geert@linux-m68k.org>, Magnus Damm <magnus.damm@gmail.com>, Johan Hovold <johan@kernel.org>, Frank Rowand <frowand.list@gmail.com>, "moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE" <linux-arm-kernel@lists.infradead.org>, "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>, devicetree@vger.kernel.org, "open list:GENERIC INCLUDE/ASM HEADER FILES" <linux-arch@vger.kernel.org> Subject: Re: [PATCH 00/12] introduce support for early platform drivers Date: Fri, 11 May 2018 15:13:35 -0500 [thread overview] Message-ID: <CAL_JsqL3CWFSpKEGoGwQDxCQ04g4uT1hiDTxXzjz4XTjPbfsoQ@mail.gmail.com> (raw) In-Reply-To: <20180511162028.20616-1-brgl@bgdev.pl> On Fri, May 11, 2018 at 11:20 AM, Bartosz Golaszewski <brgl@bgdev.pl> wrote: > This series is a follow-up to the RFC[1] posted a couple days ago. > > NOTE: this series applies on top of my recent patches[2] that move the previous > implementation of early platform devices to arch/sh. > > Problem: > > Certain class of devices, such as timers, certain clock drivers and irq chip > drivers need to be probed early in the boot sequence. The currently preferred > approach is using one of the OF_DECLARE() macros. This however does not create > a platform device which has many drawbacks - such as not being able to use > devres routines, dev_ log functions or no way of deferring the init OF function > if some other resources are missing. I skimmed though this and it doesn't look horrible (how's that for positive feedback? ;) ). But before going into the details, I think first there needs to be agreement this is the right direction. The question does remain though as to whether this class of devices should be platform drivers. They can't be modules. They can't be hotplugged. Can they be runtime-pm enabled? So the advantage is ... I assume that the clock maintainers had some reason to move clocks to be platform drivers. It's just not clear to me what that was. > For drivers that use both platform drivers and OF_DECLARE the situation is even > more complicated as the code needs to take into account that there can possibly > be no struct device present. For a specific use case that we're having problems > with, please refer to the recent DaVinci common-clock conversion patches and > the nasty workaround that this problem implies[3]. So devm_kzalloc will work with this solution? Why did we need devm_kzalloc in the first place? The clocks can never be removed and cleaning up on error paths is kind of pointless. The system would be hosed, right? > We also used to have an early platform drivers implementation but they were not > integrated with the linux device model at all - they merely used the same data > structures. The users could not use devres, defer probe and the early devices > never became actual platform devices later on. > > Proposed solution: > > This series aims at solving this problem by (re-)introducing the concept of > early platform drivers and devices - this time however in a way that seamlessly > integrates with the existing platform drivers and also offers device-tree > support. > > The idea is to provide a way for users to probe devices early, while already > being able to use devres, devices resources and properties and also deferred > probing. > > New structures are introduced: the early platform driver contains the > early_probe callback which has the same signature as regular platform_device > probe. This callback is called early on. The user can have both the early and > regular probe speficied or only one of them and they both receive the same > platform device object as argument. Any device data allocated early will be > carried over to the normal probe. > > The architecture code is responsible for calling early_platform_start() in > which the early drivers will be registered and devices populated from DT. Can we really do this in one spot for different devices (clk, timers, irq). The sequence is all very carefully crafted. Platform specific hooks is another thing to consider. > Once the device and kobject mechanisms are ready, all early drivers and devices > will be converted into real platform drivers and devices. Also: if any of the > early platform registration functions will be called once early initialization > is done, these functions will work like regular platform_device/driver ones. This could leave devices in a weird state. They've successfully probed early, but then are on the deferred list for normal probe for example. Rob
next prev parent reply other threads:[~2018-05-11 20:14 UTC|newest] Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top 2018-05-11 16:20 [PATCH 00/12] introduce support for early platform drivers Bartosz Golaszewski 2018-05-11 16:20 ` [PATCH 01/12] platform/early: add a new field to struct device Bartosz Golaszewski 2018-05-14 21:24 ` Geert Uytterhoeven 2018-05-11 16:20 ` [PATCH 02/12] platform/early: don't WARN() on non-empty devres list for early devices Bartosz Golaszewski 2018-05-14 21:24 ` Geert Uytterhoeven 2018-05-11 16:20 ` [PATCH 03/12] platform/early: export platform_match() locally Bartosz Golaszewski 2018-05-14 21:25 ` Geert Uytterhoeven 2018-05-11 16:20 ` [PATCH 04/12] platform: provide a separate function for initializing platform devices Bartosz Golaszewski 2018-05-14 21:25 ` Geert Uytterhoeven 2018-05-11 16:20 ` [PATCH 05/12] platform: export platform_device_release() locally Bartosz Golaszewski 2018-05-14 21:25 ` Geert Uytterhoeven 2018-05-11 16:20 ` [PATCH 06/12] of: add a new flag for OF device nodes Bartosz Golaszewski 2018-05-14 21:25 ` Geert Uytterhoeven 2018-05-11 16:20 ` [PATCH 07/12] of/platform: provide a separate routine for setting up device resources Bartosz Golaszewski 2018-05-14 21:26 ` Geert Uytterhoeven 2018-05-11 16:20 ` [PATCH 08/12] of/platform: provide a separate routine for device initialization Bartosz Golaszewski 2018-05-14 21:26 ` Geert Uytterhoeven 2018-05-11 16:20 ` [PATCH 09/12] platform/early: add an init section for early driver data Bartosz Golaszewski 2018-05-14 21:29 ` Geert Uytterhoeven 2018-05-15 8:41 ` Bartosz Golaszewski 2018-05-11 16:20 ` [PATCH 10/12] platform/early: implement support for early platform drivers Bartosz Golaszewski 2018-05-14 13:37 ` Rob Herring 2018-05-15 14:06 ` Bartosz Golaszewski 2018-05-16 1:06 ` Rob Herring 2018-05-11 16:20 ` [PATCH 11/12] misc: implement a dummy early platform driver Bartosz Golaszewski 2018-05-11 16:20 ` [PATCH 12/12] of/platform: make the OF code aware of early platform drivers Bartosz Golaszewski 2018-05-14 21:32 ` Geert Uytterhoeven 2018-05-11 20:13 ` Rob Herring [this message] 2018-05-14 11:38 ` [PATCH 00/12] introduce support for " Bartosz Golaszewski 2018-05-14 13:20 ` Rob Herring 2018-05-30 19:40 ` Michael Turquette 2018-05-30 22:36 ` Rob Herring 2018-05-31 6:42 ` Geert Uytterhoeven 2018-05-31 14:16 ` Tony Lindgren 2018-10-19 12:08 ` 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: 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=CAL_JsqL3CWFSpKEGoGwQDxCQ04g4uT1hiDTxXzjz4XTjPbfsoQ@mail.gmail.com \ --to=robh+dt@kernel.org \ --cc=andy.shevchenko@gmail.com \ --cc=arnd@arndb.de \ --cc=brgl@bgdev.pl \ --cc=dalias@libc.org \ --cc=daniel.lezcano@linaro.org \ --cc=david@lechnology.com \ --cc=devicetree@vger.kernel.org \ --cc=frowand.list@gmail.com \ --cc=geert@linux-m68k.org \ --cc=gregkh@linuxfoundation.org \ --cc=johan@kernel.org \ --cc=jslaby@suse.com \ --cc=khilman@kernel.org \ --cc=linux-arch@vger.kernel.org \ --cc=linux-arm-kernel@lists.infradead.org \ --cc=linux-kernel@vger.kernel.org \ --cc=magnus.damm@gmail.com \ --cc=marc.zyngier@arm.com \ --cc=mark.rutland@arm.com \ --cc=mturquette@baylibre.com \ --cc=nsekhar@ti.com \ --cc=peda@axentia.se \ --cc=rafael.j.wysocki@intel.com \ --cc=sboyd@kernel.org \ --cc=tglx@linutronix.de \ --cc=ysato@users.sourceforge.jp \ /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: linkBe 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).