热度 24
2015-3-10 09:34
2337 次阅读|
1 个评论
本来应该接着上节,进行LCD触摸屏的调试,但是USB鼠标要简单一些,因此先调试它。 HUB采用了芯片USB2514,配合两个双路USB电流监测芯片TPS2052,实现4路USB,因此首要的任务是Kernel需要识别这个HUB,并且将4路USB的电源打开。 ================================================================ http://processors.wiki.ti.com/index.php/AM335x_USB_Driver%27s_Guide http://processors.wiki.ti.com/index.php/UsbgeneralpageLinux-v3p1 Step 1: 添加dts代码: usb { status = "okay"; }; usb_ctrl_mod { status = "okay"; }; usb0_phy { status = "okay"; }; usb0 { status = "okay"; dr_mode = "host"; }; cppi41dma { status = "okay"; }; 由于我的电路板是usb0为host,usb1没有使用,因此按照上面的修改maria-am335x-common.dtsi文件。 Step 2: 在make menuconfig中选中: → Device Drivers → USB support * Inventra Highspeed Dual Role Controller (TI, ADI, ...) * Platform Glue Layer --- (X) TI DSPS platforms MUSB DMA mode --- TI CPPI 4.1 (AM335x) 其他地方都不用修改。 Note:如何确定make menuconfig时的选项呢?根据设备的compatible值,查看Makefile和Kconfig即可。 例如,在dts文件中关于usb的部分是: compatible = "ti,am33xx-usb"; 因此,使用grep命令找到对应的driver文件: $ grep -rn ti\,am33xx-usb Binary file built-in.o matches Binary file usb/built-in.o matches Binary file usb/musb/built-in.o matches Binary file usb/musb/musb_am335x.o matches usb/musb/musb_am335x.c:24: { .compatible = "ti,am33xx-usb" }, 再查看usb/musb/下的Makefile和Kconfig即可。 编译后加载到target板运行,会发现启动时的打印信息多了下面这些: usb 1-1.1: USB disconnect, device number 4 usb 1-1.1: new low-speed USB device number 5 using musb-hdrc usb 1-1.1: New USB device found, idVendor=1c4f, idProduct=0003 usb 1-1.1: New USB device strings: Mfr=1, Product=2, SerialNumber=0 usb 1-1.1: Product: Usb Mouse usb 1-1.1: Manufacturer: SIGMACHIP input: SIGMACHIP Usb Mouse as /devices/ocp/47400000.usb/47401400.us2 hid-generic 0003:1C4F:0003.0003: input: USB HID v1.10 Mouse usb 1-1.1: USB disconnect, device number 5 CAUTION: musb: Babble Interrupt Occurred usb 1-1: USB disconnect, device number 2 musb-hdrc musb-hdrc.0.auto: Restarting MUSB to recover from Babble musb-hdrc: setup fifo_mode 4 musb-hdrc: 28/31 max ep, 16384/16384 memory usb 1-1: new high-speed USB device number 6 using musb-hdrc usb 1-1: New USB device found, idVendor=0424, idProduct=2514 usb 1-1: New USB device strings: Mfr=0, Product=0, SerialNumber=0 hub 1-1:1.0: USB hub found hub 1-1:1.0: 4 ports detected 执行下面的命令: root@ok335x:/sys/bus/usb/devices# ls 1-0:1.0 1-1 1-1:1.0 usb1 root@ok335x:/sys/bus/usb/devices# cd 1-1 root@ok335x:/sys/bus/usb/devices/1-1# ls 1-1:1.0 bmAttributes maxchild authorized busnum port avoid_reset_quirk configuration power bConfigurationValue descriptors quirks bDeviceClass dev removable bDeviceProtocol devnum remove bDeviceSubClass devpath speed bMaxPacketSize0 driver subsystem bMaxPower ep_00 uevent bNumConfigurations idProduct urbnum bNumInterfaces idVendor version bcdDevice ltm_capable root@ok335x:/sys/bus/usb/devices/1-1# cat idProduct 2514 root@ok335x:/sys/bus/usb/devices/1-1# cat idVendor 0424 到这里,可知Kernel驱动USB的基本步骤没有问题了,剩下的工作是如何使用USB设备,此处不再赘述。 下一节的内容是文件系统的移植。