]> rtime.felk.cvut.cz Git - can-eth-gw-linux.git/blobdiff - arch/arm/plat-samsung/s5p-dev-mfc.c
Merge tag 'dt' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc
[can-eth-gw-linux.git] / arch / arm / plat-samsung / s5p-dev-mfc.c
index ad6089465e2afba33b49cc1def128c3c0f9a2cd5..5ec104b5408b37d58e25efa202439110150a21c2 100644 (file)
@@ -14,6 +14,8 @@
 #include <linux/dma-mapping.h>
 #include <linux/memblock.h>
 #include <linux/ioport.h>
+#include <linux/of_fdt.h>
+#include <linux/of.h>
 
 #include <mach/map.h>
 #include <plat/devs.h>
@@ -69,3 +71,35 @@ static int __init s5p_mfc_memory_init(void)
        return 0;
 }
 device_initcall(s5p_mfc_memory_init);
+
+#ifdef CONFIG_OF
+int __init s5p_fdt_find_mfc_mem(unsigned long node, const char *uname,
+                               int depth, void *data)
+{
+       __be32 *prop;
+       unsigned long len;
+       struct s5p_mfc_dt_meminfo *mfc_mem = data;
+
+       if (!data)
+               return 0;
+
+       if (!of_flat_dt_is_compatible(node, mfc_mem->compatible))
+               return 0;
+
+       prop = of_get_flat_dt_prop(node, "samsung,mfc-l", &len);
+       if (!prop || (len != 2 * sizeof(unsigned long)))
+               return 0;
+
+       mfc_mem->loff = be32_to_cpu(prop[0]);
+       mfc_mem->lsize = be32_to_cpu(prop[1]);
+
+       prop = of_get_flat_dt_prop(node, "samsung,mfc-r", &len);
+       if (!prop || (len != 2 * sizeof(unsigned long)))
+               return 0;
+
+       mfc_mem->roff = be32_to_cpu(prop[0]);
+       mfc_mem->rsize = be32_to_cpu(prop[1]);
+
+       return 1;
+}
+#endif