Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/ic only read cpr register if we're going to use the ...



details:   https://anonhg.NetBSD.org/src/rev/ff814b2e1d72
branches:  trunk
changeset: 1022640:ff814b2e1d72
user:      tnn <tnn%NetBSD.org@localhost>
date:      Sat Jul 31 10:04:12 2021 +0000

description:
only read cpr register if we're going to use the value

diffstat:

 sys/dev/ic/com.c |  11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)

diffs (33 lines):

diff -r b6de622cbfc3 -r ff814b2e1d72 sys/dev/ic/com.c
--- a/sys/dev/ic/com.c  Sat Jul 31 09:30:17 2021 +0000
+++ b/sys/dev/ic/com.c  Sat Jul 31 10:04:12 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: com.c,v 1.364 2021/07/30 12:46:46 tnn Exp $ */
+/* $NetBSD: com.c,v 1.365 2021/07/31 10:04:12 tnn Exp $ */
 
 /*-
  * Copyright (c) 1998, 1999, 2004, 2008 The NetBSD Foundation, Inc.
@@ -66,7 +66,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: com.c,v 1.364 2021/07/30 12:46:46 tnn Exp $");
+__KERNEL_RCSID(0, "$NetBSD: com.c,v 1.365 2021/07/31 10:04:12 tnn Exp $");
 
 #include "opt_com.h"
 #include "opt_ddb.h"
@@ -539,10 +539,11 @@
                goto fifodelay;
 
        case COM_TYPE_DW_APB:
-               cpr = bus_space_read_4(sc->sc_regs.cr_iot, sc->sc_regs.cr_ioh,
-                   DW_APB_UART_CPR);
-               if (!prop_dictionary_get_uint(dict, "fifolen", &sc->sc_fifolen))
+               if (!prop_dictionary_get_uint(dict, "fifolen", &sc->sc_fifolen)) {
+                       cpr = bus_space_read_4(sc->sc_regs.cr_iot,
+                           sc->sc_regs.cr_ioh, DW_APB_UART_CPR);
                        sc->sc_fifolen = __SHIFTOUT(cpr, UART_CPR_FIFO_MODE) * 16;
+               }
                if (sc->sc_fifolen == 0) {
                        sc->sc_fifolen = 1;
                        fifo_msg = "DesignWare APB UART, no fifo";



Home | Main Index | Thread Index | Old Index