Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.3 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E3E14C433E0 for ; Thu, 4 Mar 2021 20:59:17 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 7B96864F69 for ; Thu, 4 Mar 2021 20:59:17 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7B96864F69 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=ti.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Type: Content-Transfer-Encoding:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:Date:Message-ID:From: References:CC:To:Subject:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=XwMUa0KqeRBy54XuUqZh/Q5G1fkBdcCA1JhYyfuGILA=; b=gkYqs1braCzv309N0rTZ5wAYi wsoe3yyDFtwii4xC5rJEWcu/7b7/yStYfMn8S5PCyvjkFRnyCuEKGUId5v64PnxaoYGYZvAFcvAu6 1rfCVagttZUq/2r/bo5cGIvXQRhSbSXtxfnrbFT/UfUHGke8lLAAZ9v7gGtmJOCYToo+sSnIwtyCq NQlVhOVC8mbdM+KAnqbDX6hdRdCKmMM4yt5w7vhY6UfX6MN8KCz/pP4jN/OYZ+QWxy3NhrF3zRE8v W3bVR803VySZaLDZ0AaL1r0J/czNh4T/VOvcm9YMQcqE3dM9UiAeRQ9qz5R0r1vI7XHsGOWcvgptS tyPHBsuCQ==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lHv2d-00A4sV-5e; Thu, 04 Mar 2021 20:57:51 +0000 Received: from fllv0015.ext.ti.com ([198.47.19.141]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lHv2X-00A4pu-15 for linux-arm-kernel@lists.infradead.org; Thu, 04 Mar 2021 20:57:47 +0000 Received: from fllv0035.itg.ti.com ([10.64.41.0]) by fllv0015.ext.ti.com (8.15.2/8.15.2) with ESMTP id 124KvUS0069529; Thu, 4 Mar 2021 14:57:30 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1614891450; bh=7EsRPtM7ZM2gT07lEoewcPHopX7Slw9tPNibNpx45xs=; h=Subject:To:CC:References:From:Date:In-Reply-To; b=Ocw9pZeLd2sdoKP4SRVD87N3USu/oAGAE1o03ksr3GrAY6WQQxFRRgO3T4v1dSfXf kpmQvlik1z6y+82D2Xccw8eLlKaQw1CSCEps2PkmwsKbK11BFRKk8reegslaZYur1k yvaIg7cUs3TM/X5afWzavWLss2zf400cc/FL1QqM= Received: from DFLE104.ent.ti.com (dfle104.ent.ti.com [10.64.6.25]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 124KvUlv012323 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 4 Mar 2021 14:57:30 -0600 Received: from DFLE115.ent.ti.com (10.64.6.36) by DFLE104.ent.ti.com (10.64.6.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1979.3; Thu, 4 Mar 2021 14:57:29 -0600 Received: from fllv0040.itg.ti.com (10.64.41.20) by DFLE115.ent.ti.com (10.64.6.36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1979.3 via Frontend Transport; Thu, 4 Mar 2021 14:57:29 -0600 Received: from [10.250.100.73] (ileax41-snat.itg.ti.com [10.172.224.153]) by fllv0040.itg.ti.com (8.15.2/8.15.2) with ESMTP id 124KvRVu058496; Thu, 4 Mar 2021 14:57:27 -0600 Subject: Re: [PATCH 1/3] clocksource/drivers/timer-ti-dm: Fix posted mode status check order To: Tony Lindgren , Daniel Lezcano , Thomas Gleixner CC: Keerthy , , , References: <20210304072135.52712-1-tony@atomide.com> <20210304072135.52712-2-tony@atomide.com> From: Grygorii Strashko Message-ID: Date: Thu, 4 Mar 2021 22:57:02 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <20210304072135.52712-2-tony@atomide.com> Content-Language: en-US X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 04/03/2021 09:21, Tony Lindgren wrote: > When the timer is configured in posted mode, we need to check the write- > posted status register (TWPS) before writing to the register. > > We now check TWPS after the write starting with commit 52762fbd1c47 > ("clocksource/drivers/timer-ti-dm: Add clockevent and clocksource > support"). > > For example, in the TRM for am571x the following is documented in chapter > "22.2.4.13.1.1 Write Posting Synchronization Mode": > > "For each register, a status bit is provided in the timer write-posted > status (TWPS) register. In this mode, it is mandatory that software check > this status bit before any write access. If a write is attempted to a > register with a previous access pending, the previous access is discarded > without notice." > > The regression happened when I updated the code to use standard read/write > accessors for the driver instead of using __omap_dm_timer_load_start(). > We have__omap_dm_timer_load_start() check the TWPS status correctly using > __omap_dm_timer_write(). > > Fixes: 52762fbd1c47 ("clocksource/drivers/timer-ti-dm: Add clockevent and clocksource support") > Signed-off-by: Tony Lindgren > --- > drivers/clocksource/timer-ti-dm-systimer.c | 12 ++++++------ > 1 file changed, 6 insertions(+), 6 deletions(-) > > diff --git a/drivers/clocksource/timer-ti-dm-systimer.c b/drivers/clocksource/timer-ti-dm-systimer.c > --- a/drivers/clocksource/timer-ti-dm-systimer.c > +++ b/drivers/clocksource/timer-ti-dm-systimer.c > @@ -449,13 +449,13 @@ static int dmtimer_set_next_event(unsigned long cycles, > struct dmtimer_systimer *t = &clkevt->t; > void __iomem *pend = t->base + t->pend; > > - writel_relaxed(0xffffffff - cycles, t->base + t->counter); > while (readl_relaxed(pend) & WP_TCRR) > cpu_relax(); > + writel_relaxed(0xffffffff - cycles, t->base + t->counter); > > - writel_relaxed(OMAP_TIMER_CTRL_ST, t->base + t->ctrl); > while (readl_relaxed(pend) & WP_TCLR) > cpu_relax(); > + writel_relaxed(OMAP_TIMER_CTRL_ST, t->base + t->ctrl); It seems static [and inline] helper here could be better solution. no? > > return 0; > } > @@ -490,18 +490,18 @@ static int dmtimer_set_periodic(struct clock_event_device *evt) > dmtimer_clockevent_shutdown(evt); > > /* Looks like we need to first set the load value separately */ > - writel_relaxed(clkevt->period, t->base + t->load); > while (readl_relaxed(pend) & WP_TLDR) > cpu_relax(); > + writel_relaxed(clkevt->period, t->base + t->load); > > - writel_relaxed(clkevt->period, t->base + t->counter); > while (readl_relaxed(pend) & WP_TCRR) > cpu_relax(); > + writel_relaxed(clkevt->period, t->base + t->counter); > > - writel_relaxed(OMAP_TIMER_CTRL_AR | OMAP_TIMER_CTRL_ST, > - t->base + t->ctrl); > while (readl_relaxed(pend) & WP_TCLR) > cpu_relax(); > + writel_relaxed(OMAP_TIMER_CTRL_AR | OMAP_TIMER_CTRL_ST, > + t->base + t->ctrl); > > return 0; > } > -- Best regards, grygorii _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel