From patchwork Fri Mar 19 10:47:07 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Peng Fan (OSS)" X-Patchwork-Id: 12150667 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 04D5FC433E0 for ; Fri, 19 Mar 2021 10:29:09 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4249F64F6A for ; Fri, 19 Mar 2021 10:29:08 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4249F64F6A Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=oss.nxp.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=I88neUXubkXPzvMoBmY5uF+cWlCfXAwfeonVHNho7jI=; b=mmWhDSWjZKMZkJgg7QytE6RTaB A8cYgKdEHRr1glTiHgvvU6lwvTjp82g6ALZp7Ol4MoL24XjrF7MX+619ddwnyvd0E7vEoTXosWNfB msGDyhZJXouvONcElgS8r+t4xXt1uLbTTX87i+2KQITWRVMZ7hvhRmYb5p6C66nX8pemTfMPY97FI kQO7bCr9s8PNzymJjGepwIhioE2gYesvqukJrtE0zwcp/Pkue4U3UvcEBAm8FOUikxqFZO4+wn+Up 3Wa7HbwqWknBjdI1A8fcN4eLpHYwz4ZuZLyGKfwJWbnJZIm9u/Gvn/yPo9OMQ4L4jpVd9Ca+XiVNJ j1MzAZ5A==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lNCKx-0078y1-F5; Fri, 19 Mar 2021 10:26:36 +0000 Received: from mail-db8eur05on2066.outbound.protection.outlook.com ([40.107.20.66] helo=EUR05-DB8-obe.outbound.protection.outlook.com) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lNCAy-0075U1-80 for linux-arm-kernel@lists.infradead.org; Fri, 19 Mar 2021 10:16:22 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gv5PCPayW4vgjsOv87eLW9+OffA/N+12ewYMewiMUMgNpXG2GPqG4DBsn6GZeI/JshUwLgqoJUoxcuXfYEVCUHT3z9+c+RDWn8vpTJfe88GoIgi3PtkOhyhqAMCZjHixKzs95n3tP7dYaZQZ4kqrJCbyBj5sTMJteq58lWSvCPIY8M82f2X0js43Yu3p9E8o37rW5tr30tP8+0cQfE2pgdVNEwzR3AgYfp93Sm2MMOYedX/EXQHfy3nQF4/Itoa758bssq6vBUdPyBXjmJjrJOW+m7o+xtinOHgNqiyIi1hJ1joFaGHm9FEnKMxg5YNmbLYjWS5vdq9ZL4Ya/NTENQ== 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-SenderADCheck; bh=gUSsW3IoB1qObqykuMScMgJEXTMzhkEmiL5C3Bj+38M=; b=E9/kXPC6we4cPr+pjzVTqVr6vZOiLWRhjH0F/AeufqcZjfg/zJhQ39ldHzw+Ycfk/CIYl4nlV+rhgF5FceqgFCEm9LJuF7+9uki1JnqpKtukp2a0/qBxF+/pb7yc1nuMJTQlxGVjeW9oG3eVpr/bMNEQTnhLMnxD5HWOSActDZEpnYBsZ7Ki/kDFGCH9tXdWYiiDERab6tN9rdYMcawHgK8RlmwojbDpsTKB6RHQVFoB+acFnZxGsynjEuIw7rqyjlmdY9pXjPf2e5triP5J7t16w0K9y9I0oD2Aa1imAYlV6bZ3ZQtoRbri1n7mo2Vpige1wygFaslKP4Qe+GfCrw== 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=gUSsW3IoB1qObqykuMScMgJEXTMzhkEmiL5C3Bj+38M=; b=eFzR2k2azmSkEWns2fn7VIYwBW3c/IU1/eGC88V+/x58H52wV/hpgRUuxNUJ5JZ9+Wu/3HBoZjR09/sQZROUW0WNclVjqdVaXiNVAcoj7FzssGYIVUO3KR69HchFpA6vWDXpnr5rrWcV94qcryOexWsGiI+JAeEwCyXbOx1tc9s= Authentication-Results: wizery.com; dkim=none (message not signed) header.d=none;wizery.com; dmarc=none action=none header.from=oss.nxp.com; Received: from DB6PR0402MB2760.eurprd04.prod.outlook.com (2603:10a6:4:a1::14) by DB7PR04MB5241.eurprd04.prod.outlook.com (2603:10a6:10:1d::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3955.18; Fri, 19 Mar 2021 10:16:13 +0000 Received: from DB6PR0402MB2760.eurprd04.prod.outlook.com ([fe80::d58c:d479:d094:43d0]) by DB6PR0402MB2760.eurprd04.prod.outlook.com ([fe80::d58c:d479:d094:43d0%9]) with mapi id 15.20.3933.032; Fri, 19 Mar 2021 10:16:13 +0000 From: "Peng Fan (OSS)" To: ohad@wizery.com, bjorn.andersson@linaro.org, mathieu.poirier@linaro.org, o.rempel@pengutronix.de Cc: shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, linux-remoteproc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Peng Fan Subject: [PATCH 1/2] remoteproc: imx_rproc: enlarge IMX7D_RPROC_MEM_MAX Date: Fri, 19 Mar 2021 18:47:07 +0800 Message-Id: <20210319104708.7754-1-peng.fan@oss.nxp.com> X-Mailer: git-send-email 2.30.0 X-Originating-IP: [119.31.174.71] X-ClientProxiedBy: MAXPR0101CA0030.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:d::16) To DB6PR0402MB2760.eurprd04.prod.outlook.com (2603:10a6:4:a1::14) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from linux-1xn6.ap.freescale.net (119.31.174.71) by MAXPR0101CA0030.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:d::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3955.18 via Frontend Transport; Fri, 19 Mar 2021 10:16:08 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 9dbbd95f-0411-4a04-54ce-08d8eac005ce X-MS-TrafficTypeDiagnostic: DB7PR04MB5241: X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:901; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: VOpxlzctifxRFmiXrcVdfwwcj1MMzgIoTHjepQCZINNn0Itq38aW7hsJFR7cz1S160BMCuNYu/1s/JZa4NAie4ULcMGwzINRSpbVb54JkZ4IuPkAkvd9ZSkrFegTRT19Fnow/NWv7TmhoABUYF3EyVDV1U2T8U4ynKwSUy7LbNyN/mhBMPm/ho98N9do18gRacrSUaRzegdvi0AlZ6y/R6XsDQ9jnnxM9xoyzyCy8sQOXEi9UuWTHWt/M3mi2pzNanz7L/m82EIHgJRpOMByWxZXaZWfNXeCi8zfhRHxgbxac6AbbZPZOTf7Iiiv80Tjw3s7ZPcwTL1b5A96LpFjQLJxufhFNMGRJTQg/+bh5U7lt3jiOMvqlgGISJ+M71wao6kngeC0Wy3uSG6muZy87Rn+2uKN2aHyvM1t3obVtruIDdt6SaH8T6uZFM57PBlLau6vUQzUaTsWB0VuUhRFcTrb7ATNO0tlEKweDPHLEHrL6vouWBUv5xVn3y8nWdr9oRymI5MwlQETuGcMBd7XuqRMkNyKabFljExEzBO8bynVIsZaAehOdRHtlgGIhYuxWQ4bg2Gj40G3JYM20l3OgrcEvExkV/yr/ErYSdGrVLYnXxxPqf82v+Ra21jb8MG15KD+UQ8N8L39EVNUKm9SpfpmDhkdoRBz2B4dw7WUTA1t8WytyQBM1GPB8nT9QkqBp/IhztuG1nSO/Y2v5QnqnQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DB6PR0402MB2760.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(346002)(39860400002)(136003)(366004)(396003)(376002)(186003)(8936002)(6506007)(86362001)(2616005)(8676002)(7416002)(956004)(2906002)(83380400001)(26005)(4326008)(16526019)(1076003)(478600001)(316002)(52116002)(66946007)(5660300002)(66556008)(6512007)(6486002)(66476007)(38100700001)(161623001)(147533002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: Pxq7j6XoZl5UpOMdEvyKSkEOxyvjxdRxr4scyWzxxX1VqACO84xWmpBCDEXq8V5+0h9X4VIhZnaHPTQtQ3oP1aD0DzCM6RGAdDEEXxolb/KRriPScVd0jT5SyD5wjDqa13JxqgYjZeqNHrohDXEQjlRuy7eznzE0tbCswxeLvb1ctIfPFM5hRuJ289AhdeRQrYxzaZRsL3rJ7jxRtXznRu8Tfmyy3OP+UKV7VaAZJ8ar7zllnwjwVSU+rSFG5NrW88Qi1bwICtiGokilKJvM8/CmgyStTpVxido1nRkpKoU3vEP9v4iasITlvUZKhnGCNvNIrJwpIUQMI1AUpVLwdOlFht8r4VYZFZYD3Xxn7ayKHY8xH/MhG2olMy1HoEMasNEjpSMavKf6oWr5xE5qsk7BuwtBJ3RawiPDaQsRvNgzqqmSFt2LRVbToPz7xCrdlqs3/2aGVH+NzJBuA3D83SUt8JZ0BiZBHm6agRmUh+IfatwOrtn5YgP5XlhB0ytKvXi0+5zyBKS+RYVqyEiEsbK8b2rypritoOegULycVpCIBMrrZkeettBmmmQr9dGISuMfkZlPIclBKYZrkI7QscpbRp0MstQexS8PUdXq/eBsiUcf1lwh1rZoPaHpC3iY22oHow81VNcLNH3krc7phdOqr46quQUf2L64kM/4RcZ5A6lLY/8o3E9saYgkWgzjwWipUXoxNMQoFuI2BZzAX1aRzXVxL1tj24aPeH26HRJYjOQ+V0lDwzCx+CM2al3S4dUi2ml8fsKyYgSFkrkRxniNpP6Tdt/DWPG/zUDuKxlNMsPjRlGF8DhT4rHSBrLlV4IBWAjDlH/CeLCAN/y1UVhrWRlyTzLm7xUG5Ef3Aqi+4zVWfFh4RcnMniHQFuXP0MAJjjFpSqOdb5xmiBKQzLVT+IVoCY+ysytFnnoFcwettkRo+CZvnsUz1nOk/A/TUWjvBcwEYh1I87jf3hQZlfyea75bqT2rsGFtW43qyRZ5nXJ+Ui+tKTw1Ra20HsGav9SPEx5DcKMLAfg/YmCIzzNZ1OqLLXBlq07Jhljal6C3GUu3ACcaJi8E3Hv2ACUOOhHrHhRax6LkgwM6d6J0UsWNZOhDGFeXYF8v/j1N3MwkpJ36Pye7EBYXKJ/19wKx6dAcDSpa4DkMjiov8KTMN1rhjQ17f0Wmz/Xweos4aXhGm9+5qFEWeXTRvXcinr0w8v0eGeIZP2557mNdHBV5BToD5FUHkh57t0v3zkwPbERsf9FgBolUrSo8n1V6HNz+6xee14ylxUy1Dnoo3isL8oP3e0cpoNhsMgJEbWHp17xceW67zYEK3Hlv1xk+bOdChhICtIdNr/fP2HVcTlZHgQ== X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9dbbd95f-0411-4a04-54ce-08d8eac005ce X-MS-Exchange-CrossTenant-AuthSource: DB6PR0402MB2760.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Mar 2021 10:16:12.9621 (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: fXNwAHrD0JyTAgk9st8lE/Rm9f510XlPy4KAaxUGxUjM7WmJBv6O/dVkJ8e6OS2o+Kzd0lOx3TW6JZXMpkQB7Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB7PR04MB5241 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210319_101617_489178_9B631455 X-CRM114-Status: GOOD ( 15.14 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Peng Fan 8 is not enough when we need more, so enlarge IMX7D_RPROC_MEM_MAX to 32, and also rename it to IMX_RPROC_MEM_MAX which make more sense. Signed-off-by: Peng Fan Reviewed-by: Mathieu Poirier --- drivers/remoteproc/imx_rproc.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/remoteproc/imx_rproc.c b/drivers/remoteproc/imx_rproc.c index 6d3207ccbaef..24275429a7cc 100644 --- a/drivers/remoteproc/imx_rproc.c +++ b/drivers/remoteproc/imx_rproc.c @@ -48,7 +48,7 @@ | IMX6SX_SW_M4C_NON_SCLR_RST \ | IMX6SX_SW_M4C_RST) -#define IMX7D_RPROC_MEM_MAX 8 +#define IMX_RPROC_MEM_MAX 32 /** * struct imx_rproc_mem - slim internal memory structure @@ -88,7 +88,7 @@ struct imx_rproc { struct regmap *regmap; struct rproc *rproc; const struct imx_rproc_dcfg *dcfg; - struct imx_rproc_mem mem[IMX7D_RPROC_MEM_MAX]; + struct imx_rproc_mem mem[IMX_RPROC_MEM_MAX]; struct clk *clk; struct mbox_client cl; struct mbox_chan *tx_ch; @@ -272,7 +272,7 @@ static void *imx_rproc_da_to_va(struct rproc *rproc, u64 da, size_t len, bool *i if (imx_rproc_da_to_sys(priv, da, len, &sys)) return NULL; - for (i = 0; i < IMX7D_RPROC_MEM_MAX; i++) { + for (i = 0; i < IMX_RPROC_MEM_MAX; i++) { if (sys >= priv->mem[i].sys_addr && sys + len < priv->mem[i].sys_addr + priv->mem[i].size) { unsigned int offset = sys - priv->mem[i].sys_addr; @@ -425,7 +425,7 @@ static int imx_rproc_addr_init(struct imx_rproc *priv, if (!(att->flags & ATT_OWN)) continue; - if (b >= IMX7D_RPROC_MEM_MAX) + if (b >= IMX_RPROC_MEM_MAX) break; priv->mem[b].cpu_addr = devm_ioremap(&pdev->dev, @@ -459,7 +459,7 @@ static int imx_rproc_addr_init(struct imx_rproc *priv, return err; } - if (b >= IMX7D_RPROC_MEM_MAX) + if (b >= IMX_RPROC_MEM_MAX) break; /* Not use resource version, because we might share region */ From patchwork Fri Mar 19 10:47:08 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Peng Fan (OSS)" X-Patchwork-Id: 12150669 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id AC645C433DB for ; Fri, 19 Mar 2021 10:30:18 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3490B64F6A for ; Fri, 19 Mar 2021 10:30:17 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3490B64F6A Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=oss.nxp.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=9kF+W/1/eyAd6ClJTHstEjYhBB2t2XVaex26gz4io3A=; b=RwOjBGi39XxWzRDdhqplNkz4N g0BwZ/oXxdMGMsll+tpCsUYUpNP8holWs5uo7FMePdSE5zu2feBzXooRXG0CkLe8AWivYbvbiBOvA kOAvBMqIVixJgLBiMw/H88ZO84DWbuvuC2KxxSzealWs2U9GTwrb+ohFYyUvMEzCKKvXlREoVakm2 fKTTt3oTXc77+R9PbF/jyjDgTci49FKYjPwaFg92DEQaLWdE8Xf+5aIvpTzj43gowCCZs6Sgwiz+c dDehidVfVn5e0loOBNjOJpqFGwKKV6N0/mRKCDRWh1Gda0Oegkds9coga68Ona7U2EJ1YudFQjAf+ wArlLCJFw==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lNCLp-0079DM-Is; Fri, 19 Mar 2021 10:27:30 +0000 Received: from mail-eopbgr40084.outbound.protection.outlook.com ([40.107.4.84] helo=EUR03-DB5-obe.outbound.protection.outlook.com) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lNCB5-0075Wl-4Z for linux-arm-kernel@lists.infradead.org; Fri, 19 Mar 2021 10:16:27 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lP3B2q9gaYAtIENYOp0u3/uBjIVXt3ZMEEbUGTwzMbbr082KE9oVfnSd/Ubjz5KPF5W44OY6Sdi47eMgmTpWRwo+lBHBAh6DDOGayjXN4fC7KOHdzS8et7jhOlAyhiLSWeAQAcYvWsqqaJexQvqzAw180K/nwblTQ23XW7X0dfKdyNp4+MNDQVkrarSvgIMr45LuY+CC5bXhKLseojacP5/xzr0DDc+oYvA9nsdkHxug9Vb/IaGGEfbcUHNNf11DPOj677PQwlpfojT6dzX8fws/7JzsdJafO3jLX9cHK3HTpwD/0f47NmY6nY/kIGNvDxMwexB8G0yNHyMr37GU2Q== 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-SenderADCheck; bh=kuCPuN4VdnfXo8onp4yP3064s5vYqLa1xQpgmgwj6Mo=; b=nnSW2eHQaJOJw7WluPIVlugwqUovZY6vFUPX3LuOM1gk499mHR0I7WqPyK1xx6GnawN4xncROcru2iF8cIlQE5gNGfnUplFNleoyYF2jjCrswx7/Abw84tVMGExdntnf1seVR7x47vSd45RIjbr5zSFVWjT87ciRmG2boSkQfDrs3YaiYsF04iNFMoxHX6Z5tyaiBZVHr9EmR5Gvmlyo/eQfWpCBemaC4TgJ9xecV5BLf43GVd4x4rBGNaUMRiIF4k1dzQuAuS8vQxlGqqWbt0ex+UVSi5QO75znj4UdXO4b28xmYC8dYM8bLR5JX41ZCOSvyVWnxCWQ3LFM+/S42w== 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=kuCPuN4VdnfXo8onp4yP3064s5vYqLa1xQpgmgwj6Mo=; b=GByoDAkPwSppuiKd20yJhWJuaHbhOWqrJ23Eksi0GDSNguwItOaQu/PHoYl1RX2rSBQOaBlP67i4ZsBsxmHvmAtU+Dw2BKmO3ZR+Nm8/AK92WFmUVQwqbOF4n4ZkcAstbFmIozdiKdqWqrEZc1OwT16D0E4T5Z3iYtMPctEZDE0= Authentication-Results: wizery.com; dkim=none (message not signed) header.d=none;wizery.com; dmarc=none action=none header.from=oss.nxp.com; Received: from DB6PR0402MB2760.eurprd04.prod.outlook.com (2603:10a6:4:a1::14) by DB8PR04MB5803.eurprd04.prod.outlook.com (2603:10a6:10:a9::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3955.18; Fri, 19 Mar 2021 10:16:18 +0000 Received: from DB6PR0402MB2760.eurprd04.prod.outlook.com ([fe80::d58c:d479:d094:43d0]) by DB6PR0402MB2760.eurprd04.prod.outlook.com ([fe80::d58c:d479:d094:43d0%9]) with mapi id 15.20.3933.032; Fri, 19 Mar 2021 10:16:18 +0000 From: "Peng Fan (OSS)" To: ohad@wizery.com, bjorn.andersson@linaro.org, mathieu.poirier@linaro.org, o.rempel@pengutronix.de Cc: shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, linux-remoteproc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Peng Fan Subject: [PATCH 2/2] remoteproc: imx_rproc: support remote cores booted before Linux Kernel Date: Fri, 19 Mar 2021 18:47:08 +0800 Message-Id: <20210319104708.7754-2-peng.fan@oss.nxp.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210319104708.7754-1-peng.fan@oss.nxp.com> References: <20210319104708.7754-1-peng.fan@oss.nxp.com> X-Originating-IP: [119.31.174.71] X-ClientProxiedBy: MAXPR0101CA0030.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:d::16) To DB6PR0402MB2760.eurprd04.prod.outlook.com (2603:10a6:4:a1::14) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from linux-1xn6.ap.freescale.net (119.31.174.71) by MAXPR0101CA0030.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:d::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3955.18 via Frontend Transport; Fri, 19 Mar 2021 10:16:13 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: a7231efc-144f-458b-ec24-08d8eac008d1 X-MS-TrafficTypeDiagnostic: DB8PR04MB5803: X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1013; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: z029hehTRuS5LOX9CeoDvQ8g2vBn0NZxL+e2MPveegxnR5ciT0rUiKZSb4rN9fo8TXsB9AzWrJvj8SqUdoE6TW0fp0Z/7QgAXfqDPjCDtT0eCIlb4Jspv8rQBC8Ey93ZIZX/JK83ZWJNTCb+Ir0uC6gJXYEqCEzm8qsZ9It4TqPxvzVdYJnM4x46eeXMW/23MO33m/jUbkhL57RQdl0hWTXcJtm/eYEPi/Un2vLxaCSGMSK7r6O9hD577hezSUIwWs1QL0OPYlDf5AeGMwMnzUD9x2GE2bXHyvn/LCFFr20hv9byZIarTD55PU0Pdx4EdVBRhvYEDLgG7V3dTGbmhZyYtJHNeNEpzfumnCdoJM4M4RK1+XVqT9afMNFOcAZvhGcXAquWL6EK6EmDsrPOLbt+Dpjm3yy0kltIbWi+nMIykgZYMtA/Wh1RVtvxxgIZst3vYDgOUrRHegL7lBlXyReaNG02qAgiRw34TRRzeQHt7RlTVBF422xKAYKK4GStmuEPSqgna2E38KFYMBkpZJ2MDGCbqHgs7AreOPdywybVqPt+nT3g61j3uJn15elAA7ECsTIZk8XSpsAS+/kQBOzGJl9oVeytt76kSTH1YQU4xD1RORQ8LftA9jNarNzJ0dzYRskCDK7wedTGz6CUT5KY8qtw9+zYAk6e50eaOBg= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DB6PR0402MB2760.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(136003)(396003)(346002)(39860400002)(366004)(376002)(2616005)(8936002)(316002)(956004)(26005)(38100700001)(8676002)(6512007)(7416002)(66946007)(66556008)(5660300002)(52116002)(6666004)(6486002)(2906002)(6506007)(186003)(86362001)(66476007)(16526019)(83380400001)(478600001)(4326008)(1076003); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: VDCLPtd34M9+oZ6QhKo3KzvKfkWrBGkY7vrUtgnZbAWZuScuxyMKuG2x0WbSDi4p1k2aWhgATNRlcTscgfyljr7M0zmPKqmFP4TZR5iapxnjdqfIyfZHN1sNItPDoTO7ML/D9P6YvqSDR7028RoC6rOVPiV4W/eqAKuCC720eChuavky1+A9CC2Vz973M46GyDW671BNcBxTSQl+eupVozBUBGT+9F6yzpIJ5cnMr13ZVxwMUCdaayQEIshRQVXrVC/Rlo3hZo242KlXIOJAzVhSYVV7hl7Ro/Pf7LMIk4ePacGwCUEb95oQ38hF/I7l3UwtGbmV0ASrPSxIsvGgY77KLXbsGlR0K7WaycleRGUto7ribi0Bxr0NNsYDlVaiCa/bGp20mzUgest/PeT+2WZ2iYauxmGnh7jantvjd3sH/ZP5oygNV2BDmnTh9eaR4JhErhDzWsrDloIEVw42Ht52SrvL4I4wDR7f//1wJdkzx0rnqd5D+pw9YDSj5rkZFRW7+jBwaNovMArBiJdOnZC0+E8GrVkRYvLjMjU9CNVHhUyUBd2vvi5zsYm2quMDGPD53J2B7ah58fvgPi/TrIR0ipA1KXwc7LJCfEG50gPSEU4QCM4hHevppiO9MxcuDLGjHs1CGpULAdnVZ5E77RLL1OIqHHDwGgvl1PRFnZs8yAvAM35P0O4U3zOq0W9Dp+sU3kblFLQEHww6fKz6o8vi/Y73yHFUvoPfCKx+EP5xK4+T7sR8vNC1piGi6VtlhAi2SVbglEAnt6+HIVkC0d7pXg/kSsjlPYaAdwZljroMQkAFW9Wh3s7UzmM7IG2WDDi2YgIPAAc2CVnxosWj9jyYTLc4ZWrCcDZmEmsWxxGI0XUQZQgEVXk8SKjnJ38cjZbRtxS0MVl6AWUIazVfYejXWPypiKG4ceEeXCTPejtzZrTeox/9XvOXKjAVLYy0MCXmKe7163amOMMJkf8d3GIqSKGGNpTf6Q3fjyfLuBJqEkqPr8dQfXA9pb8fKtCzj4dCnbVUc6n9u/GcnxvmBELsetlx5RZslTCBCbLmwU6qFroQqzP5yObOhkNEbXHjeoGoc3kIIINFrGFeBsFzV3Y8Xa6mnMO9kdEOBHH9F2XL/K6I3DBpZvJwwlmcM9AeWqxI5EWE9okGGJmC1qHvqYo/Zuqj0lDAkLsEyMjezFIcRXTw7+7mOsC69Iu+cIV70IdbFI12d/gjqgh2NC44yIP0AWj7pnc1AV8wt1u/zbf2fp/eJvKfFqK6T4gQa5ZdUrMXp1yCZfeGP4RIqo39/C7BhZ8Rk4eGSMV2TVy56dQhCfNc2MS7YljajoldZQ5K5yttWdS9LbMCbzYFQ6slMg== X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: a7231efc-144f-458b-ec24-08d8eac008d1 X-MS-Exchange-CrossTenant-AuthSource: DB6PR0402MB2760.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Mar 2021 10:16:17.9019 (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: TVvQDP6fWR65GyoiRuPnTMqRvXMlYuOvNzLaolBN4v24s9gUz/0E2N5zcqwckYLDjBORft3RXJfykcw7MmOITg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB8PR04MB5803 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210319_101623_807682_4BEB90E4 X-CRM114-Status: GOOD ( 17.13 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Peng Fan Support remote cores booted before Linux Kernel booting. Add rsc_table to hold the resource table published by remote cores Add attach hook Add imx_rproc_detect_mode to detect remote cores' working mode, and if remote cores are booted before booting Linux Kernel, parse the memory regions and initialize the table_ptr, table_sz, cached_table. Signed-off-by: Peng Fan --- drivers/remoteproc/imx_rproc.c | 64 ++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) diff --git a/drivers/remoteproc/imx_rproc.c b/drivers/remoteproc/imx_rproc.c index 24275429a7cc..fdaaf7599cc8 100644 --- a/drivers/remoteproc/imx_rproc.c +++ b/drivers/remoteproc/imx_rproc.c @@ -74,6 +74,16 @@ struct imx_rproc_att { int flags; }; +enum imx_rproc_mode { + /* Linux load/kick remote core */ + IMX_RPROC_NORMAL, + /* + * remote core booted before kicking Linux, and remote core + * could be stopped & restarted by Linux + */ + IMX_RPROC_EARLY_BOOT, +}; + struct imx_rproc_dcfg { u32 src_reg; u32 src_mask; @@ -95,6 +105,8 @@ struct imx_rproc { struct mbox_chan *rx_ch; struct work_struct rproc_work; struct workqueue_struct *workqueue; + enum imx_rproc_mode mode; + void __iomem *rsc_table; }; static const struct imx_rproc_att imx_rproc_att_imx8mq[] = { @@ -229,6 +241,9 @@ static int imx_rproc_stop(struct rproc *rproc) if (ret) dev_err(dev, "Failed to stop M4!\n"); + if (priv->mode == IMX_RPROC_EARLY_BOOT) + priv->mode = IMX_RPROC_NORMAL; + return ret; } @@ -398,9 +413,15 @@ static void imx_rproc_kick(struct rproc *rproc, int vqid) __func__, vqid, err); } +static int imx_rproc_attach(struct rproc *rproc) +{ + return 0; +} + static const struct rproc_ops imx_rproc_ops = { .start = imx_rproc_start, .stop = imx_rproc_stop, + .attach = imx_rproc_attach, .kick = imx_rproc_kick, .da_to_va = imx_rproc_da_to_va, .load = rproc_elf_load_segments, @@ -470,6 +491,8 @@ static int imx_rproc_addr_init(struct imx_rproc *priv, } priv->mem[b].sys_addr = res.start; priv->mem[b].size = resource_size(&res); + if (!strcmp(node->name, "rsc_table")) + priv->rsc_table = priv->mem[b].cpu_addr; b++; } @@ -536,6 +559,43 @@ static void imx_rproc_free_mbox(struct rproc *rproc) mbox_free_channel(priv->rx_ch); } +static int imx_rproc_detect_mode(struct imx_rproc *priv) +{ + const struct imx_rproc_dcfg *dcfg = priv->dcfg; + struct rproc *rproc = priv->rproc; + struct device *dev = priv->dev; + int ret; + u32 val; + + ret = regmap_read(priv->regmap, dcfg->src_reg, &val); + if (ret) { + dev_err(dev, "Failed to read src\n"); + return ret; + } + + if (!(val & dcfg->src_stop)) + priv->mode = IMX_RPROC_EARLY_BOOT; + else + priv->mode = IMX_RPROC_NORMAL; + + if (priv->mode == IMX_RPROC_EARLY_BOOT) { + priv->rproc->state = RPROC_DETACHED; + + ret = imx_rproc_parse_memory_regions(priv->rproc); + if (ret) + return ret; + + if (!priv->rsc_table) + return 0; + + rproc->table_ptr = (struct resource_table *)priv->rsc_table; + rproc->table_sz = SZ_1K; + rproc->cached_table = NULL; + } + + return 0; +} + static int imx_rproc_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; @@ -590,6 +650,10 @@ static int imx_rproc_probe(struct platform_device *pdev) goto err_put_mbox; } + ret = imx_rproc_detect_mode(priv); + if (ret) + goto err_put_mbox; + priv->clk = devm_clk_get(dev, NULL); if (IS_ERR(priv->clk)) { dev_err(dev, "Failed to get clock\n");