From patchwork Wed Mar 9 10:21:13 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: 12774867 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 F0570C433F5 for ; Wed, 9 Mar 2022 09:41:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232204AbiCIJmK (ORCPT ); Wed, 9 Mar 2022 04:42:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55824 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232206AbiCIJmK (ORCPT ); Wed, 9 Mar 2022 04:42:10 -0500 Received: from EUR03-VE1-obe.outbound.protection.outlook.com (mail-eopbgr50074.outbound.protection.outlook.com [40.107.5.74]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C862C107082; Wed, 9 Mar 2022 01:41:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=doSXs0GTze7ZXVb14eIc2sGNZrZXNQp1QlXQKmwlKUpSZFqkjM94Cw6x3NV0JweumrfnQT8F3ZMGPsd37RcRnLCKhGR8SbBpQEc8NWkjoq6HK77K7+Z08AHNUt2WyBqKGvEpddp+SkpoPAGRqe3UMW6Lf0/A1/KnoHyno4727O4IUnZSJbC0XjJNhg1nDUL5N/VKLArEV8n7Oj+R9eMrLDSe95xSAkRViNFm72zfca8OUP6OBKvmFZqEtwYHOTe5wEkZUxpDryUVyDYxIMaTuTtQ9CALnEqJd7rIiMj2w7WtxT9P+QeAh4sxqju+OMrQOEfoVQXnsbqSQKlKPY+cxw== 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=ExLTEwXgXZgnyy71qgkAc2gC/WZ3/iTeNkvgGN+0f/c=; b=TPyFjoE7IYkvkXAXqQ792xnBQGUDxxJdApS2SXm9j8Nh4G/1QT8d//+qkHVBvkv62c48hU6i372HEM5VREDVqiXvT4vVWefjiqOU2bTG4GVeedxd8Muv4z6nSIpDfzSRAjdWJwNDrj9PvsaGYfUu/Bqhvgt1JphgjW68Z74g1cEVEbvvOaMPqE3p1CIuCokhv2D0DWC2vd8O8HfloVxvJYSZyC1bVXQrcfih0PvBEGe0ss3K5hQFVTloWdNdMBxBBpGN5QNwo7cjbzBji/Al/wVw23khLTKrGKq7cs6ub4etGrC1Gr69re5GhKiKlVukoQbgDc5OndEzWebDPHhaMw== 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=ExLTEwXgXZgnyy71qgkAc2gC/WZ3/iTeNkvgGN+0f/c=; b=EFrJP8mvjG+uclhiw6gIoeRWgbd0290V2X8QnB0LCakuD8gTIyDk/YNphY4n4nK3jXUs98A5Ojku0mBgMgPlDlRGBBXR2lauyWR8ZpNoqYCGIlxII1B3KMWolyNM0/z1oeZE1I3QMzxbiQWxflq01evbsxrgJbvz+phEvTHksBw= 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 DBBPR04MB6043.eurprd04.prod.outlook.com (2603:10a6:10:c5::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5038.14; Wed, 9 Mar 2022 09:41:08 +0000 Received: from DU0PR04MB9417.eurprd04.prod.outlook.com ([fe80::5538:7e34:6843:2bc7]) by DU0PR04MB9417.eurprd04.prod.outlook.com ([fe80::5538:7e34:6843:2bc7%6]) with mapi id 15.20.5038.027; Wed, 9 Mar 2022 09:41:08 +0000 From: "Peng Fan (OSS)" To: bjorn.andersson@linaro.org, mathieu.poirier@linaro.org, robh+dt@kernel.org, krzysztof.kozlowski@canonical.com Cc: shawnguo@kernel.org, s.hauer@pengutronix.de, 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 V2 1/6] dt-bindings: remoteproc: imx_rproc: support i.MX8QXP Date: Wed, 9 Mar 2022 18:21:13 +0800 Message-Id: <20220309102118.8131-2-peng.fan@oss.nxp.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20220309102118.8131-1-peng.fan@oss.nxp.com> References: <20220309102118.8131-1-peng.fan@oss.nxp.com> X-ClientProxiedBy: SI2PR04CA0002.apcprd04.prod.outlook.com (2603:1096:4:197::17) 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: 38e72da6-01dc-48a8-d94a-08da01b0f03a X-MS-TrafficTypeDiagnostic: DBBPR04MB6043:EE_ X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: wA/d4gN1WYbqOCSJKh6DBU4o6ZaYtl0YeUoVPmGCRk276t+sUdBMRgRReVtfMd25tOZKxnL0gSj7JpazVAv05n5w9jtb132x9wKhjIAtkmetRmZN4b9Qe7XmWMW1zLCmROHD/LQOBEdrebkrlQZdh4fo5vzspoS7qSkTJrJehkcHLNrUXQ2WzRNKlmNQLoV5W8/olM0RI/uIsM382XrbGTAGZ2Mi+CbBI9lAyDAvELE6Eyirgg43NqvYkzZa3glltIlv3qjeiV9uit5M+3Oh+4iT7TwFkVhsA5Iu4Ryi3flSetjvjKRokrHLs/GuYuApLvh1/cqLswA0FV0AzkZsL/wLYPJkR8IaLlgS7+r16pL5n1LP6yqCJWu6hNTpdQ4s030gMdqh8XiO6/14uwexMd7Hh7T3Hjt7LO5upOlZjD/x3gQ9eAnKf0M9wwYPomqhgL0lfxqiKXqDv4Ev6Mw3BzwWcCX9+a3PsjM6OhkRvtW2b+UFis/AMcYX5Iv0KeFI6BhaRdDiQ+O1K4qvK42iDyH73Tu/g6B8LdKuQg8bvlc7RojhJ2Abp3tP+aYRsdmxZf8/b/2PWlTdAPjvkvlLI8A2ALts12YKJ7McQuGnj/X9XaVcbHMSIkNmlSRnBNcT8qMc2DPI7eDPpVASw39LR3RTI1Gei4djoFDLYqvuciDqN2ybF6lb0Vk2EIYJl1YjYqTg6EdryjpsvJJgep05kQ== 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:(13230001)(4636009)(366004)(86362001)(52116002)(66476007)(66556008)(66946007)(6512007)(8676002)(8936002)(7416002)(2906002)(6506007)(4326008)(6666004)(6486002)(38350700002)(38100700002)(5660300002)(498600001)(1076003)(186003)(26005)(2616005)(83380400001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Ur/dcav8L+v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D2zy2UrwKLEa+lW88NmyMbkvoRgn1/GskZtR01ax9gC8H3MAm/G5huYHhVz5JB/2Ouznsj9O7ffdxaqjtbd8rIhOGxPNJEmk7CpzoZPyp4ri4u0UNbhjiYDajR4zfDeXQJ+W0qsBcYpzdWMf4cl8kpuKCCaF8GSEsjISSbwd2QxtG/2bnZGuoq4RfLjGsD8xETOQiUJ33Hp4xH1h4XorOgKQU7wxFMtvQAiOj9HQPcLTQH4IWtgHni8VKI6vLsLEbLzIIztFCq9kyq13jQEuiSSg9xnqtro7yD/uWQQvwEdISAQUZ8c7gZ0oJ7gABGtYsBH0xjU54VACa/3D2HapU201q3TllMe8DsbDOW7w+YJLdUCpRBd/P8qW/n564NsBCacpfLW0qWdJLxCU6Q4okk4SBED36WpcC0pC4I1D0zDy3fsb/8dmKSJfK8t8HXYAq0hWEu07UwQ2xzQ5pXd+XzbxdmuR8o9lZOiCmvlxWNWBeSQBXm2kW6kyGkx/zuWIrAwwJIxLc0BAfXeJlOed/m8RkUl9ZknGSXM7kp+TS23y+FajDlBjE= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 38e72da6-01dc-48a8-d94a-08da01b0f03a X-MS-Exchange-CrossTenant-AuthSource: DU0PR04MB9417.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Mar 2022 09:41:08.6512 (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: Op2EpQ2j7p9d6dEGadcWXuAvgt5wXvjahWOtKH2hDpznrsPQzYk9yWYRntCkJjPlkikvrW9Uz4/tQPpwHJzNrg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBBPR04MB6043 Precedence: bulk List-ID: X-Mailing-List: linux-remoteproc@vger.kernel.org From: Peng Fan Add i.MX8QXP compatible Add a new property rsrc-id(resource id) for SoC which supports SCFW(System Controller Firmware). SCFW manages resources using resource id, here the rsrc-id is used to check whether remote process is under control of Linux or not. 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 --- .../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 fc16d903353e..f25c203dd2f9 100644 --- a/Documentation/devicetree/bindings/remoteproc/fsl,imx-rproc.yaml +++ b/Documentation/devicetree/bindings/remoteproc/fsl,imx-rproc.yaml @@ -19,6 +19,7 @@ properties: - fsl,imx8mm-cm4 - fsl,imx8mn-cm7 - fsl,imx8mp-cm7 + - fsl,imx8qxp-cm4 - fsl,imx8ulp-cm33 - fsl,imx7d-cm4 - fsl,imx7ulp-cm4 @@ -27,6 +28,11 @@ properties: clocks: maxItems: 1 + entry: + $ref: /schemas/types.yaml#/definitions/uint32 + description: | + Specify cpu entry address for SCU enabled processor. + syscon: $ref: /schemas/types.yaml#/definitions/phandle description: @@ -59,6 +65,15 @@ properties: Indicate whether need to load the default firmware and start the remote processor automatically. + power-domains: + maxItems: 8 + + rsrc-id: + description: + This property is to specify the resource id of the remote processor in SoC + which supports SCFW + maxItems: 1 + required: - compatible From patchwork Wed Mar 9 10:21:14 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: 12774868 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 3314FC433EF for ; Wed, 9 Mar 2022 09:41:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232218AbiCIJmQ (ORCPT ); Wed, 9 Mar 2022 04:42:16 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55976 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232214AbiCIJmP (ORCPT ); Wed, 9 Mar 2022 04:42:15 -0500 Received: from EUR03-VE1-obe.outbound.protection.outlook.com (mail-eopbgr50085.outbound.protection.outlook.com [40.107.5.85]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B46BC10708C; Wed, 9 Mar 2022 01:41:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KU18m2Z33aHwjUx6hZXf8mhARa4qnB5nYuurRa3qWOi7+gAffy8mHef65pehO9xPJbHkN6l4iSjkmQ3+JuflYRObeYbkCJlXuM+HEqsnwQ+ffOY2cKzBpRBzlzG4wDniPasMj5MugcHRaVzzxuvpMvlBOCPxxvQn8U18nctOYclWMcYZ5QT50cSCQ0n9PubeJbHw01VEXndoTSL+vKJ8Yt7jSUt5xqKKCyv9vgOvDs2aDznTNLDvEsBPvIA3xa7rGnL4HCigLsFVdXY5ztiqWrAUbREMXMtOeymBgTtuIrKdRH1tSj5hKvHPAk9S5cLAOQcCfzkalgFwyxL5tU5/FQ== 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=P/8yEkjUJ9cM9HYZi+vzoG+zthQuHeqTOJqAMHsBTPI=; b=LC8ZTKrGH8SMPk7NFw9FgslyPuRfxmN1YiPmI6uDjEPltQlhtiI6Rmk/f5mCCEZmh4GWFx25AyEq1xONlyZAtgYZNJJIbqgBO+rYrHj9uAIh0VF84EHFK4IneMB1DzItkuvt0p5/ZvsuR6HfAwRXqFYdRrxuSlIj5JOXPS6hNft5K801v+19Sw9UcgTFTcaxpIAsnyDCLFEAGX5nq+nrtIhGICGjVPriktb5QDcbLX+/gL8JH70BUCf5gHx+yU0tOeo+Lepo4nNct6ZIaVeogR5H16V+oi1JPonGcY8P4pMueUsoxGSlEb6XP+Sg2M/+YCoXFTaKAA3Fb7vGpIymnA== 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=P/8yEkjUJ9cM9HYZi+vzoG+zthQuHeqTOJqAMHsBTPI=; b=atMVmtgwyOHqJUj2nZ9FIIdTYFNbtd5s7JhEHouUHXD7o9Zeb7JVt/UZp4swRlWKRaT8jwgRYeqfP4NQaPw/XbpAHTjeJrVGZlM8QxijjS/a+4RulAW4/hdf0ilRzXENqFKo6ZmHAQATiyfjx3G2ZyqUBUxUExO78cqDtlFRrUE= 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 DBBPR04MB6043.eurprd04.prod.outlook.com (2603:10a6:10:c5::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5038.14; Wed, 9 Mar 2022 09:41:13 +0000 Received: from DU0PR04MB9417.eurprd04.prod.outlook.com ([fe80::5538:7e34:6843:2bc7]) by DU0PR04MB9417.eurprd04.prod.outlook.com ([fe80::5538:7e34:6843:2bc7%6]) with mapi id 15.20.5038.027; Wed, 9 Mar 2022 09:41:13 +0000 From: "Peng Fan (OSS)" To: bjorn.andersson@linaro.org, mathieu.poirier@linaro.org, robh+dt@kernel.org, krzysztof.kozlowski@canonical.com Cc: shawnguo@kernel.org, s.hauer@pengutronix.de, 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 V2 2/6] dt-bindings: remoteproc: imx_rproc: support i.MX8QM Date: Wed, 9 Mar 2022 18:21:14 +0800 Message-Id: <20220309102118.8131-3-peng.fan@oss.nxp.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20220309102118.8131-1-peng.fan@oss.nxp.com> References: <20220309102118.8131-1-peng.fan@oss.nxp.com> X-ClientProxiedBy: SI2PR04CA0002.apcprd04.prod.outlook.com (2603:1096:4:197::17) 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: ae60381e-e0ba-44f9-d00f-08da01b0f303 X-MS-TrafficTypeDiagnostic: DBBPR04MB6043:EE_ X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: wda/5QNK2BU9OhOcyLSvSpdPkN4uS3IsmIaLdFDkdb046HjJe1yDXseefSZx+6hVVDciwlvqmGE5AOflndkO84YMEVziSOqtp5KF/xExwBOojC9a+dfnUhh8p8rzJInRjG1qsuJo25G1ooil2GG/V0UX0NvTGFDTfOiAhsNdi7cIgX5M8Gp7aVQ9jnjIHTHixGH7SOIJ5sP4wnEm0/ucV0CLy28NTgBbzOBJXvgS/+kQ1c8zBX7DWZ/dCOiElX9wI64FlpjyZstmoDoLmqAAxyDYjvM6dVgbNrN/EiwDNGxr/4lTf1fluEQCAEjCcAbC3y1AZN10Sk9L7ahg6LjLOtWTyB88hVt8/TDAPVunwJ/FGbpuykOE9v94BiGFfdFjDLY1pDR+TLJ0ceGCHiy6H6WouO3yJG3iwtAyrSqDt4ci7RGPYW3+bwQCfbN7BXwjkZkKMpyY7lw2Qzi+FvNYByl+D63RZLgTolrhlZQ+9euS+TUEEDLSGDCk4temJg6fXby7KPsZNKUo3w5ugmpL89nXvIJKPvWG0dOoJKdJynIPR+tga5U/PCFoLS0uTRHE6VPzshCw15ZFOXnupJ8C7aYGLhO0jO0CiX8fdD31naKvNjPu2F8+DJ8gRAHxwU5AHP/w+K3pHso8a7aGNycQITDHE12k1H1ewLzFk94kWkgUpccZM93NZMS2krPML/fo1+FqrIINHfjOnuWrFb6hJA== 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:(13230001)(4636009)(366004)(86362001)(52116002)(66476007)(66556008)(66946007)(4744005)(6512007)(8676002)(8936002)(7416002)(2906002)(6506007)(4326008)(6486002)(38350700002)(38100700002)(5660300002)(498600001)(1076003)(186003)(26005)(2616005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: TAb3Rwi0t7abseI6f1FMhXuzEkFEg/6fk2Ttr2NPC1/yI+ZyexLb/b50Y0/jV7IlRKP+hJgUwIVJtKv01zzr736UiMQJKp3rTnmw7Wu73gHXWGMC7gj5S3qtI7tF758lm37xdrNlD85ybzJq9oy+eqZ+3woUCrvV5qVNcOz8caevA4t8OEIXJu1xipSeidSW44LyzguZQyMzjBih7cV6ri2dY0DaTYwEvCxBl2+TCGl5CTKRZEHYVNSA7yTy+4KsTxJSrbxz+Y/dpEbx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0vd/gIyAnb2mGsJ34Q0/34ZRz5mgr0GHTLqVg8R2MTa46SfCtxTGrGxXrgAa0elknUljz/iYpvHJG3A2A2g/QFOkee407v6W6hIktZNzA45DhbixFghAEyTp0X7rt87L84tYOx0GPnc6lB75hj1LLWA0PYeyneSzKHCtjNey7+S+6qgW89lcy2nNn97PBRBt8pXJWcdyrGdFSj0jHec0a17NDKtVE/D/jW0a4oWCpWQY74ywzXlTGPYC7OipQ9Zhjqwi05odcsLyvQC54UM6EpS7KOuObnLAFggXQCec= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: ae60381e-e0ba-44f9-d00f-08da01b0f303 X-MS-Exchange-CrossTenant-AuthSource: DU0PR04MB9417.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Mar 2022 09:41:13.2456 (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: XQkFCmLh5rK1eM8YskuxwqI/dc21DOeUG+wcH/p4ds3NsRxakaovcdRZo5V7ULXLyJyzegBOjwn/Kv5A5WpT0g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBBPR04MB6043 Precedence: bulk List-ID: X-Mailing-List: linux-remoteproc@vger.kernel.org From: Peng Fan Add i.MX8QM compatible There are two general purpose M4, so add reg property to indicate the id. Signed-off-by: Peng Fan --- .../devicetree/bindings/remoteproc/fsl,imx-rproc.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Documentation/devicetree/bindings/remoteproc/fsl,imx-rproc.yaml b/Documentation/devicetree/bindings/remoteproc/fsl,imx-rproc.yaml index f25c203dd2f9..41d366cff3cd 100644 --- a/Documentation/devicetree/bindings/remoteproc/fsl,imx-rproc.yaml +++ b/Documentation/devicetree/bindings/remoteproc/fsl,imx-rproc.yaml @@ -20,6 +20,7 @@ properties: - fsl,imx8mn-cm7 - fsl,imx8mp-cm7 - fsl,imx8qxp-cm4 + - fsl,imx8qm-cm4 - fsl,imx8ulp-cm33 - fsl,imx7d-cm4 - fsl,imx7ulp-cm4 @@ -68,6 +69,9 @@ properties: power-domains: maxItems: 8 + reg: + maxItems: 1 + rsrc-id: description: This property is to specify the resource id of the remote processor in SoC From patchwork Wed Mar 9 10:21:15 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: 12774869 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 281D1C433FE for ; Wed, 9 Mar 2022 09:41:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232227AbiCIJmW (ORCPT ); Wed, 9 Mar 2022 04:42:22 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56146 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232226AbiCIJmU (ORCPT ); Wed, 9 Mar 2022 04:42:20 -0500 Received: from EUR03-VE1-obe.outbound.protection.outlook.com (mail-eopbgr50057.outbound.protection.outlook.com [40.107.5.57]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 09555106CBA; Wed, 9 Mar 2022 01:41:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RcboNrHUzvlcFrjV/wyMfr/eJA8pqw65But39ckDOpfMP4ycyJxXHRR8Fx4PYZg7sft2yCXiqi1meXaiD4z+SndxNWwqS8r0ARJwELIJLrArQ05sd6u5hIWHCN7w9Z0UbemERK6PFoLCDXURrNmMm+yEFeqE93lDgpgQNOGzXqnfCmHcGPwHnO0C4dnx35+h9HXyRpdMEDzf/9hNITdWRif5qgh16nYWURfJ4JMddibJGvriYpl/T1NJfLRcjTxim2gNvK4wlHMiAeTKurHLUoeq5fje9bwqr/te5qp5BqQcldnaILcRH2rg6DVrhvCocv563s9wBMYd8yeMpQbyww== 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=qyn2MQTRJ/FpUg8C3Fh7SyAQ5PK1OzhBx3P6+6I92uM=; b=ZbbV7Tt6SSp8WWsKEvqGozTTclRGxcPy7zMiQttwWwmh5FtvJTJo4vwpZJdzZL2hryQpq5fcm/5oZEphujXCC1WfS1Ahv6fX1bmCkhPxz4c0T08NslbKaYVFVQI77aj2NeAsA3/krU3j2LvStlL29AVrBMl5sVBLlfADt1tzTibfzbFNvk/CEHhQBiqL/IxRZ3Mdirl+ugU2hc/W4cNTyImk7vKC/CMoBzMrGFV+8uNd4np6NXz9ajcbjqirV0l2G0v5TQb1YmbatoDvuZSDGgHXYQySpf6B68g2d3wAlr9K6rKMcBIjDsCMGCsTYE2oaJ4HyLjETGFpQe9EkxUsFA== 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=qyn2MQTRJ/FpUg8C3Fh7SyAQ5PK1OzhBx3P6+6I92uM=; b=lboNj8fShqvO6p4fkXfKBcx8jAbJfyRQQTyLVGOffbzZRmIz968990fHV25McW/Wf2LFJMGo/0O+3zDYmECuMik9VQ0AANDW9grIJ7yrfsQIhMHh93b/fAhAR1uVF/xHPDKjyHbV9JGAubBTMmojx749ocwtpuCOY1/nRgepxKg= 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 DBBPR04MB6043.eurprd04.prod.outlook.com (2603:10a6:10:c5::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5038.14; Wed, 9 Mar 2022 09:41:17 +0000 Received: from DU0PR04MB9417.eurprd04.prod.outlook.com ([fe80::5538:7e34:6843:2bc7]) by DU0PR04MB9417.eurprd04.prod.outlook.com ([fe80::5538:7e34:6843:2bc7%6]) with mapi id 15.20.5038.027; Wed, 9 Mar 2022 09:41:17 +0000 From: "Peng Fan (OSS)" To: bjorn.andersson@linaro.org, mathieu.poirier@linaro.org, robh+dt@kernel.org, krzysztof.kozlowski@canonical.com Cc: shawnguo@kernel.org, s.hauer@pengutronix.de, 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 V2 3/6] remoteproc: imx_rproc: support attaching to i.MX8QXP M4 Date: Wed, 9 Mar 2022 18:21:15 +0800 Message-Id: <20220309102118.8131-4-peng.fan@oss.nxp.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20220309102118.8131-1-peng.fan@oss.nxp.com> References: <20220309102118.8131-1-peng.fan@oss.nxp.com> X-ClientProxiedBy: SI2PR04CA0002.apcprd04.prod.outlook.com (2603:1096:4:197::17) 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: 1cef5e2c-4a0f-4a5f-d0d9-08da01b0f5a6 X-MS-TrafficTypeDiagnostic: DBBPR04MB6043:EE_ X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 3KjuWW5z5PlW0OLA5mJS2ltq2iMMEh3eV9GcipYdiDsrOAdhWWEKKs9l5K+dnJ0OtheKMgkTiwck1qDcLtjqJm8VevpD9wgXHPNhRRVaz+u+XZVcrc4p6y7kCA9v2Ki+MZy3IGHn6fqxFOALvCRDYVapIKjJTfVw6T1i0DnBNFNuaExDr+FDnCpE0c7nTaJcb9vsQX7aUKOG2NlnF9qTkGk0+Z/05HxU0//y+CVaNnDsoQpWMFs8lk9CKsiw3HdjFF9coLKjRTgjIpJCeszu+Smii9cSkoyuxyvIMyAtWiBnU+8NalIPz6K2lC89I4x41FYUUj7JD70F7+gb6S1nFZMDEIijECXxaYCupsbEJhU9W9CurJHAhMOxSiFMI+buF00zQK6LATixVIqXrqQ8wuQ4EVQccWHZmeU2U67MCdSFb6YvWyzX89wRPkAeUAyKYkINWhkPK7xeOfze3gt4PmMYFChLML6LUbToylJF+HgzBWP33m87x8mm9jIo7a72qhgq8AkRNCtL7TU8SQuZmz3jZ//v0fOpR15AaIpaM4wImLDIlejRxqrUzoglJBxKETWiOsSnFi49UpXA/830IOHTUVi00EZe3uJh6K7I+cCflMiC+Nt5Dha7+IMKKTyF6e8LNa/xxo9DKLEsHRmuTNKkqdxXh3TwgcSsGh5PS/0QT38KvOhNgTVyMhLEHYA4NB99ZzJQdG1IFHwaX3JNzQ== 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:(13230001)(4636009)(366004)(86362001)(52116002)(66476007)(66556008)(66946007)(6512007)(8676002)(8936002)(7416002)(2906002)(6506007)(4326008)(6486002)(38350700002)(38100700002)(5660300002)(498600001)(1076003)(186003)(26005)(2616005)(83380400001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: zsKjtG2qgu7o5NIRzsPXASAibifLYB3ZkDZ1yMr9MKkki8aqafsBYB7gM2vEd4X4n805VqYeOUxtTL4M4fftPI6waHXeer2DHgDbvUq149m+81ZkCq72qVADeOu9exTJzuWzSK4FVs7vO0RIV4VdBc16DhKSUBFAtqOz4fMlEK3j8cWXZlp5qUKnxmR8ADHJtGkrSUix1cUB80nEYNJsYC1RTZ7e/NfrdSQKCoNk5XOZBxGLgrhxXN+4xcjr1InxhcZW7d8CxsthU1W86JGUTTyeuBYMX8N4w/id5LJzLuUe+KS4wDKPkNTDCLdZy4Ev8PmcpX6rlAl+3TGEuiskrlEWoZO/FYCj5MgnvzKgEnDpPf21OhYm91kJq4+qjyYUcSDMqr1r6aKpEF2E9mPwkJXbEZcg2VS8vAOH100tNLwlcJ+prdKbUG2RqcQSBW7NUB+FqieZgz62E4VQdduyFVYlsMm8Kmr9GvXh2AiDBsWlkj38vOEp5Dn+AriHpT+6CKjBW7+idKSGHihfJz3He0quS4r3yuhgelzoszMscYmLZnvCfygbIhoL/Ig/VixGifyu3hyhAa8y/VvgPkheKdaJ8e7lefpz7+NthfkgkDwW6dLN1lYpkra/Qrm9CnN+66L2kXTb4UZ16gq/4EugGn457L6F13kFPeN8V1Br/BthkjdVKC+fWlt55Of9rrWEbhwbXm7jdH+cCYAZfDjTHktpI69OsEey+CctowGnGPk1KG0kVhQhnrR1c3IBv1b2MUjyOUsYN4ZrtBxJKKUUXx5pRdNhFB3R76BZi1QBnmguisJq6OAZfLusfrJBSxir/nhv6jWcHT1TZ7beYChSQbhhx3AAix83s4L3fFWWZZLAXlpZznxTYpRlGLik67nxIfXd9SGrJd9JJNLTYFgqiBj/zQJi0XHoHDfRRKn+lhKCMa1oDFUXq9nYR2O7RMkYcu/pq8g34y4du6zixf/bQBbVL4svMjn09hSl5QlzguIIFfgZHBjAQ8R6figcxAJK2xkJXyln+YRp8VGGsUINZ6GO3RfXc2VVY1jSkJYhp1/FVMcp96AWDyLHr8OsU/R/OMwhHf4IBtefdfUGzNbokGi/0Kn1cPn7qs7w5v60PuhW52XVEvOfempOkhaqeDIevhQKA7zTl9WTYNZZpeCH9prCuxHnWCdzrl0E6wrW3nnWRwFngM2vmlK8cwLHRqh/OvhWgJR3wuj1hcH2muoH7+q1zz3po47LNiy8plEKV5urTmP+TbutgSWqBsJkbL/Bw1eITuPqf5gLZbaeMyQOXGdteJvspdrvmpUXP0+s9o90ubz58ef2ollwiKXQ92h+xcBIRzk4TuGq4XWKUeWE7c/UL87Advw5/hiM3qALyAnaxke+hPDO8/lJlisrfNaltJck7fUGy2w6p1UzpsrZJ8Gh9m1xYGAgrGfyoEzETdM96Vb1B+igL8WuF4J/62F27xIiYf8bylfk8mqjtMaysWVfgkQXfcLgudhzMSNl/no0SqAmbRaLxYmdCOk6sXQpkh1OTRewMfqepLejDJWQxaEf7bsgjLZ8zfYSVLq1o7jNDG1s5D3Z4QMZZb19b6zQIVOGs+lAzW7kb8+7zBxGRaNTojRzxZGaZD55/gcbYlE= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1cef5e2c-4a0f-4a5f-d0d9-08da01b0f5a6 X-MS-Exchange-CrossTenant-AuthSource: DU0PR04MB9417.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Mar 2022 09:41:17.5912 (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: WNwHvmDmK80+jMKLqlcpqAPceucypdwFsjv5/0jDfkt/QpSKOcR1wx+IyF8Iz7FIvoc4PAKp1+diqvryDVOxOQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBBPR04MB6043 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. When M4 crash reboot, it could notify Linux, so Linux could prepare to reattach to M4 after M4 recovery. Signed-off-by: Peng Fan --- drivers/remoteproc/imx_rproc.c | 99 ++++++++++++++++++++++++++++++++++ 1 file changed, 99 insertions(+) diff --git a/drivers/remoteproc/imx_rproc.c b/drivers/remoteproc/imx_rproc.c index f2bfc9077c19..6ed53c660c18 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,23 @@ 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 proc_nb; + u32 rproc_pt; /* partition id */ + u32 rsrc; /* resource id */ +}; + +static const struct imx_rproc_att imx_rproc_att_imx8qxp[] = { + /* dev addr , sys addr , size , flags */ + { 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[] = { @@ -235,6 +255,12 @@ static const struct imx_rproc_dcfg imx_rproc_cfg_imx8ulp = { .method = IMX_RPROC_NONE, }; +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_imx7ulp = { .att = imx_rproc_att_imx7ulp, .att_size = ARRAY_SIZE(imx_rproc_att_imx7ulp), @@ -490,6 +516,15 @@ static int imx_rproc_attach(struct rproc *rproc) return 0; } +/* Only support detach when doing attach recovery */ +static int imx_rproc_detach(struct rproc *rproc) +{ + if (rproc->state != RPROC_CRASHED) + return -EOPNOTSUPP; + + return 0; +} + static struct resource_table *imx_rproc_get_loaded_rsc_table(struct rproc *rproc, size_t *table_sz) { struct imx_rproc *priv = rproc->priv; @@ -505,6 +540,7 @@ static struct resource_table *imx_rproc_get_loaded_rsc_table(struct rproc *rproc static const struct rproc_ops imx_rproc_ops = { .prepare = imx_rproc_prepare, .attach = imx_rproc_attach, + .detach = imx_rproc_detach, .start = imx_rproc_start, .stop = imx_rproc_stop, .kick = imx_rproc_kick, @@ -651,6 +687,22 @@ static void imx_rproc_free_mbox(struct rproc *rproc) mbox_free_channel(priv->rx_ch); } +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, proc_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" }; @@ -660,6 +712,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: @@ -670,6 +723,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, "rsrc-id", &priv->rsrc); + if (ret) { + dev_err(dev, "no rsrc-id\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)) + return 0; + + rproc_set_feature(priv->rproc, RPROC_FEAT_ATTACH_RECOVERY); + priv->rproc->state = RPROC_DETACHED; + + /* Get partition id and enable irq in SCFW */ + ret = imx_sc_rm_get_resource_owner(priv->ipc_handle, priv->rsrc, &pt); + if (ret) { + dev_err(dev, "not able to get resource owner\n"); + return ret; + } + + priv->rproc_pt = pt; + priv->proc_nb.notifier_call = imx_rproc_partition_notify; + + ret = imx_scu_irq_register_notifier(&priv->proc_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->proc_nb); + dev_warn(dev, "Enable irq failed.\n"); + return ret; + } + + return 0; default: break; } @@ -823,6 +921,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 }, {}, }; From patchwork Wed Mar 9 10:21:16 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: 12774870 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 ABDB2C433EF for ; Wed, 9 Mar 2022 09:41:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232231AbiCIJmX (ORCPT ); Wed, 9 Mar 2022 04:42:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56256 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232234AbiCIJmX (ORCPT ); Wed, 9 Mar 2022 04:42:23 -0500 Received: from EUR03-VE1-obe.outbound.protection.outlook.com (mail-eopbgr50070.outbound.protection.outlook.com [40.107.5.70]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BD4D7106CBA; Wed, 9 Mar 2022 01:41:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HpogthNmxLLFg8ksB4onGZIzFE08z2jILUMg+/+A16+duITNUnb66CxtCMzB0LVCCGfxaiC3PIRo7dF9iN99tntHwjzaPOGJUTTPOyyrG1FkcjBEw9kbyHIVazwGVHUOAH8CSji8VKdaSDaKi2kls8YPyLqiPqs8iwgle5/8oc1t/qI3OLXD5ffz8utTiyjGKGUUrRqAnwHOw2Efw4Dns1/V6GQsx9bKHBkxoy2nT4/20bb6iFiFbtJGviMbMGSeLdQrjYy7twIdskGh/kuRGcwcJnfi9EwmNTMfZwVGsN9Hvy9Kq+5rW3Nvpdu3Ugi0G3NRJhbOr9yDAmlP2K1vRg== 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=vIS1tDzX/A3x8V/BrcBG/rU8H/aVYGGa1Bz/ZKzN/kM=; b=AtCNySnDSNKs+YyMCx/EvB5Cv+q1dK6ggU3TNfNtuUJGJ+ZuCyBwxchIZ38laUPgYVOWrUuVyuap97SFq0FWxaz6uyLrnYLRFUphGOk5GOBYT0wEA8TvvmwmOh6hgVb/hAHs45uIs5xS7OgndNBce7QgltQkpngL0cJZs2ER8K0bAqGMuWeTVqe8lX/piPbdk7ezMBSsvlv25JsdQbEM6crX7JHPhiTfNiCy7tce1OSqoNdtxmSrf74iGOkmV1qT6b61TbY+NRdh+um4prGHdNgpokNq57PykzM8P5N4WQaDQsF2MGsZkrvytXpRJ3MXz+Dh0bKIMtpJB6oSBk4v3w== 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=vIS1tDzX/A3x8V/BrcBG/rU8H/aVYGGa1Bz/ZKzN/kM=; b=DdE5T00LTOY0K60bHIrMGTmBIJbmXQi0F+AIK1GEksnq2h3qvbuZue6I7n6UAneH3xx7AlPF2vkCksxeYZ3iKoq7j6/PlanNmupsbxmHucDyyCNO2uEBZbsZkztk1phoZtqhgOC/mFBKf58MvJ9suQjs2nnul4zIHggaKmk8h1s= 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 DBBPR04MB6043.eurprd04.prod.outlook.com (2603:10a6:10:c5::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5038.14; Wed, 9 Mar 2022 09:41:22 +0000 Received: from DU0PR04MB9417.eurprd04.prod.outlook.com ([fe80::5538:7e34:6843:2bc7]) by DU0PR04MB9417.eurprd04.prod.outlook.com ([fe80::5538:7e34:6843:2bc7%6]) with mapi id 15.20.5038.027; Wed, 9 Mar 2022 09:41:22 +0000 From: "Peng Fan (OSS)" To: bjorn.andersson@linaro.org, mathieu.poirier@linaro.org, robh+dt@kernel.org, krzysztof.kozlowski@canonical.com Cc: shawnguo@kernel.org, s.hauer@pengutronix.de, 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 V2 4/6] remoteproc: imx_rproc: support kicking Mcore from Linux for i.MX8QXP Date: Wed, 9 Mar 2022 18:21:16 +0800 Message-Id: <20220309102118.8131-5-peng.fan@oss.nxp.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20220309102118.8131-1-peng.fan@oss.nxp.com> References: <20220309102118.8131-1-peng.fan@oss.nxp.com> X-ClientProxiedBy: SI2PR04CA0002.apcprd04.prod.outlook.com (2603:1096:4:197::17) 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: 71526fbe-8dd9-48dc-654a-08da01b0f840 X-MS-TrafficTypeDiagnostic: DBBPR04MB6043:EE_ X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: anG/FtnPQcDi6+ezkud9/L17TnxBGbHJVE/iRc93o89i+ytUXnjwPHYEu2snPrhQhV3rpNuF1DYvb8Aw437ZTb+hvGKrULyb4yPlHDBJSXXNCvjNpEryGDNq6cgJG3TCdTZdzLpkmyi4GSpKHFy7/zuEzfeVfCNxLqRQe+p9sUqnRGXIS96ptEdQHdPSU1vOHJnQX5AN44oDI/m0C+Ww+3J8pWY8rof2tA8Di7lOIeNhabDSN5S1j2HNOgvsob9XPRzphpHzdkIJJl0ekWPDdlYRARzA6AmoiZbCq5N6ztlFp2cm+Ra/ssvqXKfshWw3oqwIm6dP5AqsTARYnKtesPCQzO53Xq9esR6MMAP2SFeL5np3r0ehGh4y8YnVMK3wpTgxx8psOUapCpLwIXXBUFShquz4dtuJm9DqV39Yaq9HPOJPNGBsrWCcnAXgBsi3XO1WTY43rHAwvKFi6IlNJGsnh2rZCX7QQF3jsSiEVvd3qeJjV6ofhxJGhb6etFFaJ16CHltiUFXq5MflEezdx2m5eVoKyL1VE9UC8fpm7SlfMxjWWuBkYGsBIaff8NYutN+sGwukG9sXA6RyYE+OPg31nMwFgRPsDKbd+1OduoEveQdI45Ee3OlOcJ9W6SZHbsQXQq3rAM6gi1YhdbSj8DLc9QyB0Eao+AehBongsRCfC+A5fnktfWGOfeXpK5vJ8hmrPEnqj6cah/oeDXalXg== 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:(13230001)(4636009)(366004)(86362001)(52116002)(66476007)(66556008)(66946007)(6512007)(8676002)(8936002)(7416002)(2906002)(6506007)(4326008)(6666004)(6486002)(38350700002)(38100700002)(5660300002)(498600001)(1076003)(186003)(26005)(2616005)(83380400001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X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MV+HW1iM8zUgiv+44R/SWd2/iEEwzx2VEsg5EnbsO0BJIr+6g/hFhi/CxuOwwYFyabf1u2bf02AnLro0DRyjq1TXZTDvCGKSVZqANwGQgOxzFL51LVJGuHhsazk7EqFsRADINwZpHD9BqE2YNSn3fvQCdjn04uVABXh9Kfw4S94ficReT2xthJJZ3cVloS+1W4jJPgnpnEsC/4+b2VMxr0PvIMJSY/WkLF4WhvOEQiTT4wD/oaA3iWNuplx7N+7+scOcCJ9Pm+s4JE00fRLkRUkHghjz128zqLtJFFUEPrSCeVg8TJBsIhxZstniw9PdyOXRjRQZoxou2WVqSi/nQhucDVO0/A+7wnA7dGuqYL1IxPzlxfUVnGObOT+pzt46TqXxBx7aSYIQSQbQCLpxgdNE1ySinjs7Fbw7Va5BrCunbE2cujuoqPU7yZn1tFZxzkYsCNjHbNvV+a6Apl1Ta8QIMQOBpp0DDjohPmhiJ0iujZJhlAuqDLiFPwCItPOArChx9IFlYngE/wXb3MJHbGFoflQa5HuvIOaUGRSqVRLLnhx34Pl1w6XetKxpGrFkCRJg/upHeaYhk= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 71526fbe-8dd9-48dc-654a-08da01b0f840 X-MS-Exchange-CrossTenant-AuthSource: DU0PR04MB9417.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Mar 2022 09:41:21.9219 (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: mGBNzrcg4HTQpI8uG/jB0zOdmyvdfY/1/NuTd27AW+Vu6kuQAx99DgIBv40DLoGnMLoX1guJGa1bw0nbol63OA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBBPR04MB6043 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 | 69 +++++++++++++++++++++++++++++++++- 1 file changed, 67 insertions(+), 2 deletions(-) diff --git a/drivers/remoteproc/imx_rproc.c b/drivers/remoteproc/imx_rproc.c index 6ed53c660c18..7b84fb6d168f 100644 --- a/drivers/remoteproc/imx_rproc.c +++ b/drivers/remoteproc/imx_rproc.c @@ -16,6 +16,7 @@ #include #include #include +#include #include #include #include @@ -96,6 +97,10 @@ struct imx_rproc { struct notifier_block proc_nb; u32 rproc_pt; /* partition id */ u32 rsrc; /* 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_imx8qxp[] = { @@ -304,6 +309,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, true, priv->entry); + break; default: return -EOPNOTSUPP; } @@ -333,6 +341,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, false, priv->entry); + break; default: return -EOPNOTSUPP; } @@ -703,6 +714,56 @@ 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 < 0) + return priv->num_pd; + + if (!priv->num_pd) + 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_detect_mode(struct imx_rproc *priv) { struct regmap_config config = { .name = "imx-rproc" }; @@ -737,8 +798,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)) - return 0; + if (imx_sc_rm_is_resource_owned(priv->ipc_handle, priv->rsrc)) { + if (of_property_read_u32(dev->of_node, "entry", &priv->entry)) + return -EINVAL; + + return imx_rproc_attach_pd(priv); + } rproc_set_feature(priv->rproc, RPROC_FEAT_ATTACH_RECOVERY); priv->rproc->state = RPROC_DETACHED; From patchwork Wed Mar 9 10:21:17 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: 12774871 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 BE103C433FE for ; Wed, 9 Mar 2022 09:41:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232249AbiCIJmh (ORCPT ); Wed, 9 Mar 2022 04:42:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56576 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232260AbiCIJmg (ORCPT ); Wed, 9 Mar 2022 04:42:36 -0500 Received: from EUR03-VE1-obe.outbound.protection.outlook.com (mail-eopbgr50075.outbound.protection.outlook.com [40.107.5.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C325C142369; Wed, 9 Mar 2022 01:41:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=goDxrlfcfBdPhyQUyNkappXyvDuUHv6qBb1fV6xiAm11OiT0QgNRf4QbAWkUAfgYzRjfT3JPRQL3Yt0+XfkolVbmamcA6buV5z+TfLnOpISCwdq9uvFurfGVNnrdPdDeTxjtiQmamj6Z2RoSSM7lPXVfsrobPERTfEQ9zIqp6DmxO9YtNxAs/TCWoxfE9EPSOyhWyP3/HEIcktGKKgnlXAo5ANH3l0d1tKhs1bIpeSg30z5l1mQ82e2PZMkYFd+goY0dDqKOW3fOZXIBZLJZNAQpQVwooWnapwgRkGdFpN5SXYUlo/Bsl4VpAvWuhBDMmnScKZrM4hLwjuE5/O19WQ== 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=xioL4ep15kU0QQQj2Mfe14IIU1YzM1sFNj3HBLeHwmc=; b=EnjZ8RGw8gOVfJkCabCOIOJkXVlXbJCHFLK0H+JNZwJz9i+gP7MjgKOOdjhZJWSj05IWzEQAjpKK9UqAKDt2qST9qw4tLRBXZhlVUTMQCLmC7lNsUcGMBTUor4S6WrTJFqYWekVMtk9aNXynMxNs4a3CcJMxNXhnFmAyGDR3VB4Gp6Bo/xJGclwplhLQKB5zcdWBYFjSI49yghSN1QI4vACGt3BhOKz30x1BpoG7w7kEFiQaJKqqKwVpwNxrvdD2jdkCK0UV5pvWptMJV+E+00JYabvMsnnNGCLQ5qPvALFEpA3OsMQZtCpQoZQvoeMr/XqfsgJE5CETF6vtCNJ9Eg== 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=xioL4ep15kU0QQQj2Mfe14IIU1YzM1sFNj3HBLeHwmc=; b=iILnQVm4PoKuxq9svqw+coYnEAcqMjGiSzCA6UdU15phOoJHRbLzrKI5RkUgfToE5oZXWEUV1lpncucMHnijuOnhZ0akgdoq7X5nSxHx181rvNGlbct0XZlMFJu1uIJyNP7gy8QzF9i6y69eMS1AhBdCO/lG711kgIPOCaAivkA= 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 DBBPR04MB6043.eurprd04.prod.outlook.com (2603:10a6:10:c5::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5038.14; Wed, 9 Mar 2022 09:41:26 +0000 Received: from DU0PR04MB9417.eurprd04.prod.outlook.com ([fe80::5538:7e34:6843:2bc7]) by DU0PR04MB9417.eurprd04.prod.outlook.com ([fe80::5538:7e34:6843:2bc7%6]) with mapi id 15.20.5038.027; Wed, 9 Mar 2022 09:41:26 +0000 From: "Peng Fan (OSS)" To: bjorn.andersson@linaro.org, mathieu.poirier@linaro.org, robh+dt@kernel.org, krzysztof.kozlowski@canonical.com Cc: shawnguo@kernel.org, s.hauer@pengutronix.de, 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 V2 5/6] remoteproc: imx_rproc: support i.MX8QM Date: Wed, 9 Mar 2022 18:21:17 +0800 Message-Id: <20220309102118.8131-6-peng.fan@oss.nxp.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20220309102118.8131-1-peng.fan@oss.nxp.com> References: <20220309102118.8131-1-peng.fan@oss.nxp.com> X-ClientProxiedBy: SI2PR04CA0002.apcprd04.prod.outlook.com (2603:1096:4:197::17) 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: 2465fbef-2daa-4736-8d72-08da01b0fad5 X-MS-TrafficTypeDiagnostic: DBBPR04MB6043:EE_ X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: SqUZryUwZJWRfimX3n4hXKtcL+s1yMWZnTI8n5R64iINxBoGi8dMQ1Xm/NiJ7X6nOkT2yQXGQMFYv5t7PzNZjI4cpz0IEWE07UMqb248pgzUOyibXBP2dcWLsM0fEKsDTnmd5rQEOI3ye+TQYT5n9pg8zdsCXGVOpb5DVwXVQhod4c+njGU+JjdTXkXkCaYyGrL00dcZi+k067iix0XqvA8PcS7Q4Obz2QB2GHOdKfxHcV6HaVcJeLUG98M8t4pvKzMEtZOHU5C9cIXarGzk1kYglY8NP5XYGI678txqyWOdK/vRcNcuGfgpHfVgLo6lA71j6QYgKFxf8VQP7TcTLEESquIx+7KVOEj32EiTVzQFG6KOM0Pp6mtgJakOKA4Kxcn2Tewa6xszB0CG0Aa9ZEnePbRAKpX6COq60E9Lwr0hcuC1m3f0R4aQ1EHLjf3XhB+ZVyg+ZzhlHzurBCJ1uOCbvyN9MvQYn5wtlEiimbLLpv+p0hd6qeeow/kljo32GJNxLOqwrxwTRUqYqaTVXu15/KldAA7Jl9EWNSrHmwpNpV6FNpY0xTqjp2/PT22bd43Im+hyFNFEm9eu3EOZvWd30ZitrKKfxLrq9o2+iVX5vy+EeONaZE54YIDMDMdoPtHFlXqALX4HIqSQfj5MPgueHBUJaU9rhjN5QIgoEycMuG7j9e/1EMTUb8PlNOBVw1eLBPEs/GeSnQKFvFUdPA== 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:(13230001)(4636009)(366004)(86362001)(52116002)(66476007)(66556008)(66946007)(6512007)(8676002)(8936002)(7416002)(2906002)(6506007)(4326008)(6666004)(6486002)(38350700002)(38100700002)(5660300002)(498600001)(1076003)(186003)(26005)(2616005)(83380400001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: mgk4sII+n0s/z04s051iTphRFLR9JVXdhXA8OLixfVIfU+5TT1OagR//5Dm+F2oXkl8R1w+VzvV+KaPTaxKJ2DPphzAuYeYzZ+vcoiIyB9jyQt9fFlGBUtn2kkCaaOJx+a3p+3SyJfNyyOzZ7sZ6sAbLAg6DpIOyIM781pfCxN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NcUnlYtj3h/wpJqWrsmZO/ew2m2wi+WVOjYi1QeuO9+dn/F63dTvqrG0QHPV+6P5iUX346mEuaDl4GGfDBZzoM4Ffs5k1kwGDn8sJikQ1fNxMuBsSvl4AkWWVb7Sa4O6MyeMirpPbIzmxbaOHxyCjKA+ms0bWNtxmZRfQIlhv/pNq79EDW3X13XxZGjwV39n+75MQ4ZHe3weHITTJQyryEard+hMSG02F3N1GY14s/WBMY7ggJX/8IpztPoemBsafjxg312e8qH0RP6XxXzaTBhfKhO7RI9IvMD461x7IGkf/YDYAimdHRCCXKO2mxnlMxLS/XaDjyjpsD6jvSBVSemSsKgHByz+/xxzm7RzdC74ozL8gX3VVKsWp5AlXnbDGIcUTsbVqGN5j3jBSIuFA= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2465fbef-2daa-4736-8d72-08da01b0fad5 X-MS-Exchange-CrossTenant-AuthSource: DU0PR04MB9417.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Mar 2022 09:41:26.2392 (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: B3SFcx33JJUECfJbFm+b/uJNYiOSolSkbsdqgxigPha+BQlEXBcn+pskEJ9nP4Dsy+Zea+0YYd2F3CZ1t71bfA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBBPR04MB6043 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 7b84fb6d168f..adedecf8def6 100644 --- a/drivers/remoteproc/imx_rproc.c +++ b/drivers/remoteproc/imx_rproc.c @@ -75,10 +75,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)) struct imx_rproc { struct device *dev; @@ -98,11 +101,25 @@ struct imx_rproc { u32 rproc_pt; /* partition id */ u32 rsrc; /* resource id */ u32 entry; /* cpu start address */ + u32 reg; int num_pd; struct device **pd_dev; struct device_link **pd_dev_link; }; +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_CORE(0)}, + { 0x1FFE0000, 0x38FE0000, 0x00020000, ATT_OWN | ATT_CORE(1)}, + /* TCMU */ + { 0x20000000, 0x35000000, 0x00020000, ATT_OWN | ATT_CORE(0)}, + { 0x20000000, 0x39000000, 0x00020000, ATT_OWN | ATT_CORE(1)}, + /* DDR (Data) */ + { 0x80000000, 0x80000000, 0x60000000, 0 }, +}; + static const struct imx_rproc_att imx_rproc_att_imx8qxp[] = { /* dev addr , sys addr , size , flags */ { 0x08000000, 0x08000000, 0x10000000, 0}, @@ -260,6 +277,12 @@ static const struct imx_rproc_dcfg imx_rproc_cfg_imx8ulp = { .method = IMX_RPROC_NONE, }; +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), @@ -364,6 +387,11 @@ 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]; + if (att->flags & ATT_CORE_MASK) { + if (!((BIT(priv->reg)) & (att->flags & ATT_CORE_MASK))) + continue; + } + if (da >= att->da && da + len < att->da + att->size) { unsigned int offset = da - att->da; @@ -579,6 +607,11 @@ static int imx_rproc_addr_init(struct imx_rproc *priv, if (!(att->flags & ATT_OWN)) continue; + if (att->flags & ATT_CORE_MASK) { + if (!((BIT(priv->reg)) & (att->flags & ATT_CORE_MASK))) + continue; + } + if (b >= IMX_RPROC_MEM_MAX) break; @@ -794,6 +827,13 @@ static int imx_rproc_detect_mode(struct imx_rproc *priv) return ret; } + priv->reg = of_get_cpu_hwid(dev->of_node, 0); + if (priv->reg == ~0U) + priv->reg = 0; + + if (priv->reg > 1) + return -EINVAL; + /* * 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. @@ -987,6 +1027,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 }, {}, }; From patchwork Wed Mar 9 10:21: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: 12774872 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 5213AC4332F for ; Wed, 9 Mar 2022 09:41:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232242AbiCIJmi (ORCPT ); Wed, 9 Mar 2022 04:42:38 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56634 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232266AbiCIJmg (ORCPT ); Wed, 9 Mar 2022 04:42:36 -0500 Received: from EUR03-VE1-obe.outbound.protection.outlook.com (mail-eopbgr50075.outbound.protection.outlook.com [40.107.5.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4A42C16EA9C; Wed, 9 Mar 2022 01:41:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mrKuMMiugslMsWr1q4djxS+95WmQfTCzEC+p0kgkic1e5mLfyCztfA7xYgSdH3eFc6GPaTNcj4gZmfIs5Eitzxk7mBKIbkOFnHih9tlVlJbQ/Dk2ZgYtI8ay6+gNsBgA+xxEaADq144/JWWEhV7nu4eAL7o31/rATuJU081Jwn9BpqD8jSG6l3QG5nfZ0neW1fNkMDtZkENhJx21XBAbCPtMtC7ZYIKfmPOgr5K/Imj6TmZ6L6dfQJnvqhwkGesxL6mM72pz2HfFdTUMaOnFC7Fa4UMieXUU3v6OYJ5razvIZEmNoTYuYIN8+2eV3iRp5PUWcogUL6z2oSejzt3K8Q== 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=Wk6NvhCtTfcK9hE2AklyLKrOsOTcAU/RjqDgv2rFzSc=; b=IxsbTrafE4FdA2RiHUtktKdq+u3NvtUF/iJOz4hoU3WPyNCNNH+Qnv1ZaZN9SnZZfeSNdSdGT9fynDb4taOZ7gnDCyaamDxKmWa4oMzGNX1zj6fnrpckJVGJbPdHSnN/PVPEDDnR/cnUhwE/KmZm3hV1YiO6yadSnUi/Mjl1yh5S711TIJI93E7pApxEMzetXnf8vD+Yo26AGz94AjPEd7bk9VoiQ9zik7OVTnbY38rURG6USfpinxxtqcPUfUSXgxTvi6wo6yIgdJ6rSOc12W6gUZm+QUOauTTZcPPt2V57Fnwl4mtfD7GL/taK3Esn2e4yjjAiM9HRGuAOtqr2kg== 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=Wk6NvhCtTfcK9hE2AklyLKrOsOTcAU/RjqDgv2rFzSc=; b=eFMm0SAzd9jupZy82FxJ6NwUWgInm1TnHL6/lYuv/A40qlBUIuyCRyRpaShxstimLhUBH2TL6NpvfKXpCNznbhJSeTdunSAR9V2ENLhtxC6TMHc6o2tdiGKaDTAJYYHmM1mabkfQxubVN0tu7srmAAgBKfTdIveHIGALvP/5qcg= 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 DBBPR04MB6043.eurprd04.prod.outlook.com (2603:10a6:10:c5::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5038.14; Wed, 9 Mar 2022 09:41:30 +0000 Received: from DU0PR04MB9417.eurprd04.prod.outlook.com ([fe80::5538:7e34:6843:2bc7]) by DU0PR04MB9417.eurprd04.prod.outlook.com ([fe80::5538:7e34:6843:2bc7%6]) with mapi id 15.20.5038.027; Wed, 9 Mar 2022 09:41:30 +0000 From: "Peng Fan (OSS)" To: bjorn.andersson@linaro.org, mathieu.poirier@linaro.org, robh+dt@kernel.org, krzysztof.kozlowski@canonical.com Cc: shawnguo@kernel.org, s.hauer@pengutronix.de, 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 V2 6/6] remoteproc: imx_rproc: request mbox channel later Date: Wed, 9 Mar 2022 18:21:18 +0800 Message-Id: <20220309102118.8131-7-peng.fan@oss.nxp.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20220309102118.8131-1-peng.fan@oss.nxp.com> References: <20220309102118.8131-1-peng.fan@oss.nxp.com> X-ClientProxiedBy: SI2PR04CA0002.apcprd04.prod.outlook.com (2603:1096:4:197::17) 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: 9391139d-d3ff-451f-a076-08da01b0fd6c X-MS-TrafficTypeDiagnostic: DBBPR04MB6043:EE_ X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: l1ULFNaI35Jtx5+jrMl1Pp8AWFqocEbZMkL8je8WsSuVHC8k/vO4Qbpq/4dux0cyylpNZNRdqls4wcw6DjTrSRkiVdsF5ZH8hjgBitZtn1ADBKo/NzbpDTfEOxIKeJiSk5xpEDI4JqDym+Hx4GDVJFZB0k9onnnZ2C7G7c7RinQxkhQF8cKA9ytudd1kAP6uU/6hoUP38/BsH+OFtHGO52jFHo51q3ZCXkrFXhdVpluFh1bVAJJCVfjzipf1VS66bp/99mXPTQEFj5apx7ZG9c/ZuK3amyOmA1Vx+dGnvaG6aODuNrQQjnUvXTypeYmudQxI1YRTm099J4eKp7pL74JN0hAWCrR2U9kxIQIgTJZVvnEjSm21bu7/BZwNhzjCo32fyrsb6+/6LwKViHIakzweKZcZaCu8pQRo04kn7fzYVg2lsZZwm9jtROcZf3MvEyXow+rkoEiD+iDQz4/DNq5TRAyKiGdqKQ2ghIosici7hZYO1Uxe13xE5OUQ1ODDBoZG94hVHuptlgqeibtTMx/wZFELiAZtpo10KlWp4YEL0aiffkaVqZ6CA1iM6FpqtLTZLhQDJ80KRdMjyeYN83/h/rGGwg24/KA2TrG2NeN4xo5Xz0ZjhpaUXBDOBI2pv/PGqhJVaxZBYuxHXEyzVrBGoGZAtsNVEpYGVbSzoNWmGAhMeq8Hi4xUFnBjlhPsyD6gUu7u9enkNC9Nz+ceEA== 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:(13230001)(4636009)(366004)(86362001)(52116002)(66476007)(66556008)(66946007)(6512007)(8676002)(8936002)(7416002)(2906002)(6506007)(4326008)(6666004)(6486002)(38350700002)(38100700002)(5660300002)(498600001)(1076003)(186003)(26005)(2616005)(83380400001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: jaX2uiU36+6ZdTc9Rg5vRQGU9U1XJ0ehP7fUC2xH9YK+srwYKMzB4pjbYxolPOM+pJ5J+Pp5DD+Xz4b2cJL7GqEqKiJLdX3vJ81o8seukpS+e/Q9wcKU2ESDZrfO7SOTTlVSYhnRoaNJoYtYo0U81SIRMDALrvRMpW8pW6pcJ9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vQQhMuXcf2yolw37pBbeqCj2MQ1VgveIdrpx8uc9CksyTRy+04kZ1DyslL7iHT2xb+/Fsw+UU09JivYHkjtLZnaZu+zebFCyAuNICXkLjVEFyDOtlMBDNASepOiOW5eaIa1OoaXTVUDQG62JT8KXW7O+33kkzkF/+m9rGZJ78OcPlmZTVAkdvKLTHY8o18gO6Yf6VuaFafWIsQNzCU2IBQzkQZ9NjwIlstRelyKbeNO9cwuUYmkX81PXitH3mlqckgyQgg2FS7uHnS9N0HXzsid+ipDsyHCFJYO6g81fYgfuXOi1T/118JWKC9H+7L/Tse0Gd0uhYJV6alGG8LwsxQiyDW44CS0k+tkrvD36thVx/x7Di3EXxe/9OTUMqSayKJ3EVQl1ZnsglQF3fSuB1ygTT4MuOZB8= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9391139d-d3ff-451f-a076-08da01b0fd6c X-MS-Exchange-CrossTenant-AuthSource: DU0PR04MB9417.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Mar 2022 09:41:30.5849 (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: e1tQUSJX6Hb6oJPuYsAK2OJCq/2XCGO8xtHNtEt5qPP5DIdNIWUwn3R7fAU+Ysl2sV0Kevj2lv7EKveuUMxMVg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBBPR04MB6043 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. Signed-off-by: Peng Fan --- drivers/remoteproc/imx_rproc.c | 31 ++++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/drivers/remoteproc/imx_rproc.c b/drivers/remoteproc/imx_rproc.c index adedecf8def6..c03d479f1b09 100644 --- a/drivers/remoteproc/imx_rproc.c +++ b/drivers/remoteproc/imx_rproc.c @@ -83,6 +83,9 @@ 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); + struct imx_rproc { struct device *dev; struct regmap *regmap; @@ -323,6 +326,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, @@ -373,6 +380,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; } @@ -552,7 +561,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); } /* Only support detach when doing attach recovery */ @@ -561,6 +570,8 @@ static int imx_rproc_detach(struct rproc *rproc) if (rproc->state != RPROC_CRASHED) return -ENOTSUPP; + imx_rproc_free_mbox(rproc); + return 0; } @@ -695,6 +706,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; @@ -729,6 +743,8 @@ static void imx_rproc_free_mbox(struct rproc *rproc) mbox_free_channel(priv->tx_ch); mbox_free_channel(priv->rx_ch); + priv->tx_ch = NULL; + priv->rx_ch = NULL; } static int imx_rproc_partition_notify(struct notifier_block *nb, @@ -961,23 +977,19 @@ static int imx_rproc_probe(struct platform_device *pdev) goto err_put_rproc; } - ret = imx_rproc_xtr_mbox_init(rproc); - if (ret) - goto err_put_wkq; - ret = imx_rproc_addr_init(priv, pdev); if (ret) { dev_err(dev, "failed on imx_rproc_addr_init\n"); - goto err_put_mbox; + goto err_put_wkq; } ret = imx_rproc_detect_mode(priv); if (ret) - goto err_put_mbox; + goto err_put_wkq; ret = imx_rproc_clk_enable(priv); if (ret) - goto err_put_mbox; + goto err_put_wkq; INIT_WORK(&priv->rproc_work, imx_rproc_vq_work); @@ -994,8 +1006,6 @@ static int imx_rproc_probe(struct platform_device *pdev) err_put_clk: clk_disable_unprepare(priv->clk); -err_put_mbox: - imx_rproc_free_mbox(rproc); err_put_wkq: destroy_workqueue(priv->workqueue); err_put_rproc: @@ -1011,7 +1021,6 @@ static int imx_rproc_remove(struct platform_device *pdev) clk_disable_unprepare(priv->clk); rproc_del(rproc); - imx_rproc_free_mbox(rproc); destroy_workqueue(priv->workqueue); rproc_free(rproc);