Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/arm/samsung Calculate UART frequency based on bootl...
details: https://anonhg.NetBSD.org/src/rev/c32a2fd58ac9
branches: trunk
changeset: 354294:c32a2fd58ac9
user: jmcneill <jmcneill%NetBSD.org@localhost>
date: Sat Jun 10 23:23:05 2017 +0000
description:
Calculate UART frequency based on bootloader config.
diffstat:
sys/arch/arm/samsung/exynos_sscom.c | 13 ++++++++++---
1 files changed, 10 insertions(+), 3 deletions(-)
diffs (34 lines):
diff -r cb7453d38dad -r c32a2fd58ac9 sys/arch/arm/samsung/exynos_sscom.c
--- a/sys/arch/arm/samsung/exynos_sscom.c Sat Jun 10 23:22:36 2017 +0000
+++ b/sys/arch/arm/samsung/exynos_sscom.c Sat Jun 10 23:23:05 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: exynos_sscom.c,v 1.8 2017/06/10 15:13:18 jmcneill Exp $ */
+/* $NetBSD: exynos_sscom.c,v 1.9 2017/06/10 23:23:05 jmcneill Exp $ */
/*
* Copyright (c) 2014 Reinoud Zandijk
@@ -34,7 +34,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: exynos_sscom.c,v 1.8 2017/06/10 15:13:18 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: exynos_sscom.c,v 1.9 2017/06/10 23:23:05 jmcneill Exp $");
#include "opt_sscom.h"
#include "opt_ddb.h"
@@ -262,7 +262,14 @@
if (bus_space_map(bst, addr, size, 0, &bsh) != 0)
panic("cannot map console UART");
- if (sscom_cnattach(bst, bsh, &info, speed, uart_freq, flags) != 0)
+ /* Calculate UART frequency from bootloader (XXX) */
+ uint32_t freq = speed
+ * (16 * (bus_space_read_4(bst, bsh, SSCOM_UBRDIV) + 1)
+ + bus_space_read_4(bst, bsh, SSCOM_UFRACVAL));
+ freq = (freq + speed / 2) / 1000;
+ freq *= 1000;
+
+ if (sscom_cnattach(bst, bsh, &info, speed, freq, flags) != 0)
panic("cannot attach console UART");
}
Home |
Main Index |
Thread Index |
Old Index