From 6f3b0dc465437c67ed9f44b918ac189e635ce716 Mon Sep 17 00:00:00 2001 From: Carlo Caione Date: Sat, 24 Aug 2019 17:46:04 +0100 Subject: [PATCH] amlogic: Move MHU code to common directory The MHU code is shared between all the supported platforms. Move it to the common directory instead. Signed-off-by: Carlo Caione Change-Id: Iaf53122866eae85c13f772927d16836dcfa877a3 --- .../{gxl/gxl_mhu.c => common/aml_mhu.c} | 0 plat/amlogic/gxbb/gxbb_mhu.c | 53 ------------------- plat/amlogic/gxbb/platform.mk | 2 +- plat/amlogic/gxl/platform.mk | 2 +- 4 files changed, 2 insertions(+), 55 deletions(-) rename plat/amlogic/{gxl/gxl_mhu.c => common/aml_mhu.c} (100%) delete mode 100644 plat/amlogic/gxbb/gxbb_mhu.c diff --git a/plat/amlogic/gxl/gxl_mhu.c b/plat/amlogic/common/aml_mhu.c similarity index 100% rename from plat/amlogic/gxl/gxl_mhu.c rename to plat/amlogic/common/aml_mhu.c diff --git a/plat/amlogic/gxbb/gxbb_mhu.c b/plat/amlogic/gxbb/gxbb_mhu.c deleted file mode 100644 index 903ef411..00000000 --- a/plat/amlogic/gxbb/gxbb_mhu.c +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2018, ARM Limited and Contributors. All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -#include - -#include -#include - -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/platform.mk b/plat/amlogic/gxbb/platform.mk index d2d337ca..7da6468d 100644 --- a/plat/amlogic/gxbb/platform.mk +++ b/plat/amlogic/gxbb/platform.mk @@ -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/platform.mk b/plat/amlogic/gxl/platform.mk index 5c8206cf..b4f2a90f 100644 --- a/plat/amlogic/gxl/platform.mk +++ b/plat/amlogic/gxl/platform.mk @@ -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 \ -- 2.30.2