31 #include <linux/slab.h>
32 #include <linux/module.h>
33 #include <linux/types.h>
34 #include <linux/kernel.h>
50 #define DEBUG_MARKER printk(KERN_NOTICE "%s[%d]\n", __func__, __LINE__)
52 static int __init init_msp_flash(
void)
58 char flash_name[] =
"flash0";
70 for (fcnt = 0; (env =
prom_getenv(flash_name)); fcnt++)
71 flash_name[5] =
'0' + fcnt + 1;
91 for (i = 0; i < fcnt; i++) {
93 part_name[5] =
'0' +
i;
95 for (pcnt = 0; (env =
prom_getenv(part_name)); pcnt++)
96 part_name[7] =
'0' + pcnt + 1;
100 "(no partitions defined)\n", i);
110 flash_name[5] =
'0' +
i;
113 if (
sscanf(env,
"%x:%x", &addr, &size) < 2) {
121 "MSP flash device \"%s\": 0x%08x at 0x%08x\n",
122 flash_name, size, addr);
131 if (size > CONFIG_MSP_FLASH_MAP_LIMIT)
132 size = CONFIG_MSP_FLASH_MAP_LIMIT;
143 if (!msp_maps[i].
name) {
149 msp_maps[
i].
name =
strncpy(msp_maps[i].name, flash_name, 7);
151 for (j = 0; j <
pcnt; j++) {
152 part_name[5] =
'0' +
i;
153 part_name[7] =
'0' +
j;
157 if (
sscanf(env,
"%x:%x:%n", &offset, &size,
160 kfree(msp_maps[i].name);
168 msp_parts[
i][
j].
name = env + coff;
180 kfree(msp_maps[i].name);
205 static void __exit cleanup_msp_flash(
void)
209 for (i = 0; i < fcnt; i++) {