i use the kernel pulled from NXP's https://source.codeaurora.org/external/imx/linux-imx branch imx_5.4.24_2.1.0.
Default in that kernel's device tree , uart do not use DMA .
And i need to enable uart dma in my product, so i modify:
arch/arm/boot/dts/imx6ull-myboard.dts
&uart3 {
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_uart3>;
+dmas = <&sdma 29 4 0>, <&sdma 30 4 0>;
+dma-names = "rx", "tx";
status = "okay";
};
drivers/tty/serial/imx.c
@@ -1315,6 +1315,7 @@ static int imx_uart_dma_init(struct imx_port *sport)
goto err;
}
+printk("imx_uart_dma_init: sport=%p done.\n", sport); // for make sure dma is enable
return 0;
err:
imx_uart_dma_exit(sport);
it take 5 seconds to finish:
root@Router:~# echo a > /dev/ttymxc2
[ 3795.288472] imx_uart_dma_init: sport=f416546c done.
root@Router:~#
why hang 5 seconds when uart send?
and tx num increate a lot even only send one data:
2: uart:IMX mmio:0x021EC000 irq:53 tx:28693 rx:28672 DSR|CD
2: uart:IMX mmio:0x021EC000 irq:53 tx:32790 rx:32768 DSR|CD