summaryrefslogtreecommitdiff
path: root/cpu/mpc512x/speed.c
diff options
context:
space:
mode:
authorWolfgang Denk <wd@denx.de>2009-05-16 10:47:43 +0200
committerWolfgang Denk <wd@denx.de>2009-06-12 20:47:16 +0200
commit843efb1192cc8fd4f904a23dbab4e0fe3e1c5bc2 (patch)
tree8fef341b4b1a8a234f881444c237c243098e372d /cpu/mpc512x/speed.c
parent19dc7e179268be148e550c36203208c662610d76 (diff)
downloadu-boot-imx-843efb1192cc8fd4f904a23dbab4e0fe3e1c5bc2.zip
u-boot-imx-843efb1192cc8fd4f904a23dbab4e0fe3e1c5bc2.tar.gz
u-boot-imx-843efb1192cc8fd4f904a23dbab4e0fe3e1c5bc2.tar.bz2
MPC512x: use I/O accessors instead of pointer accesses
This commit changes the MPC512x code to use I/O accessor calls (i.e. out_*() and in_*()) instead of using deprecated pointer accesses. Signed-off-by: Wolfgang Denk <wd@denx.de> Cc: John Rigby <jcrigby@gmail.com>
Diffstat (limited to 'cpu/mpc512x/speed.c')
-rw-r--r--cpu/mpc512x/speed.c23
1 files changed, 16 insertions, 7 deletions
diff --git a/cpu/mpc512x/speed.c b/cpu/mpc512x/speed.c
index 1f90862..0fec004 100644
--- a/cpu/mpc512x/speed.c
+++ b/cpu/mpc512x/speed.c
@@ -1,5 +1,5 @@
/*
- * (C) Copyright 2000-2007
+ * (C) Copyright 2000-2009
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
*
* Copyright (C) 2004-2006 Freescale Semiconductor, Inc.
@@ -28,6 +28,7 @@
#include <common.h>
#include <mpc512x.h>
#include <command.h>
+#include <asm/io.h>
#include <asm/processor.h>
DECLARE_GLOBAL_DATA_PTR;
@@ -75,29 +76,37 @@ int get_clocks (void)
u32 csb_clk;
u32 ips_clk;
u32 pci_clk;
+ u32 reg;
- if ((im->sysconf.immrbar & IMMRBAR_BASE_ADDR) != (u32) im)
+ reg = in_be32(&im->sysconf.immrbar);
+ if ((reg & IMMRBAR_BASE_ADDR) != (u32) im)
return -1;
- spmf = (im->clk.spmr & SPMR_SPMF) >> SPMR_SPMF_SHIFT;
+ reg = in_be32(&im->clk.spmr);
+ spmf = (reg & SPMR_SPMF) >> SPMR_SPMF_SHIFT;
spll = ref_clk * spmf_mult[spmf];
- sys_div = (im->clk.scfr[1] & SCFR2_SYS_DIV) >> SCFR2_SYS_DIV_SHIFT;
+ reg = in_be32(&im->clk.scfr[1]);
+ sys_div = (reg & SCFR2_SYS_DIV) >> SCFR2_SYS_DIV_SHIFT;
sys_clk = (spll * sys_dividors[sys_div][1]) / sys_dividors[sys_div][0];
csb_clk = sys_clk / 2;
- cpmf = (im->clk.spmr & SPMR_CPMF) >> SPMR_CPMF_SHIFT;
+ reg = in_be32(&im->clk.spmr);
+ cpmf = (reg & SPMR_CPMF) >> SPMR_CPMF_SHIFT;
core_clk = (csb_clk * cpmf_mult[cpmf][0]) / cpmf_mult[cpmf][1];
- ips_div = (im->clk.scfr[0] & SCFR1_IPS_DIV_MASK) >> SCFR1_IPS_DIV_SHIFT;
+ reg = in_be32(&im->clk.scfr[0]);
+ ips_div = (reg & SCFR1_IPS_DIV_MASK) >> SCFR1_IPS_DIV_SHIFT;
if (ips_div != 0) {
ips_clk = csb_clk / ips_div;
} else {
/* in case we cannot get a sane IPS divisor, fail gracefully */
ips_clk = 0;
}
- pci_div = (im->clk.scfr[0] & SCFR1_PCI_DIV_MASK) >> SCFR1_PCI_DIV_SHIFT;
+
+ reg = in_be32(&im->clk.scfr[0]);
+ pci_div = (reg & SCFR1_PCI_DIV_MASK) >> SCFR1_PCI_DIV_SHIFT;
if (pci_div != 0) {
pci_clk = csb_clk / pci_div;
} else {