summaryrefslogtreecommitdiff
path: root/cpu/mpc86xx
diff options
context:
space:
mode:
authorBecky Bruce <beckyb@kernel.crashing.org>2009-02-03 18:10:52 -0600
committerWolfgang Denk <wd@denx.de>2009-02-10 00:29:49 +0100
commitc9315e6b4f244981de0b2eaaa29a7838a165b494 (patch)
treea27fab62224cf8b5e7f831f4c1c64ad6ba258d5d /cpu/mpc86xx
parentd35ae5a938679bd7e18167faf79d0fb3c6639b51 (diff)
downloadu-boot-imx-c9315e6b4f244981de0b2eaaa29a7838a165b494.zip
u-boot-imx-c9315e6b4f244981de0b2eaaa29a7838a165b494.tar.gz
u-boot-imx-c9315e6b4f244981de0b2eaaa29a7838a165b494.tar.bz2
mpc86xx: Add support to populate addr map based on BATs
If CONFIG_ADDR_MAP is enabled, update the address map whenever we write a bat. Signed-off-by: Becky Bruce <beckyb@kernel.crashing.org>
Diffstat (limited to 'cpu/mpc86xx')
-rw-r--r--cpu/mpc86xx/cpu_init.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/cpu/mpc86xx/cpu_init.c b/cpu/mpc86xx/cpu_init.c
index a7e6036..4f29122 100644
--- a/cpu/mpc86xx/cpu_init.c
+++ b/cpu/mpc86xx/cpu_init.c
@@ -154,3 +154,30 @@ void setup_bats(void)
return;
}
+
+#ifdef CONFIG_ADDR_MAP
+/* Initialize address mapping array */
+void init_addr_map(void)
+{
+ int i;
+ ppc_bat_t bat = DBAT0;
+ phys_size_t size;
+ unsigned long upper, lower;
+
+ for (i = 0; i < CONFIG_SYS_NUM_ADDR_MAP; i++, bat++) {
+ if (read_bat(bat, &upper, &lower) != -1) {
+ if (!BATU_VALID(upper))
+ size = 0;
+ else
+ size = BATU_SIZE(upper);
+ addrmap_set_entry(BATU_VADDR(upper), BATL_PADDR(lower),
+ size, i);
+ }
+#ifdef CONFIG_HIGH_BATS
+ /* High bats are not contiguous with low BAT numbers */
+ if (bat == DBAT3)
+ bat = DBAT4 - 1;
+#endif
+ }
+}
+#endif