在linux-2.6.33.5内核中添加对s3c2410串口2的配置

来源:互联网 发布:java xpath html 编辑:程序博客网 时间:2024/06/06 09:28
这几天,突然发现移植好的s3c2410的串口2在linux系统下竟然不能用,赶紧查了很多资料,发现,若要在linux系统下是用s3c23410的串口2 ,需要修改内核,把s3c2410的串口2配置成普通的串口。
    1.修改arch/arm/mach-s3c2440/mach-smdk2440.c中的uart2的配置,修改后如下:
     static struct s3c2410_uartcfg smdk2410_uartcfgs[] __initdata = {
        [0] = {
                .hwport             = 0,
                .flags             = 0,
                .ucon             = UCON,
                .ulcon             = ULCON,
                .ufcon             = UFCON,
        },
        [1] = {
                .hwport             = 1,
                .flags             = 0,
                .ucon             = UCON,
                .ulcon             = ULCON,
                .ufcon             = UFCON,
        },
        /* IR port */
        [2] = {
                .hwport             = 2,
                .flags             = 0,
                .ucon             = 0x3c5,
                .ulcon             = 0x03,
                .ufcon             = 0x51,
        }
2. 在drivers/serial/samsung.c中添加对uart2控制器的配置,配置为普通串口。
   添加头文件:#include <linux/gpio.h>
             #include <mach/regs-gpio.h>
   在static int s3c24xx_serial_startup(struct uart_port *port)函数中,添加     
      if (port->line == 2) {
                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.编译内核,下载进板子后,进行测试,串口2终于可以正常工作了。
 
参考:http://bbs.witech.com.cn/archiver/?tid-468-page-1.html开贴详述linux-2.6.33内核的移植