From patchwork Tue Apr 15 17:37:48 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Taras Kondratiuk X-Patchwork-Id: 3994621 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 42B7E9F336 for ; Tue, 15 Apr 2014 17:40:49 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6BFCF2025B for ; Tue, 15 Apr 2014 17:40:48 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 9196920253 for ; Tue, 15 Apr 2014 17:40:47 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Wa7Jr-0007RJ-Tm; Tue, 15 Apr 2014 17:38:51 +0000 Received: from mail-ee0-f47.google.com ([74.125.83.47]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Wa7JU-0005Qo-5q for linux-arm-kernel@lists.infradead.org; Tue, 15 Apr 2014 17:38:30 +0000 Received: by mail-ee0-f47.google.com with SMTP id b15so7932520eek.6 for ; Tue, 15 Apr 2014 10:38:04 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=wN69lO8wQvG2Jn7cyeeOGY6NRjgm5I0Jzmx8koOO5MM=; b=AH20eEZQ1d/aOqP9+Rti7VaDOO/40n9KWav8l9xihkYdSbUuf6BJPQREK2SKUokLf4 HvznG7HORiJJvQCPpK1cZBw6cLHx9RuyWDUX8UF6F89vkQpAbfnmJXPiKS/ypSYGsiig GgXkDKA5ONooR6nSyZ7kIjLl6wrZ2iG67D86X7reIvcJrNX3ryxQkaiOAsBovHM6S0bb LbI/Qf1DEWOTTu3635rybmlHb6WRLMNYLvEK5awVk6OqJ6zcWMZPe5s9vrsOIxaM8hyI LHRmS5ITsW+Q5gz2OJlO3dsQQK35qEkxtGqdHBjOmcxxdrIMFqKRMzZU7HICQKz4KuYZ jk9Q== X-Gm-Message-State: ALoCoQlSsVgP8Z6bkkoib1l8tZ2A46+cOERzlWPRmHN40Nr7qy7p3oUBralLPeruY/vPdoKd9TGv X-Received: by 10.14.115.1 with SMTP id d1mr4369443eeh.30.1397583484394; Tue, 15 Apr 2014 10:38:04 -0700 (PDT) Received: from uglx0153363.itg.ti.com ([195.238.92.128]) by mx.google.com with ESMTPSA id n41sm50741279eeg.4.2014.04.15.10.38.03 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 15 Apr 2014 10:38:03 -0700 (PDT) From: Taras Kondratiuk To: Tony Lindgren Subject: [RESEND PATCH 3/4] ARM: OMAP: counter-32k: raw read and write endian fix Date: Tue, 15 Apr 2014 20:37:48 +0300 Message-Id: <1397583469-14457-4-git-send-email-taras.kondratiuk@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1397583469-14457-1-git-send-email-taras.kondratiuk@linaro.org> References: <1397583469-14457-1-git-send-email-taras.kondratiuk@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140415_103828_402032_CAF5FDF2 X-CRM114-Status: GOOD ( 13.05 ) X-Spam-Score: -0.7 (/) Cc: Taras Kondratiuk , linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Victor Kamensky 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=-2.6 required=5.0 tests=BAYES_00,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 From: Victor Kamensky All OMAP IP blocks expect LE data, but CPU may operate in BE mode. Need to use endian neutral functions to read/write h/w registers. I.e instead of __raw_read[lw] and __raw_write[lw] functions code need to use read[lw]_relaxed and write[lw]_relaxed functions. If the first simply reads/writes register, the second will byteswap it if host operates in BE mode. Changes are trivial sed like replacement of __raw_xxx functions with xxx_relaxed variant. Signed-off-by: Victor Kamensky Signed-off-by: Taras Kondratiuk --- arch/arm/plat-omap/counter_32k.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/arm/plat-omap/counter_32k.c b/arch/arm/plat-omap/counter_32k.c index 384a776d..61b4d70 100644 --- a/arch/arm/plat-omap/counter_32k.c +++ b/arch/arm/plat-omap/counter_32k.c @@ -40,7 +40,7 @@ static void __iomem *sync32k_cnt_reg; static u64 notrace omap_32k_read_sched_clock(void) { - return sync32k_cnt_reg ? __raw_readl(sync32k_cnt_reg) : 0; + return sync32k_cnt_reg ? readl_relaxed(sync32k_cnt_reg) : 0; } /** @@ -64,7 +64,7 @@ static void omap_read_persistent_clock(struct timespec *ts) spin_lock_irqsave(&read_persistent_clock_lock, flags); last_cycles = cycles; - cycles = sync32k_cnt_reg ? __raw_readl(sync32k_cnt_reg) : 0; + cycles = sync32k_cnt_reg ? readl_relaxed(sync32k_cnt_reg) : 0; nsecs = clocksource_cyc2ns(cycles - last_cycles, persistent_mult, persistent_shift); @@ -95,7 +95,7 @@ int __init omap_init_clocksource_32k(void __iomem *vbase) * The 'SCHEME' bits(30-31) of the revision register is used * to identify the version. */ - if (__raw_readl(vbase + OMAP2_32KSYNCNT_REV_OFF) & + if (readl_relaxed(vbase + OMAP2_32KSYNCNT_REV_OFF) & OMAP2_32KSYNCNT_REV_SCHEME) sync32k_cnt_reg = vbase + OMAP2_32KSYNCNT_CR_OFF_HIGH; else