public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
* [PATCH][MTD] mtdpart.c: allow other drivers to get physical address of partition
@ 2007-07-27  0:04 Jared Hulbert
  2007-07-27 13:48 ` Jörn Engel
  2007-07-31 11:55 ` David Woodhouse
  0 siblings, 2 replies; 39+ messages in thread
From: Jared Hulbert @ 2007-07-27  0:04 UTC (permalink / raw)
  To: linux-mtd@lists.infradead.org

This is necessary to XIP applications because vm_insert_pfn() requires
a physical address.  Allows AXFS to get the physical address on the
flash of it's partition.  Second try, see
(www.infradead.org/pipermail/linux-mtd/2006-August/016342.html)

Signed-off-by: Jared Hulbert <jaredeh@gmail.com>


diff --git a/drivers/mtd/mtdpart.c b/drivers/mtd/mtdpart.c
index 9c62368..af0c1ff 100644
--- a/drivers/mtd/mtdpart.c
+++ b/drivers/mtd/mtdpart.c
@@ -20,6 +20,7 @@
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/partitions.h>
 #include <linux/mtd/compatmac.h>
+#include <linux/mtd/map.h>

 /* Our partition linked list */
 static LIST_HEAD(mtd_partitions);
@@ -40,6 +41,17 @@ struct mtd_part {
  */
 #define PART(x)  ((struct mtd_part *)(x))

+/*
+ * Allow other modules to get the physical address of a given partition
+ */
+void *mtd_get_partition_physaddr(struct mtd_info *mtd)
+{
+	struct mtd_part *part = PART(mtd);
+	struct map_info *map = part->master->priv;
+	
+	return (void *)(map->phys + part->offset);
+}
+EXPORT_SYMBOL_GPL(mtd_get_partition_physaddr);

 /*
  * MTD methods which simply translate the effective address and pass through
diff --git a/include/linux/mtd/partitions.h b/include/linux/mtd/partitions.h
index da6b3d6..3e9ff2c 100644
--- a/include/linux/mtd/partitions.h
+++ b/include/linux/mtd/partitions.h
@@ -52,6 +52,7 @@ struct mtd_partition {

 int add_mtd_partitions(struct mtd_info *, const struct mtd_partition *, int);
 int del_mtd_partitions(struct mtd_info *);
+void *mtd_get_partition_physaddr(struct mtd_info *);

 /*
  * Functions dealing with the various ways of partitioning the space

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

end of thread, other threads:[~2007-08-06  6:31 UTC | newest]

Thread overview: 39+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-07-27  0:04 [PATCH][MTD] mtdpart.c: allow other drivers to get physical address of partition Jared Hulbert
2007-07-27 13:48 ` Jörn Engel
2007-07-27 17:05   ` Jared Hulbert
2007-07-27 17:44     ` Jörn Engel
2007-07-27 20:53       ` Jared Hulbert
2007-07-28 11:43         ` Jörn Engel
2007-07-28 21:08           ` Jared Hulbert
2007-07-31 11:55 ` David Woodhouse
2007-07-31 19:55   ` Jared Hulbert
2007-08-01 11:55     ` Jörn Engel
2007-08-03  1:56       ` Jared Hulbert
2007-08-03  3:01         ` Jörn Engel
2007-08-03  5:23           ` Jared Hulbert
2007-08-03  9:21             ` Jörn Engel
2007-08-03  6:42       ` Jared Hulbert
2007-08-03 12:47         ` Jörn Engel
2007-08-03 22:29           ` Jared Hulbert
2007-08-01 12:18     ` Jörn Engel
2007-08-01 12:59       ` Carsten Otte
2007-08-01 20:37         ` Jared Hulbert
2007-08-01 23:31           ` Jörn Engel
2007-08-02  7:53           ` Carsten Otte
2007-08-02 21:55             ` Jared Hulbert
2007-08-03  7:59               ` Carsten Otte
2007-08-03  9:17                 ` Jörn Engel
2007-08-03 11:03                   ` Carsten Otte
2007-08-03 11:31                     ` Jörn Engel
2007-08-03 12:21                       ` Carsten Otte
2007-08-03 12:58                         ` Jörn Engel
2007-08-03 13:09               ` David Woodhouse
2007-08-03 13:18                 ` Jörn Engel
2007-08-03 19:45                   ` Jared Hulbert
2007-08-03 23:02                     ` Jörn Engel
2007-08-04 12:33                     ` David Woodhouse
2007-08-04 17:47                       ` Jared Hulbert
2007-08-06  6:30                     ` Carsten Otte
2007-08-03 18:39                 ` Jared Hulbert
2007-08-06  6:23                 ` Carsten Otte
2007-08-01 18:03       ` Jared Hulbert

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox