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>
This commit is contained in:
Geert Uytterhoeven 2014-03-12 19:44:49 +01:00 committed by Simon Horman
parent f05b4b5284
commit 835d737d66

View File

@ -30,12 +30,16 @@
u32 rcar_gen2_read_mode_pins(void)
{
void __iomem *modemr = ioremap_nocache(MODEMR, 4);
u32 mode;
static u32 mode;
static bool mode_valid;
BUG_ON(!modemr);
mode = ioread32(modemr);
iounmap(modemr);
if (!mode_valid) {
void __iomem *modemr = ioremap_nocache(MODEMR, 4);
BUG_ON(!modemr);
mode = ioread32(modemr);
iounmap(modemr);
mode_valid = true;
}
return mode;
}