Merge "rockchip: only include libfdt in non-coreboot cases" into integration
diff --git a/plat/rockchip/common/params_setup.c b/plat/rockchip/common/params_setup.c
index dda98d9..baf2563 100644
--- a/plat/rockchip/common/params_setup.c
+++ b/plat/rockchip/common/params_setup.c
@@ -5,6 +5,7 @@
  */
 
 #include <assert.h>
+#include <errno.h>
 #include <string.h>
 
 #include <common/bl_common.h>
@@ -28,6 +29,12 @@
 uint32_t suspend_gpio_cnt;
 static struct apio_info *suspend_apio;
 
+#if COREBOOT
+static int dt_process_fdt(void *blob)
+{
+	return -ENODEV;
+}
+#else
 static uint8_t fdt_buffer[0x10000];
 
 void *plat_get_fdt(void)
@@ -35,6 +42,19 @@
 	return &fdt_buffer[0];
 }
 
+static int dt_process_fdt(void *blob)
+{
+	void *fdt = plat_get_fdt();
+	int ret;
+
+	ret = fdt_open_into(blob, fdt, 0x10000);
+	if (ret < 0)
+		return ret;
+
+	return 0;
+}
+#endif
+
 struct gpio_info *plat_get_rockchip_gpio_reset(void)
 {
 	return rst_gpio;
@@ -57,18 +77,6 @@
 	return suspend_apio;
 }
 
-static int dt_process_fdt(void *blob)
-{
-	void *fdt = plat_get_fdt();
-	int ret;
-
-	ret = fdt_open_into(blob, fdt, 0x10000);
-	if (ret < 0)
-		return ret;
-
-	return 0;
-}
-
 void params_early_setup(void *plat_param_from_bl2)
 {
 	struct bl31_plat_param *bl2_param;
diff --git a/plat/rockchip/rk3288/platform.mk b/plat/rockchip/rk3288/platform.mk
index 1a0a617..d203581 100644
--- a/plat/rockchip/rk3288/platform.mk
+++ b/plat/rockchip/rk3288/platform.mk
@@ -11,8 +11,6 @@
 RK_PLAT_SOC		:=	${RK_PLAT}/${PLAT}
 RK_PLAT_COMMON		:=	${RK_PLAT}/common
 
-include lib/libfdt/libfdt.mk
-
 PLAT_INCLUDES		:=	-I${RK_PLAT_COMMON}/				\
 				-I${RK_PLAT_COMMON}/include/			\
 				-I${RK_PLAT_COMMON}/aarch32/			\
@@ -42,7 +40,6 @@
 				drivers/delay_timer/delay_timer.c		\
 				drivers/delay_timer/generic_delay_timer.c	\
 				lib/cpus/aarch32/cortex_a12.S			\
-				$(LIBFDT_SRCS)					\
 				${RK_PLAT_COMMON}/aarch32/plat_helpers.S	\
 				${RK_PLAT_COMMON}/params_setup.c		\
 				${RK_PLAT_COMMON}/aarch32/pmu_sram_cpus_on.S	\
@@ -58,6 +55,7 @@
 MULTI_CONSOLE_API	:=	1
 
 include lib/coreboot/coreboot.mk
+include lib/libfdt/libfdt.mk
 
 $(eval $(call add_define,PLAT_SP_MIN_EXTRA_LD_SCRIPT))
 
diff --git a/plat/rockchip/rk3328/platform.mk b/plat/rockchip/rk3328/platform.mk
index ce8693a..3caa108 100644
--- a/plat/rockchip/rk3328/platform.mk
+++ b/plat/rockchip/rk3328/platform.mk
@@ -8,8 +8,6 @@
 RK_PLAT_SOC		:=	${RK_PLAT}/${PLAT}
 RK_PLAT_COMMON		:=	${RK_PLAT}/common
 
-include lib/libfdt/libfdt.mk
-
 PLAT_INCLUDES		:=	-Idrivers/arm/gic/common/			\
 				-Idrivers/arm/gic/v2/			\
 				-I${RK_PLAT_COMMON}/                            \
@@ -40,7 +38,6 @@
 				drivers/delay_timer/generic_delay_timer.c	\
 				lib/cpus/aarch64/aem_generic.S			\
 				lib/cpus/aarch64/cortex_a53.S			\
-				$(LIBFDT_SRCS)					\
 				${RK_PLAT_COMMON}/drivers/parameter/ddr_parameter.c	\
 				${RK_PLAT_COMMON}/aarch64/plat_helpers.S	\
 				${RK_PLAT_COMMON}/bl31_plat_setup.c		\
@@ -54,6 +51,7 @@
 MULTI_CONSOLE_API	:=	1
 
 include lib/coreboot/coreboot.mk
+include lib/libfdt/libfdt.mk
 
 $(eval $(call add_define,PLAT_EXTRA_LD_SCRIPT))
 $(eval $(call add_define,PLAT_SKIP_OPTEE_S_EL1_INT_REGISTER))
diff --git a/plat/rockchip/rk3368/platform.mk b/plat/rockchip/rk3368/platform.mk
index 8988dc5..0495a16 100644
--- a/plat/rockchip/rk3368/platform.mk
+++ b/plat/rockchip/rk3368/platform.mk
@@ -8,8 +8,6 @@
 RK_PLAT_SOC		:=	${RK_PLAT}/${PLAT}
 RK_PLAT_COMMON		:=	${RK_PLAT}/common
 
-include lib/libfdt/libfdt.mk
-
 PLAT_INCLUDES		:=	-I${RK_PLAT_COMMON}/				\
 				-I${RK_PLAT_COMMON}/include/			\
 				-I${RK_PLAT_COMMON}/aarch64/			\
@@ -37,7 +35,6 @@
 				drivers/delay_timer/delay_timer.c		\
 				drivers/delay_timer/generic_delay_timer.c	\
 				lib/cpus/aarch64/cortex_a53.S			\
-				$(LIBFDT_SRCS)					\
 				${RK_PLAT_COMMON}/aarch64/plat_helpers.S	\
 				${RK_PLAT_COMMON}/bl31_plat_setup.c		\
 				${RK_PLAT_COMMON}/params_setup.c                \
@@ -54,6 +51,7 @@
 MULTI_CONSOLE_API	:=	1
 
 include lib/coreboot/coreboot.mk
+include lib/libfdt/libfdt.mk
 
 $(eval $(call add_define,PLAT_EXTRA_LD_SCRIPT))
 
diff --git a/plat/rockchip/rk3399/platform.mk b/plat/rockchip/rk3399/platform.mk
index 3dfafc9..c73df6d 100644
--- a/plat/rockchip/rk3399/platform.mk
+++ b/plat/rockchip/rk3399/platform.mk
@@ -8,8 +8,6 @@
 RK_PLAT_SOC	:=	${RK_PLAT}/${PLAT}
 RK_PLAT_COMMON	:=	${RK_PLAT}/common
 
-include lib/libfdt/libfdt.mk
-
 PLAT_INCLUDES		:=	-I${RK_PLAT_COMMON}/			\
 				-I${RK_PLAT_COMMON}/include/		\
 				-I${RK_PLAT_COMMON}/aarch64/		\
@@ -45,7 +43,6 @@
 			drivers/gpio/gpio.c				\
 			lib/cpus/aarch64/cortex_a53.S			\
 			lib/cpus/aarch64/cortex_a72.S			\
-			$(LIBFDT_SRCS)					\
 			${RK_PLAT_COMMON}/aarch64/plat_helpers.S	\
 			${RK_PLAT_COMMON}/bl31_plat_setup.c		\
 			${RK_PLAT_COMMON}/params_setup.c		\
@@ -71,6 +68,7 @@
 MULTI_CONSOLE_API	:=	1
 
 include lib/coreboot/coreboot.mk
+include lib/libfdt/libfdt.mk
 
 $(eval $(call add_define,PLAT_EXTRA_LD_SCRIPT))