summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@cvs.openbsd.org>2024-02-03 20:07:20 +0000
committerMark Kettenis <kettenis@cvs.openbsd.org>2024-02-03 20:07:20 +0000
commit9c7bc327adefaaa119bf6ea8d0a8809b26800397 (patch)
treef49997ca394a717e046ca65adbb7547d12d8e109
parentbd41eff00aebbc2c27daeef56e2f3f9de81e61ab (diff)
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@
-rw-r--r--sys/dev/ic/qwx.c16
-rw-r--r--sys/dev/ic/qwxvar.h3
-rw-r--r--sys/dev/pci/if_qwx_pci.c6
3 files changed, 21 insertions, 4 deletions
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 <stsp@openbsd.org>
@@ -68,6 +68,10 @@
#include <machine/bus.h>
#include <machine/intr.h>
+#ifdef __HAVE_FDT
+#include <dev/ofw/openfirm.h>
+#endif
+
#include <net/if.h>
#include <net/if_media.h>
@@ -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 <stsp@openbsd.org>
@@ -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);