Browse Source

ARM: SAMSUNG: Reorganize calls to reserve memory for MFC

Reorganize code so that "plat/mfc.h" is no more referred
from mach-exynos directory.

Signed-off-by: Tushar Behera <tushar.behera@linaro.org>
Signed-off-by: Kukjin Kim <kgene.kim@samsung.com>
Tushar Behera 11 years ago
parent
commit
8b3e8bbd13

+ 2 - 8
arch/arm/mach-exynos/mach-exynos4-dt.c

@@ -15,9 +15,9 @@
 #include <linux/of_fdt.h>
 #include <linux/of_fdt.h>
 
 
 #include <asm/mach/arch.h>
 #include <asm/mach/arch.h>
-#include <plat/mfc.h>
 
 
 #include "common.h"
 #include "common.h"
+#include "mfc.h"
 
 
 static void __init exynos4_dt_machine_init(void)
 static void __init exynos4_dt_machine_init(void)
 {
 {
@@ -37,13 +37,7 @@ static char const *exynos4_dt_compat[] __initdata = {
 static void __init exynos4_reserve(void)
 static void __init exynos4_reserve(void)
 {
 {
 #ifdef CONFIG_S5P_DEV_MFC
 #ifdef CONFIG_S5P_DEV_MFC
-	struct s5p_mfc_dt_meminfo mfc_mem;
-
-	/* Reserve memory for MFC only if it's available */
-	mfc_mem.compatible = "samsung,mfc-v5";
-	if (of_scan_flat_dt(s5p_fdt_find_mfc_mem, &mfc_mem))
-		s5p_mfc_reserve_mem(mfc_mem.roff, mfc_mem.rsize, mfc_mem.loff,
-				mfc_mem.lsize);
+	of_scan_flat_dt(s5p_fdt_alloc_mfc_mem, "samsung,mfc-v5");
 #endif
 #endif
 }
 }
 DT_MACHINE_START(EXYNOS4210_DT, "Samsung Exynos4 (Flattened Device Tree)")
 DT_MACHINE_START(EXYNOS4210_DT, "Samsung Exynos4 (Flattened Device Tree)")

+ 2 - 8
arch/arm/mach-exynos/mach-exynos5-dt.c

@@ -14,9 +14,9 @@
 #include <linux/io.h>
 #include <linux/io.h>
 
 
 #include <asm/mach/arch.h>
 #include <asm/mach/arch.h>
-#include <plat/mfc.h>
 
 
 #include "common.h"
 #include "common.h"
+#include "mfc.h"
 #include "regs-pmu.h"
 #include "regs-pmu.h"
 
 
 static void __init exynos5_dt_machine_init(void)
 static void __init exynos5_dt_machine_init(void)
@@ -59,13 +59,7 @@ static char const *exynos5_dt_compat[] __initdata = {
 static void __init exynos5_reserve(void)
 static void __init exynos5_reserve(void)
 {
 {
 #ifdef CONFIG_S5P_DEV_MFC
 #ifdef CONFIG_S5P_DEV_MFC
-	struct s5p_mfc_dt_meminfo mfc_mem;
-
-	/* Reserve memory for MFC only if it's available */
-	mfc_mem.compatible = "samsung,mfc-v6";
-	if (of_scan_flat_dt(s5p_fdt_find_mfc_mem, &mfc_mem))
-		s5p_mfc_reserve_mem(mfc_mem.roff, mfc_mem.rsize, mfc_mem.loff,
-				mfc_mem.lsize);
+	of_scan_flat_dt(s5p_fdt_alloc_mfc_mem, "samsung,mfc-v6");
 #endif
 #endif
 }
 }
 
 

+ 16 - 0
arch/arm/mach-exynos/mfc.h

@@ -0,0 +1,16 @@
+/*
+ * Copyright (C) 2013 Samsung Electronics Co.Ltd
+ *
+ * This program is free software; you can redistribute  it and/or modify it
+ * under  the terms of  the GNU General  Public License as published by the
+ * Free Software Foundation;  either version 2 of the  License, or (at your
+ * option) any later version.
+ */
+
+#ifndef __MACH_EXYNOS_MFC_H
+#define __MACH_EXYNOS_MFC_H __FILE__
+
+int __init s5p_fdt_alloc_mfc_mem(unsigned long node, const char *uname,
+				int depth, void *data);
+
+#endif /* __MACH_EXYNOS_MFC_H */

+ 0 - 3
arch/arm/plat-samsung/include/plat/mfc.h

@@ -32,7 +32,4 @@ struct s5p_mfc_dt_meminfo {
 void __init s5p_mfc_reserve_mem(phys_addr_t rbase, unsigned int rsize,
 void __init s5p_mfc_reserve_mem(phys_addr_t rbase, unsigned int rsize,
 				phys_addr_t lbase, unsigned int lsize);
 				phys_addr_t lbase, unsigned int lsize);
 
 
-int __init s5p_fdt_find_mfc_mem(unsigned long node, const char *uname,
-				int depth, void *data);
-
 #endif /* __PLAT_SAMSUNG_MFC_H */
 #endif /* __PLAT_SAMSUNG_MFC_H */

+ 10 - 7
arch/arm/plat-samsung/s5p-dev-mfc.c

@@ -122,32 +122,35 @@ device_initcall(s5p_mfc_memory_init);
 #endif
 #endif
 
 
 #ifdef CONFIG_OF
 #ifdef CONFIG_OF
-int __init s5p_fdt_find_mfc_mem(unsigned long node, const char *uname,
+int __init s5p_fdt_alloc_mfc_mem(unsigned long node, const char *uname,
 				int depth, void *data)
 				int depth, void *data)
 {
 {
 	__be32 *prop;
 	__be32 *prop;
 	unsigned long len;
 	unsigned long len;
-	struct s5p_mfc_dt_meminfo *mfc_mem = data;
+	struct s5p_mfc_dt_meminfo mfc_mem;
 
 
 	if (!data)
 	if (!data)
 		return 0;
 		return 0;
 
 
-	if (!of_flat_dt_is_compatible(node, mfc_mem->compatible))
+	if (!of_flat_dt_is_compatible(node, data))
 		return 0;
 		return 0;
 
 
 	prop = of_get_flat_dt_prop(node, "samsung,mfc-l", &len);
 	prop = of_get_flat_dt_prop(node, "samsung,mfc-l", &len);
 	if (!prop || (len != 2 * sizeof(unsigned long)))
 	if (!prop || (len != 2 * sizeof(unsigned long)))
 		return 0;
 		return 0;
 
 
-	mfc_mem->loff = be32_to_cpu(prop[0]);
-	mfc_mem->lsize = be32_to_cpu(prop[1]);
+	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);
 	prop = of_get_flat_dt_prop(node, "samsung,mfc-r", &len);
 	if (!prop || (len != 2 * sizeof(unsigned long)))
 	if (!prop || (len != 2 * sizeof(unsigned long)))
 		return 0;
 		return 0;
 
 
-	mfc_mem->roff = be32_to_cpu(prop[0]);
-	mfc_mem->rsize = be32_to_cpu(prop[1]);
+	mfc_mem.roff = be32_to_cpu(prop[0]);
+	mfc_mem.rsize = be32_to_cpu(prop[1]);
+
+	s5p_mfc_reserve_mem(mfc_mem.roff, mfc_mem.rsize,
+			mfc_mem.loff, mfc_mem.lsize);
 
 
 	return 1;
 	return 1;
 }
 }