[PATCH 13/13] video: omap: allow building on !MMU

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Arnd Bergmann <arnd@xxxxxxxx>

The omap lcdc driver has an elaborate mmap_kern function
to map the frame buffer into kernel address space as
write-combined. This uses functions that are only available
on MMU-enabled builds.

It does seem equivalent to ioremap_wc though, so we should
be able to just use that instead.

This patch is build-tested only, it needs to be run on real
hardware before applying.

Signed-off-by: Arnd Bergmann <arnd@xxxxxxxx>
Signed-off-by: Peter Griffin <peter.griffin@xxxxxxxxxx>
Cc: Jean-Christophe Plagniol-Villard <plagnioj@xxxxxxxxxxxx>
Cc: Tomi Valkeinen <tomi.valkeinen@xxxxxx>
Cc: linux-fbdev@xxxxxxxxxxxxxxx
Cc: linux-omap@xxxxxxxxxxxxxxx
---
 drivers/video/fbdev/omap/lcdc.c |   28 +++++-----------------------
 1 file changed, 5 insertions(+), 23 deletions(-)

diff --git a/drivers/video/fbdev/omap/lcdc.c b/drivers/video/fbdev/omap/lcdc.c
index b52f625..40e8200 100644
--- a/drivers/video/fbdev/omap/lcdc.c
+++ b/drivers/video/fbdev/omap/lcdc.c
@@ -613,29 +613,11 @@ static void lcdc_dma_handler(u16 status, void *data)
 
 static int mmap_kern(void)
 {
-	struct vm_struct	*kvma;
-	struct vm_area_struct	vma;
-	pgprot_t		pgprot;
-	unsigned long		vaddr;
-
-	kvma = get_vm_area(lcdc.vram_size, VM_IOREMAP);
-	if (kvma == NULL) {
-		dev_err(lcdc.fbdev->dev, "can't get kernel vm area\n");
+	void __iomem *vaddr;
+
+	vaddr = ioremap_wc(lcdc.vram_phys, lcdc.vram_size);
+	if (!vaddr)
 		return -ENOMEM;
-	}
-	vma.vm_mm = &init_mm;
-
-	vaddr = (unsigned long)kvma->addr;
-	vma.vm_start = vaddr;
-	vma.vm_end = vaddr + lcdc.vram_size;
-
-	pgprot = pgprot_writecombine(pgprot_kernel);
-	if (io_remap_pfn_range(&vma, vaddr,
-			   lcdc.vram_phys >> PAGE_SHIFT,
-			   lcdc.vram_size, pgprot) < 0) {
-		dev_err(lcdc.fbdev->dev, "kernel mmap for FB memory failed\n");
-		return -EAGAIN;
-	}
 
 	lcdc.vram_virt = (void *)vaddr;
 
@@ -644,7 +626,7 @@ static int mmap_kern(void)
 
 static void unmap_kern(void)
 {
-	vunmap(lcdc.vram_virt);
+	iounmap(lcdc.vram_virt);
 }
 
 static int alloc_palette_ram(void)
-- 
1.7.9.5

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




[Index of Archives]     [Video for Linux]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Tourism]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux