1
0
Fork 0

MLK-24438 drivers: tee: cleanup imx busfreq implementation

Cleanup implementation not to break non imx soc.

Fixes: 6814a47113 ("TEE-349 RPC Busfreq High")

Signed-off-by: Silvano di Ninno <silvano.dininno@nxp.com>
Reviewed-by: Clement Faure <clement.faure@nxp.com>
zero-colors
Silvano di Ninno 2020-07-23 11:18:18 +02:00
parent c2e58ab882
commit 85b5c8c680
3 changed files with 13 additions and 8 deletions

View File

@ -14,8 +14,7 @@
#include "optee_private.h"
#include "optee_smc.h"
#if defined(CONFIG_SOC_IMX6) || defined(CONFIG_SOC_IMX7) \
|| (CONFIG_HAVE_IMX8_SOC)
#if defined(CONFIG_HAVE_IMX_BUSFREQ)
#include <linux/busfreq-imx.h>
#endif
@ -141,13 +140,13 @@ u32 optee_do_call_with_arg(struct tee_context *ctx, phys_addr_t parg)
/* Initialize waiter */
optee_cq_wait_init(&optee->call_queue, &w);
#if defined(CONFIG_SOC_IMX6) || defined(CONFIG_SOC_IMX7) \
|| (CONFIG_HAVE_IMX8_SOC)
#if defined(CONFIG_HAVE_IMX_BUSFREQ)
/*
* Request Busfreq to HIGH to prevent DDR self-refresh while
* executing Secure stuff
*/
request_bus_freq(BUS_FREQ_HIGH);
if (optee->sec_caps & OPTEE_SMC_SEC_CAP_IMX_BUSFREQ)
request_bus_freq(BUS_FREQ_HIGH);
#endif
while (true) {
@ -178,12 +177,12 @@ u32 optee_do_call_with_arg(struct tee_context *ctx, phys_addr_t parg)
optee_rpc_finalize_call(&call_ctx);
#if defined(CONFIG_SOC_IMX6) || defined(CONFIG_SOC_IMX7) \
|| (CONFIG_HAVE_IMX8_SOC)
#if defined(CONFIG_HAVE_IMX_BUSFREQ)
/*
* Release Busfreq from HIGH
*/
release_bus_freq(BUS_FREQ_HIGH);
if (optee->sec_caps & OPTEE_SMC_SEC_CAP_IMX_BUSFREQ)
release_bus_freq(BUS_FREQ_HIGH);
#endif
/*

View File

@ -613,6 +613,10 @@ static struct optee *optee_probe(struct device_node *np)
goto err;
}
#if defined(CONFIG_HAVE_IMX_BUSFREQ)
if (of_find_compatible_node(NULL, NULL, "fsl,imx_busfreq"))
sec_caps |= OPTEE_SMC_SEC_CAP_IMX_BUSFREQ;
#endif
optee->invoke_fn = invoke_fn;
optee->sec_caps = sec_caps;

View File

@ -218,6 +218,8 @@ struct optee_smc_get_shm_config_result {
/* Secure world supports Shared Memory with a NULL buffer reference */
#define OPTEE_SMC_SEC_CAP_MEMREF_NULL BIT(4)
#define OPTEE_SMC_SEC_CAP_IMX_BUSFREQ BIT(31)
#define OPTEE_SMC_FUNCID_EXCHANGE_CAPABILITIES 9
#define OPTEE_SMC_EXCHANGE_CAPABILITIES \
OPTEE_SMC_FAST_CALL_VAL(OPTEE_SMC_FUNCID_EXCHANGE_CAPABILITIES)