summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpatrick <patrick@openbsd.org>2020-09-29 13:50:54 +0000
committerpatrick <patrick@openbsd.org>2020-09-29 13:50:54 +0000
commit332805e1f24acc346bc7dede8f639333595c087c (patch)
treea32f8b2047c3345b6fda48b86467c20ab4ef50e9
parentMove the solock() call outside of solisten(). The reason is that the (diff)
downloadwireguard-openbsd-332805e1f24acc346bc7dede8f639333595c087c.tar.xz
wireguard-openbsd-332805e1f24acc346bc7dede8f639333595c087c.zip
The pcamux(4) device tree node's children are the individual channels,
which we each treat as an I2C bus. While scanning these, we need to use each channel's node as starting point instead of the pcamux(4) node. This fixes finding and attaching devices connected to these channels. ok kettenis@
-rw-r--r--sys/dev/i2c/pca9548.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/sys/dev/i2c/pca9548.c b/sys/dev/i2c/pca9548.c
index 47ac5a7b20d..1fe6328f5c2 100644
--- a/sys/dev/i2c/pca9548.c
+++ b/sys/dev/i2c/pca9548.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pca9548.c,v 1.1 2020/06/18 18:05:00 kettenis Exp $ */
+/* $OpenBSD: pca9548.c,v 1.2 2020/09/29 13:50:54 patrick Exp $ */
/*
* Copyright (c) 2020 Mark Kettenis
@@ -32,6 +32,7 @@
struct pcamux_bus {
struct pcamux_softc *pb_sc;
+ int pb_node;
int pb_channel;
struct i2c_controller pb_ic;
struct i2c_bus pb_ib;
@@ -102,6 +103,7 @@ pcamux_attach(struct device *parent, struct device *self, void *aux)
pb = &sc->sc_bus[channel];
pb->pb_sc = sc;
+ pb->pb_node = node;
pb->pb_channel = channel;
pb->pb_ic.ic_cookie = pb;
pb->pb_ic.ic_acquire_bus = pcamux_acquire_bus;
@@ -113,7 +115,7 @@ pcamux_attach(struct device *parent, struct device *self, void *aux)
iba.iba_name = "iic";
iba.iba_tag = &pb->pb_ic;
iba.iba_bus_scan = pcamux_bus_scan;
- iba.iba_bus_scan_arg = &sc->sc_node;
+ iba.iba_bus_scan_arg = &pb->pb_node;
config_found(&sc->sc_dev, &iba, iicbus_print);