aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sh/mm/consistent.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2008-07-28 11:41:13 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-07-28 11:41:13 -0400
commitb10a8b7238d7b034f28d32a85bb05c48475f132a (patch)
tree8e70e816757c2a517de6fb721dd9ac2276619c26 /arch/sh/mm/consistent.c
parent37eaf8c7463e53cf1acf025fb566fb6c4573297f (diff)
parent8b2224dc6a5b46cfa1d54ab1fe82107351c66443 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/lethal/sh-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/lethal/sh-2.6: (72 commits) sh: SuperH Mobile CEU and camera platform data for AP325RXA sh: Update smc911x platform data for AP325RXA sh: SuperH Mobile LCDC platform data for AP325RXA sh: Add SuperH Mobile CEU platform data for Migo-R sh: Add SuperH Mobile LCDC platform data for Migo-R sh: Move asid_cache() out of ifdef to fix SH-3/4 nommu build. sh: Workaround for __put_user_asm() bug with gcc 4.x on big-endian. sh: Wire up new syscalls. sh: fix uImage Entry Point sh_keysc: remove request_mem_region() and release_mem_region() sh: Don't miss pending signals returning to user mode after signal processing sh: Use clk_always_enable() on sh7366 sh: Use clk_always_enable() on sh7343 / SE77343 sh: Use clk_always_enable() on sh7722 / Migo-R / SE7722 sh: Use clk_always_enable() on sh7723 / ap325rxa sh: Introduce clk_always_enable() function sh: Show all clocks and their state in /proc/clocks sh: Merge sh7343 and sh7722 clock code sh: Add SuperH Mobile MSTPCR bits to clock framework sh: Use arch_flags to simplify sh7722 siu clock code ...
Diffstat (limited to 'arch/sh/mm/consistent.c')
-rw-r--r--arch/sh/mm/consistent.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/arch/sh/mm/consistent.c b/arch/sh/mm/consistent.c
index d3c33fc5b1c2..8277982d0938 100644
--- a/arch/sh/mm/consistent.c
+++ b/arch/sh/mm/consistent.c
@@ -10,6 +10,7 @@
10 * for more details. 10 * for more details.
11 */ 11 */
12#include <linux/mm.h> 12#include <linux/mm.h>
13#include <linux/platform_device.h>
13#include <linux/dma-mapping.h> 14#include <linux/dma-mapping.h>
14#include <asm/cacheflush.h> 15#include <asm/cacheflush.h>
15#include <asm/addrspace.h> 16#include <asm/addrspace.h>
@@ -185,3 +186,32 @@ void dma_cache_sync(struct device *dev, void *vaddr, size_t size,
185 } 186 }
186} 187}
187EXPORT_SYMBOL(dma_cache_sync); 188EXPORT_SYMBOL(dma_cache_sync);
189
190int platform_resource_setup_memory(struct platform_device *pdev,
191 char *name, unsigned long memsize)
192{
193 struct resource *r;
194 dma_addr_t dma_handle;
195 void *buf;
196
197 r = pdev->resource + pdev->num_resources - 1;
198 if (r->flags) {
199 pr_warning("%s: unable to find empty space for resource\n",
200 name);
201 return -EINVAL;
202 }
203
204 buf = dma_alloc_coherent(NULL, memsize, &dma_handle, GFP_KERNEL);
205 if (!buf) {
206 pr_warning("%s: unable to allocate memory\n", name);
207 return -ENOMEM;
208 }
209
210 memset(buf, 0, memsize);
211
212 r->flags = IORESOURCE_MEM;
213 r->start = dma_handle;
214 r->end = r->start + memsize - 1;
215 r->name = name;
216 return 0;
217}