diff options
Diffstat (limited to 'arch/arm/plat-samsung/s5p-dev-mfc.c')
-rw-r--r-- | arch/arm/plat-samsung/s5p-dev-mfc.c | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/arch/arm/plat-samsung/s5p-dev-mfc.c b/arch/arm/plat-samsung/s5p-dev-mfc.c new file mode 100644 index 000000000000..ad6089465e2a --- /dev/null +++ b/arch/arm/plat-samsung/s5p-dev-mfc.c | |||
@@ -0,0 +1,71 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2010-2011 Samsung Electronics Co.Ltd | ||
3 | * | ||
4 | * Base S5P MFC resource and device definitions | ||
5 | * | ||
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 | */ | ||
10 | |||
11 | #include <linux/kernel.h> | ||
12 | #include <linux/interrupt.h> | ||
13 | #include <linux/platform_device.h> | ||
14 | #include <linux/dma-mapping.h> | ||
15 | #include <linux/memblock.h> | ||
16 | #include <linux/ioport.h> | ||
17 | |||
18 | #include <mach/map.h> | ||
19 | #include <plat/devs.h> | ||
20 | #include <plat/irqs.h> | ||
21 | #include <plat/mfc.h> | ||
22 | |||
23 | struct s5p_mfc_reserved_mem { | ||
24 | phys_addr_t base; | ||
25 | unsigned long size; | ||
26 | struct device *dev; | ||
27 | }; | ||
28 | |||
29 | static struct s5p_mfc_reserved_mem s5p_mfc_mem[2] __initdata; | ||
30 | |||
31 | void __init s5p_mfc_reserve_mem(phys_addr_t rbase, unsigned int rsize, | ||
32 | phys_addr_t lbase, unsigned int lsize) | ||
33 | { | ||
34 | int i; | ||
35 | |||
36 | s5p_mfc_mem[0].dev = &s5p_device_mfc_r.dev; | ||
37 | s5p_mfc_mem[0].base = rbase; | ||
38 | s5p_mfc_mem[0].size = rsize; | ||
39 | |||
40 | s5p_mfc_mem[1].dev = &s5p_device_mfc_l.dev; | ||
41 | s5p_mfc_mem[1].base = lbase; | ||
42 | s5p_mfc_mem[1].size = lsize; | ||
43 | |||
44 | for (i = 0; i < ARRAY_SIZE(s5p_mfc_mem); i++) { | ||
45 | struct s5p_mfc_reserved_mem *area = &s5p_mfc_mem[i]; | ||
46 | if (memblock_remove(area->base, area->size)) { | ||
47 | printk(KERN_ERR "Failed to reserve memory for MFC device (%ld bytes at 0x%08lx)\n", | ||
48 | area->size, (unsigned long) area->base); | ||
49 | area->base = 0; | ||
50 | } | ||
51 | } | ||
52 | } | ||
53 | |||
54 | static int __init s5p_mfc_memory_init(void) | ||
55 | { | ||
56 | int i; | ||
57 | |||
58 | for (i = 0; i < ARRAY_SIZE(s5p_mfc_mem); i++) { | ||
59 | struct s5p_mfc_reserved_mem *area = &s5p_mfc_mem[i]; | ||
60 | if (!area->base) | ||
61 | continue; | ||
62 | |||
63 | if (dma_declare_coherent_memory(area->dev, area->base, | ||
64 | area->base, area->size, | ||
65 | DMA_MEMORY_MAP | DMA_MEMORY_EXCLUSIVE) == 0) | ||
66 | printk(KERN_ERR "Failed to declare coherent memory for MFC device (%ld bytes at 0x%08lx)\n", | ||
67 | area->size, (unsigned long) area->base); | ||
68 | } | ||
69 | return 0; | ||
70 | } | ||
71 | device_initcall(s5p_mfc_memory_init); | ||