Patchwork [2/6,V3] sparc: Add pci32_unmap_page.

login
register
mail settings
Submitter Kristoffer Glembo
Date Jan. 18, 2011, 2:10 p.m.
Message ID <1295359829-27308-3-git-send-email-kristoffer@gaisler.com>
Download mbox | patch
Permalink /patch/79301/
State Accepted
Delegated to: David Miller
Headers show

Comments

Kristoffer Glembo - Jan. 18, 2011, 2:10 p.m.
Signed-off-by: Kristoffer Glembo <kristoffer@gaisler.com>
---
 arch/sparc/kernel/ioport.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
Sam Ravnborg - Jan. 18, 2011, 7:37 p.m.
On Tue, Jan 18, 2011 at 03:10:25PM +0100, Kristoffer Glembo wrote:
> Signed-off-by: Kristoffer Glembo <kristoffer@gaisler.com>

I am still missing from the changelog this information:

pci32_unmap_page is part of the DMA API and needed by
the leon ethernet driver.

Anyway:
Acked-by: Sam Ravnborg <sam@ravnborg.org>
--
To unsubscribe from this list: send the line "unsubscribe sparclinux" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
David Miller - Jan. 22, 2011, 12:51 a.m.
From: Sam Ravnborg <sam@ravnborg.org>
Date: Tue, 18 Jan 2011 20:37:29 +0100

> On Tue, Jan 18, 2011 at 03:10:25PM +0100, Kristoffer Glembo wrote:
>> Signed-off-by: Kristoffer Glembo <kristoffer@gaisler.com>
> 
> I am still missing from the changelog this information:
> 
> pci32_unmap_page is part of the DMA API and needed by
> the leon ethernet driver.
> 
> Anyway:
> Acked-by: Sam Ravnborg <sam@ravnborg.org>

Applied.
--
To unsubscribe from this list: send the line "unsubscribe sparclinux" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/arch/sparc/kernel/ioport.c b/arch/sparc/kernel/ioport.c
index cea49c0..1b9f07c 100644
--- a/arch/sparc/kernel/ioport.c
+++ b/arch/sparc/kernel/ioport.c
@@ -524,6 +524,13 @@  static dma_addr_t pci32_map_page(struct device *dev, struct page *page,
 	return page_to_phys(page) + offset;
 }
 
+static void pci32_unmap_page(struct device *dev, dma_addr_t ba, size_t size,
+			     enum dma_data_direction dir, struct dma_attrs *attrs)
+{
+	if (dir != PCI_DMA_TODEVICE)
+		mmu_inval_dma_area((unsigned long)phys_to_virt(ba), PAGE_ALIGN(size));
+}
+
 /* Map a set of buffers described by scatterlist in streaming
  * mode for DMA.  This is the scather-gather version of the
  * above pci_map_single interface.  Here the scatter gather list
@@ -646,6 +653,7 @@  struct dma_map_ops pci32_dma_ops = {
 	.alloc_coherent		= pci32_alloc_coherent,
 	.free_coherent		= pci32_free_coherent,
 	.map_page		= pci32_map_page,
+	.unmap_page		= pci32_unmap_page,
 	.map_sg			= pci32_map_sg,
 	.unmap_sg		= pci32_unmap_sg,
 	.sync_single_for_cpu	= pci32_sync_single_for_cpu,