linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: brad.mouring@ni.com (Brad Mouring)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/2] pl2x0: Add OF control of cache power management
Date: Mon, 29 Feb 2016 10:01:55 -0600	[thread overview]
Message-ID: <1456761716-10174-1-git-send-email-brad.mouring@ni.com> (raw)
In-Reply-To: <1456265019-23900-1-git-send-email-brad.mouring@ni.com>

Add ability to override power management bits of 310 controllers
through OF entries. As the saved register is only applied when
working on a supported controller, it is safe to save the settings.

Additionally, to control the actual configuration of the power
control register, remove the unconditional enabling of features in
the l2c310_enable function.

Signed-off-by: Brad Mouring <brad.mouring@ni.com>
Acked-by: Josh Cartwright <joshc@ni.com>
---
 arch/arm/mm/cache-l2x0.c | 29 ++++++++++++++++++++++++-----
 1 file changed, 24 insertions(+), 5 deletions(-)

diff --git a/arch/arm/mm/cache-l2x0.c b/arch/arm/mm/cache-l2x0.c
index 9f9d542..7432dea 100644
--- a/arch/arm/mm/cache-l2x0.c
+++ b/arch/arm/mm/cache-l2x0.c
@@ -647,11 +647,6 @@ static void __init l2c310_enable(void __iomem *base, unsigned num_lock)
 		aux &= ~(L310_AUX_CTRL_FULL_LINE_ZERO | L310_AUX_CTRL_EARLY_BRESP);
 	}
 
-	/* r3p0 or later has power control register */
-	if (rev >= L310_CACHE_ID_RTL_R3P0)
-		l2x0_saved_regs.pwr_ctrl = L310_DYNAMIC_CLK_GATING_EN |
-						L310_STNDBY_MODE_EN;
-
 	/*
 	 * Always enable non-secure access to the lockdown registers -
 	 * we write to them as part of the L2C enable sequence so they
@@ -1141,6 +1136,7 @@ static void __init l2c310_of_parse(const struct device_node *np,
 	u32 filter[2] = { 0, 0 };
 	u32 assoc;
 	u32 prefetch;
+	u32 power;
 	u32 val;
 	int ret;
 
@@ -1271,6 +1267,29 @@ static void __init l2c310_of_parse(const struct device_node *np,
 	}
 
 	l2x0_saved_regs.prefetch_ctrl = prefetch;
+
+	power = l2x0_saved_regs.pwr_ctrl;
+
+	ret = of_property_read_u32(np, "arm,dynamic-clock-gating", &val);
+	if (ret == 0) {
+		if (val)
+			power |= L310_DYNAMIC_CLK_GATING_EN;
+		else
+			power &= ~L310_DYNAMIC_CLK_GATING_EN;
+	} else if (ret != -EINVAL) {
+		pr_err("L2C-310 OF dynamic-clock-gating property value is missing\n");
+	}
+	ret = of_property_read_u32(np, "arm,standby-mode", &val);
+	if (ret == 0) {
+		if (val)
+			power |= L310_STNDBY_MODE_EN;
+		else
+			power &= ~L310_STNDBY_MODE_EN;
+	} else if (ret != -EINVAL) {
+		pr_err("L2C-310 OF standby-mode property value is missing\n");
+	}
+
+	l2x0_saved_regs.pwr_ctrl = power;
 }
 
 static const struct l2c_init_data of_l2c310_data __initconst = {
-- 
2.7.1

  parent reply	other threads:[~2016-02-29 16:01 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-23 22:03 [PATCH 0/2] Control PL310 pwr_ctrl register through DT Brad Mouring
2016-02-23 22:03 ` [PATCH 1/2] pl2x0: Add OF control of cache power management Brad Mouring
2016-02-23 22:03 ` [PATCH 2/2] Documentation: devicetree: Add PL310 PM bindings Brad Mouring
2016-02-24  1:33   ` Rob Herring
2016-02-29 16:01 ` Brad Mouring [this message]
2016-02-29 16:01   ` Brad Mouring
2016-04-18 21:36 ` [PATCH v2 0/2] Control PL310 pwr_ctrl register through DT Brad Mouring
2016-04-18 21:36   ` [PATCH v2 1/2] pl2x0: Add OF control of cache power management Brad Mouring
2016-04-18 21:36   ` [PATCH v2 2/2] Documentation: devicetree: Add PL310 PM bindings Brad Mouring
2016-04-19 21:38     ` Rob Herring
2016-04-19 22:41       ` Russell King - ARM Linux
2016-04-20 14:04         ` Rob Herring
2016-04-21 20:48           ` Brad Mouring
2016-04-27  8:59           ` Russell King - ARM Linux
2016-04-27 12:48             ` Rob Herring
2016-04-27 14:08               ` Brad Mouring
2016-04-27 14:34                 ` Rob Herring
2016-04-28 13:57               ` Russell King - ARM Linux
2016-04-20 14:23       ` Brad Mouring
2016-04-27 15:35   ` [PATCH v3 0/2] Control PL310 pwr_ctrl register through DT Brad Mouring
2016-04-27 15:35     ` [PATCH v3 1/2] arm: pl2x0: Add OF control of cache power management Brad Mouring
2016-04-27 15:35     ` [PATCH 2/2] Documentation: devicetree: Add PL310 PM bindings Brad Mouring
2016-04-28 19:56       ` Rob Herring

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=1456761716-10174-1-git-send-email-brad.mouring@ni.com \
    --to=brad.mouring@ni.com \
    --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;
as well as URLs for NNTP newsgroup(s).