s3c6410_map_io()的调用流程:
//arch/arm/mach-s3c6410/s3c6410.c
void __init s3c6410_map_io(struct map_desc *mach_desc, int size)
{
/* register our io-tables */
iotable_init(s3c6410_iodesc, ARRAY_SIZE(s3c6410_iodesc));
iotable_init(mach_desc, size);
/* set our idle function */
s3c24xx_idle = s3c6410_idle;
}
static struct cpu_table cpu_ids[] __initdata = {
………………………..,
{
.idcode = 0x36410100,
.idmask = 0xfffffff0,
.map_io = s3c6410_map_io,
.init_clocks = s3c6410_init_clocks,
.init_uarts = s3c6410_init_uarts,
.init = s3c6410_init,
.name = name_s3c6410
},
………………………..,
};
void __init s3c24xx_init_io(struct map_desc *mach_desc, int size)
{
unsigned long idcode = 0x0;
………………………..;
cpu = s3c_lookup_cpu(idcode);
if (cpu == NULL) {
printk(KERN_ERR “Unknown CPU type 0x%08lx\n”, idcode);
panic(“Unknown S3C24XX CPU”);
}
printk(“CPU %s (id 0x%08lx)\n”, cpu->name, idcode);
if (cpu->map_io == NULL || cpu->init == NULL) {
printk(KERN_ERR “CPU %s support not enabled\n”, cpu->name);
panic(“Unsupported S3C24XX CPU”);
}
(cpu->map_io)(mach_desc, size); /* s3c6410_map_io() */
}
//arch/arm/mach-smdk6410.c
static void __init smdk6410_map_io(void)
{
s3c24xx_init_io(smdk6410_iodesc, ARRAY_SIZE(smdk6410_iodesc));
……………………;
}
流程如下:
先是板卡及的map_io():smdk6410_map_io()然后通过s3c_lookup_cpu()后转为cpu级的map_io()==s3c6410_map_io()
start_kernel()==>setup_arch()==>
1.mdesc=setup_machine()==>lookup_machine_types(MACH_TYPE_SMDK6410) == __mach_desc_SMDK6410
2.paging_init(mdesc)==>devicemaps_init(mdesc)==>mdesc->map_io()==>__mach_desc_SMDK6410->map_io()
==>smdk6410_map_io()==>s3c24xx_init_io()==>s3c6410_map_io()
#if !defined(CONFIG_MACH_SMDK6430)
MACHINE_START(SMDK6410, “SMDK6410”)
#else
MACHINE_START(SMDK6430, “SMDK6430”)
#endif
/* Maintainer: Samsung Electronics */
.phys_io = S3C24XX_PA_UART,
……………….,
.init_irq = s3c_init_irq,
.map_io = smdk6410_map_io,
.fixup = smdk6410_fixup,
.timer = &s3c_timer,
.init_machine = smdk6410_machine_init,
MACHINE_END