From bd24924fea541c114c7761f4698f3fe29d7257e1 Mon Sep 17 00:00:00 2001
From: Dave Stevenson <dave.stevenson@raspberrypi.com>
Date: Thu, 9 Apr 2020 15:04:14 +0100
Subject: [PATCH] dtoverlays: Update CSI overlays to use i2c_csi_dsi

Update all overlays that were using i2c_vc for talking to CSI
source devices to use the new i2c_csi_dsi node via i2c_mux_pinctrl.
Remove the pins overrides as well.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
---
 arch/arm/boot/dts/overlays/README             | 42 ++++---------------
 .../boot/dts/overlays/adv7282m-overlay.dts    | 29 +++----------
 arch/arm/boot/dts/overlays/imx219-overlay.dts | 41 +++++-------------
 .../arm/boot/dts/overlays/irs1125-overlay.dts | 33 ++++-----------
 arch/arm/boot/dts/overlays/ov5647-overlay.dts | 33 ++++-----------
 .../boot/dts/overlays/tc358743-overlay.dts    | 32 ++++----------
 6 files changed, 47 insertions(+), 163 deletions(-)

--- a/arch/arm/boot/dts/overlays/README
+++ b/arch/arm/boot/dts/overlays/README
@@ -331,22 +331,14 @@ Info:   Analog Devices ADV7282M analogue
         Uses Unicam1, which is the standard camera connector on most Pi
         variants.
 Load:   dtoverlay=adv7282m,<param>=<val>
-Params: i2c_pins_0_1            Use pins 0&1 for the I2C instead of 44&45.
-                                Useful on Compute Modules.
-        i2c_pins_28_29          Use pins 28&29 for the I2C instead of 44&45.
-                                This is required for Pi B+, 2, 0, and 0W.
-        addr                    Overrides the I2C address (default 0x21)
+Params: addr                    Overrides the I2C address (default 0x21)
 
 
 Name:   adv728x-m
 Info:   Analog Devices ADV728[0|1|2]-M analogue video to CSI2 bridges.
         This is a wrapper for adv7282m, and defaults to ADV7282M.
 Load:   dtoverlay=adv728x-m,<param>=<val>
-Params: i2c_pins_0_1            Use pins 0&1 for the I2C instead of 44&45.
-                                Useful on Compute Modules.
-        i2c_pins_28_29          Use pins 28&29 for the I2C instead of 44&45.
-                                This is required for Pi B+, 2, 0, and 0W.
-        addr                    Overrides the I2C address (default 0x21)
+Params: addr                    Overrides the I2C address (default 0x21)
         adv7280m                Select ADV7280-M.
         adv7281m                Select ADV7281-M.
         adv7281ma               Select ADV7281-MA.
@@ -1384,12 +1376,8 @@ Name:   imx219
 Info:   Sony IMX219 camera module.
         Uses Unicam 1, which is the standard camera connector on most Pi
         variants.
-Load:   dtoverlay=imx219,<param>=<val>
-Params: i2c_pins_0_1            Use pins 0&1 for the I2C instead of 44&45.
-                                Useful on Compute Modules.
-
-        i2c_pins_28_29          Use pins 28&29 for the I2C instead of 44&45.
-                                This is required for Pi B+, 2, 0, and 0W.
+Load:   dtoverlay=imx219
+Params: <None>
 
 
 Name:   iqaudio-codec
@@ -1453,12 +1441,8 @@ Name:   irs1125
 Info:   Infineon irs1125 TOF camera module.
         Uses Unicam 1, which is the standard camera connector on most Pi
         variants.
-Load:   dtoverlay=irs1125,<param>=<val>
-Params: i2c_pins_0_1            Use pins 0&1 for the I2C instead of 44&45.
-                                Useful on Compute Modules.
-
-        i2c_pins_28_29          Use pins 28&29 for the I2C instead of 44&45.
-                                This is required for Pi B+, 2, 0, and 0W.
+Load:   dtoverlay=irs1125
+Params: <None>
 
 
 Name:   jedec-spi-nor
@@ -1743,12 +1727,8 @@ Name:   ov5647
 Info:   Omnivision OV5647 camera module.
         Uses Unicam 1, which is the standard camera connector on most Pi
         variants.
-Load:   dtoverlay=ov5647,<param>=<val>
-Params: i2c_pins_0_1            Use pins 0&1 for the I2C instead of 44&45.
-                                Useful on Compute Modules.
-
-        i2c_pins_28_29          Use pins 28&29 for the I2C instead of 44&45.
-                                This is required for Pi B+, 2, 0, and 0W.
+Load:   dtoverlay=ov5647
+Params: <None>
 
 
 Name:   papirus
@@ -2555,12 +2535,6 @@ Params: 4lane                   Use 4 la
                                 (574Mbit/s) and 486000000 (972Mbit/s - default)
                                 are supported by the driver.
 
-        i2c_pins_0_1            Use pins 0&1 for the I2C instead of 44&45.
-                                Useful on Compute Modules.
-
-        i2c_pins_28_29          Use pins 28&29 for the I2C instead of 44&45.
-                                This is required for Pi B+, 2, 0, and 0W.
-
 
 Name:   tc358743-audio
 Info:   Used in combination with the tc358743-fast overlay to route the audio
--- a/arch/arm/boot/dts/overlays/adv7282m-overlay.dts
+++ b/arch/arm/boot/dts/overlays/adv7282m-overlay.dts
@@ -7,7 +7,7 @@
 	compatible = "brcm,bcm2835";
 
 	fragment@0 {
-		target = <&i2c_vc>;
+		target = <&i2c_csi_dsi>;
 		__overlay__ {
 			#address-cells = <1>;
 			#size-cells = <0>;
@@ -45,37 +45,20 @@
 		};
 	};
 	fragment@2 {
-		target = <&i2c0_pins>;
-		__dormant__ {
-			brcm,pins = <28 29>;
-			brcm,function = <4>; /* alt0 */
-		};
-
-	};
-	fragment@3 {
-		target = <&i2c0_pins>;
+		target = <&i2c0if>;
 		__overlay__ {
-			brcm,pins = <44 45>;
-			brcm,function = <5>; /* alt1 */
-		};
-	};
-	fragment@4 {
-		target = <&i2c0_pins>;
-		__dormant__ {
-			brcm,pins = <0 1>;
-			brcm,function = <4>; /* alt0 */
+			status = "okay";
 		};
 	};
-	fragment@5 {
-		target = <&i2c_vc>;
+
+	fragment@3 {
+		target = <&i2c0mux>;
 		__overlay__ {
 			status = "okay";
 		};
 	};
 
 	__overrides__ {
-		i2c_pins_0_1 =		<0>,"-2-3+4";
-		i2c_pins_28_29 =	<0>,"+2-3-4";
 		addr =			<&adv728x>,"reg:0";
 	};
 };
--- a/arch/arm/boot/dts/overlays/imx219-overlay.dts
+++ b/arch/arm/boot/dts/overlays/imx219-overlay.dts
@@ -9,7 +9,7 @@
 	compatible = "brcm,bcm2835";
 
 	fragment@0 {
-		target = <&i2c_vc>;
+		target = <&i2c_csi_dsi>;
 		__overlay__ {
 			#address-cells = <1>;
 			#size-cells = <0>;
@@ -61,34 +61,13 @@
 	};
 
 	fragment@2 {
-		target = <&i2c0_pins>;
-		__dormant__ {
-			brcm,pins = <28 29>;
-			brcm,function = <4>; /* alt0 */
-		};
-	};
-	fragment@3 {
-		target = <&i2c0_pins>;
-		__overlay__ {
-			brcm,pins = <44 45>;
-			brcm,function = <5>; /* alt1 */
-		};
-	};
-	fragment@4 {
-		target = <&i2c0_pins>;
-		__dormant__ {
-			brcm,pins = <0 1>;
-			brcm,function = <4>; /* alt0 */
-		};
-	};
-	fragment@5 {
-		target = <&i2c_vc>;
+		target = <&i2c0if>;
 		__overlay__ {
 			status = "okay";
 		};
 	};
 
-	fragment@6 {
+	fragment@3 {
 		target-path="/";
 		__overlay__ {
 			imx219_vana: fixedregulator@0 {
@@ -114,16 +93,18 @@
 		};
 	};
 
-	fragment@7 {
+	fragment@4 {
+		target = <&i2c0mux>;
+		__overlay__ {
+			status = "okay";
+		};
+	};
+
+	fragment@5 {
 		target-path="/__overrides__";
 		__overlay__ {
 			cam0-pwdn-ctrl = <&imx219_vana>,"gpio:0";
 			cam0-pwdn      = <&imx219_vana>,"gpio:4";
 		};
 	};
-
-	__overrides__ {
-		i2c_pins_0_1 = <0>,"-2-3+4";
-		i2c_pins_28_29 = <0>,"+2-3-4";
-	};
 };
--- a/arch/arm/boot/dts/overlays/irs1125-overlay.dts
+++ b/arch/arm/boot/dts/overlays/irs1125-overlay.dts
@@ -7,7 +7,7 @@
 	compatible = "brcm,bcm2835";
 
 	fragment@0 {
-		target = <&i2c_vc>;
+		target = <&i2c_csi_dsi>;
 		__overlay__ {
 			#address-cells = <1>;
 			#size-cells = <0>;
@@ -55,43 +55,24 @@
 	};
 
 	fragment@2 {
-		target = <&i2c0_pins>;
-		__dormant__ {
-			brcm,pins = <28 29>;
-			brcm,function = <4>; /* alt0 */
-		};
-	};
-	fragment@3 {
-		target = <&i2c0_pins>;
+		target = <&i2c0if>;
 		__overlay__ {
-			brcm,pins = <44 45>;
-			brcm,function = <5>; /* alt1 */
-		};
-	};
-	fragment@4 {
-		target = <&i2c0_pins>;
-		__dormant__ {
-			brcm,pins = <0 1>;
-			brcm,function = <4>; /* alt0 */
+			status = "okay";
 		};
 	};
-	fragment@5 {
-		target = <&i2c_vc>;
+
+	fragment@3 {
+		target = <&i2c0mux>;
 		__overlay__ {
 			status = "okay";
 		};
 	};
 
-	fragment@6 {
+	fragment@4 {
 		target-path="/__overrides__";
 		__overlay__ {
 			cam0-pwdn-ctrl = <&irs1125>,"pwdn-gpios:0";
 			cam0-pwdn      = <&irs1125>,"pwdn-gpios:4";
 		};
 	};
-
-	__overrides__ {
-		i2c_pins_0_1 = <0>,"-2-3+4";
-		i2c_pins_28_29 = <0>,"+2-3-4";
-	};
 };
--- a/arch/arm/boot/dts/overlays/ov5647-overlay.dts
+++ b/arch/arm/boot/dts/overlays/ov5647-overlay.dts
@@ -7,7 +7,7 @@
 	compatible = "brcm,bcm2835";
 
 	fragment@0 {
-		target = <&i2c_vc>;
+		target = <&i2c_csi_dsi>;
 		__overlay__ {
 			#address-cells = <1>;
 			#size-cells = <0>;
@@ -55,34 +55,20 @@
 	};
 
 	fragment@2 {
-		target = <&i2c0_pins>;
-		__dormant__ {
-			brcm,pins = <28 29>;
-			brcm,function = <4>; /* alt0 */
-		};
-	};
-	fragment@3 {
-		target = <&i2c0_pins>;
+		target = <&i2c0if>;
 		__overlay__ {
-			brcm,pins = <44 45>;
-			brcm,function = <5>; /* alt1 */
-		};
-	};
-	fragment@4 {
-		target = <&i2c0_pins>;
-		__dormant__ {
-			brcm,pins = <0 1>;
-			brcm,function = <4>; /* alt0 */
+			status = "okay";
 		};
 	};
-	fragment@5 {
-		target = <&i2c_vc>;
+
+	fragment@3 {
+		target = <&i2c0mux>;
 		__overlay__ {
 			status = "okay";
 		};
 	};
 
-	fragment@6 {
+	fragment@4 {
 		target-path="/__overrides__";
 		__overlay__ {
 			cam0-pwdn-ctrl = <&ov5647>,"pwdn-gpios:0";
@@ -91,9 +77,4 @@
 			cam0-led       = <&ov5647>,"pwdn-gpios:16";
 		};
 	};
-
-	__overrides__ {
-		i2c_pins_0_1 = <0>,"-2-3+4";
-		i2c_pins_28_29 = <0>,"+2-3-4";
-	};
 };
--- a/arch/arm/boot/dts/overlays/tc358743-overlay.dts
+++ b/arch/arm/boot/dts/overlays/tc358743-overlay.dts
@@ -7,7 +7,7 @@
 	compatible = "brcm,bcm2835";
 
 	fragment@0 {
-		target = <&i2c_vc>;
+		target = <&i2c_csi_dsi>;
 		__overlay__ {
 			#address-cells = <1>;
 			#size-cells = <0>;
@@ -54,7 +54,7 @@
 	};
 
 	fragment@2 {
-		target = <&i2c_vc>;
+		target = <&i2c_csi_dsi>;
 		__overlay__ {
 			tc358743@0f {
 				port {
@@ -67,7 +67,7 @@
 	};
 
 	fragment@3 {
-		target = <&i2c_vc>;
+		target = <&i2c_csi_dsi>;
 		__dormant__ {
 			tc358743@0f {
 				port {
@@ -80,36 +80,20 @@
 	};
 
 	fragment@4 {
-		target = <&i2c0_pins>;
-		__dormant__ {
-			brcm,pins = <28 29>;
-			brcm,function = <4>; /* alt0 */
-		};
-	};
-	fragment@5 {
-		target = <&i2c0_pins>;
+		target = <&i2c0if>;
 		__overlay__ {
-			brcm,pins = <44 45>;
-			brcm,function = <5>; /* alt1 */
-		};
-	};
-	fragment@6 {
-		target = <&i2c0_pins>;
-		__dormant__ {
-			brcm,pins = <0 1>;
-			brcm,function = <4>; /* alt0 */
+			status = "okay";
 		};
 	};
-	fragment@7 {
-		target = <&i2c_vc>;
+
+	fragment@5 {
+		target = <&i2c0mux>;
 		__overlay__ {
 			status = "okay";
 		};
 	};
 
 	__overrides__ {
-		i2c_pins_0_1 = <0>,"-4-5+6";
-		i2c_pins_28_29 = <0>,"+4-5-6";
 		4lane = <0>, "-2+3";
 		link-frequency = <&tc358743>,"link-frequencies#0";
 	};