From 0de1b5fa9c4c21178da7292ed5d5e22ee2031bbf Mon Sep 17 00:00:00 2001
From: Phil Elwell <phil@raspberrypi.com>
Date: Tue, 16 Dec 2025 14:02:11 +0000
Subject: [PATCH] overlays: Fix the rs485 support in uart[2345]

Errors in the uart{2,3,4,5} overlays cause some parameters to have no
effect. Fix the problem by moving the rs485 label and by declaring
rs485-rts-active-low as a boolean.

Fixes: 9d79fae257c7 ("Add RS485 mode support for UART2, UART3, UART4, and UART5.")
See: https://forums.raspberrypi.com/viewtopic.php?t=394687
Signed-off-by: Phil Elwell <phil@raspberrypi.com>
---
 arch/arm/boot/dts/overlays/uart2-overlay.dts | 6 +++---
 arch/arm/boot/dts/overlays/uart3-overlay.dts | 6 +++---
 arch/arm/boot/dts/overlays/uart4-overlay.dts | 6 +++---
 arch/arm/boot/dts/overlays/uart5-overlay.dts | 6 +++---
 4 files changed, 12 insertions(+), 12 deletions(-)

--- a/arch/arm/boot/dts/overlays/uart2-overlay.dts
+++ b/arch/arm/boot/dts/overlays/uart2-overlay.dts
@@ -19,9 +19,9 @@
 		};
 	};
 
-	rs485: fragment@2 {
+	fragment@2 {
 		target = <&uart2>;
-		__dormant__ {
+		rs485: __dormant__ {
 			linux,rs485-enabled-at-boot-time;
 			rs485-rts-delay = <0 0>;
 		};
@@ -30,7 +30,7 @@
 	__overrides__ {
 		ctsrts = <0>,"=1";
 		rs485 = <0>,"=1=2";
-		rs485_invert_rts = <&rs485>,"rs485-rts-active-low";
+		rs485_invert_rts = <&rs485>,"rs485-rts-active-low?";
 		rs485_rts_on_delay = <&rs485>, "rs485-rts-delay:0";
 		rs485_rts_off_delay = <&rs485>, "rs485-rts-delay:4";
 	};
--- a/arch/arm/boot/dts/overlays/uart3-overlay.dts
+++ b/arch/arm/boot/dts/overlays/uart3-overlay.dts
@@ -19,9 +19,9 @@
 		};
 	};
 
-	rs485: fragment@2 {
+	fragment@2 {
 		target = <&uart3>;
-		__dormant__ {
+		rs485: __dormant__ {
 			linux,rs485-enabled-at-boot-time;
 			rs485-rts-delay = <0 0>;
 		};
@@ -30,7 +30,7 @@
 	__overrides__ {
 		ctsrts = <0>,"=1";
 		rs485 = <0>,"=1=2";
-		rs485_invert_rts = <&rs485>,"rs485-rts-active-low";
+		rs485_invert_rts = <&rs485>,"rs485-rts-active-low?";
 		rs485_rts_on_delay = <&rs485>, "rs485-rts-delay:0";
 		rs485_rts_off_delay = <&rs485>, "rs485-rts-delay:4";
 	};
--- a/arch/arm/boot/dts/overlays/uart4-overlay.dts
+++ b/arch/arm/boot/dts/overlays/uart4-overlay.dts
@@ -19,9 +19,9 @@
 		};
 	};
 
-	rs485: fragment@2 {
+	fragment@2 {
 		target = <&uart4>;
-		__dormant__ {
+		rs485: __dormant__ {
 			linux,rs485-enabled-at-boot-time;
 			rs485-rts-delay = <0 0>;
 		};
@@ -30,7 +30,7 @@
 	__overrides__ {
 		ctsrts = <0>,"=1";
 		rs485 = <0>,"=1=2";
-		rs485_invert_rts = <&rs485>,"rs485-rts-active-low";
+		rs485_invert_rts = <&rs485>,"rs485-rts-active-low?";
 		rs485_rts_on_delay = <&rs485>, "rs485-rts-delay:0";
 		rs485_rts_off_delay = <&rs485>, "rs485-rts-delay:4";
 	};
--- a/arch/arm/boot/dts/overlays/uart5-overlay.dts
+++ b/arch/arm/boot/dts/overlays/uart5-overlay.dts
@@ -19,9 +19,9 @@
 		};
 	};
 
-	rs485: fragment@2 {
+	fragment@2 {
 		target = <&uart5>;
-		__dormant__ {
+		rs485: __dormant__ {
 			linux,rs485-enabled-at-boot-time;
 			rs485-rts-delay = <0 0>;
 		};
@@ -30,7 +30,7 @@
 	__overrides__ {
 		ctsrts = <0>,"=1";
 		rs485 = <0>,"=1=2";
-		rs485_invert_rts = <&rs485>,"rs485-rts-active-low";
+		rs485_invert_rts = <&rs485>,"rs485-rts-active-low?";
 		rs485_rts_on_delay = <&rs485>, "rs485-rts-delay:0";
 		rs485_rts_off_delay = <&rs485>, "rs485-rts-delay:4";
 	};
