Title: [6479] trunk: rewrite how we setup the uClinux MTD addr/size based on feedback from mainline
- Revision
- 6479
- Author
- vapier
- Date
- 2009-05-26 18:34:51 -0500 (Tue, 26 May 2009)
Log Message
rewrite how we setup the uClinux MTD addr/size based on feedback from mainline
Modified Paths
Diff
Modified: trunk/arch/blackfin/kernel/setup.c (6478 => 6479)
--- trunk/arch/blackfin/kernel/setup.c 2009-05-26 22:57:24 UTC (rev 6478)
+++ trunk/arch/blackfin/kernel/setup.c 2009-05-26 23:34:51 UTC (rev 6479)
@@ -18,6 +18,7 @@
#include <linux/tty.h>
#include <linux/pfn.h>
+#include <linux/mtd/map.h>
#include <linux/ext2_fs.h>
#include <linux/cramfs_fs.h>
#include <linux/romfs_fs.h>
@@ -45,6 +46,7 @@
EXPORT_SYMBOL(reserved_mem_dcache_on);
#ifdef CONFIG_MTD_UCLINUX
+extern struct map_info uclinux_ram_map;
unsigned long memory_mtd_end, memory_mtd_start, mtd_size;
unsigned long _ebss;
EXPORT_SYMBOL(memory_mtd_end);
@@ -535,10 +537,9 @@
}
/* Relocate MTD image to the top of memory after the uncached memory area */
- dma_memcpy((char *)memory_end, _end, mtd_size);
-
- memory_mtd_start = memory_end;
- _ebss = memory_mtd_start; /* define _ebss for compatible */
+ uclinux_ram_map.phys = memory_mtd_start = memory_end;
+ uclinux_ram_map.size = mtd_size;
+ dma_memcpy((void *)uclinux_ram_map.phys, _end, uclinux_ram_map.size);
#endif /* CONFIG_MTD_UCLINUX */
#if (defined(CONFIG_BFIN_ICACHE) && ANOMALY_05000263)
Modified: trunk/drivers/mtd/maps/uclinux.c (6478 => 6479)
--- trunk/drivers/mtd/maps/uclinux.c 2009-05-26 22:57:24 UTC (rev 6478)
+++ trunk/drivers/mtd/maps/uclinux.c 2009-05-26 23:34:51 UTC (rev 6479)
@@ -13,8 +13,6 @@
#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/fs.h>
-#include <linux/magic.h>
-#include <linux/romfs_fs.h>
#include <linux/mm.h>
#include <linux/major.h>
#include <linux/mtd/mtd.h>
@@ -24,15 +22,19 @@
/****************************************************************************/
+extern char _ebss;
+
struct map_info uclinux_ram_map = {
.name = "RAM",
+ .phys = (unsigned long)&_ebss,
+ .size = 0,
};
-struct mtd_info *uclinux_ram_mtdinfo;
+static struct mtd_info *uclinux_ram_mtdinfo;
/****************************************************************************/
-struct mtd_partition uclinux_romfs[] = {
+static struct mtd_partition uclinux_romfs[] = {
{ .name = "ROMfs" }
};
@@ -40,7 +42,7 @@
/****************************************************************************/
-int uclinux_point(struct mtd_info *mtd, loff_t from, size_t len,
+static int uclinux_point(struct mtd_info *mtd, loff_t from, size_t len,
size_t *retlen, void **virt, resource_size_t *phys)
{
struct map_info *map = mtd->priv;
@@ -57,32 +59,10 @@
{
struct mtd_info *mtd;
struct map_info *mapp;
-#ifdef CONFIG_BLACKFIN
- extern unsigned long memory_mtd_start;
- unsigned long addr = (unsigned long) memory_mtd_start;
-#else
- extern char _ebss;
- unsigned long addr = (unsigned long) &_ebss;
-#endif
mapp = &uclinux_ram_map;
- mapp->phys = addr;
- mapp->size = PAGE_ALIGN(ntohl(*((unsigned long *)(addr + 8))));
-
-#if defined(CONFIG_EXT2_FS) || defined(CONFIG_EXT3_FS) || defined(CONFIG_EXT4_FS)
- if (*((unsigned short *)(addr + 0x438)) == EXT2_SUPER_MAGIC)
- mapp->size = *((unsigned long *)(addr + 0x404)) * 1024;
-#endif
-#if defined(CONFIG_CRAMFS)
- if (*((unsigned long *)(addr)) == CRAMFS_MAGIC)
- mapp->size = *((unsigned long *)(addr + 0x4));
-#endif
-#if defined(CONFIG_ROMFS_FS)
- if (((unsigned long *)addr)[0] == ROMSB_WORD0 &&
- ((unsigned long *)addr)[1] == ROMSB_WORD1)
- mapp->size = be32_to_cpu(((unsigned long *)addr)[2]);
-#endif
-
+ if (!mapp->size)
+ mapp->size = PAGE_ALIGN(ntohl(*((unsigned long *)(mapp->phys + 8))));
mapp->bankwidth = 4;
printk("uclinux[mtd]: RAM probe address=0x%x size=0x%x\n",
_______________________________________________
Linux-kernel-commits mailing list
[email protected]
https://blackfin.uclinux.org/mailman/listinfo/linux-kernel-commits