Source-Changes-HG archive

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

[src/netbsd-9]: src/sys/arch/arm/broadcom Pull up following revision(s) (requ...



details:   https://anonhg.NetBSD.org/src/rev/8bc3e5f8da19
branches:  netbsd-9
changeset: 963482:8bc3e5f8da19
user:      martin <martin%NetBSD.org@localhost>
date:      Thu Jan 02 10:01:04 2020 +0000

description:
Pull up following revision(s) (requested by skrll in ticket #599):

        sys/arch/arm/broadcom/bcm283x_platform.c: revision 1.34 (patch)

Provide a single generic bcm283x_platform_uart_freq which checks for
"brcm,bcm2835-aux-uart" and returns the appropriate core clock based
results; otherwise it returns the uart clock from firmware.

Should fix early console output on the rpi0w.

Based on a diff from mlelstv

diffstat:

 sys/arch/arm/broadcom/bcm283x_platform.c |  26 +++++++++++++++++---------
 1 files changed, 17 insertions(+), 9 deletions(-)

diffs (61 lines):

diff -r 9ad564e2d93b -r 8bc3e5f8da19 sys/arch/arm/broadcom/bcm283x_platform.c
--- a/sys/arch/arm/broadcom/bcm283x_platform.c  Thu Jan 02 09:52:22 2020 +0000
+++ b/sys/arch/arm/broadcom/bcm283x_platform.c  Thu Jan 02 10:01:04 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: bcm283x_platform.c,v 1.23 2019/01/03 12:52:40 jmcneill Exp $   */
+/*     $NetBSD: bcm283x_platform.c,v 1.23.4.1 2020/01/02 10:01:04 martin Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: bcm283x_platform.c,v 1.23 2019/01/03 12:52:40 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bcm283x_platform.c,v 1.23.4.1 2020/01/02 10:01:04 martin Exp $");
 
 #include "opt_arm_debug.h"
 #include "opt_bcm283x.h"
@@ -1306,6 +1306,20 @@
 bcm283x_platform_uart_freq(void)
 {
 
+       /*
+        * We are safe to access stdout phandle - consinit did before
+        * calling ap_uart_freq
+        */
+       const int phandle = fdtbus_get_stdout_phandle();
+
+       static const char * const aux_compatible[] = {
+               "brcm,bcm2835-aux-uart",
+               NULL
+       };
+
+       if (of_match_compatible(phandle, aux_compatible))
+               return core_clk * 2;
+
        return uart_clk;
 }
 
@@ -1324,12 +1338,6 @@
 #endif
 
 #if defined(SOC_BCM2836)
-static u_int
-bcm2837_platform_uart_freq(void)
-{
-
-       return core_clk * 2;
-}
 
 static const struct arm_platform bcm2836_platform = {
        .ap_devmap = bcm2836_platform_devmap,
@@ -1349,7 +1357,7 @@
        .ap_device_register = bcm283x_platform_device_register,
        .ap_reset = bcm2835_system_reset,
        .ap_delay = gtmr_delay,
-       .ap_uart_freq = bcm2837_platform_uart_freq,
+       .ap_uart_freq = bcm283x_platform_uart_freq,
        .ap_mpstart = arm_fdt_cpu_mpstart,
 };
 



Home | Main Index | Thread Index | Old Index