* [PATCH 6/8] MTD: add physical address to point() api -- PCI RAM card pmc551
@ 2007-11-08 3:23 Jared Hulbert
2007-11-08 10:12 ` Jörn Engel
0 siblings, 1 reply; 3+ messages in thread
From: Jared Hulbert @ 2007-11-08 3:23 UTC (permalink / raw)
To: linux-mtd@lists.infradead.org
Adding the ability to get a physical address from point() in addition
to virtual address. This physical address will be required for axfs
and cramfs with XIP.
Signed-off-by: Jared Hulbert <jaredeh@gmail.com>
----
diff --git a/drivers/mtd/devices/pmc551.c b/drivers/mtd/devices/pmc551.c
index 7060a08..67d7fd5 100644
--- a/drivers/mtd/devices/pmc551.c
+++ b/drivers/mtd/devices/pmc551.c
@@ -134,7 +134,8 @@ static int pmc551_erase(struct mtd_info *mtd,
struct erase_info *instr)
eoff_lo = end & (priv->asize - 1);
soff_lo = instr->addr & (priv->asize - 1);
- pmc551_point(mtd, instr->addr, instr->len, &retlen, &ptr);
+ pmc551_point(mtd, instr->addr, instr->len, &retlen,
+ (void **)&ptr, NULL);
if (soff_hi == eoff_hi || mtd->size == priv->asize) {
/* The whole thing fits within one access, so just one shot
@@ -154,7 +155,8 @@ static int pmc551_erase(struct mtd_info *mtd,
struct erase_info *instr)
}
soff_hi += priv->asize;
pmc551_point(mtd, (priv->base_map0 | soff_hi),
- priv->asize, &retlen, &ptr);
+ priv->asize, &retlen,
+ (void **)&ptr, NULL);
}
memset(ptr, 0xff, eoff_lo);
}
@@ -170,7 +172,7 @@ static int pmc551_erase(struct mtd_info *mtd,
struct erase_info *instr)
}
static int pmc551_point(struct mtd_info *mtd, loff_t from, size_t len,
- size_t * retlen, u_char ** mtdbuf)
+ size_t * retlen, void **virt, resource_size_t *phys)
{
struct mypriv *priv = mtd->priv;
u32 soff_hi;
@@ -188,6 +190,10 @@ static int pmc551_point(struct mtd_info *mtd,
loff_t from, size_t len,
return -EINVAL;
}
+ /* can we return a physical address with this driver? */
+ if (phys)
+ return -EINVAL;
+
soff_hi = from & ~(priv->asize - 1);
soff_lo = from & (priv->asize - 1);
@@ -198,13 +204,12 @@ static int pmc551_point(struct mtd_info *mtd,
loff_t from, size_t len,
priv->curr_map0 = soff_hi;
}
- *mtdbuf = priv->start + soff_lo;
+ *virt = priv->start + soff_lo;
*retlen = len;
return 0;
}
-static void pmc551_unpoint(struct mtd_info *mtd, u_char * addr, loff_t from,
- size_t len)
+static void pmc551_unpoint(struct mtd_info *mtd, loff_t from, size_t len)
{
#ifdef CONFIG_MTD_PMC551_DEBUG
printk(KERN_DEBUG "pmc551_unpoint()\n");
@@ -242,7 +247,7 @@ static int pmc551_read(struct mtd_info *mtd,
loff_t from, size_t len,
soff_lo = from & (priv->asize - 1);
eoff_lo = end & (priv->asize - 1);
- pmc551_point(mtd, from, len, retlen, &ptr);
+ pmc551_point(mtd, from, len, retlen, (void **)&ptr, NULL);
if (soff_hi == eoff_hi) {
/* The whole thing fits within one access, so just one shot
@@ -263,7 +268,8 @@ static int pmc551_read(struct mtd_info *mtd,
loff_t from, size_t len,
goto out;
}
soff_hi += priv->asize;
- pmc551_point(mtd, soff_hi, priv->asize, retlen, &ptr);
+ pmc551_point(mtd, soff_hi, priv->asize, retlen,
+ (void **)&ptr, NULL);
}
memcpy(copyto, ptr, eoff_lo);
copyto += eoff_lo;
@@ -308,7 +314,7 @@ static int pmc551_write(struct mtd_info *mtd,
loff_t to, size_t len,
soff_lo = to & (priv->asize - 1);
eoff_lo = end & (priv->asize - 1);
- pmc551_point(mtd, to, len, retlen, &ptr);
+ pmc551_point(mtd, to, len, retlen, (void **)&ptr, NULL);
if (soff_hi == eoff_hi) {
/* The whole thing fits within one access, so just one shot
@@ -329,7 +335,8 @@ static int pmc551_write(struct mtd_info *mtd,
loff_t to, size_t len,
goto out;
}
soff_hi += priv->asize;
- pmc551_point(mtd, soff_hi, priv->asize, retlen, &ptr);
+ pmc551_point(mtd, soff_hi, priv->asize, retlen,
+ (void **)&ptr, NULL);
}
memcpy(ptr, copyfrom, eoff_lo);
copyfrom += eoff_lo;
@@ -803,7 +810,7 @@ static int __init init_pmc551(void)
}
/* Keep a reference as the add_mtd_device worked */
- pci_dev_get(PCI_Device);
+ //pci_dev_get(PCI_Device);
printk(KERN_NOTICE "Registered pmc551 memory device.\n");
printk(KERN_NOTICE "Mapped %dMiB of memory from 0x%p to 0x%p\n",
diff --git a/include/linux/mtd/pmc551.h b/include/linux/mtd/pmc551.h
index a7f6d20..fd139e9 100644
--- a/include/linux/mtd/pmc551.h
+++ b/include/linux/mtd/pmc551.h
@@ -36,8 +36,9 @@ struct mypriv {
* Function Prototypes
*/
static int pmc551_erase(struct mtd_info *, struct erase_info *);
-static void pmc551_unpoint(struct mtd_info *, u_char *, loff_t, size_t);
-static int pmc551_point (struct mtd_info *mtd, loff_t from, size_t
len, size_t *retlen, u_char **mtdbuf);
+static void pmc551_unpoint(struct mtd_info *, loff_t, size_t);
+static int pmc551_point (struct mtd_info *mtd, loff_t from, size_t
len, size_t *retlen, void **virt,
+ resource_size_t *phys);
static int pmc551_read(struct mtd_info *, loff_t, size_t, size_t *, u_char *);
static int pmc551_write(struct mtd_info *, loff_t, size_t, size_t *,
const u_char *);
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 6/8] MTD: add physical address to point() api -- PCI RAM card pmc551
2007-11-08 3:23 [PATCH 6/8] MTD: add physical address to point() api -- PCI RAM card pmc551 Jared Hulbert
@ 2007-11-08 10:12 ` Jörn Engel
2007-11-08 17:44 ` Jared Hulbert
0 siblings, 1 reply; 3+ messages in thread
From: Jörn Engel @ 2007-11-08 10:12 UTC (permalink / raw)
To: Jared Hulbert; +Cc: linux-mtd@lists.infradead.org
On Wed, 7 November 2007 19:23:41 -0800, Jared Hulbert wrote:
> @@ -803,7 +810,7 @@ static int __init init_pmc551(void)
> }
>
> /* Keep a reference as the add_mtd_device worked */
> - pci_dev_get(PCI_Device);
> + //pci_dev_get(PCI_Device);
>
> printk(KERN_NOTICE "Registered pmc551 memory device.\n");
> printk(KERN_NOTICE "Mapped %dMiB of memory from 0x%p to 0x%p\n",
What is this hunk doing?
Jörn
--
Joern's library part 14:
http://www.sandpile.org/
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 6/8] MTD: add physical address to point() api -- PCI RAM card pmc551
2007-11-08 10:12 ` Jörn Engel
@ 2007-11-08 17:44 ` Jared Hulbert
0 siblings, 0 replies; 3+ messages in thread
From: Jared Hulbert @ 2007-11-08 17:44 UTC (permalink / raw)
To: Jörn Engel; +Cc: linux-mtd@lists.infradead.org
On 11/8/07, Jörn Engel <joern@logfs.org> wrote:
> On Wed, 7 November 2007 19:23:41 -0800, Jared Hulbert wrote:
> > @@ -803,7 +810,7 @@ static int __init init_pmc551(void)
> > }
> >
> > /* Keep a reference as the add_mtd_device worked */
> > - pci_dev_get(PCI_Device);
> > + //pci_dev_get(PCI_Device);
> >
> > printk(KERN_NOTICE "Registered pmc551 memory device.\n");
> > printk(KERN_NOTICE "Mapped %dMiB of memory from 0x%p to 0x%p\n",
>
> What is this hunk doing?
Making me look dumb.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2007-11-08 17:45 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-11-08 3:23 [PATCH 6/8] MTD: add physical address to point() api -- PCI RAM card pmc551 Jared Hulbert
2007-11-08 10:12 ` Jörn Engel
2007-11-08 17:44 ` Jared Hulbert
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox