From patchwork Fri Jan 6 17:04:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Delaunay X-Patchwork-Id: 640449 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A213BC54E76 for ; Fri, 6 Jan 2023 17:05:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235596AbjAFRFV (ORCPT ); Fri, 6 Jan 2023 12:05:21 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43740 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235443AbjAFRFC (ORCPT ); Fri, 6 Jan 2023 12:05:02 -0500 Received: from mx07-00178001.pphosted.com (mx07-00178001.pphosted.com [185.132.182.106]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 34D3A7CBCC; Fri, 6 Jan 2023 09:04:58 -0800 (PST) Received: from pps.filterd (m0288072.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 306C1gpC020107; Fri, 6 Jan 2023 18:04:41 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foss.st.com; h=from : to : cc : subject : date : message-id : mime-version : content-transfer-encoding : content-type; s=selector1; bh=PA0/87LbgDri/GrG5DEhMEC6AP+3ANPUvqEs9eeMOgM=; b=3pcjCz84DU+kDFFjl4GCNMDlKgo1+w9VSh7mUcY9+biUm/GsqaUmfoxMP1ffiyEWAAJ2 Jo/ADI2GDb0hXS3FkVbZDxi2LY4tuMA6Sm8JkDkqPvRvkXpnid0IHzutpCuc1rolSMVE 34Ifd1g5ibkFCFd81ofWQR/y6hQYKfX+fvaZwI8crJqgqjhqjsGaafbK1ved4p158R1c LQ0drNthpzgwWwQjDOhpi+r2D/uqJWw8WHO5wMK+9fCm2RISWtJe20h+iZZtGhwNzEzU +SmZAnWsY6wumg+IMLSqfWrOzinAVqzJOHryb5eOifEXROEZtXfVk2XXTe7pjEvmsVBf 4A== Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com (PPS) with ESMTPS id 3mtbcqgw2u-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 06 Jan 2023 18:04:41 +0100 Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id D96B5100034; Fri, 6 Jan 2023 18:04:40 +0100 (CET) Received: from Webmail-eu.st.com (shfdag1node3.st.com [10.75.129.71]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id D3F60219D9E; Fri, 6 Jan 2023 18:04:40 +0100 (CET) Received: from localhost (10.48.0.157) by SHFDAG1NODE3.st.com (10.75.129.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.13; Fri, 6 Jan 2023 18:04:37 +0100 From: Patrick Delaunay To: Alexandre TORGUE , Rob Herring , Krzysztof Kozlowski , Maxime Coquelin , Srinivas Kandagatla CC: Etienne CARRIERE , Fabrice GASNIER , Amelie DELAUNAY , Lionel DEBIEVE , Patrick Delaunay , , , , Subject: [PATCH v5 0/3] nvmem: stm32: add OP-TEE support for STM32MP13x Date: Fri, 6 Jan 2023 18:04:27 +0100 Message-ID: <20230106170430.1214186-1-patrick.delaunay@foss.st.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Originating-IP: [10.48.0.157] X-ClientProxiedBy: SHFCAS1NODE2.st.com (10.75.129.73) To SHFDAG1NODE3.st.com (10.75.129.71) X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.923,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2023-01-06_11,2023-01-06_01,2022-06-22_01 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org The v5 patchset is rebased on next-20221226. This serie update the NVMEM BSEC driver to be compatible with STM32MP13x SoC and the trusted application STM32MP BSEC in OP-TEE This serie solve issue in initial support of STM32MP131 (using BSEC STM32MP15 compatible) and so it break the STM32MP13x DTS compatible. I create this serie for more efficient review, including support for STM32MP15x. The first patches of the V1 series is already merged: "dt-bindings: nvmem: add new stm32mp13 compatible for stm32-romem" This STM32MP13x DTS break is acceptable as - the STM32MP13x SoC is not yet available outside STMicroelectronics (not official) - the same patch is already integrated or modifications are in progress in the other users (arm-trusted-firmware/TF-A, OP-TEE and U-Boot) of stm32mp131 device tree. It is the good time to correct this issue before the real availability of the SoC and before full support of STM32MP13x SoC in Linux kernel. Regards Patrick Changes in v5: - minor changes after Etienne Carierre review (comments, change %x to %#x, remove goto to out_tee_session) - update the BSEC SMC detection logic in stm32_romem_probe() after Etienne Carierre review to support NVMEM probe after OP-TEE probe Changes in v4: - fixe warning reported by kernel test robot for 64 bits support in drivers/nvmem/stm32-bsec-optee-ta.c:260:18: warning: format '%d' expects argument of type 'int', but argument 4 has type 'size_t' Changes in v3: - add a separate file stm32-bsec-optee-ta.c with STM32MP BSEC TA communication functions to avoid #if in romem driver. - use of_find_compatible_node in optee_presence_check function instead of of_find_node_by_path("/firmware/optee") Changes in v2: - rebase series on linux-next/master - minor update after V1 revue Changes in v1: - update commit message to indicate DTS break reason. Patrick Delaunay (3): ARM: dts: stm32mp13: fix compatible for BSEC nvmem: stm32: add OP-TEE support for STM32MP13x nvmem: stm32: detect bsec pta presence for STM32MP15x arch/arm/boot/dts/stm32mp131.dtsi | 2 +- drivers/nvmem/Kconfig | 11 + drivers/nvmem/Makefile | 1 + drivers/nvmem/stm32-bsec-optee-ta.c | 298 ++++++++++++++++++++++++++++ drivers/nvmem/stm32-bsec-optee-ta.h | 80 ++++++++ drivers/nvmem/stm32-romem.c | 84 +++++++- 6 files changed, 472 insertions(+), 4 deletions(-) create mode 100644 drivers/nvmem/stm32-bsec-optee-ta.c create mode 100644 drivers/nvmem/stm32-bsec-optee-ta.h base-commit: c76083fac3bae1a87ae3d005b5cb1cbc761e31d5 prerequisite-patch-id: 5aaa8fffbdd16871143808180b3932d80f4045d0 prerequisite-patch-id: ae711dc528e191e4751cbb7402041fc5f185d6b3