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.
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>
19 #include <plat/devs.h>
20 #include <plat/irqs.h>
23 struct s5p_mfc_reserved_mem
{
29 static struct s5p_mfc_reserved_mem s5p_mfc_mem
[2] __initdata
;
31 void __init
s5p_mfc_reserve_mem(phys_addr_t rbase
, unsigned int rsize
,
32 phys_addr_t lbase
, unsigned int lsize
)
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
;
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
;
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
);
54 static int __init
s5p_mfc_memory_init(void)
58 for (i
= 0; i
< ARRAY_SIZE(s5p_mfc_mem
); i
++) {
59 struct s5p_mfc_reserved_mem
*area
= &s5p_mfc_mem
[i
];
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
);
71 device_initcall(s5p_mfc_memory_init
);