Skip to content

Commit

Permalink
ARM: mvebu: add a coherency_available() call
Browse files Browse the repository at this point in the history
This commit extends the coherency fabric code to provide a
coherency_available()function that the SoC code can call to be told
whether coherency support is available or not. On Armada 370/XP,
coherency support is available as soon as the relevant DT node is
present. On some upcoming SoCs, the DT node needs to be present *and*
the system running with CONFIG_SMP enabled.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Link: https://lkml.kernel.org/r/1397483228-25625-3-git-send-email-thomas.petazzoni@free-electrons.com
Signed-off-by: Jason Cooper <jason@lakedaemon.net>
  • Loading branch information
Thomas Petazzoni authored and Jason Cooper committed Apr 24, 2014
1 parent 924d38f commit 501f928
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 8 deletions.
30 changes: 22 additions & 8 deletions arch/arm/mach-mvebu/coherency.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};

Expand Down Expand Up @@ -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;

Expand All @@ -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;
}

Expand Down
1 change: 1 addition & 0 deletions arch/arm/mach-mvebu/coherency.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */

0 comments on commit 501f928

Please sign in to comment.