summaryrefslogtreecommitdiff
path: root/arch/arm/mach-shmobile/setup-rcar-gen2.c
diff options
context:
space:
mode:
authorGeert Uytterhoeven <geert+renesas@linux-m68k.org>2014-03-12 18:44:49 (GMT)
committerSimon Horman <horms+renesas@verge.net.au>2014-04-14 02:28:42 (GMT)
commit835d737d664650d7f164a5b688271a424db4434c (patch)
treeb52cdc917107e71ae7d8d124c5ea37d70ca49e76 /arch/arm/mach-shmobile/setup-rcar-gen2.c
parentf05b4b52845a18e833644eb3a820a55e3278d2b4 (diff)
downloadlinux-835d737d664650d7f164a5b688271a424db4434c.tar.xz
ARM: shmobile: rcar-gen2: Cache Mode Monitor Register Value
The MD pins are sampled at reset time, hence the read value will always be the same, and we can avoid the overhead of ioremapping the register on every read. Signed-off-by: Geert Uytterhoeven <geert+renesas@linux-m68k.org> Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
Diffstat (limited to 'arch/arm/mach-shmobile/setup-rcar-gen2.c')
-rw-r--r--arch/arm/mach-shmobile/setup-rcar-gen2.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/arch/arm/mach-shmobile/setup-rcar-gen2.c b/arch/arm/mach-shmobile/setup-rcar-gen2.c
index 1060448..542c5a4 100644
--- a/arch/arm/mach-shmobile/setup-rcar-gen2.c
+++ b/arch/arm/mach-shmobile/setup-rcar-gen2.c
@@ -30,12 +30,16 @@
u32 rcar_gen2_read_mode_pins(void)
{
- void __iomem *modemr = ioremap_nocache(MODEMR, 4);
- u32 mode;
-
- BUG_ON(!modemr);
- mode = ioread32(modemr);
- iounmap(modemr);
+ static u32 mode;
+ static bool mode_valid;
+
+ if (!mode_valid) {
+ void __iomem *modemr = ioremap_nocache(MODEMR, 4);
+ BUG_ON(!modemr);
+ mode = ioread32(modemr);
+ iounmap(modemr);
+ mode_valid = true;
+ }
return mode;
}