From 2d4135e08fb11989a4bbd6ebf9f3c1b324493237 Mon Sep 17 00:00:00 2001
From: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
Date: Wed, 23 Jan 2019 18:55:03 +0000
Subject: [PATCH] plat/arm: scp: Move to drivers/ folder

Change-Id: Ida5dae39478654405d0ee31a6cbddb4579e76a7f
Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
---
 .../arm/css}/scp/css_bom_bootloader.c         |  3 +--
 .../arm/css}/scp/css_pm_scmi.c                |  3 +--
 .../arm/css}/scp/css_pm_scpi.c                |  3 +--
 .../drivers => drivers/arm/css}/scp/css_sds.c |  2 +-
 .../scp => include/drivers/arm/css}/css_scp.h |  0
 plat/arm/css/common/css_bl2_setup.c           |  3 +--
 plat/arm/css/common/css_bl2u_setup.c          |  3 +--
 plat/arm/css/common/css_common.mk             | 22 +++++++++----------
 plat/arm/css/common/css_pm.c                  |  3 +--
 plat/arm/css/common/sp_min/css_sp_min.mk      |  8 +++----
 10 files changed, 22 insertions(+), 28 deletions(-)
 rename {plat/arm/css/drivers => drivers/arm/css}/scp/css_bom_bootloader.c (99%)
 rename {plat/arm/css/drivers => drivers/arm/css}/scp/css_pm_scmi.c (99%)
 rename {plat/arm/css/drivers => drivers/arm/css}/scp/css_pm_scpi.c (99%)
 rename {plat/arm/css/drivers => drivers/arm/css}/scp/css_sds.c (98%)
 rename {plat/arm/css/drivers/scp => include/drivers/arm/css}/css_scp.h (100%)

diff --git a/plat/arm/css/drivers/scp/css_bom_bootloader.c b/drivers/arm/css/scp/css_bom_bootloader.c
similarity index 99%
rename from plat/arm/css/drivers/scp/css_bom_bootloader.c
rename to drivers/arm/css/scp/css_bom_bootloader.c
index 40880da29..1fc1270ba 100644
--- a/plat/arm/css/drivers/scp/css_bom_bootloader.c
+++ b/drivers/arm/css/scp/css_bom_bootloader.c
@@ -10,12 +10,11 @@
 #include <arch_helpers.h>
 #include <common/debug.h>
 #include <drivers/arm/css/css_mhu.h>
+#include <drivers/arm/css/css_scp.h>
 #include <drivers/arm/css/css_scpi.h>
 #include <plat/common/platform.h>
 #include <platform_def.h>
 
-#include "css_scp.h"
-
 /* ID of the MHU slot used for the BOM protocol */
 #define BOM_MHU_SLOT_ID		0
 
diff --git a/plat/arm/css/drivers/scp/css_pm_scmi.c b/drivers/arm/css/scp/css_pm_scmi.c
similarity index 99%
rename from plat/arm/css/drivers/scp/css_pm_scmi.c
rename to drivers/arm/css/scp/css_pm_scmi.c
index 2980d9ac3..1966c44ca 100644
--- a/plat/arm/css/drivers/scp/css_pm_scmi.c
+++ b/drivers/arm/css/scp/css_pm_scmi.c
@@ -9,14 +9,13 @@
 
 #include <arch_helpers.h>
 #include <common/debug.h>
+#include <drivers/arm/css/css_scp.h>
 #include <drivers/arm/css/scmi.h>
 #include <plat/arm/common/plat_arm.h>
 #include <plat/arm/css/common/css_pm.h>
 #include <plat/common/platform.h>
 #include <platform_def.h>
 
-#include "css_scp.h"
-
 /*
  * This file implements the SCP helper functions using SCMI protocol.
  */
diff --git a/plat/arm/css/drivers/scp/css_pm_scpi.c b/drivers/arm/css/scp/css_pm_scpi.c
similarity index 99%
rename from plat/arm/css/drivers/scp/css_pm_scpi.c
rename to drivers/arm/css/scp/css_pm_scpi.c
index 7e228169a..b4019ce03 100644
--- a/plat/arm/css/drivers/scp/css_pm_scpi.c
+++ b/drivers/arm/css/scp/css_pm_scpi.c
@@ -8,12 +8,11 @@
 
 #include <arch_helpers.h>
 #include <common/debug.h>
+#include <drivers/arm/css/css_scp.h>
 #include <drivers/arm/css/css_scpi.h>
 #include <plat/arm/common/plat_arm.h>
 #include <plat/arm/css/common/css_pm.h>
 
-#include "css_scp.h"
-
 /*
  * This file implements the SCP power management functions using SCPI protocol.
  */
diff --git a/plat/arm/css/drivers/scp/css_sds.c b/drivers/arm/css/scp/css_sds.c
similarity index 98%
rename from plat/arm/css/drivers/scp/css_sds.c
rename to drivers/arm/css/scp/css_sds.c
index e3f6102fa..2bfe75011 100644
--- a/plat/arm/css/drivers/scp/css_sds.c
+++ b/drivers/arm/css/scp/css_sds.c
@@ -9,11 +9,11 @@
 
 #include <arch_helpers.h>
 #include <common/debug.h>
+#include <drivers/arm/css/css_scp.h>
 #include <drivers/delay_timer.h>
 #include <plat/common/platform.h>
 #include <platform_def.h>
 
-#include "css_scp.h"
 #include "../sds/sds.h"
 
 int css_scp_boot_image_xfer(void *image, unsigned int image_size)
diff --git a/plat/arm/css/drivers/scp/css_scp.h b/include/drivers/arm/css/css_scp.h
similarity index 100%
rename from plat/arm/css/drivers/scp/css_scp.h
rename to include/drivers/arm/css/css_scp.h
diff --git a/plat/arm/css/common/css_bl2_setup.c b/plat/arm/css/common/css_bl2_setup.c
index 1538e2976..002c6eb93 100644
--- a/plat/arm/css/common/css_bl2_setup.c
+++ b/plat/arm/css/common/css_bl2_setup.c
@@ -8,13 +8,12 @@
 
 #include <common/bl_common.h>
 #include <common/debug.h>
+#include <drivers/arm/css/css_scp.h>
 #include <lib/mmio.h>
 #include <lib/utils.h>
 #include <plat/arm/common/plat_arm.h>
 #include <platform_def.h>
 
-#include "../drivers/scp/css_scp.h"
-
 /* Weak definition may be overridden in specific CSS based platform */
 #pragma weak plat_arm_bl2_handle_scp_bl2
 
diff --git a/plat/arm/css/common/css_bl2u_setup.c b/plat/arm/css/common/css_bl2u_setup.c
index c3b4f2b3f..15cf4f665 100644
--- a/plat/arm/css/common/css_bl2u_setup.c
+++ b/plat/arm/css/common/css_bl2u_setup.c
@@ -6,11 +6,10 @@
 
 #include <common/bl_common.h>
 #include <common/debug.h>
+#include <drivers/arm/css/css_scp.h>
 #include <plat/arm/common/plat_arm.h>
 #include <plat/common/platform.h>
 
-#include "../drivers/scp/css_scp.h"
-
 /* Weak definition may be overridden in specific CSS based platform */
 #pragma weak bl2u_plat_handle_scp_bl2u
 
diff --git a/plat/arm/css/common/css_common.mk b/plat/arm/css/common/css_common.mk
index 36da73208..fba9cdcee 100644
--- a/plat/arm/css/common/css_common.mk
+++ b/plat/arm/css/common/css_common.mk
@@ -27,15 +27,15 @@ BL31_SOURCES		+=	plat/arm/css/common/css_pm.c			\
 
 ifeq (${CSS_USE_SCMI_SDS_DRIVER},0)
 BL31_SOURCES		+=	drivers/arm/css/mhu/css_mhu.c			\
-				drivers/arm/css/scpi/css_scpi.c			\
-				plat/arm/css/drivers/scp/css_pm_scpi.c
+				drivers/arm/css/scp/css_pm_scpi.c		\
+				drivers/arm/css/scpi/css_scpi.c
 else
 BL31_SOURCES		+=	drivers/arm/css/mhu/css_mhu_doorbell.c		\
 				drivers/arm/css/scmi/scmi_ap_core_proto.c	\
 				drivers/arm/css/scmi/scmi_common.c		\
 				drivers/arm/css/scmi/scmi_pwr_dmn_proto.c	\
 				drivers/arm/css/scmi/scmi_sys_pwr_proto.c	\
-				plat/arm/css/drivers/scp/css_pm_scmi.c
+				drivers/arm/css/scp/css_pm_scmi.c
 endif
 
 # Process CSS_LOAD_SCP_IMAGES flag
@@ -49,19 +49,19 @@ ifeq (${CSS_LOAD_SCP_IMAGES},1)
   endif
 
   ifeq (${CSS_USE_SCMI_SDS_DRIVER},1)
-    BL2U_SOURCES	+=	plat/arm/css/drivers/scp/css_sds.c	\
+    BL2U_SOURCES	+=	drivers/arm/css/scp/css_sds.c			\
 				plat/arm/css/drivers/sds/sds.c
 
-    BL2_SOURCES		+=	plat/arm/css/drivers/scp/css_sds.c	\
+    BL2_SOURCES		+=	drivers/arm/css/scp/css_sds.c			\
 				plat/arm/css/drivers/sds/sds.c
   else
-    BL2U_SOURCES	+=	drivers/arm/css/mhu/css_mhu.c		\
-				drivers/arm/css/scpi/css_scpi.c		\
-				plat/arm/css/drivers/scp/css_bom_bootloader.c
+    BL2U_SOURCES	+=	drivers/arm/css/mhu/css_mhu.c			\
+				drivers/arm/css/scp/css_bom_bootloader.c	\
+				drivers/arm/css/scpi/css_scpi.c
 
-    BL2_SOURCES		+=	drivers/arm/css/mhu/css_mhu.c		\
-				drivers/arm/css/scpi/css_scpi.c		\
-				plat/arm/css/drivers/scp/css_bom_bootloader.c
+    BL2_SOURCES		+=	drivers/arm/css/mhu/css_mhu.c			\
+				drivers/arm/css/scp/css_bom_bootloader.c	\
+				drivers/arm/css/scpi/css_scpi.c
     # Enable option to detect whether the SCP ROM firmware in use predates version
     # 1.7.0 and therefore, is incompatible.
     CSS_DETECT_PRE_1_7_0_SCP	:=	1
diff --git a/plat/arm/css/common/css_pm.c b/plat/arm/css/common/css_pm.c
index 47412dfa4..f6fc6aa7a 100644
--- a/plat/arm/css/common/css_pm.c
+++ b/plat/arm/css/common/css_pm.c
@@ -11,13 +11,12 @@
 
 #include <arch_helpers.h>
 #include <common/debug.h>
+#include <drivers/arm/css/css_scp.h>
 #include <lib/cassert.h>
 #include <plat/arm/common/plat_arm.h>
 #include <plat/arm/css/common/css_pm.h>
 #include <plat/common/platform.h>
 
-#include "../drivers/scp/css_scp.h"
-
 /* Allow CSS platforms to override `plat_arm_psci_pm_ops` */
 #pragma weak plat_arm_psci_pm_ops
 
diff --git a/plat/arm/css/common/sp_min/css_sp_min.mk b/plat/arm/css/common/sp_min/css_sp_min.mk
index a7c61be82..6523a164b 100644
--- a/plat/arm/css/common/sp_min/css_sp_min.mk
+++ b/plat/arm/css/common/sp_min/css_sp_min.mk
@@ -10,12 +10,12 @@ BL32_SOURCES		+=	plat/arm/css/common/css_pm.c			\
 
 ifeq (${CSS_USE_SCMI_SDS_DRIVER},0)
 BL32_SOURCES		+=	drivers/arm/css/mhu/css_mhu.c			\
-				drivers/arm/css/scpi/css_scpi.c			\
-				plat/arm/css/drivers/scp/css_pm_scpi.c
+				drivers/arm/css/scp/css_pm_scpi.c		\
+				drivers/arm/css/scpi/css_scpi.c
 else
 BL32_SOURCES		+=	drivers/arm/css/mhu/css_mhu_doorbell.c		\
+				drivers/arm/css/scp/css_pm_scmi.c		\
 				drivers/arm/css/scmi/scmi_common.c		\
 				drivers/arm/css/scmi/scmi_pwr_dmn_proto.c	\
-				drivers/arm/css/scmi/scmi_sys_pwr_proto.c	\
-				plat/arm/css/drivers/scp/css_pm_scmi.c
+				drivers/arm/css/scmi/scmi_sys_pwr_proto.c
 endif
-- 
GitLab