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 Factor out bcm283x_aux_platform_early_...
details: https://anonhg.NetBSD.org/src/rev/dc9deb407dcd
branches: trunk
changeset: 978501:dc9deb407dcd
user: rin <rin%NetBSD.org@localhost>
date: Mon Nov 23 06:21:07 2020 +0000
description:
Factor out bcm283x_aux_platform_early_putchar() from
bcm{2837,2711}_platform_early_putchar(), for which output goes to
AUX UART (aka mini UART).
No functional changes.
diffstat:
sys/arch/arm/broadcom/bcm283x_platform.c | 48 ++++++++++++++-----------------
1 files changed, 22 insertions(+), 26 deletions(-)
diffs (83 lines):
diff -r 8d3516f02ce5 -r dc9deb407dcd sys/arch/arm/broadcom/bcm283x_platform.c
--- a/sys/arch/arm/broadcom/bcm283x_platform.c Mon Nov 23 00:52:53 2020 +0000
+++ b/sys/arch/arm/broadcom/bcm283x_platform.c Mon Nov 23 06:21:07 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: bcm283x_platform.c,v 1.41 2020/09/28 11:54:23 jmcneill Exp $ */
+/* $NetBSD: bcm283x_platform.c,v 1.42 2020/11/23 06:21:07 rin 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.41 2020/09/28 11:54:23 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bcm283x_platform.c,v 1.42 2020/11/23 06:21:07 rin Exp $");
#include "opt_arm_debug.h"
#include "opt_bcm283x.h"
@@ -1344,6 +1344,20 @@
continue;
}
+static void __noasan
+bcm283x_aux_platform_early_putchar(vaddr_t va, paddr_t pa, char c)
+{
+ volatile uint32_t *uartaddr =
+ cpu_earlydevice_va_p() ?
+ (volatile uint32_t *)va :
+ (volatile uint32_t *)pa;
+
+ while ((uartaddr[com_lsr] & LSR_TXRDY) == 0)
+ continue;
+
+ uartaddr[com_data] = c;
+}
+
void __noasan
bcm2835_platform_early_putchar(char c)
{
@@ -1365,37 +1379,19 @@
void __noasan
bcm2837_platform_early_putchar(char c)
{
-#define AUCONSADDR_PA BCM2836_PERIPHERALS_BUS_TO_PHYS(BCM2835_AUX_UART_BASE)
-#define AUCONSADDR_VA BCM2835_IOPHYSTOVIRT(AUCONSADDR_PA)
- volatile uint32_t *uartaddr =
- cpu_earlydevice_va_p() ?
- (volatile uint32_t *)AUCONSADDR_VA :
- (volatile uint32_t *)AUCONSADDR_PA;
+ paddr_t pa = BCM2836_PERIPHERALS_BUS_TO_PHYS(BCM2835_AUX_UART_BASE);
+ vaddr_t va = BCM2835_IOPHYSTOVIRT(pa);
- while ((uartaddr[com_lsr] & LSR_TXRDY) == 0)
- ;
-
- uartaddr[com_data] = c;
-#undef AUCONSADDR_VA
-#undef AUCONSADDR_PA
+ bcm283x_aux_platform_early_putchar(va, pa, c);
}
void __noasan
bcm2711_platform_early_putchar(char c)
{
-#define AUCONSADDR_PA BCM2711_PERIPHERALS_BUS_TO_PHYS(BCM2835_AUX_UART_BASE)
-#define AUCONSADDR_VA BCM2711_IOPHYSTOVIRT(AUCONSADDR_PA)
- volatile uint32_t *uartaddr =
- cpu_earlydevice_va_p() ?
- (volatile uint32_t *)AUCONSADDR_VA :
- (volatile uint32_t *)AUCONSADDR_PA;
+ paddr_t pa = BCM2711_PERIPHERALS_BUS_TO_PHYS(BCM2835_AUX_UART_BASE);
+ vaddr_t va = BCM2711_IOPHYSTOVIRT(pa);
- while ((uartaddr[com_lsr] & LSR_TXRDY) == 0)
- ;
-
- uartaddr[com_data] = c;
-#undef AUCONSADDR_VA
-#undef AUCONSADDR_PA
+ bcm283x_aux_platform_early_putchar(va, pa, c);
}
#define BCM283x_REF_FREQ 19200000
Home |
Main Index |
Thread Index |
Old Index