summaryrefslogtreecommitdiff
path: root/drivers/serial/serial_sh.c
diff options
context:
space:
mode:
authorNobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com>2014-07-28 15:07:44 +0900
committerTom Rini <trini@ti.com>2014-08-09 11:17:01 -0400
commit53022c3113a6670d21f55262f511ae6a07bb3dc4 (patch)
tree2a1df6874acffac3d13ef8c2d5064ded1248c501 /drivers/serial/serial_sh.c
parent1a223c93240fd4bfaa05cc998b261d9560ca0f09 (diff)
downloadu-boot-imx-53022c3113a6670d21f55262f511ae6a07bb3dc4.zip
u-boot-imx-53022c3113a6670d21f55262f511ae6a07bb3dc4.tar.gz
u-boot-imx-53022c3113a6670d21f55262f511ae6a07bb3dc4.tar.bz2
serial: sh: Add support External Clock mode
R8A7780 and R7A7791 of rmobile supports External Clock mode, and these uses different from Internal Clock mode registers and calculations to the baud rate setting. This adds function for External Clock mode. Signed-off-by: Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com> Signed-off-by: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
Diffstat (limited to 'drivers/serial/serial_sh.c')
-rw-r--r--drivers/serial/serial_sh.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/drivers/serial/serial_sh.c b/drivers/serial/serial_sh.c
index 0826d59..144a925 100644
--- a/drivers/serial/serial_sh.c
+++ b/drivers/serial/serial_sh.c
@@ -49,9 +49,15 @@ static struct uart_port sh_sci = {
static void sh_serial_setbrg(void)
{
DECLARE_GLOBAL_DATA_PTR;
-
+#ifdef CONFIG_SCIF_USE_EXT_CLK
+ unsigned short dl = DL_VALUE(gd->baudrate, CONFIG_SH_SCIF_CLK_FREQ);
+ sci_out(&sh_sci, DL, dl);
+ /* Need wait: Clock * 1/dl × 1/16 */
+ udelay((1000000 * dl * 16 / CONFIG_SYS_CLK_FREQ) * 1000 + 1);
+#else
sci_out(&sh_sci, SCBRR,
SCBRR_VALUE(gd->baudrate, CONFIG_SH_SCIF_CLK_FREQ));
+#endif
}
static int sh_serial_init(void)