From patchwork Tue Jun 18 15:20:33 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 2744621 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 4D97AC0AB1 for ; Tue, 18 Jun 2013 18:34:42 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 73A93204A0 for ; Tue, 18 Jun 2013 18:34:41 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3C4292049D for ; Tue, 18 Jun 2013 18:34:40 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Uoxm7-0003pI-R3; Tue, 18 Jun 2013 15:24:55 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1UoxkY-0003Mz-NO; Tue, 18 Jun 2013 15:23:14 +0000 Received: from mail-pd0-f182.google.com ([209.85.192.182]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Uoxjg-0003Fs-HX for linux-arm-kernel@lists.infradead.org; Tue, 18 Jun 2013 15:22:21 +0000 Received: by mail-pd0-f182.google.com with SMTP id r10so4000970pdi.41 for ; Tue, 18 Jun 2013 08:21:59 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references :in-reply-to:references:x-gm-message-state; bh=MAgLphkcuFYqumbo6LYTdG36heR8EcU3oiWCQyEtdlY=; b=TATLdnh0AN6fAdGxSSx5l3WekEtMgKyVYVuWIqdgtFj1NeUvf/+7Gm1QIKpYe8bEXx 3FX8rEkWXHni8W+xNE7FHNGyEkQVRTiOslupxBJO+IpaL9qFXtlYzoQTF5wU3YM+KQGc GxgDE3ZpH//tOXQEOKC5P7HRQaxXGeeE92Wv883Zh/7EcZAYMdEiH2fmXbdQ2dryWkKJ QKV/UZWDvZmQfdmBZtByjlwx7D7Thz7DiInK78kNySO60Q2aN8uCsG7yeJW45f/SG8Nl LZUFl1H2tvLexAD9I/7sk1Ok4kY5gLDmS4r8E9BfymH+2YlDg858Xk0f1YV55PsOCtJd C3kw== X-Received: by 10.68.27.9 with SMTP id p9mr17294229pbg.139.1371568919111; Tue, 18 Jun 2013 08:21:59 -0700 (PDT) Received: from localhost ([122.167.240.191]) by mx.google.com with ESMTPSA id v20sm20125904paj.4.2013.06.18.08.21.55 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Tue, 18 Jun 2013 08:21:58 -0700 (PDT) From: Viresh Kumar To: wim@iguana.be Subject: [PATCH V3 09/14] watchdog/mpcore_wdt: replace (__raw_)readl/writel with lighter *_relaxed variants Date: Tue, 18 Jun 2013 20:50:33 +0530 Message-Id: X-Mailer: git-send-email 1.7.12.rc2.18.g61b472e In-Reply-To: References: In-Reply-To: References: X-Gm-Message-State: ALoCoQn+ZKH8Q9zpTqEIdMARqwXT8Nqx/nC5evNf3ZAYE2zIBskCZRk33jwm8AT00qeXSPAsRbeE X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130618_112220_720409_3A8C5199 X-CRM114-Status: GOOD ( 13.27 ) X-Spam-Score: -1.9 (-) Cc: marc.zyngier@arm.com, Viresh Kumar , linux-watchdog@vger.kernel.org, linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-5.4 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP readl/writel versions for ARMV6+ contain memory barrier instruction for synchronizing DMA buffers. These are not required at least on this module. So use lighter _relaxed variants. Also, __raw_* variants don't have take care about endianess, so replace them too with _relaxed variants. Signed-off-by: Viresh Kumar --- drivers/watchdog/mpcore_wdt.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/watchdog/mpcore_wdt.c b/drivers/watchdog/mpcore_wdt.c index 75cc518..d8917ad 100644 --- a/drivers/watchdog/mpcore_wdt.c +++ b/drivers/watchdog/mpcore_wdt.c @@ -74,10 +74,10 @@ static irqreturn_t mpcore_wdt_fire(int irq, void *arg) struct mpcore_wdt *wdt = arg; /* Check it really was our interrupt */ - if (readl(wdt->base + TWD_WDOG_INTSTAT)) { + if (readl_relaxed(wdt->base + TWD_WDOG_INTSTAT)) { dev_crit(wdt->dev, "Triggered - Reboot ignored\n"); /* Clear the interrupt on the watchdog */ - writel(1, wdt->base + TWD_WDOG_INTSTAT); + writel_relaxed(1, wdt->base + TWD_WDOG_INTSTAT); return IRQ_HANDLED; } return IRQ_NONE; @@ -97,12 +97,12 @@ static int mpcore_wdt_ping(struct watchdog_device *wdd) spin_lock(&wdt->lock); /* Assume prescale is set to 256 */ - count = __raw_readl(wdt->base + TWD_WDOG_COUNTER); + count = readl_relaxed(wdt->base + TWD_WDOG_COUNTER); count = (0xFFFFFFFFU - count) * (HZ / 5); count = (count / 256) * mpcore_margin; /* Reload the counter */ - writel(count + wdt->perturb, wdt->base + TWD_WDOG_LOAD); + writel_relaxed(count + wdt->perturb, wdt->base + TWD_WDOG_LOAD); wdt->perturb = wdt->perturb ? 0 : 1; spin_unlock(&wdt->lock); @@ -114,9 +114,9 @@ static int mpcore_wdt_stop(struct watchdog_device *wdd) struct mpcore_wdt *wdt = watchdog_get_drvdata(wdd); spin_lock(&wdt->lock); - writel(0x12345678, wdt->base + TWD_WDOG_DISABLE); - writel(0x87654321, wdt->base + TWD_WDOG_DISABLE); - writel(0x0, wdt->base + TWD_WDOG_CONTROL); + writel_relaxed(0x12345678, wdt->base + TWD_WDOG_DISABLE); + writel_relaxed(0x87654321, wdt->base + TWD_WDOG_DISABLE); + writel_relaxed(0x0, wdt->base + TWD_WDOG_CONTROL); spin_unlock(&wdt->lock); return 0; @@ -133,10 +133,10 @@ static int mpcore_wdt_start(struct watchdog_device *wdd) if (mpcore_noboot) { /* Enable watchdog - prescale=256, watchdog mode=0, enable=1 */ - writel(0x0000FF01, wdt->base + TWD_WDOG_CONTROL); + writel_relaxed(0x0000FF01, wdt->base + TWD_WDOG_CONTROL); } else { /* Enable watchdog - prescale=256, watchdog mode=1, enable=1 */ - writel(0x0000FF09, wdt->base + TWD_WDOG_CONTROL); + writel_relaxed(0x0000FF09, wdt->base + TWD_WDOG_CONTROL); } return 0;