先看一下内核对USB的配置 CONFIG_USB=y CONFIG_USB_ANNOUNCE_NEW_DEVICES=y CONFIG_USB_SUSPEND=y CONFIG_USB_EHCI_HCD=y CONFIG_USB_EHCI_EHSET=y CONFIG_USB_EHCI_ROOT_HUB_TT=y # CONFIG_USB_EHCI_TT_NEWSCHED is not set CONFIG_USB_EHCI_MSM_72K=y CONFIG_USB_ACM=y CONFIG_USB_STORAGE=y CONFIG_USB_STORAGE_DATAFAB=y CONFIG_USB_STORAGE_FREECOM=y CONFIG_USB_STORAGE_ISD200=y CONFIG_USB_STORAGE_USBAT=y CONFIG_USB_STORAGE_SDDR09=y CONFIG_USB_STORAGE_SDDR55=y CONFIG_USB_STORAGE_JUMPSHOT=y CONFIG_USB_STORAGE_ALAUDA=y CONFIG_USB_STORAGE_ONETOUCH=y CONFIG_USB_STORAGE_KARMA=y CONFIG_USB_STORAGE_CYPRESS_ATACB=y CONFIG_USB_EHSET_TEST_FIXTURE=y CONFIG_USB_GADGET=y CONFIG_USB_MSM_72K=y CONFIG_USB_G_ANDROID=y /kernel/driver/usb/host/Ehci-hcd.c #ifdef CONFIG_USB_EHCI_MSM_72K //通过包含文件的方式集成msm udc驱动的代码 #include "ehci-msm72k.c" #define PLATFORM_DRIVER_PRESENT #endif ... ... static struct platform_driver *plat_drivers[] = { #if defined(CONFIG_USB_EHCI_MSM_72K) || defined(CONFIG_USB_EHCI_MSM) &ehci_msm_driver, #endif #ifdef CONFIG_USB_EHCI_MSM_HSIC &ehci_msm_hsic_driver, #endif #ifdef CONFIG_USB_EHCI_MSM &ehci_msm2_driver, #endif } 内核的一种一项配置 CONFIG_USB_EHCI_MSM_72K=y 可以看出高通的USB驱动采用的是EHCI的主机控制权规格. EHCI兼容OHCI和UHCI static int __init ehci_hcd_init(void) { int i, retval = 0; if (usb_disabled()) return -ENODEV; printk(KERN_INFO "%s: " DRIVER_DESC "\n", hcd_name); set_bit(USB_EHCI_LOADED, &usb_hcds_loaded); if (test_bit(USB_UHCI_LOADED, &usb_hcds_loaded) || test_bit(USB_OHCI_LOADED, &usb_hcds_loaded)) printk(KERN_WARNING "Warning! ehci_hcd should always be loaded" " before uhci_hcd and ohci_hcd, not after\n"); pr_debug("%s: block sizes: qh %Zd qtd %Zd itd %Zd sitd %Zd\n", hcd_name, sizeof(struct ehci_qh), sizeof(struct ehci_qtd), sizeof(struct ehci_itd), sizeof(struct ehci_sitd)); #ifdef DEBUG ehci_debug_root = debugfs_create_dir("ehci", usb_debug_root); if (!ehci_debug_root) { retval = -ENOENT; goto err_debug; } #endif for (i = 0; i < ARRAY_SIZE(plat_drivers); i++) { retval = platform_driver_register(plat_drivers[i]); // 逐个注册上面定义的plat_drivers【】数组 if (retval) { while (--i >= 0) platform_driver_unregister(plat_drivers[i]); goto clean0; } } 这是EHCI驱动的加载过程. 从此我们可以看出EHC的公共文件如何和高通的UDC控制器驱动衔接并注册的。