[TG3]: Set minimal hw interrupt mitigation.
[linux-2.6/verdex.git] / drivers / mtd / maps / iq80310.c
blob558d014e7acc0365adb8b8d2bb3ec502bf73ca0b
1 /*
2 * $Id: iq80310.c,v 1.20 2004/11/04 13:24:15 gleixner Exp $
4 * Mapping for the Intel XScale IQ80310 evaluation board
6 * Author: Nicolas Pitre
7 * Copyright: (C) 2001 MontaVista Software Inc.
8 *
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>
19 #include <asm/io.h>
20 #include <linux/mtd/mtd.h>
21 #include <linux/mtd/map.h>
22 #include <linux/mtd/partitions.h>
25 #define WINDOW_ADDR 0
26 #define WINDOW_SIZE 8*1024*1024
27 #define BUSWIDTH 1
29 static struct mtd_info *mymtd;
31 static struct map_info iq80310_map = {
32 .name = "IQ80310 flash",
33 .size = WINDOW_SIZE,
34 .bankwidth = BUSWIDTH,
35 .phys = WINDOW_ADDR
38 static struct mtd_partition iq80310_partitions[4] = {
40 .name = "Firmware",
41 .size = 0x00080000,
42 .offset = 0,
43 .mask_flags = MTD_WRITEABLE /* force read-only */
44 },{
45 .name = "Kernel",
46 .size = 0x000a0000,
47 .offset = 0x00080000,
48 },{
49 .name = "Filesystem",
50 .size = 0x00600000,
51 .offset = 0x00120000
52 },{
53 .name = "RedBoot",
54 .size = 0x000e0000,
55 .offset = 0x00720000,
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;
67 int nb_parts = 0;
68 int parsed_nr_parts = 0;
69 int ret;
71 iq80310_map.virt = ioremap(WINDOW_ADDR, WINDOW_SIZE);
72 if (!iq80310_map.virt) {
73 printk("Failed to ioremap\n");
74 return -EIO;
76 simple_map_init(&iq80310_map);
78 mymtd = do_map_probe("cfi_probe", &iq80310_map);
79 if (!mymtd) {
80 iounmap((void *)iq80310_map.virt);
81 return -ENXIO;
83 mymtd->owner = THIS_MODULE;
85 ret = parse_mtd_partitions(mymtd, probes, &parsed_parts, 0);
87 if (ret > 0)
88 parsed_nr_parts = ret;
90 if (parsed_nr_parts > 0) {
91 parts = parsed_parts;
92 nb_parts = parsed_nr_parts;
93 } else {
94 parts = iq80310_partitions;
95 nb_parts = ARRAY_SIZE(iq80310_partitions);
97 add_mtd_partitions(mymtd, parts, nb_parts);
98 return 0;
101 static void __exit cleanup_iq80310(void)
103 if (mymtd) {
104 del_mtd_partitions(mymtd);
105 map_destroy(mymtd);
106 if (parsed_parts)
107 kfree(parsed_parts);
109 if (iq80310_map.virt)
110 iounmap((void *)iq80310_map.virt);
113 module_init(init_iq80310);
114 module_exit(cleanup_iq80310);
117 MODULE_LICENSE("GPL");
118 MODULE_AUTHOR("Nicolas Pitre <nico@cam.org>");
119 MODULE_DESCRIPTION("MTD map driver for Intel XScale IQ80310 evaluation board");