From patchwork Tue Apr 11 16:25:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pankaj Gupta X-Patchwork-Id: 13207741 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D7DF3C76196 for ; Tue, 11 Apr 2023 15:12:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=4F0Nv2WuSoAdw/eq+yg0yqIeT+BZStZeXSpdXuT97fw=; b=MRIoeLDTDSoI9k dKTgUqJ3CcUAEILZQ7jMnpY2pgog2y1oGN54U22eNR6LXqVO0yL4tYCHLllOKkUWL/f8wxn5iGVDn 3t9fRCvoUaASJt3SXxVBM0uw1oflImvIjRXMW+wFVIlIN1YaazhvnFLfo+eB9C+24byZujn+R1uH7 da5iB6GtSHbGDZWJLwpbrzV3tr1wPv6Qwf5XgwuF4ycPCwyy5VzR1Orh34WoMKpbYrfHAEuDnjIFh NNTBe0rOSQ/3XqXwXQ7rs3QOBabq89bQyRWss1xi2UgvaLXOroBBAQqNmMfdM/Rk9WrfS3/zYvYKP ikcGQlRSlgfqFdI15Y+g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1pmFet-000N5y-10; Tue, 11 Apr 2023 15:11:47 +0000 Received: from mail-am7eur03on2061b.outbound.protection.outlook.com ([2a01:111:f400:7eaf::61b] helo=EUR03-AM7-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1pmFen-000MyA-22 for linux-arm-kernel@lists.infradead.org; Tue, 11 Apr 2023 15:11:43 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HSicR86rWE+WkZSsNF6E4nGkjLSdD0uSGw49iRh52DVoUUXxDgAVZhFgAJBjDdDi5z/FH7r1AhILeLZ0JAjNmZgXlIMG15dgnnFm4HhpKPw+5vwcjlbSpcfNRV60bm3b0aHy5QJSY7EFbhkP8CR3ff9E3BV+pF6qrZPdWr/PlCTEIG8O/+R9K0EYHns1D46/fZrpuEMyVuDT3cCCapPk6qLCsXfXHC+ZbwEHcqYo1NGfhRShRvAfPMUtnXsTz8kavvWQtBmNi7rCl/8nGn+oMJYX7VO3XRfoIFymVUUTWpk/XqBGv7d2WUiwe9o4OOp/oVuOe3e7R+bT+C3LOwcx9g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=cMpnbrLzmqLGPrUT8GUVNw+op81ZlmfpWHZy6aE1eq0=; b=Dh7j3r/bCMl3yTC5TpiPPkAShLo8e1VLOjGgQH2y5FgFjUAfNWT3ixPsGlY97bEVPFcIIYN6lBFdBParzu64CVLEkklZpkKCxtqAkzmj78qIi8jYmGE/FirWuim5jv/E7nU2WzqPiugoP+VjU9j5oF4FtV0FnG0sHmykt1wRjHSX9zMOfs+6OfAHVW5oH7+iXQgbubBFiiS4zKGuIVCE2CaoQ/rOQkYXTMHe03pqvzxeKvQVhVvdlgoPxaz5jyvLVbnjCSrA1waDTzEKpThmdgfXFD7xlUuDtRxIAlBGeeth2gwepN++ZltL9NLJo6UTBcowd/der8eQiXfPN5ZILA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=cMpnbrLzmqLGPrUT8GUVNw+op81ZlmfpWHZy6aE1eq0=; b=aKQkHSzzBb8r5FsDIsg5kT3jTxhAcUtWdW+SYjitWDU4U/bWxS8iWvXsM7tM4uklcz8wC6+abNXBqaqdexuf9theKmf2U4BjNEs14f1Cj4Jt9ASw1dWMF4dcwnGA862MtLJ9dXPkbTo+/G+H1DXBuDElztQfkcvM4DELFn0u0fQ= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from DU2PR04MB8630.eurprd04.prod.outlook.com (2603:10a6:10:2dd::15) by VE1PR04MB7454.eurprd04.prod.outlook.com (2603:10a6:800:1a8::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6277.38; Tue, 11 Apr 2023 15:11:39 +0000 Received: from DU2PR04MB8630.eurprd04.prod.outlook.com ([fe80::bb08:83bc:69ce:21ed]) by DU2PR04MB8630.eurprd04.prod.outlook.com ([fe80::bb08:83bc:69ce:21ed%8]) with mapi id 15.20.6277.038; Tue, 11 Apr 2023 15:11:39 +0000 From: Pankaj Gupta To: shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, gaurav.jain@nxp.com, sahil.malhotra@nxp.com, aisheng.dong@nxp.com, V.Sethi@nxp.com Cc: Pankaj Gupta Subject: [NXP ELE-MUAP 1/7] doc: device tree binding addition for ele MU Date: Tue, 11 Apr 2023 21:55:30 +0530 Message-Id: <20230411162536.30604-2-pankaj.gupta@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230411162536.30604-1-pankaj.gupta@nxp.com> References: <20230411162536.30604-1-pankaj.gupta@nxp.com> X-ClientProxiedBy: SI2P153CA0035.APCP153.PROD.OUTLOOK.COM (2603:1096:4:190::14) To AM9PR04MB8636.eurprd04.prod.outlook.com (2603:10a6:20b:43f::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DU2PR04MB8630:EE_|VE1PR04MB7454:EE_ X-MS-Office365-Filtering-Correlation-Id: c2a775dd-0f53-43f5-839f-08db3a9f0cce X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: gTupujyoOKA7zuIn385Q7NcrbsS67YfiA9pfPzrYry2TdveIJjDxI/3HZJykYXC0ffxhFpuyktMCXLdG81vrUahpghqGxzZERu/TPs/AVDxDzxUoN4TCXHbq/C4DqkaUCdZKrIX12WMj2Bz2UzqQfdv46b2EG0VRi9aE/srdziEHHINIEAFhtXmO+MNd6I9bqE8FtWqyadNFbYSLpUqN0eobrBWr2AKw7vwKFHGfObNT2ugSw1rpmEGPOSTjrJSbTmFBDyMt5qyVEf+lRscmsmnGubmhf5igQcTSv5R253+G21jUZmOb7DU3gGlg8vQ//BZHVJ+ZqhgK2998Tn0h2aGQmWxAdhj4tIL59tjKr66bqdSRMBIW044DTf2UjpCBjOUDqnkBZkoV3u6d06K/5bBZ7AorA39CHn6TOVVei4toz49VDkmbZ4BI9BX2cFcBUGeQTFzYayNPsGxfUMhKfGOgFQLY57WGIU0iRO20WphOEVDJ5wYJxrGQNgwMvaHScXn/cphXKXTNQVJkWMXbQgQCahi131gWBMaEwyzpyNUm0pXb3q+x2fN0fwXDqkTpViFMbR/BG0G++8U+wHHuOQ0DyICLSZKkHP54gSon8YVfyPSQ2Vbf+QnNEWPcfish2KlUJBp8rYXhbTVAUICqS5SNax+7yJ6PNA7MuzEVpvM= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DU2PR04MB8630.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(366004)(39860400002)(396003)(136003)(376002)(346002)(451199021)(6486002)(478600001)(966005)(4326008)(52116002)(6636002)(8676002)(66946007)(66476007)(66556008)(41300700001)(316002)(86362001)(36756003)(83380400001)(2616005)(26005)(1076003)(6512007)(6506007)(6666004)(2906002)(8936002)(44832011)(5660300002)(38100700002)(38350700002)(186003)(921005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: NYqmayL6mr3iVxLMImAfxudfcXuFYPkq2mN87AGsp1yuH+qh2Vugdew7ew4o+4SczvPb6TEfV8gb9Dro2gCfh0txWneus6yF4kta4ussu4kFc+WvtwhP+5HsvPzwiHZb1/2Xd0JsHCKZv13MebuQ4q7f9aTE/4lAWWx0hMPETuv/F7YNolgd16sRfelBuLVYIf2nTJed4MTLPij4WWr+I4c4rvzdihy/lLxa622KPiz1edWfUbYk85kz/ktL75nXUm0Iu/kQxYamSs7JTCivX8oPohk2PXyKCQfkvDXHOolw55kwEUopFbSA6Wzd/t0yBxopfW7JveJBI+Fd2pmNayrLVoaDL7WyHFwtPw63IAeC3LFKFZVJPZJsKml0bZURThApFO+iOG0C7iNRx/O/jTinbzeNHHV4oa4gcU30n5pSJFGH4mggqw7JqViZUXIL+uvlk2Ej3LtkNYtbGJDumgk1QqsDebSPx278553YWr0Qv3sr2PlKXFHTnFHFjzvwFgygIkB44C4iB1uweHDnKuaN/ncdm+5rz36YmI+VopCnICADiYwSTr+jPqDzfWmrSIM0qEGQ/UYpTrF46juvRLyHc8ma2iNevLBwetKRjoINOWGxBC/RsVyHa9l+FbMBHD6PbA6UMMJ1MEmCzRadWQ4QYlol4cJ1j9c7mpOJ14ckJ8KOai1lApFmdXM1exTChxVH0x2M/b/DKnT6yGSIokp9DnE5QhqxzGN7zr7XPtVqQhiP6KawyrH7KvhOLaQFMs0z7bQI2XE0cZW/P5li704viUf13acCB23DYtS5PICrcpUVYppVIgOighlXtGEhbJWDzZfXegSrwH2e+RJh1CxqKHqfAN8kkNqOCoTq8WsGjOaKP18KVXNtNsM2kXY1Qm9fJmAxgByLBz1eh933cH6QjxpTUnAxTCnIagwapvBtITo+1HDAIAMaUtYsppcptRqJpB+Rczf2GMeSoTwhr8s876Gg6Z84DEOrRQqLrrK4gNyIG/WU3Uku0kxe05Oxn25F20P3xW25Yp9fxSgL2A5DInqy3H2db8LVkJdr3dqDLobyERyEmDXGnxzjon6N+UVd4bVIsASWUXbGHlTebTiZ+tEeyFJbmwvczZZjpt6r9cx8wxLuwwmq3ZwkPXeKSZ7K8gHCEbVxFMw7UJ11fXnBx+KA4cxL4ZBGqiG5M8Y+0Aet9EpZKBHXqWB7QWozemi2zG3N66QZQGAZqD+XtOeau8IetccEaIIuzt26upRQrAXmgkUPGSbxaezBMCdiQczqSGqijaIv/KYsqQ/jvZO+CjlKzs7AYLkIRbn2eQ1771bM6CWfsKSBDOTeyLwwB5fXXKm5xoicR4TyQCN9Z7SEDrbzIO2U8rjyN11wulQ+8LASrMkO62OjM4buiXBcSlhdERvnpD+NWogJASof5IJVrGC2pJ3ie5Yk+Ruu6HSpl8xVdmVzwnOJ2rGqrwtEX/4Lr8c/mS/bdr6vINU5WwMUhsnOFV+z37hfC74fzXUGUt3wPvPi8hJ4WCuKqTJByxnVHfIjtji/FsXWEVAW9XJm9Nz307PTCCkAeJYlHa42dPZQojE+XQwew+Tc+HrJ X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: c2a775dd-0f53-43f5-839f-08db3a9f0cce X-MS-Exchange-CrossTenant-AuthSource: AM9PR04MB8636.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Apr 2023 15:11:39.4814 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: a2bqKEgJRo5ovlbaYGix3l4anVdnRfGAZmZPaGjrjxIja+Vm03BikcaMJ98wKzCFSgluAQTHxQJN48OBbApABQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR04MB7454 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230411_081141_673130_F4C40E0E X-CRM114-Status: GOOD ( 19.97 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Documentation update with addition of new device tree for NXP ele-mu (Edgelock Enclave Message Unit), driver. Signed-off-by: Pankaj Gupta --- .../bindings/arm/freescale/fsl,ele_mu.yaml | 90 +++++++++++++++++++ .../devicetree/bindings/mailbox/fsl,muap.txt | 89 ++++++++++++++++++ 2 files changed, 179 insertions(+) create mode 100644 Documentation/devicetree/bindings/arm/freescale/fsl,ele_mu.yaml create mode 100644 Documentation/devicetree/bindings/mailbox/fsl,muap.txt diff --git a/Documentation/devicetree/bindings/arm/freescale/fsl,ele_mu.yaml b/Documentation/devicetree/bindings/arm/freescale/fsl,ele_mu.yaml new file mode 100644 index 000000000000..8f75a43aec26 --- /dev/null +++ b/Documentation/devicetree/bindings/arm/freescale/fsl,ele_mu.yaml @@ -0,0 +1,90 @@ +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/arm/freescale/fsl,ele_mu.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: NXP i.MX EdgeLock Enclave MUAP driver + +maintainers: + - Pankaj Gupta + +description: | + Create char devices in /dev as channels of the form /dev/ele_muXchY with X + the id of the driver and Y for each users. It allows to send and receive + messages to the NXP EdgeLock Enclave IP on NXP SoC, where current possible + value, i.e., supported SoC(s) are imx8ulp, imx93. + +properties: + compatible: + enum: + - fsl,imx-ele + - fsl,imx93-ele + + mboxes: + description: + List of <&phandle type channel> - 4 channels for TX, 4 channels for RX, + 1 channel for TXDB (see mailbox/fsl,muap.txt) + maxItems: 9 + + mbox-names: + items: + - const: tx + - const: rx + + fsl,ele_mu_did: + description: + Owner of message-unit, is identified via Domain ID or did. + allOf: + - $ref: /schemas/types.yaml#/definitions/uint32 + - enum: [0, 1, 2, 3, 4, 5, 6, 7] + + fsl,ele_mu_id: + description: + Identifier to the message-unit among the multiple message-unit that exists on SoC. + It is used to create the channels, default to 2 + allOf: + - $ref: /schemas/types.yaml#/definitions/uint32 + - enum: [0, 1, 2, 3] + + fsl,ele_max_users: + description: + Number of misclleneous devices to be created, default to 4 + allOf: + - $ref: /schemas/types.yaml#/definitions/uint32 + - enum: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] + + fsl,cmd_tag: + description: + Tag in message header for commands on this MU, default to 0x17 + allOf: + - $ref: /schemas/types.yaml#/definitions/uint8 + - enum: [0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e] + + fsl,rsp_tag: + description: + Tag in message header for responses on this MU, default to 0xe1 + allOf: + - $ref: /schemas/types.yaml#/definitions/uint8 + - enum: [0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8] + +required: + - compatible + - mboxes + - mbox-names + +additionalProperties: false + +examples: + - | + ele_mu: ele_mu { + compatible = "fsl,imx93-ele"; + mbox-names = "tx", "rx"; + mboxes = <&s4muap 2 0 + &s4muap 3 0>; + + fsl,ele_mu_id = <1>; + fsl,ele_max_users = <4>; + fsl,cmd_tag = /bits/ 8 <0x17>; + fsl,rsp_tag = /bits/ 8 <0xe1>; + }; diff --git a/Documentation/devicetree/bindings/mailbox/fsl,muap.txt b/Documentation/devicetree/bindings/mailbox/fsl,muap.txt new file mode 100644 index 000000000000..6854ce3467fe --- /dev/null +++ b/Documentation/devicetree/bindings/mailbox/fsl,muap.txt @@ -0,0 +1,89 @@ +NXP i.MX EdgeLock Enclave Message Unit Driver +================================================= + +The Messaging Unit module enables two processing elements within the SoC to +communicate and coordinate by passing messages (e.g., data, status and control) +through its interfaces. + +The NXP i.MX EdgeLock Enclave Message Unit (ELE-MUAP) is specifically targeted +for use between application core and Edgelocke Enclave. It allows to send +messages to the EL Enclave using a shared mailbox. + +The messages must follow the protocol defined. + + Non-Secure + Secure + | + | + +---------+ +-------------+ | + | ele_mu.c+<---->+imx-mailbox.c| | + | | | mailbox.c +<-->+------+ +------+ + +---+-----+ +-------------+ | MU X +<-->+ ELE | + | +------+ +------+ + +----------------+ | + | | | + v v | + logical logical | + receiver waiter | + + + | + | | | + | | | + | +----+------+ | + | | | | + | | | | + device_ctx device_ctx device_ctx | + | + User 0 User 1 User Y | + +------+ +------+ +------+ | + |misc.c| |misc.c| |misc.c| | + kernel space +------+ +------+ +------+ | + | + +------------------------------------------------------ | + | | | | + userspace /dev/ele_muXch0 | | | + /dev/ele_muXch1 | | + /dev/ele_muXchY | + | + + When a user sends a command to the ELE, it registers its device_ctx as + waiter of a response from ELE. + + A user can be registered as receiver of command from the ELE. + + When a message is received, the driver select the device_ctx receiving the + message depending on the tag in the message. It selects the device_ctx + accordingly. + + +NXP i.MX ELE-MU Device Node: +=========================== +Required properties: +-------------------- +- compatible: Shall be: "fsl,imx-ele", "fsl,imx93-ele" +- mbox-names: Contains the name of TX/RX channels- "tx", "rx"; +- mboxes: Details of the shared mailbox node instance from the + device tree. Example values are: + For TX: s4muap 0 0 + For RX: s4muap 1 0 + +- fsl,ele_mu_id Contains the message unit id that connects between + application core and NXP EL-Enclave. +- fsl,ele_max_users For 1 user-space application, value of >2 is suggested. +- fsl,cmd_tag Default value of command tag is 0x17. Though it can be + over-ridden for futures SoCs. +- fsl,rsp_tag Default value of command tag is 0xe1. Though it can be + over-ridden for futures SoCs. + +Example: +-------- + + ele_mu: ele_mu { + compatible = "fsl,imx93-ele"; + mbox-names = "tx", "rx"; + mboxes = <&s4muap 2 0 + &s4muap 3 0>; + + fsl,ele_mu_id = <1>; + fsl,ele_max_users = <4>; + fsl,cmd_tag = /bits/ 8 <0x17>; + fsl,rsp_tag = /bits/ 8 <0xe1>; + }; From patchwork Tue Apr 11 16:25:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pankaj Gupta X-Patchwork-Id: 13207747 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 023F2C77B70 for ; Tue, 11 Apr 2023 15:27:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=koGUU8OrMdKWwUI3MeZ/DC2uHo4si+znjDhH/WAN9bY=; b=gNhKxamRgQS0Ca qJwZT3xzdofzkXG/a6O9xr+Ave3KLU/SGBZtGwAv5LfTsivayk0KM0PmHZSLMvZPUcid4VAXppMWX cIcUQvxdO1M+AW0s33XM8bdy9XkE+3hEujAizyvmjvGSBAIG5RF+yGJkNgfa6yQ9kyKrwIFFROHAF 1uaBDG2j08WKd0WYN0trYVdSnxm+UQ7ursM/GBSFa7sBIvVjGaGkk3LQbZjgyFPajqlfIqj59PC0E JX0q+aD1stWffN6Iv5a58MGZZLoEmy14373oDegAmAE0/gPWEzjJGgPQKURn2aoDVj8esChmm1JsQ eXMV6Bdyim1hE4FW7YUA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1pmFtS-000Qwi-38; Tue, 11 Apr 2023 15:26:50 +0000 Received: from mail-db3eur04on062c.outbound.protection.outlook.com ([2a01:111:f400:fe0c::62c] helo=EUR04-DB3-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1pmFtQ-000QvN-1X for linux-arm-kernel@lists.infradead.org; Tue, 11 Apr 2023 15:26:49 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fpn98CScQo4flTGepuHvwrKT65BeiehJUspC/pRGgegbN07QxJ7dS36iM8zwQ/6QmmPbU3GqgBldmzCAFrCtLsxjp/xYjohFPmrmiVb8QaWAP4urjCij/TciaDD+G8h+U7ECSGC8yL+iuhyOw18xun5R2VmJ6Mb41KWmRn//QdVmArb8GLlhwS5nLUihmiV3wbVUp8LVwrL751Kt9azZGfWVJiSiQFyu/garnTFHY3eBmOwPhWApgXjZilF/6Yn+D/Ms9k1pFf5fwn+GYaZzMEXj+mT7AlkIHY38buedvay+rSfTtAQfBhD9E8R+rtmLqAVV+Wt7Y1s2+NxuNz39sw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=MhEn8GQ0u26a9/xB0Fl5KKa03dIKffc/2IBaCND6oHc=; b=LD7mjIhVpYzRbjNa0ODsczf1lKRmXJVJ3H2M2tBgAE5iUFw4fnsqAV/Gtl7HtSE8g23XmuY222SSFnUpeCRG6DpgcENNxULO3E1ZKOdSX6R6LuMkbttPde4t0g326o7oKRmIEdac8cnsyFU8Xfad/EnM3ZLzYTuBIe3npadGD7VntalB+mhltxPhWvJfd5B5gwi8wSe5od2UkwNSuOw2qD2nQfoF0AWjH8va33vTOdrvNzChnf8qZJCkdhOPfWMjhbWMWo071czLGSF4rqtXAHxzn0vBTea7vhCrNeHwnAQESS0WdXxYfURGomKwrXYJW8wbx7LumCHU7ZkMav09pQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=MhEn8GQ0u26a9/xB0Fl5KKa03dIKffc/2IBaCND6oHc=; b=kWo8FxDG1AxYRSyzFY4Qsq1H9k3iXJTzt/YAaqSNEUWKlRBu8bYa5tPPMH9nkuQOCnw4DoLbj5RWvacJnCyOR4ss/M2PrBRe7K/ff0TAIFiyV4Xt83ps8kPCG8E2utHjuSPdmfVpvMfty2QcWpnMhH8LJkwG6ORNyKOapiH6PtQ= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from DU2PR04MB8630.eurprd04.prod.outlook.com (2603:10a6:10:2dd::15) by VE1PR04MB7454.eurprd04.prod.outlook.com (2603:10a6:800:1a8::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6277.38; Tue, 11 Apr 2023 15:11:43 +0000 Received: from DU2PR04MB8630.eurprd04.prod.outlook.com ([fe80::bb08:83bc:69ce:21ed]) by DU2PR04MB8630.eurprd04.prod.outlook.com ([fe80::bb08:83bc:69ce:21ed%8]) with mapi id 15.20.6277.038; Tue, 11 Apr 2023 15:11:43 +0000 From: Pankaj Gupta To: shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, gaurav.jain@nxp.com, sahil.malhotra@nxp.com, aisheng.dong@nxp.com, V.Sethi@nxp.com Cc: Pankaj Gupta Subject: [NXP ELE-MUAP 2/7] arm64: dts: imx93-11x11-evk: added ele-mu Date: Tue, 11 Apr 2023 21:55:31 +0530 Message-Id: <20230411162536.30604-3-pankaj.gupta@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230411162536.30604-1-pankaj.gupta@nxp.com> References: <20230411162536.30604-1-pankaj.gupta@nxp.com> X-ClientProxiedBy: SI2P153CA0035.APCP153.PROD.OUTLOOK.COM (2603:1096:4:190::14) To AM9PR04MB8636.eurprd04.prod.outlook.com (2603:10a6:20b:43f::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DU2PR04MB8630:EE_|VE1PR04MB7454:EE_ X-MS-Office365-Filtering-Correlation-Id: 29269079-5f4e-4934-bfbb-08db3a9f0f22 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: x+pPnHjhNYIwY7DK5S/Q++VWVr1t0a4xLPKcpo3JwiqdjDxXr3fDZOk1D+GdfNZRK7BzWuGJviERKe2TWqYbuv+NV9ayS9oZjX0/k5XEDSIMndFw/QcclcHHjkXzw+u4HtpZFiiVWrKwI7z1aVkRxNedZWb6GpFTYiCD1wdDYIN9l3eXFNsK1wQOUPWhpXltacFkG+VKZbeYpeRHDe6hdjS7nn/oYS7K8rz3feREKExIYOLzN1tz2SddVetI6K9GUn6JTRVapIQvIXWjx60u/FLzWJOsnkw55+2Ubl9NYL6J8XEVYFfh8LUzHncldkvk/cYpZhxpLoS46irNRy8ub1/pTp6BKfg0g9OUy9HirJEfKDCANDMGArHJVU0+iwh2JHFObRO6Cck1XEzN9Kl14i5WpxzRxIeucKhVtgKLw/DWiYRk9Wv5yxYxmyHDsmtU3I2HwaQA50GPnYPUaREZZWwPUCbUyu0qv9KRnkV2o80GL0GgbdI6ViEQ5JaUe0+DwgFEnIsl6r16awfzwarR+mVD4MmKa6Ulya/jynjkepMMchgRIRei9QGg3t1w83f0l5Y35x4WQUQvOTPclXGy1wkvKV10WUaG0UWWZ2Z4NM4wD1Dnazf20ZWh1YpGNzIoxl/qhK6sNOrX7TOn1iz3Ng== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DU2PR04MB8630.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(366004)(39860400002)(396003)(136003)(376002)(346002)(451199021)(6486002)(478600001)(4326008)(52116002)(6636002)(8676002)(66946007)(66476007)(66556008)(41300700001)(316002)(86362001)(36756003)(83380400001)(2616005)(26005)(1076003)(6512007)(6506007)(6666004)(2906002)(8936002)(44832011)(4744005)(5660300002)(38100700002)(38350700002)(186003)(921005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: A4km6jfPRd6zBEI2xuIHxxA7NfTGD19T7wvnhTb53ZPMOwkbQ4MUHLcokg9252Pkq9tsmhTE+QCG1yuRuYh2vfhh+6CC7F11d85ZY5M/uVrqCXd7kSY42t/RxqBol9O0bwLqAG9XQvBh1t8xAU8+xmNFKAr+4P6ePD16ZgxL5ZDSVFB3JT0tEz6D7wRo1a7yWFARdV2pl3FMBfm6CGlETwsPDuSRDIbtYCPxR06RydljrK3zFWbczIVAYlu8uPzSHJKq2KOXoWPw2Zf1bVIa0rsfXZStH+tdvoqOqg4o0vixkjrK/MiWBt9JFGJwygiA2WjhSBOwheX+3eZPK3LLu9HmYOA8x8GvG0sLixNIYHBfNE8rikH1Zvd+vNcG5SfL0Kx+SI6jR2IPOPDWPsVtuzcJMS/d9+GzsDtzx+zwazZHm5qGPLonOdEcAb+Hoa4NZXIVFWxLYZ0e4L2bTPbpjHoGpRYZl3Qw1SaPiMy0YKQ+E1jTJuspwSD3o1WHvR+2isTE41S1fxQFlcdZjWetvgA6jI+GYy0WTswNA8YmSu2hZ9/y/Xh73bP9geHXokdMagQtfLxnDTqI7eVXUqVYr/RMA9N0KhAtTV1fvdvJ4S9ZCjeo+HA/llHatr7s0aZlUgzuHMxdiSbL52JsUDszWuh4iSCGfBvxyocQ68pEiwD7GGjJoqqGdoBI1qOcPU8fsVP5ebXb3J0gf/aZ04oECB43S0mAfinbifEi5b35Iv4K9UMSYqfmcHi+3BjJrQohD6ibnhnRlrSd7N1Kj310TXLsnwIwON/6upJi7PgEE0S73oEdsYTFJgf2qCiSN8mhu8KG8ZcxRNSx+s25aY9QcC6lEv7VWAq3fi98bBnuDZ3XfEcC/N+X61bFMyHj+BMUWGEprlAnz9+yBBeHTmWvOPFmJWCQKTgARoADbktO+SD73sWf7ac3dBf2Coy3j5/YvwascQDRR4qK80CzBtZYpp5s/VM5lYiGIGWPDUIOjYj9q9elWSEvRS1Syny5ZDIyH9y9ALDpRvVApruJkWHEe7FyGcY9ffxKgFe6dtS9ER4DpcoZQJVWYnmLndrSN3bYb2AEe/+qKvLXOd2JUnyFaW97ZioXFHMhQJ6Rcu9Tb5yiu/lBx/QswOZZ1oAz5f6/N4doSPSeMGPqOCKSD9pcqqZvJM1vpjYNmoiM6ALo2kW1Tk6SbUy9+WIPAeLBwXRThyLm9W0GvTJRc8tfHgKMop4gu12fofJNPti3/B3cGwWCn4AbVsXxhpqK+92+DOswrzgOYrcukjazSMUBbjg/MEIXYO9TO1g7W6KbKqpqUJWeb0fNYhhMc422+YfZDB3nEgs20qhuu+fVWHxhFQ8z8zOV8LFYfuSM80QfW+fAfFxYco1RopufOCAs7gieDoTX7huX57b2GxKpqI9qZ5xem+RuiVRsdJWUgNNbF4B5hHNdnviXZMiKgIfxDhAunjI8KkjtxYIxKxcuWlZmZwPRnCaCDzqub+ULFWHgJNUPcPM9zBwxZrOzpVf1ldTpNtND1/2P0VpAjga92sFdqYSniKnqDvHq2eswdTO+wVee3B8YYNBe1uD2OVvjo2c3nIHQ X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 29269079-5f4e-4934-bfbb-08db3a9f0f22 X-MS-Exchange-CrossTenant-AuthSource: AM9PR04MB8636.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Apr 2023 15:11:43.6083 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 0DMuTwd4h4+tRhnMjI7ZdrdmFdnFwkRM9S9jcmbsjMLZYGz7VXH+Z+M8aJopTvj4oRQ1b7ASZR22YqVsWB6+Xg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR04MB7454 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230411_082648_513706_CA1B6BA9 X-CRM114-Status: UNSURE ( 9.72 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org adde support for ele-mu for imx93-11x11-evk. Signed-off-by: Pankaj Gupta --- arch/arm64/boot/dts/freescale/imx93.dtsi | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/arch/arm64/boot/dts/freescale/imx93.dtsi b/arch/arm64/boot/dts/freescale/imx93.dtsi index 92e93c8af7f7..8ca2f08b7caf 100644 --- a/arch/arm64/boot/dts/freescale/imx93.dtsi +++ b/arch/arm64/boot/dts/freescale/imx93.dtsi @@ -1,6 +1,6 @@ // SPDX-License-Identifier: (GPL-2.0+ OR MIT) /* - * Copyright 2022 NXP + * Copyright 2022-2022 NXP */ #include @@ -725,5 +725,14 @@ media_blk_ctrl: system-controller@4ac10000 { #power-domain-cells = <1>; status = "disabled"; }; + ele_mu: ele-mu { + compatible = "fsl,imx93-ele"; + mboxes = <&s4muap 0 0 &s4muap 1 0>; + mbox-names = "tx", "rx"; + fsl,ele_mu_did = <3>; + fsl,ele_mu_id = <2>; + fsl,ele_mu_max_users = <4>; + status = "okay"; + }; }; }; From patchwork Tue Apr 11 16:25:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pankaj Gupta X-Patchwork-Id: 13207746 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 841DEC77B6F for ; Tue, 11 Apr 2023 15:27:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=BTEaYHVXJJUWv9RU3/6FAWFqLYfmvYUuxwvisCBvjJk=; b=RK88Lh2X7dul6m JR5Mu2d9A6Nwb32PbtQ9q7NKvCbljUKzyHSk24TE/2yNc7/Q0CPBJKxQq4XaGTPjrK3t7cMlQ9fde ijzx8jifFhhaWn6FSUJJER8bqJ56K0fGnJ0IAbnuZV82rRKrNk3ypdpVU7Iq/F2YsdEPCjV3gqd+8 +WBTRz6yfRPsx17d7aSmcUOudN5siZ8L+2ZejOuJy0qCpV/xQFPrQlM4bgjDYlFNYvO8ld+pro/i4 meaSEKlavLDrSHTC/8AT8g4QB7WDt0GEwOt2nw+DMi3V4S71SOb0d9269wqGF8uvTMvVxfk+uQ3hu R6Rog0Mep3oEXWmjKv/A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1pmFsm-000QoQ-2u; Tue, 11 Apr 2023 15:26:08 +0000 Received: from mail-db8eur05on20602.outbound.protection.outlook.com ([2a01:111:f400:7e1a::602] helo=EUR05-DB8-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1pmFsh-000QmF-26 for linux-arm-kernel@lists.infradead.org; Tue, 11 Apr 2023 15:26:07 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VwJGFf1qC56lIm/PFN0UFU/nsiFgjsb2hjHLWhMSBbEkdKA0uNCio8PFV1Rzgv2l51CouQhA+6jB2iVgUnFFGyPiJWm89D+9xAWZDs3ROtU4T8KQHgVUmijXWGe/D6dh3LhCIqRY8iyzcdlNKbYWZMZXRiyclcNLr6kwxqHX1GuAF7YUoLgq2iJjP2WdImjcNjUZECklx1u0/k6v9rddLQEZXQdMMi28O1Sq2Mg1wDrRgMAkNjPhdE44+SNhwh7RjIi7FXq9/VLVbhNYAsk6Pggr0BN6cVtZBegXrTaNsapdLXcl+3kfZ4YgnARAaTl+PN5ImkjywcF/xAKT8OXmGw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=yDes5gh3xEHbJOjkwKYafxKv/aZQlBHuqB0mkO+7hwI=; b=kyhIwR5nDsJNO3d0trK44shMj8Ii45GkN0w5ZoOHugBOK65vw+SWd1eXsCIXGHPEBoDmURPk0s5dqqIGuh/0aJCGm2gSQ0+GZ3CHcPdZrFE5Apv71x8Ruj9VZvdJse7ZLoNnwycNx5/MGDZrRt7tzNGRGfiq+bAQdTq3Sa7tqUDZR1e7YUnEPdERu0LMu7A0YGJaDSxubZ169mb/ZYKGczETPpVRVKxXg6k3VIxcPV7YNvG5CH5aj4BmfPPUJ0sRyYoiIZ181/w75x4OOhywZYZ6FdMxLluMTJ0/B16PisMjgCjPrFVPw+e5Lt8JBzV0DQ8o3e383fCPFTn5WKzmdA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=yDes5gh3xEHbJOjkwKYafxKv/aZQlBHuqB0mkO+7hwI=; b=IOQUJvZ2YVBgPyeE7dTK9LMgZd0pwTep+xG03ZK80H0U+m2NVTGmGOaNKiKBWwDAr/BtY9odB+RYGmijYyf71R/J3sjsvbPDTGos/FW0wefNzf4T6pmxC5NfB41gvflTu794O463QxuFd+kJDEZWcYjx1LrtLECi8AjEsXO1RQE= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from DU2PR04MB8630.eurprd04.prod.outlook.com (2603:10a6:10:2dd::15) by VE1PR04MB7454.eurprd04.prod.outlook.com (2603:10a6:800:1a8::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6277.38; Tue, 11 Apr 2023 15:11:47 +0000 Received: from DU2PR04MB8630.eurprd04.prod.outlook.com ([fe80::bb08:83bc:69ce:21ed]) by DU2PR04MB8630.eurprd04.prod.outlook.com ([fe80::bb08:83bc:69ce:21ed%8]) with mapi id 15.20.6277.038; Tue, 11 Apr 2023 15:11:47 +0000 From: Pankaj Gupta To: shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, gaurav.jain@nxp.com, sahil.malhotra@nxp.com, aisheng.dong@nxp.com, V.Sethi@nxp.com Cc: Pankaj Gupta Subject: [NXP ELE-MUAP 3/7] arm64: dts: imx93-11x11-evk: reserved mem-ranges to constrain ele-mu dma-range Date: Tue, 11 Apr 2023 21:55:32 +0530 Message-Id: <20230411162536.30604-4-pankaj.gupta@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230411162536.30604-1-pankaj.gupta@nxp.com> References: <20230411162536.30604-1-pankaj.gupta@nxp.com> X-ClientProxiedBy: SI2P153CA0035.APCP153.PROD.OUTLOOK.COM (2603:1096:4:190::14) To AM9PR04MB8636.eurprd04.prod.outlook.com (2603:10a6:20b:43f::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DU2PR04MB8630:EE_|VE1PR04MB7454:EE_ X-MS-Office365-Filtering-Correlation-Id: a61dd2f9-791c-47d4-ca6e-08db3a9f1195 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: O67UK3lcO8Ziua366Zu4XRauwIpydVbpDjdLrUxaJXeeuoRDiPAWiqli2WsWpBKORxMuiJtaVokWZJ/R0R4ofpnfNi3mkVSxkjzJcjhhB9kHVtM1iXCaUgN+HP+cY9u4t+tbGZ1cvkwq9ZY3T4j8dzj+zpuFtchGMXQPDyo10nXwMui4c/8gQSSXDXbfczA6WHIT1Uec/UW6Myzdb23JYKGpxxrzS08cXNQ/iEdwB0OP+XrDptHWGCAzSh9jNAEoOqIVGLNqeDOtXrl2ipb/92p4YFhDGVLiuteFxdPWuk3sOZ8Ps4eazlSmrNRaFngI6CPd2LCBmNAOYZhooucI3hQjiZvS2Y3YI6M0HOo8auNCd3FsBaEFv1DOJYi+7bcjbmsC1fQMHaCAmVJnirgYeR6hvwMT/fINNPhG+NFAszs0MF4CFAsn5UxYhWFz3b+u8RnDTfQKCfDQO8ggvPJioXQoLNs2/6Ol+sQ1nPaNW1dVl9SzCkAf0ylFYR3tjaOB8OvNV79oniPzuYoZPxggLJt/3yJQfP+flh+bHcoSaYPtX9V6Z8wyZA2rBKXRaiqnSDh4J1CXxeiVkToDqnG7YHBO7vU7mW9YTavEuO0ulwytswVUpgB0/qnG8tK1L9Wr/8n2ilvl0dUnCpVgZZwrNA== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DU2PR04MB8630.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(366004)(39860400002)(396003)(136003)(376002)(346002)(451199021)(6486002)(478600001)(4326008)(52116002)(6636002)(8676002)(66946007)(66476007)(66556008)(41300700001)(316002)(86362001)(36756003)(83380400001)(2616005)(26005)(1076003)(6512007)(6506007)(6666004)(2906002)(8936002)(44832011)(5660300002)(38100700002)(38350700002)(186003)(921005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: BZns1isWpvVbkkrGO4ufpg1TP/eZXWdvdCqv+s4NrNqp+x0dHe9ygk3qYWYZKNFpklVyVgGG+0vxPPPcFkprrZypv5K7SX712ofLencNThmuhy2WH3Vs+XTr7nBVBbwYFzRW4YeuAY5ZoM6mPxWoplz6h4Sp0JTK8pAmXtfvSB3By5AeSQtGSFic7s+TAAXQ6x5yO1kZKfSv+6vMk0VA6Rz59+ZbnQeO+P8kyuwRFwTd55pI3MqvgWsM4dXeo2c6v/2mLxqZMaAFS0qkRa0Mp/XAzXfynAvBkeCIgNtMVk58OwvYHJO4Y6yhEWs24BxfKFdlXP+RAT5Ml4BDwvrm3+U3W1NYfF345o1aFrtjyl1Sf/DOcpq2VR+fGFk8XxfYkKiLxLr1y2Ww1l0QkNTyM59HT7r+MnXXTJdzQi9eq1OvNLBkKD24+IuIgowc6ziy+ExPnE4/ec4VNYSQWNbD/R3+8z1volmPmot0Ik7gcuAJbpmiFmSKYMoGqrk61ac5bFzbzvDDOoFZf3oHD+f8KRidoYyV/vykz8/uX0cTe9rrQB20jmAqJHyuQunRUyDPzMLfptuYqwCZgRQB78HkrLMg0P/8bGXzuhUAknyokIcZ0k25j48xuzwvjVyo6HecuuxF73m/ZEPsalTMfJTlwthVAdiO5TIZSCFLQw2Kl3LwVnTjWqagxeoeVtrGgtkdarH2ItCjf3li038FYcpx2eAlNcvvYVlh9Y/3YfQOafEdEAgxQkvfTDpy5wMPe4l3PAommVDTvtwSy8Gu6sJEEBfRv73jVR8/NjyEhZG9MW9DY0o6u4Pv9Bg1oJI1DPpYDtRFfpsPy46WvpVr47kyUDtMKmz1BlEO4RMpIWsQxKyHwrhsBZp+XCxqG1Lv8Nh+sRjiiAEiAp91K3MLRdDa8Ug0OMJfr+uL2m+ztUQqCQUkI/i9mhaXGypVBiYh97wzJj6BtTziqvwHG54Lzc/E82gMBT68cfuUKre9DDBoq3v+q+LEwd/vuw01hYjoCPk2wp0+I4YBaL/VIz+Rw8hjFtXGsD1JWrgNl8XAI+EeD1EFszc84rTvPiFbhu3CJrwDLX6BplJpogWZmo33LJzgRWIeNCJGn/6PYCHFBLggGSxchqXnP4CLBIu5nKqATbarUfguM3RqxCZgz2x7RL6EZWeKjW5Dp1U7Kn+bXF3qeo7KhywdEIeeyG9Ztwte+OnLIP9S/vOKF9ddhFi7dxjHeb5bZ/3svfjb0NubvRj+NTzriaoSowNvmpjGpPjLdN+yADDrbvNC/7Bank+l6fBBG7HBt6r8Di14own7VlPdpNB9hMtV1ivy7r6Z5YWkseKe4L5KkqMmKNrb0QHvNOlcpvoBQgbYVvFvvY0O4dnJb4ErldlM/P9RzIqbZycWkOE6hiBnXBffNh/U79Gchb4b5GEyMObVPgOa8CuSiFfCq/223M9evGywlyp1/PmCGXraKx2sawW8B821NWOqdqplb5t/vhKYfrDcjRISV3muClrIiXtDJXENe8uIwTcAa2EJeE2NqaBD8Ajt3KwhaDxYqE1lTTpXeVxQnkH5d7VsPRZrnbJuwmVhO2lKV2YqyUVS X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: a61dd2f9-791c-47d4-ca6e-08db3a9f1195 X-MS-Exchange-CrossTenant-AuthSource: AM9PR04MB8636.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Apr 2023 15:11:47.7168 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: WbbYr6AtJWrQ0v8VPF1oYpJD0phRC2BdaJ5WwGJi3B7wd5ly1JUmt7F24oFNuOVnvxXDlxEb2RlBOmyySvZEAw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR04MB7454 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230411_082603_694705_8160820E X-CRM114-Status: UNSURE ( 9.37 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org EdgeLock Enclave are has a hardware limitation of restricted access to the DDR memory range: - 0x80000000 0x9FFFFFFF ELE-MU driver requireis 1MB of memory. In this patch the we are reserving 1MB of ddr memory region from the lower 32-bit range. Signed-off-by: Dong Aisheng Signed-off-by: Pankaj Gupta --- arch/arm64/boot/dts/freescale/imx93-11x11-evk.dts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/arch/arm64/boot/dts/freescale/imx93-11x11-evk.dts b/arch/arm64/boot/dts/freescale/imx93-11x11-evk.dts index 477c146f985c..2e2c26e38af0 100644 --- a/arch/arm64/boot/dts/freescale/imx93-11x11-evk.dts +++ b/arch/arm64/boot/dts/freescale/imx93-11x11-evk.dts @@ -7,6 +7,10 @@ #include "imx93.dtsi" +&ele_mu { + memory-region = <&ele_reserved>; +}; + / { model = "NXP i.MX93 11X11 EVK board"; compatible = "fsl,imx93-11x11-evk", "fsl,imx93"; @@ -22,6 +26,17 @@ reg_vref_1v8: regulator-adc-vref { regulator-max-microvolt = <1800000>; }; + reserved-memory { + #address-cells = <2>; + #size-cells = <2>; + ranges; + ele_reserved: ele-reserved@a4120000 { + compatible = "shared-dma-pool"; + reg = <0 0xa4120000 0 0x100000>; + no-map; + }; + }; + reg_usdhc2_vmmc: regulator-usdhc2 { compatible = "regulator-fixed"; pinctrl-names = "default"; From patchwork Tue Apr 11 16:25:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pankaj Gupta X-Patchwork-Id: 13207748 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 1D94EC77B6F for ; Tue, 11 Apr 2023 15:28:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=TcqXxj5dvBiDtwFEoM215YkkRG5MbQD5msRg2L6XWAc=; b=4nxrCV3h4FrpEe RW1fzkzfxyxK+pWdYE9MCvPo6Q+n6XRLsmQ7Ca4UTRzAcwSOFZ/d1xnUo6KwM/UVC18ipIO+GHtHR e1XybuwsR/C8M29ibwtltUlddB8hqPMdYt6l7Z4UG0TEuIktH4aLoYcI0PFoQlQ5ILO16v+/eJdWw pppOeQNN4N85Ma9AG669L+Fh352fUyJc0dGo5H2rRTb6V24+J2TVxQQCw7C+/qtC6LV5xwzCGiON/ nOVtZYthF6JCWIcmBo3lSg9p9g+jVI5g8kiqLKHqEsrME450yuyBSnksh4r+b17H9iQSkumnBZXGE LlRRJxPNuPd0zYANXvyQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1pmFtk-000R3h-1x; Tue, 11 Apr 2023 15:27:08 +0000 Received: from mail-vi1eur05on2060f.outbound.protection.outlook.com ([2a01:111:f400:7d00::60f] helo=EUR05-VI1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1pmFtf-000Qyn-0I for linux-arm-kernel@lists.infradead.org; Tue, 11 Apr 2023 15:27:04 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DHCDs+rUC+lkHTFQs9ti1FJ/YaiYamXfLmHT5xRHU2jf10vz4N5QHOnWP+3Qp9ThxM+MVGCozx1kSWjdAeMcmIGO8ek1N5FcEWGV21GAoWzpgmxJsS3xjvgow3pjFzxt7OM6JtycTbOKFrf+HLtBYcCyQeVV82vExUjFgj+JH4eb5cD2YYQWHMz93Cm/igASKEPGseJ/Sr3cicfGi90rVG/gr+xDNO8UOBZGbPI9IbfhL/eCksTQQ13+KSr7R/0J7WJT4Gr3mdkOqYoIg+Wy1F1bojq99eUwkULRuO8SKIl8za2kfyTNZp2hwTBPo2EJ7xkyNVzsf1bTmk9BBoug7g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=ugIHUpo1Yo8MvrNSkzKzeOS5DG0PsdIc4I8edIbHtZ8=; b=bnboJPy5i5IgwgLk7cRNfjB8EQEj6HMO5D8/F4GDo8Ig8CmoWEYCc4k3xH+iXcIr5pWl8jmxdB0igVZcfy6Ae1jN/MluPuTXZ0qEYZD4rIk+QAmRc5xwa6m7bRswQHkEQj1j91wdlZnmzmOtV+ijkaenlvS94HbWzGD8stCriq968GvYVklezU4n8n/ZIajsqWwTUXIpl+kOXEMZvFY+SrCgKJd6XDsg/SFbfyXd2PAORYzTG9z8pvirHHSkizXTCljZ/8tJudlkch6ooWgsBcajMW3xC65jWkDOI+T3FK0zy3Mu7OS3wVRI89rdT4ljljz7toaS897DFnQMZU/0XA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ugIHUpo1Yo8MvrNSkzKzeOS5DG0PsdIc4I8edIbHtZ8=; b=YJlFjPBLkSx1JV2dxlJ8NFDp8ZJhNMPgrrhfPu4tJ1XZKDbUxLcqme6vlqKznqZrnVg1PYOY2c+QQ4IqN5V8P9tcuGIKpfTMhPy5IVR2j4w/m6/wr+1JH4QT9rJxyrown/T4JclgnNWSyEAdsHLhj0cTCu2dX+rKLcLrJcrfm78= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from DU2PR04MB8630.eurprd04.prod.outlook.com (2603:10a6:10:2dd::15) by VE1PR04MB7454.eurprd04.prod.outlook.com (2603:10a6:800:1a8::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6277.38; Tue, 11 Apr 2023 15:11:51 +0000 Received: from DU2PR04MB8630.eurprd04.prod.outlook.com ([fe80::bb08:83bc:69ce:21ed]) by DU2PR04MB8630.eurprd04.prod.outlook.com ([fe80::bb08:83bc:69ce:21ed%8]) with mapi id 15.20.6277.038; Tue, 11 Apr 2023 15:11:51 +0000 From: Pankaj Gupta To: shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, gaurav.jain@nxp.com, sahil.malhotra@nxp.com, aisheng.dong@nxp.com, V.Sethi@nxp.com Cc: Pankaj Gupta Subject: [NXP ELE-MUAP 4/7] arm64: dts: imx8ulp-evk: added ele-mu Date: Tue, 11 Apr 2023 21:55:33 +0530 Message-Id: <20230411162536.30604-5-pankaj.gupta@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230411162536.30604-1-pankaj.gupta@nxp.com> References: <20230411162536.30604-1-pankaj.gupta@nxp.com> X-ClientProxiedBy: SI2P153CA0035.APCP153.PROD.OUTLOOK.COM (2603:1096:4:190::14) To AM9PR04MB8636.eurprd04.prod.outlook.com (2603:10a6:20b:43f::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DU2PR04MB8630:EE_|VE1PR04MB7454:EE_ X-MS-Office365-Filtering-Correlation-Id: d1be206f-fe2d-4856-e097-08db3a9f1412 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: UvA7ezFII4zlgoHoP5hvA1oFiG2+rQu9XE6YrFyqAWOkYFVozKdhEsRRot+2utVLNP4AOzCO5RMuAyiPE56gVEifmKXOppuErxGmJDW4iAZ0/U/EWtXyambpNzu1BQ4HIhf6zq4Kdyjga8kYUE0dd/rzbFQ5rDXODlwshysIwHzPKmXA10UbdbW/sNhrkyK2EpWl3BhGhQ+eI2Cdk5/BgEfRwuzX+GhfwIGg2bKP7rvs7mk1SLbSzyZRyAVHj2SUTZJUvchDuG0XYk460dTwUk2GITV+4Djp3AS453vK9JGNPj6z2Kns3al9CRB3vvkxdtU86janFnpNQsrWdFyWpegRbEsPgz87Qzf3R4Ry/rxiWi2zJVbfiV5Ca0Ub2riJMtUxNFK8jFgLqjLnlPH74SSLS0eTKIrQGJMsjD1DKBlLIHu8QunejkjiI3mdqBi9eYdr/LcF1wQFM8WQi2FZoZ1dMUfUaTOWBP9wY1f9eiQYkci7mAS1JQUfVcV+tlprhfXx8+ipCmb5MqkTtiS475jIQptLlrqaly7bFf2CmKj+R48Kzce3yYHpVDW1/6LwYXlT+nWiIn0V6H6ubHIByf9ChQOBLlOqDEmzWXrQiKzlIOYmClW0MoU2LGHricrp6qjh04wXS+LB0mBY6ME27iOA2Bs2nK6BZiHmzmXENvo= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DU2PR04MB8630.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(366004)(39860400002)(396003)(136003)(376002)(346002)(451199021)(6486002)(478600001)(4326008)(52116002)(6636002)(8676002)(66946007)(66476007)(66556008)(41300700001)(316002)(86362001)(36756003)(83380400001)(2616005)(26005)(1076003)(6512007)(6506007)(6666004)(2906002)(8936002)(44832011)(5660300002)(38100700002)(38350700002)(186003)(921005)(32563001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 59Y+jKkMzYiOKXqSURVb+v2zDd0ihWsYq+CmT1ldF62BSdx+VO5ZhctvCv/PQ9dJJ/rkpUJ3DLUA08Jg5PKLpI9wadhU0r5b47yM5H47LvHesaCD+Ur9otdMbeSL/94KqtGDgm+0F8QcHftu1rfqiOZaIvsDbrWZ+AXNTAumEZX84ZgQncaSuyHsOa8rQiVXH3cGPwScM3t+SeqE9+dmv+HUC0k2p1b2bnnW+Kj7bd2s107WUC53A/Fu7Cl8RoiXzNxyJp0OMZmB0ACezK3NzxzqCxXqArfJEU++9uSAEwrSVPGLOjZLC9YD15WNwpH4z1zYmxwOXWUBaVVi+/h/FmkLFGf3Mtdp1qpznCCHFhscRlyNjL5JNIKP/Oe4S+Ydm/zjUGaos5ESdr3KeER1LyqJ4I3ujCrEGdxcdNqeQpSD03g/m1KDouxFdz5i/63FPHHbHGlU6JcF/C4LQq3BK7ZTxMH47Ya+ywI3mqdHSNFcKP+Td509jS/DekaOCZ8vmsI8eZPMM6WECOe+xqebY/Ke5tDsYpG7IxArUiOg1MIujC/29bmgqsA/kGzZuzACzw6gNKqAU/Kz43B/9iQqUUEicddgMtat/um1mMOuN3i7kKDtTrSSHpEnmvTyVOYqQln8xea09PxFtSNFdB+NdtaEy9ccAFllqHPuq/tqp/wUyaBDRSQ4x76fZWFZRcTLFkAMcfdxxD4BcFICxTYhScTzYTJ4N6DpZALPGnYo87qQIE8+lUa7t0nyhwiJOfUoPGpiMMago0NpTfPON5N++m9/boZYKZPKjQH3i4z3NwQOQizhFFo9IbbiaFuBIrgXxin9nin6tYwy1w/nvyVklRSYdlkRC30OGy5nXWJdjSPNQNIP9IO1iLZVps0wg5zSCgQxOJo5uSEd29VV5JKa7sJmsiAUQg+Hk5710zbGc21V3g9wG28IKE8T07SXXKDTBZ5YnPT3LLIspKJqpCmTCfJuk+l77qa1Xk/koQRkuR5wP7X9bwhUGFRTlSxoU80s0JrNF6o/6vShXe4KlshMN7bd7t5mvgrNofNVRDhO5ZVqfQAJmbRivmewUwZyQYtjE1XYYboikxJRdj4LXgDIPbhSRjNA+Aj3CmC//5gd7qtwZoGYZxZ+EX73LqPJgOWYSqXoBqLEB+6PL9yECeQ4jCxt7Jt0l1CSroqHK1h+FS0joKhcpRzNJl6BQNm0EfP9dat2Aal4grO8tVC26MYaPJMGC14TwYRU7d4gw5860dF9JVwa5n88XO2LFeEvtuswPY8xmOMHTPRjF6hf8wMhkMJ/PNhULjcLqixb60fi+GPvdcKEpd6zHqA8h24ol7CuuXv67BGgNbPqqkCBp0dyVtdSUE1Rkco7L9MlGwGUB+WjFb5iu2/3FpUO/UjMeQ+yP59BmJOMlGhytN/aneUDgEaYFsFG3E3fc/h3op63JSymtqELJZ5kr7H2UWjrygpNTF2VbO74jKXo7WLUVnyefC/YDP3ugSRu853Za6pREQCjtplYPIvFa/xUvPaYX8Jm1pBOyIaIifIkIqOqSQQeSPwSfw7puF/KPBda4ENWa327VIJPMzGi8647heJNrj6v X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: d1be206f-fe2d-4856-e097-08db3a9f1412 X-MS-Exchange-CrossTenant-AuthSource: AM9PR04MB8636.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Apr 2023 15:11:51.8716 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: Be7PPI+mJA8S7YYsnixjUC6Hz2Ag2W579lC85dFDBclEzaz+87yc7iJqKbN32JdNkj4Ir05pX+Nd8Qf6N7MwuQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR04MB7454 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230411_082703_130575_EF1F4370 X-CRM114-Status: GOOD ( 10.23 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org added support for ele-mu for imx8ulp-evk. Signed-off-by: Pankaj Gupta --- arch/arm64/boot/dts/freescale/imx8ulp.dtsi | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/arch/arm64/boot/dts/freescale/imx8ulp.dtsi b/arch/arm64/boot/dts/freescale/imx8ulp.dtsi index 32193a43ff49..2ab240258a67 100644 --- a/arch/arm64/boot/dts/freescale/imx8ulp.dtsi +++ b/arch/arm64/boot/dts/freescale/imx8ulp.dtsi @@ -113,7 +113,7 @@ sosc: clock-sosc { #clock-cells = <0>; }; - sram@2201f000 { + sram0: sram@2201f000 { compatible = "mmio-sram"; reg = <0x0 0x2201f000 0x0 0x1000>; @@ -160,6 +160,17 @@ s4muap: mailbox@27020000 { #mbox-cells = <2>; }; + ele_mu: ele-mu { + compatible = "fsl,imx-ele"; + mboxes = <&s4muap 0 0 &s4muap 1 0>; + mbox-names = "tx", "rx"; + fsl,ele_mu_did = <7>; + fsl,ele_mu_id = <2>; + fsl,ele_mu_max_users = <4>; + status = "okay"; + sram-pool = <&sram0>; + }; + per_bridge3: bus@29000000 { compatible = "simple-bus"; reg = <0x29000000 0x800000>; From patchwork Tue Apr 11 16:25:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pankaj Gupta X-Patchwork-Id: 13207742 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 0CE3FC77B70 for ; Tue, 11 Apr 2023 15:12:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=6imWF68r5JsILw+Y+wf2sGB3QXMKhT7n8klORbwu7AY=; b=poiNKEDDJhuHWZ z+/+3qKvcGdFDKUfmjge6/QFlKhLV1L9sbSevgyQeeTIlqz+ToqSqw9DbpQW1Au/RvRtJBHMVFYxa NqZj+VAEvZya5eGq0visjHuj6OY1EVBWc5ShxY0VP4HoZfgxw4UpAn/x/alBdpp/+sMrltDiQLXK0 +N+s4rRPu/Zs/Zmz8iduZZAGPPwhP0Y7JKqg1rKLalV4bk0xVP56t/W5UmcXQbC1fLVnjKvY34X6X TPEP1JmAMSnYaqcKopuGCpusPD4c7f/pMOW4G/fKcMXLYMzgAStUm0WziRHbZLd2a8aSp+aCPuQeY 0/sI+PRNu0jXk/BSCXGA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1pmFfB-000NHo-1o; Tue, 11 Apr 2023 15:12:05 +0000 Received: from mail-db8eur05on20619.outbound.protection.outlook.com ([2a01:111:f400:7e1a::619] helo=EUR05-DB8-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1pmFf8-000ND1-33 for linux-arm-kernel@lists.infradead.org; Tue, 11 Apr 2023 15:12:04 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ODd1drfr1KSGZrGQvvrY7zyTK6HjazvgWGu0KnF7Jp4CjDYhH346Lkg8fBkvosQf4YhqAKWWBBn/cJn5nGAXg4hmRRQNiw1R/sRrngd+d4PSs6ofGBUDJqOV5DnRt60ay6ctA056W2T4nPWNrXbDgYRckJwwiQavrvkNNOjFOY8henBUc1PPNKdCpohE/OX5++gF1bEJKrhgg/B+x1mwbxC+7CeuIetmiWWoYdgzY9JFzfEKe+fp9G2myOKTmDpbyUt6UbXyP/CldX+hm8peqWFNHV0WnWR49hY199aUpQ668O1E74OzsnERaRNAlCdXjXb7LVo6gYJoBq5NcmfLpg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=DFyzIxZnvOaPzlmylq1VEd/n8LVahEENfFCZeDmv1cM=; b=Sa1YPO5RiCQmRn45+AlX1gDnXuZ3oogoggF0ZYjJuG0tiQ7gX9suLIFu9JrhdJlUD/5ZTwX7GXk4brpLdKD4Wgm+0/YP8auiKTWOW0V6lXhrqD24ktnOuRcQELUy63SXtwRyz8lnzt9X3mDJTtP3o0ONovUCTjvVjp0mY4Q2AQlLjh84xDkFApBj/sOApS1/dXQipAhe1IfiRbUAr1Gzexjz5nbCY8FeNAbEFU/PHzpM52GJiNHgS34EHz47GyjHzUQkSb2sZtZK33nQP0XsTp1hfdk1R+5W0CqzlSRRrFc+q++ch1erzHCK5rQ7ATcHG408gQ7z1swcv4wxcLPggw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=DFyzIxZnvOaPzlmylq1VEd/n8LVahEENfFCZeDmv1cM=; b=Wwu+9Il5tvzKSKhzy7W80wRrDjYgxjgmRPESfCjo4LlipOu+gu/mr1bbLOcAvEXYZJJ4tI9AImuzrOupWSOX8bTyI5dIkQ8JLEaVfv4OSB3Y6oZqnPcx4wJMJfkkSpBqvBu3B5jEUpWp3KlWwwtHPqaE40cRAm9j6sbv0e0FjBQ= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from DU2PR04MB8630.eurprd04.prod.outlook.com (2603:10a6:10:2dd::15) by PAXPR04MB8669.eurprd04.prod.outlook.com (2603:10a6:102:21c::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6277.38; Tue, 11 Apr 2023 15:11:56 +0000 Received: from DU2PR04MB8630.eurprd04.prod.outlook.com ([fe80::bb08:83bc:69ce:21ed]) by DU2PR04MB8630.eurprd04.prod.outlook.com ([fe80::bb08:83bc:69ce:21ed%8]) with mapi id 15.20.6277.038; Tue, 11 Apr 2023 15:11:56 +0000 From: Pankaj Gupta To: shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, gaurav.jain@nxp.com, sahil.malhotra@nxp.com, aisheng.dong@nxp.com, V.Sethi@nxp.com Cc: Pankaj Gupta Subject: [NXP ELE-MUAP 5/7] arm64: dts: imx8ulp-evk: reserved mem-ranges to constrain ele-mu dma-range Date: Tue, 11 Apr 2023 21:55:34 +0530 Message-Id: <20230411162536.30604-6-pankaj.gupta@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230411162536.30604-1-pankaj.gupta@nxp.com> References: <20230411162536.30604-1-pankaj.gupta@nxp.com> X-ClientProxiedBy: SI2P153CA0035.APCP153.PROD.OUTLOOK.COM (2603:1096:4:190::14) To AM9PR04MB8636.eurprd04.prod.outlook.com (2603:10a6:20b:43f::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DU2PR04MB8630:EE_|PAXPR04MB8669:EE_ X-MS-Office365-Filtering-Correlation-Id: 091d9f41-07e0-4c82-81e6-08db3a9f1681 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: WNRqeAqm/+7bmxmg6Lz7YKLdeQF57GB6DmtHMgMyVD1kaSlqqEaU7AWc33HRckfz/XGpv+KuT8+MPyhykM52GlhB8rIf/pwqaXqkMn6K+qv7KwDGvml4oyB4gVp4fD8dr6EjDPBA7AzH9wyRKzOV1xZEd3EgoeUu0WE1hvTzNOKwwa3+lgVXaUl6gw1nif6EOvyRDsPVQegq4tygOeGFRcOxs2yyzicO7bPzp3ZU468SmLTlBNUNzoslYpI/fjwXhUKrUJu2vMqMyKV0yqL8t0t8uWjWRmjwBPk0yYbZqubWvSbEe4QHUiSrYq4xSTQliTFKujNK5POfQN9btLtBj5CW1bAQI8TCzzspcjo2kxi6+fTnAEXw9+kyEB55XrCh2d/0piPLBAqxqOPvOBUJaxmlWSlcCiE+Kd3OkL3mHE3Vy4fGPHC9wkfAwmu9a2lPlk5zc08lcnjtS98RCjy4KF24wLPoH+arGVc0Y+M2qTf4o3slgj+MDAhy/y2G8zH4aMvMZ55ujSMEQz3/aB9N+JqqiKMItERRgDmKi09cCldnF7sfdsrHqUCPYC3rUVrU0xl6/yauW9bZl/Cqv818CcPODDY58mTW1nw1kcbiJSUH0UXjzg1yu+QSC60WWsDCcQlM4+Q7jTgtLNZsspsezs2IID3r4NW/Ea1ccQZRUV0= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DU2PR04MB8630.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(136003)(39860400002)(376002)(346002)(366004)(396003)(451199021)(44832011)(36756003)(2906002)(8676002)(8936002)(38350700002)(38100700002)(5660300002)(86362001)(478600001)(52116002)(6486002)(66556008)(2616005)(6666004)(6636002)(316002)(186003)(6512007)(6506007)(1076003)(66476007)(26005)(66946007)(921005)(41300700001)(83380400001)(4326008)(32563001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: K5HhSiFNE8tMp15oDJJjA57r6p2+/ix/lXNr3UsCC7TUipOZ9KVWpfEUb/zgdsChouG8Rv6FVCRmOVLaqRk6et/89TP7tnCeTKtAKrEmAI1c05BFep7ridZ3SYOuQJmyx28x9EbMhO5izWMn2wrmjgSIgfR0G6uTWgCwafWMtS0E/+3Ucy9P8WJVWfN0HDu+eeJamk1l6gEZnVuHZTSy4EF4vKZUjqJC7irEWeJkiuoWKqoXC7Gwmc4FgYJPOw8UC1cg4oHYP63C2BLAumCGECTSqyPyTaEUSClo1bYCKoeXwnGurRHF2FAMHVsGyhPEcykQ/HVXMkcCqw+eCIT0pyTx8QxWIxS/AfWlIN/hj8f3ZRNpRJQcouDKlvfPF6bm1sU5F6u5NDplx3fDHs7/zsjsAquoMpXoG+RU15DVs0ddh9fPl9fwuWK2xwGcTaHVr0dBsIFodHARyWYhaGst+q2yKFuEII1dn4/rot984LUD5qcn3/b4ap/YOkNp5SUKRD7Vml6bZD8/nWKDLF32iGTFsRMbs0EOwpx4flY7HLx4GdCFfReTwiP4fzVoPmoOS2kKVPYpCOC6AYpRzpw7nqWzOfL7xBBiTvmnEXAjOZENs1tpUO+gzoqYauejWP4OC+6Fi2CLeuV2qKCdvp4OCtumutDjPwPXEnXJP2Mb8HNyXQCjzcHBMalQKf7t06JEuRX1psB0CzwIUVqIOu/T092+zzpdDxII06AaCPhhhBsE0LMycdGcQ4+iQx6NZlFRKTno3IXDcKXlBCIymwvQynOLQMcG9W9tb6x2+BU9gs75Bg6BgGggud5TxgnWk7Tqei9QmP+tItKyElEaAsmy1vgz+b65jjQ8dS00tkMkCVhBTfkb7+eFIYNGv0M3lpOi8fBqtzOjIEMm5yb7wxqcXpwiX+nX4OdrDU5mSKTGojZh97DrA7lWybmLp+wCDrjztlkG/txusM0RS2UY7WuU73GEpp3WoC8hXgT6pB/3Pf4MjnnrAJR+FSk6WGbLUTa+WJrcmyg6sm8L6rSNMMXlENZjpvGB8LiFtwN0bMmd/9R2lm34xlmdUTRok0QLPr2lBQgO0NhikkVj+/HvUJo6WsfVi1PGT3Er0RAZFaL2x9dwdBEtXNi5vFXzjCOLOmzP4ee2vpdKxEyQNjOkwRHAG4dAzm4Xkm1jJWCRGT0/qq4lgnHIALxK3YgcZZO/WvfUqdcKvzpcVRcvLPtB1akZ2MMJgFkQy98f/dxOsGWAzuC3J5keCBNm8MJ0KY4TG+pvkR7zA2F8VW74quedo+X/jUEUopzhVf/rhyOfbNQSY8quEOwDSSWK3dgEUq4X+xXobDqXHg7iFZPXM0QfU/jxGDHyBEBxoFQZiXuL8h6Hz42WFgbacb6T0o+LF/ccBs8Hgkk9LPaopW2meJCrLalMRuQA2yLVpvSgJ4tWl6uyHq7Rvfn9MmdkzAxAOKib0cYfPECJTcLABn5gt9dI9Zm3o2aOhs5ZjBhXpgpn1B+4Mtmw/bHIAaT/qDs54wAdBEkTVUaA/invHcvZW2ji7s2wLT9YkMoPnWVCCl+w7gyHdb0YgL/YNR398MnDOdnI7Zuu X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 091d9f41-07e0-4c82-81e6-08db3a9f1681 X-MS-Exchange-CrossTenant-AuthSource: AM9PR04MB8636.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Apr 2023 15:11:55.9851 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 0xWsyrpitZVTqKOHsVzqloQgPcGB8/kcf4AaAZ3AiuaWrn994T8sRgi8/WuNOkPc2vAZDF4JR2qfjl+bVbHQfw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR04MB8669 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230411_081203_006900_7AA9865E X-CRM114-Status: UNSURE ( 9.53 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org EdgeLock Enclave are has a hardware limitation of restricted access to the DDR memory range: - 0x90000000 - 0xAFFFFFFF ELE-MU driver requireis 1MB of memory. In this patch the we are reserving 1MB of ddr memory region from the lower 32-bit range. Signed-off-by: Dong Aisheng Signed-off-by: Pankaj Gupta --- arch/arm64/boot/dts/freescale/imx8ulp-evk.dts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/arch/arm64/boot/dts/freescale/imx8ulp-evk.dts b/arch/arm64/boot/dts/freescale/imx8ulp-evk.dts index f1c6d933a17c..d2a39e9aa951 100644 --- a/arch/arm64/boot/dts/freescale/imx8ulp-evk.dts +++ b/arch/arm64/boot/dts/freescale/imx8ulp-evk.dts @@ -19,6 +19,17 @@ memory@80000000 { device_type = "memory"; reg = <0x0 0x80000000 0 0x80000000>; }; + reserved-memory { + #address-cells = <2>; + #size-cells = <2>; + ranges; + + ele_reserved: ele-reserved@90000000 { + compatible = "shared-dma-pool"; + reg = <0 0x90000000 0 0x100000>; + no-map; + }; + }; clock_ext_rmii: clock-ext-rmii { compatible = "fixed-clock"; @@ -53,6 +64,10 @@ &usdhc0 { status = "okay"; }; +&ele_mu { + memory-region = <&ele_reserved>; +}; + &fec { pinctrl-names = "default", "sleep"; pinctrl-0 = <&pinctrl_enet>; From patchwork Tue Apr 11 16:25:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pankaj Gupta X-Patchwork-Id: 13207744 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 40DE0C77B6F for ; Tue, 11 Apr 2023 15:13:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=7SnVINEZbNpbPJD2lzNZAT9wpd/hpR4Pytz+xRjHqo0=; b=Zg4iIisGf4eWPb vf5uPSSGJhUlGL0eirf5N/x3D/VRKX4DEu9tqZABzz3Iqfm3vzgbb53vTWpHXo+34bCBnpTezJdH4 srlcEGNhJ2uj0WZNOlUv+aUsqjFa5S/aqISMAU1ein9yZfQUX3p7nGwTULsfex7Bf/8ElZhZBPAEa 4tMznEI1X3NujN5o/OdFUbs0ZqvoEXcb4zq2sWFjveCMzPbtpVIO+qkydD3aDSb+71g0pb6eBBojo I8QrMZIbXazwqmgyo1nrpk3oWMtyA3nBq2uwOtwnhTURMBVDmM9qpnFEaWwSbRr6PVhLp5jnVdgAB ewB3FY0f2q+z/d87LHBw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1pmFfK-000NNm-23; Tue, 11 Apr 2023 15:12:14 +0000 Received: from mail-am6eur05on20613.outbound.protection.outlook.com ([2a01:111:f400:7e1b::613] helo=EUR05-AM6-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1pmFfB-000NG9-30 for linux-arm-kernel@lists.infradead.org; Tue, 11 Apr 2023 15:12:13 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dQUKi0+k2mbM23zgG922wuzIdflW4q1itK379fIp66Ybsz1S9E+GD95uBVSpx10+TzeQCEL4PdwBleQEd3cDGgjTOA01xAMwC47mIMbg+QXYrwMXhTFaZW52XlMtvl9BZDKHdtwFF+IzNT6oMQX2pV2kyL6p9GjQTEmu76ew2EOBBV1zN3i7anCZ0KWkSLtgz3pzUZOMt4hYzvrSnJ7hePOoTtqkAoYW1yAVf0L+sBnSb/xeyBvT2kcFmsI6JNQzyIXbUyMnPi/PetSmrxjzc9UQq50YNf+7cH8gGX9pHzOAkPm7G6zpWz1XYb3m0lhNFwtlilaVH3LOknm5Cph0Og== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=AloRxyzXNNRlEN/Zfgm4cGLjnoNr+p/TXsgf2GZk/BU=; b=hpsZxgLpMwOk58ls4Kfh3/EcHSuGnfGK3v5+94iKHluEzaVs5P2LHEBu6S7wzCohDtnz3Uissj+Gp0LR7OTrDF+PXeHDEN53VfMmZ+z9RhN5WTT2WkU+/3W9SanDE2snzm/PK01Pgfa3BeqtLoMyl/cNdUtXx6xa73Ybj05GbzBMC2p/agyzx/oD2V8iTkKvJ1H+CbmPMToqy0FmuA29in9flUWlsXAvLATSAOWdxwTZDrOIAVnTzeNOWxWq8oRFc6VhX9kWWDSqYqEvnU02jnQxc6g/ttmJbiKq7YV2YuQwwxz4MyPAJRM+9FE2VN7e8JwWR1q1MdcAnD5QVL9+IQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=AloRxyzXNNRlEN/Zfgm4cGLjnoNr+p/TXsgf2GZk/BU=; b=WjWx4J10B4GME7PlFSCYzIy7SQt+CB062+hq326CRF9MWk64QlRenlI4x8Ih/z71PQ7nVSpl0j8TpfK+ikJOvp0F5dzHjZMvzEg3uQbM/oU6CvXGTtkBN/xuNmLaHp7FiBTn5cB3uYbY3uugEQU9DCDtDNTDC44VITMXp8+cT+0= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from DU2PR04MB8630.eurprd04.prod.outlook.com (2603:10a6:10:2dd::15) by AS8PR04MB9064.eurprd04.prod.outlook.com (2603:10a6:20b:447::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6277.38; Tue, 11 Apr 2023 15:12:00 +0000 Received: from DU2PR04MB8630.eurprd04.prod.outlook.com ([fe80::bb08:83bc:69ce:21ed]) by DU2PR04MB8630.eurprd04.prod.outlook.com ([fe80::bb08:83bc:69ce:21ed%8]) with mapi id 15.20.6277.038; Tue, 11 Apr 2023 15:12:00 +0000 From: Pankaj Gupta To: shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, gaurav.jain@nxp.com, sahil.malhotra@nxp.com, aisheng.dong@nxp.com, V.Sethi@nxp.com Cc: Pankaj Gupta Subject: [NXP ELE-MUAP 6/7] firmware: imx: add ELE MU driver support Date: Tue, 11 Apr 2023 21:55:35 +0530 Message-Id: <20230411162536.30604-7-pankaj.gupta@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230411162536.30604-1-pankaj.gupta@nxp.com> References: <20230411162536.30604-1-pankaj.gupta@nxp.com> X-ClientProxiedBy: SI2P153CA0035.APCP153.PROD.OUTLOOK.COM (2603:1096:4:190::14) To AM9PR04MB8636.eurprd04.prod.outlook.com (2603:10a6:20b:43f::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DU2PR04MB8630:EE_|AS8PR04MB9064:EE_ X-MS-Office365-Filtering-Correlation-Id: 3c13d890-1312-4ccb-e8b4-08db3a9f18f6 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 2nRlbmXKG23zVpAQbcLzukG58YCfpXd9fCW+zk36E+c0/6WAnyJEsgjnpa8H/hMt/3tzSZHhf2hjx/mHwhiFcahCDP9tvxJBAl/Wo7NlnT6fcA5XZUOFehAW2wX/1YnpcSh2cUUWz9gbuY/ElCOERa26d5UF10l2EFA3G4X9FSTklUXtr9lwBBLqDvlb5bE6mLg9C8tGJVHaokYR451Uvi0rZeqE0jjJmuoBS+GQQS4VBCrxN0wtqtuM3BVbyruBVR6nwc5Jn7GBdWnS4lYsyTSFvJPKA3LwpUiS8Qq7mhm+KWZNcMszHURU/bqOT4+yKzgSfQqKVgoqBsCBk6GyRGjN3AYVyOdwAwH+c6DYVZgcr9vDYxeJsvFYMdXhitblqyVyJdQEw+M5TM7BOztR/+yjU9uYX8qJbkkedm8kfstSdBTpTzF2knZiyw+AOD9iLhtty2nI4J64IyIHgH/edIejb9UvE09Qt0PpVPD3CUcnhcvKD9m3vxm/YuxsrHzeFKlKGeIr/LUclmQciP8uXq06PouYtzL2gv64b3JOJT+pDqDFSBBYb5vXuSqf5Ui5yQyvSWeefyOpc9mYLkH7r78e96PK/h7d4TESj/iDiUw71EKzDlnACZ5Kvs+r1S9gkY7NuPLVsc73ngQ5vJwePA== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DU2PR04MB8630.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(39860400002)(396003)(376002)(346002)(136003)(366004)(451199021)(52116002)(66946007)(4326008)(8676002)(66556008)(66476007)(186003)(5660300002)(83380400001)(86362001)(316002)(6666004)(41300700001)(8936002)(6636002)(478600001)(2906002)(36756003)(26005)(44832011)(1076003)(6512007)(6506007)(6486002)(2616005)(38100700002)(38350700002)(30864003)(921005)(579004)(559001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: PLJ9/ur7wGmgc+oTiPzK6+dYsR1ATZ6fPeySCkv5Z2kznWdm3MLhDaeC62uRuOqdPfiJmjVL4S5HrMVlsFHj3JIcNOqQbzOEfCB8y6619tQtRjum2AtMPLPQuyqWK+TpMJMU54YtuqoBdslbffKamJ5ARvuvSYWDSm7MPUdmIPBxnSClxbKiwx+wlphEG4s1HLD0oCLANGhUDE6aoMDBr839+1/Q/MsRqn8ucBQ76gt5yEUhF4ppoIZB+oc5/Mo1g4kwjJE95NH/FeRJYnUzHc2Fn9H6w704AUd5O9tt9k+1PB8YonGBH+nnR7ZDVmSihTOxhEyEn31wH06gZezkkLxx7AVNOXm0mzsn6aNLarQzdYCVfLu+bAM/4kma+b//QQyDcnHkBLWOMIS+refFkDoh4x2bd7qYGWtTf1890CAMB0OeVri7PdyTNHuc9eUFF+f1bexQw3SMgvtN128zQw99WPoXRpXjssDn/r74fd3DvSjTS9FSeIuEDclCYhSPSpPUUvhGtyIFx0al1rCs1leKx0NRSEltcV5OEfvrkt4ncFJjzxKNkMi+4bg1+MHPiyoWVejSjN3W5rnKoONt7uOIcA+sdcICmQ8PwHhj7yIK+mBsvEcXG6z+IYxzfwwikDbaKR3KNL5BRAcb1S55tDo8iGrK/gfN6NsZO9GFOQSKvQvRHyQ1XdqBryuSNMmF1IGFEpsXXS40CjDGSifUOjoUf+SRLUjpKD/FH2NUjTDpss84OKEMd/b1wDeLmo0RbjeTj/fAVk9/P2Qupvq/I2ULgDiN541Sq//Exgj5mzf3EYekA5WM2/4VkGwkjfPa0btmcLoZmRevLNW9iQVg3JW00LGzDCopJ5sgcibvzILDDHPG/4dJ98GXeIFZrysHwo5yXKuMpsP6gFQ1vjelcg/PqOL8H9ccLpKDSXngHQFQXqM1WhOizloL1IpBqmKPdkrkZ0pAkPsV1WXLVgB8RQDFNUA9l2AHb63SSXTinZ+q0BU/M4UMpwbJwLFVlhflvdmvf8c9ZyqhTTEZ9hx5YPsikZymmba3jZQCrHZgUafUk+qhx0gAs8pBfN+mFymQesAAgu2+K85CO5L++odlfLPzI4gXssmUYSJ+y+55g3qOc74AybiQoxtJOKPob6QprjNddTr50DPXqQMNSNOe5WqBIt6VPbQqWkO497a3gfqQgr2e5BupUDUEXTyorfQg6w7OVLWZmHtgwvGrfUo1bGybkst7IBfDDaL0EZ2WUUbV/MkKVEr9ZlLT70/DJM45Vjb7sgwEf2GurUO6bZKJFacNK2p/Q7KK+WfjA93qW6ggoSxCOHqHVv08wySoGpHcwk+nFqg/smCt0bvxpI2LPBeY3Y99Ht3Uzj2O1FF1sNMVTGmhP4sA8fP09TShVkw/WlOcep96AZQ8gyN0iizteph7Vnsz5Xp8okTobWr+utUt99aZ2N1Lk7IJX6UzDlc4P6vLfxOFQwgRfPXVxpB6u32m+JE1iH2r/KKaKhxbzJd2O76UdiFlee+V68xY1VH0h54nNT46sgkbjzbXFxq6YWykRDD975KhZ76839QQYXOBpHPVFLA84/c0X8RA7zuO X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3c13d890-1312-4ccb-e8b4-08db3a9f18f6 X-MS-Exchange-CrossTenant-AuthSource: AM9PR04MB8636.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Apr 2023 15:12:00.2832 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 1sAs5bEKBNRjrZnVEvAaooXXH4qB8MEKiKb3xRBMBjwBUt5HOFhe8B3IMmVDNt0erRBZiIW8PjWXLdjvTVdQ+A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB9064 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230411_081206_333004_52A6D6BE X-CRM114-Status: GOOD ( 25.13 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The Edgelock Enclave Message Unit (ELE MU), is a message based communication channel, to communicated with ELE Firmware. This runs on a dedicated MU present between application core and ELE H/W IP. It exists on some i.MX processors. e.g. i.MX8ULP, i.MX93 This patch implements the mail-box based communication with ELE firmware. Signed-off-by: Gaurav Jain Signed-off-by: Pankaj Gupta --- drivers/firmware/imx/Kconfig | 11 + drivers/firmware/imx/Makefile | 2 + drivers/firmware/imx/ele_base_msg.c | 377 ++++++ drivers/firmware/imx/ele_mu.c | 1284 +++++++++++++++++++++ drivers/firmware/imx/ele_mu.h | 174 +++ include/linux/firmware/imx/ele_base_msg.h | 66 ++ include/linux/firmware/imx/ele_mu_ioctl.h | 52 + 7 files changed, 1966 insertions(+) create mode 100644 drivers/firmware/imx/ele_base_msg.c create mode 100644 drivers/firmware/imx/ele_mu.c create mode 100644 drivers/firmware/imx/ele_mu.h create mode 100644 include/linux/firmware/imx/ele_base_msg.h create mode 100644 include/linux/firmware/imx/ele_mu_ioctl.h diff --git a/drivers/firmware/imx/Kconfig b/drivers/firmware/imx/Kconfig index c027d99f2a59..8b4d627e48b8 100644 --- a/drivers/firmware/imx/Kconfig +++ b/drivers/firmware/imx/Kconfig @@ -28,3 +28,14 @@ config IMX_SCU_PD depends on IMX_SCU help The System Controller Firmware (SCFW) based power domain driver. + +config IMX_EL_ENCLAVE + tristate "i.MX Embedded EdgeLock Enclave support." + depends on IMX_MBOX + default m if ARM64 + + help + It is possible to use APIs exposed by the iMX EdgeLock Enclave like base, HSM & + SHE using the SAB protocol via the shared Messaging Unit. This driver exposes + these interfaces via a set of file descriptors allowing to configure shared + memory, send and receive messages. diff --git a/drivers/firmware/imx/Makefile b/drivers/firmware/imx/Makefile index b76acbade2a0..886385e79bf2 100644 --- a/drivers/firmware/imx/Makefile +++ b/drivers/firmware/imx/Makefile @@ -2,3 +2,5 @@ obj-$(CONFIG_IMX_DSP) += imx-dsp.o obj-$(CONFIG_IMX_SCU) += imx-scu.o misc.o imx-scu-irq.o rm.o imx-scu-soc.o obj-$(CONFIG_IMX_SCU_PD) += scu-pd.o +el_enclave-objs = ele_mu.o ele_base_msg.o +obj-${CONFIG_IMX_EL_ENCLAVE} += el_enclave.o diff --git a/drivers/firmware/imx/ele_base_msg.c b/drivers/firmware/imx/ele_base_msg.c new file mode 100644 index 000000000000..5c7667674089 --- /dev/null +++ b/drivers/firmware/imx/ele_base_msg.c @@ -0,0 +1,377 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Copyright 2021-2023 NXP + */ + +#include +#include + +#include +#include + +#include "ele_mu.h" + +/* Fill a command message header with a given command ID and length in bytes. */ +static int plat_fill_cmd_msg_hdr(struct mu_hdr *hdr, + uint8_t cmd, + uint32_t len) +{ + struct ele_mu_priv *priv = NULL; + int err; + + err = get_ele_mu_priv(&priv); + if (err) { + pr_err("Error: iMX EdgeLock Enclave MU, used before probing.\n"); + return err; + } + + hdr->tag = priv->cmd_tag; + hdr->ver = ELE_BASE_API_VERSION; + hdr->command = cmd; + hdr->size = len >> 2; + + return err; +} + +static u32 plat_add_msg_crc(uint32_t *msg, uint32_t msg_len) +{ + uint32_t i; + uint32_t crc = 0; + uint32_t nb_words = msg_len >> 2; + + for (i = 0; i < nb_words - 1; i++) + crc ^= *(msg + i); + + return crc; +} + +int imx_ele_msg_send_rcv(struct ele_mu_priv *priv) +{ + unsigned int wait; + int err; + + mutex_lock(&priv->mu_cmd_lock); + mutex_lock(&priv->mu_lock); + + err = mbox_send_message(priv->tx_chan, &priv->tx_msg); + if (err < 0) { + pr_err("Error: mbox_send_message failure.\n"); + mutex_unlock(&priv->mu_lock); + return err; + } + mutex_unlock(&priv->mu_lock); + + wait = msecs_to_jiffies(1000); + if (!wait_for_completion_timeout(&priv->done, wait)) { + pr_err("Error: wait_for_completion timed out.\n"); + err = -ETIMEDOUT; + } + + /* As part of func ele_mu_rx_callback() execution, + * response will copied to ele_msg->rsp_msg. + * + * Lock: (mutex_unlock(&ele_mu_priv->mu_cmd_lock), + * will be unlocked if it is a response. + */ + + return err; +} + +static int read_otp_uniq_id(struct ele_mu_priv *priv, u32 *value) +{ + unsigned int tag, command, size, ver, status; + + tag = MSG_TAG(priv->rx_msg.header); + command = MSG_COMMAND(priv->rx_msg.header); + size = MSG_SIZE(priv->rx_msg.header); + ver = MSG_VER(priv->rx_msg.header); + status = RES_STATUS(priv->rx_msg.data[0]); + + if (tag == priv->rsp_tag && + command == ELE_READ_FUSE_REQ && + size == ELE_READ_FUSE_RSP_MSG_SZ && + ver == ELE_BASE_API_VERSION && + status == ELE_SUCCESS_IND) { + value[0] = priv->rx_msg.data[1]; + value[1] = priv->rx_msg.data[2]; + value[2] = priv->rx_msg.data[3]; + value[3] = priv->rx_msg.data[4]; + return 0; + } + + return -EINVAL; +} + +static int read_fuse_word(struct ele_mu_priv *priv, u32 *value) +{ + unsigned int tag, command, size, ver, status; + + tag = MSG_TAG(priv->rx_msg.header); + command = MSG_COMMAND(priv->rx_msg.header); + size = MSG_SIZE(priv->rx_msg.header); + ver = MSG_VER(priv->rx_msg.header); + status = RES_STATUS(priv->rx_msg.data[0]); + + if (tag == priv->rsp_tag && + command == ELE_READ_FUSE_REQ && + size == ELE_READ_FUSE_REQ_MSG_SZ && + ver == ELE_BASE_API_VERSION && + status == ELE_SUCCESS_IND) { + value[0] = priv->rx_msg.data[1]; + return 0; + } + + return -EINVAL; +} + +int read_common_fuse(uint16_t fuse_id, u32 *value) +{ + struct ele_mu_priv *priv = NULL; + int err; + + err = get_ele_mu_priv(&priv); + if (err) { + pr_err("Error: iMX EdgeLock Enclave MU, used before probing.\n"); + return err; + } + err = plat_fill_cmd_msg_hdr((struct mu_hdr *)&priv->tx_msg.header, + ELE_READ_FUSE_REQ, 8); + if (err) { + pr_err("Error: plat_fill_cmd_msg_hdr failed.\n"); + return err; + } + + priv->tx_msg.data[0] = fuse_id; + err = imx_ele_msg_send_rcv(priv); + if (err < 0) + return err; + + switch (fuse_id) { + case OTP_UNIQ_ID: + err = read_otp_uniq_id(priv, value); + break; + default: + err = read_fuse_word(priv, value); + break; + } + + return err; +} +EXPORT_SYMBOL_GPL(read_common_fuse); + +int ele_ping(void) +{ + struct ele_mu_priv *priv = NULL; + unsigned int tag, command, size, ver, status; + int err; + + err = get_ele_mu_priv(&priv); + if (err) { + pr_err("Error: iMX EdgeLock Enclave MU, used before probing.\n"); + return err; + } + err = plat_fill_cmd_msg_hdr((struct mu_hdr *)&priv->tx_msg.header, + ELE_PING_REQ, 4); + if (err) { + pr_err("Error: plat_fill_cmd_msg_hdr failed.\n"); + return err; + } + + err = imx_ele_msg_send_rcv(priv); + if (err < 0) + return err; + + tag = MSG_TAG(priv->rx_msg.header); + command = MSG_COMMAND(priv->rx_msg.header); + size = MSG_SIZE(priv->rx_msg.header); + ver = MSG_VER(priv->rx_msg.header); + status = RES_STATUS(priv->rx_msg.data[0]); + + if (tag == priv->rsp_tag && command == ELE_PING_REQ && + size == ELE_PING_REQ_MSG_SZ && ver == ELE_BASE_API_VERSION && + status == ELE_SUCCESS_IND) + return 0; + + return -EAGAIN; +} +EXPORT_SYMBOL_GPL(ele_ping); + +int ele_service_swap(phys_addr_t addr, u32 addr_size, u16 flag) +{ + struct ele_mu_priv *priv; + int ret; + unsigned int tag, command, size, ver, status; + + ret = get_ele_mu_priv(&priv); + if (ret) + return ret; + + ret = plat_fill_cmd_msg_hdr((struct mu_hdr *)&priv->tx_msg.header, + ELE_SERVICE_SWAP_REQ, 24); + if (ret) + return ret; + + priv->tx_msg.data[0] = flag; + priv->tx_msg.data[1] = addr_size; + priv->tx_msg.data[2] = ELE_NONE_VAL; + priv->tx_msg.data[3] = lower_32_bits(addr); + priv->tx_msg.data[4] = plat_add_msg_crc((uint32_t *)&priv->tx_msg, 24); + ret = imx_ele_msg_send_rcv(priv); + if (ret < 0) + return ret; + + tag = MSG_TAG(priv->rx_msg.header); + command = MSG_COMMAND(priv->rx_msg.header); + size = MSG_SIZE(priv->rx_msg.header); + ver = MSG_VER(priv->rx_msg.header); + status = RES_STATUS(priv->rx_msg.data[0]); + if (tag == priv->rsp_tag && + command == ELE_SERVICE_SWAP_REQ && + size == ELE_SERVICE_SWAP_REQ_MSG_SZ && + ver == ELE_BASE_API_VERSION && + status == ELE_SUCCESS_IND) { + if (flag == ELE_IMEM_EXPORT) + return priv->rx_msg.data[1]; + else + return 0; + } + + return -EINVAL; +} +EXPORT_SYMBOL_GPL(ele_service_swap); + +int ele_get_info(phys_addr_t addr, u32 data_size) +{ + struct ele_mu_priv *priv; + int ret; + unsigned int tag, command, size, ver, status; + + ret = get_ele_mu_priv(&priv); + if (ret) + return ret; + + ret = plat_fill_cmd_msg_hdr((struct mu_hdr *)&priv->tx_msg.header, + ELE_GET_INFO_REQ, 16); + if (ret) + return ret; + + priv->tx_msg.data[0] = upper_32_bits(addr); + priv->tx_msg.data[1] = lower_32_bits(addr); + priv->tx_msg.data[2] = data_size; + ret = imx_ele_msg_send_rcv(priv); + if (ret < 0) + return ret; + + tag = MSG_TAG(priv->rx_msg.header); + command = MSG_COMMAND(priv->rx_msg.header); + size = MSG_SIZE(priv->rx_msg.header); + ver = MSG_VER(priv->rx_msg.header); + status = RES_STATUS(priv->rx_msg.data[0]); + if (tag == priv->rsp_tag && + command == ELE_GET_INFO_REQ && + size == ELE_GET_INFO_REQ_MSG_SZ && + ver == ELE_BASE_API_VERSION && + status == ELE_SUCCESS_IND) + return 0; + + return -EINVAL; +} +EXPORT_SYMBOL_GPL(ele_get_info); + +/* + * ele_get_trng_state() - prepare and send the command to read + * crypto lib and TRNG state + * TRNG state + * 0x1 TRNG is in program mode + * 0x2 TRNG is still generating entropy + * 0x3 TRNG entropy is valid and ready to be read + * 0x4 TRNG encounter an error while generating entropy + * + * CSAL state + * 0x0 Crypto Lib random context initialization is not done yet + * 0x1 Crypto Lib random context initialization is on-going + * 0x2 Crypto Lib random context initialization succeed + * 0x3 Crypto Lib random context initialization failed + * + * returns: csal and trng state. + * + */ +int ele_get_trng_state(void) +{ + struct ele_mu_priv *priv; + int ret; + unsigned int tag, command, size, ver, status; + + /* access ele_mu_priv data structure pointer*/ + ret = get_ele_mu_priv(&priv); + if (ret) + return ret; + + ret = plat_fill_cmd_msg_hdr((struct mu_hdr *)&priv->tx_msg.header, + ELE_GET_TRNG_STATE_REQ, 4); + if (ret) + return ret; + + ret = imx_ele_msg_send_rcv(priv); + if (ret < 0) + return ret; + + tag = MSG_TAG(priv->rx_msg.header); + command = MSG_COMMAND(priv->rx_msg.header); + size = MSG_SIZE(priv->rx_msg.header); + ver = MSG_VER(priv->rx_msg.header); + status = RES_STATUS(priv->rx_msg.data[0]); + if (tag == priv->rsp_tag && + command == ELE_GET_TRNG_STATE_REQ && + size == ELE_GET_TRNG_STATE_REQ_MSG_SZ && + ver == ELE_BASE_API_VERSION && + status == ELE_SUCCESS_IND) { + return (priv->rx_msg.data[1] & CSAL_TRNG_STATE_MASK); + } + + return -EINVAL; +} +EXPORT_SYMBOL_GPL(ele_get_trng_state); + +/* + * ele_start_rng() - prepare and send the command to start + * initialization of the ELE RNG context + * + * returns: 0 on success. + */ +int ele_start_rng(void) +{ + struct ele_mu_priv *priv; + int ret; + unsigned int tag, command, size, ver, status; + + /* access ele_mu_priv data structure pointer*/ + ret = get_ele_mu_priv(&priv); + if (ret) + return ret; + + ret = plat_fill_cmd_msg_hdr((struct mu_hdr *)&priv->tx_msg.header, + ELE_START_RNG_REQ, 4); + if (ret) + return ret; + + ret = imx_ele_msg_send_rcv(priv); + if (ret < 0) + return ret; + + tag = MSG_TAG(priv->rx_msg.header); + command = MSG_COMMAND(priv->rx_msg.header); + size = MSG_SIZE(priv->rx_msg.header); + ver = MSG_VER(priv->rx_msg.header); + status = RES_STATUS(priv->rx_msg.data[0]); + if (tag == priv->rsp_tag && + command == ELE_START_RNG_REQ && + size == ELE_START_RNG_REQ_MSG_SZ && + ver == ELE_BASE_API_VERSION && + status == ELE_SUCCESS_IND) { + return 0; + } + + return -EINVAL; +} +EXPORT_SYMBOL_GPL(ele_start_rng); diff --git a/drivers/firmware/imx/ele_mu.c b/drivers/firmware/imx/ele_mu.c new file mode 100644 index 000000000000..674c7954546b --- /dev/null +++ b/drivers/firmware/imx/ele_mu.c @@ -0,0 +1,1284 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Copyright 2021-2023 NXP + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "ele_mu.h" + +#define ELE_PING_INTERVAL (3600 * HZ) +#define ELE_TRNG_STATE_OK 0x203 +#define ELE_GET_TRNG_STATE_RETRY_COUNT 0x5 + +#define ELE_GET_INFO_BUFF_SZ 0x100 +#define ELE_GET_INFO_READ_SZ 0xA0 +#define ELE_IMEM_SIZE 0x10000 +#define ELE_IMEM_STATE_OK 0xCA +#define ELE_IMEM_STATE_BAD 0xFE +#define ELE_IMEM_STATE_WORD 0x27 +#define ELE_IMEM_STATE_MASK 0x00ff0000 + +#define RESERVED_DMA_POOL BIT(1) + +struct ele_mu_priv *ele_priv_export; + +struct imx_info { + bool socdev; + /* platform specific flag to enable/disable the ELE True RNG */ + bool enable_ele_trng; + bool reserved_dma_ranges; +}; + +static const struct imx_info imx8ulp_info = { + .socdev = true, + .enable_ele_trng = false, + .reserved_dma_ranges = true, +}; + +static const struct imx_info imx93_info = { + .socdev = false, + .enable_ele_trng = true, + .reserved_dma_ranges = true, +}; + +static const struct of_device_id ele_mu_match[] = { + { .compatible = "fsl,imx-ele", .data = (void *)&imx8ulp_info}, + { .compatible = "fsl,imx93-ele", .data = (void *)&imx93_info}, + {}, +}; + +int get_ele_mu_priv(struct ele_mu_priv **export) +{ + if (!ele_priv_export) + return -EPROBE_DEFER; + + *export = ele_priv_export; + return 0; +} +EXPORT_SYMBOL_GPL(get_ele_mu_priv); + +/* + * Callback called by mailbox FW when data are received + */ +static void ele_mu_rx_callback(struct mbox_client *c, void *msg) +{ + struct device *dev = c->dev; + struct ele_mu_priv *priv = dev_get_drvdata(dev); + struct ele_mu_device_ctx *dev_ctx; + bool is_response = false; + int msg_size; + struct mu_hdr header; + + dev_dbg(dev, "Message received on mailbox\n"); + + /* The function can be called with NULL msg */ + if (!msg) { + dev_err(dev, "Message is invalid\n"); + return; + } + + if (IS_ERR(msg)) { + dev_err(dev, "Error during reception of message: %ld\n", + PTR_ERR(msg)); + return; + } + + header.tag = ((u8 *)msg)[TAG_OFFSET]; + header.command = ((u8 *)msg)[CMD_OFFSET]; + header.size = ((u8 *)msg)[SZ_OFFSET]; + header.ver = ((u8 *)msg)[VER_OFFSET]; + + dev_dbg(dev, "Selecting device\n"); + + /* Incoming command: wake up the receiver if any. */ + if (header.tag == priv->cmd_tag) { + dev_dbg(dev, "Selecting cmd receiver\n"); + dev_ctx = priv->cmd_receiver_dev; + } else if (header.tag == priv->rsp_tag) { + if (priv->waiting_rsp_dev) { + dev_dbg(dev, "Selecting rsp waiter\n"); + dev_ctx = priv->waiting_rsp_dev; + is_response = true; + } else { + /* Reading the EdgeLock Enclave response + * to the command sent by other + * linux kernel services. + */ + spin_lock(&priv->lock); + priv->rx_msg = *(struct ele_api_msg *)msg; + complete(&priv->done); + spin_unlock(&priv->lock); + mutex_unlock(&priv->mu_cmd_lock); + return; + } + } else { + dev_err(dev, "Failed to select a device for message: %.8x\n", + *((u32 *) &header)); + return; + } + + if (!dev_ctx) { + dev_err(dev, "No device context selected for message: %.8x\n", + *((u32 *)&header)); + return; + } + /* Init reception */ + msg_size = header.size; + if (msg_size > MAX_RECV_SIZE) { + devctx_err(dev_ctx, "Message is too big (%d > %d)", msg_size, + MAX_RECV_SIZE); + return; + } + + memcpy(dev_ctx->temp_resp, msg, msg_size * sizeof(u32)); + dev_ctx->temp_resp_size = msg_size; + + /* Allow user to read */ + dev_ctx->pending_hdr = dev_ctx->temp_resp[0]; + wake_up_interruptible(&dev_ctx->wq); + + if (is_response) { + priv->waiting_rsp_dev = NULL; + mutex_unlock(&priv->mu_cmd_lock); + } +} + +static void ele_ping_handler(struct work_struct *work) +{ + int ret; + + ret = ele_ping(); + if (ret) + pr_err("ping ele failed, try again!\n"); + + /* reschedule the delay work */ + schedule_delayed_work(to_delayed_work(work), ELE_PING_INTERVAL); +} +static DECLARE_DELAYED_WORK(ele_ping_work, ele_ping_handler); + +static int imx_soc_device_register(struct platform_device *pdev) +{ + struct soc_device_attribute *attr; + struct soc_device *dev; + struct gen_pool *sram_pool; + u32 *get_info_data; + phys_addr_t get_info_addr; + u32 soc_rev; + u32 v[4]; + int err; + + err = read_common_fuse(OTP_UNIQ_ID, v); + if (err) + return err; + + sram_pool = of_gen_pool_get(pdev->dev.of_node, "sram-pool", 0); + if (!sram_pool) { + pr_err("Unable to get sram pool\n"); + return -EINVAL; + } + + get_info_data = (u32 *)gen_pool_alloc(sram_pool, 0x100); + if (!get_info_data) { + pr_err("Unable to alloc sram from sram pool\n"); + return -ENOMEM; + } + + get_info_addr = gen_pool_virt_to_phys(sram_pool, (ulong)get_info_data); + + attr = kzalloc(sizeof(*attr), GFP_KERNEL); + if (!attr) + return -ENOMEM; + + err = ele_get_info(get_info_addr, 23 * sizeof(u32)); + if (err) { + attr->revision = kasprintf(GFP_KERNEL, "A0"); + } else { + soc_rev = (get_info_data[1] & 0xffff0000) >> 16; + if (soc_rev == 0xA100) + attr->revision = kasprintf(GFP_KERNEL, "A1"); + else + attr->revision = kasprintf(GFP_KERNEL, "A0"); + } + + gen_pool_free(sram_pool, (unsigned long)get_info_data, 0x100); + + err = of_property_read_string(of_root, "model", &attr->machine); + if (err) { + kfree(attr); + return -EINVAL; + } + attr->family = kasprintf(GFP_KERNEL, "Freescale i.MX"); + + attr->serial_number + = kasprintf(GFP_KERNEL, "%016llX", (u64)v[3] << 32 | v[0]); + attr->soc_id = kasprintf(GFP_KERNEL, "i.MX8ULP"); + + dev = soc_device_register(attr); + if (IS_ERR(dev)) { + kfree(attr->soc_id); + kfree(attr->serial_number); + kfree(attr->revision); + kfree(attr->family); + kfree(attr->machine); + kfree(attr); + return PTR_ERR(dev); + } + + return 0; +} + +static int ele_do_start_rng(void) +{ + int ret; + int count = ELE_GET_TRNG_STATE_RETRY_COUNT; + + ret = ele_get_trng_state(); + if (ret < 0) { + pr_err("Failed to get trng state\n"); + return ret; + } else if (ret != ELE_TRNG_STATE_OK) { + /* call start rng */ + ret = ele_start_rng(); + if (ret) { + pr_err("Failed to start rng\n"); + return ret; + } + + /* poll get trng state API, ELE_GET_TRNG_STATE_RETRY_COUNT times + * or while trng state != 0x203 + */ + do { + msleep(10); + ret = ele_get_trng_state(); + if (ret < 0) { + pr_err("Failed to get trng state\n"); + return ret; + } + count--; + } while ((ret != ELE_TRNG_STATE_OK) && count); + if (ret != ELE_TRNG_STATE_OK) + return -EIO; + } + + return 0; +} + +/* + * File operations for user-space + */ + +/* Write a message to the MU. */ +static ssize_t ele_mu_fops_write(struct file *fp, const char __user *buf, + size_t size, loff_t *ppos) +{ + struct ele_mu_device_ctx *dev_ctx + = container_of(fp->private_data, + struct ele_mu_device_ctx, + miscdev); + struct ele_mu_priv *ele_mu_priv = dev_ctx->priv; + u32 nb_words = 0; + struct mu_hdr header; + int err; + + devctx_dbg(dev_ctx, "write from buf (%p)%ld, ppos=%lld\n", buf, size, + ((ppos) ? *ppos : 0)); + + if (down_interruptible(&dev_ctx->fops_lock)) + return -EBUSY; + + if (dev_ctx->status != MU_OPENED) { + err = -EINVAL; + goto exit; + } + + if (size < ELE_MU_HDR_SZ) { + devctx_err(dev_ctx, "User buffer too small(%ld < %x)\n", + size, ELE_MU_HDR_SZ); + err = -ENOSPC; + goto exit; + } + + if (size > MAX_MESSAGE_SIZE_BYTES) { + devctx_err(dev_ctx, "User buffer too big(%ld > %lu)\n", size, + MAX_MESSAGE_SIZE_BYTES); + err = -ENOSPC; + goto exit; + } + + /* Copy data to buffer */ + err = (int)copy_from_user(dev_ctx->temp_cmd, buf, size); + if (err) { + err = -EFAULT; + devctx_err(dev_ctx, "Fail copy message from user\n"); + goto exit; + } + + print_hex_dump_debug("from user ", DUMP_PREFIX_OFFSET, 4, 4, + dev_ctx->temp_cmd, size, false); + + header = *((struct mu_hdr *) (&dev_ctx->temp_cmd[0])); + + /* Check the message is valid according to tags */ + if (header.tag == ele_mu_priv->cmd_tag) { + /* + * unlocked in ele_mu_receive_work_handler when the + * response to this command is received. + */ + mutex_lock(&ele_mu_priv->mu_cmd_lock); + ele_mu_priv->waiting_rsp_dev = dev_ctx; + } else if (header.tag == ele_mu_priv->rsp_tag) { + /* Check the device context can send the command */ + if (dev_ctx != ele_mu_priv->cmd_receiver_dev) { + devctx_err(dev_ctx, + "Channel not configured to send resp to FW."); + err = -EPERM; + goto exit; + } + } else { + devctx_err(dev_ctx, "The message does not have a valid TAG\n"); + err = -EINVAL; + goto exit; + } + + /* + * Check that the size passed as argument matches the size + * carried in the message. + */ + nb_words = header.size; + if (nb_words << 2 != size) { + devctx_err(dev_ctx, "User buffer too small\n"); + goto exit; + } + + mutex_lock(&ele_mu_priv->mu_lock); + + /* Send message */ + devctx_dbg(dev_ctx, "sending message\n"); + err = mbox_send_message(ele_mu_priv->tx_chan, dev_ctx->temp_cmd); + if (err < 0) { + devctx_err(dev_ctx, "Failed to send message\n"); + goto unlock; + } + + err = nb_words * (u32)sizeof(u32); + +unlock: + mutex_unlock(&ele_mu_priv->mu_lock); + +exit: + up(&dev_ctx->fops_lock); + return err; +} + +/* + * Read a message from the MU. + * Blocking until a message is available. + */ +static ssize_t ele_mu_fops_read(struct file *fp, char __user *buf, + size_t size, loff_t *ppos) +{ + struct ele_mu_device_ctx *dev_ctx + = container_of(fp->private_data, + struct ele_mu_device_ctx, + miscdev); + struct ele_mu_priv *ele_mu_priv = dev_ctx->priv; + u32 data_size = 0, size_to_copy = 0; + struct ele_obuf_desc *b_desc; + int err; + struct mu_hdr header; + + devctx_dbg(dev_ctx, "read to buf %p(%ld), ppos=%lld\n", buf, size, + ((ppos) ? *ppos : 0)); + + if (down_interruptible(&dev_ctx->fops_lock)) + return -EBUSY; + + if (dev_ctx->status != MU_OPENED) { + err = -EINVAL; + goto exit; + } + + /* Wait until the complete message is received on the MU. */ + err = wait_event_interruptible(dev_ctx->wq, dev_ctx->pending_hdr != 0); + if (err) { + devctx_err(dev_ctx, "Err[0x%x]:Interrupted by signal.\n", err); + goto exit; + } + + devctx_dbg(dev_ctx, "%s %s\n", __func__, + "message received, start transmit to user"); + + /* Check that the size passed as argument is larger than + * the one carried in the message. + */ + data_size = dev_ctx->temp_resp_size * sizeof(u32); + size_to_copy = data_size; + if (size_to_copy > size) { + devctx_dbg(dev_ctx, "User buffer too small (%ld < %d)\n", + size, size_to_copy); + size_to_copy = size; + } + + /* We may need to copy the output data to user before + * delivering the completion message. + */ + while (!list_empty(&dev_ctx->pending_out)) { + b_desc = list_first_entry_or_null(&dev_ctx->pending_out, + struct ele_obuf_desc, + link); + if (b_desc->out_usr_ptr && b_desc->out_ptr) { + devctx_dbg(dev_ctx, "Copy output data to user\n"); + err = (int)copy_to_user(b_desc->out_usr_ptr, + b_desc->out_ptr, + b_desc->out_size); + if (err) { + devctx_err(dev_ctx, + "Failure copying output data to user."); + err = -EFAULT; + goto exit; + } + } + __list_del_entry(&b_desc->link); + devm_kfree(dev_ctx->dev, b_desc); + } + + header = *((struct mu_hdr *) (&dev_ctx->temp_resp[0])); + + /* Copy data from the buffer */ + print_hex_dump_debug("to user ", DUMP_PREFIX_OFFSET, 4, 4, + dev_ctx->temp_resp, size_to_copy, false); + err = (int)copy_to_user(buf, dev_ctx->temp_resp, size_to_copy); + if (err) { + devctx_err(dev_ctx, "Failed to copy to user\n"); + err = -EFAULT; + goto exit; + } + + err = size_to_copy; + + /* free memory allocated on the shared buffers. */ + dev_ctx->secure_mem.pos = 0; + dev_ctx->non_secure_mem.pos = 0; + + dev_ctx->pending_hdr = 0; + +exit: + + up(&dev_ctx->fops_lock); + return err; +} + +/* Give access to EdgeLock Enclave, to the memory we want to share */ +static int ele_mu_setup_ele_mem_access(struct ele_mu_device_ctx *dev_ctx, + u64 addr, u32 len) +{ + /* Assuming EdgeLock Enclave has access to all the memory regions */ + int ret = 0; + + if (ret) { + devctx_err(dev_ctx, "Fail find memreg\n"); + goto exit; + } + + if (ret) { + devctx_err(dev_ctx, "Fail set permission for resource\n"); + goto exit; + } + +exit: + return ret; +} + +static int ele_mu_ioctl_get_mu_info(struct ele_mu_device_ctx *dev_ctx, + unsigned long arg) +{ + struct ele_mu_priv *priv = dev_get_drvdata(dev_ctx->dev); + struct ele_mu_ioctl_get_mu_info info; + int err = -EINVAL; + + info.ele_mu_id = (u8)priv->ele_mu_id; + info.interrupt_idx = 0; + info.tz = 0; + info.did = (u8)priv->ele_mu_did; + + devctx_dbg(dev_ctx, + "info [mu_idx: %d, irq_idx: %d, tz: 0x%x, did: 0x%x]\n", + info.ele_mu_id, info.interrupt_idx, info.tz, info.did); + + err = (int)copy_to_user((u8 *)arg, &info, + sizeof(info)); + if (err) { + devctx_err(dev_ctx, "Failed to copy mu info to user\n"); + err = -EFAULT; + goto exit; + } + +exit: + return err; +} + +/* + * Copy a buffer of daa to/from the user and return the address to use in + * messages + */ +static int ele_mu_ioctl_setup_iobuf_handler(struct ele_mu_device_ctx *dev_ctx, + unsigned long arg) +{ + struct ele_obuf_desc *out_buf_desc; + struct ele_mu_ioctl_setup_iobuf io = {0}; + struct ele_shared_mem *shared_mem; + int err = -EINVAL; + u32 pos; + + err = (int)copy_from_user(&io, + (u8 *)arg, + sizeof(io)); + if (err) { + devctx_err(dev_ctx, "Failed copy iobuf config from user\n"); + err = -EFAULT; + goto exit; + } + + devctx_dbg(dev_ctx, "io [buf: %p(%d) flag: %x]\n", + io.user_buf, io.length, io.flags); + + if (io.length == 0 || !io.user_buf) { + /* + * Accept NULL pointers since some buffers are optional + * in FW commands. In this case we should return 0 as + * pointer to be embedded into the message. + * Skip all data copy part of code below. + */ + io.ele_addr = 0; + goto copy; + } + + /* Select the shared memory to be used for this buffer. */ + if (io.flags & ELE_MU_IO_FLAGS_USE_SEC_MEM) { + /* App requires to use secure memory for this buffer.*/ + devctx_err(dev_ctx, "Failed allocate SEC MEM memory\n"); + err = -EFAULT; + goto exit; + } else { + /* No specific requirement for this buffer. */ + shared_mem = &dev_ctx->non_secure_mem; + } + + /* Check there is enough space in the shared memory. */ + if (io.length >= shared_mem->size - shared_mem->pos) { + devctx_err(dev_ctx, "Not enough space in shared memory\n"); + err = -ENOMEM; + goto exit; + } + + /* Allocate space in shared memory. 8 bytes aligned. */ + pos = shared_mem->pos; + shared_mem->pos += round_up(io.length, 8u); + io.ele_addr = (u64)shared_mem->dma_addr + pos; + + if ((io.flags & ELE_MU_IO_FLAGS_USE_SEC_MEM) && + !(io.flags & ELE_MU_IO_FLAGS_USE_SHORT_ADDR)) { + /*Add base address to get full address.*/ + devctx_err(dev_ctx, "Failed allocate SEC MEM memory\n"); + err = -EFAULT; + goto exit; + } + + if (io.flags & ELE_MU_IO_FLAGS_IS_INPUT) { + /* + * buffer is input: + * copy data from user space to this allocated buffer. + */ + err = (int)copy_from_user(shared_mem->ptr + pos, io.user_buf, + io.length); + if (err) { + devctx_err(dev_ctx, + "Failed copy data to shared memory\n"); + err = -EFAULT; + goto exit; + } + /* flush this memory "shared_mem->ptr + pos" + * with size = io.length + */ + } else { + if (io.flags & ELE_MU_IO_FLAGS_IS_IN_OUT) { + err = (int)copy_from_user(shared_mem->ptr + pos, + io.user_buf, + io.length); + if (err) { + devctx_err(dev_ctx, + "Failed copy data to shared-mem.\n"); + err = -EFAULT; + goto exit; + } + } + + /* + * buffer is output: + * add an entry in the "pending buffers" list so data + * can be copied to user space when receiving FW + * response. + */ + out_buf_desc = devm_kmalloc(dev_ctx->dev, + sizeof(*out_buf_desc), + GFP_KERNEL); + + if (!out_buf_desc) { + err = -ENOMEM; + devctx_err(dev_ctx, + "Failed allocating mem for pending buffer\n" + ); + goto exit; + } + + out_buf_desc->out_ptr = shared_mem->ptr + pos; + out_buf_desc->out_usr_ptr = io.user_buf; + out_buf_desc->out_size = io.length; + list_add_tail(&out_buf_desc->link, &dev_ctx->pending_out); + } + +copy: + /* Provide the EdgeLock Enclave address to user space only if success.*/ + err = (int)copy_to_user((u8 *)arg, &io, + sizeof(io)); + if (err) { + devctx_err(dev_ctx, "Failed to copy iobuff setup to user\n"); + err = -EFAULT; + goto exit; + } +exit: + return err; +} + + + +/* Open a char device. */ +static int ele_mu_fops_open(struct inode *nd, struct file *fp) +{ + struct ele_mu_device_ctx *dev_ctx + = container_of(fp->private_data, + struct ele_mu_device_ctx, + miscdev); + int err; + + /* Avoid race if opened at the same time */ + if (down_trylock(&dev_ctx->fops_lock)) + return -EBUSY; + + /* Authorize only 1 instance. */ + if (dev_ctx->status != MU_FREE) { + err = -EBUSY; + goto exit; + } + + /* + * Allocate some memory for data exchanges with S40x. + * This will be used for data not requiring secure memory. + */ + dev_ctx->non_secure_mem.ptr = dmam_alloc_coherent(dev_ctx->dev, + MAX_DATA_SIZE_PER_USER, + &dev_ctx->non_secure_mem.dma_addr, + GFP_KERNEL); + if (!dev_ctx->non_secure_mem.ptr) { + err = -ENOMEM; + devctx_err(dev_ctx, "Failed to map shared memory with S40x\n"); + goto exit; + } + + err = ele_mu_setup_ele_mem_access(dev_ctx, + dev_ctx->non_secure_mem.dma_addr, + MAX_DATA_SIZE_PER_USER); + if (err) { + err = -EPERM; + devctx_err(dev_ctx, + "Failed to share access to shared memory\n"); + goto free_coherent; + } + + dev_ctx->non_secure_mem.size = MAX_DATA_SIZE_PER_USER; + dev_ctx->non_secure_mem.pos = 0; + dev_ctx->status = MU_OPENED; + + dev_ctx->pending_hdr = 0; + + goto exit; + +free_coherent: + dmam_free_coherent(dev_ctx->priv->dev, MAX_DATA_SIZE_PER_USER, + dev_ctx->non_secure_mem.ptr, + dev_ctx->non_secure_mem.dma_addr); + +exit: + up(&dev_ctx->fops_lock); + return err; +} + +/* Close a char device. */ +static int ele_mu_fops_close(struct inode *nd, struct file *fp) +{ + struct ele_mu_device_ctx *dev_ctx = container_of(fp->private_data, + struct ele_mu_device_ctx, miscdev); + struct ele_mu_priv *priv = dev_ctx->priv; + struct ele_obuf_desc *out_buf_desc; + + /* Avoid race if closed at the same time */ + if (down_trylock(&dev_ctx->fops_lock)) + return -EBUSY; + + /* The device context has not been opened */ + if (dev_ctx->status != MU_OPENED) + goto exit; + + /* check if this device was registered as command receiver. */ + if (priv->cmd_receiver_dev == dev_ctx) + priv->cmd_receiver_dev = NULL; + + /* check if this device was registered as waiting response. */ + if (priv->waiting_rsp_dev == dev_ctx) { + priv->waiting_rsp_dev = NULL; + mutex_unlock(&priv->mu_cmd_lock); + } + + /* Unmap secure memory shared buffer. */ + if (dev_ctx->secure_mem.ptr) + devm_iounmap(dev_ctx->dev, dev_ctx->secure_mem.ptr); + + dev_ctx->secure_mem.ptr = NULL; + dev_ctx->secure_mem.dma_addr = 0; + dev_ctx->secure_mem.size = 0; + dev_ctx->secure_mem.pos = 0; + + /* Free non-secure shared buffer. */ + dmam_free_coherent(dev_ctx->priv->dev, MAX_DATA_SIZE_PER_USER, + dev_ctx->non_secure_mem.ptr, + dev_ctx->non_secure_mem.dma_addr); + + dev_ctx->non_secure_mem.ptr = NULL; + dev_ctx->non_secure_mem.dma_addr = 0; + dev_ctx->non_secure_mem.size = 0; + dev_ctx->non_secure_mem.pos = 0; + + while (!list_empty(&dev_ctx->pending_out)) { + out_buf_desc = list_first_entry_or_null(&dev_ctx->pending_out, + struct ele_obuf_desc, + link); + __list_del_entry(&out_buf_desc->link); + devm_kfree(dev_ctx->dev, out_buf_desc); + } + + dev_ctx->status = MU_FREE; + +exit: + up(&dev_ctx->fops_lock); + return 0; +} + +/* IOCTL entry point of a char device */ +static long ele_mu_ioctl(struct file *fp, unsigned int cmd, unsigned long arg) +{ + struct ele_mu_device_ctx *dev_ctx + = container_of(fp->private_data, + struct ele_mu_device_ctx, + miscdev); + struct ele_mu_priv *ele_mu_priv = dev_ctx->priv; + int err = -EINVAL; + + /* Prevent race during change of device context */ + if (down_interruptible(&dev_ctx->fops_lock)) + return -EBUSY; + + switch (cmd) { + case ELE_MU_IOCTL_ENABLE_CMD_RCV: + if (!ele_mu_priv->cmd_receiver_dev) { + ele_mu_priv->cmd_receiver_dev = dev_ctx; + err = 0; + }; + break; + case ELE_MU_IOCTL_GET_MU_INFO: + err = ele_mu_ioctl_get_mu_info(dev_ctx, arg); + break; + case ELE_MU_IOCTL_SHARED_BUF_CFG: + devctx_err(dev_ctx, + "ELE_MU_IOCTL_SHARED_BUF_CFG not supported [0x%x].\n", + err); + break; + case ELE_MU_IOCTL_SETUP_IOBUF: + err = ele_mu_ioctl_setup_iobuf_handler(dev_ctx, arg); + break; + case ELE_MU_IOCTL_SIGNED_MESSAGE: + devctx_err(dev_ctx, + "ELE_MU_IOCTL_SIGNED_MESSAGE not supported [0x%x].\n", + err); + break; + default: + err = -EINVAL; + devctx_dbg(dev_ctx, "IOCTL %.8x not supported\n", cmd); + } + + up(&dev_ctx->fops_lock); + return (long)err; +} + +/* Char driver setup */ +static const struct file_operations ele_mu_fops = { + .open = ele_mu_fops_open, + .owner = THIS_MODULE, + .release = ele_mu_fops_close, + .unlocked_ioctl = ele_mu_ioctl, + .read = ele_mu_fops_read, + .write = ele_mu_fops_write, +}; + +/* interface for managed res to free a mailbox channel */ +static void if_mbox_free_channel(void *mbox_chan) +{ + mbox_free_channel(mbox_chan); +} + +/* interface for managed res to unregister a char device */ +static void if_misc_deregister(void *miscdevice) +{ + misc_deregister(miscdevice); +} + +static int ele_mu_request_channel(struct device *dev, + struct mbox_chan **chan, + struct mbox_client *cl, + const char *name) +{ + struct mbox_chan *t_chan; + int ret = 0; + + t_chan = mbox_request_channel_byname(cl, name); + if (IS_ERR(t_chan)) { + ret = PTR_ERR(t_chan); + if (ret != -EPROBE_DEFER) + dev_err(dev, + "Failed to request chan %s ret %d\n", name, + ret); + goto exit; + } + + ret = devm_add_action(dev, if_mbox_free_channel, t_chan); + if (ret) { + dev_err(dev, "failed to add devm removal of mbox %s\n", name); + goto exit; + } + + *chan = t_chan; + +exit: + return ret; +} + +static int ele_mu_probe(struct platform_device *pdev) +{ + struct ele_mu_device_ctx *dev_ctx; + struct device *dev = &pdev->dev; + struct ele_mu_priv *priv; + struct device_node *np; + const struct of_device_id *of_id = of_match_device(ele_mu_match, dev); + struct imx_info *info = (of_id != NULL) ? (struct imx_info *)of_id->data + : NULL; + int max_nb_users = 0; + char *devname; + int ret; + int i; + + priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + if (!priv) { + ret = -ENOMEM; + dev_err(dev, "Fail allocate mem for private data\n"); + goto exit; + } + priv->dev = dev; + dev_set_drvdata(dev, priv); + + /* + * Get the address of MU to be used for communication with the SCU + */ + np = pdev->dev.of_node; + if (!np) { + dev_err(dev, "Cannot find MU User entry in device tree\n"); + ret = -EOPNOTSUPP; + goto exit; + } + + /* Initialize the mutex. */ + mutex_init(&priv->mu_cmd_lock); + mutex_init(&priv->mu_lock); + + /* TBD */ + priv->cmd_receiver_dev = NULL; + priv->waiting_rsp_dev = NULL; + + ret = of_property_read_u32(np, "fsl,ele_mu_did", &priv->ele_mu_did); + if (ret) { + ret = -EINVAL; + dev_err(dev, "%s: Not able to read ele_mu_did", __func__); + goto exit; + } + + ret = of_property_read_u32(np, "fsl,ele_mu_id", &priv->ele_mu_id); + if (ret) { + ret = -EINVAL; + dev_err(dev, "%s: Not able to read ele_mu_id", __func__); + goto exit; + } + + ret = of_property_read_u32(np, "fsl,ele_mu_max_users", &max_nb_users); + if (ret) { + dev_warn(dev, "%s: Not able to read mu_max_user", __func__); + max_nb_users = S4_MUAP_DEFAULT_MAX_USERS; + } + + ret = of_property_read_u8(np, "fsl,cmd_tag", &priv->cmd_tag); + if (ret) { + dev_warn(dev, "%s: Not able to read cmd_tag", __func__); + priv->cmd_tag = DEFAULT_MESSAGING_TAG_COMMAND; + } + + ret = of_property_read_u8(np, "fsl,rsp_tag", &priv->rsp_tag); + if (ret) { + dev_warn(dev, "%s: Not able to read rsp_tag", __func__); + priv->rsp_tag = DEFAULT_MESSAGING_TAG_RESPONSE; + } + + /* Mailbox client configuration */ + priv->ele_mb_cl.dev = dev; + priv->ele_mb_cl.tx_block = false; + priv->ele_mb_cl.knows_txdone = true; + priv->ele_mb_cl.rx_callback = ele_mu_rx_callback; + + ret = ele_mu_request_channel(dev, &priv->tx_chan, + &priv->ele_mb_cl, "tx"); + if (ret) { + if (ret != -EPROBE_DEFER) + dev_err(dev, "Failed to request tx channel\n"); + + goto exit; + } + + ret = ele_mu_request_channel(dev, &priv->rx_chan, + &priv->ele_mb_cl, "rx"); + if (ret) { + if (ret != -EPROBE_DEFER) + dev_err(dev, "Failed to request rx channel\n"); + + goto exit; + } + + priv->max_dev_ctx = max_nb_users; + priv->ctxs = devm_kzalloc(dev, sizeof(dev_ctx) * max_nb_users, + GFP_KERNEL); + + /* Create users */ + for (i = 0; i < max_nb_users; i++) { + dev_ctx = devm_kzalloc(dev, sizeof(*dev_ctx), GFP_KERNEL); + if (!dev_ctx) { + ret = -ENOMEM; + dev_err(dev, + "Fail to allocate memory for device context\n"); + goto exit; + } + + dev_ctx->dev = dev; + dev_ctx->status = MU_FREE; + dev_ctx->priv = priv; + + priv->ctxs[i] = dev_ctx; + + /* Default value invalid for an header. */ + init_waitqueue_head(&dev_ctx->wq); + + INIT_LIST_HEAD(&dev_ctx->pending_out); + sema_init(&dev_ctx->fops_lock, 1); + + devname = devm_kasprintf(dev, GFP_KERNEL, "ele_mu%d_ch%d", + priv->ele_mu_id, i); + if (!devname) { + ret = -ENOMEM; + dev_err(dev, + "Fail to allocate memory for misc dev name\n"); + goto exit; + } + + dev_ctx->miscdev.name = devname; + dev_ctx->miscdev.minor = MISC_DYNAMIC_MINOR; + dev_ctx->miscdev.fops = &ele_mu_fops; + dev_ctx->miscdev.parent = dev; + ret = misc_register(&dev_ctx->miscdev); + if (ret) { + dev_err(dev, "failed to register misc device %d\n", + ret); + goto exit; + } + + ret = devm_add_action(dev, if_misc_deregister, + &dev_ctx->miscdev); + if (ret) { + dev_err(dev, + "failed[%d] to add action to the misc-dev\n", + ret); + goto exit; + } + } + + init_completion(&priv->done); + spin_lock_init(&priv->lock); + + ele_priv_export = priv; + + if (info && info->reserved_dma_ranges) { + ret = of_reserved_mem_device_init(dev); + if (ret) { + dev_err(dev, + "failed to init reserved memory region %d\n", + ret); + priv->flags &= (~RESERVED_DMA_POOL); + goto exit; + } + priv->flags |= RESERVED_DMA_POOL; + } + + if (info && info->socdev) { + ret = imx_soc_device_register(pdev); + if (ret) { + dev_err(dev, + "failed[%d] to register SoC device\n", ret); + goto exit; + } + + /* allocate buffer where ELE store encrypted IMEM */ + priv->imem.buf = dmam_alloc_coherent(dev, ELE_IMEM_SIZE, + &priv->imem.phyaddr, + GFP_KERNEL); + if (!priv->imem.buf) { + dev_err(dev, + "Failed dmam-alloc to store encrypted IMEM.\n"); + ret = -ENOMEM; + goto exit; + } + } + + /* start ele rng */ + ret = ele_do_start_rng(); + if (ret) + dev_err(dev, "Failed to start ele rng\n"); + + if (!ret && info && info->enable_ele_trng) { + ret = ele_trng_init(dev); + if (ret) + dev_err(dev, "Failed to init ele-trng\n"); + } + + /* + * A ELE ping request must be send at least once every day(24 hours), + * so setup a delay work with 1 hour interval + * to ping ELE periodically. + */ + schedule_delayed_work(&ele_ping_work, ELE_PING_INTERVAL); + + dev_set_drvdata(dev, priv); + return devm_of_platform_populate(dev); + +exit: + /* if execution control reaches here, ele-mu probe fail. + * hence doing the cleanup + */ + if (priv->flags & RESERVED_DMA_POOL) { + of_reserved_mem_device_release(dev); + priv->flags &= (~RESERVED_DMA_POOL); + } + return ret; +} + +static int ele_mu_remove(struct platform_device *pdev) +{ + struct ele_mu_priv *priv; + + cancel_delayed_work_sync(&ele_ping_work); + priv = dev_get_drvdata(&pdev->dev); + mbox_free_channel(priv->tx_chan); + mbox_free_channel(priv->rx_chan); + + /* free the buffer in ele-mu remove, previously allocated + * in ele-mu probe to store encrypted IMEM + */ + if (priv->imem.buf) { + dmam_free_coherent(&pdev->dev, + ELE_IMEM_SIZE, + priv->imem.buf, + priv->imem.phyaddr); + priv->imem.buf = NULL; + } + + if (priv->flags & RESERVED_DMA_POOL) { + of_reserved_mem_device_release(&pdev->dev); + priv->flags &= (~RESERVED_DMA_POOL); + } + + return 0; +} + +#ifdef CONFIG_PM_SLEEP +static int ele_mu_suspend(struct device *dev) +{ + struct ele_mu_priv *priv = dev_get_drvdata(dev); + const struct of_device_id *of_id = of_match_device(ele_mu_match, dev); + struct imx_info *info = (of_id != NULL) ? (struct imx_info *)of_id->data + : NULL; + + if (info && info->socdev) { + int ret; + + /* EXPORT command will save encrypted IMEM to given address, + * so later in resume, IMEM can be restored from the given + * address. + * + * Size must be at least 64 kB. + */ + ret = ele_service_swap(priv->imem.phyaddr, + ELE_IMEM_SIZE, + ELE_IMEM_EXPORT); + if (ret < 0) + dev_err(dev, "Failed to export IMEM\n"); + else { + priv->imem.size = ret; + dev_info(dev, + "Exported %d bytes of encrypted IMEM\n", + ret); + } + } + + return 0; +} + +static int ele_mu_resume(struct device *dev) +{ + struct ele_mu_priv *priv = dev_get_drvdata(dev); + int i; + const struct of_device_id *of_id = of_match_device(ele_mu_match, dev); + struct imx_info *info = (of_id != NULL) ? (struct imx_info *)of_id->data + : NULL; + + for (i = 0; i < priv->max_dev_ctx; i++) + wake_up_interruptible(&priv->ctxs[i]->wq); + + if (info && info->socdev) { + struct gen_pool *sram_pool; + u32 *get_info_buf; + phys_addr_t get_info_phyaddr; + u32 imem_state; + int ret; + + ret = ele_do_start_rng(); + if (ret) + return ret; + + /* allocate buffer to get info from ELE */ + sram_pool = of_gen_pool_get(dev->of_node, "sram-pool", 0); + if (!sram_pool) { + dev_err(dev, "Unable to get sram pool\n"); + return -EINVAL; + } + + get_info_buf = (u32 *)gen_pool_alloc(sram_pool, + ELE_GET_INFO_BUFF_SZ); + if (!get_info_buf) { + dev_err(dev, "Unable to alloc sram from sram pool\n"); + return -ENOMEM; + } + get_info_phyaddr = gen_pool_virt_to_phys(sram_pool, + (ulong)get_info_buf); + + /* get info from ELE */ + ret = ele_get_info(get_info_phyaddr, ELE_GET_INFO_READ_SZ); + if (ret) { + dev_err(dev, "Failed to get info from ELE.\n"); + goto exit; + } + + /* Get IMEM state, if 0xFE then import IMEM */ + imem_state = (get_info_buf[ELE_IMEM_STATE_WORD] + & ELE_IMEM_STATE_MASK) >> 16; + if (imem_state == ELE_IMEM_STATE_BAD) { + /* IMPORT command will restore IMEM from the given + * address, here size is the actual size returned by ELE + * during the export operation + */ + ret = ele_service_swap(priv->imem.phyaddr, + priv->imem.size, + ELE_IMEM_IMPORT); + if (ret) { + dev_err(dev, "Failed to import IMEM\n"); + goto exit; + } + } else + goto exit; + + /* After importing IMEM, check if IMEM state is equal to 0xCA + * to ensure IMEM is fully loaded and + * ELE functionality can be used. + */ + ret = ele_get_info(get_info_phyaddr, ELE_GET_INFO_READ_SZ); + if (ret) { + dev_err(dev, "Failed to get info from ELE.\n"); + goto exit; + } + + imem_state = (get_info_buf[ELE_IMEM_STATE_WORD] + & ELE_IMEM_STATE_MASK) >> 16; + if (imem_state == ELE_IMEM_STATE_OK) + dev_info(dev, "Successfully restored IMEM\n"); + else + dev_err(dev, "Failed to restore IMEM\n"); + +exit: + gen_pool_free(sram_pool, (ulong)get_info_buf, ELE_GET_INFO_BUFF_SZ); + } + + return 0; +} +#endif + +static const struct dev_pm_ops ele_mu_pm = { + SET_SYSTEM_SLEEP_PM_OPS(ele_mu_suspend, ele_mu_resume) +}; + +static struct platform_driver ele_mu_driver = { + .driver = { + .name = "fsl-ele-mu", + .of_match_table = ele_mu_match, + .pm = &ele_mu_pm, + }, + .probe = ele_mu_probe, + .remove = ele_mu_remove, +}; +MODULE_DEVICE_TABLE(of, ele_mu_match); + +module_platform_driver(ele_mu_driver); + +MODULE_AUTHOR("Pankaj Gupta "); +MODULE_DESCRIPTION("iMX Secure Enclave MU Driver."); +MODULE_LICENSE("GPL v2"); diff --git a/drivers/firmware/imx/ele_mu.h b/drivers/firmware/imx/ele_mu.h new file mode 100644 index 000000000000..371a3c635f50 --- /dev/null +++ b/drivers/firmware/imx/ele_mu.h @@ -0,0 +1,174 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* + * Copyright 2021-2022 NXP + */ + +#ifndef ELE_MU_H +#define ELE_MU_H + +#include +#include +#include + +/* macro to log operation of a misc device */ +#define miscdev_dbg(p_miscdev, fmt, va_args...) \ + ({ \ + struct miscdevice *_p_miscdev = p_miscdev; \ + dev_dbg((_p_miscdev)->parent, "%s: " fmt, (_p_miscdev)->name, \ + ##va_args); \ + }) + +#define miscdev_info(p_miscdev, fmt, va_args...) \ + ({ \ + struct miscdevice *_p_miscdev = p_miscdev; \ + dev_info((_p_miscdev)->parent, "%s: " fmt, (_p_miscdev)->name, \ + ##va_args); \ + }) + +#define miscdev_err(p_miscdev, fmt, va_args...) \ + ({ \ + struct miscdevice *_p_miscdev = p_miscdev; \ + dev_err((_p_miscdev)->parent, "%s: " fmt, (_p_miscdev)->name, \ + ##va_args); \ + }) +/* macro to log operation of a device context */ +#define devctx_dbg(p_devctx, fmt, va_args...) \ + miscdev_dbg(&((p_devctx)->miscdev), fmt, ##va_args) +#define devctx_info(p_devctx, fmt, va_args...) \ + miscdev_info(&((p_devctx)->miscdev), fmt, ##va_args) +#define devctx_err(p_devctx, fmt, va_args...) \ + miscdev_err((&(p_devctx)->miscdev), fmt, ##va_args) + +#define MSG_TAG(x) (((x) & 0xff000000) >> 24) +#define MSG_COMMAND(x) (((x) & 0x00ff0000) >> 16) +#define MSG_SIZE(x) (((x) & 0x0000ff00) >> 8) +#define MSG_VER(x) ((x) & 0x000000ff) +#define RES_STATUS(x) ((x) & 0x000000ff) +#define MAX_DATA_SIZE_PER_USER (65 * 1024) +#define S4_DEFAULT_MUAP_INDEX (2) +#define S4_MUAP_DEFAULT_MAX_USERS (4) + +#define DEFAULT_MESSAGING_TAG_COMMAND (0x17u) +#define DEFAULT_MESSAGING_TAG_RESPONSE (0xe1u) + +//#define ELE_MU_IO_FLAGS_IS_INPUT (0x01u) +//#define ELE_MU_IO_FLAGS_IS_OUTPUT (0x02u) +//#define ELE_MU_IO_FLAGS_IS_IN_OUT (0x08u) + +#define ELE_MU_IO_FLAGS_USE_SEC_MEM (0x02u) +#define ELE_MU_IO_FLAGS_USE_SHORT_ADDR (0x04u) + +struct ele_imem_buf { + u8 *buf; + phys_addr_t phyaddr; + u32 size; +}; + +struct ele_obuf_desc { + u8 *out_ptr; + u8 *out_usr_ptr; + u32 out_size; + struct list_head link; +}; + +/* Status of a char device */ +enum mu_device_status_t { + MU_FREE, + MU_OPENED +}; + +struct ele_shared_mem { + dma_addr_t dma_addr; + u32 size; + u32 pos; + u8 *ptr; +}; + +/* Private struct for each char device instance. */ +struct ele_mu_device_ctx { + struct device *dev; + struct ele_mu_priv *priv; + struct miscdevice miscdev; + + enum mu_device_status_t status; + wait_queue_head_t wq; + struct semaphore fops_lock; + + u32 pending_hdr; + struct list_head pending_out; + + struct ele_shared_mem secure_mem; + struct ele_shared_mem non_secure_mem; + + u32 temp_cmd[MAX_MESSAGE_SIZE]; + u32 temp_resp[MAX_RECV_SIZE]; + u32 temp_resp_size; + struct notifier_block ele_notify; +}; + +/* Header of the messages exchange with the EdgeLock Enclave */ +struct mu_hdr { + u8 ver; + u8 size; + u8 command; + u8 tag; +} __packed; + +#define ELE_MU_HDR_SZ 4 +#define TAG_OFFSET (ELE_MU_HDR_SZ - 1) +#define CMD_OFFSET (ELE_MU_HDR_SZ - 2) +#define SZ_OFFSET (ELE_MU_HDR_SZ - 3) +#define VER_OFFSET (ELE_MU_HDR_SZ - 4) + +struct ele_api_msg { + u32 header; /* u8 Tag; u8 Command; u8 Size; u8 Ver; */ + u32 data[ELE_MSG_DATA_NUM]; +}; + +struct ele_mu_priv { + struct ele_mu_device_ctx *cmd_receiver_dev; + struct ele_mu_device_ctx *waiting_rsp_dev; + /* + * prevent parallel access to the MU registers + * e.g. a user trying to send a command while the other one is + * sending a response. + */ + struct mutex mu_lock; + /* + * prevent a command to be sent on the MU while another one is still + * processing. (response to a command is allowed) + */ + struct mutex mu_cmd_lock; + struct device *dev; + u32 ele_mu_did; + u32 ele_mu_id; + u8 cmd_tag; + u8 rsp_tag; + + struct mbox_client ele_mb_cl; + struct mbox_chan *tx_chan, *rx_chan; + struct ele_api_msg tx_msg, rx_msg; + struct completion done; + spinlock_t lock; + /* Flag to retain the state of initialization done at + * the time of ele-mu probe. + */ + int flags; + int max_dev_ctx; + struct ele_mu_device_ctx **ctxs; + struct ele_imem_buf imem; +}; + +int get_ele_mu_priv(struct ele_mu_priv **export); + +int imx_ele_msg_send_rcv(struct ele_mu_priv *priv); +#ifdef CONFIG_IMX_ELE_TRNG +int ele_trng_init(struct device *dev); +#else +static inline int ele_trng_init(struct device *dev) +{ + return 0; +} +#endif + +#endif diff --git a/include/linux/firmware/imx/ele_base_msg.h b/include/linux/firmware/imx/ele_base_msg.h new file mode 100644 index 000000000000..04a8797b5468 --- /dev/null +++ b/include/linux/firmware/imx/ele_base_msg.h @@ -0,0 +1,66 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* + * Copyright 2021 NXP + * + * Header file for the ELE Base API(s). + */ + +#ifndef ELE_BASE_MSG_H +#define ELE_BASE_MSG_H + +#include + +#define MAX_RECV_SIZE 31 +#define MAX_RECV_SIZE_BYTES (MAX_RECV_SIZE * sizeof(u32)) +#define MAX_MESSAGE_SIZE 31 +#define MAX_MESSAGE_SIZE_BYTES (MAX_MESSAGE_SIZE * sizeof(u32)) + +#define MESSAGING_VERSION_7 0x7 +#define ELE_NONE_VAL 0x0 + +#define ELE_PING_REQ 0x1 +#define ELE_PING_REQ_MSG_SZ 0x02 + +#define ELE_OEM_CNTN_AUTH_REQ 0x87 +#define ELE_VERIFY_IMAGE_REQ 0x88 +#define ELE_RELEASE_CONTAINER_REQ 0x89 + +#define ELE_READ_FUSE_REQ 0x97 +#define ELE_READ_FUSE_RSP_MSG_SZ 0x07 +#define ELE_READ_FUSE_REQ_MSG_SZ 0x03 + +#define OTP_UNIQ_ID 0x01 +#define OTFAD_CONFIG 0x2 + +#define ELE_GET_INFO_REQ 0xDA +#define ELE_GET_INFO_REQ_MSG_SZ 0x02 + +#define ELE_SERVICE_SWAP_REQ 0xDF +#define ELE_SERVICE_SWAP_REQ_MSG_SZ 0x03 + +#define ELE_START_RNG_REQ 0xA3 +#define ELE_START_RNG_REQ_MSG_SZ 0x02 + +#define ELE_GET_TRNG_STATE_REQ 0xA4 +#define ELE_GET_TRNG_STATE_REQ_MSG_SZ 0x03 + +#define ELE_GET_RANDOM_REQ 0xCD +#define CSAL_TRNG_STATE_MASK 0x0000ffff + +#define ELE_BASE_API_VERSION 0x6 +#define ELE_SUCCESS_IND 0xD6 +#define ELE_FAILURE_IND 0x29 + +#define ELE_MSG_DATA_NUM 10 + +#define ELE_IMEM_EXPORT 0x1 +#define ELE_IMEM_IMPORT 0x2 + +int read_common_fuse(uint16_t fuse_index, u32 *value); +int ele_ping(void); +int ele_get_info(phys_addr_t addr, u32 data_size); +int ele_service_swap(phys_addr_t addr, u32 addr_size, u16 flag); +int ele_start_rng(void); +int ele_get_trng_state(void); + +#endif diff --git a/include/linux/firmware/imx/ele_mu_ioctl.h b/include/linux/firmware/imx/ele_mu_ioctl.h new file mode 100644 index 000000000000..3ad93ded23ed --- /dev/null +++ b/include/linux/firmware/imx/ele_mu_ioctl.h @@ -0,0 +1,52 @@ +/* SPDX-License-Identifier: (GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause*/ +/* + * Copyright 2019-2022 NXP + */ + +#ifndef ELE_MU_IOCTL_H +#define ELE_MU_IOCTL_H + +/* IOCTL definitions. */ + +struct ele_mu_ioctl_setup_iobuf { + u8 *user_buf; + u32 length; + u32 flags; + u64 ele_addr; +}; + +struct ele_mu_ioctl_shared_mem_cfg { + u32 base_offset; + u32 size; +}; + +struct ele_mu_ioctl_get_mu_info { + u8 ele_mu_id; + u8 interrupt_idx; + u8 tz; + u8 did; +}; + +struct ele_mu_ioctl_signed_message { + u8 *message; + u32 msg_size; + u32 error_code; +}; + +#define ELE_MU_IO_FLAGS_IS_OUTPUT (0x00u) +#define ELE_MU_IO_FLAGS_IS_INPUT (0x01u) +#define ELE_MU_IO_FLAGS_USE_SEC_MEM (0x02u) +#define ELE_MU_IO_FLAGS_USE_SHORT_ADDR (0x04u) +#define ELE_MU_IO_FLAGS_IS_IN_OUT (0x08u) + +#define ELE_MU_IOCTL 0x0A /* like MISC_MAJOR. */ +#define ELE_MU_IOCTL_ENABLE_CMD_RCV _IO(ELE_MU_IOCTL, 0x01) +#define ELE_MU_IOCTL_SHARED_BUF_CFG _IOW(ELE_MU_IOCTL, 0x02, \ + struct ele_mu_ioctl_shared_mem_cfg) +#define ELE_MU_IOCTL_SETUP_IOBUF _IOWR(ELE_MU_IOCTL, 0x03, \ + struct ele_mu_ioctl_setup_iobuf) +#define ELE_MU_IOCTL_GET_MU_INFO _IOR(ELE_MU_IOCTL, 0x04, \ + struct ele_mu_ioctl_get_mu_info) +#define ELE_MU_IOCTL_SIGNED_MESSAGE _IOWR(ELE_MU_IOCTL, 0x05, \ + struct ele_mu_ioctl_signed_message) +#endif From patchwork Tue Apr 11 16:25:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pankaj Gupta X-Patchwork-Id: 13207743 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E44FFC77B70 for ; Tue, 11 Apr 2023 15:13:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=bF0ZViE+3Mkm99Tq8sSKx2JTxfx5wkTDH7Qgk3dKy1M=; b=KqgC5Qyd2u4jWp iKkc9donuxb6c4/aG4hp+GjkyXm9tV9Z9fBE8olkz9uK1Ci4sNd9VyNDAIjEP2THzMDhhxdMNXAi/ gVwf8x1fWS3NKLbOnL4cXNv9UYT6p4aPM2jaSfAntoIcc3Bz+lITOYCy6etM+5ROm2p94oS15E6uw 9/aBo/IHIH+ujRf5pcVpQHxs7X7oT+g/3IazcSoDZdIWW0IPB8D1aUni2laeGddgMz259fomIq6rf SWIk0pGbRGM5WBYlbzg0MwW2wVrOraX4Z1gadYfLWlAInwzlHHRozjYSlyPh0TjzP6+Npey1roiMH 6YeO60WKSBu0PABGSRSw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1pmFfP-000NQ2-0A; Tue, 11 Apr 2023 15:12:19 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1pmFfM-000NOL-1w for linux-arm-kernel@bombadil.infradead.org; Tue, 11 Apr 2023 15:12:16 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=MIME-Version:Content-Type:References: In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=3RP26lmURKsBYKhqFNc6Q1bFIVIbw6p56LyuWvgy/TA=; b=hgR1Bbn+JH/In41+NQgIGvrsdu sZBzRzX8Hlyy9DqrefA2hNbAD9G7bijtFjqMj2ePk/owI2OFVrklBkadxCf+eTDGlzQbLY0KxRyCt oy6eoyDla2uNheMIvr0rPuG0MMrfRXpBuQ4eaTP1ZMGFLRrRQ0Yll5am0MiKR1IBQsxh1YsylG3v1 eAZbr+x+ZeTbXsIdhxnbrsOqXRDX/Sn0iyCjkP1k8Tl7nOmS6uGD3pLbVGbQ3HXJ0+imL+2r0YLvc FDHTqc2jVyr0tsm9VNYjq/wgvpAHuXxTl0ClCvdzGs0PI0FNYikn6vzbNbvyif5lSSpHlJ94a2Bgf pnMW124g==; Received: from mail-db8eur05on2060d.outbound.protection.outlook.com ([2a01:111:f400:7e1a::60d] helo=EUR05-DB8-obe.outbound.protection.outlook.com) by desiato.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1pmFfH-00DNTw-2T for linux-arm-kernel@lists.infradead.org; Tue, 11 Apr 2023 15:12:14 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=f8NBx+8bQJNgiV7k9ttOTG0WifbVtTmshTxwgO/BqgMprX2LkMI/zUxIvaIfCU+lsngNfv9LWhMabyyxRRB9oVM+AKd8POfFJ/wuqAqexNawGeJX6AkuJpnyUbr6eESOx+nTiW2lY1PH0YBEVxxu+tFQQFRLjsV9jFHiDYYQJwisHLnpiWQ0k5BoDqdIhASfMsBBBJxh+3kqbmrZl2xq23FVRMMTynYq5Fd53AMOsEbpGdgXtg4SYyZyh+ATmx37h4i/TkzGD5GdSDGGYRdf5R7FFeyZsFYdg05xXva6eJZTluqN7XOJgNJyG5YtRW433PE0wvPrtFreD5cErdfG7A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=3RP26lmURKsBYKhqFNc6Q1bFIVIbw6p56LyuWvgy/TA=; b=m4taz4hJycVGAeaEKvIjPGG/SF9P/C0sQFV9HNLsLtYtA+BLlZ6XvV9IdULG8ccbjhTh08C6TH258myrIWRlVfHCBTmg0VUdSRKbutOc6h6HDpqg+mbepqbqk3RVGxhloce2aE5XFNC4fu2/8tEJGHkknqRP1pkkrQdsp5YKFLVTDrlEZuxavratxpSg/5sv9eB3aHi/b8dIe9iTuePnLI6p2PEoJ0417Dvwt4sFDnULeDMWlm1PrewWxrBgW1M5zLV+oFF2E3sXvxepOS3o2FU3316XVU9AB5jO1cC3E6IXICplWFxPyO25jxNx9anq7R1FQvvvBFoaxUOeRcwQ/g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=3RP26lmURKsBYKhqFNc6Q1bFIVIbw6p56LyuWvgy/TA=; b=EtAU3kFcpqNu24c2Ite7L4LcT6r0zX073O8hhysKXNXqB1WNZM7ZYnY82kYWH88pXJ4UaSrRxn35V9frSXEDKGiC5a2D2rgihqXQNv7q+YOtzlwYnNzGvQe9QxK1SJtFej76E2yXL/wPH6lk0N2QL+94nnT1x+UmAdMMP2/ZASA= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from DU2PR04MB8630.eurprd04.prod.outlook.com (2603:10a6:10:2dd::15) by PAXPR04MB8669.eurprd04.prod.outlook.com (2603:10a6:102:21c::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6277.38; Tue, 11 Apr 2023 15:12:04 +0000 Received: from DU2PR04MB8630.eurprd04.prod.outlook.com ([fe80::bb08:83bc:69ce:21ed]) by DU2PR04MB8630.eurprd04.prod.outlook.com ([fe80::bb08:83bc:69ce:21ed%8]) with mapi id 15.20.6277.038; Tue, 11 Apr 2023 15:12:04 +0000 From: Pankaj Gupta To: shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, gaurav.jain@nxp.com, sahil.malhotra@nxp.com, aisheng.dong@nxp.com, V.Sethi@nxp.com Cc: Pankaj Gupta Subject: [NXP ELE-MUAP 7/7] MAINTAINERS: Added maintainer details Date: Tue, 11 Apr 2023 21:55:36 +0530 Message-Id: <20230411162536.30604-8-pankaj.gupta@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230411162536.30604-1-pankaj.gupta@nxp.com> References: <20230411162536.30604-1-pankaj.gupta@nxp.com> X-ClientProxiedBy: SI2P153CA0035.APCP153.PROD.OUTLOOK.COM (2603:1096:4:190::14) To AM9PR04MB8636.eurprd04.prod.outlook.com (2603:10a6:20b:43f::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DU2PR04MB8630:EE_|PAXPR04MB8669:EE_ X-MS-Office365-Filtering-Correlation-Id: 89d5f5b8-063a-4504-8697-08db3a9f1baf X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: NR607SdXhwq93mTksbA3wTUsdjNCeDZaLz5WSERVhSH9dg3dIsOlA5jWlbB3An6co4fsf0rl0dVMN7W2q6kisdFmXvpZMNLAmG9paVAaGNcl8CWe1sDmFr6FAOmHap8Hv1s6lGA+MqnS/C+avonalgphYCkpQRTkymOzQwmZB+iaa4W/ZOt+wOLXmCo6aKe0O5Xr10ynZOVcXkSEDO7hE4AJgW7Z58BdSh+hLkQmM+pbG/GJUa5Lo9YKMLEF/FElzpxsrpDihaUoX7sV+Sj6Vd2QtXShC4BKSM2dza/sG2wFK6HQ/7T9SmxmPGkZrXfwZifXbrTet5dCTkvkcy0jaQI1JG8ilUkslHHQ2TJLtPc1HzlBpymE5wJ5iLfONLh7IAY6NzDwih8DIELIml1FMOChLC99Qp8WllaFSKYer1C13PkSbfEHV9OTjf7RbP0C1IEwd320JHhCgq8mlw+jtre/Q91nLHB4WE9bEV6XlnfyaY/osmJdLvigo5lAccGALk2FOvPUArw/9lPf1R5tD8qEwzSZD0wVVzQo9xuCi63GClF7CZPm44nT1mWEkgAQmxVhlqL4TFkaurFqikkcPPtasvMxX8UUB0xC0f1Y2sL3fN75EihX5aFmNTTO/4ZwvcuWL9TnQNGypTZPURZPag== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DU2PR04MB8630.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(136003)(39860400002)(376002)(346002)(366004)(396003)(451199021)(44832011)(36756003)(4744005)(2906002)(8676002)(8936002)(38350700002)(38100700002)(5660300002)(86362001)(478600001)(52116002)(6486002)(66556008)(2616005)(6666004)(6636002)(316002)(186003)(6512007)(6506007)(1076003)(66476007)(26005)(66946007)(921005)(41300700001)(83380400001)(4326008);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: cINFdRYKtNuF7jDTO+aLU7ZlyuGrISP5Uh6GKFBRhCIKDIWmesg+kwuag84AnFypnPboTm47h18okOT6rHYc/HkU6tCceku0Fpp6ahiOo5AAv/LTPKJDuV4J+YOk8JHvmvrgFUD9zlGzqkfridd/CsNboNrxyiIOYCGGFC7Hs9HxUo9n+tveJDoUlWXyhAc0LzYHUvmIMUuRc5TZY8ysfiIZtYFO9mbm9t1XIFJd/dAGpvMON30dRsPSZJOOA0oTo+IsHXkGpCr6PKw5Oba8CjMSF/UTORs2/ekLpghwTgplIR3x50aYED1G3BFLRyRwXzi1U/8y65bRfRgG3y13Newb/uNpYawJWhwy4nv3eJERpEdA0ExG8wAI0PlTSwnLbhPWtHEGEniRG353A+e9rA5ZlX+PBoVMjt69W85Ofy9OPVTKY6AKSS+pi7HMV72R9W/Oaw7AW37sczY6VOVUl8ALLEURiKjmNknhOKbOEL93w8zvg+gssOkKLIRpd/2EU8aAkEO388lF5SfdFiNSNeaxSq+itiZGYOUwZeBKCFJe5D2dcWCyLVznxjD0RIgopFl8K0kp8aBeUhMpqI5XzoewkXhBYFYviQuFErqeA0mObnmTz39+mGIkiqp4bD58EMAD61QXjv+D/gadZ5IP5HutGNQIccN0mOgvoPTYT0PHiol4U0cs1kqh0oCf/omqU6IHJj7qlQfzMLdj59GOc9DDs9f2Z6ikgEspL63Vgni6YXqLvgGVn9V5Xk7e9LQMriKxYGRNbQ7ylafVuHJWR030XyhwdXycIoZ6sQ9pBFYPbXfeoO3cKlIxhsryD2a+oHVfscPShRZElO97h8rnCQeK20E2YQ7Ieq36HCJ2ggviegf1eSDAMfF1Z6hx0Zk3H3a5k0ObEE6g9nztQ0VLqfqv8BRp2/0lYRUj1ImLYbSmHbnC+k3wl93vGXkfw7I4hWxsGg0dY4R6Pv1oxCSTj3wNSnoWKRK8pvakPG7t1CWK9kz5zX1d2SvWuZZfTI6as7Hhr31++DxvnAFPTdcuHJX+FmEYB7/XbQSrJexXQtcYfgEZcjsV8SxKi28pHZwAe380ApukGlmgXnPQJsdAueSfbMCMI0o7DEGYjp/5hYvpGhuu03TOJ+yIxPln4bEM3+eMiE2pXh5efbES1AJYL2Y52Ia78vtf9hTVjV+sUc7ylhsfPbbQn6TKIj4q6dsYuCcZY+a+HO3fRudkOoBLd2GwHBmgiKLZPavpWE3cNSwK+uHlUOq28KLARj0J4eBi79eQxubSWG0MTdjj54dUAPgUemlLYPhA1Hu3azFPT4aXEO6s2M7eMM0nOTfN7M2RH9pJ7fhHc0wEbOwCJDOT/RZHH8ACePGScs1Tquq86kQmQS+nbEm/++VY/gb3YL8boHkYj/3JQKWkE8wHAKCifktgyW2S1COLQUH9cqItWJOOEjLBpS0BiWZO84qogf27Kk8uSD4hTKXV8K+OUr6B3Yfn/1fCbq80tHCbDbPPQWt2C0zp0dVmHgyAbz17PJssZ2aySnpZ2c9CUJMZ1w/DMwO9PB42MTzVLqC+hmeDsPotmPrItyIzip/KMH4KCTYx X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 89d5f5b8-063a-4504-8697-08db3a9f1baf X-MS-Exchange-CrossTenant-AuthSource: AM9PR04MB8636.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Apr 2023 15:12:04.6396 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: xb8VM7SLexHhRHXapjfYKZBMIgfv6DC0WmTTDdF5ZtUqCH2Ke2ZP48IU6vsVEFaiYwaWQL6veyVUlwTl3lvplw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR04MB8669 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230411_161212_070330_F8142D8A X-CRM114-Status: UNSURE ( 8.24 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org MAINTAINERS: Added maintainer details for ele-mu driver. Signed-off-by: Pankaj Gupta --- MAINTAINERS | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index d8ebab595b2a..74e3dbaf9d63 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -8103,6 +8103,13 @@ S: Maintained F: Documentation/devicetree/bindings/crypto/fsl-sec4.txt F: drivers/crypto/caam/ +NXP Edgelock Enclave MU DRIVER +M: Pankaj Gupta +L: linux-kernel@vger.kernel.org +S: Maintained +F: Documentation/devicetree/bindings/arm/freescale/fsl,ele_mu.yaml +F: drivers/firmware/imx/ + FREESCALE COLDFIRE M5441X MMC DRIVER M: Angelo Dureghello L: linux-mmc@vger.kernel.org