diff options
Diffstat (limited to 'drivers/mtd/maps/ts5500_flash.c')
-rw-r--r-- | drivers/mtd/maps/ts5500_flash.c | 44 |
1 files changed, 14 insertions, 30 deletions
diff --git a/drivers/mtd/maps/ts5500_flash.c b/drivers/mtd/maps/ts5500_flash.c index 3ebd90f56503..4b372bcb17f1 100644 --- a/drivers/mtd/maps/ts5500_flash.c +++ b/drivers/mtd/maps/ts5500_flash.c | |||
@@ -19,26 +19,22 @@ | |||
19 | * | 19 | * |
20 | * Note: | 20 | * Note: |
21 | * - In order for detection to work, jumper 3 must be set. | 21 | * - In order for detection to work, jumper 3 must be set. |
22 | * - Drive A and B use a proprietary FTL from General Software which isn't | 22 | * - Drive A and B use the resident flash disk (RFD) flash translation layer. |
23 | * supported as of yet so standard drives can't be mounted; you can create | 23 | * - If you have created your own jffs file system and the bios overwrites |
24 | * your own (e.g. jffs) file system. | ||
25 | * - If you have created your own jffs file system and the bios overwrites | ||
26 | * it during boot, try disabling Drive A: and B: in the boot order. | 24 | * it during boot, try disabling Drive A: and B: in the boot order. |
27 | * | 25 | * |
28 | * $Id: ts5500_flash.c,v 1.2 2004/11/28 09:40:40 dwmw2 Exp $ | 26 | * $Id: ts5500_flash.c,v 1.5 2005/11/07 11:14:28 gleixner Exp $ |
29 | */ | 27 | */ |
30 | 28 | ||
31 | #include <linux/config.h> | 29 | #include <linux/config.h> |
30 | #include <linux/init.h> | ||
32 | #include <linux/module.h> | 31 | #include <linux/module.h> |
33 | #include <linux/types.h> | ||
34 | #include <linux/kernel.h> | 32 | #include <linux/kernel.h> |
35 | #include <linux/init.h> | ||
36 | #include <linux/mtd/mtd.h> | ||
37 | #include <linux/mtd/map.h> | 33 | #include <linux/mtd/map.h> |
38 | 34 | #include <linux/mtd/mtd.h> | |
39 | #ifdef CONFIG_MTD_PARTITIONS | ||
40 | #include <linux/mtd/partitions.h> | 35 | #include <linux/mtd/partitions.h> |
41 | #endif | 36 | #include <linux/types.h> |
37 | |||
42 | 38 | ||
43 | #define WINDOW_ADDR 0x09400000 | 39 | #define WINDOW_ADDR 0x09400000 |
44 | #define WINDOW_SIZE 0x00200000 | 40 | #define WINDOW_SIZE 0x00200000 |
@@ -50,7 +46,6 @@ static struct map_info ts5500_map = { | |||
50 | .phys = WINDOW_ADDR | 46 | .phys = WINDOW_ADDR |
51 | }; | 47 | }; |
52 | 48 | ||
53 | #ifdef CONFIG_MTD_PARTITIONS | ||
54 | static struct mtd_partition ts5500_partitions[] = { | 49 | static struct mtd_partition ts5500_partitions[] = { |
55 | { | 50 | { |
56 | .name = "Drive A", | 51 | .name = "Drive A", |
@@ -71,8 +66,6 @@ static struct mtd_partition ts5500_partitions[] = { | |||
71 | 66 | ||
72 | #define NUM_PARTITIONS (sizeof(ts5500_partitions)/sizeof(struct mtd_partition)) | 67 | #define NUM_PARTITIONS (sizeof(ts5500_partitions)/sizeof(struct mtd_partition)) |
73 | 68 | ||
74 | #endif | ||
75 | |||
76 | static struct mtd_info *mymtd; | 69 | static struct mtd_info *mymtd; |
77 | 70 | ||
78 | static int __init init_ts5500_map(void) | 71 | static int __init init_ts5500_map(void) |
@@ -81,48 +74,39 @@ static int __init init_ts5500_map(void) | |||
81 | 74 | ||
82 | ts5500_map.virt = ioremap_nocache(ts5500_map.phys, ts5500_map.size); | 75 | ts5500_map.virt = ioremap_nocache(ts5500_map.phys, ts5500_map.size); |
83 | 76 | ||
84 | if(!ts5500_map.virt) { | 77 | if (!ts5500_map.virt) { |
85 | printk(KERN_ERR "Failed to ioremap_nocache\n"); | 78 | printk(KERN_ERR "Failed to ioremap_nocache\n"); |
86 | rc = -EIO; | 79 | rc = -EIO; |
87 | goto err_out_ioremap; | 80 | goto err2; |
88 | } | 81 | } |
89 | 82 | ||
90 | simple_map_init(&ts5500_map); | 83 | simple_map_init(&ts5500_map); |
91 | 84 | ||
92 | mymtd = do_map_probe("jedec_probe", &ts5500_map); | 85 | mymtd = do_map_probe("jedec_probe", &ts5500_map); |
93 | if(!mymtd) | 86 | if (!mymtd) |
94 | mymtd = do_map_probe("map_rom", &ts5500_map); | 87 | mymtd = do_map_probe("map_rom", &ts5500_map); |
95 | 88 | ||
96 | if(!mymtd) { | 89 | if (!mymtd) { |
97 | rc = -ENXIO; | 90 | rc = -ENXIO; |
98 | goto err_out_map; | 91 | goto err1; |
99 | } | 92 | } |
100 | 93 | ||
101 | mymtd->owner = THIS_MODULE; | 94 | mymtd->owner = THIS_MODULE; |
102 | #ifdef CONFIG_MTD_PARTITIONS | ||
103 | add_mtd_partitions(mymtd, ts5500_partitions, NUM_PARTITIONS); | 95 | add_mtd_partitions(mymtd, ts5500_partitions, NUM_PARTITIONS); |
104 | #else | ||
105 | add_mtd_device(mymtd); | ||
106 | #endif | ||
107 | 96 | ||
108 | return 0; | 97 | return 0; |
109 | 98 | ||
110 | err_out_map: | 99 | err1: |
111 | map_destroy(mymtd); | 100 | map_destroy(mymtd); |
112 | err_out_ioremap: | ||
113 | iounmap(ts5500_map.virt); | 101 | iounmap(ts5500_map.virt); |
114 | 102 | err2: | |
115 | return rc; | 103 | return rc; |
116 | } | 104 | } |
117 | 105 | ||
118 | static void __exit cleanup_ts5500_map(void) | 106 | static void __exit cleanup_ts5500_map(void) |
119 | { | 107 | { |
120 | if (mymtd) { | 108 | if (mymtd) { |
121 | #ifdef CONFIG_MTD_PARTITIONS | ||
122 | del_mtd_partitions(mymtd); | 109 | del_mtd_partitions(mymtd); |
123 | #else | ||
124 | del_mtd_device(mymtd); | ||
125 | #endif | ||
126 | map_destroy(mymtd); | 110 | map_destroy(mymtd); |
127 | } | 111 | } |
128 | 112 | ||