usb_hcd_omap_probe (const struct hc_driver *driver) (dev/ohci/ohci-omap.c)
在模块初始化时被platform_driver_register()调用,用来初始化与ohci_hcd_omap_driver
相匹配的usb主控制器.
->usb_create_hcd(driver); 创建一个代表host-controller的数据结构(struct usb_hcd)并初始化 core/hcd.h
->hcd = kzalloc(sizeof(*hcd) + driver->hcd_priv_size, GFP_KERNEL); 为struct usb_hcd分配一块内存
->usb_bus_init (struct usb_bus *bus); (hcd.c) 初始化代表usb bus的数据结构(struct usb_bus)
->初始化struct usb_hcd的定时器,工作队列
->填充struct usb_hcd的rsrc_start字段:host-controller memory/io的起始物理地址
rsrc_len字段:host-controller memory/io的长度
regs字段:host-controller memory/io映射的内核虚拟地址。
->ohci_hcd_init(struct ohci_hcd *ohci); (dev/ohci/ohci-mem.c)
->usb_add_hcd(struct usb_hcd *hcd,unsigned int irqnum, unsigned long irqflags) (/core/hcd.h)
完成struct usb_hcd剩余的初始化工作
->hcd_buffer_create(hcd):创建dmapool
->usb_register_bus(usb_bus):注册usb bus
->usb_alloc_dev(NULL, &hcd->self, 0): (core/usb.c)
处理主控制器hcd上的根Hub(hcd->self.root_hub),这里做的就是为Root Hub申请了一个struct usb_device结构体,并且初始化, 将返回值赋给指针rhdev. Root Hub的parent指针指向了Controller本身.
->ohci_omap_init:完成omap硬件的init工作
->otg_get_transceiver();
->otg_set_host(ohci->transceiver, &ohci_to_hcd(ohci)->self);
针对OTG特性进行的初始化,后面分析
->ohci_init(struct ohci_hcd *ohci); (host/ohci-hcd.c)
->为ohci->hcca分配空间
->ohci_mem_init() 创建ohci->td_cache和ohci->ed_cache的dma_pool
->request_irq(irqnum, &usb_hcd_irq, irqflags,hcd->irq_descr, hcd)
注册中断处理函数.其中中断号是irqnum, 中断服务程序是usb_hcd_irq(struct usb_hcd *hcd) (ohci-hcd.c).
根据usb2.0 spec定义的中断类型有:usb_hcd_irq()根据具体类型执行相应操作,后面分析.
#define OHCI_INTR_SO (1 << 0) /* scheduling overrun */
#define OHCI_INTR_WDH (1 << 1) /* writeback of done_head */
#