Since the release of the 2.4 kernel, Linux users gained serious USB support for a wide range of devices. The Linux USB subsystem, integrated in the kernel and already supported by most Linux distributions, including uClinux, supports all necessary features like plug-and-play, USB bandwidth allocation and more than 100 ports per bus. USB development is very active in the 2.6 kernel tree.
Before you can connect a USB Peripherals, you must have a working host device in your system. For x86 Linux - this usually means a Universal Host Controller Interface (UHCI, used by Intel & Via chipsets) and the Open Host Controller Interface (OHCI, used by Compaq, Apple, SiS, OPTi, Lucent and ALi chipsets). These are a common register level interface, allowing Linux developers to write two drivers, and making USB support available to anyone with a modern motherboard. Since most embedded Linux do not use UHCI or OHCI, you will need a specific Host Controller driver for the chipset you want to use.
On the Blackfin BF54x,BF52x and BF60x, the USB controller that is used is the Mentor Graphics MUSBHSFC USB 2.0 High-Speed Function Controller. While this IP Block can be found in many other embedded processors, there are many optional features which are specified at the time of implementation. The Analog Devices designers choose to implement a subset of the available options, and as so, it can not support USB Hub devices as a host. (You can not plug a hub into the USB controller found on the BF54x or BF52x). The BF60x uses a later version of the above USB IP block, which is a multi-point controller implementation and as such hub support is provided.
On bf527 ezkit-v2 sw13 position 2 must be set off and position 3 set on in order to support musb host mode. You can find the details here
BF527_EZKIT_Lite_manual_Rev_1.6
On bf609-ezkit if board version is 0.1,musb CLK must changed to 24Mhz like:
diff --git a/arch/blackfin/mach-bf609/boards/ezkit.c b/arch/blackfin/mach-bf609/boards/ezkit.c index 1222cfb..74c6d10 100644 --- a/arch/blackfin/mach-bf609/boards/ezkit.c +++ b/arch/blackfin/mach-bf609/boards/ezkit.c @@ -399,7 +399,7 @@ static struct musb_hdrc_config musb_config = { .dma = 1, .num_eps = 16, .dma_channels = 8, - .clkin = 48, /* musb CLKIN in MHZ */ + .clkin = 24, /* musb CLKIN in MHZ */ }; static struct musb_hdrc_platform_data musb_plat = {
The usb_otg controller operates in either of two USB operation modes (peripheral or host mode) at a given time.
In peripheral mode, the USB controller encodes, decodes, checks, and directs all USB packets sent and received, responding appropriately to host requests. Data is transferred from the processor core memory into the device’s Tx FIFOs to be transmitted onto USB as IN packets and in the other direction USB OUT packets are received into the Rx FIFOs (having being sent from the host) and transferred to system memory for processing or storage. In peripheral mode, the USB controller is acting as a slave device to another USB host; either a personal computer or another OTG host controller.
EZKIT with USB Mini_AB female receptacle (USB Peripheral) <---USB Mini_B male plug ----------- USB standard A female plug---> PC with USB standard A female receptacle (USB Hosts)
USB Mini_B male plug and USB standard A male plug:
[Linux Kernel Configuration] --> [Device Drivers] --> [USB support]
<*> Support for Host-side USB [*] USB device filesystem [*] USB device class-devices (DEPRECATED) <*> Inventra Highspeed Dual Role Controller (TI, ADI, ...) <*> Platform Glue Layer (Blackfin) ---> MUSB DMA mode (Inventra) ---> <*> USB Gadget Support ---> <*> USB Peripheral Controller (Inventra HDRC USB Peripheral (TI, ADI, ...)) ---> <*> USB Gadget Drivers (Gadget Zero (DEVELOPMENT)) ---> Gadget Zero (DEVELOPMENT)
Each USB peripheral that is plugged into the USB Host controller on the Blackfin needs its own driver. These drivers are host antagonistic (same driver runs on your Linux host as on the Blackfin), so determining which driver to use can be as easy as plugging the device into your development host.
imhotep:/home/rgetz # dmesg usb 3-1: new full speed USB device using uhci_hcd and address 4 usb 3-1: new device found, idVendor=04b3, idProduct=3004 usb 3-1: new device strings: Mfr=1, Product=2, SerialNumber=0 usb 3-1: Product: IBM USB HUB KEYBOARD usb 3-1: Manufacturer: Silitek usb 3-1: configuration #1 chosen from 1 choice hub 3-1:1.0: USB hub found hub 3-1:1.0: 3 ports detected usb 3-1.1: new full speed USB device using uhci_hcd and address 5 usb 3-1.1: new device found, idVendor=04b3, idProduct=3003 usb 3-1.1: new device strings: Mfr=1, Product=2, SerialNumber=0 usb 3-1.1: Product: IBM USB HUB KEYBOARD usb 3-1.1: Manufacturer: Silitek usb 3-1.1: configuration #1 chosen from 1 choice input: Silitek IBM USB HUB KEYBOARD as /class/input/input6 input: USB HID v1.00 Keyboard [Silitek IBM USB HUB KEYBOARD] on usb-0000:00:1d.2-1.1 input: Silitek IBM USB HUB KEYBOARD as /class/input/input7 input: USB HID v1.00 Device [Silitek IBM USB HUB KEYBOARD] on usb-0000:00:1d.2-1.1
Our basic view is that any USB device that works on a host Linux machine should work on the Blackfin. If it does not, it is a bug, and should be reported and fixed. Sometimes this is difficult, since we may need physical access to the device that is having problems. This will not be a list of tested devices, since the list would quickly grow so large it was unmanageable, but will be a short document that will detail how to provide the information we need to properly debug the USB driver.
Any device that is listed as working on the Linux USB project web site is expected to work on the Blackfin. This would include 416 audio devices, 235 communication devices, 217 HID devices, 410 digital imaging devices, 1002 mass storage devices, etc - now you understand why we don't keep our own list.
Here lists samples to enable some frequently used usb devices.
Device Drivers --> HID Devices --> --- Generic HID support [ ] HID debugging support --- USB Input Devices <*> USB Human Interface Device (full HID) support [ ] Enable support for iBook/PowerBook/MacBook/MacBookPro special keys [ ] Force feedback support (EXPERIMENTAL) [ ] /dev/hiddev raw HID device support
Plug in the USB keyboard, kernel outputs message like:
usb 1-1: new low speed USB device using musb_hdrc and address 2 usb 1-1: configuration #1 chosen from 1 choice input: Dell Dell USB Keyboard as /class/input/input0 input: USB HID v1.10 Keyboard [Dell Dell USB Keyboard] on usb-musb_hdrc.0-1
Kernel configuration is the same as configuration of USB keyboard.
When plugging in a USB mouse, there is output message like:
usb 1-1: new low speed USB device using musb_hdrc and address 3 usb 1-1: configuration #1 chosen from 1 choice input: HID 413c:3010 as /class/input/input1 input: USB HID v1.10 Mouse [HID 413c:3010] on usb-musb_hdrc.0-1
You may need to enable Input Device drivers before using the mouse. If the application uses /dev/input/eventX interface, enable:
--- Generic input layer (needed for keyboard, mouse, ...) <*> Event interface
To use /dev/input/mouseX interface, enable:
--- Generic input layer (needed for keyboard, mouse, ...) <*> Mouse interface
The framebuffer console shows example of using USB keyboard and mouse with framebuffer console and nano-x.
Please refer to examples here .
EZKIT with USB Mini_AB female receptacle (USB Peripheral) <---USB Mini_B male plug ----------- USB standard A male plug---> PC with USB standard A male recptacle (USB Hosts)
USB Mini_B male plug and USB standard A male plug:
[Linux Kernel Configuration] --> [Device Drivers] --> [USB support]
<*> Support for Host-side USB [*] USB device filesystem [*] USB device class-devices (DEPRECATED) <*> Inventra Highspeed Dual Role Controller (TI, ADI, ...) <*> Platform Glue Layer (Blackfin) ---> MUSB DMA mode (Inventra) --->
[Linux Kernel Configuration] --> [Device Drivers] --> [USB support] --> [USB Gadget Support]
<*> Support for USB Gadgets USB Peripheral Controller (Inventra HDRC USB Peripheral (TI, ADI, ...)) --->
usbcore: registered new interface driver usbfs usbcore: registered new interface driver hub usbcore: registered new device driver usb musb_hdrc: version 6.0, pio, peripheral, debug=0 musb_hdrc: USB Peripheral mode controller at ffc03c00 using PIO, IRQ 82
See the USB Gadget page for more information.
Currently, OTG support in the MUSB driver is incomplete. However, some of the cable based role switching works. (That is, grounding the ID pin switches the controller to host mode, while leaving it floating leaves it in peripheral mode.)
PM must be selected to support OTG.
Power management options ---> [*] Power Management support
Enable OTG mode.
<*> Support for Host-side USB [*] USB device filesystem [*] USB device class-devices (DEPRECATED) <*> Inventra Highspeed Dual Role Controller (TI, ADI, ...) <*> Platform Glue Layer (Blackfin) ---> MUSB DMA mode (Inventra) --->
At least one of the gadget drivers must be selected.For instance, Gadget Zero.
<*> Support for USB Gadgets <M> USB Gadget Drivers <M> Gadget Zero (DEVELOPMENT)
After compling the kernel and downloading the image to target board, make sure that the gadget driver must be loaded first. From the shown up message, it can be seen that gadget and host is ready and the target is waiting for inserting of Mini B-plug/Mini A-plug. Of course, the A-plug or B-plug can be inserted to the target before loading gadget driver.
root:/> modprobe g_zero autoresume=5 zero gadget: Gadget Zero, version: Cinco de Mayo 2008 zero gadget: zero ready musb_hdrc musb_hdrc.0: MUSB HDRC host driver musb_hdrc musb_hdrc.0: new USB bus registered, assigned bus number 1 usb usb1: configuration #1 chosen from 1 choice hub 1-0:1.0: USB hub found hub 1-0:1.0: 1 port detected
Board Version | CCLK | SCLK | Kernel Version | Toolchain Version | Usb Flash Type |
---|---|---|---|---|---|
BF548Ezkit-1.4 - Rev 0.1 | 525MHz | 131MHz | 2.6.28-rc2-ADI-2009R1-pre-svn5870 | gcc 4.1.2 (svn) | SanDisk U3 Cruzer Micro |
USB DMA |
---|
on |
mkfs.ext2 /dev/sdb1 mount /dev/sdb1 /mnt/ time dd conv=fsync if=/dev/zero of=/mnt/100m.bin bs=1M count=100 100+0 records in 100+0 records out real 0m 38.36s user 0m 0.00s sys 0m 4.00s
mkfs.vfat -F 32 /dev/sdb1 mount /dev/sdb1 /mnt/ time dd conv=fsync if=/dev/zero of=/mnt/100m.bin bs=1M count=100 100+0 records in 100+0 records out real 1m 17.84s user 0m 0.00s sys 0m 6.30s
Board Version | CCLK | SCLK | Kernel Version | Toolchain Version | Hard Disk | USB-IDE Bridge |
---|---|---|---|---|---|---|
BF548Ezkit-1.4 - Rev 0.1 | 525MHz | 131MHz | 2.6.28-rc2-ADI-2009R1-pre-svn5870 | gcc 4.1.2 (svn) | IBM-DTLA -307015 15.3GB | JMicron JM20337 |
USB DMA |
---|
on |
root:/> mkfs.ext2 /dev/sdb2 root:/> mount /dev/sdb2 /mnt/ root:/> time dd conv=fsync if=/dev/zero of=/mnt/100m.bin bs=1M count=100 100+0 records in 100+0 records out real 0m 7.34s user 0m 0.01s sys 0m 4.60s
root:/> mkfs.vfat -F 32 /dev/sdb1 root:/> mount /dev/sdb1 /mnt/ root:/> time dd conv=fsync if=/dev/zero of=/mnt/100m.bin bs=1M count=100 100+0 records in 100+0 records out real 0m 10.15s user 0m 0.00s sys 0m 6.72s
root:/> mkfs.ext2 /dev/sdb2 root:/> mount /dev/sdb2 /mnt/ root:/> bonnie++ -u root -d /mnt/
Version 1.94 Concurrency 1 File Size 300M File Number 16 ------Sequential Output------ --Sequential Input- --Random- -Per Chr- --Block-- -Rewrite- -Per Chr- --Block-- --Seeks-- K/sec %CP K/sec %CP K/sec %CP K/sec %CP K/sec %CP /sec %CP 40 99 15268 72 6420 53 78 99 10798 47 129.2 5 Latency 211ms 276ms 319ms 144ms 728ms 608ms ------Sequential Create------ --------Random Create-------- -Create-- --Read--- -Delete-- -Create-- --Read--- -Delete-- /sec %CP /sec %CP /sec %CP /sec %CP /sec %CP /sec %CP 16 182 99 2519 99 2019 98 187 99 2625 100 628 99 Latency 44000us 4000us 4000us 48000us 4000us 4000us
Version 1.94 | Sequential Output | Sequential Input | Random Seeks | Sequential Create | Random Create | |||||||||||||||||||||||
Concurrency | Size | Per Char | Block | Rewrite | Per Char | Block | Num Files | Create | Read | Delete | Create | Read | Delete | |||||||||||||||
K/sec | % CPU | K/sec | % CPU | K/sec | % CPU | K/sec | % CPU | K/sec | % CPU | /sec | % CPU | /sec | % CPU | /sec | % CPU | /sec | % CPU | /sec | % CPU | /sec | % CPU | /sec | % CPU | |||||
ubuntu-pc | 1 | 2G | 683 | 97 | 23860 | 4 | 11986 | 3 | 1238 | 97 | 29638 | 3 | 145.7 | 2 | 16 | 1975 | 56 | +++++ | +++ | +++++ | +++ | 3111 | 87 | +++++ | +++ | 8685 | 71 | |
ubuntu-pc | Latency | 20720us | 438ms | 351ms | 77591us | 22671us | 649ms | Latency | 12952us | 84us | 200us | 12481us | 227us | 523us |
root:/> mkfs.vfat -F 32 /dev/sdb1 root:/> mount /dev/sdb1 /mnt/ root:/> bonnie++ -u root -d /mnt
Version 1.94 ------Sequential Output------ --Sequential Input- --Random- Concurrency 1 -Per Chr- --Block-- -Rewrite- -Per Chr- --Block-- --Seeks-- Machine Size K/sec %CP K/sec %CP K/sec %CP K/sec %CP K/sec %CP /sec %CP blackfin 300M 33 99 9415 65 6131 69 78 99 10665 60 131.9 6 Latency 252ms 271ms 396ms 132ms 619ms 627ms Version 1.94 ------Sequential Create------ --------Random Create-------- blackfin -Create-- --Read--- -Delete-- -Create-- --Read--- -Delete-- files /sec %CP /sec %CP /sec %CP /sec %CP /sec %CP /sec %CP 16 3 99 5 100 58 99 4 99 5 100 9 99 Latency 828ms 388ms 64000us 479ms 384ms 572ms
root:/> mkfs.ext2 /dev/sdb2 root:/> mount /dev/sdb2 /mnt/ root:/> bonnie++ -u root -d /mnt/ -b
Version 1.94 ------Sequential Output------ --Sequential Input- --Random- Concurrency 1 -Per Chr- --Block-- -Rewrite- -Per Chr- --Block-- --Seeks-- Machine Size K/sec %CP K/sec %CP K/sec %CP K/sec %CP K/sec %CP /sec %CP blackfin 300M 38 99 16023 77 6735 56 76 99 10553 47 127.0 6 Latency 216ms 288ms 279ms 160ms 724ms 224ms Version 1.94 ------Sequential Create------ --------Random Create-------- blackfin -Create-- --Read--- -Delete-- -Create-- --Read--- -Delete-- files /sec %CP /sec %CP /sec %CP /sec %CP /sec %CP /sec %CP 16 109 64 2553 100 506 44 110 64 2649 99 310 59 Latency 72000us 4000us 131ms 80000us 4000us 207ms
Board Version | CCLK | SCLK | Kernel Version | Toolchain Version | Usb Flash Type |
---|---|---|---|---|---|
BF527Ezkit-2.0 - Rev 0.2 | 525MHz | 131MHz | 2.6.28.9-ADI-2009R1-pre-svn6244 | gcc 4.1.2 (svn) | SanDisk U3 Cruzer Micro |
USB DMA |
---|
on |
mkfs.ext2 /dev/sdb1 mount /dev/sdb1 /mnt/ time dd conv=fsync if=/dev/zero of=/mnt/100m.bin bs=1M count=100 100+0 records in 100+0 records out
mkfs.vfat -F 32 /dev/sdb1 mount /dev/sdb1 /mnt/ time dd conv=fsync if=/dev/zero of=/mnt/100m.bin bs=1M count=100 100+0 records in 100+0 records out real 0m 35.22s user 0m 0.00s sys 0m 6.44s
Board Version | CCLK | SCLK | Kernel Version | Toolchain Version | Hard Disk | USB-IDE Bridge |
---|---|---|---|---|---|---|
BF527Ezkit-2.0 - Rev 0.2 | 525MHz | 131MHz | 2.6.28.9-ADI-2009R1-pre-svn6244 | gcc 4.1.2 (svn) | IBM-DTLA -307015 15.3GB | JMicron JM20337 |
USB DMA |
---|
on |
root:/> mkfs.ext2 /dev/sdb2 root:/> mount /dev/sdb2 /mnt/ root:/> time dd conv=fsync if=/dev/zero of=/mnt/100m.bin bs=1M count=100 100+0 records in 100+0 records out real 0m 8.26s user 0m 0.00s sys 0m 5.61s
root:/> mkfs.vfat -F 32 /dev/sdb1 root:/> mount /dev/sdb1 /mnt/ root:/> time dd conv=fsync if=/dev/zero of=/mnt/100m.bin bs=1M count=100 100+0 records in 100+0 records out real 0m 11.05s user 0m 0.00s sys 0m 7.40s
root:/> mkfs.ext2 /dev/sdb2 root:/> mount /dev/sdb2 /mnt/ root:/> bonnie++ -u root -d /mnt/
Version 1.94 Concurrency 1 File Size 300M File Number 16 Version 1.94 ------Sequential Output------ --Sequential Input- --Random- Concurrency 1 -Per Chr- --Block-- -Rewrite- -Per Chr- --Block-- --Seeks-- Machine Size K/sec %CP K/sec %CP K/sec %CP K/sec %CP K/sec %CP /sec %CP blackfin 300M 48 99 13837 89 6925 69 199 99 13157 59 128.7 5 Latency 187ms 148ms 240ms 84000us 660ms 395ms Version 1.94 ------Sequential Create------ --------Random Create-------- blackfin -Create-- --Read--- -Delete-- -Create-- --Read--- -Delete-- files /sec %CP /sec %CP /sec %CP /sec %CP /sec %CP /sec %CP 16 223 99 8605 99 4858 94 220 99 9246 99 774 98 Latency 44000us 4000us 4000us 44000us 4000us 4000us
Version 1.94 | Sequential Output | Sequential Input | Random Seeks | Sequential Create | Random Create | |||||||||||||||||||||||
Concurrency | Size | Per Char | Block | Rewrite | Per Char | Block | Num Files | Create | Read | Delete | Create | Read | Delete | |||||||||||||||
K/sec | % CPU | K/sec | % CPU | K/sec | % CPU | K/sec | % CPU | K/sec | % CPU | /sec | % CPU | /sec | % CPU | /sec | % CPU | /sec | % CPU | /sec | % CPU | /sec | % CPU | /sec | % CPU | |||||
ubuntu-pc | 1 | 2G | 683 | 97 | 23860 | 4 | 11986 | 3 | 1238 | 97 | 29638 | 3 | 145.7 | 2 | 16 | 1975 | 56 | +++++ | +++ | +++++ | +++ | 3111 | 87 | +++++ | +++ | 8685 | 71 | |
ubuntu-pc | Latency | 20720us | 438ms | 351ms | 77591us | 22671us | 649ms | Latency | 12952us | 84us | 200us | 12481us | 227us | 523us |
root:/> mkfs.vfat -F 32 /dev/sdb1 root:/> mount /dev/sdb1 /mnt/ root:/> bonnie++ -u root -d /mnt
Version 1.94 ------Sequential Output------ --Sequential Input- --Random- Concurrency 1 -Per Chr- --Block-- -Rewrite- -Per Chr- --Block-- --Seeks-- Machine Size K/sec %CP K/sec %CP K/sec %CP K/sec %CP K/sec %CP /sec %CP blackfin 300M 45 99 8320 57 6380 61 194 99 14556 55 121.1 5 Latency 203ms 171ms 335ms 124ms 656ms 411ms Version 1.94 ------Sequential Create------ --------Random Create-------- blackfin -Create-- --Read--- -Delete-- -Create-- --Read--- -Delete-- files /sec %CP /sec %CP /sec %CP /sec %CP /sec %CP /sec %CP 16 7 99 6481 99 96 99 10 99 8865 100 22 96 Latency 424ms 8000us 28000us 220ms 4000us 300ms
root:/> mkfs.ext2 /dev/sdb2 root:/> mount /dev/sdb2 /mnt/ root:/> bonnie++ -u root -d /mnt/ -b
Version 1.94 ------Sequential Output------ --Sequential Input- --Random- Concurrency 1 -Per Chr- --Block-- -Rewrite- -Per Chr- --Block-- --Seeks-- Machine Size K/sec %CP K/sec %CP K/sec %CP K/sec %CP K/sec %CP /sec %CP blackfin 300M 48 99 15715 89 7792 64 199 99 14803 57 120.3 5 Latency 187ms 83999us 220ms 99ms 564ms 196ms Version 1.94 ------Sequential Create------ --------Random Create-------- blackfin -Create-- --Read--- -Delete-- -Create-- --Read--- -Delete-- files /sec %CP /sec %CP /sec %CP /sec %CP /sec %CP /sec %CP 16 123 63 8770 99 615 33 126 63 9437 99 322 55 Latency 72000us 4000us 23999us 92000us 4000us 228ms
Board Version | CCLK | SCLK | Kernel Version | Toolchain Version | Usb Flash Type |
---|---|---|---|---|---|
BF609 Ezboard-1.0 - Rev 0.0 | 500MHz | 100MHz | 3.3.0-ADI-2012R1-pre-00015-ge0e12f1 | gcc 4.3.4 (svn) | SanDisk U3 Cruzer Micro |
USB DMA |
---|
on |
root:/> mkfs.ext2 /dev/sdb2 root:/> mount /dev/sdb2 /mnt/ root:/> bonnie++ -u root -d /mnt/
Version 1.94 Concurrency 1 File Size 200M File Number 16 Version 1.94 ------Sequential Output------ --Sequential Input- --Random- Concurrency 1 -Per Chr- --Block-- -Rewrite- -Per Chr- --Block-- --Seeks-- Machine Size K/sec %CP K/sec %CP K/sec %CP K/sec %CP K/sec %CP /sec %CP blackfin 200M 42 98 2465 12 2321 14 177 99 15157 49 137.7 6 Latency 782ms 5592ms 3032ms 54132us 6646us 48772us Version 1.94 ------Sequential Create------ --------Random Create-------- blackfin -Create-- --Read--- -Delete-- -Create-- --Read--- -Delete-- files /sec %CP /sec %CP /sec %CP /sec %CP /sec %CP /sec %CP 16 205 98 12564 100 2584 48 205 97 15692 99 646 92 Latency 18265us 564us 1188us 19353us 292us 4667us