summaryrefslogtreecommitdiffstats
path: root/arch/nds32/cpu/n1213/ag102
diff options
context:
space:
mode:
authorTom Rini <trini@ti.com>2013-07-25 08:22:08 -0400
committerTom Rini <trini@ti.com>2013-07-25 08:51:51 -0400
commitaaf5e825606a70ddc8fca8e366d8c16a6fd3cc7c (patch)
tree64eaea4d396dce4e0a30bb955b8240d4b199cdca /arch/nds32/cpu/n1213/ag102
parent0b17998e509e5614633aee0a3c5d6248f8bc580b (diff)
parentc54fd3efa497876a33cc3c6e7df514ae53abc729 (diff)
downloadblackbird-obmc-uboot-aaf5e825606a70ddc8fca8e366d8c16a6fd3cc7c.tar.gz
blackbird-obmc-uboot-aaf5e825606a70ddc8fca8e366d8c16a6fd3cc7c.zip
Merge branch 'master' of git://git.denx.de/u-boot-nds32
Diffstat (limited to 'arch/nds32/cpu/n1213/ag102')
-rw-r--r--arch/nds32/cpu/n1213/ag102/Makefile8
-rw-r--r--arch/nds32/cpu/n1213/ag102/lowlevel_init.S26
-rw-r--r--arch/nds32/cpu/n1213/ag102/timer.c7
3 files changed, 34 insertions, 7 deletions
diff --git a/arch/nds32/cpu/n1213/ag102/Makefile b/arch/nds32/cpu/n1213/ag102/Makefile
index fb388f05df..b53a3eb5f4 100644
--- a/arch/nds32/cpu/n1213/ag102/Makefile
+++ b/arch/nds32/cpu/n1213/ag102/Makefile
@@ -17,15 +17,15 @@ LIB = $(obj)lib$(SOC).o
COBJS-y := cpu.o timer.o
ifndef CONFIG_SKIP_LOWLEVEL_INIT
-SOBJS := lowlevel_init.o
+SOBJS-y := lowlevel_init.o
endif
ifndef CONFIG_SKIP_TRUNOFF_WATCHDOG
-SOBJS += watchdog.o
+SOBJS-y += watchdog.o
endif
-SRCS := $(SOBJS:.o=.S) $(COBJS-y:.o=.c)
-OBJS := $(addprefix $(obj),$(SOBJS) $(COBJS-y))
+SRCS := $(SOBJS-y:.o=.S) $(COBJS-y:.o=.c)
+OBJS := $(addprefix $(obj),$(SOBJS-y) $(COBJS-y))
all: $(obj).depend $(LIB)
diff --git a/arch/nds32/cpu/n1213/ag102/lowlevel_init.S b/arch/nds32/cpu/n1213/ag102/lowlevel_init.S
index 94018483f2..238410dde4 100644
--- a/arch/nds32/cpu/n1213/ag102/lowlevel_init.S
+++ b/arch/nds32/cpu/n1213/ag102/lowlevel_init.S
@@ -98,6 +98,11 @@ lowlevel_init:
led 0x20
jal remap
+#if (defined(NDS32_EXT_FPU_DP) || defined(NDS32_EXT_FPU_SP))
+ led 0x2f
+ jal enable_fpu
+#endif
+
led 0x30
ret $r10
@@ -273,6 +278,27 @@ relo_base:
2:
ret
+ /*
+ * enable_fpu:
+ * Some of Andes CPU version support FPU coprocessor, if so,
+ * and toolchain support FPU instruction set, we should enable it.
+ */
+#if (defined(NDS32_EXT_FPU_DP) || defined(NDS32_EXT_FPU_SP))
+enable_fpu:
+ mfsr $r0, $CPU_VER /* enable FPU if it exists */
+ srli $r0, $r0, 3
+ andi $r0, $r0, 1
+ beqz $r0, 1f /* skip if no COP */
+ mfsr $r0, $FUCOP_EXIST
+ srli $r0, $r0, 31
+ beqz $r0, 1f /* skip if no FPU */
+ mfsr $r0, $FUCOP_CTL
+ ori $r0, $r0, 1
+ mtsr $r0, $FUCOP_CTL
+1:
+ ret
+#endif
+
.globl show_led
show_led:
li $r8, (CONFIG_DEBUG_LED)
diff --git a/arch/nds32/cpu/n1213/ag102/timer.c b/arch/nds32/cpu/n1213/ag102/timer.c
index ec6eb52f2e..758b354110 100644
--- a/arch/nds32/cpu/n1213/ag102/timer.c
+++ b/arch/nds32/cpu/n1213/ag102/timer.c
@@ -71,7 +71,8 @@ void reset_timer_masked(void)
#ifdef CONFIG_FTTMR010_EXT_CLK
lastdec = readl(&tmr->timer3_counter) / (TIMER_CLOCK / CONFIG_SYS_HZ);
#else
- lastdec = readl(&tmr->timer3_counter) / (CONFIG_SYS_CLK_FREQ / 2);
+ lastdec = readl(&tmr->timer3_counter) /
+ (CONFIG_SYS_CLK_FREQ / 2 / CONFIG_SYS_HZ);
#endif
timestamp = 0; /* start "advancing" time stamp from 0 */
@@ -95,8 +96,8 @@ ulong get_timer_masked(void)
#ifdef CONFIG_FTTMR010_EXT_CLK
ulong now = readl(&tmr->timer3_counter) / (TIMER_CLOCK / CONFIG_SYS_HZ);
#else
- ulong now = readl(&tmr->timer3_counter) / \
- (CONFIG_SYS_CLK_FREQ / 2 / 1024);
+ ulong now = readl(&tmr->timer3_counter) /
+ (CONFIG_SYS_CLK_FREQ / 2 / CONFIG_SYS_HZ);
#endif
debug("%s(): now = %lx, lastdec = %lx\n", __func__, now, lastdec);
OpenPOWER on IntegriCloud