* [PATCH 0/2] Fix up qcom reset controller
@ 2023-07-26 13:26 Konrad Dybcio
2023-07-26 13:26 ` [PATCH 1/2] clk: qcom: reset: Increase max reset delay Konrad Dybcio
2023-07-26 13:26 ` [PATCH 2/2] clk: qcom: reset: Use the correct type of sleep/delay based on length Konrad Dybcio
0 siblings, 2 replies; 7+ messages in thread
From: Konrad Dybcio @ 2023-07-26 13:26 UTC (permalink / raw)
To: Bjorn Andersson, Andy Gross, Michael Turquette, Stephen Boyd,
Mike Turquette
Cc: Marijn Suijten, linux-arm-msm, linux-clk, linux-kernel,
Stephen Boyd, Konrad Dybcio
Let the toggle include a bigger delay and make sure it's using the
correct function to achieve that.
Signed-off-by: Konrad Dybcio <konrad.dybcio@linaro.org>
---
Konrad Dybcio (2):
clk: qcom: reset: Increase max reset delay
clk: qcom: reset: Use the correct type of sleep/delay based on length
drivers/clk/qcom/reset.c | 8 +++++++-
drivers/clk/qcom/reset.h | 2 +-
2 files changed, 8 insertions(+), 2 deletions(-)
---
base-commit: 0ba5d07205771c50789fd9063950aa75e7f1183f
change-id: 20230726-topic-qcom_reset-44879c0387c6
Best regards,
--
Konrad Dybcio <konrad.dybcio@linaro.org>
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 1/2] clk: qcom: reset: Increase max reset delay
2023-07-26 13:26 [PATCH 0/2] Fix up qcom reset controller Konrad Dybcio
@ 2023-07-26 13:26 ` Konrad Dybcio
2023-07-26 18:21 ` Stephan Gerhold
2023-07-26 13:26 ` [PATCH 2/2] clk: qcom: reset: Use the correct type of sleep/delay based on length Konrad Dybcio
1 sibling, 1 reply; 7+ messages in thread
From: Konrad Dybcio @ 2023-07-26 13:26 UTC (permalink / raw)
To: Bjorn Andersson, Andy Gross, Michael Turquette, Stephen Boyd,
Mike Turquette
Cc: Marijn Suijten, linux-arm-msm, linux-clk, linux-kernel,
Stephen Boyd, Konrad Dybcio
u8 limits us to 255 microseconds of delay. Promote the delay variable to
u16 to hold bigger values.
Signed-off-by: Konrad Dybcio <konrad.dybcio@linaro.org>
---
drivers/clk/qcom/reset.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/clk/qcom/reset.h b/drivers/clk/qcom/reset.h
index 9a47c838d9b1..fe0561bf53d4 100644
--- a/drivers/clk/qcom/reset.h
+++ b/drivers/clk/qcom/reset.h
@@ -11,7 +11,7 @@
struct qcom_reset_map {
unsigned int reg;
u8 bit;
- u8 udelay;
+ u16 udelay;
u32 bitmask;
};
--
2.41.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 2/2] clk: qcom: reset: Use the correct type of sleep/delay based on length
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 13:26 ` Konrad Dybcio
2023-07-26 18:34 ` Stephan Gerhold
1 sibling, 1 reply; 7+ messages in thread
From: Konrad Dybcio @ 2023-07-26 13:26 UTC (permalink / raw)
To: Bjorn Andersson, Andy Gross, Michael Turquette, Stephen Boyd,
Mike Turquette
Cc: Marijn Suijten, linux-arm-msm, linux-clk, linux-kernel,
Stephen Boyd, Konrad Dybcio
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
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 1/2] clk: qcom: reset: Increase max reset delay
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
0 siblings, 1 reply; 7+ messages in thread
From: Stephan Gerhold @ 2023-07-26 18:21 UTC (permalink / raw)
To: Konrad Dybcio
Cc: Bjorn Andersson, Andy Gross, Michael Turquette, Stephen Boyd,
Mike Turquette, Marijn Suijten, linux-arm-msm, linux-clk,
linux-kernel, Stephen Boyd
On Wed, Jul 26, 2023 at 03:26:19PM +0200, Konrad Dybcio wrote:
> u8 limits us to 255 microseconds of delay. Promote the delay variable to
> u16 to hold bigger values.
>
> Signed-off-by: Konrad Dybcio <konrad.dybcio@linaro.org>
It would be clearer to change this together with an actual user that
needs > 255us. AFAICT atm MSM8909 is the only user of this and it has
just 15us.
Thanks,
Stephan
> ---
> drivers/clk/qcom/reset.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/clk/qcom/reset.h b/drivers/clk/qcom/reset.h
> index 9a47c838d9b1..fe0561bf53d4 100644
> --- a/drivers/clk/qcom/reset.h
> +++ b/drivers/clk/qcom/reset.h
> @@ -11,7 +11,7 @@
> struct qcom_reset_map {
> unsigned int reg;
> u8 bit;
> - u8 udelay;
> + u16 udelay;
> u32 bitmask;
> };
>
>
> --
> 2.41.0
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/2] clk: qcom: reset: Increase max reset delay
2023-07-26 18:21 ` Stephan Gerhold
@ 2023-07-26 18:24 ` Konrad Dybcio
2023-07-26 18:35 ` Stephan Gerhold
0 siblings, 1 reply; 7+ messages in thread
From: Konrad Dybcio @ 2023-07-26 18:24 UTC (permalink / raw)
To: Stephan Gerhold
Cc: Bjorn Andersson, Andy Gross, Michael Turquette, Stephen Boyd,
Mike Turquette, Marijn Suijten, linux-arm-msm, linux-clk,
linux-kernel, Stephen Boyd
On 26.07.2023 20:21, Stephan Gerhold wrote:
> On Wed, Jul 26, 2023 at 03:26:19PM +0200, Konrad Dybcio wrote:
>> u8 limits us to 255 microseconds of delay. Promote the delay variable to
>> u16 to hold bigger values.
>>
>> Signed-off-by: Konrad Dybcio <konrad.dybcio@linaro.org>
>
> It would be clearer to change this together with an actual user that
> needs > 255us. AFAICT atm MSM8909 is the only user of this and it has
> just 15us.
Some LPASS resets ask for 500, but I'm still working on that driver.
Konrad
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 2/2] clk: qcom: reset: Use the correct type of sleep/delay based on length
2023-07-26 13:26 ` [PATCH 2/2] clk: qcom: reset: Use the correct type of sleep/delay based on length Konrad Dybcio
@ 2023-07-26 18:34 ` Stephan Gerhold
0 siblings, 0 replies; 7+ messages in thread
From: Stephan Gerhold @ 2023-07-26 18:34 UTC (permalink / raw)
To: Konrad Dybcio
Cc: Bjorn Andersson, Andy Gross, Michael Turquette, Stephen Boyd,
Marijn Suijten, linux-arm-msm, linux-clk, linux-kernel
On Wed, Jul 26, 2023 at 03:26:20PM +0200, Konrad Dybcio wrote:
> 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")
If anything this would fix 2cb8a39b6781 ("clk: qcom: reset: Allow
specifying custom reset delay") since before there was udelay(1)
hardcoded (which is correct).
But given that we just allowed small delays <= 255us so far it was
probably okay-ish, so I think it's not worth bringing this to the
attention of backporters with the Fixes tag.
> 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);
> +
There is fsleep() that implements this logic in a similar way already:
fsleep(rst->reset_map[id].udelay ?: 1); /* use 1 us as default */
Thanks,
Stephan
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/2] clk: qcom: reset: Increase max reset delay
2023-07-26 18:24 ` Konrad Dybcio
@ 2023-07-26 18:35 ` Stephan Gerhold
0 siblings, 0 replies; 7+ messages in thread
From: Stephan Gerhold @ 2023-07-26 18:35 UTC (permalink / raw)
To: Konrad Dybcio
Cc: Bjorn Andersson, Andy Gross, Michael Turquette, Stephen Boyd,
Marijn Suijten, linux-arm-msm, linux-clk, linux-kernel
On Wed, Jul 26, 2023 at 08:24:33PM +0200, Konrad Dybcio wrote:
> On 26.07.2023 20:21, Stephan Gerhold wrote:
> > On Wed, Jul 26, 2023 at 03:26:19PM +0200, Konrad Dybcio wrote:
> >> u8 limits us to 255 microseconds of delay. Promote the delay variable to
> >> u16 to hold bigger values.
> >>
> >> Signed-off-by: Konrad Dybcio <konrad.dybcio@linaro.org>
> >
> > It would be clearer to change this together with an actual user that
> > needs > 255us. AFAICT atm MSM8909 is the only user of this and it has
> > just 15us.
> Some LPASS resets ask for 500, but I'm still working on that driver.
>
Maybe send it together with that driver then? This feels close to the
typical "no API changes without also adding the user" rule.
Thanks,
Stephan
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2023-07-26 18:35 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 ` [PATCH 2/2] clk: qcom: reset: Use the correct type of sleep/delay based on length Konrad Dybcio
2023-07-26 18:34 ` Stephan Gerhold
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.