Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp555037pxb; Fri, 16 Apr 2021 12:04:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwiYPEe44KhMi01Z14gTD9c4mMJEC8c4+iIyt4LQcJL7ziXOm+RI3PnPtm4F7Z9Sg4JcNyn X-Received: by 2002:a50:fb19:: with SMTP id d25mr2910656edq.340.1618599860810; Fri, 16 Apr 2021 12:04:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618599860; cv=none; d=google.com; s=arc-20160816; b=WCJchWRoApbSbnRjqIGyW4Dg5mb2PpBKOJM0Ow72Xq3naVYNb0RZlZ9ko1fWCnGAd0 KUwmYPbdLQetwbOtlqTHawEkqysD03UxpxlLH4b187xmT0Yv+ewZU5xV21k2ni3efty7 XcYDbpL2d/ksGSyco3s8ckbF7sJEpTd3oKxZplQWNwAXK1UzVcN1fVVLW6S2rwCfYCIX SEIfuBlsc4LiB1xRu1Bg2trZtiITlNdCxFFXmmErHOP3saUtOJuu5RfHCS1SFHjmnyk4 NWc0lHnqyDoYWGlFenxZg+VqudHVB0v2thpq7nO+Z3QfmTb5RqTb4tcmSNq6Hc2Hfrgu j7YA== 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=7wXuYb2sAQupo2LG+aIJB2xPslEGiIuMvjBT329yg3U=; b=eMW4dNidn0UcygF4uwsp4Vir+4iuhpj3dBfPLYZTjGiByeTWiMhH+17CiLVPuYAzfs bJgcbR9U2ut3XyCbApCia3sTZYPrw97lAGqHePR0of/6ncgtCKRTRAX/4u0BCshn6GT1 3m40eVxwRPR8ycwLcsjOwotKrmqpy5tLHXUPOuMDEMfI4adJ9nO4kqBJOQMr1mKArxgi IIWwvBgumAvkGXFx4yygIy2x1e17lKawaBugHAqAyEpkRSVmqwrCXApF3ajOB8yz5dWu ZgBpMPKT9pyhh3paA0ds0lQJ239NkIITbJ2NNGzexEgisBEyBTOD8i6qUK3rt8VwAvB/ cpTA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=J5PjHQGs; 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 b18si2091042edx.573.2021.04.16.12.03.58; Fri, 16 Apr 2021 12:04:20 -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=J5PjHQGs; 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 S243532AbhDPRqz (ORCPT + 99 others); Fri, 16 Apr 2021 13:46:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59726 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235877AbhDPRqw (ORCPT ); Fri, 16 Apr 2021 13:46:52 -0400 Received: from mail-pl1-x62f.google.com (mail-pl1-x62f.google.com [IPv6:2607:f8b0:4864:20::62f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C837DC061756 for ; Fri, 16 Apr 2021 10:46:24 -0700 (PDT) Received: by mail-pl1-x62f.google.com with SMTP id d8so14368759plh.11 for ; Fri, 16 Apr 2021 10:46:24 -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=7wXuYb2sAQupo2LG+aIJB2xPslEGiIuMvjBT329yg3U=; b=J5PjHQGscCeSuO/gbZXuoewf8jGW9qKmFdTqS24XZn2uTUgChpjgJRSE0zIyVx56Wh K6ruEk05Qdf/5KJuHfJh2gsM6DgcJMLk5XKJdzJRHkL5lactllzN9rrVHBS3m4GBuPHW eErmAOFfOjDA/Gt40EEImNaXyzYe9+WbtA+ropKWwpYzYE1tOk8HmAhaJuhfg8l14tS1 CfAvjkhATJRg+pCAjnA8NuY+7lDvuXhPFECRnCp9ZI6N07vSV0SN/rLQq6OvPXv2/Jtt nNvYqgvphMkTuvocMNUxcBqqrnKDOd6jNIrLIhFiOp9Oxgy7/iZfIezi6KBvTcO48Upy qVRw== 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=7wXuYb2sAQupo2LG+aIJB2xPslEGiIuMvjBT329yg3U=; b=guvBkyYcxPqnbE9+reJzYMIbnqpOG9jRNC1Hqyq/tQ3f/kBvGizbShSuoKICNm2E+V XOxbJxLS2eNcQ5At82U/rXFfxh2taLKPgC6que06vDIvCQEau8Dqe76TZ+IMZofVtC33 Xt1tGbCBBRT32F1kR5U+g0LWYIbv6AGvG7EaYBR8mbthHl6DeaPUChF/u9YOv/d4WUEL JICSv+MhE3QdZXo23hmeIQEVHGT5vOQHzCqmCB8Nx/dqRTeLhShNeMNb59K4wWsWmJMP UdFh4JqRCwEY/ZoJ+LLEO6AyivP0dNRjBYjdReonaT7uT13JFOg49lCN5u5lyEH6kwOW iP7w== X-Gm-Message-State: AOAM53019mkg+pWUGFs3HcwX/v8AhQO9IwsxP67o/lB8wEid1cb2Lwo1 llB39R5MKVAS/RCtYgfxQj8Llg== X-Received: by 2002:a17:902:f1d3:b029:ec:7b6e:5826 with SMTP id e19-20020a170902f1d3b02900ec7b6e5826mr4473776plc.22.1618595184388; Fri, 16 Apr 2021 10:46:24 -0700 (PDT) Received: from xps15 (S0106889e681aac74.cg.shawcable.net. [68.147.0.187]) by smtp.gmail.com with ESMTPSA id w123sm1891141pfb.109.2021.04.16.10.46.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Apr 2021 10:46:24 -0700 (PDT) Date: Fri, 16 Apr 2021 11:46:22 -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 V4 6/8] remoteproc: imx_rproc: make clk optional Message-ID: <20210416174622.GC1050209@xps15> References: <1618493261-32606-1-git-send-email-peng.fan@oss.nxp.com> <1618493261-32606-7-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: <1618493261-32606-7-git-send-email-peng.fan@oss.nxp.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Apr 15, 2021 at 09:27:39PM +0800, peng.fan@oss.nxp.com wrote: > From: Peng Fan > > To i.MX7ULP, M4 is the master to control everything, no need to provide > clk from Linux side. So make clk optional when method is IMX_RPROC_NONE. > > Signed-off-by: Peng Fan > --- > drivers/remoteproc/imx_rproc.c | 46 ++++++++++++++++++++++++++++-------------- > 1 file changed, 31 insertions(+), 15 deletions(-) > > diff --git a/drivers/remoteproc/imx_rproc.c b/drivers/remoteproc/imx_rproc.c > index 2b633fd..56dfcc1 100644 > --- a/drivers/remoteproc/imx_rproc.c > +++ b/drivers/remoteproc/imx_rproc.c > @@ -606,6 +606,35 @@ static int imx_rproc_detect_mode(struct imx_rproc *priv) > return 0; > } > > +static int imx_rproc_clk_enable(struct imx_rproc *priv) > +{ > + const struct imx_rproc_dcfg *dcfg = priv->dcfg; > + struct device *dev = priv->dev; > + int ret; > + > + /* Remote core is not under control of Linux */ > + if (dcfg->method == IMX_RPROC_NONE) > + return 0; > + > + priv->clk = devm_clk_get(dev, NULL); > + if (IS_ERR(priv->clk)) { > + dev_err(dev, "Failed to get clock\n"); > + return PTR_ERR(priv->clk); > + } > + > + /* > + * clk for M4 block including memory. Should be > + * enabled before .start for FW transfer. > + */ > + ret = clk_prepare_enable(priv->clk); > + if (ret) { > + dev_err(dev, "Failed to enable clock\n"); > + return ret; > + } > + > + return 0; > +} > + > static int imx_rproc_probe(struct platform_device *pdev) > { > struct device *dev = &pdev->dev; > @@ -654,22 +683,9 @@ static int imx_rproc_probe(struct platform_device *pdev) > 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"); > - ret = PTR_ERR(priv->clk); > - goto err_put_mbox; > - } > - > - /* > - * clk for M4 block including memory. Should be > - * enabled before .start for FW transfer. > - */ > - ret = clk_prepare_enable(priv->clk); > - if (ret) { > - dev_err(&rproc->dev, "Failed to enable clock\n"); > + ret = imx_rproc_clk_enable(priv); > + if (ret) Much better Reviewed-by: Mathieu Poirier > goto err_put_mbox; > - } > > INIT_WORK(&priv->rproc_work, imx_rproc_vq_work); > > -- > 2.7.4 >