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>
17 #include <linux/of_fdt.h>
20 static struct platform_device s5p_device_mfc_l
;
21 static struct platform_device s5p_device_mfc_r
;
23 struct s5p_mfc_dt_meminfo
{
31 struct s5p_mfc_reserved_mem
{
37 static struct s5p_mfc_reserved_mem s5p_mfc_mem
[2] __initdata
;
40 static void __init
s5p_mfc_reserve_mem(phys_addr_t rbase
, unsigned int rsize
,
41 phys_addr_t lbase
, unsigned int lsize
)
45 s5p_mfc_mem
[0].dev
= &s5p_device_mfc_r
.dev
;
46 s5p_mfc_mem
[0].base
= rbase
;
47 s5p_mfc_mem
[0].size
= rsize
;
49 s5p_mfc_mem
[1].dev
= &s5p_device_mfc_l
.dev
;
50 s5p_mfc_mem
[1].base
= lbase
;
51 s5p_mfc_mem
[1].size
= lsize
;
53 for (i
= 0; i
< ARRAY_SIZE(s5p_mfc_mem
); i
++) {
54 struct s5p_mfc_reserved_mem
*area
= &s5p_mfc_mem
[i
];
55 if (memblock_remove(area
->base
, area
->size
)) {
56 printk(KERN_ERR
"Failed to reserve memory for MFC device (%ld bytes at 0x%08lx)\n",
57 area
->size
, (unsigned long) area
->base
);
63 int __init
s5p_fdt_alloc_mfc_mem(unsigned long node
, const char *uname
,
64 int depth
, void *data
)
68 struct s5p_mfc_dt_meminfo mfc_mem
;
73 if (!of_flat_dt_is_compatible(node
, data
))
76 prop
= of_get_flat_dt_prop(node
, "samsung,mfc-l", &len
);
77 if (!prop
|| (len
!= 2 * sizeof(unsigned long)))
80 mfc_mem
.loff
= be32_to_cpu(prop
[0]);
81 mfc_mem
.lsize
= be32_to_cpu(prop
[1]);
83 prop
= of_get_flat_dt_prop(node
, "samsung,mfc-r", &len
);
84 if (!prop
|| (len
!= 2 * sizeof(unsigned long)))
87 mfc_mem
.roff
= be32_to_cpu(prop
[0]);
88 mfc_mem
.rsize
= be32_to_cpu(prop
[1]);
90 s5p_mfc_reserve_mem(mfc_mem
.roff
, mfc_mem
.rsize
,
91 mfc_mem
.loff
, mfc_mem
.lsize
);