Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp9098712ybl; Fri, 17 Jan 2020 06:20:57 -0800 (PST) X-Google-Smtp-Source: APXvYqwugkhagsPLxF9EmiDvmh8w3a77KQ/qDQWx8mc5W8Q65HcgROfRGPUn8J7MBeQqa6ky1QeR X-Received: by 2002:a9d:7d85:: with SMTP id j5mr6247310otn.86.1579270857062; Fri, 17 Jan 2020 06:20:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579270857; cv=none; d=google.com; s=arc-20160816; b=nAqdy6R8CfV1gd5fkNxP4aslL8GwDir6aCVf7PmmfoHt7yk3p/ODSeYiXuL2fXPiGh XiLC56xmSgyt9IGmFMGFxxjlg7zjCLLUJwzrGJMGl4+65oXQmUaVuxPs4qaGLL4AklQR J/n9OD+SnILxDnNQzNiJxPcq/ycKe5lwrRz5dLbTMzfxJB09Wr4mte5lZ6XmMQWmBsdL WrVRV5D3GsQZnA8i9M4KbSDEoTvaeYQAT11bdjqV0FyGzmc2WieuaEHyW/hcQ32NV1bz /+XwJeYUF9a/MqtytgeUNZvy9j/RyY3nmiNIGmoJz0fodmLs2t0kqQ6mB5qv7lZvW+s7 +U7Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent :content-transfer-encoding:references:in-reply-to:date:cc:to:from :subject:message-id; bh=2GiM0CfjJ0Ew+2CIwM1+LzUvUJ0koUtgjV13JLj+K/Y=; b=RwrlryTJWTbsZjpOCxF7oNiS0xVS1X4EPpcUffF1vCp3m01h5PnLhdzV0qn2+dOjJd YL+8CyFB+HqmXrnUZnujjJkgwE0SfUmolQGRdPSP2uM/45Rs/8EOy8vF1O6M2Lti/lRm 2Iw3g0HNH6fli3E61Nm2r3TVA/aWjeyp6D+fLxBCoAcNU57fnRuW8GotrKdNTrmQ2gZo CIeiN1ns58BkSA2cJHS1TWX8GNsS/b891VdfXeYck6sEMW3Lt/oCvHWQ3AUqHNPB+aY6 TIVcjnKvWN8JEVSf5s/usU2svq8QSwNaL+7P6UIh4abw8CF6/x/NMOt3xRws5w2BtZuN z5Yw== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p22si14153344ota.43.2020.01.17.06.20.44; Fri, 17 Jan 2020 06:20:57 -0800 (PST) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727580AbgAQOTi convert rfc822-to-8bit (ORCPT + 99 others); Fri, 17 Jan 2020 09:19:38 -0500 Received: from metis.ext.pengutronix.de ([85.220.165.71]:50295 "EHLO metis.ext.pengutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726957AbgAQOTi (ORCPT ); Fri, 17 Jan 2020 09:19:38 -0500 Received: from lupine.hi.pengutronix.de ([2001:67c:670:100:3ad5:47ff:feaf:1a17] helo=lupine) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1isSTF-0006eE-5w; Fri, 17 Jan 2020 15:19:33 +0100 Received: from pza by lupine with local (Exim 4.92) (envelope-from ) id 1isSTE-0007Jv-BR; Fri, 17 Jan 2020 15:19:32 +0100 Message-ID: Subject: Re: [PATCH 1/4] remoteproc: qcom: q6v5-mss: Use regmap_read_poll_timeout From: Philipp Zabel To: Sibi Sankar , bjorn.andersson@linaro.org, evgreen@chromium.org Cc: ohad@wizery.com, linux-arm-msm@vger.kernel.org, linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org, agross@kernel.org Date: Fri, 17 Jan 2020 15:19:32 +0100 In-Reply-To: <20200117135130.3605-2-sibis@codeaurora.org> References: <20200117135130.3605-1-sibis@codeaurora.org> <20200117135130.3605-2-sibis@codeaurora.org> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8BIT User-Agent: Evolution 3.30.5-1.1 MIME-Version: 1.0 X-SA-Exim-Connect-IP: 2001:67c:670:100:3ad5:47ff:feaf:1a17 X-SA-Exim-Mail-From: p.zabel@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 2020-01-17 at 19:21 +0530, Sibi Sankar wrote: > Replace the loop for HALT_ACK detection with regmap_read_poll_timeout. > > Signed-off-by: Sibi Sankar > --- > drivers/remoteproc/qcom_q6v5_mss.c | 16 ++++++---------- > 1 file changed, 6 insertions(+), 10 deletions(-) > > diff --git a/drivers/remoteproc/qcom_q6v5_mss.c b/drivers/remoteproc/qcom_q6v5_mss.c > index 51f451311f5fc..f20b39c6ff0ed 100644 > --- a/drivers/remoteproc/qcom_q6v5_mss.c > +++ b/drivers/remoteproc/qcom_q6v5_mss.c > @@ -73,6 +73,7 @@ > #define NAV_AXI_IDLE_BIT BIT(2) > > #define HALT_ACK_TIMEOUT_MS 100 > +#define NAV_HALT_ACK_TIMEOUT_US 200 > > /* QDSP6SS_RESET */ > #define Q6SS_STOP_CORE BIT(0) > @@ -746,7 +747,6 @@ static void q6v5proc_halt_nav_axi_port(struct q6v5 *qproc, > struct regmap *halt_map, > u32 offset) > { > - unsigned long timeout; > unsigned int val; > int ret; > > @@ -760,15 +760,11 @@ static void q6v5proc_halt_nav_axi_port(struct q6v5 *qproc, > NAV_AXI_HALTREQ_BIT); > > /* Wait for halt ack*/ > - timeout = jiffies + msecs_to_jiffies(HALT_ACK_TIMEOUT_MS); > - for (;;) { > - ret = regmap_read(halt_map, offset, &val); > - if (ret || (val & NAV_AXI_HALTACK_BIT) || > - time_after(jiffies, timeout)) > - break; > - > - udelay(5); > - } > + ret = regmap_read_poll_timeout(halt_map, offset, val, > + (val & NAV_AXI_HALTACK_BIT), > + 5, NAV_HALT_ACK_TIMEOUT_US); > + if (ret) > + dev_err(qproc->dev, "nav halt ack timeout\n"); > > ret = regmap_read(halt_map, offset, &val); > if (ret || !(val & NAV_AXI_IDLE_BIT)) Reviewed-by: Philipp Zabel regards Philipp