lede/target/linux/bcm27xx/patches-6.12/950-0421-i2c-mux-Add-support-for-generic-base-nr-property.patch
=?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= d81c03f05e bcm27xx: add 6.12 patches from RPi repo
These patches were generated from:
https://github.com/raspberrypi/linux/commits/rpi-6.12.y
With the following command:
git format-patch -N v6.12.27..HEAD
(HEAD -> 8d3206ee456a5ecdf9ddbfd8e5e231e4f0cd716e)

Exceptions:
- (def)configs patches
- github workflows patches
- applied & reverted patches
- readme patches
- wireless patches

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
2025-06-20 17:01:06 +08:00

36 lines
1.3 KiB
Diff

From 84c5f89bf1cc3f70b3f1dea42dcb08d3601e540e Mon Sep 17 00:00:00 2001
From: Phil Elwell <phil@raspberrypi.com>
Date: Thu, 14 Mar 2024 09:55:31 +0000
Subject: [PATCH] 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
@@ -333,8 +333,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 && base_nr)
+ force_nr = base_nr + chan_id;
+
if (muxc->arbitrator)
mux_node = of_get_child_by_name(dev_node, "i2c-arb");
else if (muxc->gate)