Skip to content

Commit 9d79fae

Browse files
TheMightyMadmanpelwell
authored andcommitted
Add RS485 mode support for UART2, UART3, UART4, and UART5.
1 parent e6dcab6 commit 9d79fae

File tree

5 files changed

+100
-0
lines changed

5 files changed

+100
-0
lines changed

arch/arm/boot/dts/overlays/README

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5190,6 +5190,19 @@ Name: uart2
51905190
Info: Enable uart 2 on GPIOs 0-3. BCM2711 only.
51915191
Load: dtoverlay=uart2,<param>
51925192
Params: ctsrts Enable CTS/RTS on GPIOs 2-3 (default off)
5193+
rs485 Enable RS485 mode for using the RTS line to
5194+
drive the OE pin of an RS485 transceiver (i.e.
5195+
MAX3078E); also enables the UARTx ctsrts
5196+
parameter, as RTS is required (default off).
5197+
rs485_invert_rts When RS485 mode is enabled, inverts the RTS
5198+
line from active-high (default) to active-low
5199+
(default off).
5200+
rs485_rts_on_delay When RS485 mode is enabled, sets the delay (in
5201+
milliseconds) between data transmission starting
5202+
and the RTS line being asserted (default 0).
5203+
rs485_rts_off_delay When RS485 mode is enabled, sets the delay (in
5204+
milliseconds) between data transmission ending
5205+
and the RTS line being deasserted (default 0).
51935206

51945207

51955208
Name: uart2-pi5
@@ -5202,6 +5215,19 @@ Name: uart3
52025215
Info: Enable uart 3 on GPIOs 4-7. BCM2711 only.
52035216
Load: dtoverlay=uart3,<param>
52045217
Params: ctsrts Enable CTS/RTS on GPIOs 6-7 (default off)
5218+
rs485 Enable RS485 mode for using the RTS line to
5219+
drive the OE pin of an RS485 transceiver (i.e.
5220+
MAX3078E); also enables the UARTx ctsrts
5221+
parameter, as RTS is required (default off).
5222+
rs485_invert_rts When RS485 mode is enabled, inverts the RTS
5223+
line from active-high (default) to active-low
5224+
(default off).
5225+
rs485_rts_on_delay When RS485 mode is enabled, sets the delay (in
5226+
milliseconds) between data transmission starting
5227+
and the RTS line being asserted (default 0).
5228+
rs485_rts_off_delay When RS485 mode is enabled, sets the delay (in
5229+
milliseconds) between data transmission ending
5230+
and the RTS line being deasserted (default 0).
52055231

52065232

52075233
Name: uart3-pi5
@@ -5214,6 +5240,19 @@ Name: uart4
52145240
Info: Enable uart 4 on GPIOs 8-11. BCM2711 only.
52155241
Load: dtoverlay=uart4,<param>
52165242
Params: ctsrts Enable CTS/RTS on GPIOs 10-11 (default off)
5243+
rs485 Enable RS485 mode for using the RTS line to
5244+
drive the OE pin of an RS485 transceiver (i.e.
5245+
MAX3078E); also enables the UARTx ctsrts
5246+
parameter, as RTS is required (default off).
5247+
rs485_invert_rts When RS485 mode is enabled, inverts the RTS
5248+
line from active-high (default) to active-low
5249+
(default off).
5250+
rs485_rts_on_delay When RS485 mode is enabled, sets the delay (in
5251+
milliseconds) between data transmission starting
5252+
and the RTS line being asserted (default 0).
5253+
rs485_rts_off_delay When RS485 mode is enabled, sets the delay (in
5254+
milliseconds) between data transmission ending
5255+
and the RTS line being deasserted (default 0).
52175256

52185257

52195258
Name: uart4-pi5
@@ -5226,6 +5265,19 @@ Name: uart5
52265265
Info: Enable uart 5 on GPIOs 12-15. BCM2711 only.
52275266
Load: dtoverlay=uart5,<param>
52285267
Params: ctsrts Enable CTS/RTS on GPIOs 14-15 (default off)
5268+
rs485 Enable RS485 mode for using the RTS line to
5269+
drive the OE pin of an RS485 transceiver (i.e.
5270+
MAX3078E); also enables the UARTx ctsrts
5271+
parameter, as RTS is required (default off).
5272+
rs485_invert_rts When RS485 mode is enabled, inverts the RTS
5273+
line from active-high (default) to active-low
5274+
(default off).
5275+
rs485_rts_on_delay When RS485 mode is enabled, sets the delay (in
5276+
milliseconds) between data transmission starting
5277+
and the RTS line being asserted (default 0).
5278+
rs485_rts_off_delay When RS485 mode is enabled, sets the delay (in
5279+
milliseconds) between data transmission ending
5280+
and the RTS line being deasserted (default 0).
52295281

52305282

52315283
Name: udrc

arch/arm/boot/dts/overlays/uart2-overlay.dts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,19 @@
1919
};
2020
};
2121

22+
rs485: fragment@2 {
23+
target = <&uart2>;
24+
__dormant__ {
25+
linux,rs485-enabled-at-boot-time;
26+
rs485-rts-delay = <0 0>;
27+
};
28+
};
29+
2230
__overrides__ {
2331
ctsrts = <0>,"=1";
32+
rs485 = <0>,"=1=2";
33+
rs485_invert_rts = <&rs485>,"rs485-rts-active-low";
34+
rs485_rts_on_delay = <&rs485>, "rs485-rts-delay:0";
35+
rs485_rts_off_delay = <&rs485>, "rs485-rts-delay:4";
2436
};
2537
};

arch/arm/boot/dts/overlays/uart3-overlay.dts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,19 @@
1919
};
2020
};
2121

22+
rs485: fragment@2 {
23+
target = <&uart3>;
24+
__dormant__ {
25+
linux,rs485-enabled-at-boot-time;
26+
rs485-rts-delay = <0 0>;
27+
};
28+
};
29+
2230
__overrides__ {
2331
ctsrts = <0>,"=1";
32+
rs485 = <0>,"=1=2";
33+
rs485_invert_rts = <&rs485>,"rs485-rts-active-low";
34+
rs485_rts_on_delay = <&rs485>, "rs485-rts-delay:0";
35+
rs485_rts_off_delay = <&rs485>, "rs485-rts-delay:4";
2436
};
2537
};

arch/arm/boot/dts/overlays/uart4-overlay.dts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,19 @@
1919
};
2020
};
2121

22+
rs485: fragment@2 {
23+
target = <&uart4>;
24+
__dormant__ {
25+
linux,rs485-enabled-at-boot-time;
26+
rs485-rts-delay = <0 0>;
27+
};
28+
};
29+
2230
__overrides__ {
2331
ctsrts = <0>,"=1";
32+
rs485 = <0>,"=1=2";
33+
rs485_invert_rts = <&rs485>,"rs485-rts-active-low";
34+
rs485_rts_on_delay = <&rs485>, "rs485-rts-delay:0";
35+
rs485_rts_off_delay = <&rs485>, "rs485-rts-delay:4";
2436
};
2537
};

arch/arm/boot/dts/overlays/uart5-overlay.dts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,19 @@
1919
};
2020
};
2121

22+
rs485: fragment@2 {
23+
target = <&uart5>;
24+
__dormant__ {
25+
linux,rs485-enabled-at-boot-time;
26+
rs485-rts-delay = <0 0>;
27+
};
28+
};
29+
2230
__overrides__ {
2331
ctsrts = <0>,"=1";
32+
rs485 = <0>,"=1=2";
33+
rs485_invert_rts = <&rs485>,"rs485-rts-active-low";
34+
rs485_rts_on_delay = <&rs485>, "rs485-rts-delay:0";
35+
rs485_rts_off_delay = <&rs485>, "rs485-rts-delay:4";
2436
};
2537
};

0 commit comments

Comments
 (0)