1*8bab661aSEmmanuel Vadot// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
2*8bab661aSEmmanuel Vadot/*
3*8bab661aSEmmanuel Vadot * Copyright 2021 Gateworks Corporation
4*8bab661aSEmmanuel Vadot *
5*8bab661aSEmmanuel Vadot * GW73xx RS485 HD:
6*8bab661aSEmmanuel Vadot *  - GPIO1_0 rs485_term selects on-chip termination
7*8bab661aSEmmanuel Vadot *  - GPIO4_0 rs485_en needs to be driven high (active)
8*8bab661aSEmmanuel Vadot *  - GPIO4_2 rs485_hd needs to be driven high (active)
9*8bab661aSEmmanuel Vadot *  - UART4_TX is DE for RS485 transmitter
10*8bab661aSEmmanuel Vadot *  - RS485_EN needs to be pulled high
11*8bab661aSEmmanuel Vadot *  - RS485_HALF needs to be pulled high
12*8bab661aSEmmanuel Vadot */
13*8bab661aSEmmanuel Vadot
14*8bab661aSEmmanuel Vadot#include <dt-bindings/gpio/gpio.h>
15*8bab661aSEmmanuel Vadot
16*8bab661aSEmmanuel Vadot#include "imx8mm-pinfunc.h"
17*8bab661aSEmmanuel Vadot
18*8bab661aSEmmanuel Vadot/dts-v1/;
19*8bab661aSEmmanuel Vadot/plugin/;
20*8bab661aSEmmanuel Vadot
21*8bab661aSEmmanuel Vadot&{/} {
22*8bab661aSEmmanuel Vadot	compatible = "gw,imx8mm-gw73xx-0x";
23*8bab661aSEmmanuel Vadot};
24*8bab661aSEmmanuel Vadot
25*8bab661aSEmmanuel Vadot&gpio4 {
26*8bab661aSEmmanuel Vadot	rs485_en {
27*8bab661aSEmmanuel Vadot		gpio-hog;
28*8bab661aSEmmanuel Vadot		gpios = <0 GPIO_ACTIVE_HIGH>;
29*8bab661aSEmmanuel Vadot		output-high;
30*8bab661aSEmmanuel Vadot		line-name = "rs485_en";
31*8bab661aSEmmanuel Vadot	};
32*8bab661aSEmmanuel Vadot
33*8bab661aSEmmanuel Vadot	rs485_hd {
34*8bab661aSEmmanuel Vadot		gpio-hog;
35*8bab661aSEmmanuel Vadot		gpios = <2 GPIO_ACTIVE_HIGH>;
36*8bab661aSEmmanuel Vadot		output-high;
37*8bab661aSEmmanuel Vadot		line-name = "rs485_hd";
38*8bab661aSEmmanuel Vadot	};
39*8bab661aSEmmanuel Vadot};
40*8bab661aSEmmanuel Vadot
41*8bab661aSEmmanuel Vadot&uart2 {
42*8bab661aSEmmanuel Vadot	pinctrl-names = "default";
43*8bab661aSEmmanuel Vadot	pinctrl-0 = <&pinctrl_uart2>;
44*8bab661aSEmmanuel Vadot	rts-gpios = <&gpio5 29 GPIO_ACTIVE_HIGH>;
45*8bab661aSEmmanuel Vadot	linux,rs485-enabled-at-boot-time;
46*8bab661aSEmmanuel Vadot	status = "okay";
47*8bab661aSEmmanuel Vadot};
48*8bab661aSEmmanuel Vadot
49*8bab661aSEmmanuel Vadot&uart4 {
50*8bab661aSEmmanuel Vadot	status = "disabled";
51*8bab661aSEmmanuel Vadot};
52*8bab661aSEmmanuel Vadot
53*8bab661aSEmmanuel Vadot&iomuxc {
54*8bab661aSEmmanuel Vadot	pinctrl_uart2: uart2grp {
55*8bab661aSEmmanuel Vadot		fsl,pins = <
56*8bab661aSEmmanuel Vadot			MX8MM_IOMUXC_UART2_RXD_UART2_DCE_RX     0x140
57*8bab661aSEmmanuel Vadot			MX8MM_IOMUXC_UART2_TXD_UART2_DCE_TX     0x140
58*8bab661aSEmmanuel Vadot			MX8MM_IOMUXC_UART4_TXD_GPIO5_IO29	0x140
59*8bab661aSEmmanuel Vadot		>;
60*8bab661aSEmmanuel Vadot	};
61*8bab661aSEmmanuel Vadot};
62