aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-shmobile/setup-rcar-gen2.c
diff options
context:
space:
mode:
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 10604480f325..542c5a47173f 100644
--- a/arch/arm/mach-shmobile/setup-rcar-gen2.c
+++ b/arch/arm/mach-shmobile/setup-rcar-gen2.c
@@ -30,12 +30,16 @@
30 30
31u32 rcar_gen2_read_mode_pins(void) 31u32 rcar_gen2_read_mode_pins(void)
32{ 32{
33 void __iomem *modemr = ioremap_nocache(MODEMR, 4); 33 static u32 mode;
34 u32 mode; 34 static bool mode_valid;
35 35
36 BUG_ON(!modemr); 36 if (!mode_valid) {
37 mode = ioread32(modemr); 37 void __iomem *modemr = ioremap_nocache(MODEMR, 4);
38 iounmap(modemr); 38 BUG_ON(!modemr);
39 mode = ioread32(modemr);
40 iounmap(modemr);
41 mode_valid = true;
42 }
39 43
40 return mode; 44 return mode;
41} 45}