Skip to content

Commit ccabbb6

Browse files
geertustorulf
authored andcommitted
pmdomain: renesas: rcar-gen4-sysc: Reduce atomic delays
The delays used with the various atomic polling loops are already at the maximum value of ~10µs, as documented for read_poll_timeout_atomic(). Hence reduce the delays from 10 to 1 µs. Increase PDRESR_RETRIES accordingly, to retain the old (generous) timeout value. Measurements on R-Car V3U, S4, V4H, and V4M show that the first three polling loops rarely (never?) loop, so the actual delay does not matter. The fourth loop (for SYSCISCR in rcar_gen4_sysc_power()) typically ran for one or two cycles with the old delay. With the reduced delay, it typically runs for two to 17 cycles, and finishes earlier than before, which can reduce loop time up to a factor of three. While at it, rename the SYSCISR_{TIMEOUT,DELAY_US} definitions to SYSCISCR_{TIMEOUT,DELAY_US}, to match the register name they apply to. Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> Link: https://lore.kernel.org/r/77f150522096d55c6da0ff983db61e0cf6309344.1709317289.git.geert+renesas@glider.be Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
1 parent 04581ea commit ccabbb6

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

drivers/pmdomain/renesas/rcar-gen4-sysc.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,13 @@
5050
#define SYSCSR_BUSY GENMASK(1, 0) /* All bit sets is not busy */
5151

5252
#define SYSCSR_TIMEOUT 10000
53-
#define SYSCSR_DELAY_US 10
53+
#define SYSCSR_DELAY_US 1
5454

55-
#define PDRESR_RETRIES 1000
56-
#define PDRESR_DELAY_US 10
55+
#define PDRESR_RETRIES 10000
56+
#define PDRESR_DELAY_US 1
5757

58-
#define SYSCISR_TIMEOUT 10000
59-
#define SYSCISR_DELAY_US 10
58+
#define SYSCISCR_TIMEOUT 10000
59+
#define SYSCISCR_DELAY_US 1
6060

6161
#define RCAR_GEN4_PD_ALWAYS_ON 64
6262
#define NUM_DOMAINS_EACH_REG BITS_PER_TYPE(u32)
@@ -97,7 +97,7 @@ static int clear_irq_flags(unsigned int reg_idx, unsigned int isr_mask)
9797

9898
ret = readl_poll_timeout_atomic(rcar_gen4_sysc_base + SYSCISCR(reg_idx),
9999
val, !(val & isr_mask),
100-
SYSCISR_DELAY_US, SYSCISR_TIMEOUT);
100+
SYSCISCR_DELAY_US, SYSCISCR_TIMEOUT);
101101
if (ret < 0) {
102102
pr_err("\n %s : Can not clear IRQ flags in SYSCISCR", __func__);
103103
return -EIO;
@@ -157,7 +157,7 @@ static int rcar_gen4_sysc_power(u8 pdr, bool on)
157157
/* Wait until the power shutoff or resume request has completed * */
158158
ret = readl_poll_timeout_atomic(rcar_gen4_sysc_base + SYSCISCR(reg_idx),
159159
val, (val & isr_mask),
160-
SYSCISR_DELAY_US, SYSCISR_TIMEOUT);
160+
SYSCISCR_DELAY_US, SYSCISCR_TIMEOUT);
161161
if (ret < 0) {
162162
ret = -EIO;
163163
goto out;

0 commit comments

Comments
 (0)