赞
踩
USB控制器类型:
OHCI、UHCI都是USB1.1的接口标准,而EHCI是对应USB2.0的接口标准,最新的xHCI是USB3.0的接口标准。
OHCI( Open Host Controller Interface ) :一个不仅仅是usb用的主控制器接口标准。主要是遵循csr (configuration space register)标准。是其他厂商在设计usb host controller时遵循的标准,如via, nec, ali, 包括nvidia等等。支持USB1.1的标准。
UHCI (Universal Host Controller Interface ),是Intel主导的对USB1.0、1.1的接口标准,与OHCI不兼容。
EHCI(Enhanced Host Controller Interface ) ,是Intel主导的USB2.0的接口标准。EHCI仅提供USB2.0的高速功能,而依靠UHCI或OHCI来提供对全速(full-speed)或低速(low-speed)设备的支持。
xHCI( eXtensible Host Controller Interface ),是最新的USB3.0的接口标准,它在速度、节能、虚拟化等方面都比前面3中有了较大的提高。xHCI 支持所有种类速度的USB设备(USB 3.0 SuperSpeed, USB 2.0 Low-, Full-, and High-speed, USB 1.1 Low- and Full-speed)。xHCI的目的是为了替换前面三种(UHCI/OHCI/EHCI)。
USB Hub可以将一个USB口转换为多个,USB Host带有Root Hub,第一个USB设备是一个根集线器(Root_hub),它控制连接到其上的整个USB总线,该控制器是连接PCI总线和USB总线的桥,也是该总线上的第一个USB设备,USB Hub对于上游而言是一个USB Device, 对于下游而言扮演USB Host, 所以USB设备本身不知道自己连接在Hub还是Root Hub上。
rk3399平台host Controller初始化信息
[ 2.479720] ehci-platform fe380000.usb: EHCI Host Controller
[ 2.480680] ehci-platform fe380000.usb: new USB bus registered, assigned bus number 4
[ 2.481979] ehci-platform fe380000.usb: irq 28, io mem 0xfe380000
[ 2.488655] ehci-platform fe380000.usb: USB 2.0 started, EHCI 1.00
[ 2.489833] usb usb4: New USB device found, idVendor=1d6b, idProduct=0002
[ 2.490486] usb usb4: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[ 2.491138] usb usb4: Product: EHCI Host Controller
[ 2.491617] usb usb4: Manufacturer: Linux 4.4.189 ehci_hcd
[ 2.492115] usb usb4: SerialNumber: fe380000.usb
[ 2.494539] hub 4-0:1.0: USB hub found
[ 2.494966] hub 4-0:1.0: 1 port detected
[ 2.497460] ohci-platform fe3a0000.usb: Generic Platform OHCI controller
[ 2.499043] ohci-platform fe3a0000.usb: new USB bus registered, assigned bus number 3
[ 2.500263] ohci-platform fe3a0000.usb: irq 29, io mem 0xfe3a0000
[ 2.555904] usb usb3: New USB device found, idVendor=1d6b, idProduct=0001
[ 2.556557] usb usb3: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[ 2.557209] usb usb3: Product: Generic Platform OHCI controller
[ 2.557780] usb usb3: Manufacturer: Linux 4.4.189 ohci_hcd
[ 2.558279] usb usb3: SerialNumber: fe3a0000.usb
[ 2.560624] hub 3-0:1.0: USB hub found
[ 2.561050] hub 3-0:1.0: 1 port detected
经由usb hub扩展,鼠标设备(低速设备)的加载信息,鼠标连接到ehci控制器上面。
[root@rk3399:/]# [ 69.331475] usb 3-1.1: new low-speed USB device number 4 using ehci-platform
[ 69.424705] usb 3-1.1: New USB device found, idVendor=046d, idProduct=c05a
不经usb hub扩展,鼠标设备(低速设备)的加载信息,鼠标连接到ohci控制器上面。
[root@rk3399:/]# [ 16.243619] usb 3-1: new low-speed USB device number 2 using ohci-platform
[ 16.427796] usb 3-1: New USB device found, idVendor=046d, idProduct=c05a
无论是否经usb hub扩展,U盘设备(高速设备)的加载信息,U盘连接到ehci控制器上面。
[root@rk3399:/]# [ 6315.938780] usb 4-1: new high-speed USB device number 3 using ehci-platform
[ 6316.062160] usb 4-1: New USB device found, idVendor=05e3, idProduct=0749
理论上,EHCI仅提供USB2.0的高速功能,要依靠UHCI或OHCI来提供对全速(full-speed)或低速(low-speed)设备的支持。鼠标设备这样的低速设备应该连接到UHCI或OHCI控制器上,但是经由usb hub,鼠标也可以连接到EHCI控制器上。所以,usb hub是可以将不同速度的设备都连接到EHCI控制器上的,具有匹配不同速度设备的能力。
内核usb host接口相关文件
./arch/arm/mach-s5p4418/include/mach/usb-phy.h
./arch/arm/mach-s5p4418/soc/setup-usb-phy.c
./drivers/usb/host/ehci.h
./drivers/usb/host/ehci-hcd.c
./drivers/usb/host/ehci-synop.c
./drivers/usb/host/ohci.h
./drivers/usb/host/ohci-hcd.c
./drivers/usb/host/ohci-synop.c
INCR16 INCR8 INCR4
0xC002_0000 OHCI Controller
0xC003_0000 EHCI Controller
xx18平台USB host Controller初始化信息,默认xx18平台只配置了EHCI,OHCI没有配置:
[ 2.050000] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[ 2.057000] nxp-ehci nxp-ehci: SLsi Synopsys EHCI Host Controller
[ 2.063000] nxp-ehci nxp-ehci: new USB bus registered, assigned bus number 1
[ 2.070000] nxp-ehci nxp-ehci: irq 50, io mem 0xc0030000
[ 2.082000] nxp-ehci nxp-ehci: USB 0.0 started, EHCI 1.00
[ 2.087000] usb usb1: New USB device found, idVendor=1d6b, idProduct=0002
[ 2.094000] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[ 2.101000] usb usb1: Product: SLsi Synopsys EHCI Host Controller
[ 2.107000] usb usb1: Manufacturer: Linux 3.4.39 ehci_hcd
[ 2.113000] usb usb1: SerialNumber: nxp-ehci
[ 2.118000] hub 1-0:1.0: USB hub found
[ 2.121000] hub 1-0:1.0: 3 ports detected
若要添加对OHCI的支持,我们需要将内核中OHCI相关配置打开,如下:
--- a/linux/kernel/kernel-3.4.39/arch/arm/configs/s5p6818_linux_forlinx_defconfig
+++ b/linux/kernel/kernel-3.4.39/arch/arm/configs/s5p6818_linux_forlinx_defconfig
@@ -2465,8 +2465,13 @@ CONFIG_USB_EHCI_SYNOPSYS_RESUME_WORK=y
# CONFIG_USB_ISP116X_HCD is not set
# CONFIG_USB_ISP1760_HCD is not set
# CONFIG_USB_ISP1362_HCD is not set
-# CONFIG_USB_OHCI_HCD is not set
+CONFIG_USB_OHCI_HCD=y
+CONFIG_USB_OHCI_SYNOPSYS=y
+# CONFIG_USB_OHCI_HCD_PLATFORM is not set
# CONFIG_USB_EHCI_HCD_PLATFORM is not set
+# CONFIG_USB_OHCI_BIG_ENDIAN_DESC is not set
+# CONFIG_USB_OHCI_BIG_ENDIAN_MMIO is not set
+CONFIG_USB_OHCI_LITTLE_ENDIAN=y
# CONFIG_USB_SL811_HCD is not set
# CONFIG_USB_R8A66597_HCD is not set
CONFIG_USB_DWCOTG=y
打开配置以后,OHCI初始化信息:
[ 2.610000] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
[ 2.616000] nxp-ohci nxp-ohci: SLsi Synopsys OHCI Host Controller
[ 2.623000] nxp-ohci nxp-ohci: new USB bus registered, assigned bus number 3
[ 2.630000] nxp-ohci nxp-ohci: irq 50, io mem 0xc0020000
[ 2.690000] usb usb3: New USB device found, idVendor=1d6b, idProduct=0001
[ 2.697000] usb usb3: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[ 2.704000] usb usb3: Product: SLsi Synopsys OHCI Host Controller
[ 2.710000] usb usb3: Manufacturer: Linux 3.4.39 ohci_hcd
[ 2.715000] usb usb3: SerialNumber: nxp-ohci
[ 2.720000] hub 3-0:1.0: USB hub found
[ 2.724000] hub 3-0:1.0: 3 ports detected
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。