From patchwork Fri Jul 1 10:47:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Peng Fan (OSS)" X-Patchwork-Id: 12903142 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AA11ACCA479 for ; Fri, 1 Jul 2022 10:45:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236957AbiGAKpv (ORCPT ); Fri, 1 Jul 2022 06:45:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43196 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235173AbiGAKpt (ORCPT ); Fri, 1 Jul 2022 06:45:49 -0400 Received: from EUR02-AM5-obe.outbound.protection.outlook.com (mail-eopbgr00089.outbound.protection.outlook.com [40.107.0.89]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EA4C974785; Fri, 1 Jul 2022 03:45:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=K1xWFacUY4ffSIo/H5WfztWxXasrH2DMUM6GuUWsl5vTHPWj5ZX98vHVEloMObKCOx5RxOLjHHShcmO2azuNUi7LhQEXQpgGiZGzoX5q9oY+pABURHyJWvCA0hUlwxLou9BnDu2WyT+cbgOc+9K5FuPw4n7OH1G48w5tCw2H1C/JC9htUVhnQ/PxUE/3c/fz+Xv1h64YP1+BNsRuG8KJWQ2mUln3XMI3c6cFEu296p9eYKvdJOMQOb3WXQFcx5YCve0614FJriYEfTExsaYMudVruqonsP+sPgZTFdAu05LeomslNa7HR4tbFONaOKr1OkB4ib8FIB22mzBW/ykavQ== 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=aNBSFZAt5BRu1uVRtvnSrPSzRusjNj7+XOCxOmz0WHM=; b=XMvDG57Yr1IbXLjgCYtf/Ewwl0EBzgJqpGRZAbCxPtfgHnc+y6ljodn1vt/7q9F1NEkrsL6E9332w6CoXFUx0vvWLz5gUeFPKJGiSMDodWF1/LWJr6zSjSVs8PcogGy5MeJpG3ugrme9I34DOg30xFyeQUjQ5mpueYUNcXtFxOvYwJmNaiYL9wIPk2Csva8TxiI9ZnTeaaW3BDc4qZ+88oMGZsfaMHVHEVjMd9Kbxv+70z8UNPNk4RQFa4VlqUOkLKRw4dGXL3bC+HCUbdw2jLWuVAkwXt3jqh3MOHXSsM5WAw7IvDMTn1yYxZ2SfgTQzrtzp4rEcnTZzJIB6P5ALQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oss.nxp.com; dmarc=pass action=none header.from=oss.nxp.com; dkim=pass header.d=oss.nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=NXP1.onmicrosoft.com; s=selector2-NXP1-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=aNBSFZAt5BRu1uVRtvnSrPSzRusjNj7+XOCxOmz0WHM=; b=lbROq/cdtQbIN+LS4jPmB0oBkA4dFcyc7h+V5XE2K/+AMXgXrS6mOVwmH8FOayt5yto7oDuQtgV/CiJbPDfLim8xCUmU7yMjKdvQ3Rxn8xvUi19TwJRhjCF4VUw7LF7Kz+cuF79DqOiLbF8VlGLpApEGiTwcn5NEc3+b2qF29uE= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=oss.nxp.com; Received: from DU0PR04MB9417.eurprd04.prod.outlook.com (2603:10a6:10:358::11) by AS8PR04MB7974.eurprd04.prod.outlook.com (2603:10a6:20b:2a1::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5395.15; Fri, 1 Jul 2022 10:45:46 +0000 Received: from DU0PR04MB9417.eurprd04.prod.outlook.com ([fe80::fdd4:8557:334b:180d]) by DU0PR04MB9417.eurprd04.prod.outlook.com ([fe80::fdd4:8557:334b:180d%6]) with mapi id 15.20.5395.015; Fri, 1 Jul 2022 10:45:46 +0000 From: "Peng Fan (OSS)" To: bjorn.andersson@linaro.org, mathieu.poirier@linaro.org, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org Cc: linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Peng Fan , Rob Herring Subject: [PATCH V4 1/6] dt-bindings: remoteproc: imx_rproc: support i.MX8QXP Date: Fri, 1 Jul 2022 18:47:20 +0800 Message-Id: <20220701104725.557314-2-peng.fan@oss.nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220701104725.557314-1-peng.fan@oss.nxp.com> References: <20220701104725.557314-1-peng.fan@oss.nxp.com> X-ClientProxiedBy: SI2PR02CA0034.apcprd02.prod.outlook.com (2603:1096:4:195::9) To DU0PR04MB9417.eurprd04.prod.outlook.com (2603:10a6:10:358::11) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: fe918483-6e4b-4bc0-0ea0-08da5b4eda8e X-MS-TrafficTypeDiagnostic: AS8PR04MB7974:EE_ X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: /TYQfH4FDSjSTuAyjtnNYncEKxS1vOsom/J77C2x7L14rUKB0F8ZvkhWo4517sOtqyy6txRpKLYFKPOODTS9L5aC4v9iMpYYRf/1ksrsDRPSxQQ3iL/oCKW+707jWj+Ty86eJHBTvn5gC2p5xeVs+/EiRZ4pffKqTfNVx0yxzqIaiQCG3yJ6AqIP6hUWa5+4fckhfbkq1cGKOyxT6MicFqtHl0abmZTy4oUqD0+x7r4o56dK8FPrRX+1biGcKa5zaZtCXrWoR+0JDHL0Ry4bxD9jbb4x+hpTJhjKgZT/LjiTCYdH3PInu25v8sHzvhnBBVRz5+w8FtZr8UK73XBNv82QxbWFDy+3CMGgMicCfkeY8RzJyI4utQ9AKX6QuKJdNA70A2ZLMxhdA0Wlb+VFng2f+ajwo0MhJ8wVXlJANk5UTROFku578cW/byaBgfK6NKTVtRGRCF5jx3r7zhdl7jopUXGBJNvYFMwUcitQWI7RUR1Fo+U2Xj/P+Qq6svYyDqQucRdzLFHMaMi7zrgP0QvOhHMhaLq82t+5hDTocOJiAhUpA01x9sEQLwzIdricMVWEaF70OanUmFj6lshJWsgwBIEj2ljAjkbJmMbWCYr6EMjDc5VAOjpDkavF2CHC35lKcWzs3uP4frw+zf0pqsKgCUHRUtQBNZpxjGK7mJrnwA5edilWAqx/LwhD9Osk7BAxOuBs9lHK7XI9arbqToBdRZB71oltLEe0d6G4qmFfWu4BjtQbob8ffZPrZPInPtO5NgPRzOhBijyjOh33mrNEQMcI/DNDLskEFB5WLS0rWG1G3uQqm8w/OMGl+L0P X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DU0PR04MB9417.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(4636009)(39860400002)(396003)(136003)(376002)(366004)(346002)(478600001)(7416002)(6486002)(38100700002)(38350700002)(66556008)(26005)(52116002)(6512007)(1076003)(6506007)(8936002)(86362001)(6666004)(2616005)(2906002)(186003)(41300700001)(5660300002)(4326008)(8676002)(316002)(54906003)(66946007)(66476007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: tgnhZrKUkij8I/1HXr2652eoezWTlEQ7/JRzfD28g8Q3t+oJJtZgQOpHOp50b/OYTrEhGcY9fSzwSi6rRned+6ysAS84GHRsHxcgtj+Rap7gqwfQm7k0IlQ7B0e0nNaUFBZE7wKw1ad894jI4eLOXXie78GE9Tgfn0qQYJU+MDn0GdneItwbodjfbk3FTzbPdfr8Ecz9SgbV7VXrQj8QO/gMY5cxG+5jJ8WsxmOs3hLnzC79Bu9hfl1Wl1uPX/iWgWl/lFt2r52BzTQIhUzf4rruXzOtxiiq6EyQssos+2rUQpB9IeXsA/D7ZGdX8rDrPymr5Irkp+/+Uq29QtiK6tcazWyN4kDN1kKuZ3uya/OnKknjMWJNxP+GgOJGTzZDtruV598GEDooKmlCOHy404m4e53Uvpd+fWYu1SFWEryd6JXKDVIhDtrIaanbzad+yOk2aI/HB0AVL+uWLRKTpCh4aYA94ptShsHECMke07DX2/fZVzOxn9LhmL4bptqqU1MshRyh14hpaqcQwla1lF14B2jDuW0fkdI9qZPC57qznaoJH/9fNA15RRjuuueLGxiMq116ilE+MmaRDIISUD8OzH0PH0GbQZ74+FbnpVLoNGWJIilsSzTQK1NB/1G19oi3n8fY+JFLI/piuPbUepCiZaL/pRVnar8zNHGQxErLM7dlvGloIijn72UrCfP2bWaOHeUFvZPJ5ms+MIEovtoCZA3Ufd/XswZ/We2chiOMAUfyksjvgOyLGXksYw1qNr6rRUjOqIfviKqQtVS6D/aALaXEgYjTckYRNoSIesBU4XcffVdOn69Px7t0/puvKPSazPFD3ord/Hw4dNK04fNlw/+RLUJl0KOA8t0zM7VDoq2HPlEekabWK18XJ4quYcQv81s3tdCEt3couWzxIVilJe1jT9RTPGE6OUdStdKbqJTJCpTI8OIpmgXxPyGGqmgmUT1CsNnHYEp70vg4Po8d3jBxjX4Bq6T5ZvGkhupYKH0cb2zK6Z0nRVLHaaVjh9CbweBWoWfOGp9k6OlIoKReHXqIWgO5Y8gPPwvSgFHRodZ0dtoOnLACAOemuJtB7fVBet7b1cDp+joDXR4/P3NCQlYNox9bVmReSI/6RUsmSLLT8EqRkiJEb6u1aRQQeITKKM6Xx/WslGBhMgrQ27D8TKKiTaSsRY788YhC1fHp0YeGjieSOUfK1dIH3kfXbb56ocqQ4cYvhsov+vFh3KqsJtgd+aq1ZHieypCH8rgbbDVSusxcfYK+dbN3yymfAm+5GFKkZuzSqQ/eGRaqAow+6LRvRiItGfIPq4p6jKIebuO1UiMUUgv/QBxv7tsxJGTwrmpLEQ0gYMr5s+UzvXp9HaWu210TOf/glhuhGQjEE16rw4mtCT1itca0HddjfT8AX25hH+Y6kqZVlwdBayWpZfiJqHwjqS0yMI5Jpa3UTmB41wThCeR01hiDn+xHv+7hx7lTLbjxtkiCbxx1OXWVbSfdczuyrmTe2eTwWq/LSnF/clFgYisqqVkKH+3qrIiNrA3bfj4lw8MGhXNj48Z1SmBQ8osxiZ5UD+N09Sq5oyq8kvCubz2V9tdpJilP X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: fe918483-6e4b-4bc0-0ea0-08da5b4eda8e X-MS-Exchange-CrossTenant-AuthSource: DU0PR04MB9417.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Jul 2022 10:45:46.0853 (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: bj3EbI80+KWCGBP1c9hMZgtnxA23Kn+0tWqomKELdq34EAE9lOoUOyfbFefboMFIcocP6JGeOyqhgwYlzT31qQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB7974 Precedence: bulk List-ID: X-Mailing-List: linux-remoteproc@vger.kernel.org From: Peng Fan Add i.MX8QXP compatible Add a new property fsl,resource-id for SoC which supports SCFW. This property is used to check whether remote process is under control of Linux or not. Add fsl,entry-address to specify the entry address which used by SCFW to kick M4. To i.MX8QM/QXP, when M4 is in the same hardware partition with Cortex-A cores, need power up M4 through SCFW, then M4 could start. So introduce power-domains property Signed-off-by: Peng Fan Reviewed-by: Rob Herring --- .../bindings/remoteproc/fsl,imx-rproc.yaml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/Documentation/devicetree/bindings/remoteproc/fsl,imx-rproc.yaml b/Documentation/devicetree/bindings/remoteproc/fsl,imx-rproc.yaml index 3a1f59ad79e2..70322e57b6ff 100644 --- a/Documentation/devicetree/bindings/remoteproc/fsl,imx-rproc.yaml +++ b/Documentation/devicetree/bindings/remoteproc/fsl,imx-rproc.yaml @@ -22,6 +22,7 @@ properties: - fsl,imx8mn-cm7 - fsl,imx8mp-cm7 - fsl,imx8mq-cm4 + - fsl,imx8qxp-cm4 - fsl,imx8ulp-cm33 - fsl,imx93-cm33 @@ -54,12 +55,26 @@ properties: minItems: 1 maxItems: 32 + power-domains: + maxItems: 8 + fsl,auto-boot: $ref: /schemas/types.yaml#/definitions/flag description: Indicate whether need to load the default firmware and start the remote processor automatically. + fsl,entry-address: + $ref: /schemas/types.yaml#/definitions/uint32 + description: + Specify CPU entry address for SCU enabled processor. + + fsl,resource-id: + $ref: /schemas/types.yaml#/definitions/uint32 + description: + This property is to specify the resource id of the remote processor in SoC + which supports SCFW + required: - compatible From patchwork Fri Jul 1 10:47:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Peng Fan (OSS)" X-Patchwork-Id: 12903143 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D91F9C433EF for ; Fri, 1 Jul 2022 10:46:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237008AbiGAKqA (ORCPT ); Fri, 1 Jul 2022 06:46:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43316 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237014AbiGAKpz (ORCPT ); Fri, 1 Jul 2022 06:45:55 -0400 Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-eopbgr70043.outbound.protection.outlook.com [40.107.7.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 59F627BD39; Fri, 1 Jul 2022 03:45:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TnSJyoUz3Pq0PGqObL4G5OLCwsigwWVlmHn7CWQ/1l78fz3EFBHIkviPJqaNkASUoQl9cqnGHvZ27QHRuaUr4fLQbdEhUimDp54dk7iFc+7/lbJ2w3c68/3G0EESY2rb+EYxEN2yHbNbX7XAn1kutM/QqL1aDzbclR9dM7B//CQfQSomx/sXUzBPaLlpTYX1ilzr6AT0msg7pQaJyUg5ODPnwzCXa+tj7CZkBnIoFW9PL/tJkx9L4nh30mGKyX3OtHfCrQR24ffPmfj975NHLzClpeuRnCA2/y3aWtJU+ChtclnuOJipFN3cazBbJ6IRB+O/+ffM8f/o4l/Y9pydYQ== 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=uGUA+yP1L7NkUSV3npgVQzouUiR4pfEI1f2e0J4XQtc=; b=mcgOQ4ksXQJ4POGy6NSx1sjMGqG5ErL7Yag5fUGQDEPtncnsVI0BJFKoOAN9382r2IoZK0/FelNxgFj1VqgO0DxD3ZGW7d3Irk+9VFnh5MDBTvs+cDD6Tgmvay1bXjAiCUFZLaXez4IaMay3ewjA0arx6nH/GJwVHnh3dbtkpl7h23jpQpD+54CuW/lh03ombRyifs2mn+MG6QUVcc9z/EnjdVIhjHAK9QitXG6HFWvZh/5ytnTAwRn/QsLV2b07Mg+EEzF4RlKcxkXoBsl6BuvrvpPOs8IzTD/POclXb/FWsGGtgPWjFZYrtaTWmjw61iee7ZrS2DyXgSHIUFVDUg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oss.nxp.com; dmarc=pass action=none header.from=oss.nxp.com; dkim=pass header.d=oss.nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=NXP1.onmicrosoft.com; s=selector2-NXP1-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=uGUA+yP1L7NkUSV3npgVQzouUiR4pfEI1f2e0J4XQtc=; b=Esmn+d/GKDnbRAopMmY1esNZc3nhJF52Gctq7fJO/LO0MvKjjjrSbFDpP/kdEMjGWSuljoISfawmzHLZg7PPE/kDkLw2Db6YOGFdRIwwM3ChUm15FgYjyXGdONIWAgwVB2AUrFEcrQioTDGPGie5o37uCbW3gpc5cI+Tn9CLXXM= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=oss.nxp.com; Received: from DU0PR04MB9417.eurprd04.prod.outlook.com (2603:10a6:10:358::11) by AS8PR04MB7974.eurprd04.prod.outlook.com (2603:10a6:20b:2a1::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5395.15; Fri, 1 Jul 2022 10:45:50 +0000 Received: from DU0PR04MB9417.eurprd04.prod.outlook.com ([fe80::fdd4:8557:334b:180d]) by DU0PR04MB9417.eurprd04.prod.outlook.com ([fe80::fdd4:8557:334b:180d%6]) with mapi id 15.20.5395.015; Fri, 1 Jul 2022 10:45:50 +0000 From: "Peng Fan (OSS)" To: bjorn.andersson@linaro.org, mathieu.poirier@linaro.org, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org Cc: linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Peng Fan , Rob Herring Subject: [PATCH V4 2/6] dt-bindings: remoteproc: imx_rproc: support i.MX8QM Date: Fri, 1 Jul 2022 18:47:21 +0800 Message-Id: <20220701104725.557314-3-peng.fan@oss.nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220701104725.557314-1-peng.fan@oss.nxp.com> References: <20220701104725.557314-1-peng.fan@oss.nxp.com> X-ClientProxiedBy: SI2PR02CA0034.apcprd02.prod.outlook.com (2603:1096:4:195::9) To DU0PR04MB9417.eurprd04.prod.outlook.com (2603:10a6:10:358::11) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 426a341d-6627-4036-7421-08da5b4edd14 X-MS-TrafficTypeDiagnostic: AS8PR04MB7974:EE_ X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: VCc2s3QJza9AFNp0bB7tPjYWoEJYCajlcx8z4drE7eEa0viL0yLmbh+KlkcNPr1JL3EzSs7XjGL6TtmleMyoSyg08RAfrTx2OMMMbYJPQeAsHfEGCXu7WhTC6oJXj3obXvVNJNGsD20KSYdgejq0ccuuSOEnnb+0IVRmdT5TaP7xNDCgPcZKHz1dalQ1oKXMBMVNrP7otY4ZDEmYsl9My70/fkiwT6oYulli9GLrntkyaaq2tvN2iWN7H6wJHtYifuNFCx+iGNBh0hdE1rUnWelBrmeHlqcWHorwGPBBVwKCxsP/O1KyeuG68bXrp71bQemoCrBT21xNdHvkyHaf4rJ0EQBQu29mIPhUscAIVKoBoF0rptltDPuq2DmIWx0Tz2OsPnEOJLa0VBz/Pq8xyk2ktGkKYRehx9UFYMbUADF6LaPY7DC5ZRLKWSQapOmszQG8mbu9nfyrCUDATrPDh2b599htl1h1sXvrwQqduBQk7/VKvyhGAX3wZrp26giP5lD8PfERY26+RcfhSM2UVVYErs4b3dksuu5DCZTICKRbJDPjibOyUTgXayTvgE3vhWtE/NUEO1LlwJ6ZsyfkGstxR4hQd/tQG5Oy9uwZ+/23Evkfs2KpmuPP0fpNaiPjkYSOonxqbnPbAnotDiJghnaOua/buc/2hxTGW8vyczVGOWuJFxvdHfGH6iyJBp1M2Z4BkbHYof5coa2flZDy+384qeXrBWdZGhdsjYWD1ChayCYHn5bZ4NAoJ13fFXYJdbyy3x4hCrpX06UNjrXvTZ+qtHtNyXTAiI6O0Y554RiL5C+CUq5zbHv4uwNY2/iF X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DU0PR04MB9417.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(4636009)(39860400002)(396003)(136003)(376002)(366004)(346002)(478600001)(7416002)(6486002)(38100700002)(38350700002)(66556008)(26005)(52116002)(6512007)(4744005)(1076003)(6506007)(8936002)(86362001)(6666004)(2616005)(2906002)(186003)(41300700001)(5660300002)(4326008)(8676002)(316002)(54906003)(66946007)(66476007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: xnxks3vSE/Qe/ShEU7dD6I/uZpa3um9wLXzFu9F0dQLtZUop7zQA7vQT1H/IIClamuxdDz7GrpHrYcol6O9qB9fSkxoGluIJNeros36WSCmBRZUVKBEZyA8QonlYdEonNYLCbN1VZfIeQoFRaYEEKrlBdDJnVFXMHTfvXgqQFkjLUNJGQk13nfUa4w1PgxtO28A334ReoJs4fjdsXXbTl6cRrRiGKdpJ284osF1T0EwnEIxQPdHby/wO24s9MnAdW98qQugKDVPZZokgSHdfttqHFeN9ZaZTQKcBFQOFMv5gB1e9yPEckKsI0ZyenLKzhBeq9/xr15U2OJ/FIpUul9mTvb/TDNxWkq7qecHdybTyh18uz5dZuJFjk/IMViVwkCXVD21jjojUp3rzntKRGwr6aWdVyQan17z2huZuDUnzjZGPXcxRB8RMlaSLhbUul1ZwkJtoslfOVld8jPRd7yPGcbMLHuSwwM6bk0PgdIt8t4dbHO0h9zOslC9JrldeuLQrX1KWduqxCpCjaQ5S9g+akV2Z3I0+BvGaMIlzIXrAmnwc4BSTRHfhaSn5qN8zoN+boBiU1o2tS9r+IDlO0MNb9UHSQFOgFv8PcDxRRGJrozdy3qysrvagKLc4M1zXKYQk0aAOgrOLdFDMcX/hQ7ujnIPvIUb8O796lhlujlOUSNM1yXf/7SKPheZ4MaHj/Kb2BmyGz1NYjusGCzRTj4M5q70yytk0kL+xFQ4dRmhxV8pUO/AGDYdRJoDrWSLljfVCDM2HXi/xVZnVuFoPSyG3JGmV5p6JThTt/dQbhr/PLsX74MK8PPzexIzyKrcsCH6LdAi2EnmLi4eTYGYDEHUn0KMjiOjOF/AaIP5yT4cf0P3fz4Cw5R44r6PDVKrEITO72vx4kafWDZO2a4XUUI5ckAAhrU69XdqgVTc/ctRKT6GRsFQ6nsxx0BrvsddPzq+kdoxopDtOwUPk0FRcWHcXamtJd99KD1vrwMlvtF+Y03R7Gyc/zcWBnSK83HCxz+NQAZTJDn9yZLnF1yK38OiqJ1HYvWuTWAM3HQI5OlEgMmJOwNXEJxGoNRQGIwKA2DD5a9hS5SmG5NZ/fS1jH/45oJOz114gy2jNNggpfjQ30YZjNwO4dLNyhlAMdmBW92WpRtbXA4aDrCqUXxRrns7IlzzVaae9TCSzFe8wOCCCGw1qN8BfRfHsLblRJRJCTgs9/dPzN5rT8y/114fNXw8DckojrjUTxetp/y3M/thA8PJMOxuL4YeluPwfrUEfQcvIAeCqjLx2FlpsY2lla3WXDdfBOiEfwmAD6uT7DZl/vKsmbChUUojP3DAPfbjC7QC6jWdVTmgOYoaUcUXI1qdxlH9ALotUYXwbY2Ah2Dqe3RX4T66hJCQKZQceXfzITf+4WKrKkbpMhUdBB/c1i+yFQ/B7JPJVQjn05knNvc+Pec8M1tfI+8sIKei4SroxfSRZClOAFr4/KAIaFZJHFsota5j82UhmWaxTsZwVRMUJF09pIXsxNFAAhs+/raBDRD6q6JMoXec+hIhzQ6+l/Zvns4d5mBBjeU2gQhgCf7t62yG/mxxCvDJyBdzTEn13 X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 426a341d-6627-4036-7421-08da5b4edd14 X-MS-Exchange-CrossTenant-AuthSource: DU0PR04MB9417.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Jul 2022 10:45:50.4011 (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: p1ihP0PRT3rRTF6kxoWFRKTIhfKbt3MHXBACOOaWuZKwGq7vw1jvnHLqO9G8A/ieNi7KYyDOg9b6PC6VjE29Dg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB7974 Precedence: bulk List-ID: X-Mailing-List: linux-remoteproc@vger.kernel.org From: Peng Fan Add i.MX8QM compatible Signed-off-by: Peng Fan Reviewed-by: Rob Herring --- Documentation/devicetree/bindings/remoteproc/fsl,imx-rproc.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/Documentation/devicetree/bindings/remoteproc/fsl,imx-rproc.yaml b/Documentation/devicetree/bindings/remoteproc/fsl,imx-rproc.yaml index 70322e57b6ff..64e783234e38 100644 --- a/Documentation/devicetree/bindings/remoteproc/fsl,imx-rproc.yaml +++ b/Documentation/devicetree/bindings/remoteproc/fsl,imx-rproc.yaml @@ -23,6 +23,7 @@ properties: - fsl,imx8mp-cm7 - fsl,imx8mq-cm4 - fsl,imx8qxp-cm4 + - fsl,imx8qm-cm4 - fsl,imx8ulp-cm33 - fsl,imx93-cm33 From patchwork Fri Jul 1 10:47:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Peng Fan (OSS)" X-Patchwork-Id: 12903144 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A769AC43334 for ; Fri, 1 Jul 2022 10:46:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237029AbiGAKqG (ORCPT ); Fri, 1 Jul 2022 06:46:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43360 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235173AbiGAKp6 (ORCPT ); Fri, 1 Jul 2022 06:45:58 -0400 Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-eopbgr70052.outbound.protection.outlook.com [40.107.7.52]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 09DF57BD01; Fri, 1 Jul 2022 03:45:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=oTMcci2SvgXMBOK8/rwwgUVh/w9I94/3gnTPJsYNVRM5V1g4I5wxx/pj2zLAP3sWmjQQWkbD0rjzSFgaS9Ak+kKNO8yjmhffGgkMPm/uSFmXxFdfyazDscCIJSDxj3fVBeQuha3MDcDtOY7oih2mVd1SWjBWM8wdux7vJ8ENth3mTzvDVqyNC0FvCaoU2FPeCtXQthH6nnZcQDAkJvJ3hNuAH7JS9rcIUeMjoljyBV0+4nEXrOUJaxf98Z0uOnEUXbY8MskIO7QEbum4FYeb7CW56e91a7kFJMKjGQAFBFjQ9lsYsPaVzW8OkRTYfKF+luA0ezi5GWSU/yYZQkn6bw== 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=GnXgE9KyzusAYxkS1U5R/pbM/b8oI8CUuzm9Cqr1SJ4=; b=Z5O+cVMcvUYrGNM7BDO2h7pqlx3v9T5p/mkl/liJjyvf2eMpfk5703In/u6c78zsp232llVjxud1bNQiYcBbd0n58MvF794mHOlbp8q1nc3+wwkvwCfWKJQ4C1F3uCHUS72j+NH1MTWvyqtgVpb2YDtg4iWs6uVSrbRaYHSMekr4NfNH6KsJ/qPwLfSRGsiZ9duTF+xJgRbKd0SSe3ZYvFLJh7jgTIzEm/Rp7ij6aZypJCnhWIKsWyAOYr/QHIOKKF62J1UZYWzLU388AotuV/nTrWVJWNfvrTDDSm7o1J6JyCgnp14PWziQMe/7a9uIln9Je0DHzi8OMzGk0M+qjA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oss.nxp.com; dmarc=pass action=none header.from=oss.nxp.com; dkim=pass header.d=oss.nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=NXP1.onmicrosoft.com; s=selector2-NXP1-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=GnXgE9KyzusAYxkS1U5R/pbM/b8oI8CUuzm9Cqr1SJ4=; b=eWKV0tj/6omGM69brT4KY/GQHKtvtGQsUWD7BQTLrsZR9lmAGVvExSEfHd6bg6cPqP8GCGPQYeNuC0btDauc/tvrUtT8YF3S33/PQQhovtgTN+Qc8Y3v5CeTMFsyIkF3m067hSB+iKW9LZ9GNFyuXSzimZPRKUZTKVdOA/wp+z4= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=oss.nxp.com; Received: from DU0PR04MB9417.eurprd04.prod.outlook.com (2603:10a6:10:358::11) by AS8PR04MB7974.eurprd04.prod.outlook.com (2603:10a6:20b:2a1::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5395.15; Fri, 1 Jul 2022 10:45:54 +0000 Received: from DU0PR04MB9417.eurprd04.prod.outlook.com ([fe80::fdd4:8557:334b:180d]) by DU0PR04MB9417.eurprd04.prod.outlook.com ([fe80::fdd4:8557:334b:180d%6]) with mapi id 15.20.5395.015; Fri, 1 Jul 2022 10:45:54 +0000 From: "Peng Fan (OSS)" To: bjorn.andersson@linaro.org, mathieu.poirier@linaro.org, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org Cc: linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Peng Fan Subject: [PATCH V4 3/6] remoteproc: imx_rproc: support attaching to i.MX8QXP M4 Date: Fri, 1 Jul 2022 18:47:22 +0800 Message-Id: <20220701104725.557314-4-peng.fan@oss.nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220701104725.557314-1-peng.fan@oss.nxp.com> References: <20220701104725.557314-1-peng.fan@oss.nxp.com> X-ClientProxiedBy: SI2PR02CA0034.apcprd02.prod.outlook.com (2603:1096:4:195::9) To DU0PR04MB9417.eurprd04.prod.outlook.com (2603:10a6:10:358::11) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: c9f77de5-9a43-4881-0e14-08da5b4edf83 X-MS-TrafficTypeDiagnostic: AS8PR04MB7974:EE_ X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: AVyus8ecMysFvbrcyPUhjp8vug5iWbH26ivyKy49nZoEb1lZVIMfjQkfrzGhtaxmPbchWUrSpWuy4FhGo6aI4MPsYac2/ecGYTSZYdl3DEatNh62NjIebU9AwXGcswPWb3aMSr68QoE/rDua6/Ld0sXlf3oHs0E4MUCPRvUWlILATUT4HQe21qKhAh1nkWUeZaOAAfEqLmYr2ye0cFTiBFHPSlp8iw3EyQPSVfTjfk6l/8y8CEpYaOfsYze/rePiL7CrSI1tm2fDMaECIIHBgK4TP6XzcJS5dZzl2shRYgqhWOP5vFONKcjiURzmyypMOwOFp1/zKUgKCgmIlYzen9dRLaqJelCMOmGtnWqLHII0VaZkjMDeXn+aiSmy3hQZhiKUxIa2pVb8HFUJ56qCX6N5JJPeaaMPr2UuJrzhvUWZpwORX7G9a4eteBAU0vfNjnqMoWpNDvF0ZjkGC4nms6b4mIWWI6eG6Tbp5vNl61+95TrvxZESVQd9ijd2vDKHDyyiiox1jNUiN0i9Lbj8+8rRH+9F0hO9C1uu6x/Tr1JO6PA7FCLHeGBOYR8EP+6kuW5NMa0dzrHFICRkv1TgPLmiibyJx0agOMgy9VbxUS1QCiLH/sREUm+PZisuLnBE1TGASF7xbTfKHWe8GTujAWG3bX1QQHjoqRpoa+5I7VSjQUTY4v1XpdCccaXOJRZqbrh7zN85/5dgDKYXvihnLEt7sbybRrrbr+7bKahUIuw9HhwcMEKkYTvbNjwH3iKiYnhPKOFZSyTFD0Yu5Xk877xcJ3B2QBgvn54z1x8ruLzRcDzGhb9BZJQk0VO7f0dr X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DU0PR04MB9417.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(4636009)(39860400002)(396003)(136003)(376002)(366004)(346002)(478600001)(7416002)(6486002)(38100700002)(38350700002)(66556008)(26005)(52116002)(6512007)(1076003)(6506007)(8936002)(86362001)(6666004)(83380400001)(2616005)(2906002)(186003)(41300700001)(5660300002)(4326008)(8676002)(316002)(66946007)(66476007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: lsn1asuOzynjL2Bq2V70tCtQo9/XK1CDNR/p0rOiWHgjXX2Ursa7RrjvY+1T/z0PwKjcOXp5ZqLBILeRTB174nCjx5GgKlNj3AZ/bFiTTqf6nfy/RgjHHpN9QWpUA+F0rzEwv5B8RwTeUFg++EzMY+GRH7QOwpcNtSccd3Pj4A9mOM4i1q6lYGyetR76Wo7WZ8KvghoJva8d811zlcOhp59EQDBkLn3dqoX0mDwDoJMkUmm8Hb48GmSPae/xsB5kKjm6tEFb3pQjN4tFneuNaPfkUR6/Xshf8KoE9jFU6TQ0KzRAJtkMovRsu+xrbZlVuPvJIXerajPS88KlZ8ss7VOzTbXO6BLBj7XVYVFC+9vLNXLXPXJY0uhfHnHLnQm6X1VeRWx7DDBvwB2PHmpdK082ftHyKyY16UtvRWL7UIKvgsKsUrZ8dMH2CDC7dcDuC19DuDL+T/pRHaO+UAxfYcXk3EywUqpg8Lanxfk0SuP2huHMGlm4zMyRsxXL/j5K4BM+TtGb68bDEgfbYsLWFIZRVYYi3SrLgig1li3ZcckjYZiENE3tD3z9dUrP/GfrPY0SahjiBlrCOFRoe+VLZvyuP9Ewuqec4qkJ6wC+VPTKWJtADr3s7NFt9Ol9ivSv76sZHe1su5wq/oca4Yv8v9owywD2b308LH9MxFzuQOl+MKCJ4sX8K77+Ya4AZvyxy+pTt9Gjn7gukFxZTuNwq1POikryyvaWU8l+JE4zZuAUZ09npq5tAOEkuIyxfOkkKzZG9xtvr3W1hUyurG5iaBmZV3WZ5VAOYeCYWqgKdhTHQzV9rbN/GzWiz+0NK4ae0m6DJ07gU9Kb6Wiz1aXJvcT06X038vn20FmTlaaH7K4A19QFKvOvFqDhDrRviwcCNur7+pW7KadCOjPVXp+9I5GkZt+7kmCyWHV6NEhZA+Xx+WiHLhTOZRo+pLOka3OOXZMICWhWDkp0810m89jGH2hwQNxr4cKYp90YjRe2mlN3/vpE8GVOR1HFSl4GHEAsYMRtjExd4pXQRXNjKDZJdemBvX3W7TD4wkebjA8Ea4A/DTf0IZbL9HnA1ZsEx9pyxDy3GkJXpzNieGqF6toZ+LtNQKWmee6MyMfD1YIKBNcN5sVC4yaMUtLKNk86p2wVgoweyu76YFVUUfMHkyEsfEVK1XgkrvbAuY48Kefc9Jjrep4gv9DL1ZqmP6Wb3/lUaBa1kNh0PNMwc43JQrm1CIYyaL02AzCT8DHyYSxlUIF6fWquaClc2iVdECubGVWpn5szySNxi1bE2vd0vgrIrTk31S4YQCk5Owk73RxEaaSFZv5bOUKKsKaM8NrLq7k2DZ1XZHVPHgi0aAhERjZkpbgd/K+pwb+u/vWJft9k1pkR0nMQ0iY12T4ZylZYLVUFuXVoRT2sioZfDpdu2qcBdrCMcPIGg606k7G2YdG92zMAU1SDyDzNbpBGNJvkH+qhOQEyMae6cqSgNiglh5XLftrO98sPxuC1VpybXYWlvN0g7DYuzJ0BOsPGmN6WpbZVaRujnKUxeejDqwANTgEfoI/T2B2iCKCqKnLkew+pKmJiE6b+KJRlh1n7mG3kx7MF X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: c9f77de5-9a43-4881-0e14-08da5b4edf83 X-MS-Exchange-CrossTenant-AuthSource: DU0PR04MB9417.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Jul 2022 10:45:54.3405 (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: USM83StVBZmFZqKKKV6KJiHxhYVrl8KjroOlRCWhLXTqkfbQPKNlYtI2klx9QZfP0KsTXoSesQ9HBY+s8QrTnw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB7974 Precedence: bulk List-ID: X-Mailing-List: linux-remoteproc@vger.kernel.org From: Peng Fan When M4 is kicked by SCFW, M4 runs in its own hardware partition, Linux could only do IPC with M4, it could not start, stop, update image. We disable recovery reboot when M4 is managed by SCFW, because remoteproc core still not support M4 auto-recovery without loading image. Signed-off-by: Peng Fan --- drivers/remoteproc/imx_rproc.c | 108 ++++++++++++++++++++++++++++++++- 1 file changed, 107 insertions(+), 1 deletion(-) diff --git a/drivers/remoteproc/imx_rproc.c b/drivers/remoteproc/imx_rproc.c index 38383e7de3c1..1ce692a72946 100644 --- a/drivers/remoteproc/imx_rproc.c +++ b/drivers/remoteproc/imx_rproc.c @@ -6,6 +6,7 @@ #include #include #include +#include #include #include #include @@ -59,6 +60,8 @@ #define IMX_SIP_RPROC_STARTED 0x01 #define IMX_SIP_RPROC_STOP 0x02 +#define IMX_SC_IRQ_GROUP_REBOOTED 5 + /** * struct imx_rproc_mem - slim internal memory structure * @cpu_addr: MPU virtual address of the memory region @@ -89,6 +92,10 @@ struct imx_rproc { struct work_struct rproc_work; struct workqueue_struct *workqueue; void __iomem *rsc_table; + struct imx_sc_ipc *ipc_handle; + struct notifier_block rproc_nb; + u32 rproc_pt; /* partition id */ + u32 rsrc_id; /* resource id */ }; static const struct imx_rproc_att imx_rproc_att_imx93[] = { @@ -117,6 +124,18 @@ static const struct imx_rproc_att imx_rproc_att_imx93[] = { { 0xD0000000, 0xa0000000, 0x10000000, 0 }, }; +static const struct imx_rproc_att imx_rproc_att_imx8qxp[] = { + { 0x08000000, 0x08000000, 0x10000000, 0 }, + /* TCML/U */ + { 0x1FFE0000, 0x34FE0000, 0x00040000, ATT_OWN | ATT_IOMEM }, + /* OCRAM(Low 96KB) */ + { 0x21000000, 0x00100000, 0x00018000, 0 }, + /* OCRAM */ + { 0x21100000, 0x00100000, 0x00040000, 0 }, + /* DDR (Data) */ + { 0x80000000, 0x80000000, 0x60000000, 0 }, +}; + static const struct imx_rproc_att imx_rproc_att_imx8mn[] = { /* dev addr , sys addr , size , flags */ /* ITCM */ @@ -255,6 +274,12 @@ static const struct imx_rproc_dcfg imx_rproc_cfg_imx8mq = { .method = IMX_RPROC_MMIO, }; +static const struct imx_rproc_dcfg imx_rproc_cfg_imx8qxp = { + .att = imx_rproc_att_imx8qxp, + .att_size = ARRAY_SIZE(imx_rproc_att_imx8qxp), + .method = IMX_RPROC_SCU_API, +}; + static const struct imx_rproc_dcfg imx_rproc_cfg_imx8ulp = { .att = imx_rproc_att_imx8ulp, .att_size = ARRAY_SIZE(imx_rproc_att_imx8ulp), @@ -684,6 +709,37 @@ static void imx_rproc_free_mbox(struct rproc *rproc) mbox_free_channel(priv->rx_ch); } +static void imx_rproc_put_scu(struct rproc *rproc) +{ + struct imx_rproc *priv = rproc->priv; + const struct imx_rproc_dcfg *dcfg = priv->dcfg; + + if (dcfg->method != IMX_RPROC_SCU_API) + return; + + if (!imx_sc_rm_is_resource_owned(priv->ipc_handle, priv->rsrc_id)) + return; + + imx_scu_irq_group_enable(IMX_SC_IRQ_GROUP_REBOOTED, BIT(priv->rproc_pt), false); + imx_scu_irq_unregister_notifier(&priv->rproc_nb); +} + +static int imx_rproc_partition_notify(struct notifier_block *nb, + unsigned long event, void *group) +{ + struct imx_rproc *priv = container_of(nb, struct imx_rproc, rproc_nb); + + /* Ignore other irqs */ + if (!((event & BIT(priv->rproc_pt)) && (*(u8 *)group == IMX_SC_IRQ_GROUP_REBOOTED))) + return 0; + + rproc_report_crash(priv->rproc, RPROC_WATCHDOG); + + pr_info("Partition%d reset!\n", priv->rproc_pt); + + return 0; +} + static int imx_rproc_detect_mode(struct imx_rproc *priv) { struct regmap_config config = { .name = "imx-rproc" }; @@ -693,6 +749,7 @@ static int imx_rproc_detect_mode(struct imx_rproc *priv) struct arm_smccc_res res; int ret; u32 val; + u8 pt; switch (dcfg->method) { case IMX_RPROC_NONE: @@ -703,6 +760,51 @@ static int imx_rproc_detect_mode(struct imx_rproc *priv) if (res.a0) priv->rproc->state = RPROC_DETACHED; return 0; + case IMX_RPROC_SCU_API: + ret = imx_scu_get_handle(&priv->ipc_handle); + if (ret) + return ret; + ret = of_property_read_u32(dev->of_node, "fsl,resource-id", &priv->rsrc_id); + if (ret) { + dev_err(dev, "No fsl,resource-id property\n"); + return ret; + } + + /* + * If Mcore resource is not owned by Acore partition, It is kicked by ROM, + * and Linux could only do IPC with Mcore and nothing else. + */ + if (imx_sc_rm_is_resource_owned(priv->ipc_handle, priv->rsrc_id)) + return 0; + + priv->rproc->state = RPROC_DETACHED; + priv->rproc->recovery_disabled = true; + + /* Get partition id and enable irq in SCFW */ + ret = imx_sc_rm_get_resource_owner(priv->ipc_handle, priv->rsrc_id, &pt); + if (ret) { + dev_err(dev, "not able to get resource owner\n"); + return ret; + } + + priv->rproc_pt = pt; + priv->rproc_nb.notifier_call = imx_rproc_partition_notify; + + ret = imx_scu_irq_register_notifier(&priv->rproc_nb); + if (ret) { + dev_warn(dev, "register scu notifier failed.\n"); + return ret; + } + + ret = imx_scu_irq_group_enable(IMX_SC_IRQ_GROUP_REBOOTED, BIT(priv->rproc_pt), + true); + if (ret) { + imx_scu_irq_unregister_notifier(&priv->rproc_nb); + dev_warn(dev, "Enable irq failed.\n"); + return ret; + } + + return 0; default: break; } @@ -807,7 +909,7 @@ static int imx_rproc_probe(struct platform_device *pdev) ret = imx_rproc_clk_enable(priv); if (ret) - goto err_put_mbox; + goto err_put_scu; INIT_WORK(&priv->rproc_work, imx_rproc_vq_work); @@ -824,6 +926,8 @@ static int imx_rproc_probe(struct platform_device *pdev) err_put_clk: clk_disable_unprepare(priv->clk); +err_put_scu: + imx_rproc_put_scu(rproc); err_put_mbox: imx_rproc_free_mbox(rproc); err_put_wkq: @@ -841,6 +945,7 @@ static int imx_rproc_remove(struct platform_device *pdev) clk_disable_unprepare(priv->clk); rproc_del(rproc); + imx_rproc_put_scu(rproc); imx_rproc_free_mbox(rproc); destroy_workqueue(priv->workqueue); rproc_free(rproc); @@ -856,6 +961,7 @@ static const struct of_device_id imx_rproc_of_match[] = { { .compatible = "fsl,imx8mm-cm4", .data = &imx_rproc_cfg_imx8mq }, { .compatible = "fsl,imx8mn-cm7", .data = &imx_rproc_cfg_imx8mn }, { .compatible = "fsl,imx8mp-cm7", .data = &imx_rproc_cfg_imx8mn }, + { .compatible = "fsl,imx8qxp-cm4", .data = &imx_rproc_cfg_imx8qxp }, { .compatible = "fsl,imx8ulp-cm33", .data = &imx_rproc_cfg_imx8ulp }, { .compatible = "fsl,imx93-cm33", .data = &imx_rproc_cfg_imx93 }, {}, From patchwork Fri Jul 1 10:47:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Peng Fan (OSS)" X-Patchwork-Id: 12903145 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 12778C43334 for ; Fri, 1 Jul 2022 10:46:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235791AbiGAKqN (ORCPT ); Fri, 1 Jul 2022 06:46:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43454 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237064AbiGAKqE (ORCPT ); Fri, 1 Jul 2022 06:46:04 -0400 Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-eopbgr70081.outbound.protection.outlook.com [40.107.7.81]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4BB817BD26; Fri, 1 Jul 2022 03:46:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QRfz1+odHIiW155O8xKFpb/BZ7yydnjhIq0xKxgb3DX2xC7XzxH75g6cauW4IEyLfB9k42Z8ApE2Zkb8geu59f9Rdxc36ijqjwVlfsgXZvtkarD8k2zfrY1QceKEJfCTvV85sR+FpmlbruTu9yPBrKfWL4XGxBFdCQyXwoT+8l7RYJCYNSXtMZ9yPlFYyOKt4ACXcVAFeeOwhnDAKUN2U7qejBNJnZqhp38dmctEhsnXW+lsJlM+ZwRuGcwLxCBW5hgotYrqSTo5CI8Tl5TFSohoA3NB/QmTRZE7DduenpJxKBoZJzCx7MUmocX3mz0y5iZ71VaEo6RohRDTpYwjnA== 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=5L0/Bds7zEIw0DEvvUF/ZAUPes1W6xbaVPzlAFJJ27w=; b=RVcHPhaIGSIKeH5H1KwgYPfttoxSr0Z0ndO/VdW8P1qW8hFeW8w4yIdIz/AIZXIfQ74hhIOROUlSrIEHZ90MNsu7TQFXIlhKnPwOldNvR4qpeYKBqaSBj/U318DLVsCpoQeWZ5APOUryfPSoZdCh/zD67JLSjfOJUJbXNQLY5fINR2Skcqg+IeMDXD9hfz53NSN2pZBPDh+9hy7J9ZtqCELzYalpWh1oU+USz0f7s/EnOpUoa57S6kwI9JbbqskXojsyQLRFZ0kzddHGxx02W/f8oXb/9FTaLSG6Bt2hDO445rHvSp0uEbfW6O+tEOpwH0CTnIFIObciRLg8UqAXCg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oss.nxp.com; dmarc=pass action=none header.from=oss.nxp.com; dkim=pass header.d=oss.nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=NXP1.onmicrosoft.com; s=selector2-NXP1-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=5L0/Bds7zEIw0DEvvUF/ZAUPes1W6xbaVPzlAFJJ27w=; b=Toimns/UQ2uEdmBpAfRJWAEf2lNMlKIv04sV7PjGYXJLa84/73ZwNOyYW7mPLLg1ya2WLwbLsVJtnMBf7lV+szqHxXDe2oT2FjeqaPjNNMt0KU1CNKnRmQwbjtlg4Jg3aZAvpA1Dy3C3nvxP5amztCRzqe0t4N5D5U5exqCk/8A= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=oss.nxp.com; Received: from DU0PR04MB9417.eurprd04.prod.outlook.com (2603:10a6:10:358::11) by AS8PR04MB7974.eurprd04.prod.outlook.com (2603:10a6:20b:2a1::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5395.15; Fri, 1 Jul 2022 10:45:58 +0000 Received: from DU0PR04MB9417.eurprd04.prod.outlook.com ([fe80::fdd4:8557:334b:180d]) by DU0PR04MB9417.eurprd04.prod.outlook.com ([fe80::fdd4:8557:334b:180d%6]) with mapi id 15.20.5395.015; Fri, 1 Jul 2022 10:45:58 +0000 From: "Peng Fan (OSS)" To: bjorn.andersson@linaro.org, mathieu.poirier@linaro.org, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org Cc: linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Peng Fan Subject: [PATCH V4 4/6] remoteproc: imx_rproc: support kicking Mcore from Linux for i.MX8QXP Date: Fri, 1 Jul 2022 18:47:23 +0800 Message-Id: <20220701104725.557314-5-peng.fan@oss.nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220701104725.557314-1-peng.fan@oss.nxp.com> References: <20220701104725.557314-1-peng.fan@oss.nxp.com> X-ClientProxiedBy: SI2PR02CA0034.apcprd02.prod.outlook.com (2603:1096:4:195::9) To DU0PR04MB9417.eurprd04.prod.outlook.com (2603:10a6:10:358::11) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: cd25db2b-3b43-4b88-31b5-08da5b4ee1db X-MS-TrafficTypeDiagnostic: AS8PR04MB7974:EE_ X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: kjTKUuymbedbUxejOl80ZqlsKZGILPMgSRgV9RkS4o59OA3fb//usrNdZEynnNooiH47+mTWEroMu/gVbxcfPVjLDxQ+NMLz7eyZeYP3EJrLsqMClhunK7u+1At7cWqyFdxeR0mO8OcfxoCU2CDl2N6Z/tTIvcph8Ibw47Vk6us7GL63Canj0EQQ8Co16FKZ/z+ZB+Zrku34ug76YUO2f/vHJLp4z3DjEoOVYlYS2SqonhoJVObMhuspmhoQwEFWKffFl7PBR8teLclQQi2nfaZkPGDgbm+HM527bOgfTZn2aMjU8tjYlB+wUxW0bqJwAyoOqsf4U8WXX/j4sjMmyJJG6NuU+iI3hAS/uB7yAvhxbnRP7aIXJYHU7P07Nc77eBbogOboSjSVxEODXO94KIphocJgqiJG/wVnw2Fdf18GPUyKMh8mOxcE+GEr+x17ILI64dLRpIV8Vdo+i/MJ+gmo3jrgwDkueWXA3yfkl/0s+qzFsr87/VN1esX1ljzr5XAyj9z1ZCzsx0sZAgpFhwYStE6dnibXCK3PdDHFtskVInvu8UfB6b9TJmD5mcaSzdSUaFHQ/f67aRYn0JA9WYpn1q2kK1PdTBe5kgweqKzzCKjKKG8MycpJsfZgb1/bl9VAMCWlzUM3js74u9GjHWhfKebAGcpm9daEpqdF5IaYxxwQdOuVh952kH7lmCFMIRUKyZsxdRkGUH3ufTOeO6O6nyPD2uDTuEn2refSvH5FcWTshBX7tW8EA6FD9phtI44w+v0XdtDCKI80b+qH/fO4/AnlJtkfmFjHmtu3cf7M3MCCIv9rPNMvLWHR0UY2 X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DU0PR04MB9417.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(4636009)(39860400002)(396003)(136003)(376002)(366004)(346002)(478600001)(7416002)(6486002)(38100700002)(38350700002)(66556008)(26005)(52116002)(6512007)(1076003)(6506007)(8936002)(86362001)(6666004)(83380400001)(2616005)(2906002)(186003)(41300700001)(5660300002)(4326008)(8676002)(316002)(66946007)(66476007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 5we+Qkz0NLNXqg5ivkczbv3GkvNgU4cdeg23O3K+uiJCN3497dfM/olw+1yTY5I03+e05UY3LWOO9eT86AA5D7RM/f7v4WbqnOvfZ5m7W77HdDQg6QWtCGFSjHz9oVnHpPCEtmCGmiQsfRWTh2yHAS+XMDx8LyEAQ9OZSSFhzp6357LIAeXPrUV+AuBfPjFLXo3pQRVf/WYthdqb+5B2AruBPsl2LAKOrg6HHw3E1iWEDwSbiRSBlbS+nifzLfogoXKobwp+Bj861DpgtYcv1ZY+US8BQFZo5SYcekCp1mnl2dw2r8sZup+Yp2KpNzIIMqw59SRJRf/62jBJLITbus5pVY99Z2vZDgM2IPnRsCETpr/rawg4gfjFEt80rE7A7HpHO9mEKwfMP6NDxgMQ8E3eMnl4WyWAwGsUV9Rkm04gBuAPzl/xSJOyPoW+c2wwSlkbxmxEHi2HT71HP5qHrUERfDkmEY8ghEun5YxadAOzpqR65gGV3iBId68N29ZQVc3kRFusLgh674FjPwxIUCj/fsI0Ek57nloaTYhnIKwwIFhhzkCKKz47j3pZWwgFRPTbJM6LFW/Pt9zvBmR5Nx8nJwK9T/CmXqH41U8FxXPIXfZBpDahp/4xvryMG0HUhiRcv0Q2fzrmJk8MtUmV8o5OGQ+KknwtlUTVqJfoy0w/f1Iy+gVxntS08nBGxHy8Xhu6ZDNkMoGLlcUSk0O25AgmAKJ43Npbf6r7e0OQaB/sOdNFbtMIXuqVcXRjaw1nb6td0Er79VC9/hwsJqexUCoMYA4aWjAEAVDnDlSjdlhs1tFSjZem0230ctjAiyBMSmLaGmGvANMDwMmcFD1ee3o9Q3IrU4q+T/khqZO9lPlI7H/+cpjqDfruWEQ2p19BlETyj9rdaTfctQ3EKcDcbc00K4wh9lDMHfGHULakGwQ2BtMqqvn6/yv73rG+xIrTFQ8sBnxGLU1KUkH20tDqBgM6GAuHJL07ocbSzWzToi0I+3sm1AVa9T1BR9sqtNjdarkKJLaZhSbU4RpndeuHNr59xhg4p74tGDI8NKWCr3SiUxhpuZJPUU1tcI8WEKE7dHCmsaWTtwl4C+egYYj3rIGrjYkLu6YYdDKLG2ZZifio2kUdbzoV7LKj69lSk5bWLLQrY6MUDjrJ6HgqsqEmaRKEcVzmEKpa3kHbT591NnYKcgQFqA5Xpa2/uwwU6iuovNeO3tEsseXOCKQ9DMVGKrELor7xdedh32HtiGON6sdEmtjO10eBffgNV/ld/VaHhOtYiz4/S/pGudWbpUW+kpaCUFTOxIKrpIwbl8lJdN3iOyA6ZFar4KQZvE1oTW9jkhhBjTrazH51InjMVMwyIvFuQ3b4s7+BXwckzY4GrNcBLksilnlT5h+3eyG40yzlayGVXmxCOBxlBgCPDv4eAbOx57nPngjyGLmRF2CFJp16lU3oNp1CwVYTB4Yp5msP5T3rHSFEJTvD1HhOCzE5vlS04+N0vMeBd7S/OHxfHBAYv6FMY+obYavwucR9behWtXLojrEXr+WyYY3I1nfT+LdGT4wtvyJZavRaDAfH473kKBTuwAxmJzurCGfBIQEx X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: cd25db2b-3b43-4b88-31b5-08da5b4ee1db X-MS-Exchange-CrossTenant-AuthSource: DU0PR04MB9417.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Jul 2022 10:45:58.4143 (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: 236/4nGM5XEEoSgfr8UIBJP9D4cqMVEnB1/sOCxfOr6mvLpBzcZjEXjPevRLLmjmz+riJtzqrt1A3FZdFk8MCA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB7974 Precedence: bulk List-ID: X-Mailing-List: linux-remoteproc@vger.kernel.org From: Peng Fan When M4 is in the same hardware partition with Cortex-A, it could be start/stop by Linux. Added power domain to make sure M4 could run, it requires several power domains to work. Make clk always optional for i.MX8QXP, because SCFW handles it when power up M4 core. Signed-off-by: Peng Fan --- drivers/remoteproc/imx_rproc.c | 88 ++++++++++++++++++++++++++++++++-- 1 file changed, 84 insertions(+), 4 deletions(-) diff --git a/drivers/remoteproc/imx_rproc.c b/drivers/remoteproc/imx_rproc.c index 1ce692a72946..0cecb7f422b4 100644 --- a/drivers/remoteproc/imx_rproc.c +++ b/drivers/remoteproc/imx_rproc.c @@ -16,6 +16,7 @@ #include #include #include +#include #include #include #include @@ -79,6 +80,8 @@ struct imx_rproc_mem { #define ATT_OWN BIT(1) #define ATT_IOMEM BIT(2) +static int imx_rproc_detach_pd(struct rproc *rproc); + struct imx_rproc { struct device *dev; struct regmap *regmap; @@ -96,6 +99,10 @@ struct imx_rproc { struct notifier_block rproc_nb; u32 rproc_pt; /* partition id */ u32 rsrc_id; /* resource id */ + u32 entry; /* cpu start address */ + int num_pd; + struct device **pd_dev; + struct device_link **pd_dev_link; }; static const struct imx_rproc_att imx_rproc_att_imx93[] = { @@ -335,6 +342,9 @@ static int imx_rproc_start(struct rproc *rproc) arm_smccc_smc(IMX_SIP_RPROC, IMX_SIP_RPROC_START, 0, 0, 0, 0, 0, 0, &res); ret = res.a0; break; + case IMX_RPROC_SCU_API: + ret = imx_sc_pm_cpu_start(priv->ipc_handle, priv->rsrc_id, true, priv->entry); + break; default: return -EOPNOTSUPP; } @@ -364,6 +374,9 @@ static int imx_rproc_stop(struct rproc *rproc) if (res.a1) dev_info(dev, "Not in wfi, force stopped\n"); break; + case IMX_RPROC_SCU_API: + ret = imx_sc_pm_cpu_start(priv->ipc_handle, priv->rsrc_id, false, priv->entry); + break; default: return -EOPNOTSUPP; } @@ -717,8 +730,8 @@ static void imx_rproc_put_scu(struct rproc *rproc) if (dcfg->method != IMX_RPROC_SCU_API) return; - if (!imx_sc_rm_is_resource_owned(priv->ipc_handle, priv->rsrc_id)) - return; + if (imx_sc_rm_is_resource_owned(priv->ipc_handle, priv->rsrc_id)) + return imx_rproc_detach_pd(rproc); imx_scu_irq_group_enable(IMX_SC_IRQ_GROUP_REBOOTED, BIT(priv->rproc_pt), false); imx_scu_irq_unregister_notifier(&priv->rproc_nb); @@ -740,6 +753,69 @@ static int imx_rproc_partition_notify(struct notifier_block *nb, return 0; } +static int imx_rproc_attach_pd(struct imx_rproc *priv) +{ + struct device *dev = priv->dev; + int ret, i; + + priv->num_pd = of_count_phandle_with_args(dev->of_node, "power-domains", + "#power-domain-cells"); + if (priv->num_pd <= 1) + return 0; + + priv->pd_dev = devm_kmalloc_array(dev, priv->num_pd, sizeof(*priv->pd_dev), GFP_KERNEL); + if (!priv->pd_dev) + return -ENOMEM; + + priv->pd_dev_link = devm_kmalloc_array(dev, priv->num_pd, sizeof(*priv->pd_dev_link), + GFP_KERNEL); + + if (!priv->pd_dev_link) + return -ENOMEM; + + for (i = 0; i < priv->num_pd; i++) { + priv->pd_dev[i] = dev_pm_domain_attach_by_id(dev, i); + if (IS_ERR(priv->pd_dev[i])) { + ret = PTR_ERR(priv->pd_dev[i]); + goto detach_pd; + } + + priv->pd_dev_link[i] = device_link_add(dev, priv->pd_dev[i], DL_FLAG_STATELESS | + DL_FLAG_PM_RUNTIME | DL_FLAG_RPM_ACTIVE); + if (!priv->pd_dev_link[i]) { + dev_pm_domain_detach(priv->pd_dev[i], false); + ret = -EINVAL; + goto detach_pd; + } + } + + return 0; + +detach_pd: + while (--i >= 0) { + device_link_del(priv->pd_dev_link[i]); + dev_pm_domain_detach(priv->pd_dev[i], false); + } + + return ret; +} + +static int imx_rproc_detach_pd(struct rproc *rproc) +{ + struct imx_rproc *priv = rproc->priv; + int i; + + if (priv->num_pd <= 1) + return 0; + + for (i = 0; i < priv->num_pd; i++) { + device_link_del(priv->pd_dev_link[i]); + dev_pm_domain_detach(priv->pd_dev[i], false); + } + + return 0; +} + static int imx_rproc_detect_mode(struct imx_rproc *priv) { struct regmap_config config = { .name = "imx-rproc" }; @@ -774,8 +850,12 @@ static int imx_rproc_detect_mode(struct imx_rproc *priv) * If Mcore resource is not owned by Acore partition, It is kicked by ROM, * and Linux could only do IPC with Mcore and nothing else. */ - if (imx_sc_rm_is_resource_owned(priv->ipc_handle, priv->rsrc_id)) - return 0; + if (imx_sc_rm_is_resource_owned(priv->ipc_handle, priv->rsrc_id)) { + if (of_property_read_u32(dev->of_node, "fsl,entry-address", &priv->entry)) + return -EINVAL; + + return imx_rproc_attach_pd(priv); + } priv->rproc->state = RPROC_DETACHED; priv->rproc->recovery_disabled = true; From patchwork Fri Jul 1 10:47:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Peng Fan (OSS)" X-Patchwork-Id: 12903146 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A45F0CCA47F for ; Fri, 1 Jul 2022 10:46:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237050AbiGAKqP (ORCPT ); Fri, 1 Jul 2022 06:46:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43314 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237068AbiGAKqG (ORCPT ); Fri, 1 Jul 2022 06:46:06 -0400 Received: from EUR02-AM5-obe.outbound.protection.outlook.com (mail-eopbgr00072.outbound.protection.outlook.com [40.107.0.72]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2EDCE7437B; Fri, 1 Jul 2022 03:46:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GzkDvdvQVRG5r+Yt4qmmSRNDPGiV6i7bqczzacZqQKAeNM2RRsuBLmz5Z/0FlsTpnc0xIh09vM2nSnVk4NzS0aT2ULQEGhMgbY8cDyfjUq3IWYC4QaZfhHVQAGyw/c5D7E+2kQeBeIstyxRcgSG9twUtoXbU/VHFjeob/GrTsI6oDlyqXPotEODM2xyXTijfEon5sVIo8jlMx7MoAtJnnteDU72pW9/q8aIPhHdJxevnr6wOTIhBE2sJAkrNZfZ+pyjFc7LxVcRRBfzhRv5Z469c/c1inFwwkb0blEMOndVkLzm/xbeh7kvPafLlFS+MT+sTXgCq2Id4JbCWrgBGXw== 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=Mi0BiFoh91h6xoHWVePG7+aorttfMxQ5X5lm23o1680=; b=M2zLbbX2eE+4BY9C55DcJSlxHI2IAnpzL8RLI9mLLyJSxfRM4TiutkwoWXSXC6ovv96tKzGhDdVcHI7l1pw40DmGAM79/VkHdssoPwbnV1QcMYr1FgeV6l/RlOloNcdcmENzw/T01dNS6KMebhEMrj536CpO5UDK93DCkqDPMclPMuiJcXImNpzHt+BRf3zqDqQqb27L3a36D6e6ixX7/STmb1GFTeCTID3tKj2tuCqn2mTDgApby9LL4yo2AKpL9vJ+DpWvqW1/jxRPTe3YdZwMBFYxC+L/e96SRQ7qzYX6uepB+JGvXOKMluiB/4QkN1sw0288OjkRKrPhO/fhRg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oss.nxp.com; dmarc=pass action=none header.from=oss.nxp.com; dkim=pass header.d=oss.nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=NXP1.onmicrosoft.com; s=selector2-NXP1-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Mi0BiFoh91h6xoHWVePG7+aorttfMxQ5X5lm23o1680=; b=K1ifNqbgXGFHRQRrf/AAU8w7MtrQrdjPTL8n5yETwTUP0RFlQys8WwMZ/uho9Clk0MpPhJELFn+9ws3GKsehEi3YW6u27VZzWUBWl9VL4VALRggldDrDpLxJ5rh1rSxh9Pq7Q0/3XE80MPyM3m7iKF0z8LbtQwvzH2s8oNLfu9o= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=oss.nxp.com; Received: from DU0PR04MB9417.eurprd04.prod.outlook.com (2603:10a6:10:358::11) by AS8PR04MB7974.eurprd04.prod.outlook.com (2603:10a6:20b:2a1::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5395.15; Fri, 1 Jul 2022 10:46:02 +0000 Received: from DU0PR04MB9417.eurprd04.prod.outlook.com ([fe80::fdd4:8557:334b:180d]) by DU0PR04MB9417.eurprd04.prod.outlook.com ([fe80::fdd4:8557:334b:180d%6]) with mapi id 15.20.5395.015; Fri, 1 Jul 2022 10:46:02 +0000 From: "Peng Fan (OSS)" To: bjorn.andersson@linaro.org, mathieu.poirier@linaro.org, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org Cc: linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Peng Fan Subject: [PATCH V4 5/6] remoteproc: imx_rproc: support i.MX8QM Date: Fri, 1 Jul 2022 18:47:24 +0800 Message-Id: <20220701104725.557314-6-peng.fan@oss.nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220701104725.557314-1-peng.fan@oss.nxp.com> References: <20220701104725.557314-1-peng.fan@oss.nxp.com> X-ClientProxiedBy: SI2PR02CA0034.apcprd02.prod.outlook.com (2603:1096:4:195::9) To DU0PR04MB9417.eurprd04.prod.outlook.com (2603:10a6:10:358::11) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 346c2467-b4d2-420d-d0e0-08da5b4ee45c X-MS-TrafficTypeDiagnostic: AS8PR04MB7974:EE_ X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: rVk92fNqdRU9SxG1AatzzLGTmdCIQWRcIrdIuO4SYvfgEcgZpYFTSeWYyVAGFnKmvyoYscY7BNgh2d+wiXi7CzyLIDK+CQbZaLiRmAa1d66W1MPnuN/kdPRec0/4T1OHJ8mRdB/gqT6x9LLvpYDYsw9bR3PyrBzY+5uufy8dm76Q15RJ65Zd9rNvTPWMCS5iX/2knJEDQLbCcxrGWusm/If4cVkhSxcFIBm5QCy/XpT0rYm0cOCdWiR4D/yxsAFmMDIaKlOfraU4euQUph7jF0oNq0f4fKEVoQIUHJ7yWM2Myulq94mzX2O38+ZVuIBsB/crsxxx399Tqws+7VH/cmj2vrf+fNuAPvfi6gi0B5oIhbut/Id9epUoIQL5tbCtC1j/ido+xW/a15uBZ1N3zO4M3I8PXN/pbQmgdE2CHKvLXYJfKl/DnjltFlySU8V3UKpj13RDrSd1CLRKs8o/yETjfWHrjI4Y0aJLA1yMmLwGNpaUT2y4j17+zCKCo4MQwrqGSKe4gLtIB4wqOS4Twv1gWogMsOfljdpw/AEMTpn0OTl5cq3SsvPti64hjJrlzCGo72otmkhbPsXBN5HhlHOKdDhi+27k+fnY5aznTSznqyCIBeROpYnBVedvvgANMjAjxXDiU3TKsSJCMQTXpK3Zetio8j605wyDl9D68eimtUAA5kjZw8uv4Io+NfvlmHZ3ujzUD9eYxpgLYchRhXWJeCBqLOuTGaKec3bNTbkn8IggLFRheoHZfA9mztlZGpwbcC8/aecaa6jbmEOjR0MflILX9SFtIVaR304ynp6KtsjY3OxshKdiVIXgSH8j X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DU0PR04MB9417.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(4636009)(39860400002)(396003)(136003)(376002)(366004)(346002)(478600001)(7416002)(6486002)(38100700002)(38350700002)(66556008)(26005)(52116002)(6512007)(1076003)(6506007)(8936002)(86362001)(6666004)(83380400001)(2616005)(2906002)(186003)(41300700001)(5660300002)(4326008)(8676002)(316002)(66946007)(66476007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: k2JzDshvxQpFcEOAiMpO97X50Sy/r4OjWn/+8VO8+7IEeY3lP5aiSvXzjTNpu/7KYk8UD/IhbcHsEesKMymNN38lW1/VmbSxC6Fn3hJwmC68y+VyGCMAh3z02VlQuYHzNYr+cE2ofcLhM0RviMR8oX9iF95m2CeNCDh2F1hshtU74h6uj80N1TK6FcJqW68HY7wwCajBPFLRJZVOfhGVnrDEL6bXcnbMKc11t5+wcbQQumyuipbpRDS2m4DzOGyKBQJbpwhQvqxdAEaIHx6/Lj+f2kKEfphhAd7AAvSzNQ4GS3C8gxEn4GWQyjRcAGqdHOqlDyb+p2weOllG4VCbJzUfqotmhjDC++ZnyKsc7cWvVmc+oPhsp1mf3jaVHdbs0DmtkDeKCtf0T3B1Z07K28QTREjAotS2HDKivlptZHOEKjLbRbYVCWb3q79F1gh8xuyYFjZzCwM1Ji2ozw++QllF6HRZV4feaH0IrgX6SV4hE6j5ypsj3l05MNkJ3S+vYDgQhxIo/yhuLE8f4W9PAGeI1/rDzHcAUCd4WrK74rHdsIdxovKOaKa+d1lghxf/Pk8C7Oqo6uVR2M8NbCNOkdsqS5SzgzB53Gguiajjh26hlO7rY1P+6PVBJHLXzKnzyEq3Rt4ZgvQlEnaVZrSgyNLKUNIY0vquhZzjlPmQnx5Bk8zFnHBHSaz8n4AL2OFKlymVBgmFqVn+J1nb0oKfyeYthK004JbUWNjM42hRMIl6/rXtKYBuJhc2iUoVJiX50sqijYhMzKhMGXKKMEE+dNj4DD+nR6kiH9glW7EXjJ34VdihF1+D2fXvQayO6dbIg4m8m0CvYNPUknj/gCu4n+AHwDfSxzxarFeH4qh/R3m6QRIeKY5gRBGypSVju3D9WeRc0Lf8T4xMT7HTnOPKhb5Y6mBzG4ALyaCZnj55yi1ezNmwPvmVG/Xzs0wc39MqjDyS/uZNpyi9v1BMk7t8xNFKdeOjVcSdRCUDFpX8RUwealpbzj8T+2Jlnv3dvF/UtfGH7dj+Graeut6cCE9iS7Ly2JZVUEDpJU0sRhQKD9/RSbK+LvrsQur8p0o/XXNuD5QxjHygXT8NEDebPN25AkmtJpQns9P2T5XWDYQfwlw/QsB+TETxwCHsJG8T4V4gKhCWZLLDLZFanPvFIxjWZgjf1A36+brtLIlLw6wwDAh7xKCG0Q9E5yZzXxtTunL96Rc47c7gEYF+Fp0610vbgPdjOxuQfLQyKavKKrJtWxdADhiNz0frHaGLEmqSF/45PRmNYa319Q2th2kWlcwjNlLcAy5i8U+EBbqW1v2MkXDJXGHxkKf0iDzdqXFjzaYaed0nejMMOXrbp1MSwL2P5T48ekvGOAOREN6MFq3D9piXKC0KwS0adNShukkFgX4K/9tfK9N1KraCqz0aNlErS5/egrljIhKE2/kbCHmZVEjgvPP4rftmV5+j8U1pq/J+lj+9wndR5rDcAnaPxTKTmH2Xgc3/wGweAsaBO3X/qX7acOElYm3Gm2baQIo7bYtQnCKdUkOJFpeQHRnZ4CVWum/NaP/+V5zUx69PxuuEeH70gHjNWaLyaE9ArZxiCIs/ X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 346c2467-b4d2-420d-d0e0-08da5b4ee45c X-MS-Exchange-CrossTenant-AuthSource: DU0PR04MB9417.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Jul 2022 10:46:02.5099 (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: M3RxllLRWTaObN5lHDXzn1ssZ028lwXExS2eQHndGvqb0CtmRx7FD8mTzcsKvo75bPylm4T2T+mxbfags52Kxg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB7974 Precedence: bulk List-ID: X-Mailing-List: linux-remoteproc@vger.kernel.org From: Peng Fan Most logic are same as i.MX8QXP, but i.MX8QM has two general purpose M4 cores, the two cores runs independently and they has different resource id, different start address from SCFW view. Signed-off-by: Peng Fan --- drivers/remoteproc/imx_rproc.c | 47 +++++++++++++++++++++++++++++++--- 1 file changed, 44 insertions(+), 3 deletions(-) diff --git a/drivers/remoteproc/imx_rproc.c b/drivers/remoteproc/imx_rproc.c index 0cecb7f422b4..f129cc840931 100644 --- a/drivers/remoteproc/imx_rproc.c +++ b/drivers/remoteproc/imx_rproc.c @@ -3,6 +3,7 @@ * Copyright (c) 2017 Pengutronix, Oleksij Rempel */ +#include #include #include #include @@ -75,10 +76,13 @@ struct imx_rproc_mem { size_t size; }; -/* att flags */ +/* att flags: lower 16 bits specifying core, higher 16 bits for flags */ /* M4 own area. Can be mapped at probe */ -#define ATT_OWN BIT(1) -#define ATT_IOMEM BIT(2) +#define ATT_OWN BIT(31) +#define ATT_IOMEM BIT(30) + +#define ATT_CORE_MASK 0xffff +#define ATT_CORE(I) BIT((I)) static int imx_rproc_detach_pd(struct rproc *rproc); @@ -101,6 +105,7 @@ struct imx_rproc { u32 rsrc_id; /* resource id */ u32 entry; /* cpu start address */ int num_pd; + u32 core_index; struct device **pd_dev; struct device_link **pd_dev_link; }; @@ -131,6 +136,19 @@ static const struct imx_rproc_att imx_rproc_att_imx93[] = { { 0xD0000000, 0xa0000000, 0x10000000, 0 }, }; +static const struct imx_rproc_att imx_rproc_att_imx8qm[] = { + /* dev addr , sys addr , size , flags */ + { 0x08000000, 0x08000000, 0x10000000, 0}, + /* TCML */ + { 0x1FFE0000, 0x34FE0000, 0x00020000, ATT_OWN | ATT_IOMEM | ATT_CORE(0)}, + { 0x1FFE0000, 0x38FE0000, 0x00020000, ATT_OWN | ATT_IOMEM | ATT_CORE(1)}, + /* TCMU */ + { 0x20000000, 0x35000000, 0x00020000, ATT_OWN | ATT_IOMEM | ATT_CORE(0)}, + { 0x20000000, 0x39000000, 0x00020000, ATT_OWN | ATT_IOMEM | ATT_CORE(1)}, + /* DDR (Data) */ + { 0x80000000, 0x80000000, 0x60000000, 0 }, +}; + static const struct imx_rproc_att imx_rproc_att_imx8qxp[] = { { 0x08000000, 0x08000000, 0x10000000, 0 }, /* TCML/U */ @@ -281,6 +299,12 @@ static const struct imx_rproc_dcfg imx_rproc_cfg_imx8mq = { .method = IMX_RPROC_MMIO, }; +static const struct imx_rproc_dcfg imx_rproc_cfg_imx8qm = { + .att = imx_rproc_att_imx8qm, + .att_size = ARRAY_SIZE(imx_rproc_att_imx8qm), + .method = IMX_RPROC_SCU_API, +}; + static const struct imx_rproc_dcfg imx_rproc_cfg_imx8qxp = { .att = imx_rproc_att_imx8qxp, .att_size = ARRAY_SIZE(imx_rproc_att_imx8qxp), @@ -397,6 +421,17 @@ static int imx_rproc_da_to_sys(struct imx_rproc *priv, u64 da, for (i = 0; i < dcfg->att_size; i++) { const struct imx_rproc_att *att = &dcfg->att[i]; + /* + * Ignore entries not belong to current core: + * i.MX8QM has dual general M4_[0,1] cores, M4_0's own entries + * has "ATT_CORE(0) & BIT(0)" true, M4_1's own entries has + * "ATT_CORE(1) & BIT(1)" true. + */ + if (att->flags & ATT_CORE_MASK) { + if (!((BIT(priv->core_index)) & (att->flags & ATT_CORE_MASK))) + continue; + } + if (da >= att->da && da + len < att->da + att->size) { unsigned int offset = da - att->da; @@ -846,6 +881,11 @@ static int imx_rproc_detect_mode(struct imx_rproc *priv) return ret; } + if (priv->rsrc_id == IMX_SC_R_M4_1_PID0) + priv->core_index = 1; + else + priv->core_index = 0; + /* * If Mcore resource is not owned by Acore partition, It is kicked by ROM, * and Linux could only do IPC with Mcore and nothing else. @@ -1042,6 +1082,7 @@ static const struct of_device_id imx_rproc_of_match[] = { { .compatible = "fsl,imx8mn-cm7", .data = &imx_rproc_cfg_imx8mn }, { .compatible = "fsl,imx8mp-cm7", .data = &imx_rproc_cfg_imx8mn }, { .compatible = "fsl,imx8qxp-cm4", .data = &imx_rproc_cfg_imx8qxp }, + { .compatible = "fsl,imx8qm-cm4", .data = &imx_rproc_cfg_imx8qm }, { .compatible = "fsl,imx8ulp-cm33", .data = &imx_rproc_cfg_imx8ulp }, { .compatible = "fsl,imx93-cm33", .data = &imx_rproc_cfg_imx93 }, {}, From patchwork Fri Jul 1 10:47:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Peng Fan (OSS)" X-Patchwork-Id: 12903147 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C9CA2CCA47F for ; Fri, 1 Jul 2022 10:46:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233057AbiGAKqR (ORCPT ); Fri, 1 Jul 2022 06:46:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43316 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237098AbiGAKqL (ORCPT ); Fri, 1 Jul 2022 06:46:11 -0400 Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-eopbgr150073.outbound.protection.outlook.com [40.107.15.73]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4F99B7437D; Fri, 1 Jul 2022 03:46:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=eWk21Lp3evZvXGJ/ZB3b3Vyr1+oELRAH3o8aDyQp7iQAEfqKCxye1/QDIY3yAiq0oE6aZr3zg0akrZQ0ES2vH7MjgNpncYanF20S9C7euw6lRkBasgJ+aty5OcqmKLzWp1T2d9jp2Xjf3vNsh+7uhajL4ny2nYziIf2aUkDvHsnViCG8l3MdtDW7/zZVQVkG8P+mZx99mflYLbyhP39t9Eo1rLYetMTaL3nU9jT0FFvgTtdDgTlpmoD8rI6jSXkVUFlzLZqfs19PJHPwBfYWkAQNktkEzjpTZyDl/PPr0iU1TV0oqHzZpZRWpIv5UOSQi4OSvHTKI/yeaMrhp+DmSg== 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=G4v1X+G8Uwsw43fPbSGEUIs1mZJalqnDugebOFaA3wc=; b=ZB/rC9ug2NHEJuwECLicHX/+lsAFCDIc9AJX59SoIry67UOAxX1wP4mnXZWTPlAkq9cvE2KZbl/lAycY5LEHV8R1iAYUvYxzDz+H9N3blNrk+WlL9h9Vp6EjEmoDIeNEJySkKY62weJV89dIo1CWc4ezlIDhQcRb2HWmuGPlafrduviWv58P5swql+l2TEvo0RmD+jSZY+ZvtcXt65qCg0ud+8taCxKHNuNYYIeZN8XibWiGOzS5I2YxeGsjVPYrOwhbLkVSdMsFMADrLiCMe7ydAjeohTjEmXw/+AHfTDc77PxxwcDCGESRUQI3WRujfdCkm4L7y7VcZZxkIfMBsw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oss.nxp.com; dmarc=pass action=none header.from=oss.nxp.com; dkim=pass header.d=oss.nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=NXP1.onmicrosoft.com; s=selector2-NXP1-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=G4v1X+G8Uwsw43fPbSGEUIs1mZJalqnDugebOFaA3wc=; b=FdwwrSDVyPoFKGtnd8npj5Sxsl6bLdtL/q0hXftjtjbLhXqQBPGfd6pl+ZsVylcS8/N52eoGeXvoFaoBrTusHP6PP1Dy7KcSCMBSi9xKYKoiLH7944Y1Qf7gEcgUM8DrOH6RZSCQXNdxIMJ0nMkSSpXUqvdkcMU0iRSwqm18U88= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=oss.nxp.com; Received: from DU0PR04MB9417.eurprd04.prod.outlook.com (2603:10a6:10:358::11) by DB7PR04MB4554.eurprd04.prod.outlook.com (2603:10a6:5:35::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5395.15; Fri, 1 Jul 2022 10:46:06 +0000 Received: from DU0PR04MB9417.eurprd04.prod.outlook.com ([fe80::fdd4:8557:334b:180d]) by DU0PR04MB9417.eurprd04.prod.outlook.com ([fe80::fdd4:8557:334b:180d%6]) with mapi id 15.20.5395.015; Fri, 1 Jul 2022 10:46:06 +0000 From: "Peng Fan (OSS)" To: bjorn.andersson@linaro.org, mathieu.poirier@linaro.org, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org Cc: linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Peng Fan Subject: [PATCH V4 6/6] remoteproc: imx_rproc: request mbox channel later Date: Fri, 1 Jul 2022 18:47:25 +0800 Message-Id: <20220701104725.557314-7-peng.fan@oss.nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220701104725.557314-1-peng.fan@oss.nxp.com> References: <20220701104725.557314-1-peng.fan@oss.nxp.com> X-ClientProxiedBy: SI2PR02CA0034.apcprd02.prod.outlook.com (2603:1096:4:195::9) To DU0PR04MB9417.eurprd04.prod.outlook.com (2603:10a6:10:358::11) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 71762b70-7be1-4aaf-ae0f-08da5b4ee6ba X-MS-TrafficTypeDiagnostic: DB7PR04MB4554:EE_ X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: aiad2bybCIDCeESMunMw2Rq5d+FBXa2SB8KuuB4ZELYH+IsjD3aSEB4d2mxe6rSHqgDExsoAAl5NzvTmfRuKt/Uk3qswtMZsKrJhJfvKNnumu+AHdUUCkHNLG+BdQqH98bK3iS884SPsIkxUC0jpBk2yLi0K93BJ8bPfyTNWHzYZXWyRRzvZosIJ0rn6uwz2pttdgjUYzmayXdeVEu7YXKeO8dobpvHNv9cFJVTDhA+VCwoZy+dilRvylgLctu9iA0XayGGKDiJEzxw+tvSijjh5HMRkuW2AJgLaR18iBt3HsyN8wpdI85aV1X2LaNSf8AMMEqx0E0Yv8YNfJW6o5gNlgIWoLzZ/zftfTOHTgYEpoKcIhl4lCtrkBNeqofY4n70+AwE8p21bngxHLUwRK7oyOSLBuAVL7VtUM2qLks8iRIiboK82ThsVYYzHpUTz1hcUVqebivTW5Vii+J2zCs93n1x5dNs5FpWbBS1Y34QPFVl3nr19xHzOr4Um6bWvV5vu8UOOEQGxBk3+/ui4rmZ8dB8NJC5Iyo8gnXIbs3s9ILp8ZiL1G0Z8L6Abok/Md54bkm2PQtypoxCtWX/lue9vk6UgxkADey6P4iNfCmltS2m1k3sk+Yos4X/Ei2jkMtE+fUje2qa2Wn2Ron7hUvdgw61LIAoF/YpQ724fPLW2LFIhQ0/F6BQyHnhwqDw/Y1j9537+X6TGcc76fpE6i6/BMiKf8mjy2TwfzDBoNU01Xg1wvtLdBAa8nVHmqojRiHKB645EUxVKDYeHjhnwcdiuAlzZheKYgwSpjlB875ZTN78kxZVZuWFO17VKu2ga X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DU0PR04MB9417.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(4636009)(376002)(346002)(136003)(39860400002)(366004)(396003)(2616005)(186003)(1076003)(38100700002)(6666004)(38350700002)(316002)(8676002)(4326008)(83380400001)(66476007)(26005)(66946007)(66556008)(6486002)(478600001)(7416002)(8936002)(5660300002)(52116002)(86362001)(6506007)(6512007)(41300700001)(2906002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: a/2qUAXw3lc7zTd4fdslfllaWqo+XFph19ljfpVB3bpW6VZ0gWlyz0ow7oB8Yq4ngWc3xFJ0fbPH0d0CRTENFk7snllfbGFAyl/u0gJ6PHYQPlXuAUkWlTC6tbbcS/XmYrRIe/AyehUDRa6XdipXLEnDYqpnE6jytgx3Hwa7+10A1yVtojefVHHTfA1dfuFqsXz53mCamyo6gQ7TQ2WCTctOgnKmR2ysv49xv+zF2cSgZYA5lr86vcOdgPGyabxOy7LobQKFoMJD5SAkVpDfBd/4vxUwrsZtQrC/l26zdip3K6mGF9Gwz/TtX4ISW6au13tOCrI1zPY8y9mCUjXFcAJZDLauOdtPGPdsfRHV3NOjR6mXvjRQE73yefNmbKqYV0WqhM/puMjzOqetx3f5mc5oIvB9drg1iB7spi+VwSG9tQG2GK0phYKUlULBu7Enf68lOUNt/q9n+K0IE2HCuuivPJ4sDXhmYCmWEW5Eujz6g12LoipM5AcBcjhpb91F2kqNmvYjTPaMEUOG/HTR6Xn9eAqknn85ZKAQ7vfVa6zYarI8zPl7pGxcIntQ+9bLKn2sJB4JbdxyXDhNTT68EGttfsOEOvBgODTCrrp9UfrVr5oCXjTOdpltNfByP0qiu0umqMmfPoIHKfLVQDyO563rKu8rxH5eEJQP2/kJZVC6yfejYJoSjUCzjqvTd3Ra1cydPO7ejwYFoSTQylH4hiHvcwXADmVlqelgZ0X7bCxq+siua4gizCjx0wAKggRDYMEXVUMCrgjLMuxIqJYiXI3Hz+a8OPjc63tR89JjRje+XuqAu8kJa1XcbqKB+aV2V/1yM0IMryDhvQ6oW2pK6yDZlvgy/gBJuz6Cqqn/EkM9FmkCN+/+yc5pGUvdMPVeJE/J+stXsEEBUMF6WypumAfr4XAgCiOebFLYl4XeAOFz0MVm1RjHgFqTuMvvfDpM0PiS0aaaCcUqVdbwl6A/060rxfVUNcgNvtq2aVWMC04Gn6HONYhupihklWD82FRFB0PWLqypvnS5lRQ7okYnIQRg1a+Oc22CayRDYt2C0Z+4qLWfPEDs/MQUJUen8D3JdMJe6ES0EgXnH0lYOx3ECsIwm/uJJR6w83zNhYW5PxET9gPDemH6KOD0Xx9zuH8xsYpQ1JOhfNQfzGfiYXUX+ojXugWyu69pna/81WtMD4fBYa0x3BqSQmzWKjspnLa28QktFwKI+hHhuX/71qmYwBlTV/2I8gldXA1gEF/accUx9zEdkO4XZhOiYXHlzg+VfpUQrAbkn/PEEkXh5IfUOa6jW6z5z0RwWWel5OlKOiAny8pW7ZN26GnWreVZh01xdVhAJ0BtdaKzC8C+H2LgKUBe3V2miaoFg7KBjaGROkeG3N2ikzmZmFn6B9lQ5TIvBOSxBjSUb7n71aFCbDhlkGQBRj3ra7BvNvzvQjKZGuouFgf/BwYZqx6LIbFXKp8qPBbxM2W5WmsqHkhJNr92525wz5MzWBRqJcTm5A673xFNup8HJID1R0VUUzFf/LwlmVaAM8mIWaHKjI+ZGjopLQkAT43DrL9ck6GqZzf3AGm8ZWK2PXvDrQoEqlWBp8oa X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 71762b70-7be1-4aaf-ae0f-08da5b4ee6ba X-MS-Exchange-CrossTenant-AuthSource: DU0PR04MB9417.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Jul 2022 10:46:06.5585 (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: V3IQHxxp775nUez9DVvgLUR9PzTWU8cfvbB2hYakKQMp+4LpCiVj7Motb1+G7g2xwYnKeXv2LkaR08v8NU2bdw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB7PR04MB4554 Precedence: bulk List-ID: X-Mailing-List: linux-remoteproc@vger.kernel.org From: Peng Fan It is possible that when remote processor crash, the communication channel will be broken with garbage value in mailbox, such as when Linux is issuing a message through mailbox, remote processor crashes, we need free & rebuild the mailbox channels to make sure no garbage value in mailbox channels. So move the request/free to start/stop for managing remote procesosr in Linux, move to attach/detach for remote processor is out of control of Linux. Previous, we just request mbox when attach for CM4 boot early before Linux, but if mbox defer probe, remoteproc core will do resource cleanup and corrupt resource table for later probe. So move request mbox ealier and still keep mbox request when attach for self recovery case, but keep a check when request/free mbox. Signed-off-by: Peng Fan --- drivers/remoteproc/imx_rproc.c | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/drivers/remoteproc/imx_rproc.c b/drivers/remoteproc/imx_rproc.c index f129cc840931..503435ad1f11 100644 --- a/drivers/remoteproc/imx_rproc.c +++ b/drivers/remoteproc/imx_rproc.c @@ -84,6 +84,8 @@ struct imx_rproc_mem { #define ATT_CORE_MASK 0xffff #define ATT_CORE(I) BIT((I)) +static int imx_rproc_xtr_mbox_init(struct rproc *rproc); +static void imx_rproc_free_mbox(struct rproc *rproc); static int imx_rproc_detach_pd(struct rproc *rproc); struct imx_rproc { @@ -357,6 +359,10 @@ static int imx_rproc_start(struct rproc *rproc) struct arm_smccc_res res; int ret; + ret = imx_rproc_xtr_mbox_init(rproc); + if (ret) + return ret; + switch (dcfg->method) { case IMX_RPROC_MMIO: ret = regmap_update_bits(priv->regmap, dcfg->src_reg, dcfg->src_mask, @@ -407,6 +413,8 @@ static int imx_rproc_stop(struct rproc *rproc) if (ret) dev_err(dev, "Failed to stop remote core\n"); + else + imx_rproc_free_mbox(rproc); return ret; } @@ -592,7 +600,7 @@ static void imx_rproc_kick(struct rproc *rproc, int vqid) static int imx_rproc_attach(struct rproc *rproc) { - return 0; + return imx_rproc_xtr_mbox_init(rproc); } static struct resource_table *imx_rproc_get_loaded_rsc_table(struct rproc *rproc, size_t *table_sz) @@ -721,6 +729,9 @@ static int imx_rproc_xtr_mbox_init(struct rproc *rproc) struct mbox_client *cl; int ret; + if (priv->tx_ch && priv->rx_ch) + return 0; + if (!of_get_property(dev->of_node, "mbox-names", NULL)) return 0; @@ -753,8 +764,15 @@ static void imx_rproc_free_mbox(struct rproc *rproc) { struct imx_rproc *priv = rproc->priv; - mbox_free_channel(priv->tx_ch); - mbox_free_channel(priv->rx_ch); + if (priv->tx_ch) { + mbox_free_channel(priv->tx_ch); + priv->tx_ch = NULL; + } + + if (priv->rx_ch) { + mbox_free_channel(priv->rx_ch); + priv->rx_ch = NULL; + } } static void imx_rproc_put_scu(struct rproc *rproc) @@ -781,6 +799,8 @@ static int imx_rproc_partition_notify(struct notifier_block *nb, if (!((event & BIT(priv->rproc_pt)) && (*(u8 *)group == IMX_SC_IRQ_GROUP_REBOOTED))) return 0; + imx_rproc_free_mbox(priv->rproc); + rproc_report_crash(priv->rproc, RPROC_WATCHDOG); pr_info("Partition%d reset!\n", priv->rproc_pt);