From ede3fb817a6fa170fb66bd0dceb27210bb6f8b5a Mon Sep 17 00:00:00 2001 From: kettenis Date: Sat, 13 Jan 2018 18:08:20 +0000 Subject: [PATCH] Make things work when using the official device tree bindings used by the Linux kernel. --- sys/dev/fdt/rkpcie.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/sys/dev/fdt/rkpcie.c b/sys/dev/fdt/rkpcie.c index 7d8e7a7070b..c7ff5fcd43c 100644 --- a/sys/dev/fdt/rkpcie.c +++ b/sys/dev/fdt/rkpcie.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rkpcie.c,v 1.2 2018/01/06 20:31:03 kettenis Exp $ */ +/* $OpenBSD: rkpcie.c,v 1.3 2018/01/13 18:08:20 kettenis Exp $ */ /* * Copyright (c) 2018 Mark Kettenis * @@ -238,8 +238,10 @@ rkpcie_attach(struct device *parent, struct device *self, void *aux) break; delay(1000); } - if (timo == 0) - printf("timeout\n"); + if (timo == 0) { + printf("%s: link training timeout\n", sc->sc_dev.dv_xname); + return; + } /* Initialize Root Complex registers. */ HWRITE4(sc, PCIE_LM_VENDOR_ID, PCI_VENDOR_ROCKCHIP); @@ -571,13 +573,14 @@ rkpcie_intr_disestablish(void *v, void *cookie) void rkpcie_phy_init(struct rkpcie_softc *sc) { - uint32_t phy; + uint32_t phys[8]; + int len; - phy = OF_getpropint(sc->sc_node, "phys", 0); - if (phy == 0) + len = OF_getpropintarray(sc->sc_node, "phys", phys, sizeof(phys)); + if (len < sizeof(phys[0])) return; - sc->sc_phy_node = OF_getnodebyphandle(phy); + sc->sc_phy_node = OF_getnodebyphandle(phys[0]); if (sc->sc_phy_node == 0) return; -- 2.20.1