Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: (GPL-2.0+ OR MIT)
0002 /*
0003  * Copyright 2022 Gateworks Corporation
0004  *
0005  * GW72xx RS422 (RS485 full duplex):
0006  *  - GPIO1_0 rs485_term selects on-chip termination
0007  *  - GPIO4_0 rs485_en needs to be driven high (active)
0008  *  - GPIO4_2 rs485_hd needs to be driven low (in-active)
0009  *  - UART4_TX is DE for RS485 transmitter
0010  *  - RS485_EN needs to be pulled high
0011  *  - RS485_HALF needs to be low
0012  */
0013 
0014 #include <dt-bindings/gpio/gpio.h>
0015 
0016 #include "imx8mm-pinfunc.h"
0017 
0018 /dts-v1/;
0019 /plugin/;
0020 
0021 &{/} {
0022         compatible = "gw,imx8mm-gw72xx-0x";
0023 };
0024 
0025 &gpio4 {
0026         rs485_en {
0027                 gpio-hog;
0028                 gpios = <0 GPIO_ACTIVE_HIGH>;
0029                 output-high;
0030                 line-name = "rs485_en";
0031         };
0032 
0033         rs485_hd {
0034                 gpio-hog;
0035                 gpios = <2 GPIO_ACTIVE_HIGH>;
0036                 output-low;
0037                 line-name = "rs485_hd";
0038         };
0039 };
0040 
0041 &uart2 {
0042         pinctrl-names = "default";
0043         pinctrl-0 = <&pinctrl_uart2>;
0044         rts-gpios = <&gpio5 29 GPIO_ACTIVE_HIGH>;
0045         linux,rs485-enabled-at-boot-time;
0046         status = "okay";
0047 };
0048 
0049 &uart4 {
0050         status = "disabled";
0051 };
0052 
0053 &iomuxc {
0054         pinctrl_uart2: uart2grp {
0055                 fsl,pins = <
0056                         MX8MM_IOMUXC_UART2_RXD_UART2_DCE_RX     0x140
0057                         MX8MM_IOMUXC_UART2_TXD_UART2_DCE_TX     0x140
0058                         MX8MM_IOMUXC_UART4_TXD_GPIO5_IO29       0x140
0059                 >;
0060         };
0061 };