From patchwork Sun Oct 25 17:16:59 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fabio Estevam X-Patchwork-Id: 535606 X-Patchwork-Delegate: trini@ti.com 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 0150E140E4A for ; Mon, 26 Oct 2015 04:17:53 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=r8v+eEFX; dkim-atps=neutral Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 27C9A4B67C; Sun, 25 Oct 2015 18:17:47 +0100 (CET) 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 MFM0m74RQlv6; Sun, 25 Oct 2015 18:17:47 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 587294B61D; Sun, 25 Oct 2015 18:17:37 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id B15474B635 for ; Sun, 25 Oct 2015 18:17:31 +0100 (CET) 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 XvDAIEw2eU3R for ; Sun, 25 Oct 2015 18:17:31 +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-qg0-f51.google.com (mail-qg0-f51.google.com [209.85.192.51]) by theia.denx.de (Postfix) with ESMTPS id 160E74B65F for ; Sun, 25 Oct 2015 18:17:26 +0100 (CET) Received: by qgem9 with SMTP id m9so103256574qge.1 for ; Sun, 25 Oct 2015 10:17:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=2d7mSsMhMaD4IXtyscy9np59s5hZgkLQIQFA+vcZMDE=; b=r8v+eEFXwcAo4GmCzjWB2SmLYznuTk0FWeH1VL75C1smXStcXphi6UScrctzqGfblM Y30kI6RCSqPhFwbc7Zwe4GTLTP7cHCTXTYnKfzITCRDKCvh2RPhSs7C1JnCyoSx08xRs itbB6yKAt5Ej6Y09PwllbMkly0frGWzO3Xx5gzATG4GQUhRfenz+FEtuBahkCEJQ80yi LCPFcJXSK1mfCN07VuxouVdME3F7oyv+Dwo1/ge7M8UEwSA+fohSECtaJm8Dikfs3d/L HOMiA46pqFWxQHJOM5+QDVOW1oRP07wlnrerodrQgXT5Ozt9rQRBkSEKk54MU9uXc1kG CMKg== X-Received: by 10.140.133.198 with SMTP id 189mr37603991qhf.99.1445793445110; Sun, 25 Oct 2015 10:17:25 -0700 (PDT) Received: from localhost.localdomain ([189.5.18.213]) by smtp.gmail.com with ESMTPSA id 83sm5429935qhw.27.2015.10.25.10.17.22 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 25 Oct 2015 10:17:24 -0700 (PDT) From: Fabio Estevam To: trini@konsulko.com Date: Sun, 25 Oct 2015 15:16:59 -0200 Message-Id: <1445793427-1446-4-git-send-email-festevam@gmail.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1445793427-1446-1-git-send-email-festevam@gmail.com> References: <1445793427-1446-1-git-send-email-festevam@gmail.com> Cc: jteki@openedev.com, u-boot@lists.denx.de, Fabio Estevam , otavio@ossystems.com.br, York Sun Subject: [U-Boot] [PATCH v3 04/12] powerpc: Remove __ilog2_u64 and ffs4 from bitops X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.15 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" From: Fabio Estevam Remove __ilog2_u64 and ffs4 from powerpc bitops to align with the kernel implementation. Use the generic __ffs64 instead of a custom powerpc implementation. Cc: York Sun Signed-off-by: Fabio Estevam Reviewed-by: Tom Rini --- Changes since v2: - None arch/powerpc/cpu/mpc83xx/law.c | 5 +++-- arch/powerpc/cpu/mpc85xx/tlb.c | 2 ++ arch/powerpc/cpu/mpc8xxx/law.c | 5 +++-- arch/powerpc/include/asm/bitops.h | 11 +---------- arch/powerpc/include/asm/fsl_law.h | 1 + arch/powerpc/include/asm/fsl_srio.h | 2 ++ 6 files changed, 12 insertions(+), 14 deletions(-) diff --git a/arch/powerpc/cpu/mpc83xx/law.c b/arch/powerpc/cpu/mpc83xx/law.c index 66c88b6..262ae7f 100644 --- a/arch/powerpc/cpu/mpc83xx/law.c +++ b/arch/powerpc/cpu/mpc83xx/law.c @@ -9,6 +9,7 @@ #include #include #include +#include int set_ddr_laws(u64 start, u64 sz, enum law_trgt_if id) { @@ -20,7 +21,7 @@ int set_ddr_laws(u64 start, u64 sz, enum law_trgt_if id) if (start == 0) start_align = 1ull << (LAW_SIZE_2G + 1); else - start_align = 1ull << (ffs64(start) - 1); + start_align = 1ull << (__ffs64(start) - 1); law_sz = min(start_align, sz); law_sz_enc = __ilog2_u64(law_sz) - 1; @@ -40,7 +41,7 @@ int set_ddr_laws(u64 start, u64 sz, enum law_trgt_if id) if (sz) { start += law_sz; - start_align = 1ull << (ffs64(start) - 1); + start_align = 1ull << (__ffs64(start) - 1); law_sz = min(start_align, sz); law_sz_enc = __ilog2_u64(law_sz) - 1; ecm = &immap->sysconf.ddrlaw[1]; diff --git a/arch/powerpc/cpu/mpc85xx/tlb.c b/arch/powerpc/cpu/mpc85xx/tlb.c index 8e0508f..cf31eb2 100644 --- a/arch/powerpc/cpu/mpc85xx/tlb.c +++ b/arch/powerpc/cpu/mpc85xx/tlb.c @@ -14,6 +14,8 @@ #include #endif +#include + DECLARE_GLOBAL_DATA_PTR; void invalidate_tlb(u8 tlb) diff --git a/arch/powerpc/cpu/mpc8xxx/law.c b/arch/powerpc/cpu/mpc8xxx/law.c index 33d53a8..24baad4 100644 --- a/arch/powerpc/cpu/mpc8xxx/law.c +++ b/arch/powerpc/cpu/mpc8xxx/law.c @@ -11,6 +11,7 @@ #include #include #include +#include DECLARE_GLOBAL_DATA_PTR; @@ -187,7 +188,7 @@ int set_ddr_laws(u64 start, u64 sz, enum law_trgt_if id) if (start == 0) start_align = 1ull << (LAW_SIZE_32G + 1); else - start_align = 1ull << (ffs64(start) - 1); + start_align = 1ull << (__ffs64(start) - 1); law_sz = min(start_align, sz); law_sz_enc = __ilog2_u64(law_sz) - 1; @@ -202,7 +203,7 @@ int set_ddr_laws(u64 start, u64 sz, enum law_trgt_if id) if (sz) { start += law_sz; - start_align = 1ull << (ffs64(start) - 1); + start_align = 1ull << (__ffs64(start) - 1); law_sz = min(start_align, sz); law_sz_enc = __ilog2_u64(law_sz) - 1; diff --git a/arch/powerpc/include/asm/bitops.h b/arch/powerpc/include/asm/bitops.h index a6bcf3c..14217ef 100644 --- a/arch/powerpc/include/asm/bitops.h +++ b/arch/powerpc/include/asm/bitops.h @@ -6,6 +6,7 @@ #define _PPC_BITOPS_H #include +#include extern void set_bit(int nr, volatile void *addr); extern void clear_bit(int nr, volatile void *addr); @@ -209,16 +210,6 @@ static inline int fls64(__u64 x) #error BITS_PER_LONG not 32 or 64 #endif -static inline int __ilog2_u64(u64 n) -{ - return fls64(n) - 1; -} - -static inline int ffs64(u64 x) -{ - return __ilog2_u64(x & -x) + 1ull; -} - #ifdef __KERNEL__ /* diff --git a/arch/powerpc/include/asm/fsl_law.h b/arch/powerpc/include/asm/fsl_law.h index 3b50487..8e1d22a 100644 --- a/arch/powerpc/include/asm/fsl_law.h +++ b/arch/powerpc/include/asm/fsl_law.h @@ -10,6 +10,7 @@ #define _FSL_LAW_H_ #include +#include #define LAW_EN 0x80000000 diff --git a/arch/powerpc/include/asm/fsl_srio.h b/arch/powerpc/include/asm/fsl_srio.h index e5aab2a..ec25e16 100644 --- a/arch/powerpc/include/asm/fsl_srio.h +++ b/arch/powerpc/include/asm/fsl_srio.h @@ -7,6 +7,8 @@ #ifndef _FSL_SRIO_H_ #define _FSL_SRIO_H_ +#include + enum atmu_size { ATMU_SIZE_4K = 0xb, ATMU_SIZE_8K,