2 * Flash memory access on Hynix GMS30C7201/HMS30C7202 based
5 * (C) 2002 Jungjun Kim <jungjun.kim@hynix.com>
6 * 2003 Thomas Gleixner <tglx@linutronix.de>
9 #include <linux/module.h>
10 #include <linux/types.h>
11 #include <linux/kernel.h>
12 #include <linux/init.h>
13 #include <linux/errno.h>
14 #include <linux/slab.h>
16 #include <linux/mtd/mtd.h>
17 #include <linux/mtd/map.h>
18 #include <linux/mtd/partitions.h>
19 #include <mach/hardware.h>
22 static struct mtd_info
*mymtd
;
24 static struct map_info h720x_map
= {
27 .size
= H720X_FLASH_SIZE
,
28 .phys
= H720X_FLASH_PHYS
,
31 static struct mtd_partition h720x_partitions
[] = {
36 .mask_flags
= MTD_WRITEABLE
41 .mask_flags
= MTD_WRITEABLE
46 .mask_flags
= MTD_WRITEABLE
51 .mask_flags
= MTD_WRITEABLE
54 .size
= MTDPART_SIZ_FULL
,
55 .offset
= MTDPART_OFS_APPEND
59 #define NUM_PARTITIONS ARRAY_SIZE(h720x_partitions)
62 * Initialize FLASH support
64 static int __init
h720x_mtd_init(void)
66 h720x_map
.virt
= ioremap(h720x_map
.phys
, h720x_map
.size
);
68 if (!h720x_map
.virt
) {
69 printk(KERN_ERR
"H720x-MTD: ioremap failed\n");
73 simple_map_init(&h720x_map
);
75 // Probe for flash bankwidth 4
76 printk (KERN_INFO
"H720x-MTD probing 32bit FLASH\n");
77 mymtd
= do_map_probe("cfi_probe", &h720x_map
);
79 printk (KERN_INFO
"H720x-MTD probing 16bit FLASH\n");
80 // Probe for bankwidth 2
81 h720x_map
.bankwidth
= 2;
82 mymtd
= do_map_probe("cfi_probe", &h720x_map
);
86 mymtd
->owner
= THIS_MODULE
;
88 mtd_device_parse_register(mymtd
, NULL
, NULL
,
89 h720x_partitions
, NUM_PARTITIONS
);
93 iounmap((void *)h720x_map
.virt
);
100 static void __exit
h720x_mtd_cleanup(void)
104 mtd_device_unregister(mymtd
);
108 if (h720x_map
.virt
) {
109 iounmap((void *)h720x_map
.virt
);
115 module_init(h720x_mtd_init
);
116 module_exit(h720x_mtd_cleanup
);
118 MODULE_LICENSE("GPL");
119 MODULE_AUTHOR("Thomas Gleixner <tglx@linutronix.de>");
120 MODULE_DESCRIPTION("MTD map driver for Hynix evaluation boards");