<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">From 27f0e0e195568c06f21ce380f0736bdd219baf3c Mon Sep 17 00:00:00 2001
From: Janis Streib &lt;janis+github@dogcraft.de&gt;
Date: Sun, 15 Oct 2023 21:08:40 +0200
Subject: [PATCH] overlays: mcp23017: allow specification of the i2c bus

Analogous to i2c-rtc-overlay.dts

See: https://github.com/raspberrypi/linux/pull/5650
---
 arch/arm/boot/dts/overlays/README             | 10 ++++++
 .../boot/dts/overlays/mcp23017-overlay.dts    | 36 +++++++++++++++++--
 2 files changed, 44 insertions(+), 2 deletions(-)

--- a/arch/arm/boot/dts/overlays/README
+++ b/arch/arm/boot/dts/overlays/README
@@ -2810,6 +2810,16 @@ Params: gpiopin                 Gpio pin
 
         mcp23008                Configure an MCP23008 instead.
         noints                  Disable the interrupt GPIO line.
+        i2c0                    Choose the I2C0 bus on GPIOs 0&amp;1
+        i2c_csi_dsi             Choose the I2C0 bus on GPIOs 44&amp;45
+        i2c3                    Choose the I2C3 bus (configure with the i2c3
+                                overlay - BCM2711 only)
+        i2c4                    Choose the I2C4 bus (configure with the i2c4
+                                overlay - BCM2711 only)
+        i2c5                    Choose the I2C5 bus (configure with the i2c5
+                                overlay - BCM2711 only)
+        i2c6                    Choose the I2C6 bus (configure with the i2c6
+                                overlay - BCM2711 only)
 
 
 Name:   mcp23s17
--- a/arch/arm/boot/dts/overlays/mcp23017-overlay.dts
+++ b/arch/arm/boot/dts/overlays/mcp23017-overlay.dts
@@ -7,7 +7,7 @@
 	compatible = "brcm,bcm2835";
 
 	fragment@0 {
-		target = &lt;&amp;i2c1&gt;;
+		target = &lt;&amp;i2cbus&gt;;
 		__overlay__ {
 			status = "okay";
 		};
@@ -24,7 +24,7 @@
 	};
 
 	fragment@2 {
-		target = &lt;&amp;i2c1&gt;;
+		target = &lt;&amp;i2cbus&gt;;
 		__overlay__ {
 			#address-cells = &lt;1&gt;;
 			#size-cells = &lt;0&gt;;
@@ -58,12 +58,44 @@
 		};
 	};
 
+	frag100: fragment@100 {
+		target = &lt;&amp;i2c1&gt;;
+		i2cbus: __overlay__ {
+			status = "okay";
+		};
+	};
+
+	fragment@101 { 
+		target = &lt;&amp;i2c0if&gt;; 
+		__dormant__ { 
+			status = "okay"; 
+		}; 
+	};
+
+	fragment@102 { 
+		target = &lt;&amp;i2c0mux&gt;; 
+		__dormant__ { 
+			status = "okay"; 
+		}; 
+	};
+
 	__overrides__ {
 		gpiopin = &lt;&amp;mcp23017_pins&gt;,"brcm,pins:0",
 				&lt;&amp;mcp23017_irq&gt;,"interrupts:0";
 		addr = &lt;&amp;mcp23017&gt;,"reg:0", &lt;&amp;mcp23017_pins&gt;,"reg:0";
 		mcp23008 = &lt;0&gt;,"=3";
 		noints = &lt;0&gt;,"!1!4";
+		i2c0 = &lt;&amp;frag100&gt;, "target:0=",&lt;&amp;i2c0&gt;;
+		i2c_csi_dsi = &lt;&amp;frag100&gt;, "target:0=",&lt;&amp;i2c_csi_dsi&gt;,
+			      &lt;0&gt;,"+101+102";
+		i2c3 = &lt;&amp;frag100&gt;, "target?=0",
+		       &lt;&amp;frag100&gt;, "target-path=i2c3";
+		i2c4 = &lt;&amp;frag100&gt;, "target?=0",
+		       &lt;&amp;frag100&gt;, "target-path=i2c4";
+		i2c5 = &lt;&amp;frag100&gt;, "target?=0",
+		       &lt;&amp;frag100&gt;, "target-path=i2c5";
+		i2c6 = &lt;&amp;frag100&gt;, "target?=0",
+		       &lt;&amp;frag100&gt;, "target-path=i2c6";
 	};
 };
 
</pre></body></html>