From patchwork Mon Nov 5 05:13:41 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Chou X-Patchwork-Id: 197141 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 324762C0080 for ; Mon, 5 Nov 2012 16:14:11 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 4E3EF4A27D; Mon, 5 Nov 2012 06:14:08 +0100 (CET) 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 YoMoR70hIU+S; Mon, 5 Nov 2012 06:14:08 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id CBC7F4A276; Mon, 5 Nov 2012 06:14:03 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id C08894A276 for ; Mon, 5 Nov 2012 06:14:01 +0100 (CET) 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 Cu1mDhuKa99r for ; Mon, 5 Nov 2012 06:13:58 +0100 (CET) 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 www.wytron.com.tw (www.wytron.com.tw [211.75.82.101]) by theia.denx.de (Postfix) with ESMTP id 84C6D4A275 for ; Mon, 5 Nov 2012 06:13:56 +0100 (CET) Received: from darkstar.wytron.com.tw (unknown [192.168.1.100]) by www.wytron.com.tw (Postfix) with ESMTP id 723F3B007C2; Mon, 5 Nov 2012 13:13:51 +0800 (CST) From: Thomas Chou To: u-boot@lists.denx.de Date: Mon, 5 Nov 2012 13:13:41 +0800 Message-Id: <1352092421-31973-1-git-send-email-thomas@wytron.com.tw> X-Mailer: git-send-email 1.7.11.7 Cc: Tom Rini , Marek Vasut Subject: [U-Boot] [PATCH] nios2: use builtin functions for control registers access X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.11 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 The commit 51926d5ee0be029fb45f10f42756df97279f8ad3 COMMON: Use __stringify() instead of rest of implementations forgot to update the wrctl funtion, and causes compilation error. But there are builtin functions for control registers access in nios2 comipiler. It is convenient to use them instead. Signed-off-by: Thomas Chou Cc: Marek Vasut --- include/nios2.h | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/include/nios2.h b/include/nios2.h index df8126a..5da7c87 100644 --- a/include/nios2.h +++ b/include/nios2.h @@ -24,8 +24,6 @@ #ifndef __NIOS2_H__ #define __NIOS2_H__ -#include - /*------------------------------------------------------------------------ * Control registers -- use with wrctl() & rdctl() *----------------------------------------------------------------------*/ @@ -39,14 +37,8 @@ * Access to control regs *----------------------------------------------------------------------*/ -#define rdctl(reg)\ - ({unsigned int val;\ - asm volatile("rdctl %0, ctl" __stringify(reg) \ - : "=r" (val) ); val;}) - -#define wrctl(reg,val)\ - asm volatile( "wrctl ctl" _str_(reg) ",%0"\ - : : "r" (val)) +#define rdctl(reg) __builtin_rdctl(reg) +#define wrctl(reg,val) __builtin_wrctl(reg,val) /*------------------------------------------------------------------------ * Control reg bit masks