[U-Boot] [PATCH 4/7] powerpc/8xx: get rid of get_immr()

Christophe Leroy christophe.leroy at c-s.fr
Fri Jan 26 14:06:52 UTC 2018


function get_immr() is almost not used and doesn't bring much
added value. Just replace it with mfspr(SPRN_IMMR) at the two
needed places.

Signed-off-by: Christophe Leroy <christophe.leroy at c-s.fr>
---
 arch/powerpc/cpu/mpc8xx/cpu.c     | 7 +++----
 arch/powerpc/cpu/mpc8xx/reginfo.c | 2 +-
 arch/powerpc/cpu/mpc8xx/speed.c   | 3 +--
 arch/powerpc/include/asm/ppc.h    | 8 --------
 4 files changed, 5 insertions(+), 15 deletions(-)

diff --git a/arch/powerpc/cpu/mpc8xx/cpu.c b/arch/powerpc/cpu/mpc8xx/cpu.c
index 1883440db3..0eabb714d3 100644
--- a/arch/powerpc/cpu/mpc8xx/cpu.c
+++ b/arch/powerpc/cpu/mpc8xx/cpu.c
@@ -36,7 +36,7 @@ DECLARE_GLOBAL_DATA_PTR;
 
 static int check_CPU(long clock, uint pvr, uint immr)
 {
-	immap_t __iomem *immap = (immap_t __iomem *)(immr & 0xFFFF0000);
+	immap_t __iomem *immap = (immap_t __iomem *)CONFIG_SYS_IMMR;
 	uint k;
 	char buf[32];
 
@@ -90,7 +90,7 @@ static int check_CPU(long clock, uint pvr, uint immr)
 int checkcpu(void)
 {
 	ulong clock = gd->cpu_clk;
-	uint immr = get_immr(0);	/* Return full IMMR contents */
+	uint immr = mfspr(SPRN_IMMR);	/* Return full IMMR contents */
 	uint pvr = get_pvr();
 
 	puts("CPU:   ");
@@ -237,8 +237,7 @@ int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
  */
 unsigned long get_tbclk(void)
 {
-	uint immr = get_immr(0);	/* Return full IMMR contents */
-	immap_t __iomem *immap = (immap_t __iomem *)(immr & 0xFFFF0000);
+	immap_t __iomem *immap = (immap_t __iomem *)CONFIG_SYS_IMMR;
 	ulong oscclk, factor, pll;
 
 	if (in_be32(&immap->im_clkrst.car_sccr) & SCCR_TBS)
diff --git a/arch/powerpc/cpu/mpc8xx/reginfo.c b/arch/powerpc/cpu/mpc8xx/reginfo.c
index 277d2753b2..1f6e606e52 100644
--- a/arch/powerpc/cpu/mpc8xx/reginfo.c
+++ b/arch/powerpc/cpu/mpc8xx/reginfo.c
@@ -22,7 +22,7 @@ void print_reginfo(void)
 	 */
 
 	printf("\nSystem Configuration registers\n"
-		"\tIMMR\t0x%08X\n", get_immr(0));
+		"\tIMMR\t0x%08X\n", mfspr(SPRN_IMMR));
 
 	printf("\tSIUMCR\t0x%08X", in_be32(&sysconf->sc_siumcr));
 	printf("\tSYPCR\t0x%08X\n", in_be32(&sysconf->sc_sypcr));
diff --git a/arch/powerpc/cpu/mpc8xx/speed.c b/arch/powerpc/cpu/mpc8xx/speed.c
index fa8f87cbc5..f8eb4a13ea 100644
--- a/arch/powerpc/cpu/mpc8xx/speed.c
+++ b/arch/powerpc/cpu/mpc8xx/speed.c
@@ -17,8 +17,7 @@ DECLARE_GLOBAL_DATA_PTR;
  */
 int get_clocks(void)
 {
-	uint immr = get_immr(0);	/* Return full IMMR contents */
-	immap_t __iomem *immap = (immap_t __iomem *)(immr & 0xFFFF0000);
+	immap_t __iomem *immap = (immap_t __iomem *)CONFIG_SYS_IMMR;
 	uint sccr = in_be32(&immap->im_clkrst.car_sccr);
 	uint divider = 1 << (((sccr & SCCR_DFBRG11) >> 11) * 2);
 
diff --git a/arch/powerpc/include/asm/ppc.h b/arch/powerpc/include/asm/ppc.h
index 5e0aa08be9..db289ed707 100644
--- a/arch/powerpc/include/asm/ppc.h
+++ b/arch/powerpc/include/asm/ppc.h
@@ -40,14 +40,6 @@
 
 #include <asm/processor.h>
 
-#if defined(CONFIG_8xx)
-static inline uint get_immr(uint mask)
-{
-	uint immr = mfspr(SPRN_IMMR);
-
-	return mask ? (immr & mask) : immr;
-}
-#endif
 static inline uint get_pvr(void)
 {
 	return mfspr(PVR);
-- 
2.13.3



More information about the U-Boot mailing list