UART4 on iMX7D as RS485 with GPIO failed

Hello,

I am trying to bring up our new carrier board which contains two RS485 interfaces.
The first interface is connected to UARTC and the second to UARTD.

RS485 #1
DE/nRE = SODIMM 30
RX = SODIMM 19
TX = SODIMM 21

RS485 #2
DE/nRE = SODIMM 94
RX = SODIMM 29
TX = SODIMM 37

I have modified the device to use the DE/nRE pins as GPIOs within the driver and set the corresponding rts-gpios property:

//RS485 #1
&uart3 {	
	pinctrl-names = "default";
	pinctrl-0 = <&pinctrl_uart3>;
	
	rts-gpios = <&gpio1 10 GPIO_ACTIVE_HIGH>;
	
	/delete-property/uart-has-rtscts;
	linux,rs485-enabled-at-boot-time;
	
	status = "okay";
};

//RS485 #2
&uart4 {		
	pinctrl-names = "default";
	pinctrl-0 = <&pinctrl_uart4>;
	
	assigned-clocks = <&clks IMX7D_UART4_ROOT_SRC>;
	assigned-clock-parents = <&clks IMX7D_OSC_24M_CLK>;
	fsl,dte-mode;    	
	
	rts-gpios = <&gpio4 13 GPIO_ACTIVE_HIGH>;
	
	/delete-property/uart-has-rtscts;
	linux,rs485-enabled-at-boot-time;
	
	status = "okay";
};

The first RS485 work as expected and I am able to communicate but the kernel shows an error during the initialisation of UART4. It points out that it cannot get GPIO1_10, although it is not present in the UART4 pin configuration.

[    0.106154] 30860000.serial: ttymxc0 at MMIO 0x30860000 (irq = 47, base_baud = 1500000) is a IMX
[    0.827399] console [ttymxc0] enabled
[    0.831719] 30890000.serial: ttymxc1 at MMIO 0x30890000 (irq = 48, base_baud = 1500000) is a IMX
[    0.841123] 30880000.serial: ttymxc2 at MMIO 0x30880000 (irq = 49, base_baud = 1500000) is a IMX
[    0.850287] imx7d-pinctrl 30330000.iomuxc: pin MX7D_PAD_GPIO1_IO10 already requested by 30330000.iomuxc; cannot claim for 30a60000.serial
[    0.862691] imx7d-pinctrl 30330000.iomuxc: pin-7 (30a60000.serial) status -22
[    0.869861] imx7d-pinctrl 30330000.iomuxc: could not request pin 7 (MX7D_PAD_GPIO1_IO10) from group uart4-grp  on device 30330000.iomuxc
[    0.882155] imx-uart 30a60000.serial: Error applying setting, reverse things back
[    0.889682] imx-uart: probe of 30a60000.serial failed with error -22
[    0.903316] loop: module loaded
[    0.921824] libphy: Fixed MDIO Bus: probed
[    0.929056] pps pps0: new PPS source ptp0

Am I missing something?
Thx M

Thank you for your suggestions, I have found the problem.
The pins where defined within iomuxc but they have to be in section iomuxc_lpsr .

And additional to the pin configuration I have to use Uart5 for UARTD however.
Now its working fine.

Hi @gandi and Welcome to the Toradex Community!

[ 0.850287] imx7d-pinctrl 30330000.iomuxc: pin MX7D_PAD_GPIO1_IO10 already requested by 30330000.iomuxc; cannot claim for 30a60000.serial

This means that the PIN is already used somewhere else and you cannot claim with the serial peripheral.

Could you check your device-tree files again?

Thanks and best regards,
Jaski

Perfect that it works. Thanks for the feedback.