amlogic: Move MHU code to common directory
authorCarlo Caione <ccaione@baylibre.com>
Sat, 24 Aug 2019 16:46:04 +0000 (17:46 +0100)
committerCarlo Caione <ccaione@baylibre.com>
Thu, 5 Sep 2019 09:39:30 +0000 (10:39 +0100)
The MHU code is shared between all the supported platforms. Move it to
the common directory instead.

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
Change-Id: Iaf53122866eae85c13f772927d16836dcfa877a3

plat/amlogic/common/aml_mhu.c [new file with mode: 0644]
plat/amlogic/gxbb/gxbb_mhu.c [deleted file]
plat/amlogic/gxbb/platform.mk
plat/amlogic/gxl/gxl_mhu.c [deleted file]
plat/amlogic/gxl/platform.mk

diff --git a/plat/amlogic/common/aml_mhu.c b/plat/amlogic/common/aml_mhu.c
new file mode 100644 (file)
index 0000000..4c1d5b6
--- /dev/null
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2018, ARM Limited and Contributors. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#include <lib/bakery_lock.h>
+#include <lib/mmio.h>
+#include <platform_def.h>
+
+static DEFINE_BAKERY_LOCK(mhu_lock);
+
+void mhu_secure_message_start(void)
+{
+       bakery_lock_get(&mhu_lock);
+
+       while (mmio_read_32(GXBB_HIU_MAILBOX_STAT_3) != 0)
+               ;
+}
+
+void mhu_secure_message_send(uint32_t msg)
+{
+       mmio_write_32(GXBB_HIU_MAILBOX_SET_3, msg);
+
+       while (mmio_read_32(GXBB_HIU_MAILBOX_STAT_3) != 0)
+               ;
+}
+
+uint32_t mhu_secure_message_wait(void)
+{
+       uint32_t val;
+
+       do {
+               val = mmio_read_32(GXBB_HIU_MAILBOX_STAT_0);
+       } while (val == 0);
+
+       return val;
+}
+
+void mhu_secure_message_end(void)
+{
+       mmio_write_32(GXBB_HIU_MAILBOX_CLR_0, 0xFFFFFFFF);
+
+       bakery_lock_release(&mhu_lock);
+}
+
+void mhu_secure_init(void)
+{
+       bakery_lock_init(&mhu_lock);
+
+       mmio_write_32(GXBB_HIU_MAILBOX_CLR_3, 0xFFFFFFFF);
+}
diff --git a/plat/amlogic/gxbb/gxbb_mhu.c b/plat/amlogic/gxbb/gxbb_mhu.c
deleted file mode 100644 (file)
index 903ef41..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright (c) 2018, ARM Limited and Contributors. All rights reserved.
- *
- * SPDX-License-Identifier: BSD-3-Clause
- */
-
-#include <platform_def.h>
-
-#include <lib/bakery_lock.h>
-#include <lib/mmio.h>
-
-static DEFINE_BAKERY_LOCK(mhu_lock);
-
-void mhu_secure_message_start(void)
-{
-       bakery_lock_get(&mhu_lock);
-
-       while (mmio_read_32(GXBB_HIU_MAILBOX_STAT_3) != 0)
-               ;
-}
-
-void mhu_secure_message_send(uint32_t msg)
-{
-       mmio_write_32(GXBB_HIU_MAILBOX_SET_3, msg);
-
-       while (mmio_read_32(GXBB_HIU_MAILBOX_STAT_3) != 0)
-               ;
-}
-
-uint32_t mhu_secure_message_wait(void)
-{
-       uint32_t val;
-
-       do {
-               val = mmio_read_32(GXBB_HIU_MAILBOX_STAT_0);
-       } while (val == 0);
-
-       return val;
-}
-
-void mhu_secure_message_end(void)
-{
-       mmio_write_32(GXBB_HIU_MAILBOX_CLR_0, 0xFFFFFFFF);
-
-       bakery_lock_release(&mhu_lock);
-}
-
-void mhu_secure_init(void)
-{
-       bakery_lock_init(&mhu_lock);
-
-       mmio_write_32(GXBB_HIU_MAILBOX_CLR_3, 0xFFFFFFFF);
-}
index d2d337cafbaafe795b9cce3a1a765a9e509f6d5e..7da6468df49421c34fb8de68e0aec7206cc71076 100644 (file)
@@ -29,7 +29,7 @@ BL31_SOURCES          +=      lib/cpus/aarch64/cortex_a53.S           \
                                ${AML_PLAT_COMMON}/aarch64/aml_helpers.S        \
                                ${AML_PLAT_SOC}/gxbb_bl31_setup.c       \
                                ${AML_PLAT_COMMON}/aml_efuse.c          \
-                               ${AML_PLAT_SOC}/gxbb_mhu.c              \
+                               ${AML_PLAT_COMMON}/aml_mhu.c            \
                                ${AML_PLAT_SOC}/gxbb_pm.c               \
                                ${AML_PLAT_COMMON}/aml_scpi.c           \
                                ${AML_PLAT_SOC}/gxbb_sip_svc.c          \
diff --git a/plat/amlogic/gxl/gxl_mhu.c b/plat/amlogic/gxl/gxl_mhu.c
deleted file mode 100644 (file)
index 4c1d5b6..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright (c) 2018, ARM Limited and Contributors. All rights reserved.
- *
- * SPDX-License-Identifier: BSD-3-Clause
- */
-
-#include <lib/bakery_lock.h>
-#include <lib/mmio.h>
-#include <platform_def.h>
-
-static DEFINE_BAKERY_LOCK(mhu_lock);
-
-void mhu_secure_message_start(void)
-{
-       bakery_lock_get(&mhu_lock);
-
-       while (mmio_read_32(GXBB_HIU_MAILBOX_STAT_3) != 0)
-               ;
-}
-
-void mhu_secure_message_send(uint32_t msg)
-{
-       mmio_write_32(GXBB_HIU_MAILBOX_SET_3, msg);
-
-       while (mmio_read_32(GXBB_HIU_MAILBOX_STAT_3) != 0)
-               ;
-}
-
-uint32_t mhu_secure_message_wait(void)
-{
-       uint32_t val;
-
-       do {
-               val = mmio_read_32(GXBB_HIU_MAILBOX_STAT_0);
-       } while (val == 0);
-
-       return val;
-}
-
-void mhu_secure_message_end(void)
-{
-       mmio_write_32(GXBB_HIU_MAILBOX_CLR_0, 0xFFFFFFFF);
-
-       bakery_lock_release(&mhu_lock);
-}
-
-void mhu_secure_init(void)
-{
-       bakery_lock_init(&mhu_lock);
-
-       mmio_write_32(GXBB_HIU_MAILBOX_CLR_3, 0xFFFFFFFF);
-}
index 5c8206cf143626b4f0e71194ae1f9f5fbddee66c..b4f2a90f7199b7111676cb9ccc2104728a2b24d1 100644 (file)
@@ -32,7 +32,7 @@ BL31_SOURCES          +=      lib/cpus/aarch64/cortex_a53.S           \
                                ${AML_PLAT_COMMON}/aarch64/aml_helpers.S        \
                                ${AML_PLAT_SOC}/gxl_bl31_setup.c        \
                                ${AML_PLAT_COMMON}/aml_efuse.c          \
-                               ${AML_PLAT_SOC}/gxl_mhu.c               \
+                               ${AML_PLAT_COMMON}/aml_mhu.c            \
                                ${AML_PLAT_SOC}/gxl_pm.c                \
                                ${AML_PLAT_COMMON}/aml_scpi.c           \
                                ${AML_PLAT_SOC}/gxl_sip_svc.c           \