From: srinidhi.kasagar@stericsson.com (srinidhi kasagar)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] ARM l2x0: check whether l2x0 already enabled
Date: Tue, 24 Nov 2009 03:47:43 +0530 [thread overview]
Message-ID: <1259014663.2742.3.camel@vinay-desktop> (raw)
From: srinidhi kasagar <srinidhi.kasagar@stericsson.com>
Date: Tue, 24 Nov 2009 13:59:20 +0530
If running in non-secure mode, accessing
control and auxiliary registers of l2x0
will fault.
Signed-off-by: srinidhi kasagar <srinidhi.kasagar@stericsson.com>
---
arch/arm/mm/cache-l2x0.c | 24 +++++++++++++++---------
1 files changed, 15 insertions(+), 9 deletions(-)
diff --git a/arch/arm/mm/cache-l2x0.c b/arch/arm/mm/cache-l2x0.c
index b480f1d..7c0d056 100644
--- a/arch/arm/mm/cache-l2x0.c
+++ b/arch/arm/mm/cache-l2x0.c
@@ -99,18 +99,24 @@ void __init l2x0_init(void __iomem *base, __u32 aux_val, __u32 aux_mask)
l2x0_base = base;
- /* disable L2X0 */
- writel(0, l2x0_base + L2X0_CTRL);
+ /* check if l2x0 controller is already enabled.
+ * if you are booting from non-secure mode
+ * accessing the below registers will fault.
+ */
+ if (!(readl(l2x0_base + L2X0_CTRL) & 1)) {
- aux = readl(l2x0_base + L2X0_AUX_CTRL);
- aux &= aux_mask;
- aux |= aux_val;
- writel(aux, l2x0_base + L2X0_AUX_CTRL);
+ /* L2x0 controller is disabled */
- l2x0_inv_all();
+ aux = readl(l2x0_base + L2X0_AUX_CTRL);
+ aux &= aux_mask;
+ aux |= aux_val;
+ writel(aux, l2x0_base + L2X0_AUX_CTRL);
- /* enable L2X0 */
- writel(1, l2x0_base + L2X0_CTRL);
+ l2x0_inv_all();
+
+ /* enable L2X0 */
+ writel(1, l2x0_base + L2X0_CTRL);
+ }
outer_cache.inv_range = l2x0_inv_range;
outer_cache.clean_range = l2x0_clean_range;
--
1.6.3.GIT
next reply other threads:[~2009-11-23 22:17 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-11-23 22:17 srinidhi kasagar [this message]
2009-11-24 12:11 ` [PATCH] ARM l2x0: check whether l2x0 already enabled Surinder P Singh
2009-11-24 0:35 ` srinidhi kasagar
2009-11-24 13:35 ` Surinder P Singh
2009-11-24 13:55 ` Catalin Marinas
2009-11-25 19:10 ` srinidhi kasagar
2009-11-26 7:34 ` Surinder P Singh
2009-12-01 18:35 ` Catalin Marinas
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=1259014663.2742.3.camel@vinay-desktop \
--to=srinidhi.kasagar@stericsson.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).