From mboxrd@z Thu Jan 1 00:00:00 1970 From: uboot at andestech.com Date: Thu, 18 Jul 2013 07:16:55 +0000 Subject: [U-Boot] [PATCH] nds32: Enable FPU if the version of CPU supported In-Reply-To: <1374081632-3684-1-git-send-email-ken.kuoky@gmail.com> References: <1374081632-3684-1-git-send-email-ken.kuoky@gmail.com> Message-ID: List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Hi Kuan-Yu Kuo, 2013/7/18 Kuan-Yu Kuo : > + /* > + * 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 There are two kinds of toolchain in Andes architecture, one is FPU supported and the other is not, for the latter one, there is no need to enable FPU even if the processor supports it. This code snippet only useful for the toolchain that will generate FPU instructions, so add compile option to determine Andes predefined macros would be better. For example: #if defined(NDS32_EXT_FPU_DP) || defined(NDS32_EXT_FPU_SP) Andes Technology Corporation