Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/arm/broadcom Provide a single generic bcm283x_platf...



details:   https://anonhg.NetBSD.org/src/rev/cc70e54c78ce
branches:  trunk
changeset: 1006092:cc70e54c78ce
user:      skrll <skrll%NetBSD.org@localhost>
date:      Wed Jan 01 13:54:32 2020 +0000

description:
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 |  28 ++++++++++++++++++----------
 1 files changed, 18 insertions(+), 10 deletions(-)

diffs (70 lines):

diff -r 452067fd33de -r cc70e54c78ce sys/arch/arm/broadcom/bcm283x_platform.c
--- a/sys/arch/arm/broadcom/bcm283x_platform.c  Wed Jan 01 13:11:51 2020 +0000
+++ b/sys/arch/arm/broadcom/bcm283x_platform.c  Wed Jan 01 13:54:32 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: bcm283x_platform.c,v 1.33 2020/01/01 09:35:50 skrll Exp $      */
+/*     $NetBSD: bcm283x_platform.c,v 1.34 2020/01/01 13:54:32 skrll 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.33 2020/01/01 09:35:50 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bcm283x_platform.c,v 1.34 2020/01/01 13:54:32 skrll Exp $");
 
 #include "opt_arm_debug.h"
 #include "opt_bcm283x.h"
@@ -1499,6 +1499,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;
 }
 
@@ -1517,12 +1531,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,
@@ -1542,7 +1550,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,
 };
 
@@ -1553,7 +1561,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