1. make menuconfig
Added support for s3c2440
System type --> s3c2440 machine --> smdk2440
2. _ lookup_machine_type
Process the machine id sent from uboot to obtain a machine_desc struct representing the id.
The machin_desc struct of smdk2440 is defined as follows/arch/arm/mach-s3c2440/mach-smdk2440.c
MACHINE_START (S3C2440, "SMDK2440 ")
/* Maintainer: Ben Dooks <ben@fluff.org> */
. Phys_io = S3C2410_PA_UART,
. Io_pg_offst = (u32) S3C24XX_VA_UART)> 18) & 0 xfffc,
. Boot_params = S3C2410_SDRAM_PA + 0x100,
. Init_irq = s3c24xx_init_irq,
. Map_io = smdk2440_map_io,
. Init_machine = smdk2440_machine_init,
. Timer = & s3c24xx_timer,
MACHINE_END
3. setup_arch Function
The purpose of the function is to process tag parameters from uboot.
_ Lookup_machine_type get machine_desc --> boot_params
Parse_tags (tags) preliminary processing of tags Based on the obtained boot_params
_ Tagtable (ATAG_MEM, parse_tag_mem32); Memory parameter Processing Function Definition
Add the memory description to the meninfo structure of the global structure variable.
_ Tagtable (ATAG_CMDLINE, parse_tag_cmdline); command line parameter bootargs) Processing Function Definition
Copy the command line string to default_command_line
Parse_cmdline (cmdline_p, from); Further process default_command_line
_ Early_param ("mem =", early_mem); when the bootargs contains men = xxx, The early_men function is executed for processing.
_ Early_param ("initrd =", early_initrd); When bootargs contains initrd = xxx, The early_initrd function is executed for processing.
Paging_init (& meminfo, mdesc); process the above meninfo Structure
--> Devicemaps_init (mdesc );
--> (Mdesc-> map_io () The mdesc here is the machine_desc struct above.
Map_o is smdk2440_machine_init)
Smdk2440_machine_init) code: this function is mainly used to set the external crystal oscillator 12000000
This function is defined in mach_smdk2440.c.
Static void _ init smdk2440_map_io (void)
{
S3c24xx_init_io (smdk2440_iodesc, ARRAY_SIZE (smdk2440_iodesc ));
2011-0xx_init_clocks (16934400 );
S3c24xx_init_uarts (smdk2440_uartcfgs, ARRAY_SIZE (smdk2440_uartcfgs ));
}
4. parse_args)
Setup_arch) The function does not completely process tag parameters, such as ttySAC0 = XXX.
This function will continue to process and further process the processed parameters.
5. lele_init ()
This function calls each function defined between _ con_initcall_start and _ con_initcall_end in sequence.
These functions use the macro lele_initcall (fn) to define console_initcall (s3c24xx_serial_initconsole)
The s3c24xx_serial_initconsol function is defined in/dev/serial/s3c2410. c.
--> Register_console (& s3c24xx_serial_console); // register the console with the kernel
S3c24xx_serial_console is a struct.
6. Modify MTD Partition
MTD --- memory technical device
7. device identification by driver
The kernel determines the device information. When the driver is loaded, the driver information is compared with the device information.
If the driver matches a device, use the driver to operate the device.
Device information in the kernel is represented by struct.
Device struct platform_device {
Const char * name;
U32 id;
Struct device dev;
U32 num_resources;
Struct resource * resource;
};
Driver struct platform_driver {
Int (* probe) (struct platform_device *);
Int (* remove) (struct platform_device *);
Void (* shutdown) (struct platform_device *);
Int (* suspend) (struct platform_device *, pm_message_t state );
Int (* suspend_late) (struct platform_device *, pm_message_t state );
Int (* resume_early) (struct platform_device *);
Int (* resume) (struct platform_device *);
Struct device_driver driver;
};
10. Default arm mtd partition in the smdk_default_nand_part struct in arch/arm/plat-s3c24xx/common-smdk.c File
This article from the "linux cainiao" blog, please be sure to keep this source http://zheshigepangzi.blog.51cto.com/6407906/1263944