From patchwork Fri Nov 17 17:42:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tanmay Shah X-Patchwork-Id: 13459201 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 C4FE3C072A2 for ; Fri, 17 Nov 2023 17:43:34 +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=+6bvJ9KlITen21glGpkBVdugld4FPK17ZgFTvf6uvyU=; b=1wMfWiwZLDmKJI Apy/cYPk1ULTBgMmA8tFprOCqiC8fnPyNOhREnjNwSUXNJQ/WRN+K8KTMl9jruMbdqVFFwDANAhUe /9nfG7zFiBUkbcFr8lZEg0bD/ZYZlT1+SBca5BxTtdh7mc/6ljIWjI911rFRiaXAbyuxjaVv03trL mP3u/rnnjb5Uor7arV273+h3iExuqVRLFEYhLBBooLJiGzwU8Wu+z9HXMo9Rge47gKiZA3xzUyV1/ nyycvewdAZPBHHBU/AVcHkD+c9h5DDyWK2VjFJ7tUx8A5zesvcUkXyX/G1JTAp5+sgBCo/+hEyZ48 Bo+INTopD7Y0Gruj88LA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1r42ry-0072eA-15; Fri, 17 Nov 2023 17:43:06 +0000 Received: from mail-dm6nam12on20611.outbound.protection.outlook.com ([2a01:111:f400:fe59::611] helo=NAM12-DM6-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1r42rn-0072Zh-2Y for linux-arm-kernel@lists.infradead.org; Fri, 17 Nov 2023 17:42:58 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mbKJQH6kMohPNFfTepyDfOuztsWgD32y3d11YXaN+3XIk4D2Imw8XZ97Mi5z5kpZYhm3Ar3ZWdV2ww/gyPUuM+hzxRYfEetRX9n2RpJ/QbmRDMY+kVlgn9nHx83r/+0KxfR6eZ2ezBJscyGz8eBCpjyzUdGG21J9pG5NLJmC20caLt9mWXgZZ464WzMBkRiWRkzYIw3onKXzeVbQq1Pvz8z2CFFUX0FUhFIl3EL7GjirTXFtwY8c+3F2c5mk+ZXIKevhAm6flhJdJOnR0pWfcRN1gzqfuB+wACle6g8l83ire9DF2GhDjhT38ginOoe5ekGDfTWj8Vtmgv2SMGqLng== 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=iq269o5QOQbJhUiqAzKMEPjpeVXDjObs0TmQ+z0/BiA=; b=YmdoXxkyRhIQV2LskwB/bX2rgK1EFFADC9O77rTXzKc7vArY1NQSJLSx/sjdNoPPF0VW2vtPbIzGBY/BUej1eaYa+LgcWdeuJ/YSh8VQZN09i5LWS1s+jqPcR0899YC7fLZz1kazUIkkbC49awZUehr0+nF/hUi9a8pGim6q57MrjDtER6nlyyZqMTemxsT/NHK6c0ZgiQzdYBmL7uknvBfeOWxTtN8z7r8Z6fsU9uYMm2x73+54NEmR9z+7ElbYgnbQl3hw471JITMGDDUER5t8XAGUzkKRHj7UFREgVF95f8raSqbDIZ2cE7J9Kz8+ERmnOyGVz+1q9EGLr1bUDQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=iq269o5QOQbJhUiqAzKMEPjpeVXDjObs0TmQ+z0/BiA=; b=mAKRUtSWlmGQF8EDHk20tEAITMzD5OyBC1b8bOU7rYHFj0stVh4boA7fOawG2Bl3XCii578+68NPmHK1s0zEEdtAwyJuogLZf3UgHH0DilVuiBqr+HCy8P223u/JnvL+NDVT9R3CdRgJrjf4eEXHvd4nhno5rBclCvlMFH/04Hc= Received: from SN7PR18CA0025.namprd18.prod.outlook.com (2603:10b6:806:f3::29) by SJ1PR12MB6098.namprd12.prod.outlook.com (2603:10b6:a03:45f::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7002.23; Fri, 17 Nov 2023 17:42:47 +0000 Received: from SA2PEPF00001504.namprd04.prod.outlook.com (2603:10b6:806:f3:cafe::59) by SN7PR18CA0025.outlook.office365.com (2603:10b6:806:f3::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7002.23 via Frontend Transport; Fri, 17 Nov 2023 17:42:46 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by SA2PEPF00001504.mail.protection.outlook.com (10.167.242.36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7025.12 via Frontend Transport; Fri, 17 Nov 2023 17:42:46 +0000 Received: from SATLEXMB03.amd.com (10.181.40.144) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.32; Fri, 17 Nov 2023 11:42:45 -0600 Received: from xsjtanmays50.xilinx.com (10.180.168.240) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server id 15.1.2507.32 via Frontend Transport; Fri, 17 Nov 2023 11:42:44 -0600 From: Tanmay Shah To: , , , , , , , CC: , , , , Radhey Shyam Pandey , Rob Herring Subject: [PATCH v7 1/4] dt-bindings: remoteproc: add Tightly Coupled Memory (TCM) bindings Date: Fri, 17 Nov 2023 09:42:35 -0800 Message-ID: <20231117174238.1876655-2-tanmay.shah@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231117174238.1876655-1-tanmay.shah@amd.com> References: <20231117174238.1876655-1-tanmay.shah@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SA2PEPF00001504:EE_|SJ1PR12MB6098:EE_ X-MS-Office365-Filtering-Correlation-Id: 83b6faa2-8198-497e-dd38-08dbe7949c54 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: v7fIJn6/fwsNXMQIGOnwaD35xzT4tDtOITspZ3yfJP+ul/tccXVIFf7KRKHoi8izRheAy9lhHsNK/uWxwY4+jYVeum7N6AgwAaX1+7JH8svtDaSwz0fx7N8+nU/lA1sLXRgyvlk9mUjvf2U7PM6GbcOGI90xGULeEQ3jjdHX2EJyeDroYTIHvd11fvL++D0+eHQkPczgUbkXUBkzgMMB08mH8XS8B/cSmDZ/X6/xfCLxXtfpr+Yr9LzCcMcCquaiJhF3BAeefEEV5UuWyyLKGMu31JFFe/hWbaWIMUhTdiAzvlJF/8DGtmdjjmbvKt3T6z8oMt4vfJzuIY+85AnC3PuaTaYxCPy71/HFa8601yTGa6JJRbRLV30gW451BUaXduMmHUG7r0eeMLoX90g33GGe1SQ+nuusWpBBQ3k2UBFRpANRind54ffGGVYV+YLJAinmdqXpjhk1P2N3uNUTtvAG1/MIqnyS95KyE+Lagu6MHMPYD2pPeufHfwTdF8D2KDCBQnfzopBnNu81+XOqh2iBEAOe5E/TijtBrbCh0LaEQemoVZ7WnDl1kjfBJ6y7fhjdQB9Ybl5SRd1OtJRbqJ2A3iR2j65hNQ+h4e897wrLE9v1hhdARHDyijc/9MbuXiIUKmTnrqOoaV/cA23hbIx28ziku8qFwDuVCu3VrTsXlvMuV28WAKJERyP1DR4YOgrZPZmZUMz7JUfZGRqHGqayBn2I0oRuYTOCIRoQYvrC3A8ZjNifq2b5zCiCT5jrQzMzothbL5rD/ceDN/RPsg== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230031)(4636009)(39860400002)(376002)(346002)(136003)(396003)(230922051799003)(186009)(451199024)(82310400011)(1800799009)(64100799003)(36840700001)(40470700004)(46966006)(40460700003)(478600001)(44832011)(86362001)(6666004)(8676002)(8936002)(4326008)(54906003)(316002)(70586007)(70206006)(110136005)(83380400001)(356005)(81166007)(36756003)(2906002)(41300700001)(36860700001)(47076005)(2616005)(40480700001)(1076003)(7049001)(5660300002)(7416002)(26005)(426003)(336012)(82740400003)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Nov 2023 17:42:46.6103 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 83b6faa2-8198-497e-dd38-08dbe7949c54 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: SA2PEPF00001504.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ1PR12MB6098 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231117_094256_364858_1A5F9EBB X-CRM114-Status: GOOD ( 10.85 ) 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 From: Radhey Shyam Pandey Introduce bindings for TCM memory address space on AMD-xilinx Zynq UltraScale+ platform. It will help in defining TCM in device-tree and make it's access platform agnostic and data-driven. Tightly-coupled memories(TCMs) are low-latency memory that provides predictable instruction execution and predictable data load/store timing. Each Cortex-R5F processor contains two 64-bit wide 64 KB memory banks on the ATCM and BTCM ports, for a total of 128 KB of memory. The TCM resources(reg, reg-names and power-domain) are documented for each TCM in the R5 node. The reg and reg-names are made as required properties as we don't want to hardcode TCM addresses for future platforms and for zu+ legacy implementation will ensure that the old dts w/o reg/reg-names works and stable ABI is maintained. It also extends the examples for TCM split and lockstep modes. Signed-off-by: Radhey Shyam Pandey Signed-off-by: Tanmay Shah Acked-by: Rob Herring --- .../remoteproc/xlnx,zynqmp-r5fss.yaml | 131 +++++++++++++++--- 1 file changed, 113 insertions(+), 18 deletions(-) diff --git a/Documentation/devicetree/bindings/remoteproc/xlnx,zynqmp-r5fss.yaml b/Documentation/devicetree/bindings/remoteproc/xlnx,zynqmp-r5fss.yaml index 78aac69f1060..9ecd63ea1b38 100644 --- a/Documentation/devicetree/bindings/remoteproc/xlnx,zynqmp-r5fss.yaml +++ b/Documentation/devicetree/bindings/remoteproc/xlnx,zynqmp-r5fss.yaml @@ -20,6 +20,17 @@ properties: compatible: const: xlnx,zynqmp-r5fss + "#address-cells": + const: 2 + + "#size-cells": + const: 2 + + ranges: + description: | + Standard ranges definition providing address translations for + local R5F TCM address spaces to bus addresses. + xlnx,cluster-mode: $ref: /schemas/types.yaml#/definitions/uint32 enum: [0, 1, 2] @@ -37,7 +48,7 @@ properties: 2: single cpu mode patternProperties: - "^r5f-[a-f0-9]+$": + "^r5f@[0-9a-f]+$": type: object description: | The RPU is located in the Low Power Domain of the Processor Subsystem. @@ -54,8 +65,19 @@ patternProperties: compatible: const: xlnx,zynqmp-r5f + reg: + items: + - description: ATCM internal memory region + - description: BTCM internal memory region + + reg-names: + items: + - const: atcm + - const: btcm + power-domains: - maxItems: 1 + minItems: 1 + maxItems: 3 mboxes: minItems: 1 @@ -102,34 +124,107 @@ patternProperties: required: - compatible - power-domains + - reg + - reg-names unevaluatedProperties: false required: - compatible + - "#address-cells" + - "#size-cells" + - ranges additionalProperties: false examples: - | - remoteproc { - compatible = "xlnx,zynqmp-r5fss"; - xlnx,cluster-mode = <1>; - - r5f-0 { - compatible = "xlnx,zynqmp-r5f"; - power-domains = <&zynqmp_firmware 0x7>; - memory-region = <&rproc_0_fw_image>, <&rpu0vdev0buffer>, <&rpu0vdev0vring0>, <&rpu0vdev0vring1>; - mboxes = <&ipi_mailbox_rpu0 0>, <&ipi_mailbox_rpu0 1>; - mbox-names = "tx", "rx"; + #include + + //Split mode configuration + soc { + #address-cells = <2>; + #size-cells = <2>; + + remoteproc@ffe00000 { + compatible = "xlnx,zynqmp-r5fss"; + xlnx,cluster-mode = <0>; + + #address-cells = <2>; + #size-cells = <2>; + ranges = <0x0 0x0 0x0 0xffe00000 0x0 0x10000>, + <0x0 0x20000 0x0 0xffe20000 0x0 0x10000>, + <0x1 0x0 0x0 0xffe90000 0x0 0x10000>, + <0x1 0x20000 0x0 0xffeb0000 0x0 0x10000>; + + r5f@0 { + compatible = "xlnx,zynqmp-r5f"; + reg = <0x0 0x0 0x0 0x10000>, <0x0 0x20000 0x0 0x10000>; + reg-names = "atcm", "btcm"; + power-domains = <&zynqmp_firmware PD_RPU_0>, + <&zynqmp_firmware PD_R5_0_ATCM>, + <&zynqmp_firmware PD_R5_0_BTCM>; + memory-region = <&rproc_0_fw_image>, <&rpu0vdev0buffer>, + <&rpu0vdev0vring0>, <&rpu0vdev0vring1>; + mboxes = <&ipi_mailbox_rpu0 0>, <&ipi_mailbox_rpu0 1>; + mbox-names = "tx", "rx"; + }; + + r5f@1 { + compatible = "xlnx,zynqmp-r5f"; + reg = <0x1 0x0 0x0 0x10000>, <0x1 0x20000 0x0 0x10000>; + reg-names = "atcm", "btcm"; + power-domains = <&zynqmp_firmware PD_RPU_1>, + <&zynqmp_firmware PD_R5_1_ATCM>, + <&zynqmp_firmware PD_R5_1_BTCM>; + memory-region = <&rproc_1_fw_image>, <&rpu1vdev0buffer>, + <&rpu1vdev0vring0>, <&rpu1vdev0vring1>; + mboxes = <&ipi_mailbox_rpu1 0>, <&ipi_mailbox_rpu1 1>; + mbox-names = "tx", "rx"; + }; }; + }; - r5f-1 { - compatible = "xlnx,zynqmp-r5f"; - power-domains = <&zynqmp_firmware 0x8>; - memory-region = <&rproc_1_fw_image>, <&rpu1vdev0buffer>, <&rpu1vdev0vring0>, <&rpu1vdev0vring1>; - mboxes = <&ipi_mailbox_rpu1 0>, <&ipi_mailbox_rpu1 1>; - mbox-names = "tx", "rx"; + - | + //Lockstep configuration + soc { + #address-cells = <2>; + #size-cells = <2>; + + remoteproc@ffe00000 { + compatible = "xlnx,zynqmp-r5fss"; + xlnx,cluster-mode = <1>; + + #address-cells = <2>; + #size-cells = <2>; + ranges = <0x0 0x0 0x0 0xffe00000 0x0 0x20000>, + <0x0 0x20000 0x0 0xffe20000 0x0 0x20000>; + + r5f@0 { + compatible = "xlnx,zynqmp-r5f"; + reg = <0x0 0x0 0x0 0x20000>, <0x0 0x20000 0x0 0x20000>; + reg-names = "atcm", "btcm"; + power-domains = <&zynqmp_firmware PD_RPU_0>, + <&zynqmp_firmware PD_R5_0_ATCM>, + <&zynqmp_firmware PD_R5_0_BTCM>; + memory-region = <&rproc_0_fw_image>, <&rpu0vdev0buffer>, + <&rpu0vdev0vring0>, <&rpu0vdev0vring1>; + mboxes = <&ipi_mailbox_rpu0 0>, <&ipi_mailbox_rpu0 1>; + mbox-names = "tx", "rx"; + }; + + r5f@1 { + compatible = "xlnx,zynqmp-r5f"; + reg = <0x1 0x0 0x0 0x10000>, <0x1 0x20000 0x0 0x10000>; + reg-names = "atcm", "btcm"; + power-domains = <&zynqmp_firmware PD_RPU_1>, + <&zynqmp_firmware PD_R5_1_ATCM>, + <&zynqmp_firmware PD_R5_1_BTCM>; + memory-region = <&rproc_1_fw_image>, <&rpu1vdev0buffer>, + <&rpu1vdev0vring0>, <&rpu1vdev0vring1>; + mboxes = <&ipi_mailbox_rpu1 0>, <&ipi_mailbox_rpu1 1>; + mbox-names = "tx", "rx"; + }; }; }; ... From patchwork Fri Nov 17 17:42:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tanmay Shah X-Patchwork-Id: 13459199 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 E5DE2C5AD4C for ; Fri, 17 Nov 2023 17:43:30 +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=V6G24g7bHED+T4WXghQ0SQwdS0jp77QzWV0CLTouLsU=; b=r7lznoxlSQ5L6e gY6Xb+JovPISe30rjRp3Q8LPgAwPwefQ2JoCiQ4fWybmvBCmkGqQ8V19E9ColBOafbddLGpMr+rDs fvarFv+LS45zbP55OXGWG2VOpDcHwu/SKSW0P5+YIwV7KTE0ObVVr1ZAQN/M2qEzZBpLt7mrK90Os ouzB3pnY9ApoHhUkdxeIyKzPov/cHlI/1/E3z23TPziv4r8FIlPgZm8vVmfRXlHfq9P1B9PbvCSqH UIyZ+IUqBoaLLfA5sHb9FxpiS0CNjlHBwVJFZUgU74OOa7wjWpPDH3oy1ZZkybYe0Yemb0Opkjb3Q 27Msnt/NxZazvkno5mjA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1r42rr-0072bk-2x; Fri, 17 Nov 2023 17:42:59 +0000 Received: from mail-bn8nam12on2061a.outbound.protection.outlook.com ([2a01:111:f400:fe5b::61a] helo=NAM12-BN8-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1r42ro-0072ZN-0l for linux-arm-kernel@lists.infradead.org; Fri, 17 Nov 2023 17:42:58 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Ofah5zIELYSyaMruUUnNRA1tQFhizyGk8weGzZ9xm/djSg68VhCjja0bADaUJf60+raFcEG7JbY6FhIv2aWE4osqr/wlyIj6BK4eWLEtLeOTiOBfwyv0xJAADLD6tDwzzjlS78Cq9TrHWTbj9OaRB2ibrPFzg2UKPccqJsT9W2lbiKihgTezNwwfPL7SOQkIsoSkbDWiwb0G+HsN8nRJTJwtWjgmU8ays3GfjbnKUgHJum0xnBuSuqmoEFXGbcklgGNqaZr142U1gVfKAqryo8FMY3qA0S/D6oxadX+qXpSkAagrKpnlokjMXEDaGY3tlt9PSdukoklpywV2rW/zkA== 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=1tUn2KAFVldogu7paKZcLTHtNcOirwZYfRJlTriHXSM=; b=TtWhq1Jz+fYNikRDRqxsNyY0iY7VC0Q+R3XFJ9s6v0hC3UdBFklUXbJhIjRj4uD9eTOY8iFpdjUbUWoip+BJN9nY4O0XRgrxbjZeH23KVJc9MEodT7jraZBEQuMMHTDVRPyyr7jctVdx44B5/2coK3L30K5uIjZG/C2I/l3f/2usd39Ard1jutkKwG7SuZndTSfAB8xbTam+KRTwDXsHTxTNt4nnKrQURRUx3AVbDHwkBN5Tv5DRz5PQ61c+mKQYv/A4ojPwaSzAgP7Yl23puYRAdZA+Sg8VcPl96q3poijy42tRORPyLRnBPT/fFF7HXs/YX8ndN0Fd3uJPqImbwQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=1tUn2KAFVldogu7paKZcLTHtNcOirwZYfRJlTriHXSM=; b=ucpMBa4Ja3FzJcTSgJNcT9HCzsRr3+y4w1bbmbrV910vhi4+L35oYVtUpDNrEAAvq6OyAntqiHTgtFaRxSDql74aN8rXdF7vnBw9P4LPaXpqfSwk/XWDDv9Vh8ToJFMPov5cVO4/hUemS/467xL5XkMi+NgiSY5UxV3d9oT9NC4= Received: from CY5PR16CA0028.namprd16.prod.outlook.com (2603:10b6:930:10::25) by DS7PR12MB6048.namprd12.prod.outlook.com (2603:10b6:8:9f::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7002.23; Fri, 17 Nov 2023 17:42:48 +0000 Received: from CY4PEPF0000EDD0.namprd03.prod.outlook.com (2603:10b6:930:10:cafe::f4) by CY5PR16CA0028.outlook.office365.com (2603:10b6:930:10::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7002.20 via Frontend Transport; Fri, 17 Nov 2023 17:42:48 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB03.amd.com; pr=C Received: from SATLEXMB03.amd.com (165.204.84.17) by CY4PEPF0000EDD0.mail.protection.outlook.com (10.167.241.204) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7025.12 via Frontend Transport; Fri, 17 Nov 2023 17:42:47 +0000 Received: from SATLEXMB08.amd.com (10.181.40.132) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.32; Fri, 17 Nov 2023 11:42:47 -0600 Received: from SATLEXMB03.amd.com (10.181.40.144) by SATLEXMB08.amd.com (10.181.40.132) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.32; Fri, 17 Nov 2023 09:42:47 -0800 Received: from xsjtanmays50.xilinx.com (10.180.168.240) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server id 15.1.2507.32 via Frontend Transport; Fri, 17 Nov 2023 11:42:46 -0600 From: Tanmay Shah To: , , , , , , , CC: , , , Subject: [PATCH v7 2/4] dts: zynqmp: add properties for TCM in remoteproc Date: Fri, 17 Nov 2023 09:42:36 -0800 Message-ID: <20231117174238.1876655-3-tanmay.shah@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231117174238.1876655-1-tanmay.shah@amd.com> References: <20231117174238.1876655-1-tanmay.shah@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY4PEPF0000EDD0:EE_|DS7PR12MB6048:EE_ X-MS-Office365-Filtering-Correlation-Id: f4d746f6-fdaa-4c85-3e69-08dbe7949d70 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: XIsWsXbCxqoRGtqgUIdsWd6s606rhTsnv61IV+pidZmeXRwuOc/eN7us9baoqAf2Vm7Va+1WespQdKpTDo0s0X8SZz8MggEncYZT5sBLufaKoXNGFKp9qnjwdBVfNsfDi4GxW+PUcf9A/Chf9fpbGhzd6jqX+wV75JXpHAlL9obY9pprztSuZa4Vs6A5WPqqujUT2DpjX9UEoOX5gyhrYmywex6hHnRSHcDkO0uGZgBlUP35vjHwnZ/Sh79HhInI1uKgQjaVgYBi+s7LuIne1qsJm7U4R9ZOoJNq9GEpCttufHtWMgQuepH/+xvef5ZEbQSab3CfYK1sqUveMBLTuPJ/DtHq+XCEQEnwnbhLZy4cu8NSVSqPx4H2XuvZOOSS1eMvMgwHyotMgm4Z30BZbhlkcQWWGAbJPUJuNlzpxUbf50uHvBIehxckfvvFSQLN1pv7DEn5+jKg9/3oh2Ub0H8owggX/RDViKCe+AHzyzbXqLZ6ZlhLq6oTXzKbnEYEvqwrzVOeTFQokNPMdaj2EqpIxPtfHJ7FpKdHNe9+YhCy4CIzTl4CUDqYtOiM6pRhzrDS5WZKxGSe1Lkg+1AWlCRAgCC4fGnWfL3qx95TRpENdVPDrXoHYfuLXQ008qitLc3b/NnkL8QHaKUi/OKM+fEU7TxU3mnF+zIf8aPdtwHNVG23gi9qLHqphsS9kxtGfZSUEMogUE6sbfwCNujpvhQT2cSpH+xs4pOch4hS9XLOWQalfUVOqOcrgmQutwLPWvwNi30zRY3TmDfh06RDpw== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB03.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230031)(4636009)(39860400002)(346002)(376002)(396003)(136003)(230922051799003)(186009)(64100799003)(451199024)(1800799009)(82310400011)(40470700004)(46966006)(36840700001)(2616005)(81166007)(41300700001)(356005)(6666004)(86362001)(36860700001)(478600001)(82740400003)(110136005)(70586007)(70206006)(2906002)(36756003)(1076003)(40480700001)(7049001)(26005)(54906003)(316002)(336012)(426003)(83380400001)(40460700003)(8676002)(5660300002)(8936002)(4326008)(44832011)(47076005)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Nov 2023 17:42:47.9830 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f4d746f6-fdaa-4c85-3e69-08dbe7949d70 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB03.amd.com] X-MS-Exchange-CrossTenant-AuthSource: CY4PEPF0000EDD0.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS7PR12MB6048 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231117_094256_363958_B968F14F X-CRM114-Status: GOOD ( 13.21 ) 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 Add properties as per new bindings in zynqmp remoteproc node to represent TCM address and size. This patch also adds alternative remoteproc node to represent remoteproc cluster in split mode. By default lockstep mode is enabled and users should disable it before using split mode dts. Both device-tree nodes can't be used simultaneously one of them must be disabled. For zcu102-1.0 and zcu102-1.1 board remoteproc split mode dts node is enabled and lockstep mode dts is disabled. Signed-off-by: Tanmay Shah --- .../boot/dts/xilinx/zynqmp-zcu102-rev1.0.dts | 8 +++ arch/arm64/boot/dts/xilinx/zynqmp.dtsi | 60 +++++++++++++++++-- 2 files changed, 63 insertions(+), 5 deletions(-) diff --git a/arch/arm64/boot/dts/xilinx/zynqmp-zcu102-rev1.0.dts b/arch/arm64/boot/dts/xilinx/zynqmp-zcu102-rev1.0.dts index c8f71a1aec89..495ca94b45db 100644 --- a/arch/arm64/boot/dts/xilinx/zynqmp-zcu102-rev1.0.dts +++ b/arch/arm64/boot/dts/xilinx/zynqmp-zcu102-rev1.0.dts @@ -14,6 +14,14 @@ / { compatible = "xlnx,zynqmp-zcu102-rev1.0", "xlnx,zynqmp-zcu102", "xlnx,zynqmp"; }; +&rproc_split { + status = "okay"; +}; + +&rproc_lockstep { + status = "disabled"; +}; + &eeprom { #address-cells = <1>; #size-cells = <1>; diff --git a/arch/arm64/boot/dts/xilinx/zynqmp.dtsi b/arch/arm64/boot/dts/xilinx/zynqmp.dtsi index b61fc99cd911..602e6aba7ac5 100644 --- a/arch/arm64/boot/dts/xilinx/zynqmp.dtsi +++ b/arch/arm64/boot/dts/xilinx/zynqmp.dtsi @@ -247,19 +247,69 @@ fpga_full: fpga-full { ranges; }; - remoteproc { + rproc_lockstep: remoteproc@ffe00000 { compatible = "xlnx,zynqmp-r5fss"; xlnx,cluster-mode = <1>; - r5f-0 { + #address-cells = <2>; + #size-cells = <2>; + + ranges = <0x0 0x0 0x0 0xffe00000 0x0 0x20000>, + <0x0 0x20000 0x0 0xffe20000 0x0 0x20000>, + <0x1 0x0 0x0 0xffe90000 0x0 0x10000>, + <0x1 0x20000 0x0 0xffeb0000 0x0 0x10000>; + + r5f@0 { + compatible = "xlnx,zynqmp-r5f"; + reg = <0x0 0x0 0x0 0x20000>, <0x0 0x20000 0x0 0x20000>; + reg-names = "atcm", "btcm"; + power-domains = <&zynqmp_firmware PD_RPU_0>, + <&zynqmp_firmware PD_R5_0_ATCM>, + <&zynqmp_firmware PD_R5_0_BTCM>; + memory-region = <&rproc_0_fw_image>; + }; + + r5f@1 { + compatible = "xlnx,zynqmp-r5f"; + reg = <0x1 0x0 0x0 0x10000>, <0x1 0x20000 0x0 0x10000>; + reg-names = "atcm", "btcm"; + power-domains = <&zynqmp_firmware PD_RPU_1>, + <&zynqmp_firmware PD_R5_1_ATCM>, + <&zynqmp_firmware PD_R5_1_BTCM>; + memory-region = <&rproc_1_fw_image>; + }; + }; + + rproc_split: remoteproc-split@ffe00000 { + status = "disabled"; + compatible = "xlnx,zynqmp-r5fss"; + xlnx,cluster-mode = <0>; + + #address-cells = <2>; + #size-cells = <2>; + + ranges = <0x0 0x0 0x0 0xffe00000 0x0 0x10000>, + <0x0 0x20000 0x0 0xffe20000 0x0 0x10000>, + <0x1 0x0 0x0 0xffe90000 0x0 0x10000>, + <0x1 0x20000 0x0 0xffeb0000 0x0 0x10000>; + + r5f@0 { compatible = "xlnx,zynqmp-r5f"; - power-domains = <&zynqmp_firmware PD_RPU_0>; + reg = <0x0 0x0 0x0 0x10000>, <0x0 0x20000 0x0 0x10000>; + reg-names = "atcm", "btcm"; + power-domains = <&zynqmp_firmware PD_RPU_0>, + <&zynqmp_firmware PD_R5_0_ATCM>, + <&zynqmp_firmware PD_R5_0_BTCM>; memory-region = <&rproc_0_fw_image>; }; - r5f-1 { + r5f@1 { compatible = "xlnx,zynqmp-r5f"; - power-domains = <&zynqmp_firmware PD_RPU_1>; + reg = <0x1 0x0 0x0 0x10000>, <0x1 0x20000 0x0 0x10000>; + reg-names = "atcm", "btcm"; + power-domains = <&zynqmp_firmware PD_RPU_1>, + <&zynqmp_firmware PD_R5_1_ATCM>, + <&zynqmp_firmware PD_R5_1_BTCM>; memory-region = <&rproc_1_fw_image>; }; }; From patchwork Fri Nov 17 17:42:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tanmay Shah X-Patchwork-Id: 13459202 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 CFD33C197A0 for ; Fri, 17 Nov 2023 17:43:37 +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=yTSj5m/1c/BGUW+B+9/tsXMqxLri5+LHYhtReBFPhGg=; b=xhinrJTWLPFq4m E+2Yy3PBodvyIQV0Xqfgu3IPU0hZcwCX3gtYO+D8kmfVo1c+UeaZMxe/g86GkwIBBebsfLORi0sSs SDXprD9F/gnYl3JMEH6uTuVIym+bt12oef4uLOIKz3jyZcNVf7QxCiZFmDsesm63FGHHnigfII6g8 guVkDMo+q8fDQMgTWCS4y0GdSqSyKY+bv4qpDJ53NGaUviBARrza+RYWehb4ZLm8fCVKK8c0Nnupe ZQSjgZbkQHtc7LxlMXIMLZcvoO+x2vmVESoqqwCYOpGPDYv2d/8r2cx8etu7pfjVz0HDvZuqshtMK UXyUdtzqMudHj+sZecaA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1r42rz-0072f6-1w; Fri, 17 Nov 2023 17:43:07 +0000 Received: from mail-dm6nam12on20608.outbound.protection.outlook.com ([2a01:111:f400:fe59::608] helo=NAM12-DM6-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1r42rp-0072ae-1K for linux-arm-kernel@lists.infradead.org; Fri, 17 Nov 2023 17:42:59 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mA9wiMZiAVmTN/bouP8xRyDCjKdCFQBCME97ociVAU1WqtG3z70iqJfsGoTl1NEOS2E1f0FLEd2r0w/dGcQcpbLOZaFMfiqDFiscdDaxZB8doobgJahY1T5IgJEkbOwZ+o09a+a7zbxVhEzyayb6kOq0OBMDSFvK0KUF8iueGJqnsnLVQfN7hgcJn+AED2jyYGz+W9J2cBNPvP6qov4c1saxLRBIaHc6qoKNbf8huE+RrRXTp2CvLOd5uXSry464iRHBPZvOWm2GHFXI/QhISPsUHCmO2EjQjno0t9JLtfaR1K8M8jSPfhj7daEIf3ZTqCvXXUp2GnIMfaunojCd5w== 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=mMxDNlzH4itOgmRBqr/XNtpwrr/e1VXONefXBCpitRs=; b=QUhMgazmgyEx1WaHBvp4sfCmYAfIP61q5//JSm7NXWQcyh+aSeCsO6IXKy/B5Iv8QoBPNAvxtmFy2bWOFT/eD9ow0U8v8fvLUXK7LKJyR0T7sNIhaOFoelNvWsVAuVdAiwAwu1H2qTUUNNAsfHC3XDQPXWaVxib0bwyzhsT89Ll7wS24eL9ZpHhyxXtGNyPWh9vewJKHSExe980xWyYR5kGH+AU//boqmJewB9cEcAXkF8hWffSgJMfYjcZFyngAwhy6eOsBnulheSPVqS5s2C8dBMV4qefWDZCseGCZrgp8+px8CP1L3HPaA830PXaqfFVPDvgI8e+I+FF1HVF5Vw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=mMxDNlzH4itOgmRBqr/XNtpwrr/e1VXONefXBCpitRs=; b=KwS/G47gClFj4wRXBncPSb1KbembuJ8SEmYZL/1iPi6ZMAjhDOm5723D6iffQr7HdhYBy/Y+F+rOcv/KnUYa++J9fjzLYTLdkQwn+C2kMdCi4DYIestjPoLbFKOcOOPjgKHH7A9KzmLym4FUnhA2QbC1kLpq+71F8fVd7pw3gvM= Received: from CH0P221CA0018.NAMP221.PROD.OUTLOOK.COM (2603:10b6:610:11c::19) by DM6PR12MB4561.namprd12.prod.outlook.com (2603:10b6:5:2ac::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7002.23; Fri, 17 Nov 2023 17:42:49 +0000 Received: from SA2PEPF00001509.namprd04.prod.outlook.com (2603:10b6:610:11c:cafe::d1) by CH0P221CA0018.outlook.office365.com (2603:10b6:610:11c::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7002.23 via Frontend Transport; Fri, 17 Nov 2023 17:42:48 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by SA2PEPF00001509.mail.protection.outlook.com (10.167.242.41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7025.13 via Frontend Transport; Fri, 17 Nov 2023 17:42:48 +0000 Received: from SATLEXMB08.amd.com (10.181.40.132) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.32; Fri, 17 Nov 2023 11:42:48 -0600 Received: from SATLEXMB03.amd.com (10.181.40.144) by SATLEXMB08.amd.com (10.181.40.132) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.32; Fri, 17 Nov 2023 09:42:48 -0800 Received: from xsjtanmays50.xilinx.com (10.180.168.240) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server id 15.1.2507.32 via Frontend Transport; Fri, 17 Nov 2023 11:42:47 -0600 From: Tanmay Shah To: , , , , , , , CC: , , , Subject: [PATCH v7 3/4] remoteproc: zynqmp: add pm domains support Date: Fri, 17 Nov 2023 09:42:37 -0800 Message-ID: <20231117174238.1876655-4-tanmay.shah@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231117174238.1876655-1-tanmay.shah@amd.com> References: <20231117174238.1876655-1-tanmay.shah@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SA2PEPF00001509:EE_|DM6PR12MB4561:EE_ X-MS-Office365-Filtering-Correlation-Id: 4bf99c33-5518-4d45-28be-08dbe7949d87 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: JUf178ogUnXfuaa6NEJfIUf8ye7q5I38IY6XdsCC0YZsoB7YB6ITJaghDQcccj4G4mClxzMH8AwxvrIPxhR/F6dWJp03t3kQ+MvRGpx1OOxspmAcr65fytCAMgJg+CQC9dDVjOBPD+J3sIH0msUEngpaFM+DprC6vAuGv6wyNoi7s/kHW+Xkq3ZrqhvwtFmzV7itOUY7UI//dRlsemwTrGQmKaJ+J+4i/23rDgpEdOcryIxmi5QPLcmmPdaG2BQLqz07qxx4ybQ+879XzIMg0rbPtvZp/jLXHZ33qw6Owr/hQLxELV68By6Iu6mnQ9heE6V2jrGkF18y9Gh0iHP349ip9OMrEW1sFzQC1jtnZ1iHpQ269APc0lZ6UQ+jPEeLrvVsrZ5exw01M+hoo8V/zZk1RLZAXb1WBlNs89ob3CaK3c7DjqeQBvVkuMUGH3NNVnB7vOk5Y23Pg9O2zpA5uEySYvr1hufzu17vg7PxD6oHz4xMzWsKLFrQQ8o6LNyBiLuO1wvEY+6KaAv9aoLX7WqHRTKsAIqg7BAlmn5gP83g8Np9O7cAddWrl1LOUx+zKv+9KPB3WcpgvWqmwsYFZuf+EE+PyU5q7ZeWGS9LmF3hb3eU7VPC17456eT60tYc9NED45cFDlkgsmQS771dA3tbVlXrhWOs/NmiNmx7evN2fpChM0mKxHadqXwAbALC/7IqPezxCmWQ2n+rRSmqt+AMmOWaIcsopWmLcvdPRqVr0gPRanIBtfZNrE8a3D2+PXxkNgKc0cwBmRsoisvdAw== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230031)(4636009)(39860400002)(346002)(376002)(136003)(396003)(230922051799003)(451199024)(82310400011)(1800799009)(186009)(64100799003)(40470700004)(36840700001)(46966006)(36756003)(316002)(478600001)(40460700003)(83380400001)(41300700001)(356005)(81166007)(426003)(336012)(82740400003)(36860700001)(1076003)(8936002)(8676002)(5660300002)(4326008)(44832011)(47076005)(26005)(6666004)(86362001)(70206006)(110136005)(70586007)(2906002)(2616005)(40480700001)(7049001)(54906003)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Nov 2023 17:42:48.6332 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4bf99c33-5518-4d45-28be-08dbe7949d87 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: SA2PEPF00001509.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB4561 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231117_094257_499970_FACECA0A X-CRM114-Status: GOOD ( 24.82 ) 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 Use TCM pm domains extracted from device-tree to power on/off TCM using general pm domain framework. Signed-off-by: Tanmay Shah --- Changes in v7: - %s/pm_dev1/pm_dev_core0/r - %s/pm_dev_link1/pm_dev_core0_link/r - %s/pm_dev2/pm_dev_core1/r - %s/pm_dev_link2/pm_dev_core1_link/r - remove pm_domain_id check to move next patch - add comment about how 1st entry in pm domain list is used - fix loop when jump to fail_add_pm_domains loop drivers/remoteproc/xlnx_r5_remoteproc.c | 215 +++++++++++++++++++++++- 1 file changed, 212 insertions(+), 3 deletions(-) diff --git a/drivers/remoteproc/xlnx_r5_remoteproc.c b/drivers/remoteproc/xlnx_r5_remoteproc.c index 4395edea9a64..22bccc5075a0 100644 --- a/drivers/remoteproc/xlnx_r5_remoteproc.c +++ b/drivers/remoteproc/xlnx_r5_remoteproc.c @@ -16,6 +16,7 @@ #include #include #include +#include #include "remoteproc_internal.h" @@ -102,6 +103,12 @@ static const struct mem_bank_data zynqmp_tcm_banks_lockstep[] = { * @rproc: rproc handle * @pm_domain_id: RPU CPU power domain id * @ipi: pointer to mailbox information + * @num_pm_dev: number of tcm pm domain devices for this core + * @pm_dev_core0: pm domain virtual devices for power domain framework + * @pm_dev_core0_link: pm domain device links after registration + * @pm_dev_core1: used only in lockstep mode. second core's pm domain virtual devices + * @pm_dev_core1_link: used only in lockstep mode. second core's pm device links after + * registration */ struct zynqmp_r5_core { struct device *dev; @@ -111,6 +118,11 @@ struct zynqmp_r5_core { struct rproc *rproc; u32 pm_domain_id; struct mbox_info *ipi; + int num_pm_dev; + struct device **pm_dev_core0; + struct device_link **pm_dev_core0_link; + struct device **pm_dev_core1; + struct device_link **pm_dev_core1_link; }; /** @@ -651,7 +663,8 @@ static int add_tcm_carveout_lockstep_mode(struct rproc *rproc) ZYNQMP_PM_CAPABILITY_ACCESS, 0, ZYNQMP_PM_REQUEST_ACK_BLOCKING); if (ret < 0) { - dev_err(dev, "failed to turn on TCM 0x%x", pm_domain_id); + dev_err(dev, "failed to turn on TCM 0x%x", + pm_domain_id); goto release_tcm_lockstep; } @@ -758,6 +771,189 @@ static int zynqmp_r5_parse_fw(struct rproc *rproc, const struct firmware *fw) return ret; } +static void zynqmp_r5_remove_pm_domains(struct rproc *rproc) +{ + struct zynqmp_r5_core *r5_core = rproc->priv; + struct device *dev = r5_core->dev; + struct zynqmp_r5_cluster *cluster; + int i; + + cluster = platform_get_drvdata(to_platform_device(dev->parent)); + + for (i = 1; i < r5_core->num_pm_dev; i++) { + device_link_del(r5_core->pm_dev_core0_link[i]); + dev_pm_domain_detach(r5_core->pm_dev_core0[i], false); + } + + kfree(r5_core->pm_dev_core0); + r5_core->pm_dev_core0 = NULL; + kfree(r5_core->pm_dev_core0_link); + r5_core->pm_dev_core0_link = NULL; + + if (cluster->mode == SPLIT_MODE) { + r5_core->num_pm_dev = 0; + return; + } + + for (i = 1; i < r5_core->num_pm_dev; i++) { + device_link_del(r5_core->pm_dev_core1_link[i]); + dev_pm_domain_detach(r5_core->pm_dev_core1[i], false); + } + + kfree(r5_core->pm_dev_core1); + r5_core->pm_dev_core1 = NULL; + kfree(r5_core->pm_dev_core1_link); + r5_core->pm_dev_core1_link = NULL; + r5_core->num_pm_dev = 0; +} + +static int zynqmp_r5_add_pm_domains(struct rproc *rproc) +{ + struct zynqmp_r5_core *r5_core = rproc->priv; + struct device *dev = r5_core->dev, *dev2; + struct zynqmp_r5_cluster *cluster; + struct platform_device *pdev; + struct device_node *np; + int i, j, num_pm_dev, ret; + + cluster = dev_get_drvdata(dev->parent); + + /* get number of power-domains */ + num_pm_dev = of_count_phandle_with_args(r5_core->np, "power-domains", + "#power-domain-cells"); + + if (num_pm_dev <= 0) + return -EINVAL; + + r5_core->pm_dev_core0 = kcalloc(num_pm_dev, + sizeof(struct device *), + GFP_KERNEL); + if (!r5_core->pm_dev_core0) + ret = -ENOMEM; + + r5_core->pm_dev_core0_link = kcalloc(num_pm_dev, + sizeof(struct device_link *), + GFP_KERNEL); + if (!r5_core->pm_dev_core0_link) { + kfree(r5_core->pm_dev_core0); + r5_core->pm_dev_core0 = NULL; + return -ENOMEM; + } + + r5_core->num_pm_dev = num_pm_dev; + + /* + * start from 2nd entry in power-domains property list as + * for zynqmp we only add TCM power domains and not core's power domain. + * 1st entry is used to configure r5 operation mode. + */ + for (i = 1; i < r5_core->num_pm_dev; i++) { + r5_core->pm_dev_core0[i] = dev_pm_domain_attach_by_id(dev, i); + if (IS_ERR_OR_NULL(r5_core->pm_dev_core0[i])) { + dev_dbg(dev, "failed to attach pm domain %d, ret=%ld\n", i, + PTR_ERR(r5_core->pm_dev_core0[i])); + ret = -EINVAL; + goto fail_add_pm_domains; + } + r5_core->pm_dev_core0_link[i] = device_link_add(dev, + r5_core->pm_dev_core0[i], + DL_FLAG_STATELESS | + DL_FLAG_RPM_ACTIVE | + DL_FLAG_PM_RUNTIME); + if (!r5_core->pm_dev_core0_link[i]) { + dev_pm_domain_detach(r5_core->pm_dev_core0[i], true); + r5_core->pm_dev_core0[i] = NULL; + ret = -EINVAL; + goto fail_add_pm_domains; + } + } + + if (cluster->mode == SPLIT_MODE) + return 0; + + r5_core->pm_dev_core1 = kcalloc(num_pm_dev, + sizeof(struct device *), + GFP_KERNEL); + if (!r5_core->pm_dev_core1) { + ret = -ENOMEM; + goto fail_add_pm_domains; + } + + r5_core->pm_dev_core1_link = kcalloc(num_pm_dev, + sizeof(struct device_link *), + GFP_KERNEL); + if (!r5_core->pm_dev_core1_link) { + kfree(r5_core->pm_dev_core1); + r5_core->pm_dev_core1 = NULL; + ret = -ENOMEM; + goto fail_add_pm_domains; + } + + /* get second core's device to detach its power-domains */ + np = of_get_next_child(cluster->dev->of_node, of_node_get(dev->of_node)); + + pdev = of_find_device_by_node(np); + if (!pdev) { + dev_err(cluster->dev, "core1 platform device not available\n"); + kfree(r5_core->pm_dev_core1); + kfree(r5_core->pm_dev_core1_link); + r5_core->pm_dev_core1 = NULL; + r5_core->pm_dev_core1_link = NULL; + ret = -EINVAL; + goto fail_add_pm_domains; + } + + dev2 = &pdev->dev; + + /* for zynqmp we only add TCM power domains and not core's power domain */ + for (j = 1; j < r5_core->num_pm_dev; j++) { + r5_core->pm_dev_core1[j] = dev_pm_domain_attach_by_id(dev2, j); + if (!r5_core->pm_dev_core1[j]) { + dev_dbg(dev, "can't attach to pm domain %d\n", j); + ret = -EINVAL; + goto fail_add_pm_domains_lockstep; + } else if (IS_ERR(r5_core->pm_dev_core1[j])) { + dev_dbg(dev, "can't attach to pm domain %d\n", j); + ret = PTR_ERR(r5_core->pm_dev_core1[j]); + goto fail_add_pm_domains_lockstep; + } + + r5_core->pm_dev_core1_link[j] = device_link_add(dev, + r5_core->pm_dev_core1[j], + DL_FLAG_STATELESS | + DL_FLAG_RPM_ACTIVE | + DL_FLAG_PM_RUNTIME); + if (!r5_core->pm_dev_core1_link[j]) { + dev_pm_domain_detach(r5_core->pm_dev_core1[j], true); + r5_core->pm_dev_core1[j] = NULL; + ret = -ENODEV; + goto fail_add_pm_domains_lockstep; + } + } + +fail_add_pm_domains_lockstep: + while (--j >= 0) { + device_link_del(r5_core->pm_dev_core1_link[j]); + dev_pm_domain_detach(r5_core->pm_dev_core1[j], true); + } + kfree(r5_core->pm_dev_core1); + r5_core->pm_dev_core1 = NULL; + kfree(r5_core->pm_dev_core1_link); + r5_core->pm_dev_core1_link = NULL; + +fail_add_pm_domains: + while (--i >= 0) { + device_link_del(r5_core->pm_dev_core0_link[i]); + dev_pm_domain_detach(r5_core->pm_dev_core0[i], true); + } + kfree(r5_core->pm_dev_core0); + r5_core->pm_dev_core0 = NULL; + kfree(r5_core->pm_dev_core0_link); + r5_core->pm_dev_core0_link = NULL; + + return ret; +} + /** * zynqmp_r5_rproc_prepare() * adds carveouts for TCM bank and reserved memory regions @@ -770,19 +966,30 @@ static int zynqmp_r5_rproc_prepare(struct rproc *rproc) { int ret; + ret = zynqmp_r5_add_pm_domains(rproc); + if (ret) { + dev_err(&rproc->dev, "failed to add pm domains\n"); + return ret; + } + ret = add_tcm_banks(rproc); if (ret) { dev_err(&rproc->dev, "failed to get TCM banks, err %d\n", ret); - return ret; + goto fail_prepare; } ret = add_mem_regions_carveout(rproc); if (ret) { dev_err(&rproc->dev, "failed to get reserve mem regions %d\n", ret); - return ret; + goto fail_prepare; } return 0; + +fail_prepare: + zynqmp_r5_remove_pm_domains(rproc); + + return ret; } /** @@ -801,6 +1008,8 @@ static int zynqmp_r5_rproc_unprepare(struct rproc *rproc) r5_core = rproc->priv; + zynqmp_r5_remove_pm_domains(rproc); + for (i = 0; i < r5_core->tcm_bank_count; i++) { pm_domain_id = r5_core->tcm_banks[i]->pm_domain_id; if (zynqmp_pm_release_node(pm_domain_id)) From patchwork Fri Nov 17 17:42:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tanmay Shah X-Patchwork-Id: 13459200 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 510B3C197A0 for ; Fri, 17 Nov 2023 17:43:30 +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=3jyhQMnD4XHBsNdZY5Ol513fp7tumV6PyF8NVIUTXrw=; b=t7it/4zghfPAEj 5N144blF/uVu4zmBH6pNtFpEYymA3l1DnweVrnBC9s2f5nSAduWUOa9Sj+hvksXh7LpSfDFLkI6zL Y2F3mPlYgyCnxCW1gsi8prD8Jxfq87Sysyi5uIzeNqdpf/2J/+9GvA8MOvfGvyOnI9A5PxWDNoKoM umCmx97ADj1n3hdJ6RAL8jTkzp/k/Xzprtps46NDFN1HbhB9tSo5dZqNePn1SmuBRQYBnuFZ0WCP/ aFslZemA4OKjTuLx1QjEmuTuGxuReVeoulkE1nEWGl6aEYD8Nr7+JWt9W5JVzR9AOl9NIskuV7n/l wJfo4IjK1xZ0gV9Fwhzw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1r42ry-0072ea-3D; Fri, 17 Nov 2023 17:43:07 +0000 Received: from mail-sn1nam02on2060a.outbound.protection.outlook.com ([2a01:111:f400:7ea9::60a] helo=NAM02-SN1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1r42ro-0072Zk-0R for linux-arm-kernel@lists.infradead.org; Fri, 17 Nov 2023 17:42:58 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=a6vUZfKNCeX26Sqv2WlrWUHMdC+0ES7oJ1qW7NRrK+8eZwkAY+9S9jtFOmxPNDE9cWgJ4AT3cUd3EPdeRyT2TDLt0nZjIx8keXdfKCLBNQqYt9NnhAVuGoM7wOdQKFMiueEC+iqJfXpp1RsIR3OzL2xsFryFcZDzW8B7veeOTIfQ/MRAZCYZBRDDnYU9mwFup7shW5YkjGDtlYSFQITg5ReCreXH7/xpZAuS2QbO2SuL7hCoDmFT+oevxSjqfUDFy0YW5+SsXBWecd8MNDYb3KKbacoaMYQGJ20sD23WzP3ZgFg2BNMB/o85DSznf4TpsYZAUQmpjPco+recRrqlIQ== 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=/UDr2JdaYRDxThTk0QxeXOH7YbbTTjHNkri7s+8C5/4=; b=Ix7vU6y+RxWrajsZRCEdtoUQbDnrxkLNvtENy0t8EIWEg4JCeLWirz5y/hAYpE+1eaTuIP27xHkPnqC8lw+nuwf0k/4GKuYO5E/689JLo86WtPyJXWrVAjX+cgcQ/HzYQFjpPb6XDm1Xzq8lRb/DHFCYbG2C6VUcQg9V63rKFFn0fHEHP4RxYgums/oh+DXl/ipxtg8F1ECVkOSO4h/ImcboBzIl07dGKFiq42iSUF4yEk1iFgxxkHXJZk+D7Wjk+KHZdPAtlZ8HfEwK3kFAsRnvzXNvjIflP3ml71OGQ3as6oDUf88RG1+/VB3nmlNOzSk2q2qKZE0qR3ksumkwoA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=/UDr2JdaYRDxThTk0QxeXOH7YbbTTjHNkri7s+8C5/4=; b=P3/c6h9Xs2MyhmBQwuF29DIRceeMlfvQ634h7nBuH7c9HUiR+NccVYvQQW/OKvZfXR2xZ9r0wMaDwdN5XCxvcwbM0h5/ha6qcEnedjHEeXocMiiPuGGQqA+tbspXCiByDp3DvFwph51sezyIJGu5yyrb7rgr81Kji229nJNW7aY= Received: from DM6PR10CA0025.namprd10.prod.outlook.com (2603:10b6:5:60::38) by DS0PR12MB8814.namprd12.prod.outlook.com (2603:10b6:8:14e::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7002.23; Fri, 17 Nov 2023 17:42:50 +0000 Received: from CY4PEPF0000EDD6.namprd03.prod.outlook.com (2603:10b6:5:60:cafe::78) by DM6PR10CA0025.outlook.office365.com (2603:10b6:5:60::38) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7002.23 via Frontend Transport; Fri, 17 Nov 2023 17:42:50 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB03.amd.com; pr=C Received: from SATLEXMB03.amd.com (165.204.84.17) by CY4PEPF0000EDD6.mail.protection.outlook.com (10.167.241.210) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7025.12 via Frontend Transport; Fri, 17 Nov 2023 17:42:50 +0000 Received: from SATLEXMB08.amd.com (10.181.40.132) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.32; Fri, 17 Nov 2023 11:42:49 -0600 Received: from SATLEXMB03.amd.com (10.181.40.144) by SATLEXMB08.amd.com (10.181.40.132) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.32; Fri, 17 Nov 2023 09:42:49 -0800 Received: from xsjtanmays50.xilinx.com (10.180.168.240) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server id 15.1.2507.32 via Frontend Transport; Fri, 17 Nov 2023 11:42:48 -0600 From: Tanmay Shah To: , , , , , , , CC: , , , Subject: [PATCH v7 4/4] remoteproc: zynqmp: parse TCM from device tree Date: Fri, 17 Nov 2023 09:42:38 -0800 Message-ID: <20231117174238.1876655-5-tanmay.shah@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231117174238.1876655-1-tanmay.shah@amd.com> References: <20231117174238.1876655-1-tanmay.shah@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY4PEPF0000EDD6:EE_|DS0PR12MB8814:EE_ X-MS-Office365-Filtering-Correlation-Id: 1da520fa-eca7-4939-e146-08dbe7949e6a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: wvOxXHOVn5YmChPW781l2NQNU6pXCgzjkiWcCgVZLIQ5iVzcZjgyJ3ccfqBlsJq3X2inWj/iRnLtjEAZgwxpBYiFwh1Bdo/98cA/PfEptnC4gkAmrjl8ATgeGYoZYA9uyQCMIKN3Gt1hXKns2KLQB9rmWhmuHl+AT8jg3j+f7THyal+w/ImjgUxHu8kI8ZpLAPXZyyAK8pVC8ref00ky6KICIwshM9d8nuMfLCqdR0RT9srHN2xc86kPrx7Wta1SanqJ+COBGr+eo/gefdeGZfhWy5QWV+/JWjY1HvTy7zpsAyJhVkHPZwQs7J3wdj9MurSsOpbk/2hxUMPJVe8ROjtGEFya2uWtfGQGIGrIVtLqA1SEczaWiPul+9cZs131IqLSfAhnW2UpN9X0lFfKNtE9W/hluB8YKUuOTUGXLad3Gt4T9yd1ub7XZlr0WLrfXROgEzE3iyeCyaIFiCybwm9Ik0siJN0PXjh59OvCFWyQIx0FzQmZ5SLyPTFL+F1SrOVWCEcdII0wjUj7QDk+O8pRZRelZOGToTYxXYUkE2n8sjqccWLsDRps5akL/MWqh98i60oO3ZoVgDe7KIohX2LfpvqvdhHxEtmA3RkahRzwL8azkT/8rbE0PCXRpwcUvX7fKbSqcEATlZU4jSFya6CiEoFYgkoQp9G3ykvPmky7jTNevzPBF3SV4KhRwY1tTRZHUqTHIiE2AwcS/7upkQyL/IqYLF3jSuSzsYvYbnY017pRLEi+Jb4YiI9f3h41xUc6fotwBKNapm4wF0l92g== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB03.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230031)(4636009)(346002)(396003)(376002)(136003)(39860400002)(230922051799003)(1800799009)(451199024)(186009)(82310400011)(64100799003)(36840700001)(40470700004)(46966006)(41300700001)(40460700003)(66899024)(81166007)(7049001)(8676002)(4326008)(8936002)(70206006)(70586007)(110136005)(54906003)(83380400001)(316002)(2616005)(478600001)(1076003)(86362001)(6666004)(26005)(36756003)(426003)(336012)(82740400003)(2906002)(5660300002)(36860700001)(356005)(44832011)(47076005)(40480700001)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Nov 2023 17:42:50.0787 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1da520fa-eca7-4939-e146-08dbe7949e6a X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB03.amd.com] X-MS-Exchange-CrossTenant-AuthSource: CY4PEPF0000EDD6.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR12MB8814 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231117_094256_364858_941E4D62 X-CRM114-Status: GOOD ( 24.47 ) 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 ZynqMP TCM information is fixed in driver. Now ZynqMP TCM information is available in device-tree. Parse TCM information in driver as per new bindings. Signed-off-by: Tanmay Shah --- Changes in v7: - move checking of pm_domain_id from previous patch - fix mem_bank_data memory allocation drivers/remoteproc/xlnx_r5_remoteproc.c | 152 ++++++++++++++++++++---- 1 file changed, 128 insertions(+), 24 deletions(-) diff --git a/drivers/remoteproc/xlnx_r5_remoteproc.c b/drivers/remoteproc/xlnx_r5_remoteproc.c index 22bccc5075a0..270af73344ef 100644 --- a/drivers/remoteproc/xlnx_r5_remoteproc.c +++ b/drivers/remoteproc/xlnx_r5_remoteproc.c @@ -75,8 +75,8 @@ struct mbox_info { }; /* - * Hardcoded TCM bank values. This will be removed once TCM bindings are - * accepted for system-dt specifications and upstreamed in linux kernel + * Hardcoded TCM bank values. This will stay in driver to maintain backward + * compatibility with device-tree that does not have TCM information. */ static const struct mem_bank_data zynqmp_tcm_banks_split[] = { {0xffe00000UL, 0x0, 0x10000UL, PD_R5_0_ATCM, "atcm0"}, /* TCM 64KB each */ @@ -587,12 +587,21 @@ static int add_tcm_carveout_split_mode(struct rproc *rproc) bank_size = r5_core->tcm_banks[i]->size; pm_domain_id = r5_core->tcm_banks[i]->pm_domain_id; - ret = zynqmp_pm_request_node(pm_domain_id, - ZYNQMP_PM_CAPABILITY_ACCESS, 0, - ZYNQMP_PM_REQUEST_ACK_BLOCKING); - if (ret < 0) { - dev_err(dev, "failed to turn on TCM 0x%x", pm_domain_id); - goto release_tcm_split; + /* + * If TCM information is available in device-tree then + * in that case, pm domain framework will power on/off TCM. + * In that case pm_domain_id is set to 0. If hardcode + * bindings from driver is used, then only this driver will + * use pm_domain_id. + */ + if (pm_domain_id) { + ret = zynqmp_pm_request_node(pm_domain_id, + ZYNQMP_PM_CAPABILITY_ACCESS, 0, + ZYNQMP_PM_REQUEST_ACK_BLOCKING); + if (ret < 0) { + dev_err(dev, "failed to turn on TCM 0x%x", pm_domain_id); + goto release_tcm_split; + } } dev_dbg(dev, "TCM carveout split mode %s addr=%llx, da=0x%x, size=0x%lx", @@ -604,7 +613,8 @@ static int add_tcm_carveout_split_mode(struct rproc *rproc) bank_name); if (!rproc_mem) { ret = -ENOMEM; - zynqmp_pm_release_node(pm_domain_id); + if (pm_domain_id) + zynqmp_pm_release_node(pm_domain_id); goto release_tcm_split; } @@ -617,7 +627,8 @@ static int add_tcm_carveout_split_mode(struct rproc *rproc) /* If failed, Turn off all TCM banks turned on before */ for (i--; i >= 0; i--) { pm_domain_id = r5_core->tcm_banks[i]->pm_domain_id; - zynqmp_pm_release_node(pm_domain_id); + if (pm_domain_id) + zynqmp_pm_release_node(pm_domain_id); } return ret; } @@ -659,13 +670,16 @@ static int add_tcm_carveout_lockstep_mode(struct rproc *rproc) pm_domain_id = r5_core->tcm_banks[i]->pm_domain_id; /* Turn on each TCM bank individually */ - ret = zynqmp_pm_request_node(pm_domain_id, - ZYNQMP_PM_CAPABILITY_ACCESS, 0, - ZYNQMP_PM_REQUEST_ACK_BLOCKING); - if (ret < 0) { - dev_err(dev, "failed to turn on TCM 0x%x", - pm_domain_id); - goto release_tcm_lockstep; + + if (pm_domain_id) { + ret = zynqmp_pm_request_node(pm_domain_id, + ZYNQMP_PM_CAPABILITY_ACCESS, 0, + ZYNQMP_PM_REQUEST_ACK_BLOCKING); + if (ret < 0) { + dev_err(dev, "failed to turn on TCM 0x%x", + pm_domain_id); + goto release_tcm_lockstep; + } } bank_size = r5_core->tcm_banks[i]->size; @@ -683,7 +697,8 @@ static int add_tcm_carveout_lockstep_mode(struct rproc *rproc) bank_name); if (!rproc_mem) { ret = -ENOMEM; - zynqmp_pm_release_node(pm_domain_id); + if (pm_domain_id) + zynqmp_pm_release_node(pm_domain_id); goto release_tcm_lockstep; } @@ -700,7 +715,8 @@ static int add_tcm_carveout_lockstep_mode(struct rproc *rproc) /* If failed, Turn off all TCM banks turned on before */ for (i--; i >= 0; i--) { pm_domain_id = r5_core->tcm_banks[i]->pm_domain_id; - zynqmp_pm_release_node(pm_domain_id); + if (pm_domain_id) + zynqmp_pm_release_node(pm_domain_id); } return ret; } @@ -931,6 +947,8 @@ static int zynqmp_r5_add_pm_domains(struct rproc *rproc) } } + return 0; + fail_add_pm_domains_lockstep: while (--j >= 0) { device_link_del(r5_core->pm_dev_core1_link[j]); @@ -1012,7 +1030,7 @@ static int zynqmp_r5_rproc_unprepare(struct rproc *rproc) for (i = 0; i < r5_core->tcm_bank_count; i++) { pm_domain_id = r5_core->tcm_banks[i]->pm_domain_id; - if (zynqmp_pm_release_node(pm_domain_id)) + if (pm_domain_id && zynqmp_pm_release_node(pm_domain_id)) dev_warn(r5_core->dev, "can't turn off TCM bank 0x%x", pm_domain_id); } @@ -1087,6 +1105,83 @@ static struct zynqmp_r5_core *zynqmp_r5_add_rproc_core(struct device *cdev) return ERR_PTR(ret); } +static int zynqmp_r5_get_tcm_node_from_dt(struct zynqmp_r5_cluster *cluster) +{ + struct zynqmp_r5_core *r5_core; + int i, j, tcm_bank_count, ret; + struct platform_device *cpdev; + struct mem_bank_data *tcm; + struct device_node *np; + struct resource *res; + u64 abs_addr, size; + struct device *dev; + + for (i = 0; i < cluster->core_count; i++) { + r5_core = cluster->r5_cores[i]; + dev = r5_core->dev; + np = dev_of_node(dev); + + /* we have address cell 2 and size cell as 2 */ + ret = of_property_count_elems_of_size(np, "reg", + 4 * sizeof(u32)); + if (ret <= 0) { + dev_err(dev, "can't get reg property err %d\n", ret); + return -EINVAL; + } + + tcm_bank_count = ret; + + r5_core->tcm_banks = devm_kcalloc(dev, tcm_bank_count, + sizeof(struct mem_bank_data *), + GFP_KERNEL); + if (!r5_core->tcm_banks) + ret = -ENOMEM; + + r5_core->tcm_bank_count = tcm_bank_count; + for (j = 0; j < tcm_bank_count; j++) { + tcm = devm_kzalloc(dev, sizeof(struct mem_bank_data), + GFP_KERNEL); + if (!tcm) + return -ENOMEM; + + r5_core->tcm_banks[j] = tcm; + + /* get tcm address without translation */ + ret = of_property_read_reg(np, j, &abs_addr, &size); + if (ret) { + dev_err(dev, "failed to get reg property\n"); + return ret; + } + + /* + * remote processor can address only 32 bits + * so convert 64-bits into 32-bits. This will discard + * any unwanted upper 32-bits. + */ + tcm->da = (u32)abs_addr; + tcm->size = (u32)size; + + cpdev = to_platform_device(dev); + res = platform_get_resource(cpdev, IORESOURCE_MEM, j); + if (!res) { + dev_err(dev, "failed to get tcm resource\n"); + return -EINVAL; + } + + tcm->addr = (u32)res->start; + tcm->bank_name = (char *)res->name; + res = devm_request_mem_region(dev, tcm->addr, tcm->size, + tcm->bank_name); + if (!res) { + dev_err(dev, "failed to request tcm resource\n"); + return -EINVAL; + } + } + } + + return 0; +} + /** * zynqmp_r5_get_tcm_node() * Ideally this function should parse tcm node and store information @@ -1165,10 +1260,19 @@ static int zynqmp_r5_core_init(struct zynqmp_r5_cluster *cluster, struct zynqmp_r5_core *r5_core; int ret, i; - ret = zynqmp_r5_get_tcm_node(cluster); - if (ret < 0) { - dev_err(dev, "can't get tcm node, err %d\n", ret); - return ret; + r5_core = cluster->r5_cores[0]; + if (of_find_property(r5_core->np, "reg", NULL)) { + ret = zynqmp_r5_get_tcm_node_from_dt(cluster); + if (ret) { + dev_err(dev, "can't get tcm node from dt, err %d\n", ret); + return ret; + } + } else { + ret = zynqmp_r5_get_tcm_node(cluster); + if (ret < 0) { + dev_err(dev, "can't get tcm node, err %d\n", ret); + return ret; + } } for (i = 0; i < cluster->core_count; i++) {