]>
Commit | Line | Data |
---|---|---|
1da177e4 LT |
1 | /* |
2 | * $Id: rpxlite.c,v 1.22 2004/11/04 13:24:15 gleixner Exp $ | |
3 | * | |
4 | * Handle mapping of the flash on the RPX Lite and CLLF boards | |
5 | */ | |
6 | ||
7 | #include <linux/module.h> | |
8 | #include <linux/types.h> | |
9 | #include <linux/kernel.h> | |
10 | #include <linux/init.h> | |
11 | #include <asm/io.h> | |
12 | #include <linux/mtd/mtd.h> | |
13 | #include <linux/mtd/map.h> | |
14 | ||
15 | ||
16 | #define WINDOW_ADDR 0xfe000000 | |
17 | #define WINDOW_SIZE 0x800000 | |
18 | ||
19 | static struct mtd_info *mymtd; | |
20 | ||
21 | static struct map_info rpxlite_map = { | |
22 | .name = "RPX", | |
23 | .size = WINDOW_SIZE, | |
24 | .bankwidth = 4, | |
25 | .phys = WINDOW_ADDR, | |
26 | }; | |
27 | ||
28 | int __init init_rpxlite(void) | |
29 | { | |
30 | printk(KERN_NOTICE "RPX Lite or CLLF flash device: %x at %x\n", WINDOW_SIZE*4, WINDOW_ADDR); | |
31 | rpxlite_map.virt = ioremap(WINDOW_ADDR, WINDOW_SIZE * 4); | |
32 | ||
33 | if (!rpxlite_map.virt) { | |
34 | printk("Failed to ioremap\n"); | |
35 | return -EIO; | |
36 | } | |
37 | simple_map_init(&rpxlite_map); | |
38 | mymtd = do_map_probe("cfi_probe", &rpxlite_map); | |
39 | if (mymtd) { | |
40 | mymtd->owner = THIS_MODULE; | |
41 | add_mtd_device(mymtd); | |
42 | return 0; | |
43 | } | |
44 | ||
45 | iounmap((void *)rpxlite_map.virt); | |
46 | return -ENXIO; | |
47 | } | |
48 | ||
49 | static void __exit cleanup_rpxlite(void) | |
50 | { | |
51 | if (mymtd) { | |
52 | del_mtd_device(mymtd); | |
53 | map_destroy(mymtd); | |
54 | } | |
55 | if (rpxlite_map.virt) { | |
56 | iounmap((void *)rpxlite_map.virt); | |
57 | rpxlite_map.virt = 0; | |
58 | } | |
59 | } | |
60 | ||
61 | module_init(init_rpxlite); | |
62 | module_exit(cleanup_rpxlite); | |
63 | ||
64 | MODULE_LICENSE("GPL"); | |
65 | MODULE_AUTHOR("Arnold Christensen <AKC@pel.dk>"); | |
66 | MODULE_DESCRIPTION("MTD map driver for RPX Lite and CLLF boards"); |