Subject: [PATCH 09/14] 85xx/sbc8548: read hardware revision when it's required for first time

From: Dmitry Eremin-Solenikov <[email-masked]>
Date: Tue, 19 Jul 2011 12:53:46 +0400

Currently sbc8548 reads hardware revision during bootup. To simplify
things read it when it's first required when the kernel is up and
running.

Signed-off-by: Dmitry Eremin-Solenikov <[email-masked]>
---
 arch/powerpc/platforms/85xx/sbc8548.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/arch/powerpc/platforms/85xx/sbc8548.c b/arch/powerpc/platforms/85xx/sbc8548.c
index ecdd8c0..2eeb376 100644
--- a/arch/powerpc/platforms/85xx/sbc8548.c
+++ b/arch/powerpc/platforms/85xx/sbc8548.c
@@ -49,7 +49,7 @@
 #include <sysdev/fsl_soc.h>
 #include <sysdev/fsl_pci.h>
 
-static int sbc_rev;
+static int sbc_rev = -EINVAL;
 
 static void __init sbc8548_pic_init(void)
 {
@@ -82,7 +82,7 @@ static void __init sbc8548_pic_init(void)
 }
 
 /* Extract the HW Rev from the EPLD on the board */
-static int __init sbc8548_hw_rev(void)
+static int sbc8548_hw_rev(void)
 {
 	struct device_node *np;
 	struct resource res;
@@ -130,7 +130,6 @@ static void __init sbc8548_setup_arch(void)
 		}
 	}
 #endif
-	sbc_rev = sbc8548_hw_rev();
 }
 
 static void sbc8548_show_cpuinfo(struct seq_file *m)
@@ -140,6 +139,9 @@ static void sbc8548_show_cpuinfo(struct seq_file *m)
 	pvid = mfspr(SPRN_PVR);
 	svid = mfspr(SPRN_SVR);
 
+	if (sbc_rev == -EINVAL)
+		sbc_rev = sbc8548_hw_rev();
+
 	seq_printf(m, "Vendor\t\t: Wind River\n");
 	seq_printf(m, "Machine\t\t: SBC8548 v%d\n", sbc_rev);
 	seq_printf(m, "PVR\t\t: 0x%x\n", pvid);
-- 
1.7.2.5