public inbox for linux-tegra@vger.kernel.org
 help / color / mirror / Atom feed
From: Thierry Reding <thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: Lorenzo Pieralisi <lorenzo.pieralisi-5wv7dgnIgG8@public.gmane.org>
Cc: Catalin Marinas <Catalin.Marinas-5wv7dgnIgG8@public.gmane.org>,
	Arnd Bergmann <arnd-r2nGTMty4D4@public.gmane.org>,
	Stephen Warren <swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>,
	Greg Kroah-Hartman
	<gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org>,
	Kumar Gala
	<galak-XVmvHMARGAS8U2dJNN8I7kB+6BGkLq7r@public.gmane.org>,
	Santosh Shilimkar
	<santosh.shilimkar-l0cyMroinI0@public.gmane.org>,
	"linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	"linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org"
	<linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org>
Subject: Re: [RFC 1/4] ARM: tegra: Move SoC drivers to drivers/soc/tegra
Date: Mon, 30 Jun 2014 21:36:36 +0200	[thread overview]
Message-ID: <20140630193635.GB32594@mithrandir> (raw)
In-Reply-To: <20140630131628.GA31517-7AyDDHkRsp3ZROr8t4l/smS4ubULX0JqMm0uRHvK7Nw@public.gmane.org>

[-- Attachment #1: Type: text/plain, Size: 5805 bytes --]

On Mon, Jun 30, 2014 at 02:16:34PM +0100, Lorenzo Pieralisi wrote:
> On Mon, Jun 30, 2014 at 11:48:15AM +0100, Thierry Reding wrote:
> > On Mon, Jun 30, 2014 at 11:36:49AM +0100, Catalin Marinas wrote:
> > > On Mon, Jun 30, 2014 at 10:01:19AM +0100, Thierry Reding wrote:
> > > > On Mon, Jun 30, 2014 at 09:20:30AM +0200, Arnd Bergmann wrote:
> > > > > On Saturday 28 June 2014 22:40:26 Thierry Reding wrote:
> > > > > > Also, the real win we get from moving code out into drivers/ is if we
> > > > > > can provide a common framework for them. I don't see how we can possibly
> > > > > > do that for this code since there simply isn't enough commonality
> > > > > > between SoCs. At the same time we now have a situation where both 32-bit
> > > > > > and 64-bit variants of some SoCs share some of the same hardware at the
> > > > > > very low level and since we don't have mach-* directories for 64-bit ARM
> > > > > > and shouldn't be duplicating code either, we need to find a new home for
> > > > > > this type of code. drivers/soc seemed to fit perfectly well.
> > > > > 
> > > > > For the low-level stuff yes, but I agree with Santosh there needs to be
> > > > > some more work trying to split out individual high-level drivers.
> > > > > 
> > > > > There are two common patterns for the interface between the low-level
> > > > > register access and the more high-level stuff:  you can either use
> > > > > a "syscon" driver that just exports a struct regmap and that gets referenced
> > > > > from other drivers using a phandle in their device nodes, or you have
> > > > > a driver in drivers/soc that exports a somewhat higher-level interface
> > > > > and comes with its own header file that gets included by other drivers.
> > > > > At the moment, the syscon/regmap variant can only be used once device
> > > > > drivers are loaded, but there is some broad agreement that it should
> > > > > be changed to allow calling syscon_regmap_lookup_by_phandle() at
> > > > > early boot using just DT accessors.
> > > > 
> > > > Note that we already have all these drivers and they do work for earlier
> > > > Tegra generations. My attempt to move these out of arch/arm/mach-tegra
> > > > is merely about being able to share them with upcoming 64-bit variants.
> > > > So it's not about adding new functionality but rather about keeping the
> > > > existing level of functionality on 64-bit.
> > > 
> > > Only that for arm64 we try to do things slightly differently and not
> > > because we just like to but because we want better standardisation
> > > across SoCs. One example is the booting protocol. Another example, you
> > > don't get some early initcalls for your SoC (no machine descriptor). The
> > > hardware should be configured by firmware in such a way that it boots at
> > > least up to arch_initcall() level (ideally, we should move anything to
> > > device_initcall() but it's not always easy).
> > 
> > Well, one of the problems on Tegra is that we need part of the PMC to
> > power up CPUs. There's no firmware that could do this for us. We need
> > also access to another block called flow controller. Both of those
> > drivers need to be available very early for things to work. At the same
> > time the driver exposes control over power domains. So while we possibly
> > can push CPU bringup/teardown to firmware for ARM64, we can't do the
> > same for the other parts of the PMC, so we end up with a weird kind of
> > driver.
> > 
> > Parts of it can't register with the driver model because it isn't
> > available that early, and at the same time we need to register parts
> > only later because they require the driver model.
> 
> That sounds familiar and that's exactly the problem, and that's a problem
> that won't disappear by just moving code around directories (hey, it is
> not that we have not tried =)), as you (and I) know very well:
> 
> https://lkml.org/lkml/2013/8/16/399
> http://lists.infradead.org/pipermail/linux-arm-kernel/2013-August/190067.html
> 
> Either a common way of dealing with this early CPU bring-up code is
> implemented (but it can't be platform specific otherwise we are back to
> square one)

I prototyped this based on an OF init table (much like IRQCHIP_DECLARE
or CLOCKSOURCE_OF_DECLARE) that's run early in the boot process (at the
very end of setup_arch()).

> or we decide that this code does not belong in the kernel and
> should be abstracted away.
> 
> And I think that most of the early bring up issues are just related to
> powering-up/resetting a cpu for it to be booted, probably that's the
> abstraction we should be focusing on, because it should just require poking
> a bunch of registers to kickstart a CPU, no more than that, FW should be
> able to deal with that and that's yet another reason behind PSCI design.

Right, I agree that if we can push that into PSCI that would be great
(provided there's an open-source implementation of PSCI). But for 32-bit
ARM that's no longer a viable option, so we're pretty much stuck with
what we have.

> I am not convinced that the early device model would be useful for any
> other reason, that's why shoehorning kernel changes in the current driver
> model just to bring up secondaries is not something I consider useful
> and proper, in the first place, but I am happy to hear other possible
> concerns.

I agree, but we still want to support early and driver model code in the
same source file to avoid duplication. What I prototyped is a driver
that's initialized to a bare minimum very early on and then takes over
when the driver model is up (using regular driver .probe()). I hope to
get the patches cleaned up and send them out tomorrow. If you want I can
add you on Cc.

Thierry

[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]

  parent reply	other threads:[~2014-06-30 19:36 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-27 16:58 [RFC 1/4] ARM: tegra: Move SoC drivers to drivers/soc/tegra Thierry Reding
     [not found] ` <1403888329-24755-1-git-send-email-thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2014-06-27 16:58   ` [RFC 2/4] ARM: tegra: Add legacy interrupt controller nodes Thierry Reding
     [not found]     ` <1403888329-24755-2-git-send-email-thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2014-06-27 20:58       ` Stephen Warren
     [not found]         ` <53ADDAEF.2070805-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2014-06-27 23:44           ` Thierry Reding
2014-06-27 16:58   ` [RFC 3/4] soc/tegra: Initialize interrupt controller from DT Thierry Reding
     [not found]     ` <1403888329-24755-3-git-send-email-thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2014-06-27 21:03       ` Stephen Warren
     [not found]         ` <53ADDC0C.4060401-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2014-06-28  1:12           ` Thierry Reding
2014-06-30 11:30       ` Peter De Schrijver
     [not found]         ` <20140630113013.GS3679-Rysk9IDjsxmJz7etNGeUX8VPkgjIgRvpAL8bYrjMMd8@public.gmane.org>
2014-06-30 19:51           ` Thierry Reding
2014-06-27 16:58   ` [RFC 4/4] soc/tegra: Remove unused defines Thierry Reding
     [not found]     ` <1403888329-24755-4-git-send-email-thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2014-06-27 21:03       ` Stephen Warren
     [not found]         ` <53ADDC22.9060205-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2014-06-28  1:12           ` Thierry Reding
2014-06-27 17:30   ` [RFC 1/4] ARM: tegra: Move SoC drivers to drivers/soc/tegra Santosh Shilimkar
     [not found]     ` <53ADAA1C.70407-l0cyMroinI0@public.gmane.org>
2014-06-27 23:27       ` Thierry Reding
2014-06-28 17:15         ` Santosh Shilimkar
     [not found]           ` <53AEF81D.3080408-l0cyMroinI0@public.gmane.org>
2014-06-28 20:40             ` Thierry Reding
2014-06-30  7:20               ` Arnd Bergmann
2014-06-30  9:01                 ` Thierry Reding
2014-06-30 10:36                   ` Catalin Marinas
     [not found]                     ` <20140630103649.GF28951-5wv7dgnIgG8@public.gmane.org>
2014-06-30 10:48                       ` Thierry Reding
2014-06-30 13:16                         ` Lorenzo Pieralisi
     [not found]                           ` <20140630131628.GA31517-7AyDDHkRsp3ZROr8t4l/smS4ubULX0JqMm0uRHvK7Nw@public.gmane.org>
2014-06-30 19:36                             ` Thierry Reding [this message]
2014-07-01 10:50                               ` Catalin Marinas
     [not found]                                 ` <20140701105056.GO18313-5wv7dgnIgG8@public.gmane.org>
2014-07-01 15:05                                   ` Stephen Warren
     [not found]                                     ` <53B2CE4B.2010506-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2014-07-01 17:00                                       ` Catalin Marinas
2014-06-30 19:21                 ` Thierry Reding
2014-07-01  7:51                   ` Peter De Schrijver
2014-07-16 19:31                 ` Olof Johansson
     [not found]                   ` <CAOesGMjgNZ0hvWy0p1fh36gOMfBVd-uJSf=AWUsr9GdrrErtyw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-07-16 19:47                     ` Thierry Reding
2014-07-17  9:31                     ` Catalin Marinas
     [not found]                       ` <20140717093149.GB3180-5wv7dgnIgG8@public.gmane.org>
2014-07-17 16:21                         ` Olof Johansson
2014-06-30  7:23             ` Arnd Bergmann
2014-06-30  9:44               ` Catalin Marinas
2014-06-30 18:45               ` Stephen Warren
2014-06-30 10:25         ` Catalin Marinas
     [not found]           ` <20140630102512.GE28951-5wv7dgnIgG8@public.gmane.org>
2014-06-30 10:49             ` Thierry Reding
2014-06-30 11:46             ` Peter De Schrijver
     [not found]               ` <20140630114621.GT3679-Rysk9IDjsxmJz7etNGeUX8VPkgjIgRvpAL8bYrjMMd8@public.gmane.org>
2014-06-30 14:13                 ` Catalin Marinas
     [not found]                   ` <20140630141334.GK28951-5wv7dgnIgG8@public.gmane.org>
2014-06-30 14:42                     ` Peter De Schrijver
     [not found]                       ` <20140630144217.GV3679-Rysk9IDjsxmJz7etNGeUX8VPkgjIgRvpAL8bYrjMMd8@public.gmane.org>
2014-06-30 14:50                         ` Peter De Schrijver
2014-06-30 16:08                         ` Catalin Marinas
2014-06-27 21:10   ` Stephen Warren
     [not found]     ` <53ADDDC1.2080603-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2014-06-28  1:24       ` Thierry Reding

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=20140630193635.GB32594@mithrandir \
    --to=thierry.reding-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
    --cc=Catalin.Marinas-5wv7dgnIgG8@public.gmane.org \
    --cc=arnd-r2nGTMty4D4@public.gmane.org \
    --cc=galak-XVmvHMARGAS8U2dJNN8I7kB+6BGkLq7r@public.gmane.org \
    --cc=gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org \
    --cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
    --cc=linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=lorenzo.pieralisi-5wv7dgnIgG8@public.gmane.org \
    --cc=santosh.shilimkar-l0cyMroinI0@public.gmane.org \
    --cc=swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.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