From patchwork Mon Oct 2 13:27:14 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 114612 Delivered-To: patch@linaro.org Received: by 10.140.22.163 with SMTP id 32csp681422qgn; Mon, 2 Oct 2017 06:27:38 -0700 (PDT) X-Google-Smtp-Source: AOwi7QCENrWdqAvNDtYOxkuJ8FQr+wL9paRcRSaJYlgAmvqEoNJ/SN8kSIagDdP57aFH7n11GfwL X-Received: by 10.80.135.29 with SMTP id i29mr20237159edb.31.1506950858332; Mon, 02 Oct 2017 06:27:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1506950858; cv=none; d=google.com; s=arc-20160816; b=BI8JT6ZNfA5sN4h6ME2D6wzmUoWKFRwB/lk7b1lq1vikkDCsVe8hpBCT0rweZv1mc+ twn/VYb6aizPzirtVMzb7CBJgqA25l+vkwKGzGIMoBlmVj4EnltlQ6oalbSp1VcIFdQ3 LkYaVnaX8zcV0oSmh0nL9jnWVN0fpDOT0mzC1SUmSgZKo2PbTHUazipdSRBLjz2ZmKPQ 3mgjdJ9HKm1K8sq4JGwLtH1P2AHbDvRkM71PlLhVv8v1q08GLiLqsR2QvwySfc+9LMxp U4LCZpDZfNFGNNy5dsZXDKsndWkIHq6Jo5W0aJJF0VEZpeBKTgczTScRShQYKfwn3i9b 7YDQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:cc:message-id:date:to:from :arc-authentication-results; bh=XMYbOfxgYsxWOZzKxRFVjf9diyhksbOS23z2q0UrfpA=; b=c4DWpWl3jVmx9wxD2HyN6hzVu2HcgG4GYD6QrTSYBcTyEAw7MhsPRnRYlwv9sb5RAE UQZmC98InvgHwLswahJACzrzPjqabF37mgqj69Ido1Y8IMvwJkb1vi+Gm5CIutmpeDn+ Lgarz5WUqG1KPO1Rdswg550dzVJXnOzit10bspPuqotITUckgm/Rz2PEZZIUKt7qmIsh 941LB2fjG59wQDyCbDHJgzyqNRVhkpQ+A1gPpB6bv2BXGYjCiEqQ0MQ0tp9Ny6CqwwZp 1CRSGFtY4PWLOT21RCQIeQrwxmCB5TZYfwDPY26Ni2TDcbpQybwa6TeWbo0nMzf7G+VN 0d8Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de Return-Path: Received: from lists.denx.de (dione.denx.de. [81.169.180.215]) by mx.google.com with ESMTP id v15si1069047eda.99.2017.10.02.06.27.38; Mon, 02 Oct 2017 06:27:38 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) client-ip=81.169.180.215; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by lists.denx.de (Postfix, from userid 105) id DC759C21C29; Mon, 2 Oct 2017 13:27:35 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 46CD8C21C41; Mon, 2 Oct 2017 13:27:33 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 80E7AC21C41; Mon, 2 Oct 2017 13:27:31 +0000 (UTC) Received: from mail.free-electrons.com (mail.free-electrons.com [62.4.15.54]) by lists.denx.de (Postfix) with ESMTP id 2B510C21C29 for ; Mon, 2 Oct 2017 13:27:31 +0000 (UTC) Received: by mail.free-electrons.com (Postfix, from userid 110) id E00FC208FD; Mon, 2 Oct 2017 15:27:29 +0200 (CEST) Received: from localhost (unknown [185.94.189.190]) by mail.free-electrons.com (Postfix) with ESMTPSA id 5DCD920824; Mon, 2 Oct 2017 15:27:19 +0200 (CEST) From: Maxime Ripard To: Tom Rini Date: Mon, 2 Oct 2017 15:27:14 +0200 Message-Id: <20171002132714.12176-1-maxime.ripard@free-electrons.com> X-Mailer: git-send-email 2.13.5 Cc: u-boot@lists.denx.de, Maxime Ripard , Jagan Teki Subject: [U-Boot] [PATCH] sandbox: Expand list of IO accessors X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" The setbits/clrbits/clrsetbits macros are used widely across the tree, let's provide implementation for them in the sandbox. Signed-off-by: Maxime Ripard --- arch/sandbox/include/asm/io.h | 47 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/arch/sandbox/include/asm/io.h b/arch/sandbox/include/asm/io.h index a6856356df19..3ece70d09dd1 100644 --- a/arch/sandbox/include/asm/io.h +++ b/arch/sandbox/include/asm/io.h @@ -56,6 +56,53 @@ void outl(unsigned int value, unsigned int addr); void outw(unsigned int value, unsigned int addr); void outb(unsigned int value, unsigned int addr); +#define out_arch(type,endian,a,v) write##type(cpu_to_##endian(v),a) +#define in_arch(type,endian,a) endian##_to_cpu(read##type(a)) + +#define out_le32(a,v) out_arch(l,le32,a,v) +#define out_le16(a,v) out_arch(w,le16,a,v) + +#define in_le32(a) in_arch(l,le32,a) +#define in_le16(a) in_arch(w,le16,a) + +#define out_be32(a,v) out_arch(l,be32,a,v) +#define out_be16(a,v) out_arch(w,be16,a,v) + +#define in_be32(a) in_arch(l,be32,a) +#define in_be16(a) in_arch(w,be16,a) + +#define out_8(a,v) writeb(v,a) +#define in_8(a) readb(a) + +#define clrbits(type, addr, clear) \ + out_##type((addr), in_##type(addr) & ~(clear)) + +#define setbits(type, addr, set) \ + out_##type((addr), in_##type(addr) | (set)) + +#define clrsetbits(type, addr, clear, set) \ + out_##type((addr), (in_##type(addr) & ~(clear)) | (set)) + +#define clrbits_be32(addr, clear) clrbits(be32, addr, clear) +#define setbits_be32(addr, set) setbits(be32, addr, set) +#define clrsetbits_be32(addr, clear, set) clrsetbits(be32, addr, clear, set) + +#define clrbits_le32(addr, clear) clrbits(le32, addr, clear) +#define setbits_le32(addr, set) setbits(le32, addr, set) +#define clrsetbits_le32(addr, clear, set) clrsetbits(le32, addr, clear, set) + +#define clrbits_be16(addr, clear) clrbits(be16, addr, clear) +#define setbits_be16(addr, set) setbits(be16, addr, set) +#define clrsetbits_be16(addr, clear, set) clrsetbits(be16, addr, clear, set) + +#define clrbits_le16(addr, clear) clrbits(le16, addr, clear) +#define setbits_le16(addr, set) setbits(le16, addr, set) +#define clrsetbits_le16(addr, clear, set) clrsetbits(le16, addr, clear, set) + +#define clrbits_8(addr, clear) clrbits(8, addr, clear) +#define setbits_8(addr, set) setbits(8, addr, set) +#define clrsetbits_8(addr, clear, set) clrsetbits(8, addr, clear, set) + static inline void _insw(volatile u16 *port, void *buf, int ns) { }