From: Yoshinori Sato <ysato@users.sourceforge.jp>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 4/6] module enabler cleanup.
Date: Tue, 11 Feb 2014 21:20:35 +0900 [thread overview]
Message-ID: <1392121237-4790-4-git-send-email-ysato@users.sourceforge.jp> (raw)
In-Reply-To: <1392121237-4790-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 | 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 <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 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 <asm/cpu_sh2a.h>
+#endif
#if defined(CONFIG_CPU_SH7203)
# include <asm/cpu_sh7203.h>
#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
next prev parent reply other threads:[~2014-02-11 12:20 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-11 12:20 [U-Boot] [PATCH 1/6] Add MS7206SE support Yoshinori Sato
2014-02-11 12:20 ` [U-Boot] [PATCH 2/6] SH2A cache support Yoshinori Sato
2014-02-11 12:20 ` [U-Boot] [PATCH 3/6] fix typo Yoshinori Sato
2014-02-11 12:20 ` Yoshinori Sato [this message]
2014-02-11 12:20 ` [U-Boot] [PATCH 5/6] Add SH7206 support Yoshinori Sato
2014-02-11 12:20 ` [U-Boot] [PATCH 6/6] Update build options Yoshinori Sato
-- strict thread matches above, loose matches on Subject: below --
2014-02-11 12:24 [U-Boot] [PATCH 1/6] Add MS7206SE support Yoshinori Sato
2014-02-11 12:24 ` [U-Boot] [PATCH 4/6] module enabler cleanup Yoshinori Sato
2014-02-12 7:02 ` Nobuhiro Iwamatsu
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=1392121237-4790-4-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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.