summaryrefslogtreecommitdiffstats
path: root/meta/recipes-kernel/linux/linux-omap-2.6.29/isp/omap3camera/0002-omap3isp-Add-ISP-MMU-wrapper.patch
diff options
context:
space:
mode:
authorRichard Purdie <rpurdie@linux.intel.com>2010-08-27 15:14:24 +0100
committerRichard Purdie <rpurdie@linux.intel.com>2010-08-27 15:29:45 +0100
commit29d6678fd546377459ef75cf54abeef5b969b5cf (patch)
tree8edd65790e37a00d01c3f203f773fe4b5012db18 /meta/recipes-kernel/linux/linux-omap-2.6.29/isp/omap3camera/0002-omap3isp-Add-ISP-MMU-wrapper.patch
parentda49de6885ee1bc424e70bc02f21f6ab920efb55 (diff)
downloadpoky-29d6678fd546377459ef75cf54abeef5b969b5cf.tar.gz
Major layout change to the packages directory
Having one monolithic packages directory makes it hard to find things and is generally overwhelming. This commit splits it into several logical sections roughly based on function, recipes.txt gives more information about the classifications used. The opportunity is also used to switch from "packages" to "recipes" as used in OpenEmbedded as the term "packages" can be confusing to people and has many different meanings. Not all recipes have been classified yet, this is just a first pass at separating things out. Some packages are moved to meta-extras as they're no longer actively used or maintained. Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
Diffstat (limited to 'meta/recipes-kernel/linux/linux-omap-2.6.29/isp/omap3camera/0002-omap3isp-Add-ISP-MMU-wrapper.patch')
-rw-r--r--meta/recipes-kernel/linux/linux-omap-2.6.29/isp/omap3camera/0002-omap3isp-Add-ISP-MMU-wrapper.patch209
1 files changed, 209 insertions, 0 deletions
diff --git a/meta/recipes-kernel/linux/linux-omap-2.6.29/isp/omap3camera/0002-omap3isp-Add-ISP-MMU-wrapper.patch b/meta/recipes-kernel/linux/linux-omap-2.6.29/isp/omap3camera/0002-omap3isp-Add-ISP-MMU-wrapper.patch
new file mode 100644
index 0000000000..cfca26723a
--- /dev/null
+++ b/meta/recipes-kernel/linux/linux-omap-2.6.29/isp/omap3camera/0002-omap3isp-Add-ISP-MMU-wrapper.patch
@@ -0,0 +1,209 @@
1From 731527a7dc26533a878c7c5f36fc148fdcaa21b8 Mon Sep 17 00:00:00 2001
2From: Sakari Ailus <sakari.ailus@maxwell.research.nokia.com>
3Date: Tue, 10 Mar 2009 10:49:02 +0200
4Subject: [PATCH] omap3isp: Add ISP MMU wrapper
5
6TODO:
7
8- The ISP driver should start using the IOMMU directly without this wrapper.
9
10Signed-off-by: Sakari Ailus <sakari.ailus@maxwell.research.nokia.com>
11---
12 drivers/media/video/isp/ispmmu.c | 141 ++++++++++++++++++++++++++++++++++++++
13 drivers/media/video/isp/ispmmu.h | 36 ++++++++++
14 2 files changed, 177 insertions(+), 0 deletions(-)
15 create mode 100644 drivers/media/video/isp/ispmmu.c
16 create mode 100644 drivers/media/video/isp/ispmmu.h
17
18diff --git a/drivers/media/video/isp/ispmmu.c b/drivers/media/video/isp/ispmmu.c
19new file mode 100644
20index 0000000..f872c71
21--- /dev/null
22+++ b/drivers/media/video/isp/ispmmu.c
23@@ -0,0 +1,141 @@
24+/*
25+ * omap iommu wrapper for TI's OMAP3430 Camera ISP
26+ *
27+ * Copyright (C) 2008--2009 Nokia.
28+ *
29+ * Contributors:
30+ * Hiroshi Doyu <hiroshi.doyu@nokia.com>
31+ * Sakari Ailus <sakari.ailus@nokia.com>
32+ *
33+ * This package is free software; you can redistribute it and/or modify
34+ * it under the terms of the GNU General Public License version 2 as
35+ * published by the Free Software Foundation.
36+ *
37+ * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
38+ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
39+ * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
40+ */
41+
42+#include <linux/module.h>
43+
44+#include "ispmmu.h"
45+#include "isp.h"
46+
47+#include <mach/iommu.h>
48+#include <mach/iovmm.h>
49+
50+#define IOMMU_FLAG (IOVMF_ENDIAN_LITTLE | IOVMF_ELSZ_8)
51+
52+static struct iommu *isp_iommu;
53+
54+dma_addr_t ispmmu_vmalloc(size_t bytes)
55+{
56+ return (dma_addr_t)iommu_vmalloc(isp_iommu, 0, bytes, IOMMU_FLAG);
57+}
58+
59+void ispmmu_vfree(const dma_addr_t da)
60+{
61+ iommu_vfree(isp_iommu, (u32)da);
62+}
63+
64+dma_addr_t ispmmu_kmap(u32 pa, int size)
65+{
66+ void *da;
67+
68+ da = (void *)iommu_kmap(isp_iommu, 0, pa, size, IOMMU_FLAG);
69+ if (IS_ERR(da))
70+ return PTR_ERR(da);
71+
72+ return (dma_addr_t)da;
73+}
74+
75+void ispmmu_kunmap(dma_addr_t da)
76+{
77+ iommu_kunmap(isp_iommu, (u32)da);
78+}
79+
80+dma_addr_t ispmmu_vmap(const struct scatterlist *sglist,
81+ int sglen)
82+{
83+ int err;
84+ void *da;
85+ struct sg_table *sgt;
86+ unsigned int i;
87+ struct scatterlist *sg, *src = (struct scatterlist *)sglist;
88+
89+ /*
90+ * convert isp sglist to iommu sgt
91+ * FIXME: should be fixed in the upper layer?
92+ */
93+ sgt = kmalloc(sizeof(*sgt), GFP_KERNEL);
94+ if (!sgt)
95+ return -ENOMEM;
96+ err = sg_alloc_table(sgt, sglen, GFP_KERNEL);
97+ if (err)
98+ goto err_sg_alloc;
99+
100+ for_each_sg(sgt->sgl, sg, sgt->nents, i)
101+ sg_set_buf(sg, phys_to_virt(sg_dma_address(src + i)),
102+ sg_dma_len(src + i));
103+
104+ da = (void *)iommu_vmap(isp_iommu, 0, sgt, IOMMU_FLAG);
105+ if (IS_ERR(da))
106+ goto err_vmap;
107+
108+ return (dma_addr_t)da;
109+
110+err_vmap:
111+ sg_free_table(sgt);
112+err_sg_alloc:
113+ kfree(sgt);
114+ return -ENOMEM;
115+}
116+EXPORT_SYMBOL_GPL(ispmmu_vmap);
117+
118+void ispmmu_vunmap(dma_addr_t da)
119+{
120+ struct sg_table *sgt;
121+
122+ sgt = iommu_vunmap(isp_iommu, (u32)da);
123+ if (!sgt)
124+ return;
125+ sg_free_table(sgt);
126+ kfree(sgt);
127+}
128+EXPORT_SYMBOL_GPL(ispmmu_vunmap);
129+
130+void ispmmu_save_context(void)
131+{
132+ if (isp_iommu)
133+ iommu_save_ctx(isp_iommu);
134+}
135+
136+void ispmmu_restore_context(void)
137+{
138+ if (isp_iommu)
139+ iommu_restore_ctx(isp_iommu);
140+}
141+
142+int __init ispmmu_init(void)
143+{
144+ int err = 0;
145+
146+ isp_get();
147+ isp_iommu = iommu_get("isp");
148+ if (IS_ERR(isp_iommu)) {
149+ err = PTR_ERR(isp_iommu);
150+ isp_iommu = NULL;
151+ }
152+ isp_put();
153+
154+ return err;
155+}
156+
157+void ispmmu_cleanup(void)
158+{
159+ isp_get();
160+ if (isp_iommu)
161+ iommu_put(isp_iommu);
162+ isp_put();
163+ isp_iommu = NULL;
164+}
165diff --git a/drivers/media/video/isp/ispmmu.h b/drivers/media/video/isp/ispmmu.h
166new file mode 100644
167index 0000000..0bc5bcb
168--- /dev/null
169+++ b/drivers/media/video/isp/ispmmu.h
170@@ -0,0 +1,36 @@
171+/*
172+ * omap iommu wrapper for TI's OMAP3430 Camera ISP
173+ *
174+ * Copyright (C) 2008--2009 Nokia.
175+ *
176+ * Contributors:
177+ * Hiroshi Doyu <hiroshi.doyu@nokia.com>
178+ * Sakari Ailus <sakari.ailus@nokia.com>
179+ *
180+ * This package is free software; you can redistribute it and/or modify
181+ * it under the terms of the GNU General Public License version 2 as
182+ * published by the Free Software Foundation.
183+ *
184+ * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
185+ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
186+ * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
187+ */
188+
189+#ifndef OMAP_ISP_MMU_H
190+#define OMAP_ISP_MMU_H
191+
192+#include <linux/err.h>
193+#include <linux/scatterlist.h>
194+
195+dma_addr_t ispmmu_vmalloc(size_t bytes);
196+void ispmmu_vfree(const dma_addr_t da);
197+dma_addr_t ispmmu_kmap(u32 pa, int size);
198+void ispmmu_kunmap(dma_addr_t da);
199+dma_addr_t ispmmu_vmap(const struct scatterlist *sglist, int sglen);
200+void ispmmu_vunmap(dma_addr_t da);
201+void ispmmu_save_context(void);
202+void ispmmu_restore_context(void);
203+int ispmmu_init(void);
204+void ispmmu_cleanup(void);
205+
206+#endif /* OMAP_ISP_MMU_H */
207--
2081.5.6.5
209