I am trying to set up the i.MX6 uart1 port as a DTE port to connect to a modem with full modem control. Linux kernel is 3.10.17-1.0.2_ga. I am seeing odd behaviour for the DCEDTE bit.
If I add the fsl,dte-mode property to my device tree, I see the property reflected in the kernel view of the device tree (/proc/device-tree/soc/aips-bus@02000000/spba-bus@02000000/serial@02020000/fsl,dte-mode file exists). If I look at the UART1_UFCR register, the DCEDTE bit is not set. At this no software has the port open (co console, no getty, no ppp, no autodialer). When I check the IOMUXC all of the uart IO selected for uart1.
# /unit_tests/memtool UART1.UFCR
SOC: i.MX6DL
UART1 Addr:0x2020000
UART1.UFCR Addr:0x02020090 Value:0x00000801 -
UART1.UFCR.RXTL(0..5) :0x1
Receiver Trigger Level .
UART1.UFCR.DCEDTE(6..6) :0x0 <---------------------
DCE/DTE mode select .
UART1.UFCR.RFDIV(7..9) :0x0
Reference Frequency Divider.
UART1.UFCR.TXTL(10..15) :0x2
Transmitter Trigger Level .
Digging in drivers/tty/serial/imx.c it looks like the DCEDTE bit is set in imx_set_termios(). As far as I can tell this function isn't called unless the port is opened.
I think this is a bug - DCEDTE affects the IOMUX direction for all the port bits. It seems to me that it should be set much earlier, preserved across the whole driver, and set regardless if the port is opened or not to minimize any IO contention.
Hi Andrew,
Could you prepare a patch (against kernel 3.19 or 4.0-rc7) and submit it to linux-serial mailing list for review and discuss?
Regards,
Fabio Estevam
Unfortunately time constraints prevent me from doing this. We reversed the connections on the uart on the PCB, abandoned using the additional flow control bits and use DCE mode now.
Basically it is the right approach to implement UART features through
the Device Tree, in order to provide all the driver settings on the Device
Tree and avoid conflicts by setting the register manually outside it.
Perhaps, You would need to modify the driver (and - maybe - add the
required feature to the Device Tree for selected UART port.
Have a great day,
Yuri
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
I'm not saying implementing the feature via device tree is wrong. I think the implementation of the IO setup in the driver is in the wrong place and should happen as soon as possible.