From: thomas.petazzoni@free-electrons.com (Thomas Petazzoni)
To: linux-arm-kernel@lists.infradead.org
Subject: mach header files
Date: Fri, 4 Apr 2014 15:20:41 +0200 [thread overview]
Message-ID: <20140404152041.6b06bd85@skate> (raw)
In-Reply-To: <645d041db09d4cf883ba178c695fe504@HKXPR06MB168.apcprd06.prod.outlook.com>
Dear Phil Edworthy,
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.
Best regards,
Thomas
--
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
next prev parent reply other threads:[~2014-04-04 13:20 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 [this message]
2014-04-08 14:00 ` Laurent Pinchart
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=20140404152041.6b06bd85@skate \
--to=thomas.petazzoni@free-electrons.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;
as well as URLs for NNTP newsgroup(s).