From mboxrd@z Thu Jan 1 00:00:00 1970 From: Yoshinori Sato Date: Tue, 11 Feb 2014 21:20:35 +0900 Subject: [U-Boot] [PATCH 4/6] module enabler cleanup. In-Reply-To: <1392121237-4790-1-git-send-email-ysato@users.sourceforge.jp> References: <1392121237-4790-1-git-send-email-ysato@users.sourceforge.jp> Message-ID: <1392121237-4790-4-git-send-email-ysato@users.sourceforge.jp> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@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 -- 1.8.5.3