Browse Source

Merge branch 'master' of git://git.denx.de/u-boot-nios

* 'master' of git://git.denx.de/u-boot-nios:
  nios2 - adjust gbl data off to account for bd_info
  nios2: implement get_ticks and get_tbclk
  nios2: add flush_dcache_range function
Wolfgang Denk 13 years ago
parent
commit
5c877b1ae0
3 changed files with 33 additions and 1 deletions
  1. 21 0
      arch/nios2/cpu/interrupts.c
  2. 10 0
      arch/nios2/lib/cache.S
  3. 2 1
      include/configs/nios2-generic.h

+ 21 - 0
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.
  */

+ 10 - 0
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:

+ 2 - 1
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
 
 /*