Skip to content

Commit 841bb8e

Browse files
committed
overlays: i2c-mux: Add 'base' parameter
Add a 'base' parameter to set an explicit bus number for the channels, where the requested bus number is base + channel ID. Signed-off-by: Phil Elwell <[email protected]>
1 parent a7c1456 commit 841bb8e

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed

arch/arm/boot/dts/overlays/README

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2026,6 +2026,9 @@ Params: pca9542 Select the NXP PCA9542 device
20262026

20272027
addr Change I2C address of the device (default 0x70)
20282028

2029+
base Set an explicit base value for the channel bus
2030+
numbers
2031+
20292032
i2c0 Choose the I2C0 bus on GPIOs 0&1
20302033

20312034
i2c_csi_dsi Choose the I2C0 bus on GPIOs 44&45

arch/arm/boot/dts/overlays/i2c-mux-overlay.dts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,10 @@
159159
<&pca9545>,"reg:0",
160160
<&pca9548>,"reg:0";
161161

162+
base = <&pca9542>,"base-nr:0",
163+
<&pca9545>,"base-nr:0",
164+
<&pca9548>,"base-nr:0";
165+
162166
i2c0 = <&frag100>, "target:0=",<&i2c0>,
163167
<0>,"+101+102";
164168
i2c_csi_dsi = <&frag100>, "target:0=",<&i2c_csi_dsi>,

drivers/i2c/i2c-mux.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,7 @@ int i2c_mux_add_adapter(struct i2c_mux_core *muxc,
360360

361361
of_property_read_u32(dev_node, "base-nr", &base_nr);
362362
if (!force_nr)
363-
force_nr = base_nr;
363+
force_nr = base_nr + chan_id;
364364

365365
if (muxc->arbitrator)
366366
mux_node = of_get_child_by_name(dev_node, "i2c-arb");

0 commit comments

Comments
 (0)