* [PATCH 0/5] Early DT and MVEBU DT fixups
@ 2014-07-23 9:28 Sebastian Hesselbarth
2014-07-23 9:28 ` [PATCH 1/5] ARM: execute OF fixups early Sebastian Hesselbarth
` (5 more replies)
0 siblings, 6 replies; 9+ messages in thread
From: Sebastian Hesselbarth @ 2014-07-23 9:28 UTC (permalink / raw)
To: Sebastian Hesselbarth, barebox; +Cc: Thomas Petazzoni
Historically, early Armada 370 and XP boards where shipped with u-boot
not remapping internal register base therefore the upstream dts files
reflect that. On barebox we always remap the internal register base to
0xf1000000 and use DT to parse devices, causing the upstream dts to
diverge from what we actually see. Currently, we work around the issue
by applying a barebox specific dts overlay to reflect the different
internal register base.
This patch set provides a way to call DT fixups early and apply them
even on pbl or appended DTs. This is required for Marvell MVEBU SoCs
which can (and do) remap their internal register base address.
First, a call to of_fix_tree() is added to of_arm_init() right before
of_probe() starts. This allows to apply early registered DT fixups.
Patch 2 extends mvebu-mbus to fixup mbus ranges identified by their
target ID and target attribute. Patch 3 adds the required internal
register ranges to be fixed up for each of the 4 supported MVEBU SoCs.
Patch 4 then removes the now redundant DT overlay workarounds.
Patch 5 finally installs another DT fixup to properly set directly
attached RAM sizes which can read from internal SoC registers. This
also removes a runtime warning caused by double-registration of RAM
resources from arm_add_memory_device() and of_add_memory() later.
Patches have been tested on Armada 370, Dove, and Kirkwood.
Sebastian Hesselbarth (5):
ARM: execute OF fixups early
ARM: mvebu: allow to fixup mbus ranges
ARM: mvebu: add register remap for mbus ids
ARM: dts: mvebu: remove mbus ranges overwrite
ARM: mvebu: add fixup for directly attached memory
arch/arm/cpu/dtb.c | 1 +
arch/arm/dts/armada-370-mirabox-bb.dts | 3 --
arch/arm/dts/armada-xp-openblocks-ax3-4-bb.dts | 4 --
arch/arm/mach-mvebu/armada-370-xp.c | 5 +-
arch/arm/mach-mvebu/common.c | 59 ++++++++++++++++++++
arch/arm/mach-mvebu/dove.c | 6 ++-
arch/arm/mach-mvebu/include/mach/common.h | 2 +
arch/arm/mach-mvebu/kirkwood.c | 5 +-
drivers/bus/mvebu-mbus.c | 74 +++++++++++++++++++++++++-
include/linux/mbus.h | 2 +
10 files changed, 150 insertions(+), 11 deletions(-)
---
To: barebox@lists.infradead.org
To: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Cc: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
--
2.0.0
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 1/5] ARM: execute OF fixups early
2014-07-23 9:28 [PATCH 0/5] Early DT and MVEBU DT fixups Sebastian Hesselbarth
@ 2014-07-23 9:28 ` Sebastian Hesselbarth
2014-07-23 9:28 ` [PATCH 2/5] ARM: mvebu: allow to fixup mbus ranges Sebastian Hesselbarth
` (4 subsequent siblings)
5 siblings, 0 replies; 9+ messages in thread
From: Sebastian Hesselbarth @ 2014-07-23 9:28 UTC (permalink / raw)
To: Sebastian Hesselbarth, barebox; +Cc: Thomas Petazzoni
Device trees can be passed by primary boot loader or appended to
barebox binary. Unfortunately, before probing devices from such
a device tree, no fixup can be applied.
Add a call to of_fix_tree() right before probing devices to catch
some very early fixups.
Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
---
To: barebox@lists.infradead.org
To: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Cc: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
---
arch/arm/cpu/dtb.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/arch/arm/cpu/dtb.c b/arch/arm/cpu/dtb.c
index abc3ccb4c095..ae4ff2a9adcd 100644
--- a/arch/arm/cpu/dtb.c
+++ b/arch/arm/cpu/dtb.c
@@ -50,6 +50,7 @@ static int of_arm_init(void)
root = of_unflatten_dtb(fdt);
if (root) {
of_set_root_node(root);
+ of_fix_tree(root);
if (IS_ENABLED(CONFIG_OFDEVICE))
of_probe();
}
--
2.0.0
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 2/5] ARM: mvebu: allow to fixup mbus ranges
2014-07-23 9:28 [PATCH 0/5] Early DT and MVEBU DT fixups Sebastian Hesselbarth
2014-07-23 9:28 ` [PATCH 1/5] ARM: execute OF fixups early Sebastian Hesselbarth
@ 2014-07-23 9:28 ` Sebastian Hesselbarth
2014-07-23 9:28 ` [PATCH 3/5] ARM: mvebu: add register remap for mbus ids Sebastian Hesselbarth
` (3 subsequent siblings)
5 siblings, 0 replies; 9+ messages in thread
From: Sebastian Hesselbarth @ 2014-07-23 9:28 UTC (permalink / raw)
To: Sebastian Hesselbarth, barebox; +Cc: Thomas Petazzoni
On Marvell MVEBU SoCs internal registers are usually remapped from reset
default. While Dove and Kirkwood always had their registers remapped,
some Armada 370 and XP where shipped with bootloaders that did not remap
them.
On Barebox these registers are remapped early and on all MVEBU SoCs, so
provided DTs should always reflect that in their mbus ranges property.
This patch registers a fixup for DTBs and allows individual SoCs to add
specific remap ranges to the fixup list. The fixup is registered on
pure_initcall to even allow to fixup pbl or appended DTBs.
Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
---
To: barebox@lists.infradead.org
To: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Cc: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
---
drivers/bus/mvebu-mbus.c | 74 +++++++++++++++++++++++++++++++++++++++++++++++-
include/linux/mbus.h | 2 ++
2 files changed, 75 insertions(+), 1 deletion(-)
diff --git a/drivers/bus/mvebu-mbus.c b/drivers/bus/mvebu-mbus.c
index 11e3777a6094..2fefa63edd9d 100644
--- a/drivers/bus/mvebu-mbus.c
+++ b/drivers/bus/mvebu-mbus.c
@@ -53,6 +53,7 @@
#include <common.h>
#include <init.h>
#include <io.h>
+#include <malloc.h>
#include <of.h>
#include <of_address.h>
#include <linux/mbus.h>
@@ -546,7 +547,7 @@ void mvebu_mbus_get_pcie_io_aperture(struct resource *res)
* - bits 16 to 23: window attribute ID
* - bits 0 to 15: unused
*/
-#define CUSTOM(id) (((id) & 0xF0000000) >> 24)
+#define CUSTOM(id) (((id) & 0xF0000000) >> 28)
#define TARGET(id) (((id) & 0x0F000000) >> 24)
#define ATTR(id) (((id) & 0x00FF0000) >> 16)
@@ -741,3 +742,74 @@ static int mvebu_mbus_init(void)
return platform_driver_register(&mvebu_mbus_driver);
}
postcore_initcall(mvebu_mbus_init);
+
+struct mbus_range {
+ u32 mbusid;
+ u32 remap;
+ struct list_head list;
+};
+
+#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)
+{
+ struct mbus_range *r = xzalloc(sizeof(*r));
+
+ r->mbusid = MBUS_ID(target, attr);
+ r->remap = remap;
+ list_add_tail(&r->list, &mbus_ranges);
+}
+
+/*
+ * Barebox always remaps internal registers to 0xf1000000 on every SoC.
+ * As we (and Linux) need a working DT and there is no way to tell the current
+ * remap address, fixup any provided DT to ensure custom MBUS_IDs are correct.
+ */
+static int mvebu_mbus_of_fixup(struct device_node *root, void *context)
+{
+ struct device_node *np;
+
+ for_each_matching_node(np, mvebu_mbus_dt_ids) {
+ struct property *p;
+ int n, pa, na, ns, lenp, size;
+ u32 *ranges;
+
+ p = of_find_property(np, "ranges", &lenp);
+ if (!p)
+ return -EINVAL;
+
+ pa = of_n_addr_cells(np);
+ if (of_property_read_u32(np, "#address-cells", &na) ||
+ of_property_read_u32(np, "#size-cells", &ns))
+ return -EINVAL;
+
+ size = pa + na + ns;
+ ranges = xzalloc(lenp);
+ of_property_read_u32_array(np, "ranges", ranges, lenp/4);
+
+ for (n = 0; n < lenp/4; n += size) {
+ struct mbus_range *r;
+ u32 mbusid = ranges[n];
+
+ if (!CUSTOM(mbusid))
+ continue;
+
+ list_for_each_entry(r, &mbus_ranges, list) {
+ if (r->mbusid == mbusid)
+ ranges[n + na] = r->remap;
+ }
+ }
+
+ if (of_property_write_u32_array(np, "ranges", ranges, lenp/4))
+ pr_err("Unable to fixup mbus ranges\n");
+ free(ranges);
+ }
+
+ return 0;
+}
+
+static int mvebu_mbus_fixup_register(void) {
+ return of_register_fixup(mvebu_mbus_of_fixup, NULL);
+}
+pure_initcall(mvebu_mbus_fixup_register);
diff --git a/include/linux/mbus.h b/include/linux/mbus.h
index 578ff331461c..ac149828757b 100644
--- a/include/linux/mbus.h
+++ b/include/linux/mbus.h
@@ -58,4 +58,6 @@ 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);
+
#endif /* __LINUX_MBUS_H */
--
2.0.0
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 3/5] ARM: mvebu: add register remap for mbus ids
2014-07-23 9:28 [PATCH 0/5] Early DT and MVEBU DT fixups Sebastian Hesselbarth
2014-07-23 9:28 ` [PATCH 1/5] ARM: execute OF fixups early Sebastian Hesselbarth
2014-07-23 9:28 ` [PATCH 2/5] ARM: mvebu: allow to fixup mbus ranges Sebastian Hesselbarth
@ 2014-07-23 9:28 ` Sebastian Hesselbarth
2014-07-23 9:28 ` [PATCH 4/5] ARM: dts: mvebu: remove mbus ranges overwrite Sebastian Hesselbarth
` (2 subsequent siblings)
5 siblings, 0 replies; 9+ messages in thread
From: Sebastian Hesselbarth @ 2014-07-23 9:28 UTC (permalink / raw)
To: Sebastian Hesselbarth, barebox; +Cc: Thomas Petazzoni
For each supported MVEBU SoC, add the corresponding remapped registers
to fix them up in provided DTBs.
Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
---
To: barebox@lists.infradead.org
To: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Cc: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
---
arch/arm/mach-mvebu/armada-370-xp.c | 3 +++
arch/arm/mach-mvebu/dove.c | 4 ++++
arch/arm/mach-mvebu/kirkwood.c | 3 +++
3 files changed, 10 insertions(+)
diff --git a/arch/arm/mach-mvebu/armada-370-xp.c b/arch/arm/mach-mvebu/armada-370-xp.c
index e416a3876539..f5ff9640b770 100644
--- a/arch/arm/mach-mvebu/armada-370-xp.c
+++ b/arch/arm/mach-mvebu/armada-370-xp.c
@@ -18,6 +18,7 @@
#include <init.h>
#include <io.h>
#include <asm/memory.h>
+#include <linux/mbus.h>
#include <mach/armada-370-xp-regs.h>
static inline void armada_370_xp_memory_find(unsigned long *phys_base,
@@ -53,6 +54,8 @@ static int armada_370_xp_init_soc(void)
armada_370_xp_memory_find(&phys_base, &phys_size);
arm_add_mem_device("ram0", phys_base, phys_size);
+ mvebu_mbus_add_range(0xf0, 0x01, MVEBU_REMAP_INT_REG_BASE);
+
return 0;
}
core_initcall(armada_370_xp_init_soc);
diff --git a/arch/arm/mach-mvebu/dove.c b/arch/arm/mach-mvebu/dove.c
index bcbf4b8ad7bd..974f48074150 100644
--- a/arch/arm/mach-mvebu/dove.c
+++ b/arch/arm/mach-mvebu/dove.c
@@ -18,6 +18,7 @@
#include <init.h>
#include <io.h>
#include <asm/memory.h>
+#include <linux/mbus.h>
#include <mach/dove-regs.h>
static inline void dove_remap_mc_regs(void)
@@ -78,6 +79,9 @@ static int dove_init_soc(void)
dove_memory_find(&phys_base, &phys_size);
arm_add_mem_device("ram0", 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);
+
return 0;
}
core_initcall(dove_init_soc);
diff --git a/arch/arm/mach-mvebu/kirkwood.c b/arch/arm/mach-mvebu/kirkwood.c
index fe9ca9cbe4d3..2249b9bfc64b 100644
--- a/arch/arm/mach-mvebu/kirkwood.c
+++ b/arch/arm/mach-mvebu/kirkwood.c
@@ -17,6 +17,7 @@
#include <init.h>
#include <io.h>
#include <asm/memory.h>
+#include <linux/mbus.h>
#include <mach/kirkwood-regs.h>
static inline void kirkwood_memory_find(unsigned long *phys_base,
@@ -52,6 +53,8 @@ static int kirkwood_init_soc(void)
kirkwood_memory_find(&phys_base, &phys_size);
arm_add_mem_device("ram0", phys_base, phys_size);
+ mvebu_mbus_add_range(0xf0, 0x01, MVEBU_REMAP_INT_REG_BASE);
+
return 0;
}
core_initcall(kirkwood_init_soc);
--
2.0.0
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 4/5] ARM: dts: mvebu: remove mbus ranges overwrite
2014-07-23 9:28 [PATCH 0/5] Early DT and MVEBU DT fixups Sebastian Hesselbarth
` (2 preceding siblings ...)
2014-07-23 9:28 ` [PATCH 3/5] ARM: mvebu: add register remap for mbus ids Sebastian Hesselbarth
@ 2014-07-23 9:28 ` Sebastian Hesselbarth
2014-08-02 3:07 ` Ezequiel Garcia
2014-07-23 9:28 ` [PATCH 5/5] ARM: mvebu: add fixup for directly attached memory Sebastian Hesselbarth
2014-07-25 7:06 ` [PATCH 0/5] Early DT and MVEBU DT fixups Sascha Hauer
5 siblings, 1 reply; 9+ messages in thread
From: Sebastian Hesselbarth @ 2014-07-23 9:28 UTC (permalink / raw)
To: Sebastian Hesselbarth, barebox; +Cc: Thomas Petazzoni
With proper DT fixup in place, we can now remove the overwrite of
mbus ranges in Armada 370 Mirabox and Armada XP Openblocks AX3.
Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
---
To: barebox@lists.infradead.org
To: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Cc: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
---
arch/arm/dts/armada-370-mirabox-bb.dts | 3 ---
arch/arm/dts/armada-xp-openblocks-ax3-4-bb.dts | 4 ----
2 files changed, 7 deletions(-)
diff --git a/arch/arm/dts/armada-370-mirabox-bb.dts b/arch/arm/dts/armada-370-mirabox-bb.dts
index c7849237fb82..ad108b365c69 100644
--- a/arch/arm/dts/armada-370-mirabox-bb.dts
+++ b/arch/arm/dts/armada-370-mirabox-bb.dts
@@ -12,9 +12,6 @@
};
soc {
- ranges = <MBUS_ID(0xf0, 0x01) 0 0xf1000000 0x100000
- MBUS_ID(0x01, 0xe0) 0 0xfff00000 0x100000>;
-
internal-regs {
gpio_leds {
green_pwr_led {
diff --git a/arch/arm/dts/armada-xp-openblocks-ax3-4-bb.dts b/arch/arm/dts/armada-xp-openblocks-ax3-4-bb.dts
index 30433f467bda..6af9c73576e0 100644
--- a/arch/arm/dts/armada-xp-openblocks-ax3-4-bb.dts
+++ b/arch/arm/dts/armada-xp-openblocks-ax3-4-bb.dts
@@ -12,10 +12,6 @@
};
soc {
- ranges = <MBUS_ID(0xf0, 0x01) 0 0 0xf1000000 0x100000
- MBUS_ID(0x01, 0x1d) 0 0 0xfff00000 0x100000
- MBUS_ID(0x01, 0x2f) 0 0 0xf0000000 0x8000000>;
-
internal-regs {
gpio_leds {
red_led {
--
2.0.0
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 5/5] ARM: mvebu: add fixup for directly attached memory
2014-07-23 9:28 [PATCH 0/5] Early DT and MVEBU DT fixups Sebastian Hesselbarth
` (3 preceding siblings ...)
2014-07-23 9:28 ` [PATCH 4/5] ARM: dts: mvebu: remove mbus ranges overwrite Sebastian Hesselbarth
@ 2014-07-23 9:28 ` Sebastian Hesselbarth
2014-07-25 7:06 ` [PATCH 0/5] Early DT and MVEBU DT fixups Sascha Hauer
5 siblings, 0 replies; 9+ messages in thread
From: Sebastian Hesselbarth @ 2014-07-23 9:28 UTC (permalink / raw)
To: Sebastian Hesselbarth, barebox; +Cc: Thomas Petazzoni
On Marvell MVEBU SoCs memory size is set up by BootROM and can be read
from SoC's RAM controller. With early DT fixups available, set corresponding
DT node to reflect accessible amount of directly attached RAM.
This patch also removes non-DT call to arm_add_mem_device to silence a
warning about request_region conflict due to adding a mem device twice.
Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
---
To: barebox@lists.infradead.org
To: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Cc: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
---
arch/arm/mach-mvebu/armada-370-xp.c | 2 +-
arch/arm/mach-mvebu/common.c | 59 +++++++++++++++++++++++++++++++
arch/arm/mach-mvebu/dove.c | 2 +-
arch/arm/mach-mvebu/include/mach/common.h | 2 ++
arch/arm/mach-mvebu/kirkwood.c | 2 +-
5 files changed, 64 insertions(+), 3 deletions(-)
diff --git a/arch/arm/mach-mvebu/armada-370-xp.c b/arch/arm/mach-mvebu/armada-370-xp.c
index f5ff9640b770..666ae077f6e6 100644
--- a/arch/arm/mach-mvebu/armada-370-xp.c
+++ b/arch/arm/mach-mvebu/armada-370-xp.c
@@ -52,8 +52,8 @@ static int armada_370_xp_init_soc(void)
barebox_set_hostname("armada");
armada_370_xp_memory_find(&phys_base, &phys_size);
- arm_add_mem_device("ram0", phys_base, phys_size);
+ mvebu_set_memory(phys_base, phys_size);
mvebu_mbus_add_range(0xf0, 0x01, MVEBU_REMAP_INT_REG_BASE);
return 0;
diff --git a/arch/arm/mach-mvebu/common.c b/arch/arm/mach-mvebu/common.c
index b054bf5aff48..ac4b332e0180 100644
--- a/arch/arm/mach-mvebu/common.c
+++ b/arch/arm/mach-mvebu/common.c
@@ -79,3 +79,62 @@ static int mvebu_soc_id_init(void)
return 0;
}
postcore_initcall(mvebu_soc_id_init);
+
+static u64 mvebu_mem[2];
+
+void mvebu_set_memory(u64 phys_base, u64 phys_size)
+{
+ mvebu_mem[0] = phys_base;
+ mvebu_mem[1] = phys_size;
+}
+
+/*
+ * Memory size is set up by BootROM and can be read from SoC's ram controller
+ * registers. Fixup provided DTs to reflect accessible amount of directly
+ * attached RAM. Removable RAM, e.g. SODIMM, should be added by a per-board
+ * fixup.
+ */
+static int mvebu_memory_of_fixup(struct device_node *root, void *context)
+{
+ struct device_node *np;
+ __be32 reg[4];
+ int na, ns;
+
+ /* bail out on zero-sized mem */
+ if (!mvebu_mem[1])
+ return -ENODEV;
+
+ np = of_find_node_by_path("/memory");
+ if (!np)
+ np = of_create_node(root, "/memory");
+ if (!np)
+ return -EINVAL;
+
+ na = of_n_addr_cells(np);
+ ns = of_n_size_cells(np);
+
+ if (na == 2) {
+ reg[0] = cpu_to_be32(mvebu_mem[0] >> 32);
+ reg[1] = cpu_to_be32(mvebu_mem[0] & 0xffffffff);
+ } else {
+ reg[0] = cpu_to_be32(mvebu_mem[0] & 0xffffffff);
+ }
+
+ if (ns == 2) {
+ reg[2] = cpu_to_be32(mvebu_mem[1] >> 32);
+ reg[3] = cpu_to_be32(mvebu_mem[1] & 0xffffffff);
+ } else {
+ reg[1] = cpu_to_be32(mvebu_mem[1] & 0xffffffff);
+ }
+
+ if (of_set_property(np, "device_type", "memory", sizeof("memory"), 1) ||
+ of_set_property(np, "reg", reg, sizeof(u32) * (na + ns), 1))
+ pr_err("Unable to fixup memory node\n");
+
+ return 0;
+}
+
+static int mvebu_memory_fixup_register(void) {
+ return of_register_fixup(mvebu_memory_of_fixup, NULL);
+}
+pure_initcall(mvebu_memory_fixup_register);
diff --git a/arch/arm/mach-mvebu/dove.c b/arch/arm/mach-mvebu/dove.c
index 974f48074150..69c6436b2491 100644
--- a/arch/arm/mach-mvebu/dove.c
+++ b/arch/arm/mach-mvebu/dove.c
@@ -77,8 +77,8 @@ static int dove_init_soc(void)
dove_remap_mc_regs();
dove_memory_find(&phys_base, &phys_size);
- arm_add_mem_device("ram0", 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);
diff --git a/arch/arm/mach-mvebu/include/mach/common.h b/arch/arm/mach-mvebu/include/mach/common.h
index 3cc1bf71c0f7..9f6118e4ec84 100644
--- a/arch/arm/mach-mvebu/include/mach/common.h
+++ b/arch/arm/mach-mvebu/include/mach/common.h
@@ -20,4 +20,6 @@
#define MVEBU_REMAP_INT_REG_BASE 0xf1000000
+void mvebu_set_memory(u64 phys_base, u64 phys_size);
+
#endif
diff --git a/arch/arm/mach-mvebu/kirkwood.c b/arch/arm/mach-mvebu/kirkwood.c
index 2249b9bfc64b..c114bdb36006 100644
--- a/arch/arm/mach-mvebu/kirkwood.c
+++ b/arch/arm/mach-mvebu/kirkwood.c
@@ -51,8 +51,8 @@ static int kirkwood_init_soc(void)
barebox_set_hostname("kirkwood");
kirkwood_memory_find(&phys_base, &phys_size);
- arm_add_mem_device("ram0", phys_base, phys_size);
+ mvebu_set_memory(phys_base, phys_size);
mvebu_mbus_add_range(0xf0, 0x01, MVEBU_REMAP_INT_REG_BASE);
return 0;
--
2.0.0
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 0/5] Early DT and MVEBU DT fixups
2014-07-23 9:28 [PATCH 0/5] Early DT and MVEBU DT fixups Sebastian Hesselbarth
` (4 preceding siblings ...)
2014-07-23 9:28 ` [PATCH 5/5] ARM: mvebu: add fixup for directly attached memory Sebastian Hesselbarth
@ 2014-07-25 7:06 ` Sascha Hauer
2014-07-25 7:24 ` Sebastian Hesselbarth
5 siblings, 1 reply; 9+ messages in thread
From: Sascha Hauer @ 2014-07-25 7:06 UTC (permalink / raw)
To: Sebastian Hesselbarth; +Cc: Thomas Petazzoni, barebox
On Wed, Jul 23, 2014 at 11:28:05AM +0200, Sebastian Hesselbarth wrote:
> Historically, early Armada 370 and XP boards where shipped with u-boot
> not remapping internal register base therefore the upstream dts files
> reflect that. On barebox we always remap the internal register base to
> 0xf1000000 and use DT to parse devices, causing the upstream dts to
> diverge from what we actually see. Currently, we work around the issue
> by applying a barebox specific dts overlay to reflect the different
> internal register base.
>
> This patch set provides a way to call DT fixups early and apply them
> even on pbl or appended DTs. This is required for Marvell MVEBU SoCs
> which can (and do) remap their internal register base address.
>
> First, a call to of_fix_tree() is added to of_arm_init() right before
> of_probe() starts. This allows to apply early registered DT fixups.
>
> Patch 2 extends mvebu-mbus to fixup mbus ranges identified by their
> target ID and target attribute. Patch 3 adds the required internal
> register ranges to be fixed up for each of the 4 supported MVEBU SoCs.
> Patch 4 then removes the now redundant DT overlay workarounds.
>
> Patch 5 finally installs another DT fixup to properly set directly
> attached RAM sizes which can read from internal SoC registers. This
> also removes a runtime warning caused by double-registration of RAM
> resources from arm_add_memory_device() and of_add_memory() later.
>
> Patches have been tested on Armada 370, Dove, and Kirkwood.
>
> Sebastian Hesselbarth (5):
> ARM: execute OF fixups early
> ARM: mvebu: allow to fixup mbus ranges
> ARM: mvebu: add register remap for mbus ids
> ARM: dts: mvebu: remove mbus ranges overwrite
> ARM: mvebu: add fixup for directly attached memory
I had to think about executing the fixups early a bit. This used
to fixup the device tree for Linux, now it's used to fixup the
tree for barebox aswell. I hope this does not have unwanted side
effects.
Anyway, it solves your remapping problem nicely, so:
Applied, thanks
Sascha
>
> arch/arm/cpu/dtb.c | 1 +
> arch/arm/dts/armada-370-mirabox-bb.dts | 3 --
> arch/arm/dts/armada-xp-openblocks-ax3-4-bb.dts | 4 --
> arch/arm/mach-mvebu/armada-370-xp.c | 5 +-
> arch/arm/mach-mvebu/common.c | 59 ++++++++++++++++++++
> arch/arm/mach-mvebu/dove.c | 6 ++-
> arch/arm/mach-mvebu/include/mach/common.h | 2 +
> arch/arm/mach-mvebu/kirkwood.c | 5 +-
> drivers/bus/mvebu-mbus.c | 74 +++++++++++++++++++++++++-
> include/linux/mbus.h | 2 +
> 10 files changed, 150 insertions(+), 11 deletions(-)
>
> ---
> To: barebox@lists.infradead.org
> To: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
> Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
> Cc: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
> --
> 2.0.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] 9+ messages in thread
* Re: [PATCH 0/5] Early DT and MVEBU DT fixups
2014-07-25 7:06 ` [PATCH 0/5] Early DT and MVEBU DT fixups Sascha Hauer
@ 2014-07-25 7:24 ` Sebastian Hesselbarth
0 siblings, 0 replies; 9+ messages in thread
From: Sebastian Hesselbarth @ 2014-07-25 7:24 UTC (permalink / raw)
To: Sascha Hauer; +Cc: Thomas Petazzoni, barebox
On 07/25/2014 09:06 AM, Sascha Hauer wrote:
> On Wed, Jul 23, 2014 at 11:28:05AM +0200, Sebastian Hesselbarth wrote:
>> Historically, early Armada 370 and XP boards where shipped with u-boot
>> not remapping internal register base therefore the upstream dts files
>> reflect that. On barebox we always remap the internal register base to
>> 0xf1000000 and use DT to parse devices, causing the upstream dts to
>> diverge from what we actually see. Currently, we work around the issue
>> by applying a barebox specific dts overlay to reflect the different
>> internal register base.
>>
>> This patch set provides a way to call DT fixups early and apply them
>> even on pbl or appended DTs. This is required for Marvell MVEBU SoCs
>> which can (and do) remap their internal register base address.
>>
>> First, a call to of_fix_tree() is added to of_arm_init() right before
>> of_probe() starts. This allows to apply early registered DT fixups.
>>
>> Patch 2 extends mvebu-mbus to fixup mbus ranges identified by their
>> target ID and target attribute. Patch 3 adds the required internal
>> register ranges to be fixed up for each of the 4 supported MVEBU SoCs.
>> Patch 4 then removes the now redundant DT overlay workarounds.
>>
>> Patch 5 finally installs another DT fixup to properly set directly
>> attached RAM sizes which can read from internal SoC registers. This
>> also removes a runtime warning caused by double-registration of RAM
>> resources from arm_add_memory_device() and of_add_memory() later.
>>
>> Patches have been tested on Armada 370, Dove, and Kirkwood.
>>
>> Sebastian Hesselbarth (5):
>> ARM: execute OF fixups early
>> ARM: mvebu: allow to fixup mbus ranges
>> ARM: mvebu: add register remap for mbus ids
>> ARM: dts: mvebu: remove mbus ranges overwrite
>> ARM: mvebu: add fixup for directly attached memory
>
> I had to think about executing the fixups early a bit. This used
> to fixup the device tree for Linux, now it's used to fixup the
> tree for barebox aswell. I hope this does not have unwanted side
> effects.
> Anyway, it solves your remapping problem nicely, so:
>
> Applied, thanks
It should cause no harm to other boards that set up fixup later,
you'll have to register the fixup in pure_initcall to make it
modify the early dtb.
Thanks for applying!
Sebastian
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 4/5] ARM: dts: mvebu: remove mbus ranges overwrite
2014-07-23 9:28 ` [PATCH 4/5] ARM: dts: mvebu: remove mbus ranges overwrite Sebastian Hesselbarth
@ 2014-08-02 3:07 ` Ezequiel Garcia
0 siblings, 0 replies; 9+ messages in thread
From: Ezequiel Garcia @ 2014-08-02 3:07 UTC (permalink / raw)
To: Sebastian Hesselbarth; +Cc: Thomas Petazzoni, barebox
Sebastian,
While testing the mvneta I found that Openblocks AX3-4 is broken
on next: barebox just silently hangs.
Here's my config: http://sprunge.us/OiVM. Maybe there is something
wrong in the config?
On 23 Jul 11:28 AM, Sebastian Hesselbarth wrote:
> With proper DT fixup in place, we can now remove the overwrite of
> mbus ranges in Armada 370 Mirabox and Armada XP Openblocks AX3.
>
Reverting this commit (c148e367a5) seems to solve the problem, so I'll
review this whole series tonight and see if I can spot anything.
I'll test Mirabox tomorrow.
--
Ezequiel García, Free Electrons
Embedded Linux, Kernel and Android Engineering
http://free-electrons.com
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2014-08-02 3:09 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-07-23 9:28 [PATCH 0/5] Early DT and MVEBU DT fixups Sebastian Hesselbarth
2014-07-23 9:28 ` [PATCH 1/5] ARM: execute OF fixups early Sebastian Hesselbarth
2014-07-23 9:28 ` [PATCH 2/5] ARM: mvebu: allow to fixup mbus ranges Sebastian Hesselbarth
2014-07-23 9:28 ` [PATCH 3/5] ARM: mvebu: add register remap for mbus ids Sebastian Hesselbarth
2014-07-23 9:28 ` [PATCH 4/5] ARM: dts: mvebu: remove mbus ranges overwrite Sebastian Hesselbarth
2014-08-02 3:07 ` Ezequiel Garcia
2014-07-23 9:28 ` [PATCH 5/5] ARM: mvebu: add fixup for directly attached memory Sebastian Hesselbarth
2014-07-25 7:06 ` [PATCH 0/5] Early DT and MVEBU DT fixups Sascha Hauer
2014-07-25 7:24 ` Sebastian Hesselbarth
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox