Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp2983603imm; Mon, 28 May 2018 21:39:19 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpNDBMampyiKECdXggwIkzm9XrneVMExiYHmoc241bcxpDm50kSfk7t3dWf6Y0jkr/EBLPo X-Received: by 2002:a65:4003:: with SMTP id f3-v6mr12740610pgp.130.1527568759058; Mon, 28 May 2018 21:39:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527568759; cv=none; d=google.com; s=arc-20160816; b=rN4/ZxZXP+8yLvYGsRybYgoEv1mCPglycTZaUtONuaWHNReJVM3kBdj1kshXs+ZvrN mmiWsbXlyvcHQdOws4XHdkxxwXjRIEcX7HkyLnFZr641NjqI6M2PR5Xf7jpjoH9RHeKC UD7vQUDqk6l1zVpPiMlW/b/IFmfJHohIzrjMmEarCFdeoIXvuB9S0hV6w4ZUYwY9vVwG 3FlLjvtaIugbTLX5adAtHasEOX+ODiD+SPUPfax0iNXmnzzuj0brYjEXnseYxY6PMpbh OdlA2lHLUEz5G8GWAyQxxQofTIJ01uchAHQVplNqEKVA83TlHOznHp6A2+N4ZpFYg3kr b9FA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=7xPpvj5RHCP7u3BDp6EcYCheg4D+J/OsWjDL30cVcJc=; b=LijSPp0gtn+3C9J0tHI+K/vSySQrwvnJVI0ZXglVxEI1IcRuaENU6+OKfaGcqR3ag6 a+OzS90MwSmh3NZPag8SycYBdxT+PLahmHTDQ6QnI9z2P9qAuhg3Oll0sGx9etBZO4yp 6526kTMPCnLRYnwAy0ZjNtiqAvLSXiH+wQeertliviHFGngz1rPLxsABzwSfXbt50MER CPLi4UKycAVcqLMknRCw3m7djQlG7fScnLKiKIVK8XuiQuYD1yWf4jt4ahVkHBAI06fs 1FFMMGIj0q+gYn+ESYsZMjd73QzxEKgrwY9VUjLwonIyy1LGTfyRC3oiGJtOgDsu/VzJ mpqA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=gslJ+Sga; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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. [209.132.180.67]) by mx.google.com with ESMTP id a6-v6si31682149plp.175.2018.05.28.21.39.04; Mon, 28 May 2018 21:39:19 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=gslJ+Sga; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 S1754566AbeE2Ee7 (ORCPT + 99 others); Tue, 29 May 2018 00:34:59 -0400 Received: from mail-pg0-f67.google.com ([74.125.83.67]:45761 "EHLO mail-pg0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754501AbeE2Eez (ORCPT ); Tue, 29 May 2018 00:34:55 -0400 Received: by mail-pg0-f67.google.com with SMTP id w3-v6so6009214pgv.12 for ; Mon, 28 May 2018 21:34:55 -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:user-agent; bh=7xPpvj5RHCP7u3BDp6EcYCheg4D+J/OsWjDL30cVcJc=; b=gslJ+Sgaxt1Iksa8ST9HAGYrYzDzSII3i2kbI3+CzHhy3n3m1AsZIpEjx0SzHglNDo sCXucGO1YI1z3zRGhfTG5NEEE1yEHnTyMmd8sTzcrmSvb/J7D9JIYfqICxYegnV4qvyj eo6uKmqvlgEa6Mh/lXo5/uJ9SJd1Mab+NNctg= 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:user-agent; bh=7xPpvj5RHCP7u3BDp6EcYCheg4D+J/OsWjDL30cVcJc=; b=jsOze10POy5xVgEsxEvy/KtZ8y5/qZEqrvI8lmmpTvbux77gWlvQ33hY16pWLKXeyw 6NtrJGzlKu8Gqe5OEkYV456L2a2Ema7vq/92Re/aTpoOdAaE4qq3Qvhub/HLVnT0r5fK lgVHXT2ZzGeWQbLQnl0KVuZeLerOy9Ys0z91tBH0SnBg3JB2qnG7ELrvdCnWIgCfcyaV Qzk9TdRs8bqpg7FDCAqoXOZ8jJRzrAJdy23610PmrNS6jnAb94x7ieU9uos5buq2XqBa 0ChkRbXwAHitMcLWMg/AkAW/vd6JAl45w+f/F4LPOKgECZ8OPgRaG6KxRpNPpmEkiMde HWyw== X-Gm-Message-State: ALKqPwexvAquo1oXzCDqjHblSzoiFPa3Vujdurm+W2uX1NiZ5AUiCzxI 8MowGKnsyA+AnxXExJcwqbRXvszMDD0= X-Received: by 2002:a63:7b03:: with SMTP id w3-v6mr12823142pgc.52.1527568495064; Mon, 28 May 2018 21:34:55 -0700 (PDT) Received: from tuxbook-pro (104-188-17-28.lightspeed.sndgca.sbcglobal.net. [104.188.17.28]) by smtp.gmail.com with ESMTPSA id g8-v6sm45192356pgc.0.2018.05.28.21.34.53 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 28 May 2018 21:34:54 -0700 (PDT) Date: Mon, 28 May 2018 21:36:34 -0700 From: Bjorn Andersson To: Rohit Kumar Cc: ohad@wizery.com, robh+dt@kernel.org, mark.rutland@arm.com, linux-remoteproc@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, bgoswami@codeaurora.org, sbpata@codeaurora.org, asishb@codeaurora.org, rkarra@codeaurora.org, RajendraBabu Medisetti , Krishnamurthy Renu , asishb@qti.qualcomm.com, Ramlal Karra , Rohit Kumar Subject: Re: [PATCH] remoteproc: Add APSS based Qualcomm ADSP PIL driver for SDM845 Message-ID: <20180529043634.GF2259@tuxbook-pro> References: <1526194908-19027-1-git-send-email-rohitkr@codeaurora.org> <20180523062645.GY14924@minitux> <767dc01f-abed-8192-0274-ff5fc092f60b@codeaurora.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <767dc01f-abed-8192-0274-ff5fc092f60b@codeaurora.org> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed 23 May 22:18 PDT 2018, Rohit Kumar wrote: > Thanks Bjorn for reviewing. > > > On 5/23/2018 11:56 AM, Bjorn Andersson wrote: > > On Sun 13 May 00:01 PDT 2018, Rohit kumar wrote: > > > > > --- a/Documentation/devicetree/bindings/remoteproc/qcom,adsp.txt > > > +++ b/Documentation/devicetree/bindings/remoteproc/qcom,adsp.txt > > > @@ -10,6 +10,7 @@ on the Qualcomm ADSP Hexagon core. > > > "qcom,msm8974-adsp-pil" > > > "qcom,msm8996-adsp-pil" > > > "qcom,msm8996-slpi-pil" > > > + "qcom,sdm845-apss-adsp-pil" > > Afaict there's nothing in this binding that ties this to the apss, so I > > don't think we should base the compatible on this. The differentiation > > is PAS vs non-PAS; so let's start naming the PAS variants > > "qcom,platform-subsystem-pas" and the non-PAS > > "qcom,platform-subsystem-pil" instead. > > > > I.e. please make this "qcom,sdm845-adsp-pil". > > > > More importantly, any resources such as clocks or reset lines should > > come from DT and as such you need to extend the binding quite a bit - > > which I suggest you do by introducing a new binding document. > Sure. Will create new dt-binding document with clocks and reset driver info > added for sdm845 PIL. > > > > - interrupts-extended: > > > Usage: required > > > diff --git a/drivers/remoteproc/Makefile b/drivers/remoteproc/Makefile > > > index 02627ed..759831b 100644 > > > --- a/drivers/remoteproc/Makefile > > > +++ b/drivers/remoteproc/Makefile > > > @@ -14,7 +14,8 @@ obj-$(CONFIG_OMAP_REMOTEPROC) += omap_remoteproc.o > > > obj-$(CONFIG_WKUP_M3_RPROC) += wkup_m3_rproc.o > > > obj-$(CONFIG_DA8XX_REMOTEPROC) += da8xx_remoteproc.o > > > obj-$(CONFIG_KEYSTONE_REMOTEPROC) += keystone_remoteproc.o > > > -obj-$(CONFIG_QCOM_ADSP_PIL) += qcom_adsp_pil.o > > > +obj-$(CONFIG_QCOM_ADSP_PIL) += qcom_adsp.o > > > +qcom_adsp-objs += qcom_adsp_pil.o qcom_adsp_pil_sdm845.o > > > obj-$(CONFIG_QCOM_RPROC_COMMON) += qcom_common.o > > > obj-$(CONFIG_QCOM_Q6V5_PIL) += qcom_q6v5_pil.o > > > obj-$(CONFIG_QCOM_SYSMON) += qcom_sysmon.o > > > diff --git a/drivers/remoteproc/qcom_adsp_pil.c b/drivers/remoteproc/qcom_adsp_pil.c > > I get the feeling that the main reason for modifying this file is its > > name, not that it reduces the complexity of the final solution. I > > definitely think it's cleaner to have some structural duplication and > > keep this driver handling the various PAS based remoteprocs. > The main intention was to re-use exisiting APIs in PAS based PIL > driver as the major change was w.r.t. start and stop of ADSP firmware. > Load(), interrupt handling and few other APIs will be same as done in > exisiting PAS based PIL driver. A very good intention, I just think it's good to keep the PAS driver only dealing with PAS targets and work on reducing the duplication in other ways; keeping the logic as simple as possible. > > Please see the RFC series I posted reducing the duplication between the > > various "Q6V5 drivers". > I went through the RFC. Our code will fit into the design. However, we > will still have some amount of code duplication between PAS and > Non-PAS ADSP PIL driver. Will this be fine? I'm sorry for not finding the time to provide you this feedback earlier. > Please suggest. > Will wait for your response whether to write complete new driver or reuse > exisitng one. > For the Hexagon based non-PAS WCSS remoteproc in IPQ8074 we're creating a new driver [1], in doing so I extracted some common helper functions that reduces the duplication between the drivers and there are a few more things on the way (e.g. reduce the code needed to deal with memory-regions). Please have a look at either extending this (non-PAS, non-MSA) driver to cover the ADSP as well. It's hard for me to see how the exact details will look after extracting the clocks and resets to their appropriate drivers, if it doesn't fit the details we should work further on making sure frameworks and helper functions reduces the logical duplication between drivers. [1] https://patchwork.kernel.org/patch/10420185/ > > [..] > > > diff --git a/drivers/remoteproc/qcom_adsp_pil.h b/drivers/remoteproc/qcom_adsp_pil.h > > [..] > > > +static inline void update_bits(void *reg, u32 mask_val, u32 set_val, u32 shift) > > > +{ > > > + u32 reg_val = 0; > > > + > > > + reg_val = ((readl(reg)) & ~mask_val) | ((set_val << shift) & mask_val); > > > + writel(reg_val, reg); > > > +} > > > + > > > +static inline unsigned int read_bit(void *reg, u32 mask, int shift) > > > +{ > > > + return ((readl(reg) & mask) >> shift); > > > +} > > I don't like these helper functions, their prototype is nonstandard and > > makes it really hard to read all the calling code. > > > > I would prefer if you just inline the operations directly, to make it > > clearer what's going on in each case - if not then at least follow the > > prototype of e.g. regmap_udpate_bits(), which people might be used to. > Sure. Will update these APIs to follow standard format used in regmap and > other drivers. I like Rob's argument here (just use readl/writel) and it does suit our current style. [..] > Thanks, > Rohit > Thank you Rohit, Bjorn