Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/mips/cavium Initialize FDT console device



details:   https://anonhg.NetBSD.org/src/rev/fb2d7a55d31b
branches:  trunk
changeset: 1011932:fb2d7a55d31b
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Thu Jul 16 16:40:28 2020 +0000

description:
Initialize FDT console device

diffstat:

 sys/arch/mips/cavium/mainbus.c |  22 ++++++++++++++++++++--
 1 files changed, 20 insertions(+), 2 deletions(-)

diffs (59 lines):

diff -r d9eb3bf6fc12 -r fb2d7a55d31b sys/arch/mips/cavium/mainbus.c
--- a/sys/arch/mips/cavium/mainbus.c    Thu Jul 16 16:39:54 2020 +0000
+++ b/sys/arch/mips/cavium/mainbus.c    Thu Jul 16 16:40:28 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: mainbus.c,v 1.2 2020/07/16 11:49:37 jmcneill Exp $     */
+/*     $NetBSD: mainbus.c,v 1.3 2020/07/16 16:40:28 jmcneill Exp $     */
 
 /*
  * Copyright (c) 2007
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.2 2020/07/16 11:49:37 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.3 2020/07/16 16:40:28 jmcneill Exp $");
 
 #define        _MIPS_BUS_DMA_PRIVATE
 
@@ -37,6 +37,7 @@
 #include <sys/bus.h>
 
 #include <mips/cavium/include/mainbusvar.h>
+#include <mips/cavium/octeonvar.h>
 
 #include <dev/fdt/fdtvar.h>
 
@@ -108,8 +109,10 @@
 static void
 mainbus_attach_devicetree(device_t self)
 {
+       const struct fdt_console *cons = fdtbus_get_console();
        struct mainbus_attach_args aa;
        struct fdt_attach_args faa;
+       u_int uart_freq;
 
        aa.aa_name = "cpunode";
        config_found_sm_loc(self, "mainbus", NULL, &aa, mainbus_print,
@@ -124,6 +127,21 @@
        faa.faa_a4x_bst = NULL;         /* XXX */
        faa.faa_dmat = &simplebus_dma_tag;
        faa.faa_name = "";
+
+       if (cons != NULL) {
+               faa.faa_phandle = fdtbus_get_stdout_phandle();
+
+               if (of_getprop_uint32(faa.faa_phandle, "clock-frequency",
+                   &uart_freq) != 0) {
+                       uart_freq = octeon_ioclock_speed();
+               }
+
+               if (uart_freq > 0)
+                       delay(640000000 / uart_freq);
+
+               cons->consinit(&faa, uart_freq);
+       }
+
        faa.faa_phandle = OF_peer(0);
        config_found(self, &faa, NULL);
 }



Home | Main Index | Thread Index | Old Index