Skip to content

Commit ae8cb0d

Browse files
TheMightyMadmanpopcornmix
authored andcommitted
Add RS485 mode support for UART2, UART3, UART4, and UART5.
1 parent dd4594f commit ae8cb0d

File tree

5 files changed

+96
-0
lines changed

5 files changed

+96
-0
lines changed

arch/arm/boot/dts/overlays/README

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5190,6 +5190,18 @@ 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+
rs485_rts_on_delay When RS485 mode is enabled, sets the delay (in
5200+
milliseconds) between data transmission starting
5201+
and the RTS line being asserted (default 0).
5202+
rs485_rts_off_delay When RS485 mode is enabled, sets the delay (in
5203+
milliseconds) between data transmission ending
5204+
and the RTS line being deasserted (default 0).
51935205

51945206

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

52065230

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

52185254

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

52305278

52315279
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)