ti-ocf-crypto-module: add crypto module for hw accel
[openembedded.git] / recipes / linux / linux-mtx-1-2.4.24 / 02-mtd-mtx-1-map.diff
blobba24bb1381c8eab45a0b309373dc0840ffc68474
1 diff -Nurb linux/drivers/mtd/maps/Config.in linux-mips-2.4.24-pre2+mtd-2004-01-27+mtx-map/drivers/mtd/maps/Config.in
2 --- linux/drivers/mtd/maps/Config.in 2004-11-17 18:17:59.049312400 +0100
3 +++ linux-mips-2.4.24-pre2+mtd-2004-01-27+mtx-map/drivers/mtd/maps/Config.in 2004-11-17 18:12:26.000000000 +0100
4 @@ -80,6 +80,7 @@
5 bool ' Db1x00 boot flash device' CONFIG_MTD_DB1X00_BOOT
6 bool ' Db1x00 user flash device (2nd bank)' CONFIG_MTD_DB1X00_USER
7 fi
8 + dep_tristate ' MTX-1 flash device' CONFIG_MTD_MTX1 $CONFIG_MIPS_MTX1
9 dep_tristate ' Flash chip mapping on ITE QED-4N-S01B, Globespan IVR or custom board' CONFIG_MTD_CSTM_MIPS_IXX $CONFIG_MTD_CFI $CONFIG_MTD_JEDEC $CONFIG_MTD_PARTITIONS
10 if [ "$CONFIG_MTD_CSTM_MIPS_IXX" = "y" -o "$CONFIG_MTD_CSTM_MIPS_IXX" = "m" ]; then
11 hex ' Physical start address of flash mapping' CONFIG_MTD_CSTM_MIPS_IXX_START 0x8000000
12 diff -Nurb linux/drivers/mtd/maps/Makefile linux-mips-2.4.24-pre2+mtd-2004-01-27+mtx-map/drivers/mtd/maps/Makefile
13 --- linux/drivers/mtd/maps/Makefile 2004-11-17 18:17:59.051312096 +0100
14 +++ linux-mips-2.4.24-pre2+mtd-2004-01-27+mtx-map/drivers/mtd/maps/Makefile 2004-11-17 18:12:26.000000000 +0100
15 @@ -49,6 +49,7 @@
16 obj-$(CONFIG_MTD_PCI) += pci.o
17 obj-$(CONFIG_MTD_PB1XXX) += pb1xxx-flash.o
18 obj-$(CONFIG_MTD_DB1X00) += db1x00-flash.o
19 +obj-$(CONFIG_MTD_MTX1) += mtx-1.o
20 obj-$(CONFIG_MTD_LASAT) += lasat.o
21 obj-$(CONFIG_MTD_AUTCPU12) += autcpu12-nvram.o
22 obj-$(CONFIG_MTD_EDB7312) += edb7312.o
23 diff -Nurb linux/drivers/mtd/maps/mtx-1.c linux-mips-2.4.24-pre2+mtd-2004-01-27+mtx-map/drivers/mtd/maps/mtx-1.c
24 --- linux/drivers/mtd/maps/mtx-1.c 2004-11-17 18:17:02.689880336 +0100
25 +++ linux-mips-2.4.24-pre2+mtd-2004-01-27+mtx-map/drivers/mtd/maps/mtx-1.c 2004-11-17 18:12:26.000000000 +0100
26 @@ -1,166 +1,78 @@
28 * Flash memory access on 4G Systems MTX-1 board
30 - * (C) 2003 Pete Popov <ppopov@mvista.com>
31 - * Bruno Randolf <bruno.randolf@4g-systems.de>
32 + * (C) Bruno Randolf (4G Systeme GmbH) <bruno.randolf@4g-systems.biz>
35 #include <linux/config.h>
36 #include <linux/module.h>
37 #include <linux/types.h>
38 #include <linux/kernel.h>
39 +#include <linux/init.h>
41 #include <linux/mtd/mtd.h>
42 #include <linux/mtd/map.h>
43 #include <linux/mtd/partitions.h>
45 #include <asm/io.h>
46 -#include <asm/au1000.h>
48 -#ifdef DEBUG_RW
49 -#define DBG(x...) printk(x)
50 -#else
51 -#define DBG(x...)
52 -#endif
54 -#ifdef CONFIG_MIPS_MTX1
55 #define WINDOW_ADDR 0x1E000000
56 #define WINDOW_SIZE 0x2000000
57 -#endif
59 -__u8 physmap_read8(struct map_info *map, unsigned long ofs)
61 - __u8 ret;
62 - ret = __raw_readb(map->map_priv_1 + ofs);
63 - DBG("read8 from %x, %x\n", (unsigned)(map->map_priv_1 + ofs), ret);
64 - return ret;
67 -__u16 physmap_read16(struct map_info *map, unsigned long ofs)
69 - __u16 ret;
70 - ret = __raw_readw(map->map_priv_1 + ofs);
71 - DBG("read16 from %x, %x\n", (unsigned)(map->map_priv_1 + ofs), ret);
72 - return ret;
75 -__u32 physmap_read32(struct map_info *map, unsigned long ofs)
77 - __u32 ret;
78 - ret = __raw_readl(map->map_priv_1 + ofs);
79 - DBG("read32 from %x, %x\n", (unsigned)(map->map_priv_1 + ofs), ret);
80 - return ret;
83 -void physmap_copy_from(struct map_info *map, void *to, unsigned long from, ssize_t len)
85 - DBG("physmap_copy from %x to %x\n", (unsigned)from, (unsigned)to);
86 - memcpy_fromio(to, map->map_priv_1 + from, len);
89 -void physmap_write8(struct map_info *map, __u8 d, unsigned long adr)
91 - DBG("write8 at %x, %x\n", (unsigned)(map->map_priv_1 + adr), d);
92 - __raw_writeb(d, map->map_priv_1 + adr);
93 - mb();
96 -void physmap_write16(struct map_info *map, __u16 d, unsigned long adr)
98 - DBG("write16 at %x, %x\n", (unsigned)(map->map_priv_1 + adr), d);
99 - __raw_writew(d, map->map_priv_1 + adr);
100 - mb();
103 -void physmap_write32(struct map_info *map, __u32 d, unsigned long adr)
105 - DBG("write32 at %x, %x\n", (unsigned)(map->map_priv_1 + adr), d);
106 - __raw_writel(d, map->map_priv_1 + adr);
107 - mb();
110 -void physmap_copy_to(struct map_info *map, unsigned long to, const void *from, ssize_t len)
112 - DBG("physmap_copy_to %x from %x\n", (unsigned)to, (unsigned)from);
113 - memcpy_toio(map->map_priv_1 + to, from, len);
117 +#define BUSWIDTH 4
119 static struct map_info mtx1_map = {
120 - name: "MTX-1 flash",
121 - read8: physmap_read8,
122 - read16: physmap_read16,
123 - read32: physmap_read32,
124 - copy_from: physmap_copy_from,
125 - write8: physmap_write8,
126 - write16: physmap_write16,
127 - write32: physmap_write32,
128 - copy_to: physmap_copy_to,
129 + .name = "MTX-1 flash",
130 + .size = WINDOW_SIZE,
131 + .buswidth = BUSWIDTH,
132 + .phys = WINDOW_ADDR
136 -static unsigned long flash_size = 0x01000000;
137 -static unsigned char flash_buswidth = 4;
138 static struct mtd_partition mtx1_partitions[] = {
140 - name: "user fs",
141 - size: 0x1c00000,
142 - offset: 0,
143 + .name = "user fs",
144 + .size = 0x1c00000,
145 + .offset = 0,
147 - name: "yamon",
148 - size: 0x0100000,
149 - offset: MTDPART_OFS_APPEND,
150 - mask_flags: MTD_WRITEABLE
151 + .name = "yamon",
152 + .size = 0x0100000,
153 + .offset = MTDPART_OFS_APPEND,
154 + .mask_flags = MTD_WRITEABLE /* force read-only */
156 - name: "raw kernel",
157 - size: 0x02c0000,
158 - offset: MTDPART_OFS_APPEND,
159 + .name = "raw kernel",
160 + .size = 0x02c0000,
161 + .offset = MTDPART_OFS_APPEND,
163 - name: "yamon env vars",
164 - size: 0x0040000,
165 - offset: MTDPART_OFS_APPEND,
166 - mask_flags: MTD_WRITEABLE
167 + .name = "yamon environment",
168 + .size = 0x0040000,
169 + .offset = MTDPART_OFS_APPEND,
170 + .mask_flags = MTD_WRITEABLE /* force read-only */
175 -#define NB_OF(x) (sizeof(x)/sizeof(x[0]))
177 -static struct mtd_partition *parsed_parts;
178 static struct mtd_info *mymtd;
180 int __init mtx1_mtd_init(void)
182 - struct mtd_partition *parts;
183 - int nb_parts = 0;
184 - char *part_type;
185 + printk(KERN_NOTICE "MTX-1 flash: probing %d-bit flash bus at %x\n",
186 + mtx1_map.buswidth*8, WINDOW_ADDR);
188 - /* Default flash buswidth */
189 - mtx1_map.buswidth = flash_buswidth;
190 + mtx1_map.virt = (unsigned long)ioremap(WINDOW_ADDR, WINDOW_SIZE);
191 + if (!mtx1_map.virt) {
192 + printk("mtx_mtd_init: failed to ioremap\n");
193 + return -EIO;
196 + simple_map_init(&mtx1_map);
198 - /*
199 - * Static partition definition selection
200 - */
201 - part_type = "static";
202 - parts = mtx1_partitions;
203 - nb_parts = NB_OF(mtx1_partitions);
204 - mtx1_map.size = flash_size;
206 - /*
207 - * Now let's probe for the actual flash. Do it here since
208 - * specific machine settings might have been set above.
209 - */
210 - printk(KERN_NOTICE "MTX-1 flash: probing %d-bit flash bus\n",
211 - mtx1_map.buswidth*8);
212 - mtx1_map.map_priv_1 =
213 - (unsigned long)ioremap(WINDOW_ADDR, WINDOW_SIZE);
214 mymtd = do_map_probe("cfi_probe", &mtx1_map);
215 - if (!mymtd) return -ENXIO;
216 - mymtd->module = THIS_MODULE;
217 + if (!mymtd) {
218 + iounmap(mtx1_map.virt);
219 + return -ENXIO;
222 + mymtd->owner = THIS_MODULE;
224 - add_mtd_partitions(mymtd, parts, nb_parts);
225 - return 0;
226 + return add_mtd_partitions(mymtd, mtx1_partitions, ARRAY_SIZE(mtx1_partitions));
229 static void __exit mtx1_mtd_cleanup(void)
230 @@ -168,14 +80,14 @@
231 if (mymtd) {
232 del_mtd_partitions(mymtd);
233 map_destroy(mymtd);
234 - if (parsed_parts)
235 - kfree(parsed_parts);
237 + if (mtx1_map.virt)
238 + iounmap(mtx1_map.virt);
241 module_init(mtx1_mtd_init);
242 module_exit(mtx1_mtd_cleanup);
244 -MODULE_AUTHOR("Pete Popov");
245 +MODULE_AUTHOR("Bruno Randolf <bruno.randolf@4g-systems.biz>");
246 MODULE_DESCRIPTION("MTX-1 CFI map driver");
247 MODULE_LICENSE("GPL");