From: jason@lakedaemon.net (Jason Cooper)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH RFCv1 1/6] ARM: mvebu: prepare coherency code to support more SOCs
Date: Fri, 27 Dec 2013 12:57:03 -0500 [thread overview]
Message-ID: <20131227175703.GY19878@titan.lakedaemon.net> (raw)
In-Reply-To: <1388067146-18111-2-git-send-email-thomas.petazzoni@free-electrons.com>
All,
resending to include the MLs.
On Thu, Dec 26, 2013 at 03:12:21PM +0100, Thomas Petazzoni wrote:
> 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:
>
> * Adds a new "marvell,armada-370-coherency-fabric" compatible string,
> to indicate the Armada 370/XP variant of the coherency fabric. The
> existing compatible string "marvel,coherency-fabric" is preserved
> for compatibility reasons, and has the same behavior as
> the new "marvell,armada-370-coherency-fabric".
>
> * 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: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
> ---
> .../devicetree/bindings/arm/coherency-fabric.txt | 12 ++++-
> arch/arm/mach-mvebu/coherency.c | 53 ++++++++++++++++------
> 2 files changed, 49 insertions(+), 16 deletions(-)
>
> diff --git a/Documentation/devicetree/bindings/arm/coherency-fabric.txt b/Documentation/devicetree/bindings/arm/coherency-fabric.txt
> index 17d8cd1..6bd8788 100644
> --- a/Documentation/devicetree/bindings/arm/coherency-fabric.txt
> +++ b/Documentation/devicetree/bindings/arm/coherency-fabric.txt
> @@ -4,7 +4,15 @@ Available on Marvell SOCs: Armada 370 and Armada XP
>
> Required properties:
>
> -- compatible: "marvell,coherency-fabric"
> +- compatible: the possible values are:
> +
> + * "marvell,coherency-fabric", kept for backward compatibility reasons
> + only. To be used for the coherency fabric of the Armada 370 and
> + Armada XP. It is recommended to use
> + "marvell,armada-370-coherency-fabric" instead.
> +
> + * "marvell,armada-370-coherency-fabric", for the Armada 370 and
> + Armada XP coherency fabric.
This is completely unneeded. Once the new SoC is announced, all you
should need is marvell,coherency-fabric (for 370/XP) and
marvell,whizbang-coherency-fabric for the new whizbang SoC.
thx,
Jason.
>
> - reg: Should contain coherency fabric registers location and
> length. First pair for the coherency fabric registers, second pair
> @@ -13,7 +21,7 @@ Required properties:
> Example:
>
> coherency-fabric at d0020200 {
> - compatible = "marvell,coherency-fabric";
> + compatible = "marvell,armada-370-coherency-fabric";
> reg = <0xd0020200 0xb0>,
> <0xd0021810 0x1c>;
>
> diff --git a/arch/arm/mach-mvebu/coherency.c b/arch/arm/mach-mvebu/coherency.c
> index 58adf2f..a8209ae 100644
> --- a/arch/arm/mach-mvebu/coherency.c
> +++ b/arch/arm/mach-mvebu/coherency.c
> @@ -37,8 +37,20 @@ static void __iomem *coherency_cpu_base;
>
> #define IO_SYNC_BARRIER_CTL_OFFSET 0x0
>
> +enum {
> + COHERENCY_FABRIC_TYPE_ARMADA_370_XP,
> +};
> +
> +/*
> + * The "marvell,coherency-fabric" compatible string is kept for
> + * backward compatibility reasons, and is equivalent to
> + * "marvell,armada-370-coherency-fabric".
> + */
> static struct of_device_id of_coherency_table[] = {
> - {.compatible = "marvell,coherency-fabric"},
> + {.compatible = "marvell,coherency-fabric",
> + .data = (void *) COHERENCY_FABRIC_TYPE_ARMADA_370_XP },
> + {.compatible = "marvell,armada-370-coherency-fabric",
> + .data = (void *) COHERENCY_FABRIC_TYPE_ARMADA_370_XP },
> { /* end of list */ },
> };
>
> @@ -120,26 +132,39 @@ static struct notifier_block mvebu_hwcc_platform_nb = {
> .notifier_call = mvebu_hwcc_platform_notifier,
> };
>
> +static void __init armada_370_coherency_init(struct device_node *np)
> +{
> + struct resource res;
> + of_address_to_resource(np, 0, &res);
> + coherency_phys_base = res.start;
> + /*
> + * Ensure secondary CPUs will see the updated value,
> + * which they read before they join the coherency
> + * fabric, and therefore before they are coherent with
> + * the boot CPU cache.
> + */
> + sync_cache_w(&coherency_phys_base);
> + 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) {
> - struct resource res;
> + 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");
> - of_address_to_resource(np, 0, &res);
> - coherency_phys_base = res.start;
> - /*
> - * Ensure secondary CPUs will see the updated value,
> - * which they read before they join the coherency
> - * fabric, and therefore before they are coherent with
> - * the boot CPU cache.
> - */
> - sync_cache_w(&coherency_phys_base);
> - coherency_base = of_iomap(np, 0);
> - coherency_cpu_base = of_iomap(np, 1);
> - set_cpu_coherent(cpu_logical_map(smp_processor_id()), 0);
> +
> + if (type == COHERENCY_FABRIC_TYPE_ARMADA_370_XP)
> + armada_370_coherency_init(np);
> +
> of_node_put(np);
> }
>
> --
> 1.8.3.2
>
next prev parent reply other threads:[~2013-12-27 17:57 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1388067146-18111-1-git-send-email-thomas.petazzoni@free-electrons.com>
[not found] ` <20131226160831.GB19323@lunn.ch>
[not found] ` <20131226171302.3409b096@skate>
[not found] ` <20131226162931.GD19323@lunn.ch>
2013-12-27 17:55 ` [PATCH RFCv1 0/6] ARM: mvebu: coherency support improvements Jason Cooper
[not found] ` <1388067146-18111-2-git-send-email-thomas.petazzoni@free-electrons.com>
2013-12-27 17:57 ` Jason Cooper [this message]
[not found] ` <1388067146-18111-3-git-send-email-thomas.petazzoni@free-electrons.com>
2013-12-27 17:57 ` [PATCH RFCv1 2/6] ARM: mvebu: add a coherency_available() call Jason Cooper
[not found] ` <1388067146-18111-4-git-send-email-thomas.petazzoni@free-electrons.com>
2013-12-27 17:58 ` [PATCH RFCv1 3/6] bus: mvebu: pass the coherency availability information at init time Jason Cooper
[not found] ` <1388067146-18111-6-git-send-email-thomas.petazzoni@free-electrons.com>
2013-12-27 17:59 ` [PATCH RFCv1 5/6] ARM: mvebu: update Armada 370/XP DT to use new coherency compatible string Jason Cooper
2013-12-26 14:12 [PATCH RFCv1 0/6] ARM: mvebu: coherency support improvements Thomas Petazzoni
2013-12-26 14:12 ` [PATCH RFCv1 1/6] ARM: mvebu: prepare coherency code to support more SOCs Thomas Petazzoni
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20131227175703.GY19878@titan.lakedaemon.net \
--to=jason@lakedaemon.net \
--cc=linux-arm-kernel@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox