大家好,
官方默认只通两个串口,现在我要使用多个串口,内核是linux-3.0.35的,我修改如下:
添加串口需要修改如下5个文件的内容,分别是board-mx6q_sabresd.h、board-mx6q_sabresd.c、platform-imx-uart.c、clock.c、mx6.h
修改如下:
1.board-mx6q_sabresd.h(kernel_imx/arch/arm/mach-mx6)
/*UART2 */
MX6Q_PAD_EIM_D26_UART2_TXD,
MX6Q_PAD_EIM_D27_UART2_RXD,
/*UART4*/
MX6Q_PAD_KEY_COL0_UART4_RXD,
MX6Q_PAD_KEY_ROW0_UART4_TXD,
/*UART5 */
MX6Q_PAD_KEY_COL1_UART5_RXD,
MX6Q_PAD_KEY_ROW1_UART5_TXD,
2.board-mx6q_sabresd.c(kernel_imx/arch/arm/mach-mx6)
static inline void mx6q_sabresd_init_uart(void)
{
imx6q_add_imx_uart(0,NULL);
imx6q_add_imx_uart(1,NULL);
imx6q_add_imx_uart(2,NULL);
imx6q_add_imx_uart(3,NULL);
imx6q_add_imx_uart(4,NULL);
}
3.platform-imx-uart.c(kernel_imx/arch/arm/plat-mxc/devices)
#define imx6q_imx_uart_data_entry(_id, _hwid)
imx_imx_uart_lirq_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),
imx6q_imx_uart_data_entry(4,5),
};
4.clock.c(kernel_imx/arch/arm/mach-mx6)
_REGISTER_CLOCK("imx_uart.0", NULL, uart_clk[0]),
_REGISTER_CLOCK("imx_uart.1", NULL, uart_clk[0]),
_REGISTER_CLOCK("imx_uart.2", NULL, uart_clk[0]),
_REGISTER_CLOCK("imx_uart.3", NULL, uart_clk[0]),
_REGISTER_CLOCK("imx_uart.4", NULL, uart_clk[0]),
5.mx6.h(kernel_imx/arch/arm/plat-mxc/include/mach)
#define MX6Q_UART1_BASE_ADDR UART1_BASE_ADDR
#define MX6Q_UART2_BASE_ADDR UART2_BASE_ADDR
#define MX6Q_UART3_BASE_ADDR UART3_BASE_ADDR
#define MX6Q_UART4_BASE_ADDR UART4_BASE_ADDR
#define MX6Q_UART5_BASE_ADDR UART5_BASE_ADDR
#define MX6Q_INT_UART1 MXC_INT_UART1_ANDED
#define MX6Q_INT_UART2 MXC_INT_UART2_ANDED
#define MX6Q_INT_UART3 MXC_INT_UART3_ANDED
#define MX6Q_INT_UART4 MXC_INT_UART4_ANDED
#define MX6Q_INT_UART5 MXC_INT_UART5_ANDED
但是这样配置后,重新编译内核,烧写到板子上,用相应的工具,还是只能识别原来的ttymxc0和ttymxc2这两个,系统启动log中,也只有
Serial: IMX driver
imx-uart.2: ttymxc2 at MMIO 0x21ec000 (irq = 60) is a IMX
imx-uart.0: ttymxc0 at MMIO 0x2020000 (irq = 58) is a IMX
console [ttymxc0] enabled, bootconsole disabled
console [ttymxc0] enabled, bootconsole disabled
请问一下,我是不是还有地方没有改,所以串口没有生效??谢谢! |