mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Sander Vanheule <sander@svanheule.net>
To: linux-watchdog@vger.kernel.org, devicetree@vger.kernel.org
Cc: Wim Van Sebroeck <wim@linux-watchdog.org>,
	Guenter Roeck <linux@roeck-us.net>,
	Rob Herring <robh+dt@kernel.org>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 2/2] watchdog: Add Realtek Otto watchdog timer
Date: Thu, 04 Nov 2021 10:21:50 +0100	[thread overview]
Message-ID: <d8d5f82e89151b09098ed0cf3f5b0827d2868cd7.camel@svanheule.net> (raw)
In-Reply-To: <20211104085952.13572-3-sander@svanheule.net>

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

      reply	other threads:[~2021-11-04  9:21 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-04  8:59 [PATCH v2 0/2] Add Realtek Otto WDT support Sander Vanheule
2021-11-04  8:59 ` [PATCH v2 1/2] dt-bindings: watchdog: Realtek Otto WDT binding Sander Vanheule
2021-11-04  8:59 ` [PATCH v2 2/2] watchdog: Add Realtek Otto watchdog timer Sander Vanheule
2021-11-04  9:21   ` Sander Vanheule [this message]

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=d8d5f82e89151b09098ed0cf3f5b0827d2868cd7.camel@svanheule.net \
    --to=sander@svanheule.net \
    --cc=devicetree@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-watchdog@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=robh+dt@kernel.org \
    --cc=wim@linux-watchdog.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

all inboxes | Powered by JetHome®