ar71xx: fix mac address for 5GHz interface on WNDR3700
[openwrt.git] / target / linux / pxa / patches-2.6.21 / 007-flash.patch
1 --- /dev/null
2 +++ b/drivers/mtd/maps/gumstix-flash.c
3 @@ -0,0 +1,136 @@
4 +/*
5 + * Map driver for the Gumstix platform
6 + *
7 + * Author: Craig Hughes
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.
12 + */
13 +
14 +#include <linux/module.h>
15 +#include <linux/types.h>
16 +#include <linux/kernel.h>
17 +#include <linux/init.h>
18 +#include <linux/mtd/mtd.h>
19 +#include <linux/mtd/map.h>
20 +#include <linux/mtd/partitions.h>
21 +#include <asm/io.h>
22 +#include <asm/hardware.h>
23 +#include <asm/arch/gumstix.h>
24 +
25 +
26 +#define ROM_ADDR 0x00000000
27 +#define FLASH_ADDR 0x00000000
28 +
29 +#define WINDOW_SIZE 64*1024*1024
30 +
31 +static struct map_info gumstix_flash_maps[1] = { {
32 + .name = "Gumstix Flash ROM",
33 + .size = WINDOW_SIZE,
34 + .phys = FLASH_ADDR,
35 + .bankwidth = 2,
36 +} };
37 +
38 +static struct mtd_partition gumstix_flash_partitions[] = {
39 + {
40 + .name = "Bootloader",
41 + .size = 0x00040000,
42 + .offset = FLASH_ADDR
43 + },{
44 + .name = "RootFS",
45 + .size = MTDPART_SIZ_FULL,
46 + .offset = MTDPART_OFS_APPEND
47 + }
48 +};
49 +
50 +static struct mtd_info *mymtds[1];
51 +static struct mtd_partition *parsed_parts[1];
52 +static int nr_parsed_parts[1];
53 +
54 +static const char *probes[] = { NULL };
55 +
56 +static int __init gumstix_flashmap_init(void)
57 +{
58 + int ret = 0, i;
59 +
60 + for (i = 0; i < 1; i++) {
61 + gumstix_flash_maps[i].virt = ioremap(gumstix_flash_maps[i].phys, WINDOW_SIZE);
62 + if (!gumstix_flash_maps[i].virt) {
63 + printk(KERN_WARNING "Failed to ioremap %s\n", gumstix_flash_maps[i].name);
64 + if (!ret)
65 + ret = -ENOMEM;
66 + continue;
67 + }
68 + simple_map_init(&gumstix_flash_maps[i]);
69 +
70 + printk(KERN_NOTICE "Probing %s at physical address 0x%08lx (%d-bit bankwidth)\n",
71 + gumstix_flash_maps[i].name, gumstix_flash_maps[i].phys,
72 + gumstix_flash_maps[i].bankwidth * 8);
73 +
74 + mymtds[i] = do_map_probe("cfi_probe", &gumstix_flash_maps[i]);
75 +
76 + if (!mymtds[i]) {
77 + iounmap((void *)gumstix_flash_maps[i].virt);
78 + if (gumstix_flash_maps[i].cached)
79 + iounmap(gumstix_flash_maps[i].cached);
80 + if (!ret)
81 + ret = -EIO;
82 + continue;
83 + }
84 + mymtds[i]->owner = THIS_MODULE;
85 +
86 + ret = parse_mtd_partitions(mymtds[i], probes,
87 + &parsed_parts[i], 0);
88 +
89 + if (ret > 0)
90 + nr_parsed_parts[i] = ret;
91 + }
92 +
93 + if (!mymtds[0])
94 + return ret;
95 +
96 + for (i = 0; i < 1; i++) {
97 + if (!mymtds[i]) {
98 + printk(KERN_WARNING "%s is absent. Skipping\n", gumstix_flash_maps[i].name);
99 + } else if (nr_parsed_parts[i]) {
100 + add_mtd_partitions(mymtds[i], parsed_parts[i], nr_parsed_parts[i]);
101 + } else if (!i) {
102 + printk("Using static partitions on %s\n", gumstix_flash_maps[i].name);
103 + add_mtd_partitions(mymtds[i], gumstix_flash_partitions, ARRAY_SIZE(gumstix_flash_partitions));
104 + } else {
105 + printk("Registering %s as whole device\n", gumstix_flash_maps[i].name);
106 + add_mtd_device(mymtds[i]);
107 + }
108 + }
109 + return 0;
110 +}
111 +
112 +static void __exit gumstix_flashmap_cleanup(void)
113 +{
114 + int i;
115 + for (i = 0; i < 1; i++) {
116 + if (!mymtds[i])
117 + continue;
118 +
119 + if (nr_parsed_parts[i] || !i)
120 + del_mtd_partitions(mymtds[i]);
121 + else
122 + del_mtd_device(mymtds[i]);
123 +
124 + map_destroy(mymtds[i]);
125 + iounmap((void *)gumstix_flash_maps[i].virt);
126 + if (gumstix_flash_maps[i].cached)
127 + iounmap(gumstix_flash_maps[i].cached);
128 +
129 + if (parsed_parts[i])
130 + kfree(parsed_parts[i]);
131 + }
132 +}
133 +
134 +module_init(gumstix_flashmap_init);
135 +module_exit(gumstix_flashmap_cleanup);
136 +
137 +MODULE_LICENSE("GPL");
138 +MODULE_AUTHOR("Gumstix, Inc. <gumstix-users@lists.sf.net>");
139 +MODULE_DESCRIPTION("MTD map driver for the Gumstix Platform");
140 --- a/drivers/mtd/maps/Kconfig
141 +++ b/drivers/mtd/maps/Kconfig
142 @@ -131,6 +131,13 @@ config MTD_SBC_GXX
143 More info at
144 <http://www.arcomcontrols.com/products/icp/pc104/processors/SBC_GX1.htm>.
145
146 +config MTD_GUMSTIX
147 + tristate "CFI Flash device mapped on Gumstix"
148 + depends on ARCH_GUMSTIX && MTD_CFI_INTELEXT && MTD_PARTITIONS
149 + help
150 + This provides a driver for the on-board flash of the Gumstix
151 + single board computers.
152 +
153 config MTD_LUBBOCK
154 tristate "CFI Flash device mapped on Intel Lubbock XScale eval board"
155 depends on ARCH_LUBBOCK && MTD_CFI_INTELEXT && MTD_PARTITIONS
156 --- a/drivers/mtd/maps/Makefile
157 +++ b/drivers/mtd/maps/Makefile
158 @@ -21,6 +21,7 @@ obj-$(CONFIG_MTD_ICHXROM) += ichxrom.o
159 obj-$(CONFIG_MTD_CK804XROM) += ck804xrom.o
160 obj-$(CONFIG_MTD_TSUNAMI) += tsunami_flash.o
161 obj-$(CONFIG_MTD_LUBBOCK) += lubbock-flash.o
162 +obj-$(CONFIG_MTD_GUMSTIX) += gumstix-flash.o
163 obj-$(CONFIG_MTD_MAINSTONE) += mainstone-flash.o
164 obj-$(CONFIG_MTD_MBX860) += mbx860.o
165 obj-$(CONFIG_MTD_CEIVA) += ceiva.o
This page took 0.051712 seconds and 5 git commands to generate.