Greetings,
I have a custom MX6 board where we've have a DB-9 serial connection on UART5. We're running the most recent Ubuntu Linux on the system. How can I configure the system to start a getty on that device at bootup?
Thanks,
FM
Solved! Go to Solution.
So you hope to use UART5 as console output port. Right?
You can check the followings:
1. Ensure you have config UART5 relative pins.
2. Set early UART as UART5 if you hope to use UART5 as early console output.
uart_clk = clk_get_sys("imx-uart.4", NULL);
early_console_setup((UART5_BASE_ADDR, uart_clk);
3. Add UART5 device: imx6q_add_imx_uart(4, NULL). If you have UART platform data, you should set accordingly. I saw your early mx6_sabresd_uart4_data __initconst is wrong. Because you mention you don't have RTS/CTS, but you enable it into the flags.
4. Then you can change your console output as UART5 into command line when you boot: console=ttymxc4.
5. For getty, you can check etc/init. If you don't want to modify getty, another method - you can change as imx6q_imx_uart_data_entry(0, 5) in arch/arm/plat-mxc/devices/platform-imx-uart.c. Then use 0 for UART5 in other step 3 and 4.
Please read the document BSP_Porting_Guide_L3.0.35_1.1.0.pdf. ( Chapter 3 -- Registering a New UART Driver ) for the details. You can download the Linux BSP document bundle from here: http://www.freescale.com/webapp/sps/site/prod_summary.jsp?code=IMX6_SW
Hi Jimmy,
Thanks for the reply. I've done all of this and incorporated some other advice that was given to me on another thread. So I have the following changes in board-mx6q_sabresd.c:
// <added>
static const struct imxuart_platform_data
mx6_sabresd_uart4_data __initconst = {
.flags = IMXUART_HAVE_RTSCTS | IMXUART_SDMA,
.dma_req_rx = MX6Q_DMA_REQ_UART5_RX,
.dma_req_tx = MX6Q_DMA_REQ_UART5_TX,
};
// </added>
static inline void mx6q_sabresd_init_uart(void)
{
imx6q_add_imx_uart(0, NULL);
// imx6q_add_imx_uart(2, NULL);
imx6q_add_imx_uart(4, &mx6_sabresd_uart4_data);
// imx6q_add_imx_uart(4, NULL);
// imx6q_add_imx_uart(0, NULL);
}
This is the output I get when I try to boot this. For some reason it doesnt appear to be applying these parameters to UART5. The kernel boot hangs at this point as well. Any thoughts?
imx-sdma imx-sdma: loaded firmware 1.1
imx-sdma imx-sdma: initialized
Serial: IMX driver
imx-uart.0: ttymxc0 at MMIO 0x2020000 (irq = 58) is a IMX
console [ttymxc0] enabled, bootconsole disabled
console [ttymxc0] enabled, bootconsole disabled
imx-uart.1: ttymxc1 at MMIO 0x2184200 (irq = 2) is a IMX
According to the Linux BSP reference manual (Linux_6DQ_RM_L3.0.35_1.1.0.pdf) Chapter 38 -- UART driver, there is a note (attach below) that DMA may be abnormal if not enable RTS/CTS. So please try to enable RTS/CTS.
NOTE :
If you want to use the DMA support for UART please also enable the RTS/CTS for it. The DMA may be abnormal if you do not enable the RTS/CTS.
In addition to the changes you mentioned, I've found I need to do the following changes as well. First in linux/arch/arm/plat-mxc/include/mach/mx6.h:
// <added>
#define MX6Q_UART5_BASE_ADDR 0x021f4000
// </added>
I also had to add an entry in the ..._uart_data[] table for UART5 in linux/arch/arm/plat-mxc/devices/platform-imx-usrt.c:
#ifdef CONFIG_SOC_IMX6Q
const struct imx_imx_uart_1irq_data imx6q_imx_uart_data[] __initconst = {
#define imx6q_imx_uart_data_entry(_id, _hwid) \
imx_imx_uart_1irq_data_entry(MX6Q, _id, _hwid, SZ_4K)
imx6q_imx_uart_data_entry(0, 1),
imx6q_imx_uart_data_entry(1, 2),
imx6q_imx_uart_data_entry(2, 3),
imx6q_imx_uart_data_entry(3, 4),
// <added>
imx6q_imx_uart_data_entry(4, 5),
// </added>
};
#endif /* ifdef CONFIG_SOC_IMX6Q */
These two changes allow the kernel to boot but when I look at the kernel output I get this:
imx-uart.0: ttymxc0 at MMIO 0x20200000 (irq = 58) is a IMX
imx-uart: probe of imx-uart.4 failed with error -2
Any thoughts on this error code?
Thanks,
FM
So you hope to use UART5 as console output port. Right?
You can check the followings:
1. Ensure you have config UART5 relative pins.
2. Set early UART as UART5 if you hope to use UART5 as early console output.
uart_clk = clk_get_sys("imx-uart.4", NULL);
early_console_setup((UART5_BASE_ADDR, uart_clk);
3. Add UART5 device: imx6q_add_imx_uart(4, NULL). If you have UART platform data, you should set accordingly. I saw your early mx6_sabresd_uart4_data __initconst is wrong. Because you mention you don't have RTS/CTS, but you enable it into the flags.
4. Then you can change your console output as UART5 into command line when you boot: console=ttymxc4.
5. For getty, you can check etc/init. If you don't want to modify getty, another method - you can change as imx6q_imx_uart_data_entry(0, 5) in arch/arm/plat-mxc/devices/platform-imx-uart.c. Then use 0 for UART5 in other step 3 and 4.
This is the code I had to add to make this work but it is finally working!
diff board-mx6q_sabresd.h board-mx6q_sabresd.h.bak
44,46c44,45
< // MX6Q_PAD_KEY_COL1__ECSPI1_MISO,
< // MX6Q_PAD_KEY_ROW1__GPIO_4_9,
<
---
> MX6Q_PAD_KEY_COL1__ECSPI1_MISO,
> MX6Q_PAD_KEY_ROW1__GPIO_4_9,
182,191c181,182
< // MX6Q_PAD_EIM_D24__UART3_TXD,
< // MX6Q_PAD_EIM_D25__UART3_RXD,
<
< // <added>
< /* UART5 for external serial port */
< MX6Q_PAD_KEY_COL1__UART5_TXD,
< MX6Q_PAD_KEY_ROW1__UART5_RXD,
< MX6Q_PAD_KEY_COL4__UART5_RTS,
< MX6Q_PAD_KEY_ROW4__UART5_CTS,
< // </added>
---
> MX6Q_PAD_EIM_D24__UART3_TXD,
> MX6Q_PAD_EIM_D25__UART3_RXD,
225,228c216,219
< //MX6Q_PAD_SD3_DAT4__USDHC3_DAT4_50MHZ,
< //MX6Q_PAD_SD3_DAT5__USDHC3_DAT5_50MHZ,
< //MX6Q_PAD_SD3_DAT6__USDHC3_DAT6_50MHZ,
< //MX6Q_PAD_SD3_DAT7__USDHC3_DAT7_50MHZ,
---
> MX6Q_PAD_SD3_DAT4__USDHC3_DAT4_50MHZ,
> MX6Q_PAD_SD3_DAT5__USDHC3_DAT5_50MHZ,
> MX6Q_PAD_SD3_DAT6__USDHC3_DAT6_50MHZ,
> MX6Q_PAD_SD3_DAT7__USDHC3_DAT7_50MHZ,
265c256
< // MX6Q_PAD_KEY_COL4__GPIO_4_14, /* PCIE_DIS */
---
> MX6Q_PAD_KEY_COL4__GPIO_4_14, /* PCIE_DIS */
diff board-mx6q_sabresd.c board-mx6q_sabresd.c.bak
249a249
> imx6q_add_imx_uart(2, NULL);
251d250
< // imx6q_add_imx_uart(2, NULL);
1919,1923c1918,1919
< // uart_clk = clk_get_sys("imx-uart.0", NULL);
< uart_clk = clk_get_sys("imx-uart.4", NULL);
<
< // early_console_setup(UART1_BASE_ADDR, uart_clk);
< early_console_setup(UART5_BASE_ADDR, uart_clk);
---
> uart_clk = clk_get_sys("imx-uart.0", NULL);
> early_console_setup(UART1_BASE_ADDR, uart_clk);
diff platform-imx-uart.c platform-imx-uart.c.bak
133,139c133,136
<
< // imx6q_imx_uart_data_entry(0, 1),
< imx6q_imx_uart_data_entry(0, 5),
<
< // imx6q_imx_uart_data_entry(1, 2),
< // imx6q_imx_uart_data_entry(2, 3),
< // imx6q_imx_uart_data_entry(3, 4),
---
> imx6q_imx_uart_data_entry(0, 1),
> imx6q_imx_uart_data_entry(1, 2),
> imx6q_imx_uart_data_entry(2, 3),
> imx6q_imx_uart_data_entry(3, 4),
diff mx6.h mx6.h.bak
286,290d285
<
< // <added>
< #define MX6Q_UART5_BASE_ADDR 0x021f4000
< // </added>
<
494,498d488
<
< // <added>
< #define MX6Q_INT_UART5 MXC_INT_UART5_ANDED
< // </added>
<
I've seen this note. Is there anyway to bring up a UART without RTS/CTS? UART1 on this board has only the TX/RX lines connected. I'm getting a login prompt on that port but cannot input anything to it from minicom on a Linux laptop.
Thanks,
FM