Lines Matching +full:op +full:- +full:tee
1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * OP-TEE STM32MP BSEC PTA interface, used by STM32 ROMEM driver
5 * Copyright (C) 2022, STMicroelectronics - All Rights Reserved
10 #include "stm32-bsec-optee-ta.h"
21 * TEE_SUCCESS - Invoke command success
22 * TEE_ERROR_BAD_PARAMETERS - Incorrect input param
23 * TEE_ERROR_ACCESS_DENIED - OTP not accessible by caller
36 * TEE_SUCCESS - Invoke command success
37 * TEE_ERROR_BAD_PARAMETERS - Incorrect input param
38 * TEE_ERROR_ACCESS_DENIED - OTP not accessible by caller
50 /* OP-TEE STM32MP BSEC TA UUID */
56 * Check whether this driver supports the BSEC TA in the TEE instance
62 /* Currently this driver only supports GP compliant, OP-TEE based TA */ in stm32_bsec_optee_ta_match()
63 if ((ver->impl_id == TEE_IMPL_ID_OPTEE) && in stm32_bsec_optee_ta_match()
64 (ver->gen_caps & TEE_GEN_CAP_GP)) in stm32_bsec_optee_ta_match()
70 /* Open a session to OP-TEE for STM32MP BSEC TA */
86 rc = -EINVAL; in stm32_bsec_ta_open_session()
94 /* close a session to OP-TEE for STM32MP BSEC TA */
100 /* stm32_bsec_optee_ta_open() - initialize the STM32MP BSEC TA */
107 /* Open context with TEE driver */ in stm32_bsec_optee_ta_open()
111 if (rc == -ENOENT) in stm32_bsec_optee_ta_open()
112 return -EPROBE_DEFER; in stm32_bsec_optee_ta_open()
132 /* stm32_bsec_optee_ta_open() - release the PTA STM32MP BSEC TA */
138 /* stm32_bsec_optee_ta_read() - nvmem read access using PTA client driver */
163 num_bytes = round_up(offset + bytes - start, 4); in stm32_bsec_optee_ta_read()
180 pr_err("TA_BSEC invoke failed TEE err:%#x, ret:%#x\n", in stm32_bsec_optee_ta_read()
183 ret = -EIO; in stm32_bsec_optee_ta_read()
204 /* stm32_bsec_optee_ta_write() - nvmem write access using PTA client driver */
218 /* Allow only writing complete 32-bits aligned words */ in stm32_bsec_optee_ta_write()
220 return -EINVAL; in stm32_bsec_optee_ta_write()
256 pr_err("TA_BSEC invoke failed TEE err:%#x, ret:%#x\n", arg.ret, ret); in stm32_bsec_optee_ta_write()
258 ret = -EIO; in stm32_bsec_optee_ta_write()
273 nb_lock = (offset + bytes - start) / 4; in stm32_bsec_optee_ta_write()
284 pr_err("TA_BSEC invoke failed TEE err:%#x, ret:%#x\n", arg.ret, ret); in stm32_bsec_optee_ta_write()
286 ret = -EIO; in stm32_bsec_optee_ta_write()