From 8875833a86e567c0ca4258353116294089d24625 Mon Sep 17 00:00:00 2001 From: Stefan Kristiansson Date: Fri, 4 Nov 2011 14:38:08 +0200 Subject: nios2: add flush_dcache_range function exposes functionality to flush dcache according to the common.h API Signed-off-by: Stefan Kristiansson Cc: Thomas Chou Signed-off-by: Thomas Chou diff --git a/arch/nios2/lib/cache.S b/arch/nios2/lib/cache.S index ee3b4b7..b952d0c 100644 --- a/arch/nios2/lib/cache.S +++ b/arch/nios2/lib/cache.S @@ -48,6 +48,16 @@ flush_icache: bltu r4, r5, 1b ret + .global flush_dcache_range + +flush_dcache_range: + movhi r8, %hi(CONFIG_SYS_DCACHELINE_SIZE) + ori r8, r8, %lo(CONFIG_SYS_DCACHELINE_SIZE) +0: flushd 0(r4) + add r4, r4, r8 + bltu r4, r5, 0b + ret + .global flush_cache flush_cache: -- cgit v0.10.2 From 7bd7b31574518bf9c7b3c83ef2831e27abb6b14e Mon Sep 17 00:00:00 2001 From: Alex Hornung Date: Mon, 20 Feb 2012 07:34:48 +0000 Subject: nios2: implement get_ticks and get_tbclk * Copy over Blackfin's get_ticks and get_tbclk - they work just fine on Nios2. Signed-off-by: Alex Hornung Signed-off-by: Thomas Chou diff --git a/arch/nios2/cpu/interrupts.c b/arch/nios2/cpu/interrupts.c index 0a97fa6..2ce689f 100644 --- a/arch/nios2/cpu/interrupts.c +++ b/arch/nios2/cpu/interrupts.c @@ -98,6 +98,27 @@ ulong get_timer (ulong base) return (timestamp - base); } +/* + * This function is derived from Blackfin code (read timebase as long long). + * On Nios2 it just returns the timer value. + */ +unsigned long long get_ticks(void) +{ + return get_timer(0); +} + +/* + * This function is derived from Blackfin code. + * On Nios2 it returns the number of timer ticks per second. + */ +ulong get_tbclk(void) +{ + ulong tbclk; + + tbclk = CONFIG_SYS_HZ; + return tbclk; +} + /* The board must handle this interrupt if a timer is not * provided. */ -- cgit v0.10.2 From bb60db634c26d609b289e114f44cc2c94ee64c4f Mon Sep 17 00:00:00 2001 From: Alex Hornung Date: Mon, 20 Feb 2012 23:45:45 +0000 Subject: nios2 - adjust gbl data off to account for bd_info * Adjust the GBL_DATA_OFFSET to account for the fact that we'll be using the space between that offset and the start of the malloc region to allocate both a gd structure and a board info structure. * This fixes a memory corruption bug due to overlap of the malloc region and the bd_info structure. Signed-off-by: Alex Hornung Signed-off-by: Thomas Chou diff --git a/include/configs/nios2-generic.h b/include/configs/nios2-generic.h index 9ba35e8..17017a5 100644 --- a/include/configs/nios2-generic.h +++ b/include/configs/nios2-generic.h @@ -131,7 +131,8 @@ #define CONFIG_SYS_MALLOC_BASE (CONFIG_SYS_MONITOR_BASE - \ CONFIG_SYS_MALLOC_LEN) #define CONFIG_SYS_GBL_DATA_OFFSET (CONFIG_SYS_MALLOC_BASE - \ - GENERATED_GBL_DATA_SIZE) + GENERATED_GBL_DATA_SIZE - \ + GENERATED_BD_INFO_SIZE) #define CONFIG_SYS_INIT_SP CONFIG_SYS_GBL_DATA_OFFSET /* -- cgit v0.10.2