本来应该接着上节,进行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文件:
[maria@localhost drivers]$ 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板运行,会发现启动时的打印信息多了下面这些:
[ 49.045648] usb 1-1.1: USB disconnect, device number 4
[ 50.303032] usb 1-1.1: new low-speed USB device number 5 using musb-hdrc
[ 50.428537] usb 1-1.1: New USB device found, idVendor=1c4f, idProduct=0003
[ 50.435992] usb 1-1.1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[ 50.443870] usb 1-1.1: Product: Usb Mouse
[ 50.448146] usb 1-1.1: Manufacturer: SIGMACHIP
[ 50.496499] input: SIGMACHIP Usb Mouse as /devices/ocp/47400000.usb/47401400.us2
[ 50.525066] hid-generic 0003:1C4F:0003.0003: input: USB HID v1.10 Mouse [SIGMAC0
[ 53.039375] usb 1-1.1: USB disconnect, device number 5
[ 54.053001] CAUTION: musb: Babble Interrupt Occurred
[ 54.143577] usb 1-1: USB disconnect, device number 2
[ 54.175717] musb-hdrc musb-hdrc.0.auto: Restarting MUSB to recover from Babble
[ 54.188177] musb-hdrc: setup fifo_mode 4
[ 54.188252] musb-hdrc: 28/31 max ep, 16384/16384 memory
[ 54.583051] usb 1-1: new high-speed USB device number 6 using musb-hdrc
[ 54.723503] usb 1-1: New USB device found, idVendor=0424, idProduct=2514
[ 54.730651] usb 1-1: New USB device strings: Mfr=0, Product=0, SerialNumber=0
[ 54.745275] hub 1-1:1.0: USB hub found
[ 54.749558] 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设备,此处不再赘述。
下一节的内容是文件系统的移植。
用户377235 2016-1-25 10:26
你好,我是初学者,请教下驱动装好了,要怎么使用USB设备呢?找了很多资料,好像都对不上号