From fb760e67e0336587583eb32cf77bbdf4b4e1fc74 Mon Sep 17 00:00:00 2001
From: Andrey Gusakov <andrey.gusakov@cogentembedded.com>
Date: Tue, 28 May 2019 19:55:13 +0300
Subject: [PATCH] arm64: dts: renesas: ulcb-vb2: Drive CAN controller reset
 through regulators

This uses regulators instead of GPIO hogs for controlling CAN
reset pins on VideoBox v2 which fixes CAN cold-start issues.

Signed-off-by: Andrey Gusakov <andrey.gusakov@cogentembedded.com>
Signed-off-by: Valentine Barshak <valentine.barshak@cogentembedded.com>
---
 arch/arm64/boot/dts/renesas/ulcb-vb2.dtsi | 32 +++++++++++++++++++------------
 1 file changed, 20 insertions(+), 12 deletions(-)

diff --git a/arch/arm64/boot/dts/renesas/ulcb-vb2.dtsi b/arch/arm64/boot/dts/renesas/ulcb-vb2.dtsi
index 1610949..5831d12 100644
--- a/arch/arm64/boot/dts/renesas/ulcb-vb2.dtsi
+++ b/arch/arm64/boot/dts/renesas/ulcb-vb2.dtsi
@@ -94,6 +94,24 @@
 		regulator-always-on;
 	};
 
+	can2_power: regulator@11 {
+		compatible = "regulator-fixed";
+		regulator-name = "can2_power";
+		regulator-min-microvolt = <3300000>;
+		regulator-max-microvolt = <3300000>;
+		gpio = <&gpio_ext_pwr 8 GPIO_ACTIVE_HIGH>;
+		enable-active-high;
+	};
+
+	can3_power: regulator@12 {
+		compatible = "regulator-fixed";
+		regulator-name = "can3_power";
+		regulator-min-microvolt = <3300000>;
+		regulator-max-microvolt = <3300000>;
+		gpio = <&gpio_ext_pwr 9 GPIO_ACTIVE_HIGH>;
+		enable-active-high;
+	};
+
 	/delete-node/sound;
 
 	rsnd_ak4613: sound@0 {
@@ -187,6 +205,7 @@
 			interrupt-parent = <&gpio0>;
 			interrupts = <15 GPIO_ACTIVE_LOW>;
 			spi-max-frequency = <10000000>;
+			vdd-supply = <&can2_power>;
 		};
 		spican1: spidev@1 {
 			compatible = "microchip,mcp2515";
@@ -195,6 +214,7 @@
 			interrupt-parent = <&gpio1>;
 			interrupts = <5 GPIO_ACTIVE_LOW>;
 			spi-max-frequency = <10000000>;
+			vdd-supply = <&can3_power>;
 		};
 	};
 };
@@ -1147,12 +1167,6 @@
 					output-high;
 					line-name = "can2_120R_load";
 				};
-				can2_rst {
-					gpio-hog;
-					gpios = <8 GPIO_ACTIVE_HIGH>;
-					output-high;
-					line-name = "can2_rst";
-				};
 				/* CAN3 */
 				can3_stby {
 					gpio-hog;
@@ -1166,12 +1180,6 @@
 					output-high;
 					line-name = "can3_120R_load";
 				};
-				can3_rst {
-					gpio-hog;
-					gpios = <9 GPIO_ACTIVE_HIGH>;
-					output-high;
-					line-name = "can3_rst";
-				};
 			};
 		};
 
-- 
2.7.4

