summaryrefslogtreecommitdiffstats
path: root/meta/recipes-kernel/linux/linux-omap-2.6.29/dss2/0049-DSS2-VRAM-clear-allocated-area-with-DMA.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-kernel/linux/linux-omap-2.6.29/dss2/0049-DSS2-VRAM-clear-allocated-area-with-DMA.patch')
-rw-r--r--meta/recipes-kernel/linux/linux-omap-2.6.29/dss2/0049-DSS2-VRAM-clear-allocated-area-with-DMA.patch101
1 files changed, 101 insertions, 0 deletions
diff --git a/meta/recipes-kernel/linux/linux-omap-2.6.29/dss2/0049-DSS2-VRAM-clear-allocated-area-with-DMA.patch b/meta/recipes-kernel/linux/linux-omap-2.6.29/dss2/0049-DSS2-VRAM-clear-allocated-area-with-DMA.patch
new file mode 100644
index 0000000000..e9fc76ce15
--- /dev/null
+++ b/meta/recipes-kernel/linux/linux-omap-2.6.29/dss2/0049-DSS2-VRAM-clear-allocated-area-with-DMA.patch
@@ -0,0 +1,101 @@
1From 02034cc79f69512a6037f03ad1243c28f59fdd8a Mon Sep 17 00:00:00 2001
2From: Tomi Valkeinen <tomi.valkeinen@nokia.com>
3Date: Wed, 22 Apr 2009 10:25:20 +0300
4Subject: [PATCH] DSS2: VRAM: clear allocated area with DMA
5
6Use DMA constant fill feature to clear VRAM area when
7someone allocates it.
8---
9 arch/arm/plat-omap/vram.c | 57 +++++++++++++++++++++++++++++++++++++++++++++
10 1 files changed, 57 insertions(+), 0 deletions(-)
11
12diff --git a/arch/arm/plat-omap/vram.c b/arch/arm/plat-omap/vram.c
13index 8e9fe77..90276ac 100644
14--- a/arch/arm/plat-omap/vram.c
15+++ b/arch/arm/plat-omap/vram.c
16@@ -31,11 +31,13 @@
17 #include <linux/seq_file.h>
18 #include <linux/bootmem.h>
19 #include <linux/omapfb.h>
20+#include <linux/completion.h>
21
22 #include <asm/setup.h>
23
24 #include <mach/sram.h>
25 #include <mach/vram.h>
26+#include <mach/dma.h>
27
28 #ifdef DEBUG
29 #define DBG(format, ...) printk(KERN_DEBUG "VRAM: " format, ## __VA_ARGS__)
30@@ -276,6 +278,59 @@ int omap_vram_reserve(unsigned long paddr, size_t size)
31 }
32 EXPORT_SYMBOL(omap_vram_reserve);
33
34+static void _omap_vram_dma_cb(int lch, u16 ch_status, void *data)
35+{
36+ struct completion *compl = data;
37+ complete(compl);
38+}
39+
40+static int _omap_vram_clear(u32 paddr, unsigned pages)
41+{
42+ struct completion compl;
43+ unsigned elem_count;
44+ unsigned frame_count;
45+ int r;
46+ int lch;
47+
48+ init_completion(&compl);
49+
50+ r = omap_request_dma(OMAP_DMA_NO_DEVICE, "VRAM DMA",
51+ _omap_vram_dma_cb,
52+ &compl, &lch);
53+ if (r) {
54+ pr_err("VRAM: request_dma failed for memory clear\n");
55+ return -EBUSY;
56+ }
57+
58+ elem_count = pages * PAGE_SIZE / 4;
59+ frame_count = 1;
60+
61+ omap_set_dma_transfer_params(lch, OMAP_DMA_DATA_TYPE_S32,
62+ elem_count, frame_count,
63+ OMAP_DMA_SYNC_ELEMENT,
64+ 0, 0);
65+
66+ omap_set_dma_dest_params(lch, 0, OMAP_DMA_AMODE_POST_INC,
67+ paddr, 0, 0);
68+
69+ omap_set_dma_color_mode(lch, OMAP_DMA_CONSTANT_FILL, 0x000000);
70+
71+ omap_start_dma(lch);
72+
73+ if (wait_for_completion_timeout(&compl, msecs_to_jiffies(1000)) == 0) {
74+ omap_stop_dma(lch);
75+ pr_err("VRAM: dma timeout while clearing memory\n");
76+ r = -EIO;
77+ goto err;
78+ }
79+
80+ r = 0;
81+err:
82+ omap_free_dma(lch);
83+
84+ return r;
85+}
86+
87 static int _omap_vram_alloc(int mtype, unsigned pages, unsigned long *paddr)
88 {
89 struct vram_region *rm;
90@@ -313,6 +368,8 @@ found:
91
92 *paddr = start;
93
94+ _omap_vram_clear(start, pages);
95+
96 return 0;
97 }
98
99--
1001.5.6.5
101