diff options
Diffstat (limited to 'drivers/mtd/maps/lasat.c')
-rw-r--r-- | drivers/mtd/maps/lasat.c | 102 |
1 files changed, 102 insertions, 0 deletions
diff --git a/drivers/mtd/maps/lasat.c b/drivers/mtd/maps/lasat.c new file mode 100644 index 000000000000..c658d4045ef2 --- /dev/null +++ b/drivers/mtd/maps/lasat.c | |||
@@ -0,0 +1,102 @@ | |||
1 | /* | ||
2 | * Flash device on Lasat 100 and 200 boards | ||
3 | * | ||
4 | * (C) 2002 Brian Murphy <brian@murphy.dk> | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or | ||
7 | * modify it under the terms of the GNU General Public License version | ||
8 | * 2 as published by the Free Software Foundation. | ||
9 | * | ||
10 | * $Id: lasat.c,v 1.9 2004/11/04 13:24:15 gleixner Exp $ | ||
11 | * | ||
12 | */ | ||
13 | |||
14 | #include <linux/module.h> | ||
15 | #include <linux/types.h> | ||
16 | #include <linux/kernel.h> | ||
17 | #include <linux/init.h> | ||
18 | #include <asm/io.h> | ||
19 | #include <linux/mtd/mtd.h> | ||
20 | #include <linux/mtd/map.h> | ||
21 | #include <linux/mtd/partitions.h> | ||
22 | #include <linux/config.h> | ||
23 | #include <asm/lasat/lasat.h> | ||
24 | |||
25 | static struct mtd_info *lasat_mtd; | ||
26 | |||
27 | static struct mtd_partition partition_info[LASAT_MTD_LAST]; | ||
28 | static char *lasat_mtd_partnames[] = {"Bootloader", "Service", "Normal", "Filesystem", "Config"}; | ||
29 | |||
30 | static void lasat_set_vpp(struct map_info *map, int vpp) | ||
31 | { | ||
32 | if (vpp) | ||
33 | *lasat_misc->flash_wp_reg |= 1 << lasat_misc->flash_wp_bit; | ||
34 | else | ||
35 | *lasat_misc->flash_wp_reg &= ~(1 << lasat_misc->flash_wp_bit); | ||
36 | } | ||
37 | |||
38 | static struct map_info lasat_map = { | ||
39 | .name = "LASAT flash", | ||
40 | .bankwidth = 4, | ||
41 | .set_vpp = lasat_set_vpp | ||
42 | }; | ||
43 | |||
44 | static int __init init_lasat(void) | ||
45 | { | ||
46 | int i; | ||
47 | /* since we use AMD chips and set_vpp is not implimented | ||
48 | * for these (yet) we still have to permanently enable flash write */ | ||
49 | printk(KERN_NOTICE "Unprotecting flash\n"); | ||
50 | ENABLE_VPP((&lasat_map)); | ||
51 | |||
52 | lasat_map.phys = lasat_flash_partition_start(LASAT_MTD_BOOTLOADER); | ||
53 | lasat_map.virt = ioremap_nocache( | ||
54 | lasat_map.phys, lasat_board_info.li_flash_size); | ||
55 | lasat_map.size = lasat_board_info.li_flash_size; | ||
56 | |||
57 | simple_map_init(&lasat_map); | ||
58 | |||
59 | for (i=0; i < LASAT_MTD_LAST; i++) | ||
60 | partition_info[i].name = lasat_mtd_partnames[i]; | ||
61 | |||
62 | lasat_mtd = do_map_probe("cfi_probe", &lasat_map); | ||
63 | |||
64 | if (!lasat_mtd) | ||
65 | lasat_mtd = do_map_probe("jedec_probe", &lasat_map); | ||
66 | |||
67 | if (lasat_mtd) { | ||
68 | u32 size, offset = 0; | ||
69 | |||
70 | lasat_mtd->owner = THIS_MODULE; | ||
71 | |||
72 | for (i=0; i < LASAT_MTD_LAST; i++) { | ||
73 | size = lasat_flash_partition_size(i); | ||
74 | partition_info[i].size = size; | ||
75 | partition_info[i].offset = offset; | ||
76 | offset += size; | ||
77 | } | ||
78 | |||
79 | add_mtd_partitions( lasat_mtd, partition_info, LASAT_MTD_LAST ); | ||
80 | return 0; | ||
81 | } | ||
82 | |||
83 | return -ENXIO; | ||
84 | } | ||
85 | |||
86 | static void __exit cleanup_lasat(void) | ||
87 | { | ||
88 | if (lasat_mtd) { | ||
89 | del_mtd_partitions(lasat_mtd); | ||
90 | map_destroy(lasat_mtd); | ||
91 | } | ||
92 | if (lasat_map.virt) { | ||
93 | lasat_map.virt = 0; | ||
94 | } | ||
95 | } | ||
96 | |||
97 | module_init(init_lasat); | ||
98 | module_exit(cleanup_lasat); | ||
99 | |||
100 | MODULE_LICENSE("GPL"); | ||
101 | MODULE_AUTHOR("Brian Murphy <brian@murphy.dk>"); | ||
102 | MODULE_DESCRIPTION("Lasat Safepipe/Masquerade MTD map driver"); | ||