summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCatalin Marinas <catalin.marinas@arm.com>2013-01-04 12:56:49 (GMT)
committerChanho Park <chanho61.park@samsung.com>2014-04-16 12:36:52 (GMT)
commit4dd75ec77356a23b604be3116a7ea77e8e353627 (patch)
tree31b3ac8fdfb25167d51960190024a3c21cc165a2
parent8b5f0ee5b4ff25e2d33db563f190cc891b40163f (diff)
downloadlinux-3.10-4dd75ec77356a23b604be3116a7ea77e8e353627.zip
linux-3.10-4dd75ec77356a23b604be3116a7ea77e8e353627.tar.gz
linux-3.10-4dd75ec77356a23b604be3116a7ea77e8e353627.tar.bz2
amba-clcd: Only use dma_alloc_writecombine() if the arch supports it
This patch hides the dma_(alloc|free)_writecombine() calls behind macros to allow the amba-clcd.c to be used on architectures that do not provide this DMA API. With this patch, the *_writecombine() API is only used on ARM (AArch32). Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
-rw-r--r--drivers/video/amba-clcd.c27
1 files changed, 20 insertions, 7 deletions
diff --git a/drivers/video/amba-clcd.c b/drivers/video/amba-clcd.c
index 04fa00f..432699b 100644
--- a/drivers/video/amba-clcd.c
+++ b/drivers/video/amba-clcd.c
@@ -33,6 +33,16 @@
#define to_clcd(info) container_of(info, struct clcd_fb, fb)
+#ifdef CONFIG_ARM
+#define clcdfb_dma_alloc dma_alloc_writecombine
+#define clcdfb_dma_free dma_free_writecombine
+#define clcdfb_dma_mmap dma_mmap_writecombine
+#else
+#define clcdfb_dma_alloc dma_alloc_coherent
+#define clcdfb_dma_free dma_free_coherent
+#define clcdfb_dma_mmap dma_mmap_coherent
+#endif
+
/* This is limited to 16 characters when displayed by X startup */
static const char *clcd_name = "CLCD FB";
@@ -396,16 +406,19 @@ static int clcdfb_blank(int blank_mode, struct fb_info *info)
}
int clcdfb_mmap_dma(struct clcd_fb *fb, struct vm_area_struct *vma)
{
- return dma_mmap_writecombine(&fb->dev->dev, vma,
- fb->fb.screen_base,
- fb->fb.fix.smem_start,
- fb->fb.fix.smem_len);
+ return clcdfb_dma_mmap(&fb->dev->dev, vma, fb->fb.screen_base,
+ fb->fb.fix.smem_start, fb->fb.fix.smem_len);
}
void clcdfb_remove_dma(struct clcd_fb *fb)
{
- dma_free_writecombine(&fb->dev->dev, fb->fb.fix.smem_len,
- fb->fb.screen_base, fb->fb.fix.smem_start);
+ struct device_node *node = fb->dev->dev.of_node;
+ u32 use_dma = 0;
+
+ of_property_read_u32(node, "use_dma", &use_dma);
+ if (use_dma)
+ clcdfb_dma_free(&fb->dev->dev, fb->fb.fix.smem_len,
+ fb->fb.screen_base, fb->fb.fix.smem_start);
}
static int clcdfb_mmap(struct fb_info *info,
@@ -739,7 +752,7 @@ static int clcdfb_dt_init(struct clcd_fb *fb)
if (of_property_read_u32(node, "use_dma", &use_dma))
use_dma = 0;
if (use_dma) {
- fb->fb.screen_base = dma_alloc_writecombine(&fb->dev->dev,
+ fb->fb.screen_base = clcdfb_dma_alloc(&fb->dev->dev,
fb->fb.fix.smem_len, &dma, GFP_KERNEL);
if (!fb->fb.screen_base) {
pr_err("CLCD: unable to map framebuffer\n");