All of lore.kernel.org
 help / color / mirror / Atom feed
From: Linus Walleij <linus.walleij@linaro.org>
To: linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org,
	linux-leds@vger.kernel.org, linux-pm@vger.kernel.org
Cc: Arnd Bergmann <arnd@arndb.de>, Pawel Moll <pawel.moll@arm.com>,
	Mark Rutland <mark.rutland@arm.com>,
	Marc Zyngier <marc.zyngier@arm.com>,
	Will Deacon <will.deacon@arm.com>, Rob Herring <robh@kernel.org>,
	Linus Walleij <linus.walleij@linaro.org>,
	Florian Fainelli <f.fainelli@gmail.com>
Subject: [PATCH 7/8] ARM: l2x0: support associativity from DT
Date: Tue,  2 Sep 2014 14:02:33 +0200	[thread overview]
Message-ID: <1409659354-23553-8-git-send-email-linus.walleij@linaro.org> (raw)
In-Reply-To: <1409659354-23553-1-git-send-email-linus.walleij@linaro.org>

The ARM RealView platforms comes with boot loaders that fail
to set up cache size, ways and associativity correctly. This
complements Florian's patch to set up cache size and sets from
the device tree with the possibility to set up associativity
on the L2C-220 cache variant.

Cc: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
 Documentation/devicetree/bindings/arm/l2cc.txt |  1 +
 arch/arm/mm/cache-l2x0.c                       | 11 +++++++++++
 2 files changed, 12 insertions(+)

diff --git a/Documentation/devicetree/bindings/arm/l2cc.txt b/Documentation/devicetree/bindings/arm/l2cc.txt
index d33ed2344c7e..94b02f704f1d 100644
--- a/Documentation/devicetree/bindings/arm/l2cc.txt
+++ b/Documentation/devicetree/bindings/arm/l2cc.txt
@@ -44,6 +44,7 @@ Optional properties:
   I/O coherent mode. Valid only when the arm,pl310-cache compatible
   string is used.
 - interrupts : 1 combined interrupt.
+- cache-associativity : specifies the associativity of the cache
 - cache-size : specifies the size in bytes of the cache
 - cache-sets : specifies the number of associativity sets of the cache
 - cache-id-part: cache id part number to be used if it is not present
diff --git a/arch/arm/mm/cache-l2x0.c b/arch/arm/mm/cache-l2x0.c
index c735f792c3d5..ebed9638b96c 100644
--- a/arch/arm/mm/cache-l2x0.c
+++ b/arch/arm/mm/cache-l2x0.c
@@ -1007,6 +1007,7 @@ static void __init l2x0_of_parse(const struct device_node *np,
 	u32 tag = 0;
 	u32 dirty = 0;
 	u32 val = 0, mask = 0;
+	u32 assoc = 0;
 
 	of_property_read_u32(np, "arm,tag-latency", &tag);
 	if (tag) {
@@ -1029,6 +1030,16 @@ static void __init l2x0_of_parse(const struct device_node *np,
 		val |= (dirty - 1) << L2X0_AUX_CTRL_DIRTY_LATENCY_SHIFT;
 	}
 
+	of_property_read_u32(np, "cache-associativity", &assoc);
+	if (assoc) {
+		if (assoc > 8) {
+			pr_warn("L2C: associativity %d is too large\n", assoc);
+		} else {
+			mask |= L2X0_AUX_CTRL_ASSOC_MASK;
+			val |= (assoc << L2X0_AUX_CTRL_ASSOC_SHIFT);
+		}
+	}
+
 	l2x0_cache_size_of_parse(np, aux_val, aux_mask, SZ_256K);
 
 	*aux_val &= ~mask;
-- 
1.9.3

WARNING: multiple messages have this Message-ID (diff)
From: linus.walleij@linaro.org (Linus Walleij)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 7/8] ARM: l2x0: support associativity from DT
Date: Tue,  2 Sep 2014 14:02:33 +0200	[thread overview]
Message-ID: <1409659354-23553-8-git-send-email-linus.walleij@linaro.org> (raw)
In-Reply-To: <1409659354-23553-1-git-send-email-linus.walleij@linaro.org>

The ARM RealView platforms comes with boot loaders that fail
to set up cache size, ways and associativity correctly. This
complements Florian's patch to set up cache size and sets from
the device tree with the possibility to set up associativity
on the L2C-220 cache variant.

Cc: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
 Documentation/devicetree/bindings/arm/l2cc.txt |  1 +
 arch/arm/mm/cache-l2x0.c                       | 11 +++++++++++
 2 files changed, 12 insertions(+)

diff --git a/Documentation/devicetree/bindings/arm/l2cc.txt b/Documentation/devicetree/bindings/arm/l2cc.txt
index d33ed2344c7e..94b02f704f1d 100644
--- a/Documentation/devicetree/bindings/arm/l2cc.txt
+++ b/Documentation/devicetree/bindings/arm/l2cc.txt
@@ -44,6 +44,7 @@ Optional properties:
   I/O coherent mode. Valid only when the arm,pl310-cache compatible
   string is used.
 - interrupts : 1 combined interrupt.
+- cache-associativity : specifies the associativity of the cache
 - cache-size : specifies the size in bytes of the cache
 - cache-sets : specifies the number of associativity sets of the cache
 - cache-id-part: cache id part number to be used if it is not present
diff --git a/arch/arm/mm/cache-l2x0.c b/arch/arm/mm/cache-l2x0.c
index c735f792c3d5..ebed9638b96c 100644
--- a/arch/arm/mm/cache-l2x0.c
+++ b/arch/arm/mm/cache-l2x0.c
@@ -1007,6 +1007,7 @@ static void __init l2x0_of_parse(const struct device_node *np,
 	u32 tag = 0;
 	u32 dirty = 0;
 	u32 val = 0, mask = 0;
+	u32 assoc = 0;
 
 	of_property_read_u32(np, "arm,tag-latency", &tag);
 	if (tag) {
@@ -1029,6 +1030,16 @@ static void __init l2x0_of_parse(const struct device_node *np,
 		val |= (dirty - 1) << L2X0_AUX_CTRL_DIRTY_LATENCY_SHIFT;
 	}
 
+	of_property_read_u32(np, "cache-associativity", &assoc);
+	if (assoc) {
+		if (assoc > 8) {
+			pr_warn("L2C: associativity %d is too large\n", assoc);
+		} else {
+			mask |= L2X0_AUX_CTRL_ASSOC_MASK;
+			val |= (assoc << L2X0_AUX_CTRL_ASSOC_SHIFT);
+		}
+	}
+
 	l2x0_cache_size_of_parse(np, aux_val, aux_mask, SZ_256K);
 
 	*aux_val &= ~mask;
-- 
1.9.3

  parent reply	other threads:[~2014-09-02 12:03 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-02 12:02 [PATCH 0/8] ARM RealView DeviceTree support v5 Linus Walleij
2014-09-02 12:02 ` Linus Walleij
2014-09-02 12:02 ` [PATCH 1/8 v2] leds: add a driver for syscon-based LEDs Linus Walleij
2014-09-02 12:02   ` Linus Walleij
2014-09-02 12:02 ` [PATCH 2/8 v2] leds: add device tree bindings for register bit LEDs Linus Walleij
2014-09-02 12:02   ` Linus Walleij
2014-09-02 12:24   ` Arnd Bergmann
2014-09-02 12:24     ` Arnd Bergmann
2014-09-08 11:25     ` Linus Walleij
2014-09-08 11:25       ` Linus Walleij
2014-09-02 14:22   ` Geert Uytterhoeven
2014-09-02 14:22     ` Geert Uytterhoeven
2014-09-08 11:14     ` Linus Walleij
2014-09-08 11:14       ` Linus Walleij
2014-09-02 12:02 ` [PATCH 3/8 v2] power: reset: driver for the Versatile syscon reboot Linus Walleij
2014-09-02 12:02   ` Linus Walleij
2014-09-02 12:32   ` Arnd Bergmann
2014-09-02 12:32     ` Arnd Bergmann
2014-09-02 12:02 ` [PATCH 4/8] soc: add driver for the ARM RealView Linus Walleij
2014-09-02 12:02   ` Linus Walleij
2014-09-02 12:02 ` [PATCH 5/8] ARM: l2x0: move DT parsing for cache props Linus Walleij
2014-09-02 12:02   ` Linus Walleij
2014-09-02 12:43   ` Russell King - ARM Linux
2014-09-02 12:43     ` Russell King - ARM Linux
2014-09-05 11:10     ` Linus Walleij
2014-09-05 11:10       ` Linus Walleij
2014-09-02 12:02 ` [PATCH 6/8] ARM: l2c: parse 'cache-size' and 'cache-sets' properties Linus Walleij
2014-09-02 12:02   ` Linus Walleij
2014-09-02 12:02 ` Linus Walleij [this message]
2014-09-02 12:02   ` [PATCH 7/8] ARM: l2x0: support associativity from DT Linus Walleij
2014-09-02 13:17   ` Russell King - ARM Linux
2014-09-02 13:17     ` Russell King - ARM Linux
2014-09-02 12:02 ` [PATCH 8/8 v5] ARM: realview: basic device tree implementation Linus Walleij
2014-09-02 12:02   ` Linus Walleij
2014-09-02 12:37   ` Arnd Bergmann
2014-09-02 12:37     ` Arnd Bergmann

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=1409659354-23553-8-git-send-email-linus.walleij@linaro.org \
    --to=linus.walleij@linaro.org \
    --cc=arnd@arndb.de \
    --cc=devicetree@vger.kernel.org \
    --cc=f.fainelli@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-leds@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=marc.zyngier@arm.com \
    --cc=mark.rutland@arm.com \
    --cc=pawel.moll@arm.com \
    --cc=robh@kernel.org \
    --cc=will.deacon@arm.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.