2 * $Id: iq80310.c,v 1.21 2005/11/07 11:14:27 gleixner Exp $
4 * Mapping for the Intel XScale IQ80310 evaluation board
6 * Author: Nicolas Pitre
7 * Copyright: (C) 2001 MontaVista Software Inc.
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.
14 #include <linux/module.h>
15 #include <linux/types.h>
16 #include <linux/kernel.h>
17 #include <linux/init.h>
18 #include <linux/slab.h>
20 #include <linux/mtd/mtd.h>
21 #include <linux/mtd/map.h>
22 #include <linux/mtd/partitions.h>
26 #define WINDOW_SIZE 8*1024*1024
29 static struct mtd_info *mymtd;
31 static struct map_info iq80310_map = {
32 .name = "IQ80310 flash",
34 .bankwidth = BUSWIDTH,
38 static struct mtd_partition iq80310_partitions[4] = {
43 .mask_flags = MTD_WRITEABLE /* force read-only */
56 .mask_flags = MTD_WRITEABLE
60 static struct mtd_info *mymtd;
61 static struct mtd_partition *parsed_parts;
62 static const char *probes[] = { "RedBoot", "cmdlinepart", NULL };
64 static int __init init_iq80310(void)
66 struct mtd_partition *parts;
68 int parsed_nr_parts = 0;
71 iq80310_map.virt = ioremap(WINDOW_ADDR, WINDOW_SIZE);
72 if (!iq80310_map.virt) {
73 printk("Failed to ioremap\n");
76 simple_map_init(&iq80310_map);
78 mymtd = do_map_probe("cfi_probe", &iq80310_map);
80 iounmap((void *)iq80310_map.virt);
83 mymtd->owner = THIS_MODULE;
85 ret = parse_mtd_partitions(mymtd, probes, &parsed_parts, 0);
88 parsed_nr_parts = ret;
90 if (parsed_nr_parts > 0) {
92 nb_parts = parsed_nr_parts;
94 parts = iq80310_partitions;
95 nb_parts = ARRAY_SIZE(iq80310_partitions);
97 add_mtd_partitions(mymtd, parts, nb_parts);
101 static void __exit cleanup_iq80310(void)
104 del_mtd_partitions(mymtd);
108 if (iq80310_map.virt)
109 iounmap((void *)iq80310_map.virt);
112 module_init(init_iq80310);
113 module_exit(cleanup_iq80310);
116 MODULE_LICENSE("GPL");
117 MODULE_AUTHOR("Nicolas Pitre <nico@cam.org>");
118 MODULE_DESCRIPTION("MTD map driver for Intel XScale IQ80310 evaluation board");