MPC8309 USB OTG功能调试
电路图:
调试时使用的是mpc8309twr freescale官方开发板。
DTS配置
usb@23000{
compatible= "fsl-usb2-dr";
reg= <0x23000 0x1000>;
#address-cells= <1>;
#size-cells= <0>;
interrupt-parent= <&ipic>;
interrupts= <38 0x8>;
dr_mode= "otg"; //+ 20160812
phy_type= "ulpi";
};
内核配置:
[*] USB support --->
<*> EHCI HCD (USB 2.0) support
[*] Support for Freescale on-chip EHCI USB controller
<*> USB Mass Storage support
<*> USB Gadget Support --->
*** OTG and related infrastructure ***
启动后,D1亮起表明USB3300已经开始工作。插入U盘,串口打印出:
[root@mpc8309twr root]# usb 1-1: new highspeed USB device using fsl-ehci and address 2
scsi0 : usb-storage 1-1:1.0
scsi 0:0:0:0: Direct-Access Kingston DataTraveIer G3 PMAP PQ: 0 ANSI: 0 CCS
sd 0:0:0:0: Attached scsi generic sg0 type0
usb 1-1: reset high speed USB device usingfsl-ehci and address 2
sd 0:0:0:0: [sda] 7827456 512-byte logicalblocks: (4.00 GB/3.73 GiB)
sd 0:0:0:0: [sda] Write Protect is off
sd 0:0:0:0: [sda] Assuming drive cache:write through
sd 0:0:0:0: [sda] Assuming drive cache:write through
sda:sda1
sd 0:0:0:0: [sda] Assuming drive cache:write through
sd 0:0:0:0: [sda] Attached SCSI removabledisk
表明USB口已经识别到了U盘的型号和容量。使用fdisk命令查询挂载信息。
[root@mpc8309twr root]# fdisk -l
Disk /dev/sda: 4007 MB, 4007657472 bytes
61 heads, 21 sectors/track, 6110 cylinders
Units = cylinders of 1281 * 512 = 655872bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 812 6111 3393664 b Win95 FAT32
使用mount命令挂载U盘:
[root@mpc8309twr root]# mount -t vfat/dev/sda1 /mnt/usbflash/
[root@mpc8309twr root]# cd /mnt/usbflash/
[root@mpc8309twr usbflash]# ls
这样就可以看到U盘中的文件。