Module Name: src
Committed By: matt
Date: Sat Apr 19 19:47:55 UTC 2014
Modified Files:
src/sys/arch/evbarm/odroid: odroid_machdep.c
Log Message:
Use the conspeed and div/frac from the uart to figure out the frequency
for the console. XXX until we actually compute from the chip clocks.
To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/evbarm/odroid/odroid_machdep.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/arch/evbarm/odroid/odroid_machdep.c
diff -u src/sys/arch/evbarm/odroid/odroid_machdep.c:1.7 src/sys/arch/evbarm/odroid/odroid_machdep.c:1.8
--- src/sys/arch/evbarm/odroid/odroid_machdep.c:1.7 Fri Apr 18 14:17:11 2014
+++ src/sys/arch/evbarm/odroid/odroid_machdep.c Sat Apr 19 19:47:55 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: odroid_machdep.c,v 1.7 2014/04/18 14:17:11 reinoud Exp $ */
+/* $NetBSD: odroid_machdep.c,v 1.8 2014/04/19 19:47:55 matt Exp $ */
/*
* Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: odroid_machdep.c,v 1.7 2014/04/18 14:17:11 reinoud Exp $");
+__KERNEL_RCSID(0, "$NetBSD: odroid_machdep.c,v 1.8 2014/04/19 19:47:55 matt Exp $");
#include "opt_evbarm_boardtype.h"
#include "opt_exynos.h"
@@ -433,8 +433,18 @@ consinit(void)
consinit_called = true;
#if NSSCOM > 0
+ bus_space_tag_t bst = &exynos_bs_tag;
bus_addr_t iobase = armreg_tpidruro_read();
- size_t i;
+ bus_space_handle_t bsh = EXYNOS_IOPHYSTOVIRT(iobase);
+ u_int i;
+ /*
+ * No need to guess at the UART frequency since we can caclulate it.
+ */
+ uint32_t freq = conspeed
+ * (16 * (bus_space_read_4(bst, bsh, SSCOM_UBRDIV) + 1)
+ + bus_space_read_4(bst, bsh, SSCOM_UFRACVAL));
+ freq = (freq + conspeed / 2) / 1000;
+ freq *= 1000;
for (i = 0; i < __arraycount(exynos_uarts); i++) {
/* attach console */
@@ -442,11 +452,14 @@ consinit(void)
break;
}
KASSERT(i < __arraycount(exynos_uarts));
-
- if (sscom_cnattach(&exynos_bs_tag, exynos_core_bsh,
- &exynos_uarts[i], conspeed, EXYNOS_UART_FREQ,
- conmode))
+ printf("%s: attaching console @ %#"PRIxPTR" (%u HZ, %u bps)\n",
+ __func__, iobase, freq, conspeed);
+ if (sscom_cnattach(bst, exynos_core_bsh, &exynos_uarts[i],
+ conspeed, freq, conmode))
panic("Serial console can not be initialized");
+#ifdef VERBOSE_INIT_ARM
+ printf("Console initialized\n");
+#endif
#else
#error only serial console is supported
#if NUKBD > 0