* [PATCH 1/2] dt-bindings: i2c: omap: Add mux-states property
2025-03-18 10:36 [PATCH 0/2] Add support for setting MUX for I2C lines Jayesh Choudhary
@ 2025-03-18 10:36 ` Jayesh Choudhary
2025-03-18 19:55 ` Ing. Josua Mayer
2025-03-18 22:19 ` Rob Herring
2025-03-18 10:36 ` [PATCH 2/2] i2c: omap: Add support for setting mux Jayesh Choudhary
2025-03-19 10:11 ` [PATCH 0/2] Add support for setting MUX for I2C lines Andi Shyti
2 siblings, 2 replies; 8+ messages in thread
From: Jayesh Choudhary @ 2025-03-18 10:36 UTC (permalink / raw)
To: vigneshr, andi.shyti, robh, krzk+dt, conor+dt, linux-kernel
Cc: aaro.koskinen, andreas, khilman, rogerq, tony, jmkrzyszt,
linux-omap, linux-i2c, devicetree, j-choudhary
Add mux controller support for when the I2C lines are muxed after
signals come out of SoC and before they go to any client.
Signed-off-by: Jayesh Choudhary <j-choudhary@ti.com>
---
Documentation/devicetree/bindings/i2c/ti,omap4-i2c.yaml | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/Documentation/devicetree/bindings/i2c/ti,omap4-i2c.yaml b/Documentation/devicetree/bindings/i2c/ti,omap4-i2c.yaml
index 8c2e35fabf5b..58d32ceeacfc 100644
--- a/Documentation/devicetree/bindings/i2c/ti,omap4-i2c.yaml
+++ b/Documentation/devicetree/bindings/i2c/ti,omap4-i2c.yaml
@@ -47,6 +47,11 @@ properties:
$ref: /schemas/types.yaml#/definitions/string
deprecated: true
+ mux-states:
+ description:
+ mux controller node to route the I2C signals from SoC to clients.
+ maxItems: 1
+
required:
- compatible
- reg
@@ -87,4 +92,5 @@ examples:
interrupts = <GIC_SPI 200 IRQ_TYPE_LEVEL_HIGH>;
#address-cells = <1>;
#size-cells = <0>;
+ mux-states = <&i2c_mux 1>;
};
--
2.34.1
^ permalink raw reply related [flat|nested] 8+ messages in thread* Re: [PATCH 1/2] dt-bindings: i2c: omap: Add mux-states property
2025-03-18 10:36 ` [PATCH 1/2] dt-bindings: i2c: omap: Add mux-states property Jayesh Choudhary
@ 2025-03-18 19:55 ` Ing. Josua Mayer
2025-03-18 22:18 ` Rob Herring
2025-03-18 22:19 ` Rob Herring
1 sibling, 1 reply; 8+ messages in thread
From: Ing. Josua Mayer @ 2025-03-18 19:55 UTC (permalink / raw)
To: Jayesh Choudhary, vigneshr, andi.shyti, robh, krzk+dt, conor+dt,
linux-kernel
Cc: aaro.koskinen, andreas, khilman, rogerq, tony, jmkrzyszt,
linux-omap, linux-i2c, devicetree
Hi Jayesh,
Am 18.03.25 um 11:36 schrieb Jayesh Choudhary:
> Add mux controller support for when the I2C lines are muxed after
> signals come out of SoC and before they go to any client.
>
> Signed-off-by: Jayesh Choudhary <j-choudhary@ti.com>
> ---
> Documentation/devicetree/bindings/i2c/ti,omap4-i2c.yaml | 6 ++++++
> 1 file changed, 6 insertions(+)
Is there any chance for this to be generic across any i2c controller
regardless of SoC in use?
Is this perhaps also generic to any device in dts,
similar to assigned-clocks?
E.g. in k3-am642-hummingboard-t-{pcie,usb3}.dts we have a mux on the
carrier board switching a serdes lane between two different connectors.
It would make sense for pcie and usb phy nodes to delay probe in a
similar fashion.
The same may hold true for other buses muxed at boot-time or based on
assembly options or extension cards.
sincerely
Josua Mayer
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: [PATCH 1/2] dt-bindings: i2c: omap: Add mux-states property
2025-03-18 19:55 ` Ing. Josua Mayer
@ 2025-03-18 22:18 ` Rob Herring
2025-03-19 11:32 ` Andreas Kemnade
0 siblings, 1 reply; 8+ messages in thread
From: Rob Herring @ 2025-03-18 22:18 UTC (permalink / raw)
To: Ing. Josua Mayer
Cc: Jayesh Choudhary, vigneshr, andi.shyti, krzk+dt, conor+dt,
linux-kernel, aaro.koskinen, andreas, khilman, rogerq, tony,
jmkrzyszt, linux-omap, linux-i2c, devicetree
On Tue, Mar 18, 2025 at 2:55 PM Ing. Josua Mayer <josua.mayer@jm0.eu> wrote:
>
> Hi Jayesh,
>
> Am 18.03.25 um 11:36 schrieb Jayesh Choudhary:
> > Add mux controller support for when the I2C lines are muxed after
> > signals come out of SoC and before they go to any client.
> >
> > Signed-off-by: Jayesh Choudhary <j-choudhary@ti.com>
> > ---
> > Documentation/devicetree/bindings/i2c/ti,omap4-i2c.yaml | 6 ++++++
> > 1 file changed, 6 insertions(+)
>
> Is there any chance for this to be generic across any i2c controller
> regardless of SoC in use?
> Is this perhaps also generic to any device in dts,
> similar to assigned-clocks?
$ git grep assigned-clocks arch/ | wc -l
2097
>
> E.g. in k3-am642-hummingboard-t-{pcie,usb3}.dts we have a mux on the
> carrier board switching a serdes lane between two different connectors.
> It would make sense for pcie and usb phy nodes to delay probe in a
> similar fashion.
> The same may hold true for other buses muxed at boot-time or based on
> assembly options or extension cards.
$ git grep mux-states arch/
arch/arm64/boot/dts/ti/k3-j7200-common-proc-board.dts:
mux-states = <&mux0 1>;
arch/arm64/boot/dts/ti/k3-j721s2-common-proc-board.dts:
mux-states = <&mux0 1>;
arch/arm64/boot/dts/ti/k3-j721s2-common-proc-board.dts:
mux-states = <&mux1 1>;
arch/arm64/boot/dts/ti/k3-j784s4-j742s2-evm-common.dtsi:
mux-states = <&mux1 1>;
I'm not convinced it is common enough to allow everywhere.
Rob
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: [PATCH 1/2] dt-bindings: i2c: omap: Add mux-states property
2025-03-18 22:18 ` Rob Herring
@ 2025-03-19 11:32 ` Andreas Kemnade
0 siblings, 0 replies; 8+ messages in thread
From: Andreas Kemnade @ 2025-03-19 11:32 UTC (permalink / raw)
To: Rob Herring
Cc: Ing. Josua Mayer, Jayesh Choudhary, vigneshr, andi.shyti, krzk+dt,
conor+dt, linux-kernel, aaro.koskinen, khilman, rogerq, tony,
jmkrzyszt, linux-omap, linux-i2c, devicetree
Am Tue, 18 Mar 2025 17:18:29 -0500
schrieb Rob Herring <robh@kernel.org>:
> On Tue, Mar 18, 2025 at 2:55 PM Ing. Josua Mayer <josua.mayer@jm0.eu> wrote:
> >
> > Hi Jayesh,
> >
> > Am 18.03.25 um 11:36 schrieb Jayesh Choudhary:
> > > Add mux controller support for when the I2C lines are muxed after
> > > signals come out of SoC and before they go to any client.
> > >
> > > Signed-off-by: Jayesh Choudhary <j-choudhary@ti.com>
> > > ---
> > > Documentation/devicetree/bindings/i2c/ti,omap4-i2c.yaml | 6 ++++++
> > > 1 file changed, 6 insertions(+)
> >
> > Is there any chance for this to be generic across any i2c controller
> > regardless of SoC in use?
> > Is this perhaps also generic to any device in dts,
> > similar to assigned-clocks?
>
> $ git grep assigned-clocks arch/ | wc -l
> 2097
>
> >
> > E.g. in k3-am642-hummingboard-t-{pcie,usb3}.dts we have a mux on the
> > carrier board switching a serdes lane between two different connectors.
> > It would make sense for pcie and usb phy nodes to delay probe in a
> > similar fashion.
> > The same may hold true for other buses muxed at boot-time or based on
> > assembly options or extension cards.
>
> $ git grep mux-states arch/
> arch/arm64/boot/dts/ti/k3-j7200-common-proc-board.dts:
> mux-states = <&mux0 1>;
> arch/arm64/boot/dts/ti/k3-j721s2-common-proc-board.dts:
> mux-states = <&mux0 1>;
> arch/arm64/boot/dts/ti/k3-j721s2-common-proc-board.dts:
> mux-states = <&mux1 1>;
> arch/arm64/boot/dts/ti/k3-j784s4-j742s2-evm-common.dtsi:
> mux-states = <&mux1 1>;
>
> I'm not convinced it is common enough to allow everywhere.
>
strange logic. It is not in there, because it is not allowed/supported
and some quirk maybe is added elsewhere, e.g. in bootloader or private
kernel branch.
So you cannot say whether such a case is common engough by looking what
is *now* in the dtb.
Regards,
Andreas
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/2] dt-bindings: i2c: omap: Add mux-states property
2025-03-18 10:36 ` [PATCH 1/2] dt-bindings: i2c: omap: Add mux-states property Jayesh Choudhary
2025-03-18 19:55 ` Ing. Josua Mayer
@ 2025-03-18 22:19 ` Rob Herring
1 sibling, 0 replies; 8+ messages in thread
From: Rob Herring @ 2025-03-18 22:19 UTC (permalink / raw)
To: Jayesh Choudhary
Cc: vigneshr, andi.shyti, krzk+dt, conor+dt, linux-kernel,
aaro.koskinen, andreas, khilman, rogerq, tony, jmkrzyszt,
linux-omap, linux-i2c, devicetree
On Tue, Mar 18, 2025 at 5:36 AM Jayesh Choudhary <j-choudhary@ti.com> wrote:
>
> Add mux controller support for when the I2C lines are muxed after
> signals come out of SoC and before they go to any client.
>
> Signed-off-by: Jayesh Choudhary <j-choudhary@ti.com>
> ---
> Documentation/devicetree/bindings/i2c/ti,omap4-i2c.yaml | 6 ++++++
> 1 file changed, 6 insertions(+)
Reviewed-by: Rob Herring (Arm) <robh@kernel.org>
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 2/2] i2c: omap: Add support for setting mux
2025-03-18 10:36 [PATCH 0/2] Add support for setting MUX for I2C lines Jayesh Choudhary
2025-03-18 10:36 ` [PATCH 1/2] dt-bindings: i2c: omap: Add mux-states property Jayesh Choudhary
@ 2025-03-18 10:36 ` Jayesh Choudhary
2025-03-19 10:11 ` [PATCH 0/2] Add support for setting MUX for I2C lines Andi Shyti
2 siblings, 0 replies; 8+ messages in thread
From: Jayesh Choudhary @ 2025-03-18 10:36 UTC (permalink / raw)
To: vigneshr, andi.shyti, robh, krzk+dt, conor+dt, linux-kernel
Cc: aaro.koskinen, andreas, khilman, rogerq, tony, jmkrzyszt,
linux-omap, linux-i2c, devicetree, j-choudhary
Some SoCs require muxes in the routing for SDA and SCL lines.
Therefore, add support for setting the mux by reading the mux-states
property from the dt-node.
Signed-off-by: Jayesh Choudhary <j-choudhary@ti.com>
---
drivers/i2c/busses/Kconfig | 1 +
drivers/i2c/busses/i2c-omap.c | 22 ++++++++++++++++++++++
2 files changed, 23 insertions(+)
diff --git a/drivers/i2c/busses/Kconfig b/drivers/i2c/busses/Kconfig
index fc438f445771..0648e58b083e 100644
--- a/drivers/i2c/busses/Kconfig
+++ b/drivers/i2c/busses/Kconfig
@@ -940,6 +940,7 @@ config I2C_OMAP
tristate "OMAP I2C adapter"
depends on ARCH_OMAP || ARCH_K3 || COMPILE_TEST
default MACH_OMAP_OSK
+ select MULTIPLEXER
help
If you say yes to this option, support will be included for the
I2C interface on the Texas Instruments OMAP1/2 family of processors.
diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
index f18c3e74b076..16afb9ca19bb 100644
--- a/drivers/i2c/busses/i2c-omap.c
+++ b/drivers/i2c/busses/i2c-omap.c
@@ -24,6 +24,7 @@
#include <linux/platform_device.h>
#include <linux/clk.h>
#include <linux/io.h>
+#include <linux/mux/consumer.h>
#include <linux/of.h>
#include <linux/slab.h>
#include <linux/platform_data/i2c-omap.h>
@@ -211,6 +212,7 @@ struct omap_i2c_dev {
u16 syscstate;
u16 westate;
u16 errata;
+ struct mux_state *mux_state;
};
static const u8 reg_map_ip_v1[] = {
@@ -1452,6 +1454,23 @@ omap_i2c_probe(struct platform_device *pdev)
(1000 * omap->speed / 8);
}
+ if (of_property_read_bool(node, "mux-states")) {
+ struct mux_state *mux_state;
+
+ mux_state = devm_mux_state_get(&pdev->dev, NULL);
+ if (IS_ERR(mux_state)) {
+ r = PTR_ERR(mux_state);
+ dev_dbg(&pdev->dev, "failed to get I2C mux: %d\n", r);
+ goto err_disable_pm;
+ }
+ omap->mux_state = mux_state;
+ r = mux_state_select(omap->mux_state);
+ if (r) {
+ dev_err(&pdev->dev, "failed to select I2C mux: %d\n", r);
+ goto err_disable_pm;
+ }
+ }
+
/* reset ASAP, clearing any IRQs */
omap_i2c_init(omap);
@@ -1511,6 +1530,9 @@ static void omap_i2c_remove(struct platform_device *pdev)
i2c_del_adapter(&omap->adapter);
+ if (omap->mux_state)
+ mux_state_deselect(omap->mux_state);
+
ret = pm_runtime_get_sync(&pdev->dev);
if (ret < 0)
dev_err(omap->dev, "Failed to resume hardware, skip disable\n");
--
2.34.1
^ permalink raw reply related [flat|nested] 8+ messages in thread* Re: [PATCH 0/2] Add support for setting MUX for I2C lines
2025-03-18 10:36 [PATCH 0/2] Add support for setting MUX for I2C lines Jayesh Choudhary
2025-03-18 10:36 ` [PATCH 1/2] dt-bindings: i2c: omap: Add mux-states property Jayesh Choudhary
2025-03-18 10:36 ` [PATCH 2/2] i2c: omap: Add support for setting mux Jayesh Choudhary
@ 2025-03-19 10:11 ` Andi Shyti
2 siblings, 0 replies; 8+ messages in thread
From: Andi Shyti @ 2025-03-19 10:11 UTC (permalink / raw)
To: Jayesh Choudhary
Cc: vigneshr, robh, krzk+dt, conor+dt, linux-kernel, aaro.koskinen,
andreas, khilman, rogerq, tony, jmkrzyszt, linux-omap, linux-i2c,
devicetree
Hi Jayesh,
> Jayesh Choudhary (2):
> dt-bindings: i2c: omap: Add mux-states property
> i2c: omap: Add support for setting mux
merged to i2c/i2c-host.
Thanks,
Andi
^ permalink raw reply [flat|nested] 8+ messages in thread