4.1. The basic framework of the MMC subsystem 4.1.1. The code of the MMC subsystem is under kernel/driver/MMC. Currently, the MMC subsystem supports some forms of memory cards: SD, SDIO, MMC. 4.1.2. HOST: Drivers for different hosts. This part needs to be completed according to your specific platform. 4.1.3.CORE: This is the core layer of the entire MMC. This part implements different protocols and specifications, and provides interface functions for the HOST layer driver. 4.1.4.CARD: Because these memory cards are block devices, of course, block device drivers need to be provided. This part implements how to implement the SD card as a block device. 4.1.5.Relationships between the various layers 4.2.Important structures 4.2.1. struct mmc_host is used to describe the card controller locationkernel/include/linux/mmc/host.hbelow. 4.2.2.struct mmc_card is used to describe the card and is located belowkernel/include/linux/mmc/card.h4.2.3.struct mmc_driver is used to describe themmccard driver inkernel/include/linux/mmc/card.h. 4.2.4.struct mmc_host_ops is used to describe the card controller operation set, which is used to register the operation function from the host controller to the core layer, thereby isolating the core layer from the specific host controller. In other words, if the core needs to operate the host controller, it is the function pointer operation given in this ops, and cannot directly call the function of the specific host controller. It is located in kernel/include/linux/mmc/host.h. 2.5.struct mmc_ios is used to describe the controller's I/O status for the card. It is located in kernel/include/linux/mmc/host.h. 4.2.6.struct mmc_request is used to describe the request to read and write the MMC card. It includes the command, data and the callback function after the request is completed. It is located in kernel/include/linux/mmc/core.h. 4.2.7.struct mmc_queue is the request queue structure of MMC. It encapsulates the general request queue structure and adds MMC card related structures. It is located in kernel/drivers/mmc/card/queue.h. 4.2.8.struct mmc_data describes the data related information of MMC card reading and writing, such as request, operation command, data and status. It is located in kernel/include/linux/mmc/core.h. 4.2.9.struct mmc_command describes the MMC card operation related commands and data, status information, etc. It is located in kernel/include/linux/mmc/core.h. 4.3.Relationship and processing flow between host, core and card 4.3.1 The overall flow is shown in the figure below 364689 4.3.2.Data.The processing flow of the command will be analyzed in detail in the code analysis. 4.4: Core Tasks The entire architecture of the MMC/SD card driver consists of three files. In fact, it only does two things: 1). Card detection. 2). Card data reading. 4.4.1.Functions involved in card detection tcc_mmc_probe(host/tcc_sdhc.c) mmc_alloc_host(core/core.c) mmc_rescan(core/core.c) mmc_attach_mmc(core/mmc.c) mmc_init_card(core/mmc.c) mmc_add_card(core/bus.c) device_add mmc_bus_match(core/bus.c) mmc_bus_probe(core/bus.c) mmc_blk_probe(card/block.c) alloc_disk/add_disk 4.4.2.Functions involved in card data reading and writing mmc_blk_issue_rq(card/block.c) mmc_wait_for_req(core/core.c) Shenzhen Leilong Development Co., Ltd. has been engaged in NANDFLASH industry for more than 10 years. Currently, it is the agent of ATO Solution small capacity SLC NAND, SPI NAND, MCP, etc. For more information, please contact kou2852ba26ba68; Tel: 13691982107
|