Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 924d38f4 authored by Thomas Petazzoni's avatar Thomas Petazzoni Committed by Jason Cooper
Browse files

ARM: mvebu: prepare coherency code to support more SOCs



The code that handles the coherency fabric of Armada 370 and Armada XP
in arch/arm/mach-mvebu/coherency.c made the assumption that there was
only one type of coherency fabric. Unfortunately, it turns out that
upcoming SoCs have a slightly different coherency unit.

In preparation to the introduction of the coherency support for more
SoCs, this commit:

 * Introduces a data associated to the compatible string in the
   compatible string match table, so that the code can differantiate
   the variant of coherency unit being used.

 * Separates the coherency unit initialization code into its own
   function.

Signed-off-by: default avatarThomas Petazzoni <thomas.petazzoni@free-electrons.com>
Link: https://lkml.kernel.org/r/1397483228-25625-2-git-send-email-thomas.petazzoni@free-electrons.com


Signed-off-by: default avatarJason Cooper <jason@lakedaemon.net>
parent 56a705a4
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -4,7 +4,10 @@ Available on Marvell SOCs: Armada 370 and Armada XP

Required properties:

- compatible: "marvell,coherency-fabric"
- compatible: the possible values are:

 * "marvell,coherency-fabric", to be used for the coherency fabric of
   the Armada 370 and Armada XP.

- reg: Should contain coherency fabric registers location and
  length. First pair for the coherency fabric registers, second pair
+33 −14
Original line number Diff line number Diff line
@@ -38,8 +38,13 @@ static void __iomem *coherency_cpu_base;

#define IO_SYNC_BARRIER_CTL_OFFSET		   0x0

enum {
	COHERENCY_FABRIC_TYPE_ARMADA_370_XP,
};

static struct of_device_id of_coherency_table[] = {
	{.compatible = "marvell,coherency-fabric"},
	{.compatible = "marvell,coherency-fabric",
	 .data = (void *) COHERENCY_FABRIC_TYPE_ARMADA_370_XP },
	{ /* end of list */ },
};

@@ -121,14 +126,10 @@ static struct notifier_block mvebu_hwcc_platform_nb = {
	.notifier_call = mvebu_hwcc_platform_notifier,
};

int __init coherency_init(void)
static void __init armada_370_coherency_init(struct device_node *np)
{
	struct device_node *np;

	np = of_find_matching_node(NULL, of_coherency_table);
	if (np) {
	struct resource res;
		pr_info("Initializing Coherency fabric\n");

	of_address_to_resource(np, 0, &res);
	coherency_phys_base = res.start;
	/*
@@ -141,6 +142,24 @@ int __init coherency_init(void)
	coherency_base = of_iomap(np, 0);
	coherency_cpu_base = of_iomap(np, 1);
	set_cpu_coherent(cpu_logical_map(smp_processor_id()), 0);
}

int __init coherency_init(void)
{
	struct device_node *np;

	np = of_find_matching_node(NULL, of_coherency_table);
	if (np) {
		const struct of_device_id *match =
			of_match_node(of_coherency_table, np);
		int type;

		type = (int) match->data;
		pr_info("Initializing Coherency fabric\n");

		if (type == COHERENCY_FABRIC_TYPE_ARMADA_370_XP)
			armada_370_coherency_init(np);

		of_node_put(np);
	}