Skip to contentSkip to conversation

sh: split coherent pages

PATCH New Magnus Damm 2 participants 3 messages Dec 17, 2008

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sh: split coherent pages

From: Magnus Damm <[email protected]>

Split pages returned by dma_alloc_coherent() and make sure we free them one by one.

---

 arch/sh/mm/consistent.c |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
arch/sh/mm/consistent.c +6 -1
@@ -42,6 +42,8 @@ void *dma_alloc_coherent(struct device *
 		return NULL;
 	}
 
+	split_page(pfn_to_page(virt_to_phys(ret) >> PAGE_SHIFT), order);
+
 	*dma_handle = virt_to_phys(ret);
 	return ret_nocache;
 }
@@ -51,10 +53,13 @@ void dma_free_coherent(struct device *de
 			 void *vaddr, dma_addr_t dma_handle)
 {
 	int order = get_order(size);
+	unsigned long pfn = dma_handle >> PAGE_SHIFT;
+	int k;
 
 	if (!dma_release_from_coherent(dev, order, vaddr)) {
 		WARN_ON(irqs_disabled());	/* for portability */
-		free_pages((unsigned long)phys_to_virt(dma_handle), order);
+		for (k = 0; k < (1 << order); k++)
+			__free_pages(pfn_to_page(pfn + k), 0);
 		iounmap(vaddr);
 	}
 }
#1 lore raw

PATCH 1/1 sh_mobile_lcdc: use FB_SYS helpers instead of FB_CFB

From: Magnus Damm <[email protected]>

Since the sh_mobile_lcdc hardware has the framebuffer(s) in system RAM, use FB_SYS instead of FB_CFB. Also hook in read and write helpers.

---

 drivers/video/Kconfig            |    8 ++++----
 drivers/video/sh_mobile_lcdcfb.c |    8 +++++---
 2 files changed, 9 insertions(+), 7 deletions(-)
drivers/video/Kconfig +4 -4
@@ -1889,10 +1889,10 @@ config FB_W100
 config FB_SH_MOBILE_LCDC
 	tristate "SuperH Mobile LCDC framebuffer support"
 	depends on FB && SUPERH
-	select FB_CFB_FILLRECT
-	select FB_CFB_COPYAREA
-	select FB_CFB_IMAGEBLIT
-	default m
+	select FB_SYS_FILLRECT
+	select FB_SYS_COPYAREA
+	select FB_SYS_IMAGEBLIT
+	select FB_SYS_FOPS
 	---help---
 	  Frame buffer driver for the on-chip SH-Mobile LCD controller.
 
drivers/video/sh_mobile_lcdcfb.c +5 -3
@@ -499,9 +499,11 @@ static struct fb_fix_screeninfo sh_mobil
 
 static struct fb_ops sh_mobile_lcdc_ops = {
 	.fb_setcolreg	= sh_mobile_lcdc_setcolreg,
-	.fb_fillrect	= cfb_fillrect,
-	.fb_copyarea	= cfb_copyarea,
-	.fb_imageblit	= cfb_imageblit,
+	.fb_read        = fb_sys_read,
+	.fb_write       = fb_sys_write,
+	.fb_fillrect	= sys_fillrect,
+	.fb_copyarea	= sys_copyarea,
+	.fb_imageblit	= sys_imageblit,
 };
 
 static int sh_mobile_lcdc_set_bpp(struct fb_var_screeninfo *var, int bpp)
#2 lore raw
Quoted 4 lines · Magnus Damm

Split pages returned by dma_alloc_coherent() and make sure we free them one by one.

Quoted 4 lines · Magnus Damm

Since the sh_mobile_lcdc hardware has the framebuffer(s) in system RAM, use FB_SYS instead of FB_CFB. Also hook in read and write helpers.

Both applied, thanks.