2 * UC-7110-LX Version 2 Flash mapping driver
5 //#include <linux/config.h>
6 #include <asm/arch/moxa.h>
7 #include <linux/module.h>
8 #include <linux/types.h>
9 #include <linux/kernel.h>
10 #include <linux/init.h>
11 #include <linux/ioport.h>
13 #include <linux/mtd/mtd.h>
14 #include <linux/mtd/map.h>
15 #include <linux/mtd/partitions.h>
19 #define WINDOW_ADDR CONFIG_FLASH_MEM_BASE
20 //#define WINDOW_SIZE CONFIG_FLASH_SIZE
21 #define WINDOW_SIZE 0x00800000
22 #define UC7110_FLASH_SIZE 0x00800000
24 #define RW_PART0_OF 0x0
25 #define RW_PART0_SZ 0x40000 /* Bootloader */
26 #define RW_PART1_OF (RW_PART0_OF+RW_PART0_SZ)
27 #define RW_PART1_SZ 0x200000 /* Kernel */
28 #define RW_PART2_OF (RW_PART1_OF+RW_PART1_SZ)
29 #define RW_PART2_SZ (0x280000-RW_PART0_SZ) /* root file system - JFFS2 */
30 #define RW_PART3_OF (RW_PART2_OF+RW_PART2_SZ)
31 #define RW_PART3_SZ (UC7110_FLASH_SIZE-RW_PART3_OF) /* user disk - JFFS2 */
33 static struct mtd_partition moxart_flash_partitions
[] = {
36 .offset
= RW_PART0_OF
,
40 .name
= "LinuxKernel",
41 .offset
= RW_PART1_OF
,
43 //.mask_flags = MTD_WRITEABLE
46 .name
= "RootFileSystem",
47 .offset
= RW_PART2_OF
,
49 //.mask_flags = MTD_WRITEABLE
53 .offset
= RW_PART3_OF
,
57 struct map_info moxart_flash_map
= {
58 .name
= "EM1220 FLASH",
62 .virt
= IO_ADDRESS(WINDOW_ADDR
),
66 #define NUM_MOXART_FLASH_PARTITIONS ARRAY_SIZE(moxart_flash_partitions)
68 static struct mtd_info
*moxart_mtd
;
70 int __init
init_moxart_flash(void)
72 printk(KERN_NOTICE
"moxart: flash mapping: 0x%x at 0x%x\n",
73 WINDOW_SIZE
, WINDOW_ADDR
);
75 simple_map_init(&moxart_flash_map
);
77 moxart_mtd
= do_map_probe("cfi_probe",&moxart_flash_map
);
80 moxart_mtd
->owner
= THIS_MODULE
;
81 return add_mtd_partitions(moxart_mtd
,
82 moxart_flash_partitions
,
83 NUM_MOXART_FLASH_PARTITIONS
);
89 static void __exit
cleanup_moxart_flash(void)
92 del_mtd_partitions(moxart_mtd
);
93 /* moved iounmap after map_destroy - armin */
94 map_destroy(moxart_mtd
);
98 module_init(init_moxart_flash
);
99 module_exit(cleanup_moxart_flash
);
101 MODULE_LICENSE("GPL");
102 MODULE_AUTHOR("Jimmy_chen@moxa.com.tw");
103 MODULE_DESCRIPTION("MTD map driver for the EM1220-LX for DLin ODM");