Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4597189pxj; Wed, 12 May 2021 08:57:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxBv6Cqk6Nr9jty0wrdk2kLEI2kr3HqqU+5hL5HAWwLfFsvJH7D2bxplDepoJfyIA96UmiH X-Received: by 2002:a9d:7d12:: with SMTP id v18mr13700891otn.221.1620835050539; Wed, 12 May 2021 08:57:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620835050; cv=none; d=google.com; s=arc-20160816; b=cMjCZrBRvsfZwSBUcL6nI46AYI6MidPHSEd7xWlDyDWRKIs6RxdlXz3xd1Lj6Ef9VC dSwzHixkAUSzn8N9wbE02do1WMzF222uBCw79hEb0IwxJ+ssZDbjo743Ax62yZ3gKOx+ m/mn7SvI2DC1K/zPlcscd/nL4iu+2GLstQ66T3yC8vdU/g7DB6dCAlTZ4bOlFMev0QUT ktOyUhWpW5tkV3xut2cwXZ7uXkN8/25UkfZL7/KUDUHrb+ZACZWHjJwBn8xS7JNcjI4T CD+NmyhbvvKFmm9PrgRHSujdIhrD667v9vp2Qa1rB/JLbbkZhUlE3CnEW9RlAr7IPbGq VtUw== 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:message-id:date:subject:cc:to :from:dkim-signature; bh=6fQ4r2Q41pkrGm7XoRAp4mYpbJTrh0rsbjSe6IlGnSo=; b=NJz0qHV3JmW7Zips3Hh8Qf2OQICXVon8oAfFzpcXwSDaMawWNsUrupt7FMLVGnW/11 3zqCSlR0HMzHlkVL5xYE2DJ6FhMTdB+f5gFk7zd0mfJzGvtqGpwJ1Ty1oCvCS6ric+7j vGnbfYylUcnfJnmFeiT8qf8/UY+APSuxM7NSoS2xjjTyz3cQJ3LbsYv2zaPkXaveVNNP LNY1vRy5rham5fqFLOkmYMv9LSyP9ihUc1pZbt7iYzBuNl7fYkE6ImORFvc+5p2OytRZ XW3uiUqk9cyvnrhRVoVIlp0BtrI29Jx7GD/9i5mfLycduU+R8Zyobomt+LvHjtendZFt bZkA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=QDixWD9E; 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=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c8si212451oia.149.2021.05.12.08.57.16; Wed, 12 May 2021 08:57:30 -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=@linuxfoundation.org header.s=korg header.b=QDixWD9E; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236289AbhELPzH (ORCPT + 99 others); Wed, 12 May 2021 11:55:07 -0400 Received: from mail.kernel.org ([198.145.29.99]:40742 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235067AbhELP0i (ORCPT ); Wed, 12 May 2021 11:26:38 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id A0F12619D5; Wed, 12 May 2021 15:11:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1620832286; bh=iskjLq3stQY6pW14znA3uT5yirChRDox2RZ7J4dGAQU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QDixWD9EFNJiVuO7NvrbjrKNgCxOiKl1YIQmvHZiJ606cVGTs0xaj2cK11CIsWjh+ SnKeY7V9NnVqVxWOVT3/URQantAn9zqmXcsItYFfC0vNAKNW8oEJpYXo8oftWnkNJF gzx8XasZ6mzxpu9x38LQIGTsU6Tjcdz4kP/lRmAc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tony Lindgren , Daniel Lezcano , Sasha Levin Subject: [PATCH 5.10 216/530] clocksource/drivers/timer-ti-dm: Fix posted mode status check order Date: Wed, 12 May 2021 16:45:26 +0200 Message-Id: <20210512144826.936757981@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210512144819.664462530@linuxfoundation.org> References: <20210512144819.664462530@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Tony Lindgren [ Upstream commit 212709926c5493a566ca4086ad4f4b0d4e66b553 ] 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 Signed-off-by: Daniel Lezcano Link: https://lore.kernel.org/r/20210304072135.52712-2-tony@atomide.com Signed-off-by: Sasha Levin --- 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 index 33b3e8aa2cc5..422376680c8a 100644 --- 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); 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; } -- 2.30.2