split magicbox patch
[openwrt/svn-archive/archive.git] / openwrt / target / linux / magicbox-2.6 / patches / 002-flash_map.patch
1 diff -Nur linux-2.6.17/drivers/mtd/maps/Kconfig linux-2.6.17-owrt/drivers/mtd/maps/Kconfig
2 --- linux-2.6.17/drivers/mtd/maps/Kconfig 2006-06-18 03:49:35.000000000 +0200
3 +++ linux-2.6.17-owrt/drivers/mtd/maps/Kconfig 2006-08-25 23:33:05.000000000 +0200
4 @@ -323,6 +323,15 @@
5 Walnut board. If you have one of these boards and would like to
6 use the flash chips on it, say 'Y'.
7
8 +config MTD_MAGICMAP
9 + tristate "Flash device mapped on IBM 405EP MagicBox"
10 + depends on MTD_CFI && MTD_PARTITIONS && 40x && MAGICBOX
11 + help
12 + This enables access routines for the flash chips on the IBM 405EP
13 + MagicBox board. If you have one of these boards and would like to
14 + use the flash chips on it, say 'Y'.
15 +
16 +
17 config MTD_EBONY
18 tristate "Flash devices mapped on IBM 440GP Ebony"
19 depends on MTD_JEDECPROBE && EBONY
20 diff -Nur linux-2.6.17/drivers/mtd/maps/magicmap.c linux-2.6.17-owrt/drivers/mtd/maps/magicmap.c
21 --- linux-2.6.17/drivers/mtd/maps/magicmap.c 1970-01-01 01:00:00.000000000 +0100
22 +++ linux-2.6.17-owrt/drivers/mtd/maps/magicmap.c 2006-08-25 23:33:05.000000000 +0200
23 @@ -0,0 +1,102 @@
24 +/*
25 + * magicmap.c: Copyleft 2005 Karol Lewandowski
26 + *
27 + * Mapping for MagicBox flash.
28 + * Based on walnut.c.
29 + *
30 + * Heikki Lindholm <holindho@infradead.org>
31 + *
32 + *
33 + * This program is free software; you can redistribute it and/or modify it
34 + * under the terms of the GNU General Public License as published by the
35 + * Free Software Foundation; either version 2 of the License, or (at your
36 + * option) any later version.
37 + */
38 +
39 +#include <linux/module.h>
40 +#include <linux/types.h>
41 +#include <linux/kernel.h>
42 +#include <linux/init.h>
43 +#include <linux/mtd/mtd.h>
44 +#include <linux/mtd/map.h>
45 +#include <linux/mtd/partitions.h>
46 +#include <linux/config.h>
47 +#include <asm/io.h>
48 +
49 +static struct mtd_info *flash;
50 +
51 +static struct map_info magic_map = {
52 + .name = "Magically mapped flash",
53 + .phys = 0xffc00000,
54 + .size = 0x400000,
55 + .bankwidth = 2,
56 +};
57 +
58 +static struct mtd_partition magic_partitions[] = {
59 + {
60 + .name = "kernel",
61 + .offset = 0x0,
62 + .size = 0x0e0000,
63 + },
64 + {
65 + .name = "ramdisk",
66 + .offset = 0x0e0000,
67 + .size = 0x2c0000,
68 + },
69 + {
70 + .name = "persistent",
71 + .offset = 0x3a0000,
72 + .size = 0x020000,
73 + },
74 + {
75 + .name = "bootloader",
76 + .offset = 0x3c0000,
77 + .size = 0x040000,
78 + .mask_flags = MTD_WRITEABLE,
79 + },
80 +};
81 +
82 +int __init init_magic(void)
83 +{
84 + magic_map.virt =
85 + (void __iomem *)ioremap(magic_map.phys, magic_map.size);
86 +
87 + if (!magic_map.virt) {
88 + printk("Failed to ioremap flash.\n");
89 + return -EIO;
90 + }
91 +
92 + simple_map_init(&magic_map);
93 +
94 + flash = do_map_probe("cfi_probe", &magic_map);
95 + if (flash) {
96 + flash->owner = THIS_MODULE;
97 + add_mtd_partitions(flash, magic_partitions,
98 + ARRAY_SIZE(magic_partitions));
99 + } else {
100 + printk("map probe failed for flash\n");
101 + return -ENXIO;
102 + }
103 +
104 + return 0;
105 +}
106 +
107 +static void __exit cleanup_magic(void)
108 +{
109 + if (flash) {
110 + del_mtd_partitions(flash);
111 + map_destroy(flash);
112 + }
113 +
114 + if (magic_map.virt) {
115 + iounmap((void *)magic_map.virt);
116 + magic_map.virt = NULL;
117 + }
118 +}
119 +
120 +module_init(init_magic);
121 +module_exit(cleanup_magic);
122 +
123 +MODULE_LICENSE("GPL");
124 +MODULE_AUTHOR("Karol Lewandowski");
125 +MODULE_DESCRIPTION("MTD map and partitions for IBM 405EP MagicBox boards");
126 diff -Nur linux-2.6.17/drivers/mtd/maps/Makefile linux-2.6.17-owrt/drivers/mtd/maps/Makefile
127 --- linux-2.6.17/drivers/mtd/maps/Makefile 2006-06-18 03:49:35.000000000 +0200
128 +++ linux-2.6.17-owrt/drivers/mtd/maps/Makefile 2006-08-25 23:33:05.000000000 +0200
129 @@ -58,6 +58,7 @@
130 obj-$(CONFIG_MTD_BEECH) += beech-mtd.o
131 obj-$(CONFIG_MTD_ARCTIC) += arctic-mtd.o
132 obj-$(CONFIG_MTD_WALNUT) += walnut.o
133 +obj-$(CONFIG_MTD_MAGICMAP) += magicmap.o
134 obj-$(CONFIG_MTD_H720X) += h720x-flash.o
135 obj-$(CONFIG_MTD_SBC8240) += sbc8240.o
136 obj-$(CONFIG_MTD_NOR_TOTO) += omap-toto-flash.o
137