From patchwork Thu Oct 23 13:51:55 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 5140811 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 9E105C11AC for ; Thu, 23 Oct 2014 13:55:35 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D9F3B2024F for ; Thu, 23 Oct 2014 13:55:34 +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 D06272026C for ; Thu, 23 Oct 2014 13:55:33 +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 1XhIpJ-0008Vp-VR; Thu, 23 Oct 2014 13:53:17 +0000 Received: from mail-pd0-f180.google.com ([209.85.192.180]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1XhIp1-0008CX-H8 for linux-arm-kernel@lists.infradead.org; Thu, 23 Oct 2014 13:53:00 +0000 Received: by mail-pd0-f180.google.com with SMTP id fp1so1044706pdb.25 for ; Thu, 23 Oct 2014 06:52:38 -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; bh=b3cd418DnCFbE5itiQiXKV1DYGcjWCzf0d24ZCnsdNo=; b=iQOmQ60Fz6ryrq6GT4sC2pHdBRICMUMbOmeVdzcs0bAZjIBcectUB2vNCkI818ljQz 8Z9lCDBqf5t/zNEFmlhjg9WFQMSfbYTAdWrQcAWAIFwo+fWQj8xpJgOLBaF0C9qxjXDY NRCfkgUp30iR7F0AvRXV0i0cddrcuFmo+xjVgS2dAxHviRlxDQDLmstYTsDibQdJtriu DWLGa2cUo4wGZZXh9KFqS+lS7hw3bfq7BNDyYaVEiG8GXDpOe4vIJ40za9f2qvh/tqrm MPNDuJNROfCwFEaUbJl/TlYXvc/5VTzED/J2e8fNQs7JBWonkI6vrIniO53Z5pNptJsN p9mQ== X-Gm-Message-State: ALoCoQk9JEetwb4vCffotGBldGiZmRt9gTkaySwJceGs30Hm1s4t0MWaQikFeW+2OPlAMNMV6/aT X-Received: by 10.66.255.36 with SMTP id an4mr5209677pad.15.1414072358109; Thu, 23 Oct 2014 06:52:38 -0700 (PDT) Received: from t430.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [70.73.24.112]) by mx.google.com with ESMTPSA id v11sm1648973pas.24.2014.10.23.06.52.36 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 23 Oct 2014 06:52:37 -0700 (PDT) From: mathieu.poirier@linaro.org To: linux@arm.linux.org.uk Subject: [PATCH v2] ARM: supplementing IO accessors with 64 bit capability Date: Thu, 23 Oct 2014 07:51:55 -0600 Message-Id: <1414072315-18393-1-git-send-email-mathieu.poirier@linaro.org> X-Mailer: git-send-email 1.9.1 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20141023_065259_673294_40782D61 X-CRM114-Status: UNSURE ( 9.73 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -0.9 (/) Cc: thomas.petazzoni@free-electrons.com, mathieu.poirier@linaro.org, stefano.stabellini@eu.citrix.com, catalin.marinas@arm.com, Liviu.Dudau@arm.com, linux-kernel@vger.kernel.org, ezequiel.garcia@free-electrons.com, linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 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=-3.3 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, 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: Mathieu Poirier Some drivers on ARMv7 need 64 bit read and writes. Signed-off-by: Mathieu Poirier Acked-by: Nicolas Pitre --- Changes for v2: - Protecting [readq, writeq]_relaxed with architecture constraint. arch/arm/include/asm/io.h | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/arch/arm/include/asm/io.h b/arch/arm/include/asm/io.h index 1805674..027832b 100644 --- a/arch/arm/include/asm/io.h +++ b/arch/arm/include/asm/io.h @@ -118,6 +118,24 @@ static inline u32 __raw_readl(const volatile void __iomem *addr) return val; } +#if __LINUX_ARM_ARCH__ >= 5 +static inline void __raw_writeq(u64 val, volatile void __iomem *addr) +{ + asm volatile("strd %1, %0" + : "+Qo" (*(volatile u64 __force *)addr) + : "r" (val)); +} + +static inline u64 __raw_readq(const volatile void __iomem *addr) +{ + u64 val; + asm volatile("ldrd %1, %0" + : "+Qo" (*(volatile u64 __force *)addr), + "=r" (val)); + return val; +} +#endif + /* * Architecture ioremap implementation. */ @@ -306,10 +324,17 @@ extern void _memset_io(volatile void __iomem *, int, size_t); __raw_readw(c)); __r; }) #define readl_relaxed(c) ({ u32 __r = le32_to_cpu((__force __le32) \ __raw_readl(c)); __r; }) +#if __LINUX_ARM_ARCH__ >= 5 +#define readq_relaxed(c) ({ u64 __r = le64_to_cpu((__force __le64) \ + __raw_readq(c)); __r; }) +#endif #define writeb_relaxed(v,c) __raw_writeb(v,c) #define writew_relaxed(v,c) __raw_writew((__force u16) cpu_to_le16(v),c) #define writel_relaxed(v,c) __raw_writel((__force u32) cpu_to_le32(v),c) +#if __LINUX_ARM_ARCH__ >= 5 +#define writeq_relaxed(v,c) __raw_writeq((__force u64) cpu_to_le64(v),c) +#endif #define readb(c) ({ u8 __v = readb_relaxed(c); __iormb(); __v; }) #define readw(c) ({ u16 __v = readw_relaxed(c); __iormb(); __v; })