3 * Normal mappings of chips in physical memory
5 #include <linux/module.h>
6 #include <linux/types.h>
7 #include <linux/kernel.h>
8 #include <linux/init.h>
9 #include <linux/errno.h>
11 #include <linux/mtd/cfi.h>
12 #include <linux/mtd/mtd.h>
13 #include <linux/mtd/map.h>
14 #include <linux/mtd/partitions.h>
18 #define WINDOW_ADDR 0xff800000 // Flash Start addr.
19 #define WINDOW_SIZE 0x00800000 // Flash Size: 8 MB
22 #define NUM_PARTITIONS (sizeof(avnet5282_partitions) / sizeof (avnet5282_partitions[0]))
24 /*************************************************************************************/
26 static struct mtd_partition avnet5282_partitions
[] = {
28 .name
= "uboot (256 KB)",
31 .mask_flags
= MTD_WRITEABLE
34 .name
= "kernel (3 MB)",
39 .name
= "rootfs (4,75 MB)",
45 /*************************************************************************************/
47 struct map_info avnet5282_map
= {
48 .name
= "MCF5282 flash",
54 static struct mtd_info
*mymtd
;
56 /*************************************************************************************/
58 static int __init
init_avnet5282(void)
60 avnet5282_map
.virt
= ioremap(WINDOW_ADDR
, WINDOW_SIZE
);
62 if (avnet5282_map
.virt
== 0) {
63 printk(KERN_NOTICE
"Failed to ioremap FLASH memory area.\n");
66 simple_map_init(&avnet5282_map
);
68 mymtd
= do_map_probe("cfi_probe", &avnet5282_map
);
71 printk(KERN_NOTICE
"Flash 5282 error, can't map");
72 iounmap((void *)avnet5282_map
.virt
);
75 printk(KERN_NOTICE
"MCF5282 flash device: %dMiB at 0x%08x\n", mymtd
->size
>> 20, WINDOW_ADDR
);
77 mymtd
->owner
= THIS_MODULE
;
78 mymtd
->erasesize
= 0x40000;
80 add_mtd_partitions(mymtd
, avnet5282_partitions
, NUM_PARTITIONS
);
84 /*************************************************************************************/
86 static void __exit
cleanup_avnet5282(void)
89 del_mtd_partitions(mymtd
);
92 if (avnet5282_map
.virt
) {
93 iounmap((void *)avnet5282_map
.virt
);
94 avnet5282_map
.virt
= 0;
99 /*************************************************************************************/
101 module_init(init_avnet5282
);
102 module_exit(cleanup_avnet5282
);
104 MODULE_AUTHOR("Daniel Alomar i Claramonte");
105 MODULE_DESCRIPTION("Mapejat Xip Flash 28F640JA");
106 MODULE_LICENSE("GPL");
108 /*************************************************************************************/