mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
To: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Cc: barebox@lists.infradead.org
Subject: [PATCH v2 2/6] ARM: mvebu: Add machine compatible to mbus ranges
Date: Wed, 17 Sep 2014 22:22:40 +0200	[thread overview]
Message-ID: <1410985364-7105-3-git-send-email-sebastian.hesselbarth@gmail.com> (raw)
In-Reply-To: <1410985364-7105-1-git-send-email-sebastian.hesselbarth@gmail.com>

Multi-SoC support for MVEBU will add mbus ranges for all compiled
SoCs. To protect the mbus node of the SoC barebox is executed on
from others ranges, pass machine's compatible to mvebu_mbus_add_range
and check before applying the fixup.

Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
---
Cc: Sascha Hauer <s.hauer@pengutronix.de>
Cc: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
Cc: barebox@lists.infradead.org
---
 arch/arm/mach-mvebu/armada-370-xp.c | 3 ++-
 arch/arm/mach-mvebu/dove.c          | 6 ++++--
 arch/arm/mach-mvebu/kirkwood.c      | 3 ++-
 drivers/bus/mvebu-mbus.c            | 6 +++++-
 include/linux/mbus.h                | 3 ++-
 5 files changed, 15 insertions(+), 6 deletions(-)

diff --git a/arch/arm/mach-mvebu/armada-370-xp.c b/arch/arm/mach-mvebu/armada-370-xp.c
index 6251100e886d..92096fcccabe 100644
--- a/arch/arm/mach-mvebu/armada-370-xp.c
+++ b/arch/arm/mach-mvebu/armada-370-xp.c
@@ -70,7 +70,8 @@ static int armada_370_xp_init_soc(void)
 	armada_370_xp_memory_find(&phys_base, &phys_size);
 
 	mvebu_set_memory(phys_base, phys_size);
-	mvebu_mbus_add_range(0xf0, 0x01, MVEBU_REMAP_INT_REG_BASE);
+	mvebu_mbus_add_range("marvell,armada-370-xp", 0xf0, 0x01,
+			     MVEBU_REMAP_INT_REG_BASE);
 
 	return 0;
 }
diff --git a/arch/arm/mach-mvebu/dove.c b/arch/arm/mach-mvebu/dove.c
index 17cee0b9017c..85fdbe41b55c 100644
--- a/arch/arm/mach-mvebu/dove.c
+++ b/arch/arm/mach-mvebu/dove.c
@@ -90,8 +90,10 @@ static int dove_init_soc(void)
 	dove_memory_find(&phys_base, &phys_size);
 
 	mvebu_set_memory(phys_base, phys_size);
-	mvebu_mbus_add_range(0xf0, 0x01, MVEBU_REMAP_INT_REG_BASE);
-	mvebu_mbus_add_range(0xf0, 0x02, DOVE_REMAP_MC_REGS);
+	mvebu_mbus_add_range("marvell,dove", 0xf0, 0x01,
+			     MVEBU_REMAP_INT_REG_BASE);
+	mvebu_mbus_add_range("marvell,dove", 0xf0, 0x02,
+			     DOVE_REMAP_MC_REGS);
 
 	return 0;
 }
diff --git a/arch/arm/mach-mvebu/kirkwood.c b/arch/arm/mach-mvebu/kirkwood.c
index 7c0526b885a0..b6cbd02592a4 100644
--- a/arch/arm/mach-mvebu/kirkwood.c
+++ b/arch/arm/mach-mvebu/kirkwood.c
@@ -63,7 +63,8 @@ static int kirkwood_init_soc(void)
 	kirkwood_memory_find(&phys_base, &phys_size);
 
 	mvebu_set_memory(phys_base, phys_size);
-	mvebu_mbus_add_range(0xf0, 0x01, MVEBU_REMAP_INT_REG_BASE);
+	mvebu_mbus_add_range("marvell,kirkwood", 0xf0, 0x01,
+			     MVEBU_REMAP_INT_REG_BASE);
 
 	return 0;
 }
diff --git a/drivers/bus/mvebu-mbus.c b/drivers/bus/mvebu-mbus.c
index b7f78367d4a7..9dc43011b964 100644
--- a/drivers/bus/mvebu-mbus.c
+++ b/drivers/bus/mvebu-mbus.c
@@ -744,6 +744,7 @@ static int mvebu_mbus_init(void)
 postcore_initcall(mvebu_mbus_init);
 
 struct mbus_range {
+	const char *compatible;
 	u32 mbusid;
 	u32 remap;
 	struct list_head list;
@@ -752,10 +753,11 @@ struct mbus_range {
 #define MBUS_ID(t,a)	(((t) << 24) | ((attr) << 16))
 static LIST_HEAD(mbus_ranges);
 
-void mvebu_mbus_add_range(u8 target, u8 attr, u32 remap)
+void mvebu_mbus_add_range(const char *compatible, u8 target, u8 attr, u32 remap)
 {
 	struct mbus_range *r = xzalloc(sizeof(*r));
 
+	r->compatible = strdup(compatible);
 	r->mbusid = MBUS_ID(target, attr);
 	r->remap = remap;
 	list_add_tail(&r->list, &mbus_ranges);
@@ -811,6 +813,8 @@ static int mvebu_mbus_of_fixup(struct device_node *root, void *context)
 				continue;
 
 			list_for_each_entry(r, &mbus_ranges, list) {
+				if (!of_machine_is_compatible(r->compatible))
+					continue;
 				if (r->mbusid == mbusid)
 					ranges[n + na + pa - 1] = r->remap;
 			}
diff --git a/include/linux/mbus.h b/include/linux/mbus.h
index ac149828757b..b90fabbfb7e5 100644
--- a/include/linux/mbus.h
+++ b/include/linux/mbus.h
@@ -58,6 +58,7 @@ int mvebu_mbus_add_window_by_id(unsigned int target, unsigned int attribute,
 				phys_addr_t base, size_t size);
 int mvebu_mbus_del_window(phys_addr_t base, size_t size);
 
-void mvebu_mbus_add_range(u8 target, u8 attr, u32 remap);
+void mvebu_mbus_add_range(const char *compatible,
+			  u8 target, u8 attr, u32 remap);
 
 #endif /* __LINUX_MBUS_H */
-- 
2.0.0


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  parent reply	other threads:[~2014-09-17 20:23 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-17 20:22 [PATCH v2 0/6] mvebu multi SoC support Sebastian Hesselbarth
2014-09-17 20:22 ` [PATCH v2 1/6] ARM: mvebu: Add common reset_cpu function Sebastian Hesselbarth
2014-09-17 20:22 ` Sebastian Hesselbarth [this message]
2014-09-17 20:22 ` [PATCH v2 3/6] ARM: mvebu: Simplify memory init order Sebastian Hesselbarth
2014-09-17 20:22 ` [PATCH v2 4/6] ARM: mvebu: Check for correct SoC in of_fixup callback Sebastian Hesselbarth
2014-09-17 20:22 ` [PATCH v2 5/6] ARM: mvebu: Allow multiple SoCs Sebastian Hesselbarth
2014-09-17 20:22 ` [PATCH v2 6/6] ARM: Add mvebu_defconfig Sebastian Hesselbarth
2014-09-20 17:24   ` Sebastian Hesselbarth
2014-09-23  5:58     ` Sascha Hauer
2014-09-19  5:47 ` [PATCH v2 0/6] mvebu multi SoC support Sascha Hauer
2014-09-19  6:44   ` Sebastian Hesselbarth
2014-09-19  7:55     ` Sascha Hauer
2014-09-19  8:25       ` Sebastian Hesselbarth

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=1410985364-7105-3-git-send-email-sebastian.hesselbarth@gmail.com \
    --to=sebastian.hesselbarth@gmail.com \
    --cc=barebox@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