From: laurent.pinchart@ideasonboard.com (Laurent Pinchart)
To: linux-arm-kernel@lists.infradead.org
Subject: mach header files
Date: Tue, 08 Apr 2014 16:00:17 +0200 [thread overview]
Message-ID: <4261016.NOmSY7hXBc@avalon> (raw)
In-Reply-To: <20140404152041.6b06bd85@skate>
Hi,
On Friday 04 April 2014 15:20:41 Thomas Petazzoni wrote:
> On Fri, 4 Apr 2014 13:14:44 +0000, Phil Edworthy wrote:
> > > If it is used only by one driver, then it should go directly into
> > > that driver without a #include. For SoC defines, you'll need to
> > > check with the arm-soc maintainers. I *think* we're trying to get
> > > away from separate arch/arm/mach-* directories, but I'm slightly
> > > out of touch. You certainly should not do anything that breaks
> > > multiplatform builds.
> >
> > This is where it gets tricky. The clock driver only wants to know
> > about one reg in a block of general system control registers. There
> > is very little input to the clock driver... the SoC code needs to
> > access other registers in the system control block.
> >
> > I think you are right about trying to avoid separate arch/arm/mach-*
> > directories, which is what prompted my question. So, how best to
> > handle this?
>
> I believe there are two solutions here:
>
> * Have a driver in arch/arm/mach-foo/ for your "system control block"
> that exposes a small API used by your clock driver in drivers/clk/.
> The issue is of course always: where to put the header files for
> this small API.
>
> * Have both your clock driver and your system control block driver map
> the registers they need, even if some of those registers are the
> same. Then you can use atomic_io_modify() from both drivers to
> atomically make changes to these registers. This is typically OK if
> you don't have any performance sensitive usage of those registers
> (atomic_io_modify accesses are protected by a global spinlock). This
> is the solution we've used between the Armada watchdog and Armada
> clocksource drivers, which require accessing a shared register, even
> though those two drivers are completely unrelated.
Just for what it's worth, we've solved this problem on R-Car Gen2 by passing
the boot mode using a direct explicit call from platform code to the clock
driver. See rcar_gen2_clocks_init() in drivers/clk/shmobile/clk-rcar-gen2.c
and arch/arm/mach-shmobile/setup-rcar-gen2.c.
If we want to get rid of that I'd go for the first option, as the boot mode
register is really not part of the clock IP core and should not be listed as a
memory resource in its DT node.
--
Regards,
Laurent Pinchart
next prev parent reply other threads:[~2014-04-08 14:00 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-04 8:19 mach header files Phil Edworthy
2014-04-04 10:29 ` Grant Likely
2014-04-04 12:16 ` Phil Edworthy
2014-04-04 12:22 ` Grant Likely
2014-04-04 13:14 ` Phil Edworthy
2014-04-04 13:20 ` Thomas Petazzoni
2014-04-08 14:00 ` Laurent Pinchart [this message]
2014-04-04 13:44 ` Grant Likely
2014-04-04 13:24 ` Arnd Bergmann
2014-04-04 13:32 ` Barry Song
2014-04-04 15:27 ` Arnd Bergmann
2014-04-04 13:52 ` Phil Edworthy
2014-04-04 15:30 ` Arnd Bergmann
2014-04-04 15:42 ` Phil Edworthy
2014-04-04 15:50 ` Arnd Bergmann
2014-04-04 16:02 ` Phil Edworthy
2014-04-04 16:22 ` Russell King - ARM Linux
2014-04-04 16:38 ` Phil Edworthy
2014-04-04 18:01 ` Kent Borg
2014-04-04 18:49 ` Arnd Bergmann
2014-04-04 19:01 ` Kent Borg
2014-04-04 19:19 ` Arnd Bergmann
-- strict thread matches above, loose matches on Subject: below --
2014-04-02 15:11 Phil Edworthy
2014-04-02 15:16 ` Arnd Bergmann
2014-04-03 7:48 ` Phil Edworthy
2014-04-02 15:20 ` Ben Dooks
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=4261016.NOmSY7hXBc@avalon \
--to=laurent.pinchart@ideasonboard.com \
--cc=linux-arm-kernel@lists.infradead.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