public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Yoshinori Sato <ysato@users.sourceforge.jp>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v2 5/6] Module enabler cleanup
Date: Thu, 13 Feb 2014 23:13:44 +0900	[thread overview]
Message-ID: <1392300825-18782-6-git-send-email-ysato@users.sourceforge.jp> (raw)
In-Reply-To: <1392300825-18782-1-git-send-email-ysato@users.sourceforge.jp>

Signed-off-by: Yoshinori Sato <ysato@users.sourceforge.jp>
---
 arch/sh/cpu/sh2/cpu.c          | 27 ++++++++++++---------------
 arch/sh/include/asm/cpu_sh2.h  |  3 +++
 arch/sh/include/asm/cpu_sh2a.h | 16 ++++++++++++++++
 3 files changed, 31 insertions(+), 15 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 <asm/processor.h>
 #include <asm/io.h>
 
-#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 b84dad4..deadece 100644
--- a/arch/sh/include/asm/cpu_sh2.h
+++ b/arch/sh/include/asm/cpu_sh2.h
@@ -8,6 +8,9 @@
 #ifndef _ASM_CPU_SH2_H_
 #define _ASM_CPU_SH2_H_
 
+#if defined(CONFIG_SH2A)
+#  include <asm/cpu_sh2a.h>
+#endif
 #if defined(CONFIG_CPU_SH7203)
 # include <asm/cpu_sh7203.h>
 #elif defined(CONFIG_CPU_SH7206)
diff --git a/arch/sh/include/asm/cpu_sh2a.h b/arch/sh/include/asm/cpu_sh2a.h
new file mode 100644
index 0000000..7262a2a
--- /dev/null
+++ b/arch/sh/include/asm/cpu_sh2a.h
@@ -0,0 +1,16 @@
+#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() \
+	writeb((readb(STBCR4) & ~0x04), STBCR4)
+#endif
-- 
1.8.5.3

  parent reply	other threads:[~2014-02-13 14:13 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-13 14:13 [U-Boot] [PATCH v2 0/6] Add target board MS7206SE Yoshinori Sato
2014-02-13 14:13 ` [U-Boot] [PATCH v2 1/6] Add MS7206SE support Yoshinori Sato
2014-02-13 14:13 ` [U-Boot] [PATCH v2 2/6] Add MS7206SE ethernet support Yoshinori Sato
2015-01-30 21:29   ` Joe Hershberger
2014-02-13 14:13 ` [U-Boot] [PATCH v2 3/6] Add SH7206 support Yoshinori Sato
2014-02-13 14:13 ` [U-Boot] [PATCH v2 4/6] SH2A cache support Yoshinori Sato
2014-02-13 14:13 ` Yoshinori Sato [this message]
2014-02-13 14:13 ` [U-Boot] [PATCH v2 6/6] Various update Yoshinori Sato

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=1392300825-18782-6-git-send-email-ysato@users.sourceforge.jp \
    --to=ysato@users.sourceforge.jp \
    --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