S3C6410串口平台设备注册流程分析

1.mdesc->map_io()

start_kernel
    -->setup_arch(&command_line);
        -->paging_init(mdesc);
            -->devicemaps_init(mdesc)
                -->mdesc->map_io();

这里的map_io可从如下定义中得知,即为smdk6410_map_io(void),

MACHINE_START(SMDK6410, "SMDK6410")
    /* Maintainer: Ben Dooks <ben@fluff.org> */
    .phys_io    = S3C_PA_UART & 0xfff00000,
    .io_pg_offst    = (((u32)S3C_VA_UART) >> 18) & 0xfffc,
    .boot_params    = S3C64XX_PA_SDRAM + 0x100,

    .init_irq    = s3c6410_init_irq,
    .map_io        = smdk6410_map_io,
    .init_machine    = smdk6410_machine_init,
    .timer        = &s3c24xx_timer,
MACHINE_END

2.smdk6410_map_io()

smdk6410_map_io(void)
    -->s3c64xx_init_io(smdk6410_iodesc, ARRAY_SIZE(smdk6410_iodesc));
        -->iotable_init(s3c_iodesc, ARRAY_SIZE(s3c_iodesc));/*寄存器内存映射*/
        -->s3c_init_cpu(idcode, cpu_ids, ARRAY_SIZE(cpu_ids));
            -->s3c6410_map_io(void)
    -->s3c24xx_init_clocks(12000000);
        -->s3c6410_init_clocks(int xtal)
            -->s3c24xx_register_baseclocks(xtal);
            -->s3c64xx_register_clocks();
            -->s3c6400_register_clocks();
            -->s3c6400_setup_clocks();
    -->s3c24xx_init_uarts(smdk6410_uartcfgs, ARRAY_SIZE(smdk6410_uartcfgs));
        -->s3c6400_common_init_uarts(struct s3c2410_uartcfg *cfg, int no)
            -->s3c24xx_init_uartdevs("s3c6400-uart", s3c64xx_uart_resources, cfg, no);
                -->填充平台设备指针数组struct platform_device *s3c24xx_uart_devs[4]

3.注册平台设备

arch_initcall(s3c_arch_init);
    -->s3c6410_init(void)
        -->sysdev_register(&s3c6410_sysdev);
    -->platform_add_devices(s3c24xx_uart_devs, nr_uarts);
原文地址:https://www.cnblogs.com/yangjiguang/p/8563320.html