From patchwork Mon Mar 28 06:53:43 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lei Wen X-Patchwork-Id: 88555 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 614A6B6FC3 for ; Mon, 28 Mar 2011 17:57:06 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id B5D6528258; Mon, 28 Mar 2011 08:57:04 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 7pRmpRYeAPu7; Mon, 28 Mar 2011 08:57:04 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id D58292822F; Mon, 28 Mar 2011 08:56:41 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 0439328242 for ; Mon, 28 Mar 2011 08:54:28 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 1JNmfkA1eYDg for ; Mon, 28 Mar 2011 08:54:13 +0200 (CEST) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from dakia2.marvell.com (dakia2.marvell.com [65.219.4.35]) by theia.denx.de (Postfix) with ESMTPS id 1F7AD2822F for ; Mon, 28 Mar 2011 08:53:56 +0200 (CEST) X-ASG-Debug-ID: 1301295229-082be11e0001-4l7tJC Received: from maili.marvell.com (maili.marvell.com [10.68.76.51]) by dakia2.marvell.com with ESMTP id 8cTj8k1JjW7le4pV; Sun, 27 Mar 2011 23:53:49 -0700 (PDT) X-Barracuda-Envelope-From: leiwen@marvell.com Received: from localhost (unknown [10.38.164.145]) by maili.marvell.com (Postfix) with ESMTP id 394368A065; Sun, 27 Mar 2011 23:53:49 -0700 (PDT) From: Lei Wen To: Heiko Schocher , Prafulla Wadaskar , Wolfgang Denk , "u-boot@lists.denx.de" , Marek Vasut , Ashish Karkare , Prabhanjan Sarnaik , Yu Tang , adrian.wenl@gmail.com X-ASG-Orig-Subj: [PATCH V5 1/6] io: add and* and or* operation api to set and clear bit Date: Sun, 27 Mar 2011 23:53:43 -0700 X-ASG-Orig-Subj: [PATCH V5 1/6] io: add and* and or* operation api to set and clear bit Message-Id: <1301295228-12752-2-git-send-email-leiwen@marvell.com> X-Mailer: git-send-email 1.7.0.4 In-Reply-To: <1301291335-13734-1-git-send-email-leiwen@marvell.com> References: <1301291335-13734-1-git-send-email-leiwen@marvell.com> X-Barracuda-Connect: maili.marvell.com[10.68.76.51] X-Barracuda-Start-Time: 1301295229 X-Barracuda-URL: http://10.68.76.222:80/cgi-mod/mark.cgi X-Barracuda-Spam-Score: -1002.00 X-Barracuda-Spam-Status: No, SCORE=-1002.00 using global scores of TAG_LEVEL=1000.0 QUARANTINE_LEVEL=1000.0 KILL_LEVEL=1000.0 Subject: [U-Boot] [PATCH V5 1/6] io: add and* and or* operation api to set and clear bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.9 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de Those api take use of read*/write* to align the current dmb usage. Also this could short the code length in one line. Signed-off-by: Lei Wen --- Changelog: V2: V3: V4: Move original driver specific bit set to the general place V5: fix code style issue arch/arm/include/asm/io.h | 8 ++++++++ 1 files changed, 8 insertions(+), 0 deletions(-) diff --git a/arch/arm/include/asm/io.h b/arch/arm/include/asm/io.h index 1fbc531..71e85e8 100644 --- a/arch/arm/include/asm/io.h +++ b/arch/arm/include/asm/io.h @@ -141,6 +141,14 @@ extern inline void __raw_readsl(unsigned int addr, void *data, int longlen) #define readw(c) ({ u16 __v = __arch_getw(c); __iormb(); __v; }) #define readl(c) ({ u32 __v = __arch_getl(c); __iormb(); __v; }) +#define orb(v, c) writeb(readb(c) | v, c) +#define orw(v, c) writew(readw(c) | v, c) +#define orl(v, c) writel(readl(c) | v, c) + +#define andb(v, c) writeb(readb(c) & v, c) +#define andw(v, c) writew(readw(c) & v, c) +#define andl(v, c) writel(readl(c) & v, c) + /* * The compiler seems to be incapable of optimising constants * properly. Spell it out to the compiler in some cases.