aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-mvebu
diff options
context:
space:
mode:
authorThomas Petazzoni <thomas.petazzoni@free-electrons.com>2013-06-05 03:04:59 -0400
committerJason Cooper <jason@lakedaemon.net>2013-06-13 13:48:46 -0400
commitd834d26ae250783a24abaac3e906a6e563a7018f (patch)
tree831e7fa96ec758e9baa527520eae03a5a3232b4b /arch/arm/mach-mvebu
parent580ff0eea15c341d17d564f7e5c519df37033d8e (diff)
arm: mvebu: don't hardcode the physical address for mvebu-mbus
Since the mvebu-mbus driver doesn't yet have a DT binding (and this DT binding may not necessarily be ready for 3.11), the physical address of the mvebu-mbus registers are currently hardcoded. This doesn't play well with the fact that the internal registers base address may be different depending on the bootloader. In order to have only one central place for the physical address of the internal registers, we now use of_translate_address() to translate the mvebu-mbus register offsets into the real physical address, by using DT-based address translation. This will go away once the mvebu-mbus driver gains a proper DT binding. Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> Acked-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Jason Cooper <jason@lakedaemon.net>
Diffstat (limited to 'arch/arm/mach-mvebu')
-rw-r--r--arch/arm/mach-mvebu/armada-370-xp.c38
-rw-r--r--arch/arm/mach-mvebu/armada-370-xp.h8
2 files changed, 27 insertions, 19 deletions
diff --git a/arch/arm/mach-mvebu/armada-370-xp.c b/arch/arm/mach-mvebu/armada-370-xp.c
index c1c0556fd250..0dbc370f9e35 100644
--- a/arch/arm/mach-mvebu/armada-370-xp.c
+++ b/arch/arm/mach-mvebu/armada-370-xp.c
@@ -14,6 +14,7 @@
14 14
15#include <linux/kernel.h> 15#include <linux/kernel.h>
16#include <linux/init.h> 16#include <linux/init.h>
17#include <linux/of_address.h>
17#include <linux/of_platform.h> 18#include <linux/of_platform.h>
18#include <linux/io.h> 19#include <linux/io.h>
19#include <linux/time-armada-370-xp.h> 20#include <linux/time-armada-370-xp.h>
@@ -33,29 +34,44 @@ static void __init armada_370_xp_map_io(void)
33 debug_ll_io_init(); 34 debug_ll_io_init();
34} 35}
35 36
36static void __init armada_370_xp_timer_and_clk_init(void) 37/*
38 * This initialization will be replaced by a DT-based
39 * initialization once the mvebu-mbus driver gains DT support.
40 */
41
42#define ARMADA_370_XP_MBUS_WINS_OFFS 0x20000
43#define ARMADA_370_XP_MBUS_WINS_SIZE 0x100
44#define ARMADA_370_XP_SDRAM_WINS_OFFS 0x20180
45#define ARMADA_370_XP_SDRAM_WINS_SIZE 0x20
46
47static void __init armada_370_xp_mbus_init(void)
37{ 48{
38 char *mbus_soc_name; 49 char *mbus_soc_name;
50 struct device_node *dn;
51 const __be32 mbus_wins_offs = cpu_to_be32(ARMADA_370_XP_MBUS_WINS_OFFS);
52 const __be32 sdram_wins_offs = cpu_to_be32(ARMADA_370_XP_SDRAM_WINS_OFFS);
39 53
40 mvebu_clocks_init();
41 armada_370_xp_timer_init();
42 coherency_init();
43
44 /*
45 * This initialization will be replaced by a DT-based
46 * initialization once the mvebu-mbus driver gains DT support.
47 */
48 if (of_machine_is_compatible("marvell,armada370")) 54 if (of_machine_is_compatible("marvell,armada370"))
49 mbus_soc_name = "marvell,armada370-mbus"; 55 mbus_soc_name = "marvell,armada370-mbus";
50 else 56 else
51 mbus_soc_name = "marvell,armadaxp-mbus"; 57 mbus_soc_name = "marvell,armadaxp-mbus";
52 58
59 dn = of_find_node_by_name(NULL, "internal-regs");
60 BUG_ON(!dn);
61
53 mvebu_mbus_init(mbus_soc_name, 62 mvebu_mbus_init(mbus_soc_name,
54 ARMADA_370_XP_MBUS_WINS_BASE, 63 of_translate_address(dn, &mbus_wins_offs),
55 ARMADA_370_XP_MBUS_WINS_SIZE, 64 ARMADA_370_XP_MBUS_WINS_SIZE,
56 ARMADA_370_XP_SDRAM_WINS_BASE, 65 of_translate_address(dn, &sdram_wins_offs),
57 ARMADA_370_XP_SDRAM_WINS_SIZE); 66 ARMADA_370_XP_SDRAM_WINS_SIZE);
67}
58 68
69static void __init armada_370_xp_timer_and_clk_init(void)
70{
71 mvebu_clocks_init();
72 armada_370_xp_timer_init();
73 coherency_init();
74 armada_370_xp_mbus_init();
59#ifdef CONFIG_CACHE_L2X0 75#ifdef CONFIG_CACHE_L2X0
60 l2x0_of_init(0, ~0UL); 76 l2x0_of_init(0, ~0UL);
61#endif 77#endif
diff --git a/arch/arm/mach-mvebu/armada-370-xp.h b/arch/arm/mach-mvebu/armada-370-xp.h
index 585e14710c8b..c612b2c4ed6c 100644
--- a/arch/arm/mach-mvebu/armada-370-xp.h
+++ b/arch/arm/mach-mvebu/armada-370-xp.h
@@ -15,14 +15,6 @@
15#ifndef __MACH_ARMADA_370_XP_H 15#ifndef __MACH_ARMADA_370_XP_H
16#define __MACH_ARMADA_370_XP_H 16#define __MACH_ARMADA_370_XP_H
17 17
18#define ARMADA_370_XP_REGS_PHYS_BASE 0xd0000000
19
20/* These defines can go away once mvebu-mbus has a DT binding */
21#define ARMADA_370_XP_MBUS_WINS_BASE (ARMADA_370_XP_REGS_PHYS_BASE + 0x20000)
22#define ARMADA_370_XP_MBUS_WINS_SIZE 0x100
23#define ARMADA_370_XP_SDRAM_WINS_BASE (ARMADA_370_XP_REGS_PHYS_BASE + 0x20180)
24#define ARMADA_370_XP_SDRAM_WINS_SIZE 0x20
25
26#ifdef CONFIG_SMP 18#ifdef CONFIG_SMP
27#include <linux/cpumask.h> 19#include <linux/cpumask.h>
28 20