[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <d8d5f82e89151b09098ed0cf3f5b0827d2868cd7.camel@svanheule.net>
Date: Thu, 04 Nov 2021 10:21:50 +0100
From: Sander Vanheule <sander@...nheule.net>
To: linux-watchdog@...r.kernel.org, devicetree@...r.kernel.org
Cc: Wim Van Sebroeck <wim@...ux-watchdog.org>,
Guenter Roeck <linux@...ck-us.net>,
Rob Herring <robh+dt@...nel.org>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 2/2] watchdog: Add Realtek Otto watchdog timer
On Thu, 2021-11-04 at 09:59 +0100, Sander Vanheule wrote:
> + do {
> + if (prescale > OTTO_WDT_PRESCALE_MAX)
> + return -EINVAL;
> +
> + tick_ms = otto_wdt_tick_ms(ctrl, prescale);
> + total_ticks = div_round_ticks(timeout_ms, tick_ms, 2);
> + phase1_ticks = div_round_ticks(timeout_ms - pretimeout_ms, tick_ms,
> 1);
> + phase2_ticks = total_ticks - phase1_ticks;
> +
> + prescale++;
> + } while (phase1_ticks > OTTO_WDT_PHASE_TICKS_MAX
> + || phase2_ticks > OTTO_WDT_PHASE_TICKS_MAX);
> +
> + v = ioread32(ctrl->base + OTTO_WDT_REG_CTRL);
> +
> + v &= ~(OTTO_WDT_CTRL_PRESCALE | OTTO_WDT_CTRL_PHASE1 |
> OTTO_WDT_CTRL_PHASE2);
> + v |= FIELD_PREP(OTTO_WDT_CTRL_PHASE1, phase1_ticks - 1);
> + v |= FIELD_PREP(OTTO_WDT_CTRL_PHASE2, phase2_ticks - 1);
> + v |= FIELD_PREP(OTTO_WDT_CTRL_PRESCALE, prescale);
I dropped the prescale_next variable here, but now the wrong prescale value is used
after the loop. I'll send out a v3 shortly.
Best,
Sander
Powered by blists - more mailing lists