162306a36Sopenharmony_ci// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
262306a36Sopenharmony_ci/*
362306a36Sopenharmony_ci * Copyright 2021 Gateworks Corporation
462306a36Sopenharmony_ci *
562306a36Sopenharmony_ci * GW73xx RS485 HD:
662306a36Sopenharmony_ci *  - GPIO1_0 rs485_term selects on-chip termination
762306a36Sopenharmony_ci *  - GPIO4_0 rs485_en needs to be driven high (active)
862306a36Sopenharmony_ci *  - GPIO4_2 rs485_hd needs to be driven high (active)
962306a36Sopenharmony_ci *  - UART4_TX is DE for RS485 transmitter
1062306a36Sopenharmony_ci *  - RS485_EN needs to be pulled high
1162306a36Sopenharmony_ci *  - RS485_HALF needs to be pulled high
1262306a36Sopenharmony_ci */
1362306a36Sopenharmony_ci
1462306a36Sopenharmony_ci#include <dt-bindings/gpio/gpio.h>
1562306a36Sopenharmony_ci
1662306a36Sopenharmony_ci#include "imx8mm-pinfunc.h"
1762306a36Sopenharmony_ci
1862306a36Sopenharmony_ci/dts-v1/;
1962306a36Sopenharmony_ci/plugin/;
2062306a36Sopenharmony_ci
2162306a36Sopenharmony_ci&{/} {
2262306a36Sopenharmony_ci	compatible = "gw,imx8mm-gw73xx-0x";
2362306a36Sopenharmony_ci};
2462306a36Sopenharmony_ci
2562306a36Sopenharmony_ci&gpio4 {
2662306a36Sopenharmony_ci	rs485_en {
2762306a36Sopenharmony_ci		gpio-hog;
2862306a36Sopenharmony_ci		gpios = <0 GPIO_ACTIVE_HIGH>;
2962306a36Sopenharmony_ci		output-high;
3062306a36Sopenharmony_ci		line-name = "rs485_en";
3162306a36Sopenharmony_ci	};
3262306a36Sopenharmony_ci
3362306a36Sopenharmony_ci	rs485_hd {
3462306a36Sopenharmony_ci		gpio-hog;
3562306a36Sopenharmony_ci		gpios = <2 GPIO_ACTIVE_HIGH>;
3662306a36Sopenharmony_ci		output-high;
3762306a36Sopenharmony_ci		line-name = "rs485_hd";
3862306a36Sopenharmony_ci	};
3962306a36Sopenharmony_ci};
4062306a36Sopenharmony_ci
4162306a36Sopenharmony_ci&uart2 {
4262306a36Sopenharmony_ci	pinctrl-names = "default";
4362306a36Sopenharmony_ci	pinctrl-0 = <&pinctrl_uart2>;
4462306a36Sopenharmony_ci	rts-gpios = <&gpio5 29 GPIO_ACTIVE_HIGH>;
4562306a36Sopenharmony_ci	linux,rs485-enabled-at-boot-time;
4662306a36Sopenharmony_ci	status = "okay";
4762306a36Sopenharmony_ci};
4862306a36Sopenharmony_ci
4962306a36Sopenharmony_ci&uart4 {
5062306a36Sopenharmony_ci	status = "disabled";
5162306a36Sopenharmony_ci};
5262306a36Sopenharmony_ci
5362306a36Sopenharmony_ci&iomuxc {
5462306a36Sopenharmony_ci	pinctrl_uart2: uart2grp {
5562306a36Sopenharmony_ci		fsl,pins = <
5662306a36Sopenharmony_ci			MX8MM_IOMUXC_UART2_RXD_UART2_DCE_RX     0x140
5762306a36Sopenharmony_ci			MX8MM_IOMUXC_UART2_TXD_UART2_DCE_TX     0x140
5862306a36Sopenharmony_ci			MX8MM_IOMUXC_UART4_TXD_GPIO5_IO29	0x140
5962306a36Sopenharmony_ci		>;
6062306a36Sopenharmony_ci	};
6162306a36Sopenharmony_ci};
62