[PATCH v2 4/3] mvebu: armada-370-xp: simplify soc init code flow

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This gets rid of a of-fixup which is strange because the soc init stuff
is rerun then when a new dt for booting into Linux is loaded.

The initcall must be postponed to post-core to ensure
of_machine_is_compatible is working correctly.

The call to mvebu_mbus_add_range is moved to drivers/bus/mvebu-mbus.c to
ensure it's registered early enough.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@xxxxxxxxxxxxxx>
---
 arch/arm/mach-mvebu/armada-370-xp.c | 31 ++++++++-----------------------
 drivers/bus/mvebu-mbus.c            |  9 ++++++++-
 2 files changed, 16 insertions(+), 24 deletions(-)

diff --git a/arch/arm/mach-mvebu/armada-370-xp.c b/arch/arm/mach-mvebu/armada-370-xp.c
index 5fb207594fd4..93ad955a6e49 100644
--- a/arch/arm/mach-mvebu/armada-370-xp.c
+++ b/arch/arm/mach-mvebu/armada-370-xp.c
@@ -83,19 +83,7 @@ static void __noreturn armada_370_xp_restart_soc(struct restart_handler *rst)
 	hang();
 }
 
-static int armada_xp_init_soc(struct device_node *root)
-{
-	u32 reg;
-
-	/* Enable GBE0, GBE1, LCD and NFC PUP */
-	reg = readl(ARMADA_XP_PUP_ENABLE);
-	reg |= GE0_PUP_EN | GE1_PUP_EN | LCD_PUP_EN | NAND_PUP_EN | SPI_PUP_EN;
-	writel(reg, ARMADA_XP_PUP_ENABLE);
-
-	return 0;
-}
-
-static int armada_370_xp_init_soc(struct device_node *root, void *context)
+static int armada_370_xp_init_soc(void)
 {
 	u32 reg;
 
@@ -116,16 +104,13 @@ static int armada_370_xp_init_soc(struct device_node *root, void *context)
 
 	armada_xp_soc_id_fixup();
 
-	if (of_machine_is_compatible("marvell,armadaxp"))
-		armada_xp_init_soc(root);
+	if (of_machine_is_compatible("marvell,armadaxp")) {
+		/* Enable GBE0, GBE1, LCD and NFC PUP */
+		reg = readl(ARMADA_XP_PUP_ENABLE);
+		reg |= GE0_PUP_EN | GE1_PUP_EN | LCD_PUP_EN | NAND_PUP_EN | SPI_PUP_EN;
+		writel(reg, ARMADA_XP_PUP_ENABLE);
+	}
 
 	return 0;
 }
-
-static int armada_370_xp_register_soc_fixup(void)
-{
-	mvebu_mbus_add_range("marvell,armada-370-xp", 0xf0, 0x01,
-			     MVEBU_REMAP_INT_REG_BASE);
-	return of_register_fixup(armada_370_xp_init_soc, NULL);
-}
-pure_initcall(armada_370_xp_register_soc_fixup);
+postcore_initcall(armada_370_xp_init_soc);
diff --git a/drivers/bus/mvebu-mbus.c b/drivers/bus/mvebu-mbus.c
index df5f7a32d346..b95c071d57a4 100644
--- a/drivers/bus/mvebu-mbus.c
+++ b/drivers/bus/mvebu-mbus.c
@@ -59,6 +59,7 @@
 #include <of.h>
 #include <of_address.h>
 #include <linux/mbus.h>
+#include <mach/common.h>
 
 /* DDR target is the same on all platforms */
 #define TARGET_DDR		0
@@ -810,7 +811,13 @@ static int mvebu_mbus_of_fixup(struct device_node *root, void *context)
 	return 0;
 }
 
-static int mvebu_mbus_fixup_register(void) {
+static int mvebu_mbus_fixup_register(void)
+{
+	if (IS_ENABLED(CONFIG_ARCH_ARMADA_370) ||
+	    IS_ENABLED(CONFIG_ARCH_ARMADA_XP))
+		mvebu_mbus_add_range("marvell,armada-370-xp", 0xf0, 0x01,
+				     MVEBU_REMAP_INT_REG_BASE);
+
 	return of_register_fixup(mvebu_mbus_of_fixup, NULL);
 }
 pure_initcall(mvebu_mbus_fixup_register);
-- 
2.11.0


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




[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux