From patchwork Mon Nov 5 05:13:41 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [U-Boot] nios2: use builtin functions for control registers access Date: Sun, 04 Nov 2012 19:13:41 -0000 From: Thomas Chou X-Patchwork-Id: 197141 Message-Id: <1352092421-31973-1-git-send-email-thomas@wytron.com.tw> To: u-boot@lists.denx.de Cc: Tom Rini , Marek Vasut 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