From patchwork Wed Dec 15 15:13:14 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rob Herring X-Patchwork-Id: 75651 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 A46551007D1 for ; Thu, 16 Dec 2010 02:13:42 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 0EAAB28094; Wed, 15 Dec 2010 16:13:41 +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 o2pBEWL+piN6; Wed, 15 Dec 2010 16:13:40 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 9BBF128099; Wed, 15 Dec 2010 16:13:39 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 3925A2809D for ; Wed, 15 Dec 2010 16:13:38 +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 3kBVMEUHSR0Y for ; Wed, 15 Dec 2010 16:13:34 +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 mail-gy0-f172.google.com (mail-gy0-f172.google.com [209.85.160.172]) by theia.denx.de (Postfix) with ESMTP id 04EBC28099 for ; Wed, 15 Dec 2010 16:13:32 +0100 (CET) Received: by gyd12 with SMTP id 12so1094420gyd.3 for ; Wed, 15 Dec 2010 07:13:31 -0800 (PST) Received: by 10.91.7.15 with SMTP id k15mr8403235agi.167.1292426011752; Wed, 15 Dec 2010 07:13:31 -0800 (PST) Received: from rob-laptop.i.smooth-stone.com ([173.226.190.126]) by mx.google.com with ESMTPS id p9sm1545782anf.7.2010.12.15.07.13.29 (version=SSLv3 cipher=RC4-MD5); Wed, 15 Dec 2010 07:13:30 -0800 (PST) From: Rob Herring To: u-boot@lists.denx.de Date: Wed, 15 Dec 2010 09:13:14 -0600 Message-Id: <1292425994-24331-1-git-send-email-robherring2@gmail.com> X-Mailer: git-send-email 1.7.1 Cc: Rob Herring Subject: [U-Boot] [PATCH] arm: Add armv6 and armv7 optimized swab functions 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 From: Rob Herring swab functions are heavily used by FDT code, so enable optimized assembly code for ARMv6 and later. Signed-off-by: Rob Herring --- arch/arm/include/asm/byteorder.h | 16 ++++++++++++++++ 1 files changed, 16 insertions(+), 0 deletions(-) diff --git a/arch/arm/include/asm/byteorder.h b/arch/arm/include/asm/byteorder.h index c3489f1..9df5844 100644 --- a/arch/arm/include/asm/byteorder.h +++ b/arch/arm/include/asm/byteorder.h @@ -23,6 +23,22 @@ # define __SWAB_64_THRU_32__ #endif +#if defined(__ARM_ARCH_7A__) || defined(__ARM_ARCH_6__) +static inline __u16 __attribute__((const)) ___arch_swab16(__u16 x) +{ + __asm__ ("rev16 %0, %1" : "=r" (x) : "r" (x)); + return x; +} +#define __arch_swab16 ___arch_swab16 + +static inline __u32 __attribute__((const)) ___arch_swab32(__u32 x) +{ + __asm__ ("rev %0, %1" : "=r" (x) : "r" (x)); + return x; +} +#define __arch_swab32 ___arch_swab32 +#endif + #ifdef __ARMEB__ #include #else