linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: slash.tmp@free.fr (Mason)
To: linux-arm-kernel@lists.infradead.org
Subject: Preprocessor arithmetic in dtsi files (base + offset)
Date: Thu, 26 Nov 2015 14:16:16 +0100	[thread overview]
Message-ID: <56570620.3070106@free.fr> (raw)

Hello,

In the device tree for my ARM platform, I have several nodes with
addresses within the SCU block:

	scu: scu at 20000000 {
		compatible = "arm,cortex-a9-scu";
		reg = <0x20000000 0x100>;

	gic: interrupt-controller at 20001000 {
		compatible = "arm,cortex-a9-gic";
		reg = <0x20001000 0x1000>, <0x20000100 0x0100>;

	twd-timer at 20000600 {
		compatible = "arm,cortex-a9-twd-timer";
		reg = <0x20000600 0x10>;

Can I use preprocessor arithmetic to abstract the base address,
as would be done in C?

#define SCU_BASE 0x20000000

	scu: scu at XXX {
		compatible = "arm,cortex-a9-scu";
		reg = <SCU_BASE 0x100>;
	
	gic: interrupt-controller at XXX {
		compatible = "arm,cortex-a9-gic";
		reg = <SCU_BASE+0x1000 0x1000>, <SCU_BASE+0x100 0x0100>;

	twd-timer at XXX {
		compatible = "arm,cortex-a9-twd-timer";
		reg = <SCU_BASE+0x600 0x10>;

Are the @XXX important? Can they be removed altogether?

Regards.

             reply	other threads:[~2015-11-26 13:16 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-26 13:16 Mason [this message]
2015-11-26 13:52 ` Preprocessor arithmetic in dtsi files (base + offset) Mark Rutland
2015-11-26 13:59 ` Russell King - ARM Linux
2015-11-26 14:44   ` Mason
2015-11-26 16:23     ` Geert Uytterhoeven
2015-11-26 17:51       ` Robin Murphy
2015-12-02 22:14       ` Mason

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=56570620.3070106@free.fr \
    --to=slash.tmp@free.fr \
    --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).