From: kettenis Date: Sat, 3 Feb 2024 20:07:19 +0000 (+0000) Subject: Try to fetch the board variant from the device tree on platforms that have X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=51dce3f82dc5708e307a5983e267c4488676294a;p=openbsd Try to fetch the board variant from the device tree on platforms that have one (e.g. on arm64). Needed to extract the right information from the qwx(4) firmware on the x13s. ok stsp@ --- diff --git a/sys/dev/ic/qwx.c b/sys/dev/ic/qwx.c index 85304096065..65b15c8cae9 100644 --- a/sys/dev/ic/qwx.c +++ b/sys/dev/ic/qwx.c @@ -1,4 +1,4 @@ -/* $OpenBSD: qwx.c,v 1.15 2024/02/03 10:03:18 stsp Exp $ */ +/* $OpenBSD: qwx.c,v 1.16 2024/02/03 20:07:19 kettenis Exp $ */ /* * Copyright 2023 Stefan Sperling @@ -68,6 +68,10 @@ #include #include +#ifdef __HAVE_FDT +#include +#endif + #include #include @@ -7847,7 +7851,15 @@ qwx_core_check_smbios(struct qwx_softc *sc) int qwx_core_check_dt(struct qwx_softc *sc) { - return 0; /* TODO */ +#ifdef __HAVE_FDT + if (sc->sc_node == 0) + return 0; + + OF_getprop(sc->sc_node, "qcom,ath11k-calibration-variant", + sc->qmi_target.bdf_ext, sizeof(sc->qmi_target.bdf_ext) - 1); +#endif + + return 0; } int diff --git a/sys/dev/ic/qwxvar.h b/sys/dev/ic/qwxvar.h index 67a951f3527..e59d7b77a27 100644 --- a/sys/dev/ic/qwxvar.h +++ b/sys/dev/ic/qwxvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: qwxvar.h,v 1.10 2024/02/03 10:03:18 stsp Exp $ */ +/* $OpenBSD: qwxvar.h,v 1.11 2024/02/03 20:07:19 kettenis Exp $ */ /* * Copyright (c) 2018-2019 The Linux Foundation. @@ -1628,6 +1628,7 @@ struct qwx_softc { struct device sc_dev; struct ieee80211com sc_ic; uint32_t sc_flags; + int sc_node; int (*sc_newstate)(struct ieee80211com *, enum ieee80211_state, int); diff --git a/sys/dev/pci/if_qwx_pci.c b/sys/dev/pci/if_qwx_pci.c index 12ec98d7f5d..6b7310d21ad 100644 --- a/sys/dev/pci/if_qwx_pci.c +++ b/sys/dev/pci/if_qwx_pci.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_qwx_pci.c,v 1.4 2024/01/25 17:00:21 stsp Exp $ */ +/* $OpenBSD: if_qwx_pci.c,v 1.5 2024/02/03 20:07:19 kettenis Exp $ */ /* * Copyright 2023 Stefan Sperling @@ -770,6 +770,10 @@ qwx_pci_attach(struct device *parent, struct device *self, void *aux) psc->sc_pc = pa->pa_pc; psc->sc_tag = pa->pa_tag; +#ifdef __HAVE_FDT + sc->sc_node = PCITAG_NODE(pa->pa_tag); +#endif + rw_init(&sc->ioctl_rwl, "qwxioctl"); sreg = pci_conf_read(psc->sc_pc, psc->sc_tag, PCI_SUBSYS_ID_REG);