Linux under the Mmc/sd/sdio Drive Series II----Host registration process (i) __linux

Source: Internet
Author: User

The previous article said that the Mmc/sd/sdio (MMC) driver from the large aspect of the main device-driven and from device-driven, that this article to detail the main device driver registration process.

MMC main device (that is, host) refers to the integration of the internal CPU MMC controller, the author is 4412 chips, from the datasheet can be seen, the integration of four MMC controller, respectively, is MMC0,MMC1,MMC2, MMC3. And from the last article we know that the WiFi module is connected to the MMC3 host.

In a Linux system, each host device is encapsulated into Platform_device to register one by one. For the kernel used by the author (3.2.0 version), the corresponding Platform_device file for each host device is located under the directory ($KERNEL _source)/arch/arm/plat-samsung, respectively for DEV-HSMMC.C,DEV-HSMMC1.C,DEV-HSMMC2.C,DEV-HSMMC3.C, in order to correspond with the actual WiFi module, we focus on entering the dev-hsmmc3.c file to look at

As you can see from the diagram above, a platform_device named S3C_DEVICE_HSMMC3 is defined in the file, but the defined Platform_device also requires a registration process that occurs in the file ($KERNEL _ SOURCE)/arch/arm/mach-exynos/mach-$ (BOARD). C, which has one of the following function calls: Its behavior is to put the array Every Platform_device item one by one inside the skd4x12_devices is registered into the system, and the array contains the above defined S3C_DEVICE_HSMMC3

So in summary, systematization in the initialization, it has been S3C_DEVICE_HSMMC3 (that is, the host MMC3) registered into the platform bus (the other mmc0,mmc1,mmc2 is a truth).

Of course, for those who are familiar with the platform mechanism, it is only registered Platform_device, and the corresponding Platform_driver is not registered. The following is the registration of this platform_driver, which is done in the SDHCI-S3C.C file in the $ (kernel_source)/drivers/mmc/host directory, which has the following registration function call:

The parameter sdhci_s3c_driver is the platform_driver mentioned above, it is also defined in the SDHCI-S3C.C file, look at:

       in the process of registering the Sdhci_s3c_driver, the system will be based on the sdhci_s3c_driver-> The Driver.name member variable (here is "S3C-SDHCI") looks for the platform_dvice of the same name on the Platform_bus bus (this process is called "probing"), through the registration analysis of the S3C_DEVICE_HSMMC3 above, Found S3c_device_mmc3.name also happens to be "s3c-sdhci", so they just can match, detect success, and when you check S3C_DEVICE_HSMMC,S3C_DEVICE_HSMMC1 and S3c_device_ HSMMC2 found their name member variable is "S3C-SDHCI", so there will be four successful probes, each time the probe succeeds, it will call the Sdhci_s3c_driver.probe function---sdhci_s3c_probe, This function is critical and plays a central role throughout the driver registration process, and for the details, see the next article.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.