diff options
author | Ralf Baechle <ralf@linux-mips.org> | 2007-02-07 08:48:59 -0500 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2007-02-10 17:38:42 -0500 |
commit | 27a3bbaf4b1e23a3afbae4d9f72b51a36859f74a (patch) | |
tree | c6cf2b25d02ee2ad1cf290e9ac9719b301cbc77b | |
parent | 66efc5a7e3061c3597ac43a8bb1026488d57e66b (diff) |
[MIPS] VPE: Sprinkle device model code into code to make udev happier.
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
-rw-r--r-- | arch/mips/kernel/mips-mt.c | 19 | ||||
-rw-r--r-- | arch/mips/kernel/vpe.c | 22 | ||||
-rw-r--r-- | include/asm-mips/mips_mt.h | 3 |
3 files changed, 43 insertions, 1 deletions
diff --git a/arch/mips/kernel/mips-mt.c b/arch/mips/kernel/mips-mt.c index a32f6797353a..ba01800b6018 100644 --- a/arch/mips/kernel/mips-mt.c +++ b/arch/mips/kernel/mips-mt.c | |||
@@ -3,9 +3,11 @@ | |||
3 | * Copyright (C) 2005 Mips Technologies, Inc | 3 | * Copyright (C) 2005 Mips Technologies, Inc |
4 | */ | 4 | */ |
5 | 5 | ||
6 | #include <linux/device.h> | ||
6 | #include <linux/kernel.h> | 7 | #include <linux/kernel.h> |
7 | #include <linux/sched.h> | 8 | #include <linux/sched.h> |
8 | #include <linux/cpumask.h> | 9 | #include <linux/cpumask.h> |
10 | #include <linux/module.h> | ||
9 | #include <linux/interrupt.h> | 11 | #include <linux/interrupt.h> |
10 | #include <linux/security.h> | 12 | #include <linux/security.h> |
11 | 13 | ||
@@ -453,3 +455,20 @@ void mt_cflush_release(void) | |||
453 | #endif /* CONFIG_MIPS_MT_SMTC */ | 455 | #endif /* CONFIG_MIPS_MT_SMTC */ |
454 | /* FILL IN VSMP and AP/SP VERSIONS HERE */ | 456 | /* FILL IN VSMP and AP/SP VERSIONS HERE */ |
455 | } | 457 | } |
458 | |||
459 | struct class *mt_class; | ||
460 | |||
461 | static int __init mt_init(void) | ||
462 | { | ||
463 | struct class *mtc; | ||
464 | |||
465 | mtc = class_create(THIS_MODULE, "mt"); | ||
466 | if (IS_ERR(mtc)) | ||
467 | return PTR_ERR(mtc); | ||
468 | |||
469 | mt_class = mtc; | ||
470 | |||
471 | return 0; | ||
472 | } | ||
473 | |||
474 | subsys_initcall(mt_init); | ||
diff --git a/arch/mips/kernel/vpe.c b/arch/mips/kernel/vpe.c index 459624969c99..4e832da48c69 100644 --- a/arch/mips/kernel/vpe.c +++ b/arch/mips/kernel/vpe.c | |||
@@ -29,6 +29,7 @@ | |||
29 | */ | 29 | */ |
30 | 30 | ||
31 | #include <linux/kernel.h> | 31 | #include <linux/kernel.h> |
32 | #include <linux/device.h> | ||
32 | #include <linux/module.h> | 33 | #include <linux/module.h> |
33 | #include <linux/fs.h> | 34 | #include <linux/fs.h> |
34 | #include <linux/init.h> | 35 | #include <linux/init.h> |
@@ -48,6 +49,7 @@ | |||
48 | #include <asm/cacheflush.h> | 49 | #include <asm/cacheflush.h> |
49 | #include <asm/atomic.h> | 50 | #include <asm/atomic.h> |
50 | #include <asm/cpu.h> | 51 | #include <asm/cpu.h> |
52 | #include <asm/mips_mt.h> | ||
51 | #include <asm/processor.h> | 53 | #include <asm/processor.h> |
52 | #include <asm/system.h> | 54 | #include <asm/system.h> |
53 | #include <asm/vpe.h> | 55 | #include <asm/vpe.h> |
@@ -64,6 +66,7 @@ typedef void *vpe_handle; | |||
64 | 66 | ||
65 | static char module_name[] = "vpe"; | 67 | static char module_name[] = "vpe"; |
66 | static int major; | 68 | static int major; |
69 | static const int minor = 1; /* fixed for now */ | ||
67 | 70 | ||
68 | #ifdef CONFIG_MIPS_APSP_KSPD | 71 | #ifdef CONFIG_MIPS_APSP_KSPD |
69 | static struct kspd_notifications kspd_events; | 72 | static struct kspd_notifications kspd_events; |
@@ -1365,12 +1368,15 @@ static void kspd_sp_exit( int sp_id) | |||
1365 | } | 1368 | } |
1366 | #endif | 1369 | #endif |
1367 | 1370 | ||
1371 | static struct device *vpe_dev; | ||
1372 | |||
1368 | static int __init vpe_module_init(void) | 1373 | static int __init vpe_module_init(void) |
1369 | { | 1374 | { |
1370 | struct vpe *v = NULL; | 1375 | struct vpe *v = NULL; |
1376 | struct device *dev; | ||
1371 | struct tc *t; | 1377 | struct tc *t; |
1372 | unsigned long val; | 1378 | unsigned long val; |
1373 | int i; | 1379 | int i, err; |
1374 | 1380 | ||
1375 | if (!cpu_has_mipsmt) { | 1381 | if (!cpu_has_mipsmt) { |
1376 | printk("VPE loader: not a MIPS MT capable processor\n"); | 1382 | printk("VPE loader: not a MIPS MT capable processor\n"); |
@@ -1383,6 +1389,14 @@ static int __init vpe_module_init(void) | |||
1383 | return major; | 1389 | return major; |
1384 | } | 1390 | } |
1385 | 1391 | ||
1392 | dev = device_create(mt_class, NULL, MKDEV(major, minor), | ||
1393 | "tc%d", minor); | ||
1394 | if (IS_ERR(dev)) { | ||
1395 | err = PTR_ERR(dev); | ||
1396 | goto out_chrdev; | ||
1397 | } | ||
1398 | vpe_dev = dev; | ||
1399 | |||
1386 | dmt(); | 1400 | dmt(); |
1387 | dvpe(); | 1401 | dvpe(); |
1388 | 1402 | ||
@@ -1478,6 +1492,11 @@ static int __init vpe_module_init(void) | |||
1478 | kspd_events.kspd_sp_exit = kspd_sp_exit; | 1492 | kspd_events.kspd_sp_exit = kspd_sp_exit; |
1479 | #endif | 1493 | #endif |
1480 | return 0; | 1494 | return 0; |
1495 | |||
1496 | out_chrdev: | ||
1497 | unregister_chrdev(major, module_name); | ||
1498 | |||
1499 | return err; | ||
1481 | } | 1500 | } |
1482 | 1501 | ||
1483 | static void __exit vpe_module_exit(void) | 1502 | static void __exit vpe_module_exit(void) |
@@ -1490,6 +1509,7 @@ static void __exit vpe_module_exit(void) | |||
1490 | } | 1509 | } |
1491 | } | 1510 | } |
1492 | 1511 | ||
1512 | device_destroy(mt_class, MKDEV(major, minor)); | ||
1493 | unregister_chrdev(major, module_name); | 1513 | unregister_chrdev(major, module_name); |
1494 | } | 1514 | } |
1495 | 1515 | ||
diff --git a/include/asm-mips/mips_mt.h b/include/asm-mips/mips_mt.h index c31a312b9783..fdfff0b8ce42 100644 --- a/include/asm-mips/mips_mt.h +++ b/include/asm-mips/mips_mt.h | |||
@@ -12,4 +12,7 @@ extern unsigned long mt_fpemul_threshold; | |||
12 | extern void mips_mt_regdump(unsigned long previous_mvpcontrol_value); | 12 | extern void mips_mt_regdump(unsigned long previous_mvpcontrol_value); |
13 | extern void mips_mt_set_cpuoptions(void); | 13 | extern void mips_mt_set_cpuoptions(void); |
14 | 14 | ||
15 | struct class; | ||
16 | extern struct class *mt_class; | ||
17 | |||
15 | #endif /* __ASM_MIPS_MT_H */ | 18 | #endif /* __ASM_MIPS_MT_H */ |