diff mbox series

[U-Boot,v4,02/16] powerpc: mpc8xx: harmonise initialisation of the immap local pointer

Message ID 349afe00b4fcd4af371e59a424c44866e218999e.1521215903.git.christophe.leroy@c-s.fr
State Accepted
Delegated to: Tom Rini
Headers show
Series Powerpc: mpc8xx: cleanup before migration to DM model | expand

Commit Message

Christophe Leroy March 16, 2018, 4:20 p.m. UTC
In most places, immap local pointer is defined as
	immap_t __iomem *immap = (immap_t __iomem *)CONFIG_SYS_IMMR;
In a few places, it is defined as
	immap_t __iomem *immap = (immap_t __iomem *)(immr & 0xFFFF0000);

This patch replaces the few of the latest form by the other one.

The two are fully equivalent since SPRN_IMMR is set with CONFIG_SYS_IMMR
very early in start.S

Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
---
 arch/powerpc/cpu/mpc8xx/cpu.c   | 5 ++---
 arch/powerpc/cpu/mpc8xx/speed.c | 3 +--
 2 files changed, 3 insertions(+), 5 deletions(-)

Comments

Tom Rini April 6, 2018, 9:02 p.m. UTC | #1
On Fri, Mar 16, 2018 at 05:20:33PM +0100, Christophe Leroy wrote:

> In most places, immap local pointer is defined as
> 	immap_t __iomem *immap = (immap_t __iomem *)CONFIG_SYS_IMMR;
> In a few places, it is defined as
> 	immap_t __iomem *immap = (immap_t __iomem *)(immr & 0xFFFF0000);
> 
> This patch replaces the few of the latest form by the other one.
> 
> The two are fully equivalent since SPRN_IMMR is set with CONFIG_SYS_IMMR
> very early in start.S
> 
> Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>

Applied to u-boot/master, thanks!
diff mbox series

Patch

diff --git a/arch/powerpc/cpu/mpc8xx/cpu.c b/arch/powerpc/cpu/mpc8xx/cpu.c
index 1120fd7441c..9da73ac22e2 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];
 
@@ -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/speed.c b/arch/powerpc/cpu/mpc8xx/speed.c
index fa8f87cbc5e..f8eb4a13eaf 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);