openwrt/target/linux/bcm27xx/patches-6.6/950-0966-overlays-i2c-mux-Add-base-parameter.patch

52 lines
1.8 KiB
Diff
Raw Normal View History

From 841bb8e98b3383fdb98b43251923b94e6c86f1cf Mon Sep 17 00:00:00 2001
From: Phil Elwell <phil@raspberrypi.com>
Date: Thu, 14 Mar 2024 10:05:58 +0000
Subject: [PATCH 0966/1085] 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 <phil@raspberrypi.com>
---
arch/arm/boot/dts/overlays/README | 3 +++
arch/arm/boot/dts/overlays/i2c-mux-overlay.dts | 4 ++++
drivers/i2c/i2c-mux.c | 2 +-
3 files changed, 8 insertions(+), 1 deletion(-)
--- a/arch/arm/boot/dts/overlays/README
+++ b/arch/arm/boot/dts/overlays/README
@@ -2026,6 +2026,9 @@ Params: pca9542 Select t
addr Change I2C address of the device (default 0x70)
+ base Set an explicit base value for the channel bus
+ numbers
+
i2c0 Choose the I2C0 bus on GPIOs 0&1
i2c_csi_dsi Choose the I2C0 bus on GPIOs 44&45
--- a/arch/arm/boot/dts/overlays/i2c-mux-overlay.dts
+++ b/arch/arm/boot/dts/overlays/i2c-mux-overlay.dts
@@ -159,6 +159,10 @@
<&pca9545>,"reg:0",
<&pca9548>,"reg:0";
+ base = <&pca9542>,"base-nr:0",
+ <&pca9545>,"base-nr:0",
+ <&pca9548>,"base-nr:0";
+
i2c0 = <&frag100>, "target:0=",<&i2c0>,
<0>,"+101+102";
i2c_csi_dsi = <&frag100>, "target:0=",<&i2c_csi_dsi>,
--- a/drivers/i2c/i2c-mux.c
+++ b/drivers/i2c/i2c-mux.c
@@ -360,7 +360,7 @@ int i2c_mux_add_adapter(struct i2c_mux_c
of_property_read_u32(dev_node, "base-nr", &base_nr);
if (!force_nr)
- force_nr = base_nr;
+ force_nr = base_nr + chan_id;
if (muxc->arbitrator)
mux_node = of_get_child_by_name(dev_node, "i2c-arb");