Received: by 2002:a05:6a10:a852:0:0:0:0 with SMTP id d18csp2939376pxy; Mon, 3 May 2021 11:18:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwO7wmWfTTXI5yqDP2ZXokqA+W56HyxRKy8z6eGcztkKkpwi6YeAj74PPMOuJjClu+sMkkE X-Received: by 2002:a63:4d50:: with SMTP id n16mr19195892pgl.237.1620065473996; Mon, 03 May 2021 11:11:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620065473; cv=none; d=google.com; s=arc-20160816; b=mLOX4UdXMiPwZDdUO3gAmFi4k+VUBOowgChYHhHLLwMVuJbqkIKBnlsrjeR78iaxrh 89IFxa588FAl1JirgKgik+DTGHcDbNwTLgtS6Yht3Qa79Kgp/nlAxuWBYiME8vX+/tWi tSxhXdQTb7DMNW8Fl5lssrk1D8WSEkhmELGYdBR0wqoEbuhQHixlb4RQyie/vtbc1HLo SFVdn8emY5ggbdFe0jzTxKfa4mVetHQTb57IEW1bk26igji1o6Z4g9M2OocuD4IjHzjg qH+LAJho6epaO2DNtpisfokgBx/XIAU8POfFSD7h6/K3DPq0NoOUQH8JHX8S15dJwyh1 Poew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=IMPuX2GLAUntzsthEcxUQ2FwjzaX9JjI2MyBDDngoGU=; b=GIpZvPk/A7Xau7O35Ezai/zrb0froAKShWuKZ5aTdrTv/AYd4AcDQ80AGvexrPo5g9 VnbMvqjkhuEFPuBmq79PPnzmi7iQIj7wMIflz6iYQOyonyJox7DaVAdQ2ScP25oSjSeR hbPsUL+I/aIrzec8+kyMa3GABjH6RmUW22iCwlnpihTN0rcQDBv9EfhWdy5DHzUiT1C/ ngpvAVCRDMOxLPWWMwwZKx1riJeA55Cfkz/oLfCvECO+GThYqqe3ZbPHf6l6/iXpTVTB jHnUMp8RY1TO1lpkEIDgeGGbYsaP+zAFTAYsmFR/vu6PgihOlSwzwHIv+Whel58GNmej 6r8A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=JorQnrKo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z5si1232356pju.43.2021.05.03.11.11.01; Mon, 03 May 2021 11:11:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-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=@linaro.org header.s=google header.b=JorQnrKo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231174AbhECQac (ORCPT + 99 others); Mon, 3 May 2021 12:30:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48434 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231189AbhECQab (ORCPT ); Mon, 3 May 2021 12:30:31 -0400 Received: from mail-pf1-x433.google.com (mail-pf1-x433.google.com [IPv6:2607:f8b0:4864:20::433]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7A537C061763 for ; Mon, 3 May 2021 09:29:38 -0700 (PDT) Received: by mail-pf1-x433.google.com with SMTP id p4so4559174pfo.3 for ; Mon, 03 May 2021 09:29:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=IMPuX2GLAUntzsthEcxUQ2FwjzaX9JjI2MyBDDngoGU=; b=JorQnrKo8j2/VqI6YR8OhY7Wb7CbydQ52xnJPb3cnX6PA2k8nnkeXX1YrGinVWZ7c7 FpaBa7gUbrQV1JajbCantUw/qNb6h4F8WKU56vIqxmln1OsCxA6vbQuIY7/66vL2qZIv oWZc4GRtMGLyw3Mey8biOE/lKJ5SgI0UdC2CqomaQEwmrfNaQZYhM5Xhk3OxdxHDLoYM O+uSUyRB6uyXAufl+8TKoTp0eYR2HJLtecloxkI39cxf29pLVxbwndLOjNRvj0V3/ksS iz1Hfzm295cxJCg7OsFahNA1b9W2iRNhd6PwwMVoZusvbU6wrpaN4CkKJLJX4ouzhfcT qyFw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=IMPuX2GLAUntzsthEcxUQ2FwjzaX9JjI2MyBDDngoGU=; b=ANEZVuzVBSVZ99DN6uznSHPZwaI+pKEB3HP+fYAe7X3KoHH8QyYie0KrJJWzN/mVIr 2skuhZWlecoYB0BI2LR7JGjcr32QzKrGHB5zxKTm9WAndCmU51auEOgWlyc9HCd59TVQ MMc0JpJv+8CTtFp9G/ootxw3X7gnUd3L21ArMykSAbNJ4FY7yeTAOmO8o/GWD/I6sziw IomEjv8qyoU+pAZBSozLkkYf2z76KulmtfBQqvV9MNF1TTe30QJFeQ+gZR5LyJc3HxBd EBjs5uCP0Y2FlmetH60hFoLyF/eG2eGlToqA+YcElBIQ9j3T7RmdeT/aZ8uEseaAO2Vc jyrw== X-Gm-Message-State: AOAM532L94EzDHTauHziPsKPdnNCisR83HN29G1Hbw+2YBF9uXzB74V3 l73t/UXp7w6uQqWKUzFuiROilVPJKI/Svg== X-Received: by 2002:a63:cf55:: with SMTP id b21mr19789896pgj.126.1620059377918; Mon, 03 May 2021 09:29:37 -0700 (PDT) Received: from xps15 (S0106889e681aac74.cg.shawcable.net. [68.147.0.187]) by smtp.gmail.com with ESMTPSA id t19sm9606010pfg.100.2021.05.03.09.29.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 May 2021 09:29:37 -0700 (PDT) Date: Mon, 3 May 2021 10:29:35 -0600 From: Mathieu Poirier To: peng.fan@oss.nxp.com Cc: ohad@wizery.com, bjorn.andersson@linaro.org, o.rempel@pengutronix.de, robh+dt@kernel.org, devicetree@vger.kernel.org, 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: Re: [PATCH V5 7/8] remoteproc: imx_rproc: support i.MX7ULP Message-ID: <20210503162935.GB1699665@xps15> References: <1618971622-30539-1-git-send-email-peng.fan@oss.nxp.com> <1618971622-30539-8-git-send-email-peng.fan@oss.nxp.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1618971622-30539-8-git-send-email-peng.fan@oss.nxp.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Apr 21, 2021 at 10:20:21AM +0800, peng.fan@oss.nxp.com wrote: > 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 s/serivces/services I pointed that out on V4 - why do I have to do so again? With that: Reviwed-by: Mathieu Poirier > 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 }, > -- > 2.30.0 >