Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp2577476pxb; Tue, 21 Sep 2021 03:03:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw8nA3OTHV73/Xqc1n4iDxDgm13C+Wwts6cZmA9ljUWI8uxCZWs5pASnm0TOSQspCBF7uIF X-Received: by 2002:a17:906:7c52:: with SMTP id g18mr33355880ejp.246.1632218599932; Tue, 21 Sep 2021 03:03:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632218599; cv=none; d=google.com; s=arc-20160816; b=JPjkrQLTCtSBRymP6LUFt5Vr1dNLKuA3mAHFBXgzk1kZ45GCLOV9ydZtT3wMFlzMPq +Rxe7OOVUWu6O/NI6MAa0Byub+t0gEm76zvw/vgw2Q7OD0R6XGzOVHc+9k5O8n0gW8/t P/Q7Hwg3ATrSYi+FvowHtynK1OcSxN2GAPB/ZeXTukQn8DRiDJ9Of8lcS9GYpVekblaN aF9Bwpa09/ePkqCqDFBe6odYhvnVxAdV8MCnBo4RvAW4Teydm9ceN0lHQXu/7+5q6ILk fARV2l+4YysJlyxCjaewXTVboEtEVTVGsVriKlBOGcN8kbF8RLS6G0LsBaMqzTiCJHdV pnAA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from; bh=Ehhgg5muqwxiAmKBy9CHb1G3YWXS0lF71sWLUVPd6A4=; b=b6GKV8pZHjLjc2xbBFsWdOYXcRv6e6VK6EkguHWP1/lCdIFapDlKpEwuPi10yvYGDI YbzSg8fL/xep+P1dqSbUtSsSlrbf5bv8lg0FkW4I28+xAnPYSfp2ybdXue9Yq3yPSKDL Nu82vcL0rV3Pt/vOOXWc2HvCqn24vOPus46QIlaSsarK6Yt+f31mQ2jx4MgJ4LVQrjft WLJ4f+XhhiAlIBn/gy057Lnd06sw7n482jqTcE2gWAjXiWBCUOOcON/8fC1vRqMHMFRc hz62dX6PKoUKRbPr7sTDn/gnVq65/cIz1bst/dhY63oTTLtMOylLUwWp2eK+AY+3Uxbm CU+w== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ch16si19025808edb.168.2021.09.21.03.02.55; Tue, 21 Sep 2021 03:03:19 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231560AbhIUKC7 (ORCPT + 99 others); Tue, 21 Sep 2021 06:02:59 -0400 Received: from muru.com ([72.249.23.125]:35408 "EHLO muru.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229683AbhIUKCz (ORCPT ); Tue, 21 Sep 2021 06:02:55 -0400 Received: from hillo.muru.com (localhost [127.0.0.1]) by muru.com (Postfix) with ESMTP id 4A5138127; Tue, 21 Sep 2021 10:01:53 +0000 (UTC) From: Tony Lindgren To: linux-omap@vger.kernel.org Cc: Dave Gerlach , Faiz Abbas , Greg Kroah-Hartman , Grygorii Strashko , Keerthy , Kevin Hilman , Nishanth Menon , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH 1/9] bus: ti-sysc: Fix timekeeping_suspended warning on resume Date: Tue, 21 Sep 2021 13:01:07 +0300 Message-Id: <20210921100115.59865-2-tony@atomide.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210921100115.59865-1-tony@atomide.com> References: <20210921100115.59865-1-tony@atomide.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On resume we can get a warning at kernel/time/timekeeping.c:824 for timekeeping_suspended. Let's fix this by adding separate functions for sysc_poll_reset_sysstatus() and sysc_poll_reset_sysconfig() and have the new functions handle also timekeeping_suspended. If iopoll at some point supports timekeeping_suspended, we can just drop the custom handling from these functions. Fixes: d46f9fbec719 ("bus: ti-sysc: Use optional clocks on for enable and wait for softreset bit") Signed-off-by: Tony Lindgren --- drivers/bus/ti-sysc.c | 65 +++++++++++++++++++++++++++++++++++-------- 1 file changed, 53 insertions(+), 12 deletions(-) diff --git a/drivers/bus/ti-sysc.c b/drivers/bus/ti-sysc.c --- a/drivers/bus/ti-sysc.c +++ b/drivers/bus/ti-sysc.c @@ -17,6 +17,7 @@ #include #include #include +#include #include #include @@ -223,37 +224,77 @@ static u32 sysc_read_sysstatus(struct sysc *ddata) return sysc_read(ddata, offset); } -/* Poll on reset status */ -static int sysc_wait_softreset(struct sysc *ddata) +static int sysc_poll_reset_sysstatus(struct sysc *ddata) { - u32 sysc_mask, syss_done, rstval; - int syss_offset, error = 0; - - if (ddata->cap->regbits->srst_shift < 0) - return 0; - - syss_offset = ddata->offsets[SYSC_SYSSTATUS]; - sysc_mask = BIT(ddata->cap->regbits->srst_shift); + int error, retries; + u32 syss_done, rstval; if (ddata->cfg.quirks & SYSS_QUIRK_RESETDONE_INVERTED) syss_done = 0; else syss_done = ddata->cfg.syss_mask; - if (syss_offset >= 0) { + if (likely(!timekeeping_suspended)) { error = readx_poll_timeout_atomic(sysc_read_sysstatus, ddata, rstval, (rstval & ddata->cfg.syss_mask) == syss_done, 100, MAX_MODULE_SOFTRESET_WAIT); + } else { + retries = MAX_MODULE_SOFTRESET_WAIT; + while (retries--) { + rstval = sysc_read_sysstatus(ddata); + if ((rstval & ddata->cfg.syss_mask) == syss_done) + return 0; + udelay(2); /* Account for udelay flakeyness */ + } + error = -ETIMEDOUT; + } - } else if (ddata->cfg.quirks & SYSC_QUIRK_RESET_STATUS) { + return error; +} + +static int sysc_poll_reset_sysconfig(struct sysc *ddata) +{ + int error, retries; + u32 sysc_mask, rstval; + + sysc_mask = BIT(ddata->cap->regbits->srst_shift); + + if (likely(!timekeeping_suspended)) { error = readx_poll_timeout_atomic(sysc_read_sysconfig, ddata, rstval, !(rstval & sysc_mask), 100, MAX_MODULE_SOFTRESET_WAIT); + } else { + retries = MAX_MODULE_SOFTRESET_WAIT; + while (retries--) { + rstval = sysc_read_sysconfig(ddata); + if (!(rstval & sysc_mask)) + return 0; + udelay(2); /* Account for udelay flakeyness */ + } + error = -ETIMEDOUT; } return error; } +/* Poll on reset status */ +static int sysc_wait_softreset(struct sysc *ddata) +{ + int syss_offset, error = 0; + + if (ddata->cap->regbits->srst_shift < 0) + return 0; + + syss_offset = ddata->offsets[SYSC_SYSSTATUS]; + + if (syss_offset >= 0) + error = sysc_poll_reset_sysstatus(ddata); + else if (ddata->cfg.quirks & SYSC_QUIRK_RESET_STATUS) + error = sysc_poll_reset_sysconfig(ddata); + + return error; +} + static int sysc_add_named_clock_from_child(struct sysc *ddata, const char *name, const char *optfck_name) -- 2.33.0