AM335x(TQ335x)学习笔记——USB驱动移植(转)
时间:10-02
整理:3721RD
点击:
对于AM335x来讲,TI维护的USB驱动已经非常完善了,本文称之为移植,实际上仅仅是配置内核选项使能USB HOST/OTG功能。废话少说,直接动手开启AM335x的USB驱动配置项。
Step1. 配置内核支持USB
默认的配置项没有配置USB相关的选项,但是DTS已经配置好了,我们不需要对DTS作任何修改,详细的内核配置项如下:
- Device Drivers --->
- [*] USB support --->
- [*] OTG support
- <*> EHCI HCD (USB 2.0) support
- [*] Improved Transaction Translator scheduling (NEW)
- <*> EHCI support for OMAP3 and later chips (NEW)
- <*> OHCI HCD (USB 1.1) support
- <*> OHCI support for OMAP3 and later chips (NEW)
- <*> Inventra Highspeed Dual Role Controller (TI, ADI, ...)
- MUSB Mode Selection (Dual Role mode) --->
- <*> Platform Glue Layer (TI DSPS platforms) --->
- MUSB DMA mode (Disable DMA (always use PIO)) --->
编译内核的指令如下:
- make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- -j8
Step3.测试
用新编译好的内核启动开发板,可以看到如下Log:
- Starting kernel ...
-
-
- [ 0.000000] Booting Linux on physical CPU 0x0
- [ 0.000000] Linux version 3.17.2 (lilianrong@smarter) (gcc version 4.7.3 (Ubuntu/Linaro 4.7.3-12ubuntu1) ) #96 SMP Fri Dec 26 22:28:21 CST 2014
- [ 0.000000] CPU: ARMv7 Processor [413fc082] revision 2 (ARMv7), cr=10c5387d
- [ 0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
- [ 0.000000] Machine model: TI AM335x EVM
- [ 0.000000] cma: Reserved 16 MiB at 9e800000
- [ 0.000000] Memory policy: Data cache writeback
- [ 0.000000] HighMem zone: 1048574 pages exceeds freesize 0
- [ 0.000000] CPU: All CPU(s) started in SVC mode.
- [ 0.000000] AM335X ES2.1 (sgx neon )
- [ 0.000000] PERCPU: Embedded 9 pages/cpu @dfa99000 s14336 r8192 d14336 u36864
- [ 0.000000] Built 1 zonelists in Zone order, mobility grouping on. Total pages: 129792
- [ 0.000000] Kernel command line: console=ttyO0,115200n8 root=/dev/mmcblk0p2 rw rootfstype=ext3 rootwait
- [ 0.000000] PID hash table entries: 2048 (order: 1, 8192 bytes)
- [ 0.000000] Dentry cache hash table entries: 65536 (order: 6, 262144 bytes)
- [ 0.000000] Inode-cache hash table entries: 32768 (order: 5, 131072 bytes)
- [ 0.000000] Memory: 483980K/523264K available (6184K kernel code, 668K rwdata, 2468K rodata, 410K init, 8215K bss, 39284K reserved, 0K highmem)
- [ 0.000000] Virtual kernel memory layout:
- [ 0.000000] vector : 0xffff0000 - 0xffff1000 ( 4 kB)
- [ 0.000000] fixmap : 0xffc00000 - 0xffe00000 (2048 kB)
- [ 0.000000] vmalloc : 0xe0800000 - 0xff000000 ( 488 MB)
- [ 0.000000] lowmem : 0xc0000000 - 0xe0000000 ( 512 MB)
- [ 0.000000] pkmap : 0xbfe00000 - 0xc0000000 ( 2 MB)
- [ 0.000000] modules : 0xbf000000 - 0xbfe00000 ( 14 MB)
- [ 0.000000] .text : 0xc0008000 - 0xc087b564 (8654 kB)
- [ 0.000000] .init : 0xc087c000 - 0xc08e2800 ( 410 kB)
- [ 0.000000] .data : 0xc08e4000 - 0xc098b330 ( 669 kB)
- [ 0.000000] .bss : 0xc098b330 - 0xc1190f60 (8216 kB)
- [ 0.000000] Hierarchical RCU implementation.
- [ 0.000000] RCU restricting CPUs from NR_CPUS=2 to nr_cpu_ids=1.
- [ 0.000000] RCU: Adjusting geometry for rcu_fanout_leaf=16, nr_cpu_ids=1
- [ 0.000000] NR_IRQS:16 nr_irqs:16 16
- [ 0.000000] IRQ: Found an INTC at 0xfa200000 (revision 5.0) with 128 interrupts
- [ 0.000000] Total of 128 interrupts on 1 active controller
- [ 0.000000] OMAP clockevent source: timer2 at 24000000 Hz
- [ 0.000014] sched_clock: 32 bits at 24MHz, resolution 41ns, wraps every 178956969942ns
- [ 0.000064] OMAP clocksource: timer1 at 24000000 Hz
- [ 0.000795] Console: colour dummy device 80x30
- [ 0.000845] Lock dependency validator: Copyright (c) 2006 Red Hat, Inc., Ingo Molnar
- [ 0.000853] ... MAX_LOCKDEP_SUBCLASSES: 8
- [ 0.000861] ... MAX_LOCK_DEPTH: 48
- [ 0.000869] ... MAX_LOCKDEP_KEYS: 8191
- [ 0.000876] ... CLASSHASH_SIZE: 4096
- [ 0.000884] ... MAX_LOCKDEP_ENTRIES: 32768
- [ 0.000890] ... MAX_LOCKDEP_CHAINS: 65536
- [ 0.000898] ... CHAINHASH_SIZE: 32768
- [ 0.000905] memory used by lock dependency info: 5167 kB
- [ 0.000913] per task-struct memory footprint: 1152 bytes
- [ 0.000956] Calibrating delay loop... 996.14 BogoMIPS (lpj=4980736)
- [ 0.079037] pid_max: default: 32768 minimum: 301
- [ 0.079443] Security Framework initialized
- [ 0.079567] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
- [ 0.079580] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
- [ 0.081764] CPU: Testing write buffer coherency: ok
- [ 0.082949] CPU0: thread -1, cpu 0, socket -1, mpidr 0
- [ 0.083077] Setting up static identity map for 0x805dbb70 - 0x805dbbe0
- [ 0.086307] Brought up 1 CPUs
- [ 0.086326] SMP: Total of 1 processors activated.
- [ 0.086336] CPU: All CPU(s) started in SVC mode.
- [ 0.088948] devtmpfs: initialized
- [ 0.097822] VFP support v0.3: implementor 41 architecture 3 part 30 variant c rev 3
- [ 0.133146] omap_hwmod: tptc0 using broken dt data from edma
- [ 0.133495] omap_hwmod: tptc1 using broken dt data from edma
- [ 0.133823] omap_hwmod: tptc2 using broken dt data from edma
- [ 0.141643] omap_hwmod: debugss: _wait_target_disable failed
- [ 0.199665] pinctrl core: initialized pinctrl subsystem
- [ 0.202194] regulator-dummy: no parameters
- [ 0.232293] NET: Registered protocol family 16
- [ 0.240857] DMA: preallocated 256 KiB pool for atomic coherent allocations
- [ 0.243121] cpuidle: using governor ladder
- [ 0.243149] cpuidle: using governor menu
- [ 0.255109] OMAP GPIO hardware version 0.1
- [ 0.270370] omap-gpmc 50000000.gpmc: could not find pctldev for node /pinmux@44e10800/nandflash_pins_s0, deferring probe
- [ 0.270413] platform 50000000.gpmc: Driver omap-gpmc requests probe deferral
- [ 0.274914] hw-breakpoint: debug architecture 0x4 unsupported.
- [ 0.320324] edma-dma-engine edma-dma-engine.0: TI EDMA DMA engine driver
- [ 0.321686] vbat: 5000 mV
- [ 0.322450] lis3_reg: no parameters
- [ 0.325863] SCSI subsystem initialized
- [ 0.326622] usbcore: registered new interface driver usbfs
- [ 0.326782] usbcore: registered new interface driver hub
- [ 0.330704] usbcore: registered new device driver usb
- [ 0.331558] omap_i2c 44e0b000.i2c: could not find pctldev for node /pinmux@44e10800/pinmux_i2c0_pins, deferring probe
- [ 0.331597] platform 44e0b000.i2c: Driver omap_i2c requests probe deferral
- [ 0.331654] omap_i2c 4802a000.i2c: could not find pctldev for node /pinmux@44e10800/pinmux_i2c1_pins, deferring probe
- [ 0.331677] platform 4802a000.i2c: Driver omap_i2c requests probe deferral
- [ 0.332863] Advanced Linux Sound Architecture Driver Initialized.
- [ 0.336272] Switched to clocksource timer1
- [ 0.489380] NET: Registered protocol family 2
- [ 0.491239] TCP established hash table entries: 4096 (order: 2, 16384 bytes)
- [ 0.491422] TCP bind hash table entries: 4096 (order: 5, 147456 bytes)
- [ 0.492785] TCP: Hash tables configured (established 4096 bind 4096)
- [ 0.492955] TCP: reno registered
- [ 0.492981] UDP hash table entries: 256 (order: 2, 20480 bytes)
- [ 0.493170] UDP-Lite hash table entries: 256 (order: 2, 20480 bytes)
- [ 0.494207] NET: Registered protocol family 1
- [ 0.496281] RPC: Registered named UNIX socket transport module.
- [ 0.496304] RPC: Registered udp transport module.
- [ 0.496314] RPC: Registered tcp transport module.
- [ 0.496323] RPC: Registered tcp NFSv4.1 backchannel transport module.
- [ 0.498147] hw perfevents: enabled with armv7_cortex_a8 PMU driver, 5 counters available
- [ 0.502301] futex hash table entries: 256 (order: 2, 16384 bytes)
- [ 0.507875] VFS: Disk quotas dquot_6.5.2
- [ 0.508024] Dquot-cache hash table entries: 1024 (order 0, 4096 bytes)
- [ 0.510137] NFS: Registering the id_resolver key type
- [ 0.510482] Key type id_resolver registered
- [ 0.510497] Key type id_legacy registered
- [ 0.510654] jffs2: version 2.2. (NAND) (SUMMARY) 漏 2001-2006 Red Hat, Inc.
- [ 0.511074] msgmni has been set to 977
- [ 0.516250] io scheduler noop registered
- [ 0.516287] io scheduler deadline registered
- [ 0.516358] io scheduler cfq registered (default)
- [ 0.518591] pinctrl-single 44e10800.pinmux: 142 pins at pa f9e10800 size 568
- [ 0.523698] backlight supply power not found, using dummy regulator
- [ 0.527040] Serial: 8250/16550 driver, 4 ports, IRQ sharing enabled
- [ 0.533191] omap_uart 44e09000.serial: no wakeirq for uart0
- [ 0.533803] 44e09000.serial: ttyO0 at MMIO 0x44e09000 (irq = 88, base_baud = 3000000) is a OMAP UART0
- [ 1.234091] console [ttyO0] enabled
- [ 1.243201] omap_rng 48310000.rng: OMAP Random Number Generator ver. 20
- [ 1.250887] [drm] Initialized drm 1.1.0 20060810
- [ 1.264563] [drm] Supports vblank timestamp caching Rev 2 (21.10.2013).
- [ 1.271671] [drm] No driver support for vblank timestamp query.
- [ 1.331494] Console: switching to colour frame buffer device 100x30
- [ 1.342552] tilcdc 4830e000.lcdc: fb0: frame buffer device
- [ 1.348442] tilcdc 4830e000.lcdc: registered panic notifier
- [ 1.354341] [drm] Initialized tilcdc 1.0.0 20121205 on minor 0
- [ 1.390556] brd: module loaded
- [ 1.408704] loop: module loaded
- [ 1.414966] mtdoops: mtd device (mtddev=name/number) must be supplied
- [ 1.425658] usbcore: registered new interface driver asix
- [ 1.431555] usbcore: registered new interface driver ax88179_178a
- [ 1.438078] usbcore: registered new interface driver cdc_ether
- [ 1.444343] usbcore: registered new interface driver smsc95xx
- [ 1.450493] usbcore: registered new interface driver net1080
- [ 1.456543] usbcore: registered new interface driver cdc_subset
- [ 1.462850] usbcore: registered new interface driver zaurus
- [ 1.468911] usbcore: registered new interface driver cdc_ncm
- [ 1.475931] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
- [ 1.482939] ehci-omap: OMAP-EHCI Host Controller driver
- [ 1.488833] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
- [ 1.495347] ohci-omap3: OHCI OMAP3 driver
- [ 1.500021] usbcore: registered new interface driver cdc_wdm
- [ 1.506178] usbcore: registered new interface driver usb-storage
- [ 1.512631] usbcore: registered new interface driver usbtest
- [ 1.521522] 47401300.usb-phy supply vcc not found, using dummy regulator
- [ 1.533165] musb-hdrc musb-hdrc.0.auto: MUSB HDRC host driver
- [ 1.543455] musb-hdrc musb-hdrc.0.auto: new USB bus registered, assigned bus number 1
- [ 1.562104] usb usb1: New USB device found, idVendor=1d6b, idProduct=0002
- [ 1.569359] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
- [ 1.576955] usb usb1: Product: MUSB HDRC host driver
- [ 1.582140] usb usb1: Manufacturer: Linux 3.17.2 musb-hcd
- [ 1.587820] usb usb1: SerialNumber: musb-hdrc.0.auto
- [ 1.599603] hub 1-0:1.0: USB hub found
- [ 1.605078] hub 1-0:1.0: 1 port detected
- [ 1.622178] 47401b00.usb-phy supply vcc not found, using dummy regulator
- [ 1.632793] musb-hdrc musb-hdrc.1.auto: MUSB HDRC host driver
- [ 1.640700] musb-hdrc musb-hdrc.1.auto: new USB bus registered, assigned bus number 2
- [ 1.651379] usb usb2: New USB device found, idVendor=1d6b, idProduct=0002
- [ 1.658617] usb usb2: New USB device strings: Mfr=3, Product=2, SerialNumber=1
- [ 1.666213] usb usb2: Product: MUSB HDRC host driver
- [ 1.671397] usb usb2: Manufacturer: Linux 3.17.2 musb-hcd
- [ 1.677083] usb usb2: SerialNumber: musb-hdrc.1.auto
- [ 1.686595] hub 2-0:1.0: USB hub found
- [ 1.690986] hub 2-0:1.0: 1 port detected
- [ 1.701609] mousedev: PS/2 mouse device common for all mice
- [ 1.711782] omap_rtc 44e3e000.rtc: rtc core: registered 44e3e000.rtc as rtc0
- [ 1.720055] i2c /dev entries driver
- [ 1.723788] Driver for 1-wire Dallas network protocol.
- [ 1.736318] omap_wdt: OMAP Watchdog Timer Rev 0x01: initial timeout 60 sec
- [ 1.755078] omap_hsmmc 48060000.mmc: unable to get vmmc regulator -517
- [ 1.762557] platform 48060000.mmc: Driver omap_hsmmc requests probe deferral
- [ 1.772215] ledtrig-cpu: registered to indicate activity on CPUs
- [ 1.779192] usbcore: registered new interface driver usbhid
- [ 1.785014] usbhid: USB HID core driver
- [ 1.795167] davinci_evm sound: ASoC: CODEC (null) not registered
- [ 1.801977] davinci_evm sound: snd_soc_register_card failed (-517)
- [ 1.808594] platform sound: Driver davinci_evm requests probe deferral
- [ 1.816440] oprofile: using arm/armv7
- [ 1.821115] TCP: cubic registered
- [ 1.824592] Initializing XFRM netlink socket
- [ 1.829340] NET: Registered protocol family 17
- [ 1.834075] NET: Registered protocol family 15
- [ 1.839198] Key type dns_resolver registered
- [ 1.843920] omap_voltage_late_init: Voltage driver support not added
- [ 1.850660] sr_dev_init: No voltage domain specified for smartreflex0. Cannot initialize
- [ 1.859152] sr_dev_init: No voltage domain specified for smartreflex1. Cannot initialize
- [ 1.868786] ThumbEE CPU extension supported.
- [ 1.873392] Registering SWP/SWPB emulation handler
- [ 1.878502] SmartReflex Class3 initialized
- [ 1.891065] omap-gpmc 50000000.gpmc: GPMC revision 6.0
- [ 1.898216] nand: device found, Manufacturer ID: 0xec, Chip ID: 0xd3
- [ 1.904865] nand: Samsung NAND 1GiB 3,3V 8-bit
- [ 1.909588] nand: 1024MiB, SLC, page size: 2048, OOB size: 64
- [ 1.915591] nand: using OMAP_ECC_BCH8_CODE_HW ECC scheme
- [ 1.921433] 10 ofpart partitions found on MTD device omap2-nand.0
- [ 1.927825] Creating 10 MTD partitions on "omap2-nand.0":
- [ 1.933473] 0x000000000000-0x000000020000 : "NAND.SPL"
- [ 1.947581] 0x000000020000-0x000000040000 : "NAND.SPL.backup1"
- [ 1.958288] 0x000000040000-0x000000060000 : "NAND.SPL.backup2"
- [ 1.967696] 0x000000060000-0x000000080000 : "NAND.SPL.backup3"
- [ 1.978978] 0x000000080000-0x0000000c0000 : "NAND.u-boot-spl"
- [ 1.989074] 0x0000000c0000-0x0000001c0000 : "NAND.u-boot"
- [ 2.000439] 0x0000001c0000-0x0000001e0000 : "NAND.u-boot-env"
- [ 2.010926] 0x0000001e0000-0x000000200000 : "NAND.u-boot-env.backup1"
- [ 2.022841] 0x000000200000-0x000000a00000 : "NAND.kernel"
- [ 2.038984] 0x000000a00000-0x000010000000 : "NAND.file-system"
- [ 2.332279] tps65910 0-002d: No interrupt support, no core IRQ
- [ 2.349898] vrtc: 1800 mV
- [ 2.353264] vrtc: supplied by vbat
- [ 2.360422] vio: at 1500 mV
- [ 2.363696] vio: supplied by vbat
- [ 2.370657] vdd_mpu: 912 <--> 1312 mV at 1325 mV
- [ 2.375794] vdd_mpu: supplied by vbat
- [ 2.384999] vdd_core: 912 <--> 1150 mV at 1137 mV
- [ 2.390404] vdd_core: supplied by vbat
- [ 2.397288] vdd3: 5000 mV
- [ 2.402667] vdig1: at 1800 mV
- [ 2.406225] vdig1: supplied by vbat
- [ 2.412538] vdig2: at 1800 mV
- [ 2.415945] vdig2: supplied by vbat
- [ 2.422351] vpll: at 1800 mV
- [ 2.425662] vpll: supplied by vbat
- [ 2.432822] vdac: at 1800 mV
- [ 2.436335] vdac: supplied by vbat
- [ 2.443361] vaux1: at 1800 mV
- [ 2.446899] vaux1: supplied by vbat
- [ 2.453342] vaux2: at 3300 mV
- [ 2.456846] vaux2: supplied by vbat
- [ 2.463190] vaux33: at 3300 mV
- [ 2.466775] vaux33: supplied by vbat
- [ 2.473172] vmmc: 1800 <--> 3300 mV at 3300 mV
- [ 2.478237] vmmc: supplied by vbat
- [ 2.484283] vbb: at 3000 mV
- [ 2.487872] vbb: supplied by vbat
- [ 2.495458] omap_i2c 44e0b000.i2c: bus 0 rev0.11 at 400 kHz
- [ 2.503173] usb 2-1: new high-speed USB device number 2 using musb-hdrc
- [ 2.517638] omap_i2c 4802a000.i2c: bus 1 rev0.11 at 100 kHz
- [ 2.568304] wm8960 0-001a: No platform data supplied
- [ 2.644805] mmc0: host does not support reading read-only switch. assuming write-enable.
- [ 2.654108] usb 2-1: New USB device found, idVendor=1a40, idProduct=0101
- [ 2.661182] usb 2-1: New USB device strings: Mfr=0, Product=1, SerialNumber=0
- [ 2.668663] usb 2-1: Product: USB 2.0 Hub
- [ 2.675544] hub 2-1:1.0: USB hub found
- [ 2.681178] hub 2-1:1.0: 4 ports detected
- [ 2.690227] mmc0: new high speed SDHC card at address aaaa
- [ 2.699372] mmcblk0: mmc0:aaaa SL16G 14.8 GiB
- [ 2.710574] mmcblk0: p1 p2
- [ 2.723345] davinci_evm sound: wm8960-hifi <-> 4803c000.mcasp mapping ok
- [ 2.806163] davinci_mdio 4a101000.mdio: davinci mdio revision 1.6
- [ 2.812552] davinci_mdio 4a101000.mdio: detected phy mask ffffffde
- [ 2.825370] libphy: 4a101000.mdio: probed
- [ 2.829704] davinci_mdio 4a101000.mdio: phy[0]: device 4a101000.mdio:00, driver unknown
- [ 2.838093] davinci_mdio 4a101000.mdio: phy[5]: device 4a101000.mdio:05, driver unknown
- [ 2.847649] cpsw 4a100000.ethernet: Detected MACID = c4:ed:ba:88:b5:e4
- [ 2.859600] input: gpio_keyad@0 as /devices/gpio_keyad@0/input/input0
- [ 2.869505] omap_rtc 44e3e000.rtc: setting system clock to 2000-01-01 00:00:00 UTC (946684800)
- [ 2.878657] sr_init: No PMIC hook to init smartreflex
- [ 2.884274] sr_init: platform driver register failed for SR
- [ 2.907467] lis3_reg: disabling
- [ 2.910975] ALSA device list:
- [ 2.914075] #0: AM335x-EVM
- [ 3.008783] kjournald starting. Commit interval 5 seconds
- [ 3.017395] EXT3-fs (mmcblk0p2): using internal journal
- [ 3.025475] EXT3-fs (mmcblk0p2): recovery complete
- [ 3.030554] EXT3-fs (mmcblk0p2): mounted filesystem with ordered data mode
- [ 3.037888] VFS: Mounted root (ext3 filesystem) on device 179:2.
- [ 3.047778] devtmpfs: mounted
- [ 3.051614] Freeing unused kernel memory: 408K (c087c000 - c08e2000)
- ----------mount all...
- ----------Starting mdev......
-
-
- Please press Enter to activate this console.
- @tq335x #[ 11.296192] usb 2-1.2: new high-speed USB device number 3 using musb-hdrc
- [ 11.419745] usb 2-1.2: device v0951 p1665 is not supported
- [ 11.425483] usb 2-1.2: New USB device found, idVendor=0951, idProduct=1665
- [ 11.432693] usb 2-1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
- [ 11.440342] usb 2-1.2: Product: DataTraveler 2.0
- [ 11.445163] usb 2-1.2: Manufacturer: Kingston
- [ 11.449729] usb 2-1.2: SerialNumber: 50E549C20268FE41491C17E1
- [ 11.458198] usb-storage 2-1.2:1.0: USB Mass Storage device detected
- [ 11.476650] scsi host0: usb-storage 2-1.2:1.0
- [ 12.768968] scsi 0:0:0:0: Direct-Access Kingston DataTraveler 2.0 1.00 PQ: 0 ANSI: 4
- [ 12.785085] sd 0:0:0:0: [sda] 30233588 512-byte logical blocks: (15.4 GB/14.4 GiB)
- [ 12.806457] sd 0:0:0:0: [sda] Write Protect is off
- [ 12.817312] sd 0:0:0:0: [sda] Write cache: disabled, read cache: enabled, doesn't support DPO or FUA
- [ 12.840718] sda: sda4
- [ 12.850713] sd 0:0:0:0: [sda] Attached SCSI removable disk
- [ 13.265222] usb 2-1.2: USB disconnect, device number 3
末尾是拔插U盘的效果。
Step4. 配置其它USB设备驱动
如果需要配置其它USB设备驱动可以继续在menuconfig配置列表中进行配置,这里就不一一介绍了。
注:
不知道是我的开发板硬件问题还是其它问题,我自己移植的Linux-3.17.2只有中间的一个USB端口可用,另外两个USB端口没有任何作用。