aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/vfp/vfpmodule.c
diff options
context:
space:
mode:
authorRussell King <rmk@dyn-67.arm.linux.org.uk>2006-12-08 10:22:20 -0500
committerRussell King <rmk+kernel@arm.linux.org.uk>2006-12-08 11:05:26 -0500
commitefe90d273b6f365d37c0f82fbbd68a40982c3265 (patch)
treea065719ebabfd6fa8b41e5a01fc5ff0c7ad3e80c /arch/arm/vfp/vfpmodule.c
parentc99767974ebd2a719d849fdeaaa1674456f5283f (diff)
[ARM] Handle HWCAP_VFP in VFP support code
Don't set HWCAP_VFP in the processor support file; not only does it depend on the processor features, but it also depends on the support code being present. Therefore, only set it if the support code detects that we have a VFP coprocessor attached. Also, move the VFP handling of the coprocessor access register into the VFP support code. Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/vfp/vfpmodule.c')
-rw-r--r--arch/arm/vfp/vfpmodule.c26
1 files changed, 25 insertions, 1 deletions
diff --git a/arch/arm/vfp/vfpmodule.c b/arch/arm/vfp/vfpmodule.c
index f08eafbddcc1..e26cc1f59948 100644
--- a/arch/arm/vfp/vfpmodule.c
+++ b/arch/arm/vfp/vfpmodule.c
@@ -263,13 +263,24 @@ void VFP9_bounce(u32 trigger, u32 fpexc, struct pt_regs *regs)
263 if (exceptions) 263 if (exceptions)
264 vfp_raise_exceptions(exceptions, trigger, orig_fpscr, regs); 264 vfp_raise_exceptions(exceptions, trigger, orig_fpscr, regs);
265} 265}
266 266
267/* 267/*
268 * VFP support code initialisation. 268 * VFP support code initialisation.
269 */ 269 */
270static int __init vfp_init(void) 270static int __init vfp_init(void)
271{ 271{
272 unsigned int vfpsid; 272 unsigned int vfpsid;
273 unsigned int cpu_arch = cpu_architecture();
274 u32 access = 0;
275
276 if (cpu_arch >= CPU_ARCH_ARMv6) {
277 access = get_copro_access();
278
279 /*
280 * Enable full access to VFP (cp10 and cp11)
281 */
282 set_copro_access(access | CPACC_FULL(10) | CPACC_FULL(11));
283 }
273 284
274 /* 285 /*
275 * First check that there is a VFP that we can use. 286 * First check that there is a VFP that we can use.
@@ -281,6 +292,12 @@ static int __init vfp_init(void)
281 printk(KERN_INFO "VFP support v0.3: "); 292 printk(KERN_INFO "VFP support v0.3: ");
282 if (VFP_arch) { 293 if (VFP_arch) {
283 printk("not present\n"); 294 printk("not present\n");
295
296 /*
297 * Restore the copro access register.
298 */
299 if (cpu_arch >= CPU_ARCH_ARMv6)
300 set_copro_access(access);
284 } else if (vfpsid & FPSID_NODOUBLE) { 301 } else if (vfpsid & FPSID_NODOUBLE) {
285 printk("no double precision support\n"); 302 printk("no double precision support\n");
286 } else { 303 } else {
@@ -291,9 +308,16 @@ static int __init vfp_init(void)
291 (vfpsid & FPSID_PART_MASK) >> FPSID_PART_BIT, 308 (vfpsid & FPSID_PART_MASK) >> FPSID_PART_BIT,
292 (vfpsid & FPSID_VARIANT_MASK) >> FPSID_VARIANT_BIT, 309 (vfpsid & FPSID_VARIANT_MASK) >> FPSID_VARIANT_BIT,
293 (vfpsid & FPSID_REV_MASK) >> FPSID_REV_BIT); 310 (vfpsid & FPSID_REV_MASK) >> FPSID_REV_BIT);
311
294 vfp_vector = vfp_support_entry; 312 vfp_vector = vfp_support_entry;
295 313
296 thread_register_notifier(&vfp_notifier_block); 314 thread_register_notifier(&vfp_notifier_block);
315
316 /*
317 * We detected VFP, and the support code is
318 * in place; report VFP support to userspace.
319 */
320 elf_hwcap |= HWCAP_VFP;
297 } 321 }
298 return 0; 322 return 0;
299} 323}