diff options
author | Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> | 2009-04-05 13:02:43 +0200 |
---|---|---|
committer | Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> | 2009-04-05 13:02:43 +0200 |
commit | 677e62f43235de9a1701204d7bcea0fb3d233fa1 (patch) | |
tree | 39cfac114059b9e3f8b4c949da614b0475fff890 /cpu/ixp | |
parent | 36003268968949110ef145d9f2eaf8439c96d25b (diff) | |
download | u-boot-imx-677e62f43235de9a1701204d7bcea0fb3d233fa1.zip u-boot-imx-677e62f43235de9a1701204d7bcea0fb3d233fa1.tar.gz u-boot-imx-677e62f43235de9a1701204d7bcea0fb3d233fa1.tar.bz2 |
arm: update co-processor 15 access
import system.h from linux
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Diffstat (limited to 'cpu/ixp')
-rw-r--r-- | cpu/ixp/cpu.c | 53 |
1 files changed, 23 insertions, 30 deletions
diff --git a/cpu/ixp/cpu.c b/cpu/ixp/cpu.c index fd545b5..265c820 100644 --- a/cpu/ixp/cpu.c +++ b/cpu/ixp/cpu.c @@ -34,6 +34,7 @@ #include <command.h> #include <netdev.h> #include <asm/arch/ixp425.h> +#include <asm/system.h> ulong loops_per_jiffy; @@ -125,47 +126,39 @@ int do_reset (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) return (0); } -/* taken from blob */ -void icache_enable (void) +/* cache_bit must be either CR_I or CR_C */ +static void cache_enable(uint32_t cache_bit) { - register u32 i; + uint32_t reg; - /* read control register */ - asm ("mrc p15, 0, %0, c1, c0, 0":"=r" (i)); - - /* set i-cache */ - i |= 0x1000; - - /* write back to control register */ - asm ("mcr p15, 0, %0, c1, c0, 0": :"r" (i)); + reg = get_cr(); /* get control reg. */ + cp_delay(); + set_cr(reg | cache_bit); } -void icache_disable (void) +/* cache_bit must be either CR_I or CR_C */ +static void cache_disable(uint32_t cache_bit) { - register u32 i; - - /* read control register */ - asm ("mrc p15, 0, %0, c1, c0, 0":"=r" (i)); - - /* clear i-cache */ - i &= ~0x1000; + uint32_t reg; - /* write back to control register */ - asm ("mcr p15, 0, %0, c1, c0, 0": :"r" (i)); - - /* flush i-cache */ - asm ("mcr p15, 0, %0, c7, c5, 0": :"r" (i)); + reg = get_cr(); + cp_delay(); + set_cr(reg & ~cache_bit); } -int icache_status (void) +void icache_enable(void) { - register u32 i; + cache_enable(CR_I); +} - /* read control register */ - asm ("mrc p15, 0, %0, c1, c0, 0":"=r" (i)); +void icache_disable(void) +{ + cache_disable(CR_I); +} - /* return bit */ - return (i & 0x1000); +int icache_status(void) +{ + return (get_cr() & CR_I) != 0; } /* we will never enable dcache, because we have to setup MMU first */ |