Commit 865e0527 authored by Thomas Petazzoni's avatar Thomas Petazzoni Committed by Jason Cooper

arm: mvebu: avoid hardcoded virtual address in coherency code

Now that the coherency_get_cpu_count() function no longer requires a
very early mapping of the coherency unit registers, we can avoid the
hardcoded virtual address in coherency.c. However, the coherency
features are still used quite early, so we need to do the of_iomap()
early enough, at the ->init_timer() level, so we have the call of
coherency_init() at this point.

Unfortunately, at ->init_timer() time, it is not possible to register
a bus notifier, so we add a separate coherency_late_init() function
that gets called as as postcore_initcall(), when bus notifiers are
available.
Signed-off-by: default avatarThomas Petazzoni <thomas.petazzoni@free-electrons.com>
Acked-by: default avatarArnd Bergmann <arnd@arndb.de>
Signed-off-by: default avatarJason Cooper <jason@lakedaemon.net>
parent b21dcafe
...@@ -46,6 +46,7 @@ static void __init armada_370_xp_timer_and_clk_init(void) ...@@ -46,6 +46,7 @@ static void __init armada_370_xp_timer_and_clk_init(void)
{ {
mvebu_clocks_init(); mvebu_clocks_init();
armada_370_xp_timer_init(); armada_370_xp_timer_init();
coherency_init();
} }
static void __init armada_370_xp_init_early(void) static void __init armada_370_xp_init_early(void)
...@@ -75,7 +76,6 @@ static void __init armada_370_xp_init_early(void) ...@@ -75,7 +76,6 @@ static void __init armada_370_xp_init_early(void)
static void __init armada_370_xp_dt_init(void) static void __init armada_370_xp_dt_init(void)
{ {
of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
coherency_init();
} }
static const char * const armada_370_xp_dt_compat[] = { static const char * const armada_370_xp_dt_compat[] = {
......
...@@ -27,14 +27,7 @@ ...@@ -27,14 +27,7 @@
#include <asm/smp_plat.h> #include <asm/smp_plat.h>
#include "armada-370-xp.h" #include "armada-370-xp.h"
/* static void __iomem *coherency_base;
* Some functions in this file are called very early during SMP
* initialization. At that time the device tree framework is not yet
* ready, and it is not possible to get the register address to
* ioremap it. That's why the pointer below is given with an initial
* value matching its virtual mapping
*/
static void __iomem *coherency_base = ARMADA_370_XP_REGS_VIRT_BASE + 0x20200;
static void __iomem *coherency_cpu_base; static void __iomem *coherency_cpu_base;
/* Coherency fabric registers */ /* Coherency fabric registers */
...@@ -135,9 +128,16 @@ int __init coherency_init(void) ...@@ -135,9 +128,16 @@ int __init coherency_init(void)
coherency_base = of_iomap(np, 0); coherency_base = of_iomap(np, 0);
coherency_cpu_base = of_iomap(np, 1); coherency_cpu_base = of_iomap(np, 1);
set_cpu_coherent(cpu_logical_map(smp_processor_id()), 0); set_cpu_coherent(cpu_logical_map(smp_processor_id()), 0);
bus_register_notifier(&platform_bus_type,
&mvebu_hwcc_platform_nb);
} }
return 0; return 0;
} }
static int __init coherency_late_init(void)
{
bus_register_notifier(&platform_bus_type,
&mvebu_hwcc_platform_nb);
return 0;
}
postcore_initcall(coherency_late_init);
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment