aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/maps
diff options
context:
space:
mode:
authorSean Young <sean@mess.org>2005-06-29 05:46:19 -0400
committerThomas Gleixner <tglx@mtd.linutronix.de>2005-11-06 18:32:01 -0500
commit28f462308e0fcd30dcab4c50862881dfb68a627c (patch)
treef6b46e88402617dc1c34c924a395f8d92dfc02c0 /drivers/mtd/maps
parent15fdc52f35b853e3fa550087987b5ee4ffbd199b (diff)
[MTD] maps/ts5500: Fix partition support. Code cleanup
Signed-off-by: Sean Young <sean@mess.org> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'drivers/mtd/maps')
-rw-r--r--drivers/mtd/maps/ts5500_flash.c38
1 files changed, 12 insertions, 26 deletions
diff --git a/drivers/mtd/maps/ts5500_flash.c b/drivers/mtd/maps/ts5500_flash.c
index 286dd82e8b83..2762da954318 100644
--- a/drivers/mtd/maps/ts5500_flash.c
+++ b/drivers/mtd/maps/ts5500_flash.c
@@ -23,20 +23,18 @@
23 * - If you have created your own jffs file system and the bios overwrites 23 * - If you have created your own jffs file system and the bios overwrites
24 * 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.
25 * 25 *
26 * $Id: ts5500_flash.c,v 1.3 2005/06/16 08:49:30 sean Exp $ 26 * $Id: ts5500_flash.c,v 1.4 2005/06/29 09:29:43 sean Exp $
27 */ 27 */
28 28
29#include <linux/config.h> 29#include <linux/config.h>
30#include <linux/init.h>
30#include <linux/module.h> 31#include <linux/module.h>
31#include <linux/types.h>
32#include <linux/kernel.h> 32#include <linux/kernel.h>
33#include <linux/init.h>
34#include <linux/mtd/mtd.h>
35#include <linux/mtd/map.h> 33#include <linux/mtd/map.h>
36 34#include <linux/mtd/mtd.h>
37#ifdef CONFIG_MTD_PARTITIONS
38#include <linux/mtd/partitions.h> 35#include <linux/mtd/partitions.h>
39#endif 36#include <linux/types.h>
37
40 38
41#define WINDOW_ADDR 0x09400000 39#define WINDOW_ADDR 0x09400000
42#define WINDOW_SIZE 0x00200000 40#define WINDOW_SIZE 0x00200000
@@ -48,7 +46,6 @@ static struct map_info ts5500_map = {
48 .phys = WINDOW_ADDR 46 .phys = WINDOW_ADDR
49}; 47};
50 48
51#ifdef CONFIG_MTD_PARTITIONS
52static struct mtd_partition ts5500_partitions[] = { 49static struct mtd_partition ts5500_partitions[] = {
53 { 50 {
54 .name = "Drive A", 51 .name = "Drive A",
@@ -69,8 +66,6 @@ static struct mtd_partition ts5500_partitions[] = {
69 66
70#define NUM_PARTITIONS (sizeof(ts5500_partitions)/sizeof(struct mtd_partition)) 67#define NUM_PARTITIONS (sizeof(ts5500_partitions)/sizeof(struct mtd_partition))
71 68
72#endif
73
74static struct mtd_info *mymtd; 69static struct mtd_info *mymtd;
75 70
76static int __init init_ts5500_map(void) 71static int __init init_ts5500_map(void)
@@ -79,48 +74,39 @@ static int __init init_ts5500_map(void)
79 74
80 ts5500_map.virt = ioremap_nocache(ts5500_map.phys, ts5500_map.size); 75 ts5500_map.virt = ioremap_nocache(ts5500_map.phys, ts5500_map.size);
81 76
82 if(!ts5500_map.virt) { 77 if (!ts5500_map.virt) {
83 printk(KERN_ERR "Failed to ioremap_nocache\n"); 78 printk(KERN_ERR "Failed to ioremap_nocache\n");
84 rc = -EIO; 79 rc = -EIO;
85 goto err_out_ioremap; 80 goto err2;
86 } 81 }
87 82
88 simple_map_init(&ts5500_map); 83 simple_map_init(&ts5500_map);
89 84
90 mymtd = do_map_probe("jedec_probe", &ts5500_map); 85 mymtd = do_map_probe("jedec_probe", &ts5500_map);
91 if(!mymtd) 86 if (!mymtd)
92 mymtd = do_map_probe("map_rom", &ts5500_map); 87 mymtd = do_map_probe("map_rom", &ts5500_map);
93 88
94 if(!mymtd) { 89 if (!mymtd) {
95 rc = -ENXIO; 90 rc = -ENXIO;
96 goto err_out_map; 91 goto err1;
97 } 92 }
98 93
99 mymtd->owner = THIS_MODULE; 94 mymtd->owner = THIS_MODULE;
100#ifdef CONFIG_MTD_PARTITIONS
101 add_mtd_partitions(mymtd, ts5500_partitions, NUM_PARTITIONS); 95 add_mtd_partitions(mymtd, ts5500_partitions, NUM_PARTITIONS);
102#else
103 add_mtd_device(mymtd);
104#endif
105 96
106 return 0; 97 return 0;
107 98
108err_out_map: 99err1:
109 map_destroy(mymtd); 100 map_destroy(mymtd);
110err_out_ioremap:
111 iounmap(ts5500_map.virt); 101 iounmap(ts5500_map.virt);
112 102err2:
113 return rc; 103 return rc;
114} 104}
115 105
116static void __exit cleanup_ts5500_map(void) 106static void __exit cleanup_ts5500_map(void)
117{ 107{
118 if (mymtd) { 108 if (mymtd) {
119#ifdef CONFIG_MTD_PARTITIONS
120 del_mtd_partitions(mymtd); 109 del_mtd_partitions(mymtd);
121#else
122 del_mtd_device(mymtd);
123#endif
124 map_destroy(mymtd); 110 map_destroy(mymtd);
125 } 111 }
126 112