From patchwork Tue Feb 11 12:24:44 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yoshinori Sato X-Patchwork-Id: 319252 X-Patchwork-Delegate: iwamatsu@nigauri.org 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 DC86A2C00A0 for ; Tue, 11 Feb 2014 23:47:00 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id C93BC4B731; Tue, 11 Feb 2014 13:46:50 +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 1IJgEwydmRly; Tue, 11 Feb 2014 13:46:50 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 254974B7AC; Tue, 11 Feb 2014 13:46:43 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 92C574B736 for ; Tue, 11 Feb 2014 13:46:37 +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 bPucRE+imI06 for ; Tue, 11 Feb 2014 13:46:37 +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 mail1.asahi-net.or.jp (mail1.asahi-net.or.jp [202.224.39.197]) by theia.denx.de (Postfix) with ESMTP id 287164B7A9 for ; Tue, 11 Feb 2014 13:46:30 +0100 (CET) Received: from sa76r4 (y081184.ppp.asahi-net.or.jp [118.243.81.184]) by mail1.asahi-net.or.jp (Postfix) with ESMTP id D95F09401A; Tue, 11 Feb 2014 21:24:49 +0900 (JST) Received: by sa76r4 (Postfix, from userid 1000) id C62E37A1E; Tue, 11 Feb 2014 21:24:49 +0900 (JST) From: Yoshinori Sato To: u-boot@lists.denx.de Date: Tue, 11 Feb 2014 21:24:44 +0900 Message-Id: <1392121486-5165-4-git-send-email-ysato@users.sourceforge.jp> X-Mailer: git-send-email 1.8.5.3 In-Reply-To: <1392121486-5165-1-git-send-email-ysato@users.sourceforge.jp> References: <1392121486-5165-1-git-send-email-ysato@users.sourceforge.jp> Subject: [U-Boot] [PATCH 4/6] module enabler cleanup. 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 Signed-off-by: Yoshinori Sato --- arch/sh/cpu/sh2/cpu.c | 27 ++++++++++++--------------- arch/sh/include/asm/cpu_sh2.h | 4 +++- arch/sh/include/asm/cpu_sh2a.h | 19 +++++++++++++++++++ 3 files changed, 34 insertions(+), 16 deletions(-) create mode 100644 arch/sh/include/asm/cpu_sh2a.h diff --git a/arch/sh/cpu/sh2/cpu.c b/arch/sh/cpu/sh2/cpu.c index b401d08..0a6a58b 100644 --- a/arch/sh/cpu/sh2/cpu.c +++ b/arch/sh/cpu/sh2/cpu.c @@ -10,16 +10,17 @@ #include #include -#define STBCR4 0xFFFE040C -#define cmt_clock_enable() do {\ - writeb(readb(STBCR4) & ~0x04, STBCR4);\ - } while (0) -#define scif0_enable() do {\ - writeb(readb(STBCR4) & ~0x80, STBCR4);\ - } while (0) -#define scif3_enable() do {\ - writeb(readb(STBCR4) & ~0x10, STBCR4);\ - } while (0) +#if defined(CONFIG_CONS_SCIF0) +# define CH 0 +#elif defined(CONFIG_CONS_SCIF1) +# define CH 1 +#elif defined(CONFIG_CONS_SCIF2) +# define CH 2 +#elif defined(CONFIG_CONS_SCIF3) +# define CH 3 +#else +# error "Default SCIF doesn't set....." +#endif int checkcpu(void) { @@ -30,11 +31,7 @@ int checkcpu(void) int cpu_init(void) { /* SCIF enable */ -#if defined(CONFIG_CONS_SCIF3) - scif3_enable(); -#else - scif0_enable(); -#endif + scif_enable(CH); /* CMT clock enable */ cmt_clock_enable() ; return 0; diff --git a/arch/sh/include/asm/cpu_sh2.h b/arch/sh/include/asm/cpu_sh2.h index b67c093..62b5179 100644 --- a/arch/sh/include/asm/cpu_sh2.h +++ b/arch/sh/include/asm/cpu_sh2.h @@ -8,7 +8,9 @@ #ifndef _ASM_CPU_SH2_H_ #define _ASM_CPU_SH2_H_ - +#if defined(CONFIG_SH2A) +# include +#endif #if defined(CONFIG_CPU_SH7203) # include #elif defined(CONFIG_CPU_SH7264) diff --git a/arch/sh/include/asm/cpu_sh2a.h b/arch/sh/include/asm/cpu_sh2a.h new file mode 100644 index 0000000..6de9729 --- /dev/null +++ b/arch/sh/include/asm/cpu_sh2a.h @@ -0,0 +1,19 @@ +#ifndef _ASM_CPU_SH2A_H_ +#define _ASM_CPU_SH2A_H_ + +/* module enable */ +#define STBCR4 0xFFFE040C +#define scif_enable(ch) \ +do { \ + if (ch < 4) { \ + unsigned char mask = 1 << (7 - ch); \ + writeb((readb(STBCR4) & ~mask), STBCR4); \ + } \ +} while (0) + +#define cmt_clock_enable() \ +do { \ + writeb((readb(STBCR4) & ~0x04), STBCR4); \ +} while (0) + +#endif