From patchwork Thu May 6 04:08:42 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: 431640 Delivered-To: patch@linaro.org Received: by 2002:a02:c901:0:0:0:0:0 with SMTP id t1csp1094134jao; Wed, 5 May 2021 21:25:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzxZv/OuezkYd2dlLYAE5lMLUhgtB7jKHmkRfETm/ztQ3IcYmiuPvA+haELyDq4B+NrtIUQ X-Received: by 2002:a17:902:da88:b029:ee:cd32:808e with SMTP id j8-20020a170902da88b02900eecd32808emr2635356plx.15.1620275146815; Wed, 05 May 2021 21:25:46 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1620275146; cv=pass; d=google.com; s=arc-20160816; b=rUxpfKchP8UpKJ3p3oftSECo1aaZltdxANTx1W+WN5YRshIyNQCqW+IzM//EO+jdkw IAL1qrOX26eJrVYCLXrVpy7aI5nWlzChoY5yaz6JAmDADJX0bXXPl37rOxDpvUQsy+Cg qjCixkwjLKfA2eGAKz22RqBE9CXtkDWlLxri5vy18Qn50KFTYIRwYeVxFPhrTxoOKjWp M4vCHcEYsmhB9l1SFcy8XHGvw4TmET04Uljc4OoWDHdoBzri8xYe4wVwtr1L2nXIkmAQ UG84krLsOfle352XNIRgxeq1lUunqXIhmrcytvceNqn/Onkop4wt0+8WlRkgn4iaiD4Y Tt0A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=NfYBa1daWkLa/S83Q2i3o1uIDSl9rdtzZmjwwoixPgY=; b=qQs1+/xW8vDnBpahKspnZuTl307SozLOHQANpir4uq8GmrMWx7BF2B9SgsAwAwkRUt XcJ498tnwwP8qBoxm8WmOgPjXTemiLK9QRiJP3VzYKUAokV0ClWSP2k49su9kvsKol6K 3ZJ86Yrymlcaun9zoYv4krALW7/xF8Vok9y1Ii7D8eOHhNu0366eqJWlZvjMunKfRn0f dSFYY8YPonWpDhkf7UtUHlgrPQAO5z0YZWIiiD/og6aO/9N0TTOzFFuTIcbZFnmvmEOR alddTu2rB615oXJqX31g0uw7hxpBW+D0XYg+/w0Un7xvu3uXY+DFYJY6DN87ifYjXD0N IHow== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@NXP1.onmicrosoft.com header.s=selector2-NXP1-onmicrosoft-com header.b=CjqmuXyV; arc=pass (i=1 spf=pass spfdomain=oss.nxp.com dkim=pass dkdomain=oss.nxp.com dmarc=pass fromdomain=oss.nxp.com); spf=pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j5si1468706pgb.340.2021.05.05.21.25.46; Wed, 05 May 2021 21:25:46 -0700 (PDT) Received-SPF: pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@NXP1.onmicrosoft.com header.s=selector2-NXP1-onmicrosoft-com header.b=CjqmuXyV; arc=pass (i=1 spf=pass spfdomain=oss.nxp.com dkim=pass dkdomain=oss.nxp.com dmarc=pass fromdomain=oss.nxp.com); spf=pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233064AbhEFE0m (ORCPT + 6 others); Thu, 6 May 2021 00:26:42 -0400 Received: from mail-db8eur05on2055.outbound.protection.outlook.com ([40.107.20.55]:21472 "EHLO EUR05-DB8-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S232848AbhEFE0c (ORCPT ); Thu, 6 May 2021 00:26:32 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Dnttg+UvEOnIlzkRTnalaXPIOHu+EpwywNLykZ1rEIHczd0qKzITtepEOD0Y5gXiTxnOTlhJbXcYArTFhWkGr6b6sGD2ojOE08YgsYBzUMZKqxcQC6M+gNMTd4GAtYw0iLV9XSKXdc8491COcKkaBsYDm37qRWXRFghgVoXqcCmFRJflXh0SyYxGnbUJAIISZQS0UpKOQr8TExUBUY8kOgrAqzwZ/KO3zdupBMnYdv7TEvqD5FCcklA9w/x77AcdJIihd+3I6PWVCjC53PZbBFOE3z1Btrnkc0TWyor1RWhsEI2QpE4160Vk6ugWDt2a2bZXp5kjQfjVi2mLRiIpmg== 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=NfYBa1daWkLa/S83Q2i3o1uIDSl9rdtzZmjwwoixPgY=; b=VxDBxFZGZm1DRwFDRWfpyyXGlamLb6KOX/oQjlF+jpBEKyG3g/MY+dTz4dSWp5lvl/0DH8TY+Y/48d2p9oMlhR5aknIixoxLr2WuJ3awBKCSDOtiNrFVUgWTSRQtkPkhERZfjzO8opO/j5IwVKbI5AENJV1mWcOeqGoqTFNrnIlXRw8JejSsvMHy/3LXAgjq1781pRlSQ8vU5d6HZHoGnnxDfzpd6m86Tod1YEl6nTNn+jyFdA9IqHg5OGx5x40ySTF7CWk63LCNad2uaCFT34ymxmhGV2f9qgU55+AkzdItaOsvsrVr4lGu4Xe3fO0zJcbxlET0aEn/zJE7H75dhg== 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=NfYBa1daWkLa/S83Q2i3o1uIDSl9rdtzZmjwwoixPgY=; b=CjqmuXyVV88ZqNx/kL2vxks7C/a4fvgjWZF0ah/GA4Wtat7S607K+PewaItKf8Nkgh113h5qdPXbN51AURFyzrVE3uejVE8Wq1pXIaeDNylJL2uNzUCEWHWtVRMoIEndDB8zl8PS9JDpRaKRAmwPpLZguNk5p6T2MMRrdrrZUnk= 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 DB6PR04MB3126.eurprd04.prod.outlook.com (2603:10a6:6:7::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4065.20; Thu, 6 May 2021 04:25:24 +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.4065.039; Thu, 6 May 2021 04:25:24 +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 V6 7/8] remoteproc: imx_rproc: support i.MX7ULP Date: Thu, 6 May 2021 12:08:42 +0800 Message-Id: <1620274123-1461-8-git-send-email-peng.fan@oss.nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1620274123-1461-1-git-send-email-peng.fan@oss.nxp.com> References: <1620274123-1461-1-git-send-email-peng.fan@oss.nxp.com> X-Originating-IP: [119.31.174.66] X-ClientProxiedBy: SG2PR02CA0055.apcprd02.prod.outlook.com (2603:1096:4:54::19) 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 SG2PR02CA0055.apcprd02.prod.outlook.com (2603:1096:4:54::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.20.4108.25 via Frontend Transport; Thu, 6 May 2021 04:25:20 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 1e342db9-3388-4036-8018-08d91046f7ab X-MS-TrafficTypeDiagnostic: DB6PR04MB3126: 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: 4UlHyaDrbjDKVvciZg8mICievaCRuBOVknjjjEgstJcJWHN7GqlifqQzJO2NNLkFCi7XwDP4u1iAJgRjgXZv1IhWc0F75v1q6SQpxniLurxGwAApfkkq38JmLauvQeXB2PqqpOspLR/GjNxgq65jc06bf46thxcBi2HbHugwFSgw/szKBbrqC+PD622lmRr6vw71XRlLcXlHWCsdAG/1VV6EVql8+g7swJElohGIhH3QXiF6W5kXf6ZnCyjzcW2VleAXdn2rwsHq/gaAISXsGoWz3mskBhNajX/I3g007YBLm7YeBcMWp2AGMX7CwBrveKc6Xx97z11V4ZO8Btpq1H39MHZTfkHog88/sKy9n6YIOck7BL9JtunI4W2xiWoagIiFPhaG7ziQ90IokmK0+KBlEPpbOsWmp2Z2H46YFr09dKJk822hPBtM2s0mL2poXqV3ysh+Qn2vrz8L8+XqzXjgSKRMpWZ3HuwtVzTUusKi67EKeYwVwGHLJQ+L8OIJt83qp3UMMhyIlur37LsQ9yxdFZ6LVKru019O1PduOubxDlhLeD1Bbyen8MkbKzc8O5McsvMjmkJDStdHSsQxv5H9jjUxSadvNpNrJ8UkQOxLAfGYQzaZNoj90C9gNHRp6DIc7F6vbPi02jfioX9vNAh5xPaLrdv58nvsdEDquU4WtnrNo+v04WEj/bejYDXF 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)(39850400004)(366004)(136003)(396003)(376002)(346002)(26005)(38350700002)(52116002)(9686003)(2906002)(66946007)(6486002)(8676002)(6506007)(16526019)(7416002)(5660300002)(6512007)(38100700002)(186003)(478600001)(2616005)(316002)(6666004)(86362001)(66476007)(66556008)(956004)(8936002)(83380400001)(4326008)(69590400013); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: ffxRW8/pqJotC1m5STE13q7VTulIDmirGV5RexpMp53+4ow2XVofFPCmO4j0vkxwtapHFKudwi+BgXbmbPKZRChQEIOktauuhWhVOOBn+J33UtoAegGnN2p4k9vVX5T2KB9zkXjFeaUaP1+gXot90f9no6ia5QNdYSzb+wNEpTYmKnjUGIaarzGXATT1hC2D+7ya3hzVSmBkoN/U3l1fgtU1J4ONDJ2KV5Fsvbm3ZNEvrvDPrLc6bNWAmC19VZpnjWpUv/h97PkLjdROm9NunrqR2dQloRidtkzZuBH6kauBZhaLoH26KMgBuY4FhKgGHGE2JlqGxOSGE+ZuQSMZV8DLsWuxqqvtgL/fvpvnqFKhvLbdE2M0ceGz//bHQYyPhv/bGgTPqBbDTo44XeLL8g0/cv0s+93P9iRipJ0gNeUJPXv2nbs2guRpXj95RZMeTByTGovtOf5o9AXECeAviL6AjbPeA88jnMlL+iVEsUpVd/7KM6d9HZPixgis2/egF+2xWJRXm9mZ7uMwztqcgPotrW+VG/CtKCX4ozYVF365laRKxgReqfVTAXL4gPaFELqAcM17Zkbu34M/MwlFE0c3xZ9n7uIUEQqQwTMC+Q6xZTexj+Io4t4I6MZvafQs/Ow+LEF0qxQACFQjPK2WGIV161A1JgwvnOARRWZ9TWX8aG+gI9H1lx05a4QId9PauBkLczxAQrQNYtEKVgwiEZbTZ6QPi7e4kV/rG5aC5zzMXTT4fXlYIyufUKMc2Bb7zxqaY4fuCdEHCUxrhqHdKKOHsNFd2Ulcfccvvh9AvOx3x9kiaBBZ51Ef35yVVLvvooKPCtUQINu4jAGU0B+b97+x/eN5vZ9p0JkLFzefazYujAgOqBAClEq+EM8KFhvbam/C+l1QD1ZaIt02TJjLe+8Q+MF1XyyV817yzG1YbpQs/EJjY2Ap+U+goyMg0pU/Jq4XCXG0yMxWVR7XBGEY+5ktdr1mB2wUWitozEw0c1RETRgtkdkvAEAmWxir5dRbEF9fUmXpzP6qrkZy73oVDQGDpyY1kWPBK3bx0hsbzHXwuTUOq36wp1T4R85yP37WD+2ilaVFyA7Ltx3iI5pU0OC3+lrW1hxsY03V1+YKuzTzuzYYSmWQ7QIb5wp2/RjzZKg8HScU4uvlMCie3O6iMKiDUrMTeakmAaMkg+kbmecPVIe9OOQSdNNaGKr5eeFYBIbm3T2QBkNuWDC7Hhmq8oBsuw9mex3IHrEQFg0DV39lEdwxqjvE2QubCclI5znVA5ATXf/RNzmxKpnQR5DLqtKwtWR5EM6qjkTSoTa5hyaa5H7tQf+sxNcVn/7AAGNG X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1e342db9-3388-4036-8018-08d91046f7ab X-MS-Exchange-CrossTenant-AuthSource: DB6PR0402MB2760.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 May 2021 04:25:24.1291 (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: ap4Dh4O7LgYGV5B06AsXVuGDGlMpXzL6PEIWvBDv5imef47Uv3OC5ydDLzHdIu1cGBijMToOy8YEndSaTwDRNA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR04MB3126 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org From: Peng Fan i.MX7ULP A7 core runs under control of M4 core, M4 core starts by ROM and powers most services 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. Reviewed-by: Mathieu Poirier Signed-off-by: Peng Fan --- drivers/remoteproc/imx_rproc.c | 49 ++++++++++++++++++++++++++-------- 1 file changed, 38 insertions(+), 11 deletions(-) -- 2.30.0 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 },