Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/arm/rockchip Use bus_space_{peek, poke}_4 for pci co...



details:   https://anonhg.NetBSD.org/src/rev/e1ab9a2e56bf
branches:  trunk
changeset: 847025:e1ab9a2e56bf
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Sat Dec 07 16:00:36 2019 +0000

description:
Use bus_space_{peek,poke}_4 for pci conf reg access.

diffstat:

 sys/arch/arm/rockchip/rk3399_pcie.c |  22 +++++++++++++---------
 1 files changed, 13 insertions(+), 9 deletions(-)

diffs (57 lines):

diff -r e6934f69fec3 -r e1ab9a2e56bf sys/arch/arm/rockchip/rk3399_pcie.c
--- a/sys/arch/arm/rockchip/rk3399_pcie.c       Sat Dec 07 16:00:09 2019 +0000
+++ b/sys/arch/arm/rockchip/rk3399_pcie.c       Sat Dec 07 16:00:36 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: rk3399_pcie.c,v 1.7 2019/11/29 00:36:22 jmcneill Exp $ */
+/* $NetBSD: rk3399_pcie.c,v 1.8 2019/12/07 16:00:36 jmcneill Exp $ */
 /*
  * Copyright (c) 2018 Mark Kettenis <kettenis%openbsd.org@localhost>
  *
@@ -17,7 +17,7 @@
 
 #include <sys/cdefs.h>
 
-__KERNEL_RCSID(1, "$NetBSD: rk3399_pcie.c,v 1.7 2019/11/29 00:36:22 jmcneill Exp $");
+__KERNEL_RCSID(1, "$NetBSD: rk3399_pcie.c,v 1.8 2019/12/07 16:00:36 jmcneill Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -121,10 +121,10 @@
        bus_space_read_4((sc)->sc_iot, (sc)->sc_ioh, (reg))
 #define HWRITE4(sc, reg, val)                                          \
        bus_space_write_4((sc)->sc_iot, (sc)->sc_ioh, (reg), (val))
-#define AXIREAD4(sc, reg)                                              \
-       bus_space_read_4((sc)->sc_iot, (sc)->sc_axi_ioh, (reg))
-#define AXIWRITE4(sc, reg, val)                                                \
-       bus_space_write_4((sc)->sc_iot, (sc)->sc_axi_ioh, (reg), (val))
+#define AXIPEEK4(sc, reg, valp)                                                \
+       bus_space_peek_4((sc)->sc_iot, (sc)->sc_axi_ioh, (reg), (valp))
+#define AXIPOKE4(sc, reg, val)                                         \
+       bus_space_poke_4((sc)->sc_iot, (sc)->sc_axi_ioh, (reg), (val))
 
 struct rkpcie_softc {
        struct pcihost_softc    sc_phsc;
@@ -540,8 +540,12 @@
 
        if (bus == phsc->sc_bus_min)
                return HREAD4(sc, PCIE_RC_NORMAL_BASE + reg);
-       else
-               return AXIREAD4(sc, reg);
+       else {
+               uint32_t val;
+               if (AXIPEEK4(sc, reg, &val) != 0)
+                       return 0xffffffff;
+               return val;
+       }
 }
 
 void
@@ -563,7 +567,7 @@
        if (bus == phsc->sc_bus_min)
                HWRITE4(sc, PCIE_RC_NORMAL_BASE + reg, data);
        else
-               AXIWRITE4(sc, reg, data);
+               AXIPOKE4(sc, reg, data);
 }
 
 static int



Home | Main Index | Thread Index | Old Index