Received: by 2002:a05:6a10:d5a5:0:0:0:0 with SMTP id gn37csp3846758pxb; Mon, 4 Oct 2021 10:52:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwKkRuEWD0h8nxYpXBKItoZ+6vA7XG7Ld27Ni7tbrDVc23nn2SDRIIeKRQZHKi4yp3kQKs/ X-Received: by 2002:a05:6402:154:: with SMTP id s20mr19766680edu.253.1633369952201; Mon, 04 Oct 2021 10:52:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633369952; cv=none; d=google.com; s=arc-20160816; b=lAdMgqFR4OKuCSAWtNu+h8iM2p4ZBI7mxL+QuUVd+laMZfn5OfuYwA58s0QztXS0nF glKhCxuZO52s79hzzDWX1uTx7ehu8ZcMfh5HuinSSUadBnzk35j/K6XkqQPs1g47ZD66 l5ADu24C5DDV+V3Kn7UFmPB6/7ZRKAdirnumOQfOBnfwWgjEUc4S5u7tKHx9iPc4vcNT mbMNV9EIusd6Ytw+9+67P7USKevb4TxFGxeXhQBIc5zutyhheG3bHyVxblZMLwCoqluP eVx8Qk2zqTWZZgEVoMKSiU9CthAoszg+IGCsv1I/6mUjR6Gtp1VxISx2dmIJaTitVwYY e7Ew== 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=x1TkdRhXE1OhS3zsW88GeP150p3334b2oH7aPa/m0z4=; b=pPokqYjNqn01kImjdqz4VtxB+5GoI36KzWivINUfIre1hgf6qeuB4mPd38ecQkMrw7 GdlEXSd9ywXGl2Zo5hP+S11FY6gBfp0HyDGsCTZ4ew32pLMr+Mjgzn+f80tIxL8XZ0L8 zRKwRdx1yTp2Wsa9zmG87qCn5TWSM12HE4MATe5SKiQrwT59R9goFzwm2F/ivPUUIeGR BqH6zScuKXkRTXuY+Q3nG0U98i5XdqrlBdXsGj3Bc3sxo1JNiQ7mXH6BO6qwsy6YtNpi x0vmpGUv/5I9vBghlpTjKHaPsGjBJzF4MultNBPrlcaUkaTHWr9YtziZ4/F3vyknHCrp d7JQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="xemhKd/S"; 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 i24si11416429eds.331.2021.10.04.10.52.06; Mon, 04 Oct 2021 10:52:32 -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="xemhKd/S"; 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 S234812AbhJDPbQ (ORCPT + 99 others); Mon, 4 Oct 2021 11:31:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35740 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234917AbhJDPbP (ORCPT ); Mon, 4 Oct 2021 11:31:15 -0400 Received: from mail-oi1-x236.google.com (mail-oi1-x236.google.com [IPv6:2607:f8b0:4864:20::236]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F22E6C061746 for ; Mon, 4 Oct 2021 08:29:26 -0700 (PDT) Received: by mail-oi1-x236.google.com with SMTP id a3so21993487oid.6 for ; Mon, 04 Oct 2021 08:29:26 -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=x1TkdRhXE1OhS3zsW88GeP150p3334b2oH7aPa/m0z4=; b=xemhKd/SbPHSjPX1U6V90DwOPnxlcaKvb3HpBTkZbV4FBdcD6Re7u185LsEBsAffi9 RW08AAszqJk3iWp5vKVaeuLAZ6ogOpB2DnxDJ0IylXQbb4vGIULYoxHm6s8i9B8bk7Yq znkx0HAICYZQgxVtDOnX54KJLhOuh0HPXxebzcP6E5+rFTLH9bkxCe+5Qf8udiZPo73S qd+EJXTILe4PSik0clI4wQ+RGrmoJK/pJoX1yHLGrKlcrBAA0n+4SCIm1dlunBv9PG8y wRWwHcxiYfftn3PW3PBFobRCOSJG5fnF2nk8AbQS9yaqw3HCeStVkeu89ragGgwEHIBx LwBQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=x1TkdRhXE1OhS3zsW88GeP150p3334b2oH7aPa/m0z4=; b=52K8nt9Nq+Emc9ovtdyjj3grWrtykxGHYuXIabMwdXkOEdcIxEP53U5irglIDiYlyv 1+9D+qeIs71siBlpG84QJrZkvICdexRvIv4ULYu0UarLjZI2SJngNdPA/qzpoO8vMXGy 9P/Oq/gSkJYm7PbU/SPrIhPmAEfdk6DKBg6FdedskI5D7GPNiSjmQ7OWapjJdwMpqtD5 +lIsvJ5l5UzMnTFYyHJXqnnEgw4Nc8p79EumeBUuHHSPoDP7dTe/qozjJBqVKlnuSfJY zRcMuooMuoakIhwvJb3FIAl+NRWco2pd16jGTVdlA2u+Vfw5VfUcB/Aa6KNg5w6p6V1O S+2A== X-Gm-Message-State: AOAM533Wu6fAuSHVp3iDLqcNZtikhGrwEn5qu943DMS4UQGpVNZDjcVY Lmg1RcfVM953lgmdB31F+nVNPQ== X-Received: by 2002:a05:6808:171c:: with SMTP id bc28mr14003060oib.18.1633361366313; Mon, 04 Oct 2021 08:29:26 -0700 (PDT) Received: from builder.lan ([2600:1700:a0:3dc8:3697:f6ff:fe85:aac9]) by smtp.gmail.com with ESMTPSA id o8sm2809465oiw.39.2021.10.04.08.29.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Oct 2021 08:29:25 -0700 (PDT) Date: Mon, 4 Oct 2021 10:29:24 -0500 From: Bjorn Andersson To: Rakesh Pillai Cc: agross@kernel.org, ohad@wizery.com, mathieu.poirier@linaro.org, robh+dt@kernel.org, p.zabel@pengutronix.de, sibis@codeaurora.org, linux-arm-msm@vger.kernel.org, linux-remoteproc@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 2/2] remoteproc: qcom: q6v5_wpss: Add support for sc7280 WPSS Message-ID: References: <1615361290-19238-1-git-send-email-pillair@codeaurora.org> <1615361290-19238-3-git-send-email-pillair@codeaurora.org> <000001d71993$ded6e070$9c84a150$@codeaurora.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <000001d71993$ded6e070$9c84a150$@codeaurora.org> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon 15 Mar 07:08 CDT 2021, Rakesh Pillai wrote: > > > > -----Original Message----- > > From: Bjorn Andersson > > Sent: Wednesday, March 10, 2021 10:15 PM > > To: Rakesh Pillai > > Cc: agross@kernel.org; ohad@wizery.com; mathieu.poirier@linaro.org; > > robh+dt@kernel.org; p.zabel@pengutronix.de; sibis@codeaurora.org; linux- > > arm-msm@vger.kernel.org; linux-remoteproc@vger.kernel.org; > > devicetree@vger.kernel.org; linux-kernel@vger.kernel.org > > Subject: Re: [PATCH 2/2] remoteproc: qcom: q6v5_wpss: Add support for > > sc7280 WPSS > > > > On Wed 10 Mar 01:28 CST 2021, Rakesh Pillai wrote: > > > > > Add support for PIL loading of WPSS processor for SC7280 > > > WPSS boot will be requested by the wifi driver and hence > > > disable auto-boot for WPSS. Also add a separate shutdown > > > sequence handler for WPSS. > > > > > > Signed-off-by: Rakesh Pillai > > > --- > > > drivers/remoteproc/qcom_q6v5_adsp.c | 77 > > ++++++++++++++++++++++++++++++++++++- > > > 1 file changed, 76 insertions(+), 1 deletion(-) > > > > > > diff --git a/drivers/remoteproc/qcom_q6v5_adsp.c > > b/drivers/remoteproc/qcom_q6v5_adsp.c > > > index e024502..dc6b91d 100644 > > > --- a/drivers/remoteproc/qcom_q6v5_adsp.c > > > +++ b/drivers/remoteproc/qcom_q6v5_adsp.c > > > @@ -58,6 +58,8 @@ struct adsp_pil_data { > > > const char *ssr_name; > > > const char *sysmon_name; > > > int ssctl_id; > > > + bool is_wpss; > > > + bool auto_boot; > > > > > > const char **clk_ids; > > > int num_clks; > > > @@ -96,8 +98,54 @@ struct qcom_adsp { > > > struct qcom_rproc_glink glink_subdev; > > > struct qcom_rproc_ssr ssr_subdev; > > > struct qcom_sysmon *sysmon; > > > + > > > + int (*shutdown)(struct qcom_adsp *adsp); > > > }; > > > > > > +static int qcom_wpss_shutdown(struct qcom_adsp *adsp) > > > +{ > > > + unsigned long timeout; > > > + unsigned int val; > > > + int ret; > > > + > > > + regmap_write(adsp->halt_map, adsp->halt_lpass + > > LPASS_HALTREQ_REG, 1); > > > + > > > + /* Wait for halt ACK from QDSP6 */ > > > + timeout = jiffies + msecs_to_jiffies(ACK_TIMEOUT); > > > + for (;;) { > > > + ret = regmap_read(adsp->halt_map, > > > + adsp->halt_lpass + LPASS_HALTACK_REG, > > &val); > > > + if (ret || val || time_after(jiffies, timeout)) > > > + break; > > > + > > > + usleep_range(1000, 1100); > > > + } > > > + > > > + /* Place the WPSS processor into reset */ > > > + reset_control_assert(adsp->restart); > > > + /* wait after asserting subsystem restart from AOSS */ > > > + usleep_range(100, 105); > > > + /* Remove the WPSS reset */ > > > + reset_control_deassert(adsp->restart); > > > + > > > + usleep_range(100, 105); > > > + > > > + regmap_write(adsp->halt_map, adsp->halt_lpass + > > LPASS_HALTREQ_REG, 0); > > > + > > > + /* Wait for halt ACK from QDSP6 */ > > > + timeout = jiffies + msecs_to_jiffies(ACK_TIMEOUT); > > > + for (;;) { > > > + ret = regmap_read(adsp->halt_map, > > > + adsp->halt_lpass + LPASS_HALTACK_REG, > > &val); > > > + if (ret || !val || time_after(jiffies, timeout)) > > > + break; > > > + > > > + usleep_range(1000, 1100); > > > + } > > > + > > > + return 0; > > > +} > > > + > > > static int qcom_adsp_shutdown(struct qcom_adsp *adsp) > > > { > > > unsigned long timeout; > > > @@ -270,7 +318,7 @@ static int adsp_stop(struct rproc *rproc) > > > if (ret == -ETIMEDOUT) > > > dev_err(adsp->dev, "timed out on wait\n"); > > > > > > - ret = qcom_adsp_shutdown(adsp); > > > + ret = adsp->shutdown(adsp); > > > if (ret) > > > dev_err(adsp->dev, "failed to shutdown: %d\n", ret); > > > > > > @@ -439,6 +487,8 @@ static int adsp_probe(struct platform_device > > *pdev) > > > dev_err(&pdev->dev, "unable to allocate remoteproc\n"); > > > return -ENOMEM; > > > } > > > + > > > + rproc->auto_boot = desc->auto_boot; > > > rproc_coredump_set_elf_info(rproc, ELFCLASS32, EM_NONE); > > > > > > adsp = (struct qcom_adsp *)rproc->priv; > > > @@ -447,6 +497,11 @@ static int adsp_probe(struct platform_device > > *pdev) > > > adsp->info_name = desc->sysmon_name; > > > platform_set_drvdata(pdev, adsp); > > > > > > + if (desc->is_wpss) > > > + adsp->shutdown = qcom_wpss_shutdown; > > > + else > > > + adsp->shutdown = qcom_adsp_shutdown; > > > + > > > ret = adsp_alloc_memory_region(adsp); > > > if (ret) > > > goto free_rproc; > > > @@ -515,6 +570,8 @@ static const struct adsp_pil_data adsp_resource_init > > = { > > > .ssr_name = "lpass", > > > .sysmon_name = "adsp", > > > .ssctl_id = 0x14, > > > + .is_wpss = false, > > > + .auto_boot = true; > > > .clk_ids = (const char*[]) { > > > "sway_cbcr", "lpass_ahbs_aon_cbcr", > > "lpass_ahbm_aon_cbcr", > > > "qdsp6ss_xo", "qdsp6ss_sleep", "qdsp6ss_core", NULL > > > @@ -528,6 +585,8 @@ static const struct adsp_pil_data cdsp_resource_init > > = { > > > .ssr_name = "cdsp", > > > .sysmon_name = "cdsp", > > > .ssctl_id = 0x17, > > > + .is_wpss = false, > > > + .auto_boot = true; > > > .clk_ids = (const char*[]) { > > > "sway", "tbu", "bimc", "ahb_aon", "q6ss_slave", > > "q6ss_master", > > > "q6_axim", NULL > > > @@ -535,7 +594,23 @@ static const struct adsp_pil_data > > cdsp_resource_init = { > > > .num_clks = 7, > > > }; > > > > > > +static const struct adsp_pil_data wpss_resource_init = { > > > + .crash_reason_smem = 626, > > > + .firmware_name = "wpss.mdt", > > > + .ssr_name = "wpss", > > > + .sysmon_name = "wpss", > > > + .ssctl_id = 0x19, > > > + .is_wpss = true, > > > + .auto_boot = false; > > > > Why is auto_boot false for the WPSS? > > Wifi driver will start the remote processor when it comes up. We do not want > to load it at the start. > Can you please explain this further? We've had several cases in the past where functional drivers controls a remoteproc instance and makes assumptions about when the remoteproc is up or not. I would like to ensure that we don't design ourselves into such corner (even though I see that the ath11k code for this was merged a long time ago) Regards, Bjorn > > > > > + .clk_ids = (const char*[]) { > > > + "gcc_wpss_ahb_bdg_mst_clk", "gcc_wpss_ahb_clk", > > > + "gcc_wpss_rscp_clk", NULL > > > + }, > > > + .num_clks = 3, > > > +}; > > > + > > > static const struct of_device_id adsp_of_match[] = { > > > + { .compatible = "qcom,sc7280-wpss-pil", .data = &wpss_resource_init > > }, > > > > Nit. Please keep things like this sorted alphabetically. > > Will fix this in the next patchset. > > Thanks, > Rakesh > > > > > Regards, > > Bjorn > > > > > { .compatible = "qcom,qcs404-cdsp-pil", .data = &cdsp_resource_init > > }, > > > { .compatible = "qcom,sdm845-adsp-pil", .data = > > &adsp_resource_init }, > > > { }, > > > -- > > > 2.7.4 > > > >