Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 835d737d authored by Geert Uytterhoeven's avatar Geert Uytterhoeven Committed by Simon Horman
Browse files

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: default avatarGeert Uytterhoeven <geert+renesas@linux-m68k.org>
Signed-off-by: default avatarSimon Horman <horms+renesas@verge.net.au>
parent f05b4b52
Loading
Loading
Loading
Loading
+10 −6
Original line number Diff line number Diff line
@@ -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;

	if (!mode_valid) {
		void __iomem *modemr = ioremap_nocache(MODEMR, 4);
		BUG_ON(!modemr);
		mode = ioread32(modemr);
		iounmap(modemr);
		mode_valid = true;
	}

	return mode;
}