S3C2440 UART2被配置为CTS问题解决


Linux内核默认把uart2的功能设置为nRTS1、nTCTS1,没有作为正常串口使用,如果我们想要将uart2作为串口,需要做以下修改:linux2.6内核将GPHCON寄存器的值置为0x16faaa就是说GPH6被设置为nRTS1,GPH7被设置为nCTS1,此时,串口2是无法收发数据的。

1、修改arch/arm/mach-s3c2440/mach-smdk2440.c中的uart2的配置,修改后如下:
static struct s3c2410_uartcfg smdk2440_uartcfgs[] __initdata = {
        [0] = {
                .hwport           = 0,
                .flags            = 0,
                .ucon             = 0x3c5,
                .ulcon            = 0x03,
                .ufcon            = 0x51,
        },
        [1] = {
                .hwport           = 1,
                .flags            = 0,
                .ucon             = 0x3c5,
                .ulcon            = 0x03,
                .ufcon            = 0x51,
        },

        /* IR port */

        [2] = {
                .hwport             = 2,
                .flags             = 0,
                .ucon             = 0x3c5,
                .ulcon             = 0x03,/*old0x43*/
                .ufcon             = 0x51,
        }

};

2、vi drivers/serial/samsung.c
//增加以下头文件
#include <linux/gpio.h>
#include <mach/regs-gpio.h>
在static int s3c24xx_serial_startup(struct uart_port *port)函数最后,添加
                s3c2410_gpio_cfgpin(S3C2410_GPH(6), S3C2410_GPH6_TXD2);
                s3c2410_gpio_pullup(S3C2410_GPH(6), 1);
                s3c2410_gpio_cfgpin(S3C2410_GPH(7), S3C2410_GPH7_RXD2);

                s3c2410_gpio_pullup(S3C2410_GPH(7), 1);

3、重新编译zImage下载进开发板即可

相关内容