some platform support path name cleanup
[openwrt.git] / target / linux / magicbox-2.6 / patches / 002-flash_map.patch
1 diff -urN linux.old/drivers/mtd/maps/Kconfig linux.dev/drivers/mtd/maps/Kconfig
2 --- linux.old/drivers/mtd/maps/Kconfig 2006-08-30 06:30:59.000000000 +0200
3 +++ linux.dev/drivers/mtd/maps/Kconfig 2006-08-30 06:11:51.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 -urN linux.old/drivers/mtd/maps/magicmap.c linux.dev/drivers/mtd/maps/magicmap.c
21 --- linux.old/drivers/mtd/maps/magicmap.c 1970-01-01 01:00:00.000000000 +0100
22 +++ linux.dev/drivers/mtd/maps/magicmap.c 2006-08-30 06:52:34.000000000 +0200
23 @@ -0,0 +1,113 @@
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/autoconf.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 = "linux",
61 + .offset = 0x0,
62 + .size = 0x3c0000,
63 + },
64 + {
65 + .name = "rootfs",
66 + .offset = 0x100000,
67 + .size = 0x2c0000,
68 + },
69 + {
70 + .name = "bootloader",
71 + .offset = 0x3c0000,
72 + .size = 0x040000,
73 + .mask_flags = MTD_WRITEABLE,
74 + },
75 +};
76 +
77 +int __init init_magic(void)
78 +{
79 + u32 size, len;
80 +
81 + magic_map.virt =
82 + (void __iomem *)ioremap(magic_map.phys, magic_map.size);
83 +
84 + if (!magic_map.virt) {
85 + printk("Failed to ioremap flash.\n");
86 + return -EIO;
87 + }
88 +
89 + simple_map_init(&magic_map);
90 +
91 + flash = do_map_probe("cfi_probe", &magic_map);
92 + if (flash) {
93 + flash->owner = THIS_MODULE;
94 + if (flash->read(flash, 12, sizeof(u32), &len, (char *) &size) ||
95 + len != 4)
96 + return -ENXIO;
97 + size += 0x40; /* header size of the uImage */
98 + if (size < 0x400000) {
99 + /* skip to next erase block */
100 + if (size & (flash->erasesize - 1)) {
101 + size |= (flash->erasesize - 1);
102 + size += 1;
103 + }
104 + magic_partitions[1].offset = size;
105 + magic_partitions[1].size = magic_partitions[2].offset - size;
106 + }
107 +
108 + add_mtd_partitions(flash, magic_partitions,
109 + ARRAY_SIZE(magic_partitions));
110 + } else {
111 + printk("map probe failed for flash\n");
112 + return -ENXIO;
113 + }
114 +
115 + return 0;
116 +}
117 +
118 +static void __exit cleanup_magic(void)
119 +{
120 + if (flash) {
121 + del_mtd_partitions(flash);
122 + map_destroy(flash);
123 + }
124 +
125 + if (magic_map.virt) {
126 + iounmap((void *)magic_map.virt);
127 + magic_map.virt = NULL;
128 + }
129 +}
130 +
131 +module_init(init_magic);
132 +module_exit(cleanup_magic);
133 +
134 +MODULE_LICENSE("GPL");
135 +MODULE_AUTHOR("Karol Lewandowski");
136 +MODULE_DESCRIPTION("MTD map and partitions for IBM 405EP MagicBox boards");
137 diff -urN linux.old/drivers/mtd/maps/Makefile linux.dev/drivers/mtd/maps/Makefile
138 --- linux.old/drivers/mtd/maps/Makefile 2006-08-30 06:30:59.000000000 +0200
139 +++ linux.dev/drivers/mtd/maps/Makefile 2006-08-30 06:11:51.000000000 +0200
140 @@ -58,6 +58,7 @@
141 obj-$(CONFIG_MTD_BEECH) += beech-mtd.o
142 obj-$(CONFIG_MTD_ARCTIC) += arctic-mtd.o
143 obj-$(CONFIG_MTD_WALNUT) += walnut.o
144 +obj-$(CONFIG_MTD_MAGICMAP) += magicmap.o
145 obj-$(CONFIG_MTD_H720X) += h720x-flash.o
146 obj-$(CONFIG_MTD_SBC8240) += sbc8240.o
147 obj-$(CONFIG_MTD_NOR_TOTO) += omap-toto-flash.o
This page took 0.046228 seconds and 5 git commands to generate.