blob: 51e53ff2c8beeefa791a67bdb71c4a2411a45c5e [file] [log] [blame]
Igor Lisitsin95bcd382007-03-28 19:06:19 +04001/*
Sergei Poselenov3190dbe2007-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 Lisitsin95bcd382007-03-28 19:06:19 +04006 *
Wolfgang Denkd79de1d2013-07-08 09:37:19 +02007 * SPDX-License-Identifier: GPL-2.0+
Igor Lisitsin95bcd382007-03-28 19:06:19 +04008 */
9
10#include <config.h>
11
Igor Lisitsin95bcd382007-03-28 19:06:19 +040012#if defined(CONFIG_440EP) || \
13 defined(CONFIG_440EPX)
14
Igor Lisitsin95bcd382007-03-28 19:06:19 +040015#include <asm/processor.h>
Stefan Roese247e9d72010-09-09 19:18:00 +020016#include <asm/ppc4xx.h>
Igor Lisitsin95bcd382007-03-28 19:06:19 +040017
18
19int fpu_status(void)
20{
Matthias Fuchs730b2d22009-07-22 17:27:56 +020021 if (mfspr(SPRN_CCR0) & CCR0_DAPUIB)
Igor Lisitsin95bcd382007-03-28 19:06:19 +040022 return 0; /* Disabled */
Wolfgang Denka0453aa2007-07-10 00:01:28 +020023 else
Igor Lisitsin95bcd382007-03-28 19:06:19 +040024 return 1; /* Enabled */
25}
26
27
28void fpu_disable(void)
29{
Matthias Fuchs730b2d22009-07-22 17:27:56 +020030 mtspr(SPRN_CCR0, mfspr(SPRN_CCR0) | CCR0_DAPUIB);
Igor Lisitsin95bcd382007-03-28 19:06:19 +040031 mtmsr(mfmsr() & ~MSR_FP);
32}
33
34
35void fpu_enable(void)
36{
Matthias Fuchs730b2d22009-07-22 17:27:56 +020037 mtspr(SPRN_CCR0, mfspr(SPRN_CCR0) & ~CCR0_DAPUIB);
Igor Lisitsin95bcd382007-03-28 19:06:19 +040038 mtmsr(mfmsr() | MSR_FP);
39}
Sergei Poselenov3190dbe2007-07-05 08:17:37 +020040
Igor Lisitsin95bcd382007-03-28 19:06:19 +040041#endif