Igor Lisitsin | a11e069 | 2007-03-28 19:06:19 +0400 | [diff] [blame] | 1 | /* |
Sergei Poselenov | b448962 | 2007-07-05 08:17:37 +0200 | [diff] [blame] | 2 | * (C) Copyright 2007 |
3 | * Wolfgang Denk, DENX Software Engineering, wd@denx.de. | ||||
4 | * | ||||
5 | * Author: Sergei Poselenov <sposelenov@emcraft.com> | ||||
Igor Lisitsin | a11e069 | 2007-03-28 19:06:19 +0400 | [diff] [blame] | 6 | * |
Wolfgang Denk | 1a45966 | 2013-07-08 09:37:19 +0200 | [diff] [blame^] | 7 | * SPDX-License-Identifier: GPL-2.0+ |
Igor Lisitsin | a11e069 | 2007-03-28 19:06:19 +0400 | [diff] [blame] | 8 | */ |
9 | |||||
10 | #include <config.h> | ||||
11 | |||||
Igor Lisitsin | a11e069 | 2007-03-28 19:06:19 +0400 | [diff] [blame] | 12 | #if defined(CONFIG_440EP) || \ |
13 | defined(CONFIG_440EPX) | ||||
14 | |||||
Igor Lisitsin | a11e069 | 2007-03-28 19:06:19 +0400 | [diff] [blame] | 15 | #include <asm/processor.h> |
Stefan Roese | b36df56 | 2010-09-09 19:18:00 +0200 | [diff] [blame] | 16 | #include <asm/ppc4xx.h> |
Igor Lisitsin | a11e069 | 2007-03-28 19:06:19 +0400 | [diff] [blame] | 17 | |
18 | |||||
19 | int fpu_status(void) | ||||
20 | { | ||||
Matthias Fuchs | 58ea142 | 2009-07-22 17:27:56 +0200 | [diff] [blame] | 21 | if (mfspr(SPRN_CCR0) & CCR0_DAPUIB) |
Igor Lisitsin | a11e069 | 2007-03-28 19:06:19 +0400 | [diff] [blame] | 22 | return 0; /* Disabled */ |
Wolfgang Denk | 4ef218f | 2007-07-10 00:01:28 +0200 | [diff] [blame] | 23 | else |
Igor Lisitsin | a11e069 | 2007-03-28 19:06:19 +0400 | [diff] [blame] | 24 | return 1; /* Enabled */ |
25 | } | ||||
26 | |||||
27 | |||||
28 | void fpu_disable(void) | ||||
29 | { | ||||
Matthias Fuchs | 58ea142 | 2009-07-22 17:27:56 +0200 | [diff] [blame] | 30 | mtspr(SPRN_CCR0, mfspr(SPRN_CCR0) | CCR0_DAPUIB); |
Igor Lisitsin | a11e069 | 2007-03-28 19:06:19 +0400 | [diff] [blame] | 31 | mtmsr(mfmsr() & ~MSR_FP); |
32 | } | ||||
33 | |||||
34 | |||||
35 | void fpu_enable(void) | ||||
36 | { | ||||
Matthias Fuchs | 58ea142 | 2009-07-22 17:27:56 +0200 | [diff] [blame] | 37 | mtspr(SPRN_CCR0, mfspr(SPRN_CCR0) & ~CCR0_DAPUIB); |
Igor Lisitsin | a11e069 | 2007-03-28 19:06:19 +0400 | [diff] [blame] | 38 | mtmsr(mfmsr() | MSR_FP); |
39 | } | ||||
Sergei Poselenov | b448962 | 2007-07-05 08:17:37 +0200 | [diff] [blame] | 40 | |
Igor Lisitsin | a11e069 | 2007-03-28 19:06:19 +0400 | [diff] [blame] | 41 | #endif |