x86/boot: Rename overlapping memcpy() to memmove()
[linux/fpc-iii.git] / arch / arm / mach-exynos / s5p-dev-mfc.c
blob8ef1f3ee4e98676ce15c9ff95cfa20c85a980962
1 /*
2 * Copyright (C) 2010-2011 Samsung Electronics Co.Ltd
4 * Base S5P MFC resource and device definitions
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
11 #include <linux/kernel.h>
12 #include <linux/platform_device.h>
13 #include <linux/dma-mapping.h>
14 #include <linux/memblock.h>
15 #include <linux/ioport.h>
16 #include <linux/of_fdt.h>
17 #include <linux/of.h>
19 static struct platform_device s5p_device_mfc_l;
20 static struct platform_device s5p_device_mfc_r;
22 struct s5p_mfc_dt_meminfo {
23 unsigned long loff;
24 unsigned long lsize;
25 unsigned long roff;
26 unsigned long rsize;
27 char *compatible;
30 struct s5p_mfc_reserved_mem {
31 phys_addr_t base;
32 unsigned long size;
33 struct device *dev;
36 static struct s5p_mfc_reserved_mem s5p_mfc_mem[2] __initdata;
39 static void __init s5p_mfc_reserve_mem(phys_addr_t rbase, unsigned int rsize,
40 phys_addr_t lbase, unsigned int lsize)
42 int i;
44 s5p_mfc_mem[0].dev = &s5p_device_mfc_r.dev;
45 s5p_mfc_mem[0].base = rbase;
46 s5p_mfc_mem[0].size = rsize;
48 s5p_mfc_mem[1].dev = &s5p_device_mfc_l.dev;
49 s5p_mfc_mem[1].base = lbase;
50 s5p_mfc_mem[1].size = lsize;
52 for (i = 0; i < ARRAY_SIZE(s5p_mfc_mem); i++) {
53 struct s5p_mfc_reserved_mem *area = &s5p_mfc_mem[i];
54 if (memblock_remove(area->base, area->size)) {
55 printk(KERN_ERR "Failed to reserve memory for MFC device (%ld bytes at 0x%08lx)\n",
56 area->size, (unsigned long) area->base);
57 area->base = 0;
62 int __init s5p_fdt_alloc_mfc_mem(unsigned long node, const char *uname,
63 int depth, void *data)
65 const __be32 *prop;
66 int len;
67 struct s5p_mfc_dt_meminfo mfc_mem;
69 if (!data)
70 return 0;
72 if (!of_flat_dt_is_compatible(node, data))
73 return 0;
75 prop = of_get_flat_dt_prop(node, "samsung,mfc-l", &len);
76 if (!prop || (len != 2 * sizeof(unsigned long)))
77 return 0;
79 mfc_mem.loff = be32_to_cpu(prop[0]);
80 mfc_mem.lsize = be32_to_cpu(prop[1]);
82 prop = of_get_flat_dt_prop(node, "samsung,mfc-r", &len);
83 if (!prop || (len != 2 * sizeof(unsigned long)))
84 return 0;
86 mfc_mem.roff = be32_to_cpu(prop[0]);
87 mfc_mem.rsize = be32_to_cpu(prop[1]);
89 s5p_mfc_reserve_mem(mfc_mem.roff, mfc_mem.rsize,
90 mfc_mem.loff, mfc_mem.lsize);
92 return 1;