gadget fs test fail as gadgetfs-test fails to run.
--
Linux version 3.16.0-rc4-ADI-2014R1-pre-00376-gb6f3b82 (test@uclinux63-bf527-usbdev) (gcc version 4.3.5 (ADI-master/git-a2bfd4
register early platform devices
bootconsole [early_shadow0] enabled
bootconsole [early_BFuart1] enabled
early printk enabled on early_BFuart1
Board Memory: 64MB
Kernel Managed Memory: 64MB
Memory map:
fixedcode = 0x00000400-0x00000490
text = 0x00001000-0x001fa3d0
rodata = 0x001fa3d0-0x002a2798
bss = 0x002a3000-0x002bba1c
data = 0x002bba20-0x002e2000
stack = 0x002e0000-0x002e2000
init = 0x002e2000-0x005c7000
available = 0x005c7000-0x03f00000
DMA Zone = 0x03f00000-0x04000000
Hardware Trace active and enabled
Boot Mode: 1
Blackfin support (C) 2004-2010 Analog Devices, Inc.
Compiled for ADSP-BF527 Rev 0.2
Blackfin Linux support by http://blackfin.uclinux.org/
Processor Speed: 525 MHz core clock and 131 MHz System Clock
NOMPU: setting up cplb tables
Instruction Cache Enabled for CPU0
External memory: cacheable in instruction cache
Data Cache Enabled for CPU0
External memory: cacheable (write-back) in data cache
Built 1 zonelists in Zone order, mobility grouping off. Total pages: 16002
Kernel command line: root=/dev/mtdblock0 rw clkin_hz=25000000 earlyprintk=serial,uart1,57600 console=ttyBF1,57600 ip=10.100.4f
PID hash table entries: 256 (order: -2, 1024 bytes)
Dentry cache hash table entries: 8192 (order: 3, 32768 bytes)
Inode-cache hash table entries: 4096 (order: 2, 16384 bytes)
Memory: 57988K/64512K available (2020K kernel code, 153K rwdata, 672K rodata, 2964K init, 98K bss, 6524K reserved, 1024K DMA)
NR_IRQS:159
Configuring Blackfin Priority Driven Interrupts
Console: colour dummy device 80x25
Calibrating delay loop... 1044.48 BogoMIPS (lpj=2088960)
pid_max: default: 32768 minimum: 301
Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
devtmpfs: initialized
Blackfin Scratchpad data SRAM: 4 KB
Blackfin L1 Data A SRAM: 16 KB (16 KB free)
Blackfin L1 Data B SRAM: 16 KB (16 KB free)
Blackfin L1 Instruction SRAM: 48 KB (42 KB free)
NET: Registered protocol family 16
Blackfin DMA Controller
ezkit_init(): registering device resources
SCSI subsystem initialized
bfin-spi bfin-spi.0: master is unqueued, this is deprecated
bfin-spi bfin-spi.0: Blackfin on-chip SPI Controller Driver, Version 1.0, regs@ffc00500, dma channel@7
usbcore: registered new interface driver usbfs
usbcore: registered new interface driver hub
usbcore: registered new device driver usb
i2c-bfin-twi i2c-bfin-twi.0: Blackfin on-chip I2C TWI Contoller, regs_base@ffc01400
Advanced Linux Sound Architecture Driver Initialized.
NET: Registered protocol family 2
TCP established hash table entries: 1024 (order: 0, 4096 bytes)
TCP bind hash table entries: 1024 (order: 0, 4096 bytes)
TCP: Hash tables configured (established 1024 bind 1024)
TCP: reno registered
UDP hash table entries: 256 (order: 0, 4096 bytes)
UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
NET: Registered protocol family 1
debug-mmrs: setting up Blackfin MMR debugfs
msgmni has been set to 113
io scheduler noop registered (default)
dma_alloc_init: dma_page @ 0x0249c000 - 256 pages at 0x03f00000
Console: switching to colour frame buffer device 40x30
bfin-lq035q1 bfin-lq035q1: 320x240 16-bit RGB FrameBuffer initialized
bfin-uart: Blackfin serial driver
bfin-uart.1: ttyBF1 at MMIO 0xffc02000 (irq = 31, base_baud = 8203125) is a BFIN-UART
console [ttyBF1] enabled
console [ttyBF1] enabled
bootconsole [early_BFuart1] disabled
bootconsole [early_BFuart1] disabled
bootconsole [early_shadow0] disabled
bfin-otp: initialized
brd: module loaded
adp5520 0-0032: failed writing 0x80 to 0x00
adp5520 0-0032: failed to write
adp5520: probe of 0-0032 failed with error -1
m25p80 spi0.1: m25p16 (2048 Kbytes)
Creating 2 MTD partitions on "m25p80":
0x000000000000-0x000000040000 : "bootloader(spi)"
0x000000040000-0x000000200000 : "linux kernel(spi)"
libphy: bfin_mii_bus: probed
bfin_mac: attached PHY driver [Generic PHY] (mii_bus:phy_addr=bfin_mii_bus-0:01, irq=-1, mdc_clk=2500000Hz(mdc_div=25)@sclk=1)
bfin_mac bfin_mac.0 eth0: Blackfin on-chip Ethernet MAC driver, Version 1.1
usbcore: registered new interface driver usb-storage
musb-hdrc musb-hdrc.1.auto: MUSB HDRC host driver
musb-hdrc musb-hdrc.1.auto: new USB bus registered, assigned bus number 1
hub 1-0:1.0: USB hub found
hub 1-0:1.0: 1 port detected
ad7879 0-002c: Failed to write AD7879 Touchscreen
ad7879: probe of 0-002c failed with error -1
rtc (null): invalid alarm value: 1900-1-16 0:0:0
rtc-bfin rtc-bfin: rtc core: registered rtc-bfin as rtc0
bfin_wdt: initialized: timeout=20 sec (nowayout=0)
usbcore: registered new interface driver usbhid
usbhid: USB HID core driver
bfin-i2s bfin-i2s.0: dma rx:3 tx:4, err irq:15, regs:ffc00800
soc-audio soc-audio: ASoC: machine bfin-ssm2602 should use snd_soc_register_card()
ssm2602 0-001b: Failed to issue reset: -5
ssm2602 0-001b: ASoC: failed to probe CODEC -5
soc-audio soc-audio: ASoC: failed to instantiate card -5
soc-audio: probe of soc-audio failed with error -5
TCP: cubic registered
NET: Registered protocol family 17
rtc-bfin rtc-bfin: setting system clock to 1970-08-16 12:11:14 UTC (19656674)
IP-Config: Complete:
device=eth0, hwaddr=00:e0:22:fe:bf:34, ipaddr=10.100.4.50, mask=255.255.255.0, gw=10.100.4.174
host=bf527-ezkit, domain=, nis-domain=(none)
bootserver=10.100.4.174, rootserver=10.100.4.174, rootpath=
ALSA device list:
No soundcards found.
Freeing unused kernel memory: 2964K (002e2000 - 005c7000)
BusyBox v1.22.1 (2014-07-17 17:40:14 CST) hush - the humble shell
root:/> bfin_mac bfin_mac.0 eth0: Link is Up - 100Mbps/Full - flow control rx/tx
random: nonblocking pool is initialized
root:/>
root:/> modprobe gadgetfs
gadgetfs: USB Gadget filesystem, version 24 Aug 2004
root:/>
root:/> mkdir /dev/gadget
root:/>
root:/> mount -t gadgetfs gadgetfs /dev/gadget
root:/>
root:/> ls /dev/gadget/ -l
-rw------- 1 root root 0 Aug 16 12:14 musb-hdrc
root:/>
root:/> gadgetfs-test -r 1.3 -v
gadgetfs: bound to musb-hdrc driver
/dev/gadget/musb-hdrc ep0 configured
serial="1.3"
gadgetfs: connected
** SungAug 16 12:14:56 1970
ep0 read after poll: Invalid argument
adgetfs: disconnected
done
root:/>
--
There is a bug in filesystem. fd->f_op->read can't be called by vfs_read.
I found out that the vfs_read() returns with an error, because the file pointer does not have FMODE_CAN_READ flag set. (This is only done in open(), and since the dev_init_operations do not contain a .read() pointer, open() does not set this flag.)
Setting it manually when assigning the ep0_io_operations worked for me.