Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp9572pxa; Tue, 11 Aug 2020 15:43:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyVCnbIufxYLjLtUzq50cIQ/4jfp49Hyyv2epNVm/b/Vk7DD1zZGn7WGpT0TZKVkFik0D1L X-Received: by 2002:a05:6402:22b3:: with SMTP id cx19mr28033452edb.248.1597185834794; Tue, 11 Aug 2020 15:43:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597185834; cv=none; d=google.com; s=arc-20160816; b=hK5LWrZq2E46oj2o3BQcleJGCFpheBtUjco/pdyM6jBfa7rGRn/Gv8BBRRMChrgkJR U/E0aiiYccBDOWO7540LkMofCV1c4r+6d0l6In9EcvHSOhPMsjSWvEvPxCxC7TXU52GY VM63ITWgVPRX7EJlEXe/QjDpWltzVo0hJ//gTOIpscMwgjZzob2lDjetF37P8UDU0GK+ xyISkn2miDS7CuO1tDrxxvkWDF57JOmtPG9rmnZQH+siEd9Hbqml7TN8tVsquYADYW9X em976S2qQKCgGBDrUb26/YoeMJ5pFPQ7+46oqlhkAFumKMWy/Oxa44y8rciMHutXA+Ht mNBQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=oHyQTUvTUFNtPnfXB354eAFfqwmcdKEgh8qUciOM6ac=; b=qJxIGbstzwe7D7b58ZNs/yUsEeU0LJwb8c2uEGd0YFulomH3v/0mHmIE2v5N+7ttNU +emGzvmzKOK8a6sOXPdLJek48ifiMoMKMtuXFhDuGUGEpjXGCH/GbvO9APzQawM3+vel SIkRvswJ4DbW+6fQN10dfhY7J0XNdiSMfbYo19dC8SYkGFVRe0VMv6s2OWzbmyrbCXtp 63hL1u6EEzIc23usS9If1clgNzzID3/tmVC/5k7ojRqm6z2FL+H1RupumuNvYUkjqoIM LZq7rpE8s8Hv6UCtvRTuwrwCXlDoPKqjIm2uoxeyxq4SKOa0g5ifljdWUgMVxYcShb3M IsyA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Q+Mr4NjN; 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 dh25si97885edb.8.2020.08.11.15.43.32; Tue, 11 Aug 2020 15:43:54 -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=Q+Mr4NjN; 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 S1726501AbgHKWkd (ORCPT + 99 others); Tue, 11 Aug 2020 18:40:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41950 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726310AbgHKWkd (ORCPT ); Tue, 11 Aug 2020 18:40:33 -0400 Received: from mail-pf1-x441.google.com (mail-pf1-x441.google.com [IPv6:2607:f8b0:4864:20::441]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 393F8C061788 for ; Tue, 11 Aug 2020 15:40:33 -0700 (PDT) Received: by mail-pf1-x441.google.com with SMTP id 17so1138pfw.9 for ; Tue, 11 Aug 2020 15:40:33 -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=oHyQTUvTUFNtPnfXB354eAFfqwmcdKEgh8qUciOM6ac=; b=Q+Mr4NjN6PyImpPTNKKWFG/Z5AoMhj9JWM8jtgqV/wwe3AMGAtvjfyZBX6qbvMR4gS jEE2gjM7SLo/oV7nYKYoE7s3SXRHNKUYSy71EhTAdC4vlNHYTXhjzxm8D16lKWy/9VP0 6GxhrytItisbuM1vsjS+C6vACracgq2Lu0gS5ePRWJayQXP8eBWqh4JOwgm/HnHHIoZs adEqh/yuqxIdRaMkkMYVlk26ATTJQogmOkk3f2Jo0i+1j/1ewgf1n84x6ace81t5P2ks D1v20OwnPrvV+L/Yunwv3j/HGI1tXyUYeNGTmircrYjn6G3f0UI70CIc57DEjbCFxUHL YJdA== 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=oHyQTUvTUFNtPnfXB354eAFfqwmcdKEgh8qUciOM6ac=; b=lXJ1aEsxzaqWTV16eg6luDJfYeZZmcwzZ2GXFdWUXwLgH32ftEQhZ9bDec3B1uZJsj VyyN8WWC3kwxitiffrYMm70VvpH5Gi4DG0oQ+b9bBDASU7HDCaBKSFybe9Ab3YbQXuo0 x+Y2SDFta9+8l96C7K6iyG1ENuyqA30rUMIDHU48m0zlNXSQdu3H8BiHuTVh2KzWhX1d VakPSSQk0LIoZfKadNAvMKgfuQsH3sNzW+vkj9cDgsvBGO4eSxcXRMajytapZ5vCk1kr iS9lVlpFp47oKWjuN78qbjA48yBhTOEYCLl5jwqzGjK7TxcYsSfgcFS4c91vkIISxHam TIHg== X-Gm-Message-State: AOAM533upq0C7TQBWTfMGC94LqY1K80ftuaKUjBH5x9ZwLuQsvgF6cU1 Tzy2jvrtB52YFpsVgB5tHYIwOg== X-Received: by 2002:a62:6186:: with SMTP id v128mr8416919pfb.211.1597185632526; Tue, 11 Aug 2020 15:40:32 -0700 (PDT) Received: from xps15 (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id x136sm115500pfc.28.2020.08.11.15.40.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Aug 2020 15:40:31 -0700 (PDT) Date: Tue, 11 Aug 2020 16:40:29 -0600 From: Mathieu Poirier To: Peng Fan Cc: bjorn.andersson@linaro.org, o.rempel@pengutronix.de, robh+dt@kernel.org, linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org Subject: Re: [PATCH 04/10] remoteproc: imx_rproc: make syscon optional Message-ID: <20200811224029.GE3370567@xps15> References: <20200724080813.24884-1-peng.fan@nxp.com> <20200724080813.24884-5-peng.fan@nxp.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200724080813.24884-5-peng.fan@nxp.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jul 24, 2020 at 04:08:07PM +0800, Peng Fan wrote: > Make syscon optional, since i.MX8QM/QXP/7ULP not have SRC to control M4. > But currently i.MX8QM/QXP/7ULP not added, so still check regmap > when start/stop to avoid unhappy things. > > Reviewed-by: Richard Zhu > Signed-off-by: Peng Fan > --- > drivers/remoteproc/imx_rproc.c | 11 +++++++++-- > 1 file changed, 9 insertions(+), 2 deletions(-) > > diff --git a/drivers/remoteproc/imx_rproc.c b/drivers/remoteproc/imx_rproc.c > index 82594a800a1b..4fad5c0b1c05 100644 > --- a/drivers/remoteproc/imx_rproc.c > +++ b/drivers/remoteproc/imx_rproc.c > @@ -162,6 +162,9 @@ static int imx_rproc_start(struct rproc *rproc) > struct device *dev = priv->dev; > int ret; > > + if (!priv->regmap) > + return -EOPNOTSUPP; Proceeding this way is hard to maintain. I would perfer to add specific operations based on the scenario or coprocessor we are working with. > + > ret = regmap_update_bits(priv->regmap, dcfg->src_reg, > dcfg->src_mask, dcfg->src_start); > if (ret) > @@ -177,6 +180,9 @@ static int imx_rproc_stop(struct rproc *rproc) > struct device *dev = priv->dev; > int ret; > > + if (!priv->regmap) > + return -EOPNOTSUPP; > + > ret = regmap_update_bits(priv->regmap, dcfg->src_reg, > dcfg->src_mask, dcfg->src_stop); > if (ret) > @@ -325,9 +331,10 @@ static int imx_rproc_probe(struct platform_device *pdev) > 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 = NULL; > + } else { > + regmap_attach_dev(dev, regmap, &config); Here you are altering how all the existing implemenation are currently working. Add a new field to imx_rproc_dcfg and based on that, determine if a regmap is mandatory or not. > } > - regmap_attach_dev(dev, regmap, &config); > > /* set some other name then imx */ > rproc = rproc_alloc(dev, "imx-rproc", &imx_rproc_ops, > -- > 2.16.4 >