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 Data written to and read from bcm283x ...



details:   https://anonhg.NetBSD.org/src/rev/fafb58aab22d
branches:  trunk
changeset: 957519:fafb58aab22d
user:      rin <rin%NetBSD.org@localhost>
date:      Tue Dec 01 04:16:18 2020 +0000

description:
Data written to and read from bcm283x UART registers should be in little-endian.

diffstat:

 sys/arch/arm/broadcom/bcm283x_platform.c |  14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)

diffs (47 lines):

diff -r 12dc6b33ec73 -r fafb58aab22d sys/arch/arm/broadcom/bcm283x_platform.c
--- a/sys/arch/arm/broadcom/bcm283x_platform.c  Tue Dec 01 04:15:04 2020 +0000
+++ b/sys/arch/arm/broadcom/bcm283x_platform.c  Tue Dec 01 04:16:18 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: bcm283x_platform.c,v 1.44 2020/12/01 04:14:31 rin Exp $        */
+/*     $NetBSD: bcm283x_platform.c,v 1.45 2020/12/01 04:16:18 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.44 2020/12/01 04:14:31 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bcm283x_platform.c,v 1.45 2020/12/01 04:16:18 rin Exp $");
 
 #include "opt_arm_debug.h"
 #include "opt_bcm283x.h"
@@ -1347,12 +1347,12 @@
                (volatile uint32_t *)va :
                (volatile uint32_t *)pa;
 
-       while ((uartaddr[PL01XCOM_FR / 4] & PL01X_FR_TXFF) != 0)
+       while ((le32toh(uartaddr[PL01XCOM_FR / 4]) & PL01X_FR_TXFF) != 0)
                continue;
 
-       uartaddr[PL01XCOM_DR / 4] = c;
+       uartaddr[PL01XCOM_DR / 4] = htole32(c);
 
-       while ((uartaddr[PL01XCOM_FR / 4] & PL01X_FR_TXFE) == 0)
+       while ((le32toh(uartaddr[PL01XCOM_FR / 4]) & PL01X_FR_TXFE) == 0)
                continue;
 }
 
@@ -1364,10 +1364,10 @@
                (volatile uint32_t *)va :
                (volatile uint32_t *)pa;
 
-       while ((uartaddr[com_lsr] & LSR_TXRDY) == 0)
+       while ((le32toh(uartaddr[com_lsr]) & LSR_TXRDY) == 0)
                continue;
 
-       uartaddr[com_data] = c;
+       uartaddr[com_data] = htole32(c);
 }
 
 void __noasan



Home | Main Index | Thread Index | Old Index