mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] mvebu: Fix fixup of mbus device-tree ranges
@ 2017-02-22 20:06 Uwe Kleine-König
  2017-02-24  7:12 ` Sascha Hauer
  0 siblings, 1 reply; 3+ messages in thread
From: Uwe Kleine-König @ 2017-02-22 20:06 UTC (permalink / raw)
  To: barebox

Commits "mvebu: {armada-370-xp,dove,kirkwood}: simplify soc init code
flow" simplified too much. The problem is that if the dtb used for
probing doesn't use the same mbus window address as barebox (i.e.
0xf1000000) the fixup fails because above commits moved the information
about the real position to a postcore initcall which is too late because
the fixup happens in of_arm_init which runs as core initcall.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 arch/arm/mach-mvebu/armada-370-xp.c |  3 ---
 arch/arm/mach-mvebu/dove.c          |  5 -----
 arch/arm/mach-mvebu/kirkwood.c      |  2 --
 drivers/bus/mvebu-mbus.c            | 22 +++++++++++++++++++++-
 4 files changed, 21 insertions(+), 11 deletions(-)

diff --git a/arch/arm/mach-mvebu/armada-370-xp.c b/arch/arm/mach-mvebu/armada-370-xp.c
index 196b770277f3..93ad955a6e49 100644
--- a/arch/arm/mach-mvebu/armada-370-xp.c
+++ b/arch/arm/mach-mvebu/armada-370-xp.c
@@ -90,9 +90,6 @@ static int armada_370_xp_init_soc(void)
 	if (!of_machine_is_compatible("marvell,armada-370-xp"))
 		return 0;
 
-	mvebu_mbus_add_range("marvell,armada-370-xp", 0xf0, 0x01,
-			     MVEBU_REMAP_INT_REG_BASE);
-
 	restart_handler_register_fn(armada_370_xp_restart_soc);
 
 	barebox_set_model("Marvell Armada 370/XP");
diff --git a/arch/arm/mach-mvebu/dove.c b/arch/arm/mach-mvebu/dove.c
index 54da0d785490..1cdb7e1b8296 100644
--- a/arch/arm/mach-mvebu/dove.c
+++ b/arch/arm/mach-mvebu/dove.c
@@ -57,11 +57,6 @@ static int dove_init_soc(void)
 	if (!of_machine_is_compatible("marvell,dove"))
 		return 0;
 
-	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);
-
 	restart_handler_register_fn(dove_restart_soc);
 
 	barebox_set_model("Marvell Dove");
diff --git a/arch/arm/mach-mvebu/kirkwood.c b/arch/arm/mach-mvebu/kirkwood.c
index 36cd2a84a6f5..59fb95ff4adf 100644
--- a/arch/arm/mach-mvebu/kirkwood.c
+++ b/arch/arm/mach-mvebu/kirkwood.c
@@ -34,8 +34,6 @@ static int kirkwood_init_soc(void)
 	if (!of_machine_is_compatible("marvell,kirkwood"))
 		return 0;
 
-	mvebu_mbus_add_range("marvell,kirkwood", 0xf0, 0x01,
-			     MVEBU_REMAP_INT_REG_BASE);
 	restart_handler_register_fn(kirkwood_restart_soc);
 
 	barebox_set_model("Marvell Kirkwood");
diff --git a/drivers/bus/mvebu-mbus.c b/drivers/bus/mvebu-mbus.c
index df5f7a32d346..79c80cf52115 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,26 @@ static int mvebu_mbus_of_fixup(struct device_node *root, void *context)
 	return 0;
 }
 
-static int mvebu_mbus_fixup_register(void) {
+#define DOVE_REMAP_MC_REGS		0xf1800000
+
+static int mvebu_mbus_fixup_register(void)
+{
+	if (IS_ENABLED(CONFIG_ARCH_DOVE)) {
+		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);
+	}
+
+	if (IS_ENABLED(CONFIG_ARCH_KIRKWOOD))
+		mvebu_mbus_add_range("marvell,kirkwood", 0xf0, 0x01,
+				     MVEBU_REMAP_INT_REG_BASE);
+
+	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@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] mvebu: Fix fixup of mbus device-tree ranges
  2017-02-22 20:06 [PATCH] mvebu: Fix fixup of mbus device-tree ranges Uwe Kleine-König
@ 2017-02-24  7:12 ` Sascha Hauer
  2017-02-25 20:41   ` Uwe Kleine-König
  0 siblings, 1 reply; 3+ messages in thread
From: Sascha Hauer @ 2017-02-24  7:12 UTC (permalink / raw)
  To: Uwe Kleine-König; +Cc: barebox

On Wed, Feb 22, 2017 at 09:06:18PM +0100, Uwe Kleine-König wrote:
> Commits "mvebu: {armada-370-xp,dove,kirkwood}: simplify soc init code
> flow" simplified too much. The problem is that if the dtb used for
> probing doesn't use the same mbus window address as barebox (i.e.
> 0xf1000000) the fixup fails because above commits moved the information
> about the real position to a postcore initcall which is too late because
> the fixup happens in of_arm_init which runs as core initcall.

Said patches are currently in -next, so you could send a fixup patch
instead or I could just remove the patches.

Sascha

> 
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> ---
>  arch/arm/mach-mvebu/armada-370-xp.c |  3 ---
>  arch/arm/mach-mvebu/dove.c          |  5 -----
>  arch/arm/mach-mvebu/kirkwood.c      |  2 --
>  drivers/bus/mvebu-mbus.c            | 22 +++++++++++++++++++++-
>  4 files changed, 21 insertions(+), 11 deletions(-)
> 
> diff --git a/arch/arm/mach-mvebu/armada-370-xp.c b/arch/arm/mach-mvebu/armada-370-xp.c
> index 196b770277f3..93ad955a6e49 100644
> --- a/arch/arm/mach-mvebu/armada-370-xp.c
> +++ b/arch/arm/mach-mvebu/armada-370-xp.c
> @@ -90,9 +90,6 @@ static int armada_370_xp_init_soc(void)
>  	if (!of_machine_is_compatible("marvell,armada-370-xp"))
>  		return 0;
>  
> -	mvebu_mbus_add_range("marvell,armada-370-xp", 0xf0, 0x01,
> -			     MVEBU_REMAP_INT_REG_BASE);
> -
>  	restart_handler_register_fn(armada_370_xp_restart_soc);
>  
>  	barebox_set_model("Marvell Armada 370/XP");
> diff --git a/arch/arm/mach-mvebu/dove.c b/arch/arm/mach-mvebu/dove.c
> index 54da0d785490..1cdb7e1b8296 100644
> --- a/arch/arm/mach-mvebu/dove.c
> +++ b/arch/arm/mach-mvebu/dove.c
> @@ -57,11 +57,6 @@ static int dove_init_soc(void)
>  	if (!of_machine_is_compatible("marvell,dove"))
>  		return 0;
>  
> -	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);
> -
>  	restart_handler_register_fn(dove_restart_soc);
>  
>  	barebox_set_model("Marvell Dove");
> diff --git a/arch/arm/mach-mvebu/kirkwood.c b/arch/arm/mach-mvebu/kirkwood.c
> index 36cd2a84a6f5..59fb95ff4adf 100644
> --- a/arch/arm/mach-mvebu/kirkwood.c
> +++ b/arch/arm/mach-mvebu/kirkwood.c
> @@ -34,8 +34,6 @@ static int kirkwood_init_soc(void)
>  	if (!of_machine_is_compatible("marvell,kirkwood"))
>  		return 0;
>  
> -	mvebu_mbus_add_range("marvell,kirkwood", 0xf0, 0x01,
> -			     MVEBU_REMAP_INT_REG_BASE);
>  	restart_handler_register_fn(kirkwood_restart_soc);
>  
>  	barebox_set_model("Marvell Kirkwood");
> diff --git a/drivers/bus/mvebu-mbus.c b/drivers/bus/mvebu-mbus.c
> index df5f7a32d346..79c80cf52115 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,26 @@ static int mvebu_mbus_of_fixup(struct device_node *root, void *context)
>  	return 0;
>  }
>  
> -static int mvebu_mbus_fixup_register(void) {
> +#define DOVE_REMAP_MC_REGS		0xf1800000
> +
> +static int mvebu_mbus_fixup_register(void)
> +{
> +	if (IS_ENABLED(CONFIG_ARCH_DOVE)) {
> +		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);
> +	}
> +
> +	if (IS_ENABLED(CONFIG_ARCH_KIRKWOOD))
> +		mvebu_mbus_add_range("marvell,kirkwood", 0xf0, 0x01,
> +				     MVEBU_REMAP_INT_REG_BASE);
> +
> +	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@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] mvebu: Fix fixup of mbus device-tree ranges
  2017-02-24  7:12 ` Sascha Hauer
@ 2017-02-25 20:41   ` Uwe Kleine-König
  0 siblings, 0 replies; 3+ messages in thread
From: Uwe Kleine-König @ 2017-02-25 20:41 UTC (permalink / raw)
  To: Sascha Hauer; +Cc: barebox

Hallo,

On Fri, Feb 24, 2017 at 08:12:25AM +0100, Sascha Hauer wrote:
> On Wed, Feb 22, 2017 at 09:06:18PM +0100, Uwe Kleine-König wrote:
> > Commits "mvebu: {armada-370-xp,dove,kirkwood}: simplify soc init code
> > flow" simplified too much. The problem is that if the dtb used for
> > probing doesn't use the same mbus window address as barebox (i.e.
> > 0xf1000000) the fixup fails because above commits moved the information
> > about the real position to a postcore initcall which is too late because
> > the fixup happens in of_arm_init which runs as core initcall.
> 
> Said patches are currently in -next, so you could send a fixup patch
> instead or I could just remove the patches.

As the commit log isn't correct with this squashed in I sent a v2 and
not a fixup for them.

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-02-25 20:41 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-22 20:06 [PATCH] mvebu: Fix fixup of mbus device-tree ranges Uwe Kleine-König
2017-02-24  7:12 ` Sascha Hauer
2017-02-25 20:41   ` Uwe Kleine-König

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox