2 * $Id: mbx860.c,v 1.6 2004/07/12 21:59:44 dwmw2 Exp $
4 * Handle mapping of the flash on MBX860 boards
6 * Author: Anton Todorov
7 * Copyright: (C) 2001 Emness Technology
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
15 #include <linux/module.h>
16 #include <linux/types.h>
17 #include <linux/kernel.h>
18 #include <linux/init.h>
20 #include <linux/mtd/mtd.h>
21 #include <linux/mtd/map.h>
22 #include <linux/mtd/partitions.h>
25 #define WINDOW_ADDR 0xfe000000
26 #define WINDOW_SIZE 0x00200000
28 /* Flash / Partition sizing */
29 #define MAX_SIZE_KiB 8192
30 #define BOOT_PARTITION_SIZE_KiB 512
31 #define KERNEL_PARTITION_SIZE_KiB 5632
32 #define APP_PARTITION_SIZE_KiB 2048
34 #define NUM_PARTITIONS 3
36 /* partition_info gives details on the logical partitions that the split the
37 * single flash device into. If the size if zero we use up to the end of the
39 static struct mtd_partition partition_info
[]={
40 { .name
= "MBX flash BOOT partition",
42 .size
= BOOT_PARTITION_SIZE_KiB
*1024 },
43 { .name
= "MBX flash DATA partition",
44 .offset
= BOOT_PARTITION_SIZE_KiB
*1024,
45 .size
= (KERNEL_PARTITION_SIZE_KiB
)*1024 },
46 { .name
= "MBX flash APPLICATION partition",
47 .offset
= (BOOT_PARTITION_SIZE_KiB
+KERNEL_PARTITION_SIZE_KiB
)*1024 }
51 static struct mtd_info
*mymtd
;
53 struct map_info mbx_map
= {
60 int __init
init_mbx(void)
62 printk(KERN_NOTICE
"Motorola MBX flash device: 0x%x at 0x%x\n", WINDOW_SIZE
*4, WINDOW_ADDR
);
63 mbx_map
.virt
= (unsigned long)ioremap(WINDOW_ADDR
, WINDOW_SIZE
* 4);
66 printk("Failed to ioremap\n");
69 simple_map_init(&mbx_map
);
71 mymtd
= do_map_probe("jedec_probe", &mbx_map
);
73 mymtd
->owner
= THIS_MODULE
;
74 add_mtd_device(mymtd
);
75 add_mtd_partitions(mymtd
, partition_info
, NUM_PARTITIONS
);
79 iounmap((void *)mbx_map
.virt
);
83 static void __exit
cleanup_mbx(void)
86 del_mtd_device(mymtd
);
90 iounmap((void *)mbx_map
.virt
);
95 module_init(init_mbx
);
96 module_exit(cleanup_mbx
);
98 MODULE_AUTHOR("Anton Todorov <a.todorov@emness.com>");
99 MODULE_DESCRIPTION("MTD map driver for Motorola MBX860 board");
100 MODULE_LICENSE("GPL");