Linux那些事兒 之 戲說USB(4)漫漫辛酸路

USB的一生充滿了PK,並在PK中發展,1.0、1.1、2.0,漫漫辛酸路,一把辛酸淚。我們又何嘗不是,上學碰到實行自費,畢業碰到IT崩潰,工作碰到房價見鬼,現在又碰到股市泡沫,與房價PK,與莊家PK,從來的結局都只有失敗一個,USB在PK中發展,我們在PK中只有變老。

這張表是從USB2.0 spec裏直接拿過來的,可以看出,它的高速模式最高已經達到了480Mbps,即60MBps,這是個什麼概念,也就是說,照這個速度,你將自己從網上下的小短片備份到自己的移動硬盤上不用一秒鐘,而按照USB1.1最高12Mbps的速度,你需要將近1分鐘。2.0比1.1的最高速度足足提高了幾十倍,日後任小強們說房價還很合理,增加不多的時候可以不用和美國比和日本比了,和USB傳輸速度的發展比好了,更加能夠顯示房價的低廉。USB走過的這段辛酸路,對咱們來說最直觀的結果也就是傳輸速度提高了,過程很艱辛,結果很簡單,是不。

USB的各個版本是兼容的。每個USB2.0 控制器帶有3個芯片,根據設備的識別方式將信號發送到正確的控制芯片。我們可以將1.1設備連接到2.0的控制器上使用,不過它只能達到1.1的速度。同時也可以將2.0的設備連接到1.1的控制器上,不過不能指望它能以2.0的速度運行。畢竟走過的路太辛酸了,沒有那麼快就忘掉,好像我們不時的要去交大門口的老趙烤肉店憶苦思甜一樣,我們不能忘本,USB也不能。

顯然,Linux對USB1.1和2.0都是支持的,通過看drivers/usb/host目錄下的Kconfig文件,我們可以知道內核裏支持的控制器。

25 config USB_EHCI_HCD
26         tristate "EHCI HCD (USB 2.0) support"
27         depends on USB && PCI
28         ---help---
29           The Enhanced Host Controller Interface (EHCI) is standard for USB 2.0
30           "high speed" (480 Mbit/sec, 60 Mbyte/sec) host controller hardware.
31           If your USB host controller supports USB 2.0, you will likely want to
32           configure this Host Controller Driver. At this writing, the primary
33           implementation of EHCI is a chip from NEC, widely available in add-on
34           PCI cards, but implementations are in the works from other vendors
35           including Intel and Philips. Motherboard support is appearing.
37           EHCI controllers are packaged with "companion" host controllers (OHCI
38           or UHCI) to handle USB 1.1 devices connected to root hub ports. Ports
39           will connect to EHCI if it the device is high speed, otherwise they
40           connect to a companion controller. If you configure EHCI, you should
41           probably configure the OHCI (for NEC and some other vendors) USB Host
42           Controller Driver or UHCI (for Via motherboards) Host Controller
43           Driver too.
45           You may want to read <file:Documentation/usb/ehci.txt>.
47           To compile this driver as a module, choose M here: the
48           module will be called ehci-hcd.

這裏使用的都是2.6.11版本內核的。所有與USB相關的代碼都在drivers/usb目錄下面。上面的Kconfig文件說的很清楚,ehci-hcd模塊支持的是USB2.0控制器的高速模式,它本身並不支持全速或低速模式,對連接上的USB1.1設備的支持,是通過ohci-hcd或uhci-hcd模塊。如果我們只配置了EHCI,就不能使用usb的鼠標鍵盤。有時碰到usb鍵盤或鼠標不能用的情況,很可能就是因爲配置EHCI的同時沒有配置OHCI或UHCI。多少年以前我還是個青澀少年的時候就遇到過這個問題。

70 config USB_OHCI_HCD
71         tristate "OHCI HCD support"
72         depends on USB && USB_ARCH_HAS_OHCI
73         select ISP1301_OMAP if MACH_OMAP_H2 || MACH_OMAP_H3
74         ---help---
75           The Open Host Controller Interface (OHCI) is a standard for accessing
76           USB 1.1 host controller hardware.  It does more in hardware than Intel's
77           UHCI specification.  If your USB host controller follows the OHCI spec,
78           say Y.  On most non-x86 systems, and on x86 hardware that's not using a
79           USB controller from Intel or VIA, this is appropriate.  If your host
80           controller doesn't use PCI, this is probably appropriate.  For a PCI
81           based system where you're not sure, the "lspci -v" entry will list the
82           right "prog-if" for your USB controller(s):  EHCI, OHCI, or UHCI.
83 
84           To compile this driver as a module, choose M here: the
85           module will be called ohci-hcd.
86 
87 config USB_UHCI_HCD
88         tristate "UHCI HCD (most Intel and VIA) support"
89         depends on USB && PCI
90         ---help---
91           The Universal Host Controller Interface is a standard by Intel for
92           accessing the USB hardware in the PC (which is also called the USB
93           host controller). If your USB host controller conforms to this
94           standard, you may want to say Y, but see below. All recent boards
95           with Intel PCI chipsets (like intel 430TX, 440FX, 440LX, 440BX,
96           i810, i820) conform to this standard. Also all VIA PCI chipsets
97           (like VIA VP2, VP3, MVP3, Apollo Pro, Apollo Pro II or Apollo Pro
98           133). If unsure, say Y.
99 
100           To compile this driver as a module, choose M here: the
101           module will be called uhci-hcd.
 

OHCI和UHCI雖然支持的都是1.1的控制器,但是支持的硬件範圍不一樣,房子、股票我們需要關心的太多了,就不用去管它們了,如果你在編譯內核,直接選上它們就是了。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章