From: Rob Herring <robherring2@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 4/8] arm: add __ilog2 function
Date: Sat, 11 Jun 2011 16:46:48 -0500 [thread overview]
Message-ID: <1307828812-14825-5-git-send-email-robherring2@gmail.com> (raw)
In-Reply-To: <1307828812-14825-1-git-send-email-robherring2@gmail.com>
From: Rob Herring <rob.herring@calxeda.com>
Add __ilog2 function for ARM. Needed for ahci.c
Signed-off-by: Rob Herring <rob.herring@calxeda.com>
---
arch/arm/include/asm/bitops.h | 9 +++++++++
1 files changed, 9 insertions(+), 0 deletions(-)
diff --git a/arch/arm/include/asm/bitops.h b/arch/arm/include/asm/bitops.h
index 270f163..0420182 100644
--- a/arch/arm/include/asm/bitops.h
+++ b/arch/arm/include/asm/bitops.h
@@ -106,6 +106,15 @@ static inline int test_bit(int nr, const void * addr)
return ((unsigned char *) addr)[nr >> 3] & (1U << (nr & 7));
}
+extern __inline__ int __ilog2(unsigned int x)
+{
+ int ret;
+
+ asm("clz\t%0, %1" : "=r" (ret) : "r" (x));
+ ret = 31 - ret;
+ return ret;
+}
+
/*
* ffz = Find First Zero in word. Undefined if no zero exists,
* so code should check against ~0UL first..
--
1.7.4.1
next prev parent reply other threads:[~2011-06-11 21:46 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-06-11 21:46 [U-Boot] [PATCH 0/8] Add Highbank platform Rob Herring
2011-06-11 21:46 ` [U-Boot] [PATCH 1/8] mmc: copy s5p to sdhci Rob Herring
2011-06-11 21:46 ` [U-Boot] [PATCH 2/8] mmc: sdhci: rework Samsung specfic code Rob Herring
2011-06-13 6:59 ` Minkyu Kang
2011-06-13 12:45 ` Rob Herring
2011-06-14 8:14 ` Minkyu Kang
2011-06-14 14:48 ` [U-Boot] [PATCH] " Rob Herring
2011-06-15 4:28 ` Minkyu Kang
2011-06-15 8:12 ` Jaehoon Chung
2011-06-15 8:29 ` Minkyu Kang
2011-06-15 8:40 ` Jaehoon Chung
2011-06-13 21:01 ` [U-Boot] [PATCH 2/8] " Mike Frysinger
2011-06-11 21:46 ` [U-Boot] [PATCH 3/8] mmc: sdhci: exit cmd on error status Rob Herring
2011-06-11 21:46 ` Rob Herring [this message]
2011-06-11 21:46 ` [U-Boot] [PATCH 5/8] scsi/ahci: ata id little endian fix Rob Herring
2011-06-11 21:46 ` [U-Boot] [PATCH 6/8] scsi/ahci: add support for non-PCI controllers Rob Herring
2011-06-11 21:46 ` [U-Boot] [PATCH 7/8] ARM: add missing CONFIG_SKIP_LOWLEVEL_INIT for armv7 Rob Herring
2011-07-17 9:26 ` Albert ARIBAUD
2011-06-11 21:46 ` [U-Boot] [PATCH 8/8] ARM: Add Calxeda Highbank platform Rob Herring
2011-07-17 9:29 ` Albert ARIBAUD
2011-07-17 9:42 ` Albert ARIBAUD
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1307828812-14825-5-git-send-email-robherring2@gmail.com \
--to=robherring2@gmail.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox