0
0
mirror of https://git.openwrt.org/openwrt/openwrt.git synced 2024-11-25 06:26:15 +00:00
openwrt/target/linux/bcm27xx/patches-6.6/950-0965-i2c-mux-Add-support-for-generic-base-nr-property.patch
Álvaro Fernández Rojas 8c405cdccc bcm27xx: add 6.6 kernel patches
The patches were generated from the RPi repo with the following command:
git format-patch v6.6.34..rpi-6.1.y

Some patches needed rebasing and, as usual, the applied and reverted, wireless
drivers, Github workflows, READMEs and defconfigs patches were removed.

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
2024-06-18 18:52:49 +02:00

36 lines
1.2 KiB
Diff

From a7c1456eb3e8f99ed908b2ccce9a4045c2d3c85e Mon Sep 17 00:00:00 2001
From: Phil Elwell <phil@raspberrypi.com>
Date: Thu, 14 Mar 2024 09:55:31 +0000
Subject: [PATCH 0965/1085] i2c: mux: Add support for generic base-nr property
i2c_mux_add_adapter takes a force_nr parameter that allows an explicit
bus number to be associated with a channel. However, only i2c-mux-reg
and i2c-mux-gpio make use of it.
To help with situations where it is desirable to have a fixed, known
base address for the channels of a mux, create a "base-nr" property.
When force_nr is 0 and base-nr is set and non-zero, form a force_nr
value from the sum of base-nr and the channel ID.
Signed-off-by: Phil Elwell <phil@raspberrypi.com>
---
drivers/i2c/i2c-mux.c | 5 +++++
1 file changed, 5 insertions(+)
--- a/drivers/i2c/i2c-mux.c
+++ b/drivers/i2c/i2c-mux.c
@@ -355,8 +355,13 @@ int i2c_mux_add_adapter(struct i2c_mux_c
if (muxc->dev->of_node) {
struct device_node *dev_node = muxc->dev->of_node;
struct device_node *mux_node, *child = NULL;
+ u32 base_nr = 0;
u32 reg;
+ of_property_read_u32(dev_node, "base-nr", &base_nr);
+ if (!force_nr)
+ force_nr = base_nr;
+
if (muxc->arbitrator)
mux_node = of_get_child_by_name(dev_node, "i2c-arb");
else if (muxc->gate)