From patchwork Wed Aug 24 01:10:18 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: 12952778 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 F29E0C3F6B0 for ; Wed, 24 Aug 2022 01:09:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231987AbiHXBJA (ORCPT ); Tue, 23 Aug 2022 21:09:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56526 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229518AbiHXBI5 (ORCPT ); Tue, 23 Aug 2022 21:08:57 -0400 Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2068.outbound.protection.outlook.com [40.107.21.68]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C305080B6E; Tue, 23 Aug 2022 18:08:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VBP7S4dXBOYkLcxHvR3wzArX+1v+gNhNt7BZzPkblUVQg/jguuXHlIlGY41cxjySmcivk5kXDp/krMrp8lyCQXYUlfqK7HFOu5+LQk6uw7R2m9bal9g0GCg8KrjuXSDEsHQXlRt3YjiX1jD1CabrPecd3dnDcrMozLdygoMNK2g/cW1ltl1vhgkkfBpzQStc37Ufq37VUjQLI2dH3ZEPfkUV/kRM3Yr7U8Z5EGa45ucCt6rbkhciO89k84TeC13rmBofTyT1XhkY6Sye5czJ97XFeN8jBhzmMHo8pJ/oKn8d6FFB64logh4BcD6jWoEI5NtFxxobEllWEI4Vvyt9Kg== 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=05Sxwp2qiuQnWOyN46jehy6hs5jPcBhHTOijKpW514o=; b=VighQUlbPtcQzXSYmb0ilykoWlrQMR67mormgw7P5Ldg4QcgvWVNyIBUOIBEajlJNtWkOiwqVR0i8ydzN9U57DFt2nDpAJvAxgJ8Mq525dmIl65yhWNQhYLX4Dvk7s+9URgdLspKtlj6ilwtczWes1/yS0yuAcrcaZ3FbeFPJUph+TnvUMKDv9hnHz/v6v1wOL7feJjvzRsathMtPYSKImFtGeSAslrST2Kl1KH5Olb3+rCHb7tLHMfwmrrBlbFH9RAYHzGiQb5bapBBoPObwYwbO3fPresIda0nL98xspvD0+QFa2T/rP21IsNNkgN0pjOfnmMjRWFvQKlSBzK1AA== 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=05Sxwp2qiuQnWOyN46jehy6hs5jPcBhHTOijKpW514o=; b=Qjelrzprxv7o2UnElJc8fwPbG+HzCtCiiN0mKU8TqKAv99h4Y2aQPFENwVHE6R+a4JP1tbaUr7a5AWOSgZ0UW8tZv2Hob+AeL5up7g4pGYpaY3beNJTg4TKFQdUoJYp5QSjP+2RNUVOS4Jq8qBmPhn68xQ2ROlh96f7sj1owwQg= 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 AM6PR04MB6182.eurprd04.prod.outlook.com (2603:10a6:20b:bb::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5566.15; Wed, 24 Aug 2022 01:08:52 +0000 Received: from DU0PR04MB9417.eurprd04.prod.outlook.com ([fe80::3c6c:b7e6:a93d:d442]) by DU0PR04MB9417.eurprd04.prod.outlook.com ([fe80::3c6c:b7e6:a93d:d442%4]) with mapi id 15.20.5546.023; Wed, 24 Aug 2022 01:08:52 +0000 From: "Peng Fan (OSS)" To: bjorn.andersson@kernel.org, mathieu.poirier@linaro.org, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, shawnguo@kernel.org, s.hauer@pengutronix.de Cc: kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, linux-remoteproc@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Peng Fan , Rob Herring Subject: [PATCH V5 1/6] dt-bindings: remoteproc: imx_rproc: support i.MX8QXP Date: Wed, 24 Aug 2022 09:10:18 +0800 Message-Id: <20220824011023.1493050-2-peng.fan@oss.nxp.com> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220824011023.1493050-1-peng.fan@oss.nxp.com> References: <20220824011023.1493050-1-peng.fan@oss.nxp.com> X-ClientProxiedBy: SG2PR06CA0192.apcprd06.prod.outlook.com (2603:1096:4:1::24) 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: fe774178-2945-459c-336d-08da856d3596 X-MS-TrafficTypeDiagnostic: AM6PR04MB6182: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: 8yDgUrfSOxOTSe5PthWAA/ovyWGHXfw54mv65hrm1EFH37IwcLER2H55DDLQ5Bk0/IV2YHGElfR9EceMFmLjBCmYHK40SIK9gOn6RceTUPYHN7R5zgT3FVIxCB689Thkd/J5k4MFJ9/43onyFD6U/mUV4UvBALjNA652BT4ShLnCAfwGxmvo2s7glYa7iKd0EPhWboJK4BQDkXSLX/H1jf+47TDZFdVgCsfDuJEOVIbsM/tjcLTMXIngT/Cy/Zlfwt9h1gqolYcXRfU3YcD3+r/NKw8yzPGjVAMYS3+KVnZrSlw0GCxwYNxLKvt43h7TW4lyNkLPBAyd+Sja2nxcMt+LUrMa8wIYCHvNt/CIQoNCUByOU1unSzkpP8r0TirJSOW7IkDUtZ+e7owRHHv2z2BTzJB4agMhXVJa69T8bCZsAVQCixIH+zGOys6irK3Np1+q3A0Rv3vvXBvWnPA8rStd9LrYdh/ldjehTosLI38gJ9WgQMSI59ClGGLCYDSA/JUFvhX4zCGbSRSLo1IwAhxRb9OxrZjtxG5qMXaSfPEQehN1lhGqZ13UMcnHK1WZiYIAI4GCaTyj6AmCZuJaisaQpaPOqzr3ttyANC997/qGJv3gP19H/cldX+R2i1lhS583IgvgQFpuAwqN7QOiWEBDoMVqpmx1WtdvUbwPweJeG6hgT/p0P0NDWxhU+q/pNi1TaVRQNmvJ/QZ5A0SzzTaxvSh1TBx6RpSS+/OPLDQNs9goYnlkubOS1pfWrb0nLlsBGUzxdeeN41voP/3DbQ== 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)(39860400002)(396003)(136003)(366004)(38100700002)(316002)(38350700002)(41300700001)(6486002)(66476007)(8676002)(4326008)(66556008)(66946007)(6666004)(478600001)(5660300002)(7416002)(26005)(6512007)(8936002)(86362001)(6506007)(2906002)(52116002)(1076003)(186003)(2616005)(54906003);DIR:OUT;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yz0EK7ussaSGh+zbNjdZfK9dcew0hXc92AfTmfiNe2PE15M3IAoZtN6iPBmY4HUU9FgRYAi71TKJABqPrz57N1ZCzKd8cHOehFb2mm+D/3ZC3qYy9FGNN+KpLJnZZPHlg8NfDdTwnSWNzoRqugPRBwh4o5Ftv/ZPm/nUVak8k1sFlSOpKs7gX8m4MMB2qJEUhS/RYAHUS3AqBo/vmoEImjDFH65SSA8ezEvuku7MnoRwdBzcvTl9gWp4wX8IW5ZmXeQkUUCCeoJiWIiAy9f5NzXH8KFSXuLxZSOeb8nNQukKzdxJto8lKR1NiwtctHgrpAMw7ZFezuOeuPz2Rmg4CT2aYnwTrOv2NzGNhZuz1ZdEOaePaosm36odxKvey3Famr4gvug+MnriNLJPTbvBmscbH1bUWH+D0U8g/epo+eRWycSBXQkxDSe4qpINT2cuEUHLs3cdb5K807+oMxdRP3mr78+/y0VyWOllYne+d1jf8PVV8ig5aMokH7P+DETz0W7A356SRHUqxDJXyyF3N49jaKysV4QIbWobbVwPC9yE+eivR6brkoAUCE5LWuyC0U X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: fe774178-2945-459c-336d-08da856d3596 X-MS-Exchange-CrossTenant-AuthSource: DU0PR04MB9417.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Aug 2022 01:08:52.5342 (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: zCmxW99+DNf2zUG8Ne7qbfehTErOSJPPQxSnIqqalwyYEbo0Mc99gZvNwU9C/v6u8aZPrPKAt0sUh2ZB6cUt9A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR04MB6182 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 Reviewed-by: Rob Herring Signed-off-by: Peng Fan --- .../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 Wed Aug 24 01:10:19 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: 12952779 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 6359BC32796 for ; Wed, 24 Aug 2022 01:09:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231492AbiHXBJD (ORCPT ); Tue, 23 Aug 2022 21:09:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56612 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232394AbiHXBJB (ORCPT ); Tue, 23 Aug 2022 21:09:01 -0400 Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2077.outbound.protection.outlook.com [40.107.21.77]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 575CA80B6E; Tue, 23 Aug 2022 18:09:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=oDKHgIHDHGqyW2YFJHpAydgd7ZuAMTJklWmRJQbtHghzEVNhX7C7aKYVQUyB0ipZNxKhs8vCaKO3UPpgzxI8QOH6gd39BkKrXLujWElOsahdDFTJHXb1t1VWJ4R52zM7VB2Kck7VX9ATNv0UQ6imz2POZs+vb27yqGfOUygbHyZ3JEU3wE1NbqWQOmCJZqTyup+SU8l6QCmyIgBQliV/1dVIayzqNRSCoKYol5bwdTc5H21WKTmR/m62eejjslLFLzqanwNMKuBSNkw723WU7ZXZukmn8Zuapgu16iTpdB+yuPR8iPSeHiaJvgmoVF9y9VDivlaygxU/5qUSJ4oXhg== 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=YYRBLRGVmW0aYEp0yM/gTOlzfxHZDMvloKUpivAqNLM=; b=dXiaHWBMk7Mo27v0WJdcCh4Z45oDny+es/QptQBEwM/dDD0aAe0Akp2gq9cpIxPP4NT2ujo7aZtiGiUEWKYcKiIlnjcPweSn/F8Ou5l8Cs+5r+n0DoA3WvkUfVYCgF3ew0jvAlsOm6oW0smRG087l80pp44MjmW4BrSwhIgJDEOQaikka4LsMXaC+m9+IRu3jB9RT/oACMISLRVlZ6itfi5CUad1Qtxd/NzTT/cfvzghw4Z44M9xv/TrHuJisON1MOC/h+PIEbGM01ze1tBTCgQzRDBqnpGCQre6zU//AEYHqrEBrs8lbGePowBCwd11Hl89/Zot91ygTpUqus54HA== 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=YYRBLRGVmW0aYEp0yM/gTOlzfxHZDMvloKUpivAqNLM=; b=I2gW1V8WHyHw2NWR2LDLTCH3s239C5a8YmIczKcq31G+cpOHOIladzKDyx7D6JGcyHYr5alkgItwb1C3qZg7aRdNAqFlEgXiCkwkWrdz0eZGFjthFrog6UPFXcDT9sVU/Ey0UgB4XsQHsFllwy6WOMPohs62hT7txiNYVqXgP9c= 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 AM6PR04MB6182.eurprd04.prod.outlook.com (2603:10a6:20b:bb::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5566.15; Wed, 24 Aug 2022 01:08:57 +0000 Received: from DU0PR04MB9417.eurprd04.prod.outlook.com ([fe80::3c6c:b7e6:a93d:d442]) by DU0PR04MB9417.eurprd04.prod.outlook.com ([fe80::3c6c:b7e6:a93d:d442%4]) with mapi id 15.20.5546.023; Wed, 24 Aug 2022 01:08:57 +0000 From: "Peng Fan (OSS)" To: bjorn.andersson@kernel.org, mathieu.poirier@linaro.org, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, shawnguo@kernel.org, s.hauer@pengutronix.de Cc: kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, linux-remoteproc@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Peng Fan , Rob Herring Subject: [PATCH V5 2/6] dt-bindings: remoteproc: imx_rproc: support i.MX8QM Date: Wed, 24 Aug 2022 09:10:19 +0800 Message-Id: <20220824011023.1493050-3-peng.fan@oss.nxp.com> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220824011023.1493050-1-peng.fan@oss.nxp.com> References: <20220824011023.1493050-1-peng.fan@oss.nxp.com> X-ClientProxiedBy: SG2PR06CA0192.apcprd06.prod.outlook.com (2603:1096:4:1::24) 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: fe1b704b-dcc6-4fba-fdc1-08da856d3842 X-MS-TrafficTypeDiagnostic: AM6PR04MB6182: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: WwPmKS9MUckGzCWSfSNWCazMODF3FPBKfcFvYiSLe7LfOarVD8d0e6sZQPEE2gFiT9T4X0wgDIBKitqdW0IinsKUhEL9K3ZGlC0iSoheIPeb7ghPC8dXsR2RLwesjXP+26VXaeO54CUsM/akuxSVNmjnhEmzAASnQVcZuvgzaV6iC7NZe7Re+TAfYBc7W0CgD/3b/yANDnwtuVq/Qlxmzac10FbJcLKZdpeeX/hruyDCqnr48cfn/o8bS1HfRlEDLIRK3hKm+RmriaQ/9lkXaI+SGtZryrNsgJurTKOL5Ii7W+AGJCbg0RlQUarS3QDckoKbN15BeapBEJVdS6J6LJDcnHO/wq41de8SnBrPnkwrqLSpAN7BN3VONnyUXBcqylVu6YXlfpCOwfNqsfrwOMtyVp/bYwWXML0HtUEnGPQPYjLW1JA+9Mwbov5oIukChHQ7ahKrHGp47nOuXpr5soVHWGpwhN0isWd8xXsrF3cXZfkavmE0TUCUbDe4Uka1mIXdXnn75Iqs+OXAEkkNqcrQss1thM4ijxskg3h15aWI0pcVaAh4afF9d+hetbg1ltJQqMBLq784hWsDrbvZS4qMykNo767rmf+OLrtuuiZiDRtQBpr9iygLOl7RAxBjcUYfJFvhscBxNm/rRog59lkYjFpuK0SWZWoXCsOBN4XmJrAhjvPT8ed6hMdOVeEDmjuR74nw+hYVjZzesbf01TXIriM1MoNm1+BlCUBrrBfTxxGwMEuUapfkHS0p/vIxJFfvaGAwZYNZDy9Waipl6g== 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)(39860400002)(396003)(136003)(366004)(38100700002)(316002)(38350700002)(41300700001)(6486002)(66476007)(8676002)(4326008)(66556008)(66946007)(6666004)(478600001)(5660300002)(4744005)(7416002)(26005)(6512007)(8936002)(86362001)(6506007)(2906002)(52116002)(1076003)(186003)(2616005)(54906003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: vxFIo9mj6ckvHIKObV0ygdWIQksUspZoZa73+eClQirXrunJNV4U/E8sicISo0U65ccveGSVc62Nb0z5itMhpfkufytww9irmLgvIXeftrmYhcQCf/htwyoD5mTTVCMIyDfVGit8hXGTRT2e9UX7UJgBHQzWxFnnOVo4CfYIVzrEcd8lRO+7L9ICnpO3RvgwWW29eeWO2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bNwbS0vuWE6NL/nvvQubCpjJmvpTWtQ7BNOgb8m9C7uhM9SD+rQbfZNgWUejtrl9cDbavhnYCHMX841lqEDq8IpdV2hhVvXj5z6BeVd2psTwapirSwv45GBpxAK/IgbqIbQ6SPgD/CYMzDaS5mzzEugoRkmsbjv000iEQrGVQqyKMnyXDCWLePLxJ6UYTRGg1ZUS21sClaITbuucLwNHnaXg7H4Ti1J7XprtWkYrrIiwdYANnffzct1M/6pVDLFJUm4ybsCz0/yLPxzXK3fwUpeDm84LMBHoMp+UeDjHpgbBSfwEiwJb3R/GWgEy0p X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: fe1b704b-dcc6-4fba-fdc1-08da856d3842 X-MS-Exchange-CrossTenant-AuthSource: DU0PR04MB9417.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Aug 2022 01:08:57.1157 (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: voGll9OABums7ykQVQfkm+D/LTqHyV06T4oli80w1MBZa1wWRb/Jl9KFn56IPSoIZc2Tb4991hHwHqibqzq6dg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR04MB6182 Precedence: bulk List-ID: X-Mailing-List: linux-remoteproc@vger.kernel.org From: Peng Fan Add i.MX8QM compatible Reviewed-by: Rob Herring Signed-off-by: Peng Fan --- 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 Wed Aug 24 01:10: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: 12952780 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 7432BC32793 for ; Wed, 24 Aug 2022 01:09:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232796AbiHXBJK (ORCPT ); Tue, 23 Aug 2022 21:09:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56820 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232394AbiHXBJI (ORCPT ); Tue, 23 Aug 2022 21:09:08 -0400 Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2072.outbound.protection.outlook.com [40.107.21.72]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 03A527FE4E; Tue, 23 Aug 2022 18:09:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WrsftiCsO+hkCdRL433o57X3WvKu6RJyRaviETwz59KAXRDBG46pDcZo4J+Bg59ewTAqXGivn4q18xg2u9sJvx5UsaGWOnJqZM3yruok7BYqvBAS1C0TtfPlPn+2vyYSWOGUO569oUnEtHdSIdBvuFnW4+k5BTF3kCSK4MzGLNMsQBOB8+TobbNWkhJgOopVEpx8/yaN4oFjoJJEZOOde3ZgkuffzlV4gLK+rizYK1Uzp8hXrrfd1EoR1tRIwH2Si55SvB1ir9+dc212gzTM6xXeqyvVw5yl6IYPZ4cb5aIHU333+fCgx5UqKPdt0QfskkGgqbMGYw13p0yhka4vXw== 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=/1BGWAxmr0gKp9yCLcPaa9w24oOq322w9+bA5aNiWWM=; b=djSnnv20ISs/ZkVgI+xf7A8xoAPADF3jXcplKUgj6Ip+RJb0T5L3L9DbWkSS4G3RoSh7tGFNcKAfellajabZmkxD7Lxp6WTZ38HRUKwQadqx1wd9LbRMW0LZU1wZj/XpM2uHd336y9bCzymDpdy5AJVgeCy16l3q7nmGd342MRaYM+y7J2Ty+oyQ8OPeQJ/hgb42OcXulCeUofUHLMTMi+3Sw5wl/WT1GxuvfCRNU4X0dwy4JQPgV5BiRi1hHZcg/8DPOEbdzhiR1ewTDOLqfRVGzMTGS1q0Gp/r290zfQ9vu3Y2oheKtTbPnKrCrxmEsM8EzZkbSjWbdba+BjCj/w== 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=/1BGWAxmr0gKp9yCLcPaa9w24oOq322w9+bA5aNiWWM=; b=aKm3dONIR5kmObK1vKjlrYx4W66FJrdrvBhfQj3dGIh4wo2xt9KKAPZiyGpQ9SBcSltIeBjj0q7pnGG6qfK2P63YZsNPGwz7zuGro5XKTuUQhJgQtI3PF0vgt3ZSfpXQkc/nW1GrHRuo9KWCTL00lTap9cw6OOx6CO3YUMmJLUU= 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 AM6PR04MB6182.eurprd04.prod.outlook.com (2603:10a6:20b:bb::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5566.15; Wed, 24 Aug 2022 01:09:01 +0000 Received: from DU0PR04MB9417.eurprd04.prod.outlook.com ([fe80::3c6c:b7e6:a93d:d442]) by DU0PR04MB9417.eurprd04.prod.outlook.com ([fe80::3c6c:b7e6:a93d:d442%4]) with mapi id 15.20.5546.023; Wed, 24 Aug 2022 01:09:01 +0000 From: "Peng Fan (OSS)" To: bjorn.andersson@kernel.org, mathieu.poirier@linaro.org, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, shawnguo@kernel.org, s.hauer@pengutronix.de Cc: kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, linux-remoteproc@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Peng Fan Subject: [PATCH V5 3/6] remoteproc: imx_rproc: support attaching to i.MX8QXP M4 Date: Wed, 24 Aug 2022 09:10:20 +0800 Message-Id: <20220824011023.1493050-4-peng.fan@oss.nxp.com> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220824011023.1493050-1-peng.fan@oss.nxp.com> References: <20220824011023.1493050-1-peng.fan@oss.nxp.com> X-ClientProxiedBy: SG2PR06CA0192.apcprd06.prod.outlook.com (2603:1096:4:1::24) 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: ae879175-818f-499d-e6a2-08da856d3ad9 X-MS-TrafficTypeDiagnostic: AM6PR04MB6182: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: Cif2ZIyJB2tE2Nzke7an+fIFFCR/hfPjZ1CU/7GK/3LyFqzX8ebZvTK/B+znylLytC0qIYPhAtjANSpFeByIr5s7VbD+SkojTBgic+CT48ymZOob3FgQFIg+4zP5y70ya1bV9Mozk+sk4dVO7coUM9h5W+t5NPHZZebN0cInZaJjPkcPLfa5nfVbxuiwDC8tz3kOFwoasZjfJhyMLJctNQ9VHiHxMIMzjl5kCu3hGDYqhaBM95TiFB/IKsTxyan1qi5tF0P5aNJjSMDBDfY26/0NKWtFWW3tHnevaGql96rZalOxlHlSizHnSAQxeQ2rEYUgTUwgMqxZ8kFiW5jeY1acAeB39y8WQWX4fumNp07fHZ1tXJT8ih4qSB2gecTAeGx1f2vhwFja36NdhRHftGcNg6fvb/Xios/p5GwKQAgeYVZM7sQewgTfS63XS7ibFe8KCaQbfn8shTS9gXZ9v173GWPHyE7H1MEXZMVr3lio69Yasq0IqOXepdZBlXQ0gbPkFQg0d37SmXQR+c6eR45zH7ZCCzBeDhvycSKqfJtviwl4HoPSv5tE4SAFyXp6lA5vHwQX03Ir/GQf3Lyvr3HCpuqCfYHe4MMCsUTbN/I6PPpB4x3g8FgFvr9YTInDaTTUhr/4u3e+ST4sDbka7i2imOziNWnkYABRlxwPJioOb2nI+cOvtJQrcKolQbYUq+e26QNCgoatGjTHttUauSNHREIfJhYR5FOJj35XKN1+x2EQ0SlBp5T+Iw3b4BgXawN9shVdnSF3u6ksXJ3E2g== 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)(39860400002)(396003)(136003)(366004)(38100700002)(316002)(38350700002)(41300700001)(6486002)(66476007)(8676002)(4326008)(66556008)(66946007)(6666004)(478600001)(5660300002)(7416002)(26005)(6512007)(8936002)(86362001)(6506007)(2906002)(52116002)(1076003)(186003)(2616005)(83380400001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: NctlCF/J/PRdxZatGHgqFoov0czAMrtXCImNnN1Q7CSb8lMrm2apClOg++tzsl+uJMEHb/YwA3Pq7JfBb5DTSaelJ7S/0DsE/Sh9bhDgECZuo17wZRbUKJ2Vri2BvZSSIeKV2pTRY7KB1+OeRCfaaGZfiW+1WEgPZssMOdZe89+XGPiwhKmtmgkKjo9cwGZEpVUNosbO/qDRL3PNP51WC0F3qoZ24hcU9G3A5bHDg0jEBb3w1ywvDxPajTswCDnkbp3kEdxwog3gPuroWF5EOUATKW+LfC9+oBh8Ah1U+0/gdC//arc09W6MMex3TfYmLs/LefYTLoYEZVkWs4OjHX58BnUIjL9ca9j0viGgQTXyBx5/558pTH08q0WQfct//sOB2+clc0n8DJ50RsB52aoSuebJa9vQ4nhpfcKhpumF5j/zhxsm6NYxe5R0XSS2GoycKnBZVKdSqQzn4Iwzs74jS0uob8ivzLjl6ETvKQllNGIh87oLAHhYfhmere6sSTA51BmeHtNSO6CgcEPZhTZCVj7egTsdOkwMVPISrgj38q27WQ2vB6U+VTTklwspbOdjGj+xqqSnyBGwJBjEex3Xgma0FO0KryfhKpeSpTrafyspJXFRdsgYnyglfZBFG9YI66VB6PWYgqsEZZM1BBGmqHw6cpnWRA7ag3NaYgW+LzqFnZOztZCUHASu7CpalaZ8jvdYL5afDheT3LH9oxFGzHbefpcN60iDR+Vw0HetjxaQirgLIaU7NnDPxwnNLc/lhpjQZDw0sY+z5j3FydNW0JKpBB7FWJYGsGJ9W3r/M7as+Pzgs/MQPAupx1aTq6ZKpFgKT+DFgYzN0aRs3rWNwWTmZXdBo7yynIxsnbnTNzlfEyPD4euG2wWjFUKhQ4X/scLsVH3exDcZcZZXhZTppLNnX+tR5PDtI+vbDXV/hOKYwMhldlD/998QDvJ9bMK02nKowtqKKZgjh3DEzJov19qwyxO+LWVSLZLu7fFGJP/nBuaiKhL+Uq3+zgBDuf/C1JsE5Vxtb8YOT3Q+8Fw1zmyLBhDFfOMMjE5+ZyPnZOQ9wQTmpJr24x/GiUlcHsJYzhgNVjbXvNPYN97YWrm7nQg5+kHr0ZBaqL/PjdMMEQlMSzeGdRpVH0ocqAf79SWVC7+gEE5C/47MTXY24En/sBqmF3NZm/YDFhCkFEqyd6efDmS4zFA4Xz7ZyAuyq7hN0UAYbjWKFQhDMMjzpP+QIc/a0EQDbKe0Sm2ntkafKtdHie6iYzgs7mt75mKXpeTTgQb/X5gpptb4I30gB0rvlbCKBwBEJWbqqU7ikKLzAG13AyCgmGlJba58X/b9XyqvXDhOT8FP2tMu6FvGN7gRLSOSf43ADPsasAp6pmOBhF5+PdBR0hRDM3iL44AV99ZL965VMhdr40DKHO+ghH9bB+Rfi/stMKhWA394fFPPd3g3Tp7aMSXD8bPnvDTUVCXZuOp6Cuw4ehnuZ5ze7gtOuTa8OvIKDCdnkdKT14YCtOfHLRUy3jKCn9tAVs2MEVxDwLz3x1tkNw1sNMu1MxKaNyy+qrGdGMDIFH4Cq+sl+OCnpIXUJUUTS3O0saHO X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: ae879175-818f-499d-e6a2-08da856d3ad9 X-MS-Exchange-CrossTenant-AuthSource: DU0PR04MB9417.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Aug 2022 01:09:01.3335 (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: iFVl82GE3bwufFgopyqaZcZwqtuhkPC+fkqyp6rc6V7fwW6hwS8fyeQPb4cbwumm0PbER5zVYJnzRG62ru+6Lw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR04MB6182 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 7cc4fd207e2d..bcba74e90020 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), @@ -680,6 +705,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" }; @@ -689,6 +745,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: @@ -699,6 +756,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; } @@ -803,7 +905,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); @@ -820,6 +922,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: @@ -837,6 +941,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); @@ -852,6 +957,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 Wed Aug 24 01:10: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: 12952781 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 D3CB2C32793 for ; Wed, 24 Aug 2022 01:09:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233085AbiHXBJP (ORCPT ); Tue, 23 Aug 2022 21:09:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56858 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232055AbiHXBJJ (ORCPT ); Tue, 23 Aug 2022 21:09:09 -0400 Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2072.outbound.protection.outlook.com [40.107.21.72]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 881ED883C7; Tue, 23 Aug 2022 18:09:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XgZYsNGTmQHxO4JpcQvGwoaj+hhAxkpFHacB3JJbgEiIALpeA/pXCcCVzj65X3awZGaT/uXpBa7IDjINs//L6hmKI1QcxQx/OR/X3McUEKyF7PlL9hDj5BMsRhPfdWcrzIRIVpbPISUArEYg0tmvbRr5eVIu0YPQaEl6jKVp1LqCnOkkOO6Ld9ZtRt/ITuAiHIwaG2gLYNwLMF2vp8Qp86SK5yUJNnB9CklgTXl9K5+gw8Fskw+Ci8RFYKD9Wr7WzPp5UCuBCpCorOO2gtcmcgJu7KuLy0oUhTIfhrZKyVUmU+5ZdPagbomGbP5Ru71OYYVGJS35ocNKOdDas6SuUA== 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=By1HjPEIvs3mgUq2ZvvggQGfUi8iRmZM767HTom8FzA=; b=SQYzrNEwZyOlu6TTprg4SNrXOkUohH0ZAHimWT2vJtWJRoWgeTK+uHXWGjYgVFFvPZyNtLDGyybqkGhe28An7oPpe4+b6AgyIHhwLOgIBnA/mtQeqtlv9H0U1BgMy9PzUtIeYPNmR3P2obztomE+GQBt4N956FG+2PXJX2WzCnm7ZaLXT7fMuPY/IdEv9m4v9ulmfOV3C/9ALAWjNowimqDYjIrkNu4bt7jCXuGQw0dSDzqOZrLH90vtgVqbUN4fqxOQIQH5rcGFzKbV63nVzmPECuh6QIIvoMLuYOgXavVU9A1rLBbVpm+bv9Z4i7y6MdIoAJYBa1GFbzYGJPqfpw== 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=By1HjPEIvs3mgUq2ZvvggQGfUi8iRmZM767HTom8FzA=; b=h8jQ8NR6MUJzNczCfB94AJ9l4s+7LCXQs6jX3LytUZqRYgcfZMfyEsdwdwOZ6PzWtrgYRVXsGOV8iPU5HwD8bI+ngPnUdk7y0lsn/QMsuPPMeeCoNcdzQXhkP2TcuniQYHiSNhxmm2poPaB9GyWWLUzRmEScBRja+QDoiCYhlgU= 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 AM6PR04MB6182.eurprd04.prod.outlook.com (2603:10a6:20b:bb::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5566.15; Wed, 24 Aug 2022 01:09:05 +0000 Received: from DU0PR04MB9417.eurprd04.prod.outlook.com ([fe80::3c6c:b7e6:a93d:d442]) by DU0PR04MB9417.eurprd04.prod.outlook.com ([fe80::3c6c:b7e6:a93d:d442%4]) with mapi id 15.20.5546.023; Wed, 24 Aug 2022 01:09:05 +0000 From: "Peng Fan (OSS)" To: bjorn.andersson@kernel.org, mathieu.poirier@linaro.org, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, shawnguo@kernel.org, s.hauer@pengutronix.de Cc: kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, linux-remoteproc@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Peng Fan Subject: [PATCH V5 4/6] remoteproc: imx_rproc: support kicking Mcore from Linux for i.MX8QXP Date: Wed, 24 Aug 2022 09:10:21 +0800 Message-Id: <20220824011023.1493050-5-peng.fan@oss.nxp.com> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220824011023.1493050-1-peng.fan@oss.nxp.com> References: <20220824011023.1493050-1-peng.fan@oss.nxp.com> X-ClientProxiedBy: SG2PR06CA0192.apcprd06.prod.outlook.com (2603:1096:4:1::24) 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: 17968ff7-d061-40be-c012-08da856d3d5e X-MS-TrafficTypeDiagnostic: AM6PR04MB6182: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: oPTgP7h2d3M06HMaTx56u1TmNMkdd1FvHngbwJ1GCJugkpraNZ//cc3AT6d/wfUjf5pUuIDmdfcP/cLfh+seVvkPAK+JQrKYKbpc49BYCcgwA5CB7C0n0RB8I8KclDIWWf3XqvI+nH/XLgH2KhdX0kSCHQLgmT+xBL8nunXrg2zNgL2/dFMROzn1xoBLH1lkxKl3qQXCCTWpwZQB+dAtdJMgBXaara3a2QcvuWgo1d/B56mGs+qjhrF4tvIRy/ez5CXxhu6hOhMExJiv/5r4acnBprgjOAX2Zl0OCWnW//6oeGhNw10nHj2GPQzQeSNmY58pZ+OKqCkN5Q8rBIuPKz+og0YPm+UNaAA8K9kLc1to5LHjrdm4n6OY5bATFcmIM4YqpZApcWHupzB7DZKXSrvBmsiV6gvE9kKTC9zXh8PoDtHKiVA5K7yQKceMagPSMfW5pyzfAG7PsIBjCRFLPRRPDwaRN+xemWjQzVcAAhCkYJZiEi9ubj+C4smzFpmhRFvizAluLgOkhFtxJNIrtRy/PGFy96M65qcySmDPp6XlKYXnFbVQoujq9IKyk1aYRp9ocbVjbvpOqkX9v6I8eXB9B1u0Vn29R2wqhF1N7I3t8qu/3A/9LT7rIZhely2KN0TQ/6gB5re3HOMmQEP+/q7dpcFeiJ8ZZ4nkSa8XwiQZtAZyCKH8OH1SZAQ3LouRDIb38e0+QHKbBbQ+5D230ZKtccDQwDeiBbnBazRwvvw/1m3/jaXqll13/Zp1upOKdpnf+IyVQyXJKkClZn3oSw== 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)(39860400002)(396003)(136003)(366004)(38100700002)(316002)(38350700002)(41300700001)(6486002)(66476007)(8676002)(4326008)(66556008)(66946007)(6666004)(478600001)(5660300002)(7416002)(26005)(6512007)(8936002)(86362001)(6506007)(2906002)(52116002)(1076003)(186003)(2616005)(83380400001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: qE0Gr/aRsSWUDLUmyFx6v6b7HVnU3up3wGchfF5YRgedWS0QzzPUgvEuFwXYNZZ5PfbNu9nCslkerzF6JHliUcuR9ltOiatasl24XAsNuKReSVvFjTb38NxstjhQ27Ky3kq4R5N5e6nCXfpBwvdrTGsq8s9G0rC0KssEjC3mXgEBfNYbAk88A/lGHXG1GFLFKr8Vl/+BcX4yk3vzirlGanujFbqUWH+zPh9Qne+u61YPNG5u6/ThG7Ht5x6fFynJ489Jwc23JdxDKD4Dvgnagi3Oxzvbe4QcTBZoAA2NAL+zePqSqrD+dRCIPGcoOl1FlgEzlDxkxi1zxLQ19rGRyO/ow2GhBIPAO9OU0PcyHK90LotQCzpmPI7zzxx/f+fGgrx1KKvnTKXgZDwANbhzoe2/2wYpiHXv8rKtS2+9W8o1ALruhU4vc7oR/fU658prsvJ3mfkgafZ2Bb5BlmPvobzd0KtXn1ATgrLX6ogR7+AL4XnXkAWk9t81htA6U1g3Kb4Eic4pLLXPPSQZthNC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.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 17968ff7-d061-40be-c012-08da856d3d5e X-MS-Exchange-CrossTenant-AuthSource: DU0PR04MB9417.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Aug 2022 01:09:05.5615 (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: jv05Ep7iUeV+Y5Glul0+3orK5SDba0dLhBPhzwzoCeBn2E2TpRpK6hl3kxz7c6p6W/RdCkfVF9Kw0BlAHEbCdg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR04MB6182 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 bcba74e90020..8cc8bcbbd895 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; } @@ -713,8 +726,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); @@ -736,6 +749,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" }; @@ -770,8 +846,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 Wed Aug 24 01:10: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: 12952782 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 45ECAC32793 for ; Wed, 24 Aug 2022 01:09:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233356AbiHXBJi (ORCPT ); Tue, 23 Aug 2022 21:09:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57136 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233145AbiHXBJR (ORCPT ); Tue, 23 Aug 2022 21:09:17 -0400 Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2063.outbound.protection.outlook.com [40.107.21.63]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 71B518A1E7; Tue, 23 Aug 2022 18:09:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=C07k7/UvYRh/m+IONljNjNLy/RHVeJAPWleW8g/aCNkEQ9O9yByTUmO6iRiM0GFbTJDgsY+YDogQCSFr6ZVzq0blfPliCV8lMN+WUTfnRMpFetZiCg/zNbUc2OP5glNC0gYu5UBx0JRmnt0K/AfL9MoKWGVFNfF5nHW6ymRqFCp6kNAEjB2Cj+yVuTWZkQtISDhy8f0Pobey029BhSew4TiaIM6uyzIo47ut3GcLGDxnnjAm2U52MvYzX5EaT0C8mN3p0+xENjN2DNvs3Mvf1OHd8kk6bNdsc4LyVmt97OZa2oAivVJWQhDRVlshCuBNezRzCO5lGVayFl520NFFgg== 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=eUT97Dvt3ucUmD9ppAfywi0D0H3XVw1WsLuuzUvm9IU=; b=P9qi1TjYqCtGazEwWAwfX9hoUqR98zYb3YWy2e+vscj5eUHR0ogPKVyDbRGy3jVvXcXHAVRVXS0AUYFqs26mrGPke+xJo5il3SGXEKUc5pahyoY9NRAM5UOieLdkybgukvuHKjFg7cXQaaBPYS5rzD+h0LEQ40OIL37gbf/C2dXAJ9Ut49mi+IXzqaBf1svkk7ppA7qg0grSuhYCHNBPkV1/Ty31DOfaqUD4d7hyfMGXFHZRGVbQq6vF3zdXtS2eYpze3Yi9zVd4TQC5vFBiEK2aXWbKcKqMM15YDPhISTTheSJ9CpWM6gistIajgo3pycgLaAircI9FffhhhK0pGw== 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=eUT97Dvt3ucUmD9ppAfywi0D0H3XVw1WsLuuzUvm9IU=; b=fO0KEhE7+tNFm5VsDqTV9+jyDGbU+YWJ6TSdxIAzISt5SqzsjXslpYgG0zZvTZSi2CVzgeBus/+VXA5wfMsFghS8JKbh0stllhxf9wF+GqluWh4yfAsunCDPWxaeVC5StK3VDRxJaTcMapFUPzPBnDV6PXL1ca0rSDNotXG/0hE= 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 AM6PR04MB6182.eurprd04.prod.outlook.com (2603:10a6:20b:bb::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5566.15; Wed, 24 Aug 2022 01:09:09 +0000 Received: from DU0PR04MB9417.eurprd04.prod.outlook.com ([fe80::3c6c:b7e6:a93d:d442]) by DU0PR04MB9417.eurprd04.prod.outlook.com ([fe80::3c6c:b7e6:a93d:d442%4]) with mapi id 15.20.5546.023; Wed, 24 Aug 2022 01:09:09 +0000 From: "Peng Fan (OSS)" To: bjorn.andersson@kernel.org, mathieu.poirier@linaro.org, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, shawnguo@kernel.org, s.hauer@pengutronix.de Cc: kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, linux-remoteproc@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Peng Fan Subject: [PATCH V5 5/6] remoteproc: imx_rproc: support i.MX8QM Date: Wed, 24 Aug 2022 09:10:22 +0800 Message-Id: <20220824011023.1493050-6-peng.fan@oss.nxp.com> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220824011023.1493050-1-peng.fan@oss.nxp.com> References: <20220824011023.1493050-1-peng.fan@oss.nxp.com> X-ClientProxiedBy: SG2PR06CA0192.apcprd06.prod.outlook.com (2603:1096:4:1::24) 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: 051de99d-6d6c-46c3-86f2-08da856d3fe7 X-MS-TrafficTypeDiagnostic: AM6PR04MB6182: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: rpVOR4h52QaMgaALys2fe50lDlCKbQDKF0MRDkVR6++Df0bJJVdaiKYfrqrv+DcFIFVBc8apmLn3xWeyzt88oaKpMGy/BbilV21jbIR/LquF1e3Y6hEJRAkqHqrrI508flk/xCdGp5gwYA3tdsnKJJk2SeixA9zk7kLU9wvNzVErDv+rpvSfK8g8LQ8/ruYskKT+keCbPNvWZoIcqrwhTlVXi9jeuyQd6O80gzN6/6g97qEb7mFzviHihhykfoLxgRP+dxRy97+nz151wqsaRG60xLzH3P6y0wriHnXeqzjbg6GYpXUZc9bhiS28S4w+MZeBimj0ae5rq45ebHQi/Tzkx7yTTZpgKi6zXXwYmS/s5FUBzR8ety/7VzGArJLHYWEmEy3fFwUYMqI6dS8wGEyPws8jvQAqsj751j7yuoBbN0gd7x3u/6kXs6BOZUq0THPgq2LKiyWvJvL2m7jId9QnTQuyPyNsJz+Z+Hpffud1zX1ClYAE0kTBSWAe3u0hO8Qwhqujlm+Bjq2hXBHRhj6X+n5guW/vmL83GXAv/r7j5PCULGm1SKz3r8RNz236tJDtO+z2g8j0H/yCiEvpbsvTi6wtlNzeRye0CbDTylM1mPAARb90V3uADtrnrvX6S9ZEnb9XQJhuAffDih7NAlOvSngT2GX3QLBu3z9YMe3IskizZT+BzZedNfY8fNqi9ynkLSfS4i/CfRem74RhkkjsFc6yNuV+BEb8nfrJkQdUiK3G3TNtbLSXBjruBQepQK5OLxgJJhWEE5EIy31uGw== 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)(39860400002)(396003)(136003)(366004)(38100700002)(316002)(38350700002)(41300700001)(6486002)(66476007)(8676002)(4326008)(66556008)(66946007)(6666004)(478600001)(5660300002)(7416002)(26005)(6512007)(8936002)(86362001)(6506007)(2906002)(52116002)(1076003)(186003)(2616005)(83380400001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: x+WJQZtHHPNe0RalkOOz65rzo8Do2QhJ3z+q7JTPlywBm9n+z/H3dfESy0UEHbqPGt6n0wEhZPvu5voYIpNFZpPDJwTHLqIa8hqt1KSq5cZTixvtqTry11LG+DPVegvd/MXkuiBNzEZy+jfQzzlCDn5adqtftHl2xxoKEBb32sbUQ70/CthtT5IDG9/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jc7QHbufhSOmT8e4ETvnFRqx8f7srIkO9P9qZq9ntxhmfwOH15KnGpZD6j3cTkZjCxWxH0D2QcerWD2B6gbCjmf9mgvtEYoF9iB/vTG54fABD+FswO3Dp8i9Vu3s8g6N9EoVkqZVWb5YOfeAEjw7DHtDKB6hyQ0CmvVpaf3FE/NwNJFLfcPtseDJwt8ApOX54xlSI7jd/DQvEHDVAUMVVO1ZvjBKMjQsx83+9F/8ROJ3mHHCIwxDVAUgA1HgwwrY1nzlvStMYSUgkhyyzx4h+UOYQxPNhn3KPQa/yePzZqyIIfH+2u4AJPP4qBJSYwkYtnh4laB3Me X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 051de99d-6d6c-46c3-86f2-08da856d3fe7 X-MS-Exchange-CrossTenant-AuthSource: DU0PR04MB9417.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Aug 2022 01:09:09.8144 (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: 3fBzRkmdxu4sL6emlLk5hLYrhWThWJCh+kwaIrD+ZRkeqMn+Rj9V7IJ4g6yV/OPJubrFseE65XZAgaoUrtgwHg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR04MB6182 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 8cc8bcbbd895..9e46fd9bc2d1 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; @@ -842,6 +877,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. @@ -1038,6 +1078,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 Wed Aug 24 01:10: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: 12952783 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 B9C7CC32793 for ; Wed, 24 Aug 2022 01:09:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232984AbiHXBJl (ORCPT ); Tue, 23 Aug 2022 21:09:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57042 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232997AbiHXBJZ (ORCPT ); Tue, 23 Aug 2022 21:09:25 -0400 Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2063.outbound.protection.outlook.com [40.107.21.63]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5B6848A6FB; Tue, 23 Aug 2022 18:09:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Z2M4Vf4jgmHGd5QLNRujyimbD9SlGnD908omnQnF/8pKaUdlnstlkFbeDf91LHZVcuzm731Aa2YoUPry05IJC2Q6iO9eoGI+ipTSWAHJ4E1NOJ/M0fZSfkPVgqlveGTcFJE2pLTlPXWLOniUGB4R0IArmWOCfmqMOslAvaA2N1jr2CAwXCMHI11qRWgvjxixUkKsAWnSwYzWoofILCAtYUL0kJrTRrqonhbbd9qcV/lb/gO9mAYdLUTJZ2jeL1SkvXXSODujjbySIJ3Gi5vmWF25mYe/46CzEkMf8isNF+rgtG7jBojz6ltJW8gSwcsiaYtg3nOzCC7VRbFdZjKmJA== 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=lbowT/KX1lAN42MBJtwjvOdXo3KDkHqk28b7ZdsaAl4=; b=FSq3FUaISJyA7yx2STit8YZ/SVFiYDcJ7ysntsjx14yck9OpMEFBBTMLlKByhq5zATXnjrvnTp8WJ/8PueSDYHZo3k+19wjup7Iv2K7d35UDeg3tuLuG5HpdA42PVYuojvYIAjcHkZByN1b2ryBTFBAUeUAjhbQT3MehxuZ0bu+D9CotU3AjCeUNFBD6pZXwb3j5mDvSbU/ShO/TczhsQHDwC/4XekqjoDQp0Dr38b2t/ZgCYcE5kI8gIrLYIeJP8ln5cA1nR3B+Fljq01ng/Zh/jILlz/KImJ+EWvAeOhxx52yv/otPedaYux5Y2u2oeI8KeMy3vtqXA2/i6Gz03w== 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=lbowT/KX1lAN42MBJtwjvOdXo3KDkHqk28b7ZdsaAl4=; b=BDylb6GzCmveuNJIFwYIB/mvr5AtL2VM0Er9jOml0whr0euDBtYlzPsusdW3Z7ROOQGkRPnmdZ80sJZafrFISTYFftDAZr2gKyWNLeskX+3Hec0949nbOpdOsl6/ODH7mGiuqGVG1wSbPRpFG+1f3nUVvnEJLC2w0EPL2YVuPoA= 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 AM6PR04MB6182.eurprd04.prod.outlook.com (2603:10a6:20b:bb::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5566.15; Wed, 24 Aug 2022 01:09:14 +0000 Received: from DU0PR04MB9417.eurprd04.prod.outlook.com ([fe80::3c6c:b7e6:a93d:d442]) by DU0PR04MB9417.eurprd04.prod.outlook.com ([fe80::3c6c:b7e6:a93d:d442%4]) with mapi id 15.20.5546.023; Wed, 24 Aug 2022 01:09:14 +0000 From: "Peng Fan (OSS)" To: bjorn.andersson@kernel.org, mathieu.poirier@linaro.org, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, shawnguo@kernel.org, s.hauer@pengutronix.de Cc: kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, linux-remoteproc@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Peng Fan Subject: [PATCH V5 6/6] remoteproc: imx_rproc: request mbox channel later Date: Wed, 24 Aug 2022 09:10:23 +0800 Message-Id: <20220824011023.1493050-7-peng.fan@oss.nxp.com> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220824011023.1493050-1-peng.fan@oss.nxp.com> References: <20220824011023.1493050-1-peng.fan@oss.nxp.com> X-ClientProxiedBy: SG2PR06CA0192.apcprd06.prod.outlook.com (2603:1096:4:1::24) 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: ce8b5100-f773-470d-c989-08da856d426b X-MS-TrafficTypeDiagnostic: AM6PR04MB6182: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: iJGkkSQjY5/5dE03z9xTXotQYlMOgX7FwdTXQ+SrYabUjoqZE3NIUGxpXNsrC2S6/TRRvKI9XGqtoSDX3iXpK88SBFYCQOeA4xc1TG/3EgiSVHtfW9Jr7vs979JvUnJJmIKfI1fF/jeaeCOvXNtK43mhufHErCCsHJAvwZ3IV7d/3VnWI2lc2j8WJipOh+L4ePtkmNq/jMTMRKJwuoH8bbzZhACaqWQvWnvK7E8trL9KhSHfF4p6ZltbzENM8uvzNvdMLb8uT8qYJQ9F4Hc2qMQE2ClAYDjhDR709OXOu4ISU+Zp6cPEdHBEsz7IN94NKVmsoH/8+amfIS3sgMuIpn+PoyyaVRAaeLm44MLsq9y2a/Cn4xpPdY+XlkU/o3xakaepgZRSRsjb4RkWB8pzxBMwmOl6wP+vDW104rNrr6RhCjqzCbBQu88vN9NvFczF49PU3z29g6JpVoGBr9WRrwqdLd8h3vZ4bLUShJwSoOUXm5HEwR3KQuMAIBOv+dg+KOpw/emDd646TtTwcyPt/ZYnNxbr6BmVgoQhmIqP5S2lahOVUOfuPCZJEb7W3O/OCRhCF94qkQh8bMHYJrZHvJ/ndQYYlKuNU9uvcLFRcD7TFPU/+bKMLw5FXgC274uEM3rmN/aqjtwDAyTojzPvgfyOtvoLhw0a2goJH9jcEIxtc8AJqEDj3ELfkEPDpsZIoWqR2qB2AaOHyKZ/jBw7cHA6OXne7ysAVveEPC1MUDFthetNAHAgkzn/xScGpc4+nP2JfJjzgcGiLoGrJ4gmvw== 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)(39860400002)(396003)(136003)(366004)(38100700002)(316002)(38350700002)(41300700001)(6486002)(66476007)(8676002)(4326008)(66556008)(66946007)(6666004)(478600001)(5660300002)(7416002)(26005)(6512007)(8936002)(86362001)(6506007)(2906002)(52116002)(1076003)(186003)(2616005)(83380400001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 6z9Hgn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n65r1dBA6PxLKETJs/10RXX9eH9iKuTwo7fzeaOommuDxGHw2P4Y2vnkYaxZAVp9d5gGSnGqFlz6c0rHoazsfJEuRnriYBiCgid5YDTacF2WlWz7YvCScuJaTZRHiGlLSK8zN/OnfVMsgXMtCrWssx6HsQvhsmAJff5AsB8miCU1J0vskuWj9jN+WNNS1gADhUpY+eQ2Ph0GgQfIdaDY0w2CUY1jFQYio37qGpnT+6LH0GGeBwf5JotHdSZ3XDdemkw1MyFMfeqA48ByAKLSZ0bT3wthZE6yDNjQL3nKW65WzxKUet80KgeFGi5aeLvE+NrwUh6/fEVZWD7CEj0xucC4Nt0QT8UsUpQCVbaYjBypkwFcXZXPoBWcnt+H5NwwHQRYf/A2+axfA3q/4UEu9OG1TcpyXzHLDk6bFiSobxPVYSKT3Nr/nRV41BFBb9NcQKkY2lPvSZkdZB5gbT7vUV+M/ROqYQu6zx1o0Py1B54uFaX13b8hf6dalJ X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: ce8b5100-f773-470d-c989-08da856d426b X-MS-Exchange-CrossTenant-AuthSource: DU0PR04MB9417.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Aug 2022 01:09:14.0666 (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: XWUVwj082n8Vs46Mo1Hz7PEct2bePa+Fp+3DgjiXc3PJRfoT1oFuLxSk3MLW2jNK2Sqbna6TnHtoT76Xg+0Nlg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR04MB6182 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 9e46fd9bc2d1..62726efa8ff5 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) @@ -720,6 +728,9 @@ static int imx_rproc_xtr_mbox_init(struct rproc *rproc) struct device *dev = priv->dev; struct mbox_client *cl; + if (priv->tx_ch && priv->rx_ch) + return 0; + if (!of_get_property(dev->of_node, "mbox-names", NULL)) return 0; @@ -749,8 +760,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) @@ -777,6 +795,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);