Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp1444593pxb; Thu, 4 Nov 2021 02:23:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwqI+9Y61a5bcVORUtOqu9U53fv4lO6MoXOfY+rJ4+2M6/NsNdQq1+8ZeXO48TtseQqUy7X X-Received: by 2002:a05:6602:2c07:: with SMTP id w7mr35288882iov.122.1636017795905; Thu, 04 Nov 2021 02:23:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1636017795; cv=none; d=google.com; s=arc-20160816; b=uulwJW/I5i3Kdqc8gS0tlj0shhdVQetkMPHPpMI9hwDKpITp0olDcMNmx2aWvi3Igz AcpriCOJz1LzmC5yQrIywRP7gGjMBNL3An9nNdVcyY8qgXQWRnfjFXSOsu/3D2qBOPs+ vUegHgqhLy4wYP/bgzCUjl/pyav+UFU+25cQc5ys0KmJXJo3KSs544Q7kjhXuPsYCDLH dMUhrXWPwepzsTlks+xRBU8s/jtX9Od3Pyf6UQ0/4RMY6kq80Ia3IZ9UlKpHugMIrnqd Fl66+N2oEEcPItoMqpN2VjwsdgUkzw3bzzfFzhu4vd/6aVmEjjPLQVc3KHGO3MwAn82x yPFA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:date:cc:to:from:subject :message-id:dkim-signature; bh=y70bAvqnCv4oVjmWTcG3uLPetllC23Wd0oU9QdEYhIo=; b=rLohWGWt0t22iH0ihXFP/e8VNOeiYdsmQTcO5LXdlvOfEr+NWWJqk/+M77iMkZ6vxI 0ZB+bFMLGjI9+1WS8iofw9r9eoOUIHw1OxwEQkEYbDXRCiq/Eed+z1icKTed5o0qZVV/ NMq3xDTUrREcgn+W8d5raw2JRIFQdYXLCAABIihuoIBsjH2LhzhUTPegGRB8KhxLMQLv vln+4G98KnYGzfgrQiaVr4MDRjcbxwRgveLWauKPGGw3lz5CbsVApNr+/yXGaQ+lhH3Z 94k5Ixs7pKK3xUXSkH/HDp9wQVjYCp3RjipMevIGbVw09ceVTnCvOkwq8qMNky3qyFJM PsdQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@svanheule.net header.s=mail1707 header.b="E/+HXaAG"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=svanheule.net Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b18si10197047jat.93.2021.11.04.02.22.58; Thu, 04 Nov 2021 02:23:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@svanheule.net header.s=mail1707 header.b="E/+HXaAG"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=svanheule.net Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230450AbhKDJYb (ORCPT + 99 others); Thu, 4 Nov 2021 05:24:31 -0400 Received: from polaris.svanheule.net ([84.16.241.116]:37702 "EHLO polaris.svanheule.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230363AbhKDJYb (ORCPT ); Thu, 4 Nov 2021 05:24:31 -0400 Received: from [10.104.240.139] (unknown [195.176.0.34]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: sander@svanheule.net) by polaris.svanheule.net (Postfix) with ESMTPSA id 6A13B26C27B; Thu, 4 Nov 2021 10:21:52 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=svanheule.net; s=mail1707; t=1636017712; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=y70bAvqnCv4oVjmWTcG3uLPetllC23Wd0oU9QdEYhIo=; b=E/+HXaAGvMgBUpuiKfMI76bfoc0rO7n3cmhDQCTnvjE6CRMwlGypRTkbxqq2ndIYbz3Sf4 wP6xQJ8j93JTBDU5rhrEa8YbFw96yYRcH4yBS+OIX2xOMvvYfKnQbIe8UgMD4DAUHDNGiU IN7AJ0BySc+I90iNHe293EJrXwXvPthYV/oeapyZIVD16UcE72wxNOZTxZAkqn/1BD33qs +AX5FOhrRKkSwCJgRm2wtxrj7SDDCVJQhvQxD93hgCeLehWbOAoPwbahqAjHZHSrCQ9E9W WL7BAFIql5q8TgMAof9ZqlhV5EE/PSpq8aS6VuFdXh1kAfOtEX0REx3x3ykH+A== Message-ID: Subject: Re: [PATCH v2 2/2] watchdog: Add Realtek Otto watchdog timer From: Sander Vanheule To: linux-watchdog@vger.kernel.org, devicetree@vger.kernel.org Cc: Wim Van Sebroeck , Guenter Roeck , Rob Herring , linux-kernel@vger.kernel.org Date: Thu, 04 Nov 2021 10:21:50 +0100 In-Reply-To: <20211104085952.13572-3-sander@svanheule.net> References: <20211104085952.13572-1-sander@svanheule.net> <20211104085952.13572-3-sander@svanheule.net> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.42.0 (3.42.0-1.fc35) MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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