Linux ARM-MSM sub-architecture
 help / color / mirror / Atom feed
From: Konrad Dybcio <konrad.dybcio@linaro.org>
To: Bjorn Andersson <andersson@kernel.org>,
	Andy Gross <agross@kernel.org>,
	Michael Turquette <mturquette@baylibre.com>,
	Stephen Boyd <sboyd@kernel.org>,
	Mike Turquette <mturquette@linaro.org>
Cc: Marijn Suijten <marijn.suijten@somainline.org>,
	linux-arm-msm@vger.kernel.org, linux-clk@vger.kernel.org,
	linux-kernel@vger.kernel.org, Stephen Boyd <sboyd@codeaurora.org>,
	Konrad Dybcio <konrad.dybcio@linaro.org>
Subject: [PATCH 2/2] clk: qcom: reset: Use the correct type of sleep/delay based on length
Date: Wed, 26 Jul 2023 15:26:20 +0200	[thread overview]
Message-ID: <20230726-topic-qcom_reset-v1-2-92de6d3e4c7c@linaro.org> (raw)
In-Reply-To: <20230726-topic-qcom_reset-v1-0-92de6d3e4c7c@linaro.org>

Based on the length of the delay (see: [1]), use the correct sleep/delay
functions.

[1] https://www.kernel.org/doc/Documentation/timers/timers-howto.txt
Fixes: b36ba30c8ac6 ("clk: qcom: Add reset controller support")
Signed-off-by: Konrad Dybcio <konrad.dybcio@linaro.org>
---
 drivers/clk/qcom/reset.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/clk/qcom/reset.c b/drivers/clk/qcom/reset.c
index 0e914ec7aeae..928995c3f369 100644
--- a/drivers/clk/qcom/reset.c
+++ b/drivers/clk/qcom/reset.c
@@ -14,9 +14,15 @@
 static int qcom_reset(struct reset_controller_dev *rcdev, unsigned long id)
 {
 	struct qcom_reset_controller *rst = to_qcom_reset_controller(rcdev);
+	u16 delay_us = rst->reset_map[id].udelay ?: 1;
 
 	rcdev->ops->assert(rcdev, id);
-	udelay(rst->reset_map[id].udelay ?: 1); /* use 1 us as default */
+
+	if (delay_us < 10)
+		udelay(delay_us);
+	else
+		usleep_range(delay_us, delay_us + 5);
+
 	rcdev->ops->deassert(rcdev, id);
 	return 0;
 }

-- 
2.41.0


  parent reply	other threads:[~2023-07-26 13:26 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-26 13:26 [PATCH 0/2] Fix up qcom reset controller Konrad Dybcio
2023-07-26 13:26 ` [PATCH 1/2] clk: qcom: reset: Increase max reset delay Konrad Dybcio
2023-07-26 18:21   ` Stephan Gerhold
2023-07-26 18:24     ` Konrad Dybcio
2023-07-26 18:35       ` Stephan Gerhold
2023-07-26 13:26 ` Konrad Dybcio [this message]
2023-07-26 18:34   ` [PATCH 2/2] clk: qcom: reset: Use the correct type of sleep/delay based on length Stephan Gerhold

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230726-topic-qcom_reset-v1-2-92de6d3e4c7c@linaro.org \
    --to=konrad.dybcio@linaro.org \
    --cc=agross@kernel.org \
    --cc=andersson@kernel.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marijn.suijten@somainline.org \
    --cc=mturquette@baylibre.com \
    --cc=mturquette@linaro.org \
    --cc=sboyd@codeaurora.org \
    --cc=sboyd@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox