From: Kuan-Yu Kuo <ken.kuoky@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] nds32: Enable FPU if the version of CPU supported
Date: Thu, 18 Jul 2013 01:20:32 +0800 [thread overview]
Message-ID: <1374081632-3684-1-git-send-email-ken.kuoky@gmail.com> (raw)
Some version of Andes core support FPU coprocessor, if this is the case,
we should enable it at low level initialization time.
Signed-off-by: Kuan-Yu Kuo <ken.kuoky@gmail.com>
Cc: Macpaul Lin <macpaul@gmail.com>
---
arch/nds32/cpu/n1213/ag101/lowlevel_init.S | 22 ++++++++++++++++++++++
arch/nds32/cpu/n1213/ag102/lowlevel_init.S | 22 ++++++++++++++++++++++
2 files changed, 44 insertions(+)
diff --git a/arch/nds32/cpu/n1213/ag101/lowlevel_init.S b/arch/nds32/cpu/n1213/ag101/lowlevel_init.S
index 55985cf..b4c2b0f 100644
--- a/arch/nds32/cpu/n1213/ag101/lowlevel_init.S
+++ b/arch/nds32/cpu/n1213/ag101/lowlevel_init.S
@@ -98,6 +98,9 @@ lowlevel_init:
led 0x10
jal remap
+ led 0x1f
+ jal enable_fpu
+
led 0x20
ret $r10
@@ -234,6 +237,25 @@ relo_base:
2:
ret
+ /*
+ * enable_fpu:
+ * Some of Andes CPU version support FPU coprocessor, if so,
+ * we should enable it.
+ */
+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
+
.globl show_led
show_led:
li $r8, (CONFIG_DEBUG_LED)
diff --git a/arch/nds32/cpu/n1213/ag102/lowlevel_init.S b/arch/nds32/cpu/n1213/ag102/lowlevel_init.S
index d842afa..345f316 100644
--- a/arch/nds32/cpu/n1213/ag102/lowlevel_init.S
+++ b/arch/nds32/cpu/n1213/ag102/lowlevel_init.S
@@ -114,6 +114,9 @@ lowlevel_init:
led 0x20
jal remap
+ led 0x2f
+ jal enable_fpu
+
led 0x30
ret $r10
@@ -289,6 +292,25 @@ relo_base:
2:
ret
+ /*
+ * enable_fpu:
+ * Some of Andes CPU version support FPU coprocessor, if so,
+ * we should enable it.
+ */
+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
+
.globl show_led
show_led:
li $r8, (CONFIG_DEBUG_LED)
--
1.7.9.5
next reply other threads:[~2013-07-17 17:20 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-17 17:20 Kuan-Yu Kuo [this message]
2013-07-18 7:16 ` [U-Boot] [PATCH] nds32: Enable FPU if the version of CPU supported uboot at andestech.com
2013-07-24 5:20 ` Macpaul Lin
2013-07-24 18:17 ` [U-Boot] [PATCH v2] " Kuan-Yu Kuo
2013-07-25 9:44 ` Macpaul Lin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1374081632-3684-1-git-send-email-ken.kuoky@gmail.com \
--to=ken.kuoky@gmail.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.