blob: 51e53ff2c8beeefa791a67bdb71c4a2411a45c5e [file] [log] [blame]
Igor Lisitsina11e0692007-03-28 19:06:19 +04001/*
Sergei Poselenovb4489622007-07-05 08:17:37 +02002 * (C) Copyright 2007
3 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
4 *
5 * Author: Sergei Poselenov <sposelenov@emcraft.com>
Igor Lisitsina11e0692007-03-28 19:06:19 +04006 *
Wolfgang Denk1a459662013-07-08 09:37:19 +02007 * SPDX-License-Identifier: GPL-2.0+
Igor Lisitsina11e0692007-03-28 19:06:19 +04008 */
9
10#include <config.h>
11
Igor Lisitsina11e0692007-03-28 19:06:19 +040012#if defined(CONFIG_440EP) || \
13 defined(CONFIG_440EPX)
14
Igor Lisitsina11e0692007-03-28 19:06:19 +040015#include <asm/processor.h>
Stefan Roeseb36df562010-09-09 19:18:00 +020016#include <asm/ppc4xx.h>
Igor Lisitsina11e0692007-03-28 19:06:19 +040017
18
19int fpu_status(void)
20{
Matthias Fuchs58ea1422009-07-22 17:27:56 +020021 if (mfspr(SPRN_CCR0) & CCR0_DAPUIB)
Igor Lisitsina11e0692007-03-28 19:06:19 +040022 return 0; /* Disabled */
Wolfgang Denk4ef218f2007-07-10 00:01:28 +020023 else
Igor Lisitsina11e0692007-03-28 19:06:19 +040024 return 1; /* Enabled */
25}
26
27
28void fpu_disable(void)
29{
Matthias Fuchs58ea1422009-07-22 17:27:56 +020030 mtspr(SPRN_CCR0, mfspr(SPRN_CCR0) | CCR0_DAPUIB);
Igor Lisitsina11e0692007-03-28 19:06:19 +040031 mtmsr(mfmsr() & ~MSR_FP);
32}
33
34
35void fpu_enable(void)
36{
Matthias Fuchs58ea1422009-07-22 17:27:56 +020037 mtspr(SPRN_CCR0, mfspr(SPRN_CCR0) & ~CCR0_DAPUIB);
Igor Lisitsina11e0692007-03-28 19:06:19 +040038 mtmsr(mfmsr() | MSR_FP);
39}
Sergei Poselenovb4489622007-07-05 08:17:37 +020040
Igor Lisitsina11e0692007-03-28 19:06:19 +040041#endif