From patchwork Wed Apr 21 02:20:21 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: 12215321 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=-16.7 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 D3C47C433ED for ; Wed, 21 Apr 2021 02:39:58 +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 1C99461414 for ; Wed, 21 Apr 2021 02:39:58 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1C99461414 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=n2kd1LWbv/HowcKpPTTEpku98pNq+qpwyqYlUJIXsmY=; b=FwDoMNJydBWOvPViyxBtnPS5p QzIfWnTdlDCTQYX1JaOqR33fYVVPkilTmIeoVvNtslaJtTwo+T4IUapM0KM2qR2/q2+tiuc4gRFff Nm+A1DOfWEgz1vc+Bs9kkR9uvSqsXZpg7mqE5UNWDlsQWNnILUpTnLHqXMkDcN3oZMzTwppM3uVdG SEvOCg/Sdk79dZQ+2i0FJ/KHR8zAEArP4ld5R6qw4SYH4+rh5xkqb6dGVACOeLLP8lKayGsJRbKg5 1koZD8GWSXpcC0AvXda81oK0WzfEDaK0zkkjsMSxQRNHgWOoQat41Ej+lAD2O4THHIMNrsmEViIxa vb3Jr4odQ==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lZ2kU-00DUUK-U2; Wed, 21 Apr 2021 02:37:55 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lZ2j3-00DUCw-RY for linux-arm-kernel@desiato.infradead.org; Wed, 21 Apr 2021 02:36:26 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=MIME-Version:Content-Type:References: In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=tyC632MAwv39LiQVDogDEQqiXSuIKRXd2m7bNuWYY8Q=; b=xkxFUK/Y9WaoRNpFjs/dpDyE0O Z76UqrwWBU72CV6hkysrCJlX16VZShaw80bu0BehMQ+qFAj/geIQSFNraDAtt77litanJH9RVeEWP GEfmoprroxyd3ygcf/ySKFUcjM1ppt8NuTVi4gaEEzWY8HWofW8dAYivDBiHgh9NIUEEzVZfwqibR e03lfjA1cpdGafcskMakEwFQx66hvI7CrjxXBkinhhNxdgprVyAYM3/nVrsOB4RxkoR6PnViCOhej gouGbSVDtekOW+09VWtuNHY4jDnRAVodmiR15IVZ6KjyUVfsbs8MUlIQI9th95/AVTBZKUyqdMp8S YB6SMytA==; Received: from mail-eopbgr150050.outbound.protection.outlook.com ([40.107.15.50] helo=EUR01-DB5-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lZ2j1-00CXsO-6o for linux-arm-kernel@lists.infradead.org; Wed, 21 Apr 2021 02:36:24 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=K3/zvzHK6c5pSPtK0nD0l5eSfMOPNDO5ClPxt1YYGUoZCJfP/0YqRqxQ6h9tKZDywsXwO7JhfF4zbhGmnDsx5td0zvZeGgNiOmkYP99gMYjPNOOpz9sOKswkRQxxlIB7pBnykLhaIISyjNPyhMGsTpOqFvqXKPfI4ZP4sOob2GZc1W7BqJFO7+XprO2BGeCL/3CrDCL5YNmgZWZyjNtoOVfDVmd0PNBfQK84Ysr0WQCMuvDyjdrxywlDKoqMsFAOW9CtbHLu0N0Rsrhf8jnEltGjDGRkuDpJ4TQaXY/ettdTG9EA4tQX6KWnxCyQj+37obcgX8Vq/bivRpsjZoWalQ== 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=tyC632MAwv39LiQVDogDEQqiXSuIKRXd2m7bNuWYY8Q=; b=gc+fLAVzxIVqq5VL++rFJpf5LGJ5mbSaPO9YhpcDf0gkjsrKatapiqAL7GXME221cH3CpNfD0hw/yMl3N+gDV7edDuwpL6VFuaczZg+bIYDOnVYLiEfGj6zdMLGOQLjh+5gD9r2d0E+Skn4KqA0O/7PBG1pKMs4Txd0/hN+y7hvpzLoxZfm9V9RFbFt/7T6GTXGIBFX9BllS7XVi0rixizslaLULSX+/K7o8GweSrCozQBhW/beUt4gc3Q44z6skUxi19qMcoh45A3lmPLyTg3EIQNIV44jyg9VsVnycPsUaFU7XqWQgu3+GKk6t1mLcQUQezHLidat3CmPkJv0MtA== 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=tyC632MAwv39LiQVDogDEQqiXSuIKRXd2m7bNuWYY8Q=; b=k7dJYgzo8F7ckbZ386xhpMnzZsZMCq6WkWoI5BkjiuyLnHPGJfnG7KRm6kmcjCzefs/Ci97mh3Dkw3mOI+Eqz5OelbuL9YGe1iytUXYz7DJdt/T5CbofmZuvlcEUXKX32CwxVRZd97stOrSKoernTcAC2ez7Eo+kO2Whdx45oNg= 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 DB9PR04MB8313.eurprd04.prod.outlook.com (2603:10a6:10:241::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4042.19; Wed, 21 Apr 2021 02:36:17 +0000 Received: from DB6PR0402MB2760.eurprd04.prod.outlook.com ([fe80::45b9:c993:87ec:9a64]) by DB6PR0402MB2760.eurprd04.prod.outlook.com ([fe80::45b9:c993:87ec:9a64%8]) with mapi id 15.20.4042.020; Wed, 21 Apr 2021 02:36:17 +0000 From: peng.fan@oss.nxp.com To: ohad@wizery.com, bjorn.andersson@linaro.org, mathieu.poirier@linaro.org, o.rempel@pengutronix.de, robh+dt@kernel.org, devicetree@vger.kernel.org Cc: shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, linux-remoteproc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Peng Fan Subject: [PATCH V5 7/8] remoteproc: imx_rproc: support i.MX7ULP Date: Wed, 21 Apr 2021 10:20:21 +0800 Message-Id: <1618971622-30539-8-git-send-email-peng.fan@oss.nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1618971622-30539-1-git-send-email-peng.fan@oss.nxp.com> References: <1618971622-30539-1-git-send-email-peng.fan@oss.nxp.com> X-Originating-IP: [119.31.174.66] X-ClientProxiedBy: HK2PR02CA0204.apcprd02.prod.outlook.com (2603:1096:201:20::16) To DB6PR0402MB2760.eurprd04.prod.outlook.com (2603:10a6:4:a1::14) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (119.31.174.66) by HK2PR02CA0204.apcprd02.prod.outlook.com (2603:1096:201:20::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.20.4065.20 via Frontend Transport; Wed, 21 Apr 2021 02:36:13 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: af8c6e34-d858-4875-904f-08d9046e3d6a X-MS-TrafficTypeDiagnostic: DB9PR04MB8313: X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:208; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: gozex77vbI8qbUabxXKWMR1wA8y6dgUXUyEkrzgZqtjk/VUK8rOsfbze3DMU9ky0uiDgWBhoTf82hsjMuat+DdYgpgUm3FoadxptLO6FVA1iAM3itjV4d+ZdJ85noXPERhXmUhEh6TeNwEgM1ZujEjTXFpHNQnGNRfO7sNDdU/8gWac6OtRTnxAWGzQ/RGBF6bvSogGw56uA5I7MQYEiKGmBjHQR0fIvK0HyZWwe3eFZj3ljv+Vb3UXAFAl6hzZlCZRlRMdMOgrhEhYoJ+lvpGE/sjRYRHNiCnGdfpFWvHaqy68F4GcgPEIj0EbouSp5QFq0o2r3FJZ9LwpxBT7/+8eeJOxBPG/5CcwaeyFZKkw89Ady/SO48r4uPHkIO8/GIV4tcT0w7s5fnEgVanXyR8BYScGEgxKcKkEpwkFdWmIwn4+5QKvJsjKG4cuK2zU5sDA0D+8gSSh0H5xC7gJbitRGVz9hbypcGFTRUvR0KPE6dJ7RBm2hkkExWfB/2w56l6n7aqQaGn78ZHKWXCATe43iOnQGnHOgoKZ4MBYLuHCgxrICfZfRjzTBQjpPel/UYb2HM+dHQUWMBKRYyRflsdvu29L5OhY8mgtlnA30rioGzBAQvW+JVaigwGafKsb+GrqYFX/ZvuKeXxh+Wv7elOuffDP7RXGDjHT+8XBhjEj0CAZdxGnIru75gsi8p9/J 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)(376002)(366004)(136003)(39860400002)(346002)(396003)(38350700002)(26005)(186003)(38100700002)(66556008)(52116002)(5660300002)(956004)(4326008)(8676002)(66946007)(8936002)(316002)(86362001)(83380400001)(6666004)(66476007)(7416002)(6506007)(6512007)(2906002)(9686003)(478600001)(2616005)(16526019)(6486002)(69590400013); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: LpPpq1U19HjZAxE0EMAFAH0OQwBu9Ulhw/hiNYpqNs0MK6oMexPbaAF9W75ivhG2IDS1FH6jQdqzDerQVQUw52pCo8ee4EsTdQohP/zo+A9spWEZx0RmtFCAfIENkc3ALXl+is0KMFuXKsCi2QESAzcXMYxpUNzPJ1N0PQfQtlAxEoNVbjAI5xJCPfs8xuQgu6vRJSJErsx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YqWKaN3WyIJI5R/ijGX9Ay1GvZCDewe6IsYnpLBgiJK3a2EMt/lnvrgLuh6yRtxT1J9eTXn X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: af8c6e34-d858-4875-904f-08d9046e3d6a X-MS-Exchange-CrossTenant-AuthSource: DB6PR0402MB2760.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Apr 2021 02:36:17.4652 (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: IGrv9CSM1F87IGnKgbfqfTXY3YCaWtPMH7C8ib8Da3ptL/TZ+05EhPSGXAiw8xF5cQh7ns7UiVoBDOJ0KOG3Iw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR04MB8313 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210420_193623_276907_E05B4757 X-CRM114-Status: GOOD ( 18.11 ) 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 i.MX7ULP A7 core runs under control of M4 core, M4 core starts by ROM and powers most serivces used by A7 core, so A7 core has no power to start and stop M4 core. And the M4 core's state is default RPROC_DETACHED and remoteproc framework not able to stop the M4 core. Signed-off-by: Peng Fan --- drivers/remoteproc/imx_rproc.c | 49 ++++++++++++++++++++++++++-------- 1 file changed, 38 insertions(+), 11 deletions(-) diff --git a/drivers/remoteproc/imx_rproc.c b/drivers/remoteproc/imx_rproc.c index e9d9860e4fce..d26254609a52 100644 --- a/drivers/remoteproc/imx_rproc.c +++ b/drivers/remoteproc/imx_rproc.c @@ -136,6 +136,14 @@ static const struct imx_rproc_att imx_rproc_att_imx8mq[] = { { 0x40000000, 0x40000000, 0x80000000, 0 }, }; +static const struct imx_rproc_att imx_rproc_att_imx7ulp[] = { + {0x1FFD0000, 0x1FFD0000, 0x30000, ATT_OWN}, + {0x20000000, 0x20000000, 0x10000, ATT_OWN}, + {0x2F000000, 0x2F000000, 0x20000, ATT_OWN}, + {0x2F020000, 0x2F020000, 0x20000, ATT_OWN}, + {0x60000000, 0x60000000, 0x40000000, 0} +}; + static const struct imx_rproc_att imx_rproc_att_imx7d[] = { /* dev addr , sys addr , size , flags */ /* OCRAM_S (M4 Boot code) - alias */ @@ -196,6 +204,12 @@ static const struct imx_rproc_dcfg imx_rproc_cfg_imx8mq = { .method = IMX_RPROC_MMIO, }; +static const struct imx_rproc_dcfg imx_rproc_cfg_imx7ulp = { + .att = imx_rproc_att_imx7ulp, + .att_size = ARRAY_SIZE(imx_rproc_att_imx7ulp), + .method = IMX_RPROC_NONE, +}; + static const struct imx_rproc_dcfg imx_rproc_cfg_imx7d = { .src_reg = IMX7D_SRC_SCR, .src_mask = IMX7D_M4_RST_MASK, @@ -238,6 +252,9 @@ static int imx_rproc_stop(struct rproc *rproc) struct device *dev = priv->dev; int ret; + if (dcfg->method == IMX_RPROC_NONE) + return -EOPNOTSUPP; + ret = regmap_update_bits(priv->regmap, dcfg->src_reg, dcfg->src_mask, dcfg->src_stop); if (ret) @@ -573,12 +590,31 @@ static void imx_rproc_free_mbox(struct rproc *rproc) static int imx_rproc_detect_mode(struct imx_rproc *priv) { + struct regmap_config config = { .name = "imx-rproc" }; const struct imx_rproc_dcfg *dcfg = priv->dcfg; struct device *dev = priv->dev; + struct regmap *regmap; int ret; u32 val; - ret = regmap_read(priv->regmap, dcfg->src_reg, &val); + switch (dcfg->method) { + case IMX_RPROC_NONE: + priv->rproc->state = RPROC_DETACHED; + return 0; + default: + break; + } + + regmap = syscon_regmap_lookup_by_phandle(dev->of_node, "syscon"); + if (IS_ERR(regmap)) { + dev_err(dev, "failed to find syscon\n"); + return PTR_ERR(regmap); + } + + priv->regmap = regmap; + regmap_attach_dev(dev, regmap, &config); + + ret = regmap_read(regmap, dcfg->src_reg, &val); if (ret) { dev_err(dev, "Failed to read src\n"); return ret; @@ -625,18 +661,9 @@ static int imx_rproc_probe(struct platform_device *pdev) struct device_node *np = dev->of_node; struct imx_rproc *priv; struct rproc *rproc; - struct regmap_config config = { .name = "imx-rproc" }; const struct imx_rproc_dcfg *dcfg; - struct regmap *regmap; int ret; - regmap = syscon_regmap_lookup_by_phandle(np, "syscon"); - if (IS_ERR(regmap)) { - dev_err(dev, "failed to find syscon\n"); - return PTR_ERR(regmap); - } - regmap_attach_dev(dev, regmap, &config); - /* set some other name then imx */ rproc = rproc_alloc(dev, "imx-rproc", &imx_rproc_ops, NULL, sizeof(*priv)); @@ -651,7 +678,6 @@ static int imx_rproc_probe(struct platform_device *pdev) priv = rproc->priv; priv->rproc = rproc; - priv->regmap = regmap; priv->dcfg = dcfg; priv->dev = dev; @@ -720,6 +746,7 @@ static int imx_rproc_remove(struct platform_device *pdev) } static const struct of_device_id imx_rproc_of_match[] = { + { .compatible = "fsl,imx7ulp-cm4", .data = &imx_rproc_cfg_imx7ulp }, { .compatible = "fsl,imx7d-cm4", .data = &imx_rproc_cfg_imx7d }, { .compatible = "fsl,imx6sx-cm4", .data = &imx_rproc_cfg_imx6sx }, { .compatible = "fsl,imx8mq-cm4", .data = &imx_rproc_cfg_imx8mq },