public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Yoshihiro Shimoda <shimoda.yoshihiro@renesas.com>
To: u-boot@lists.denx.de
Subject: [U-Boot-Users] [PATCH] serial_sh: Add support for SH7720
Date: Mon, 03 Dec 2007 22:58:47 +0900	[thread overview]
Message-ID: <47540B97.30609@renesas.com> (raw)

Add support for SH7720 in serial_sh driver.

Signed-off-by: Yoshihiro Shimoda <shimoda.yoshihiro@renesas.com>
CC: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
---
 drivers/serial_sh.c |   26 ++++++++++++++++++++++++--
 1 file changed, 24 insertions(+), 2 deletions(-)

--- a/drivers/serial_sh.c	2007-11-14 21:06:34.000000000 +0900
+++ b/drivers/serial_sh.c	2007-12-03 22:27:15.000000000 +0900
@@ -30,6 +30,17 @@
 #error "Default SCIF doesn't set....."
 #endif

+#if defined(CONFIG_SH3)
+/* There are SH7720's register */
+#define SCSMR 	(volatile unsigned short *)(SCIF_BASE + 0x0)
+#define SCBRR 	(volatile unsigned char  *)(SCIF_BASE + 0x4)
+#define SCSCR 	(volatile unsigned short *)(SCIF_BASE + 0x8)
+#define SCFSR 	(volatile unsigned short *)(SCIF_BASE + 0x14)	/* SCSSR */
+#define SCFCR 	(volatile unsigned short *)(SCIF_BASE + 0x18)
+#define SCFDR 	(volatile unsigned short *)(SCIF_BASE + 0x1C)
+#define SCFTDR 	(volatile unsigned char  *)(SCIF_BASE + 0x20)
+#define SCFRDR 	(volatile unsigned char  *)(SCIF_BASE + 0x24)
+#else
 #define SCSMR 	(volatile unsigned short *)(SCIF_BASE + 0x0)
 #define SCBRR 	(volatile unsigned char  *)(SCIF_BASE + 0x4)
 #define SCSCR 	(volatile unsigned short *)(SCIF_BASE + 0x8)
@@ -38,16 +49,21 @@
 #define SCFRDR 	(volatile unsigned char  *)(SCIF_BASE + 0x14)
 #define SCFCR 	(volatile unsigned short *)(SCIF_BASE + 0x18)
 #define SCFDR 	(volatile unsigned short *)(SCIF_BASE + 0x1C)
+#endif
+
 #if defined(CONFIG_SH4A)
 #define SCRFDR	(volatile unsigned short *)(SCIF_BASE + 0x20)
 #define SCSPTR	(volatile unsigned short *)(SCIF_BASE + 0x24)
 #define SCLSR   (volatile unsigned short *)(SCIF_BASE + 0x28)
 #define SCRER	(volatile unsigned short *)(SCIF_BASE + 0x2C)
+#define LSR_ORER        1
 #elif defined (CONFIG_SH4)
 #define SCSPTR 	(volatile unsigned short *)(SCIF_BASE + 0x20)
 #define SCLSR 	(volatile unsigned short *)(SCIF_BASE + 0x24)
+#define LSR_ORER        1
 #elif defined (CONFIG_SH3)
-#define SCLSR 	(volatile unsigned short *)(SCIF_BASE + 0x24)
+#define SCLSR 	SCFSR	/* SCSSR */
+#define LSR_ORER	0x0200
 #endif

 #define SCR_RE 		(1 << 4)
@@ -67,10 +83,17 @@
 void serial_setbrg (void)
 {
 	DECLARE_GLOBAL_DATA_PTR;
+#if defined(CONFIG_CPU_SH7720)
+	int divisor = gd->baudrate * 16;
+
+	*SCBRR = (CONFIG_SYS_CLK_FREQ * 2 + (divisor / 2)) /
+						(gd->baudrate * 32) - 1;
+#else
 	int divisor = gd->baudrate * 32;

 	*SCBRR = (CONFIG_SYS_CLK_FREQ + (divisor / 2)) /
 						(gd->baudrate * 32) - 1;
+#endif
 }

 int serial_init (void)
@@ -133,7 +156,6 @@ int serial_tstc (void)

 #define FSR_ERR_CLEAR   0x0063
 #define RDRF_CLEAR      0x00fc
-#define LSR_ORER        1
 void handle_error( void ){

 	(void)*SCFSR ;

             reply	other threads:[~2007-12-03 13:58 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-12-03 13:58 Yoshihiro Shimoda [this message]
2008-01-14  9:24 ` [U-Boot-Users] [PATCH] serial_sh: Add support for SH7720 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=47540B97.30609@renesas.com \
    --to=shimoda.yoshihiro@renesas.com \
    --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