diff --git a/arch/arm/mach-mvebu/coherency.c b/arch/arm/mach-mvebu/coherency.c index 434cf5f90a80ea5d0d07582c7e7cb5e8d544ef1d..296cf14f08a43665c6e20c5a240bde4f5f028dae 100644 --- a/arch/arm/mach-mvebu/coherency.c +++ b/arch/arm/mach-mvebu/coherency.c @@ -39,6 +39,7 @@ static void __iomem *coherency_cpu_base; #define IO_SYNC_BARRIER_CTL_OFFSET 0x0 enum { + COHERENCY_FABRIC_TYPE_NONE, COHERENCY_FABRIC_TYPE_ARMADA_370_XP, }; @@ -144,7 +145,7 @@ static void __init armada_370_coherency_init(struct device_node *np) set_cpu_coherent(cpu_logical_map(smp_processor_id()), 0); } -int __init coherency_init(void) +static int coherency_type(void) { struct device_node *np; @@ -155,27 +156,40 @@ int __init coherency_init(void) int type; type = (int) match->data; - pr_info("Initializing Coherency fabric\n"); + /* Armada 370/XP coherency works in both UP and SMP */ if (type == COHERENCY_FABRIC_TYPE_ARMADA_370_XP) - armada_370_coherency_init(np); + return type; of_node_put(np); } - return 0; + return COHERENCY_FABRIC_TYPE_NONE; } -static int __init coherency_late_init(void) +int coherency_available(void) { + return coherency_type() != COHERENCY_FABRIC_TYPE_NONE; +} + +int __init coherency_init(void) +{ + int type = coherency_type(); struct device_node *np; np = of_find_matching_node(NULL, of_coherency_table); - if (np) { + + if (type == COHERENCY_FABRIC_TYPE_ARMADA_370_XP) + armada_370_coherency_init(np); + + return 0; +} + +static int __init coherency_late_init(void) +{ + if (coherency_available()) bus_register_notifier(&platform_bus_type, &mvebu_hwcc_platform_nb); - of_node_put(np); - } return 0; } diff --git a/arch/arm/mach-mvebu/coherency.h b/arch/arm/mach-mvebu/coherency.h index 760226c4135309b4ec79ddda47ba9fb18c31a3f4..02f7ec34ced258a6c50d0509237b94040c93153e 100644 --- a/arch/arm/mach-mvebu/coherency.h +++ b/arch/arm/mach-mvebu/coherency.h @@ -18,5 +18,6 @@ extern unsigned long coherency_phys_base; int set_cpu_coherent(unsigned int cpu_id, int smp_group_id); int coherency_init(void); +int coherency_available(void); #endif /* __MACH_370_XP_COHERENCY_H */