All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] mtd: physmap: add physmap_unmapped_area() for no-mmu XIP
@ 2010-05-23  7:30 Mike Frysinger
  2010-05-23  7:30 ` [PATCH 2/2] mtd: physmap: allow maps to be read-only mapped Mike Frysinger
  2010-06-12 14:26 ` [PATCH 1/2] mtd: physmap: add physmap_unmapped_area() for no-mmu XIP Artem Bityutskiy
  0 siblings, 2 replies; 8+ messages in thread
From: Mike Frysinger @ 2010-05-23  7:30 UTC (permalink / raw)
  To: linux-mtd, David Woodhouse
  Cc: uclinux-dev, Bernd Schmidt, David Howells, Paul Mundt,
	Greg Ungerer, uclinux-dist-devel, David McCullough

From: Bernd Schmidt <bernds_cb1@t-online.de>

Currently, romfs XIP doesn't work in flash memory (the kernel crashes
with a null pointer dereference).  The problem is that the mtd physmap
driver isn't setting up a get_unmapped_area pointer for the mtd
partitions it creates.

Signed-off-by: Bernd Schmidt <bernds_cb1@t-online.de>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
---
 drivers/mtd/maps/physmap.c |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/drivers/mtd/maps/physmap.c b/drivers/mtd/maps/physmap.c
index 09d89ff..370da18 100644
--- a/drivers/mtd/maps/physmap.c
+++ b/drivers/mtd/maps/physmap.c
@@ -72,6 +72,20 @@ static int physmap_flash_remove(struct platform_device *dev)
 	return 0;
 }
 
+/*
+ * Allow NOMMU mmap() to directly map the device (if not NULL)
+ * - return the address to which the offset maps
+ * - return -ENOSYS to indicate refusal to do the mapping
+ */
+static unsigned long physmap_unmapped_area(struct mtd_info *mtd,
+					   unsigned long len,
+					   unsigned long offset,
+					   unsigned long flags)
+{
+	struct map_info *map = mtd->priv;
+	return (unsigned long) map->virt + offset;
+}
+
 static const char *rom_probe_types[] = {
 					"cfi_probe",
 					"jedec_probe",
@@ -149,6 +163,8 @@ static int physmap_flash_probe(struct platform_device *dev)
 		} else {
 			devices_found++;
 		}
+		if (info->mtd[i]->get_unmapped_area == NULL)
+			info->mtd[i]->get_unmapped_area = physmap_unmapped_area;
 		info->mtd[i]->owner = THIS_MODULE;
 		info->mtd[i]->dev.parent = &dev->dev;
 	}
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2010-08-20  6:18 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-05-23  7:30 [PATCH 1/2] mtd: physmap: add physmap_unmapped_area() for no-mmu XIP Mike Frysinger
2010-05-23  7:30 ` [PATCH 2/2] mtd: physmap: allow maps to be read-only mapped Mike Frysinger
2010-06-12 14:26 ` [PATCH 1/2] mtd: physmap: add physmap_unmapped_area() for no-mmu XIP Artem Bityutskiy
2010-08-04  9:33   ` David Woodhouse
2010-08-07 23:26     ` [Uclinux-dist-devel] " Mike Frysinger
2010-08-08 11:33       ` David Woodhouse
2010-08-09  7:36         ` Mike Frysinger
2010-08-20  6:17   ` Artem Bityutskiy

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.