Recently, we are studying the driver of pxa300 SD card.Program, Figured out the SD card initialization process, the record is as follows
1. The pxamci_probe () function calls mmc_alloc_host () to allocate the mmc_host structure and initializes the mmc_rescan latency task.
2. initialize the mmc_host structure, initialize the MMC hardware controller registers, interrupt registration, and DMA initialization.
3. At the end of pxamci_probe (), call mmc_add_host () to set the driver model of the mmc_host device, and execute mmc_host_start ()
The mmc_rescan delayed task is started.
4. Then run the mmc_rescan () function, send related commands, and scan the sdio, SD, and MMC devices on the MMC controller in sequence.
5. After scanning the SD card, the system will obtain the information about the SD card from the response of the relevant command, initialize the SD card, and assign the mmc_card structure to describe the related features of the card,
And register mmc_card to the device layer of the "MMC" bus.
6. When mmc_card is registered to the device layer of the "MMC" bus, find the mmc_driver named "mmcblk" on the "MMC" Bus Based on the device driver model,
Call the mmc_blk_probe () function in mmc_drivcer.
7. In the mmc_blk_probe () function, the data structure related to the MMC block device is allocated to the SD card, device nodes and device numbers are allocated to the SD card, and the SD card is added
The block device layer initializes all SD cards.