This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

USB hotplug AM3517

Other Parts Discussed in Thread: AM3517, OMAPL138

Hi,

I have a custom board based on an AM3517 processor and running Linux 2.6.37. I am using the USB OTG port in host only mode but I am having trouble with hotplugging a USB mass storage (memory stick) device.

When booting with the USB memory inserted in the host port, the memory will not be mounted. If I remove the USB memory and insert it again it will be mounted and the folders and files can be browsed in the console under /mnt/usb. Also sometimes when removing the USB memory from the host port it will not dismount so the folders and files are still visible in /mnt/usb. This results in a kernel spinlock if a user application is trying to read from a file found in /mnt/usb but the memory is not inserted.

If anyone have any idea of what could be wrong I would appreciate any input on this problem. I am really struggling to understand why the memory is not mounted/dismounted correctly each time.

In /etc/init.d I have a script S10mdev with the following code which is run at boot:

#!/bin/sh
#
# Start mdev....
#

case "$1" in
  start)
        echo "Starting mdev..."
        /bin/echo /sbin/mdev > /proc/sys/kernel/hotplug
        /sbin/mdev -s
        ;;
  stop)
        ;;
  restart|reload)
        ;;
  *)
        echo $"Usage: $0 {start|stop|restart}"
        exit 1
esac

exit $?

When booting with a USB memory stick inserted in the host I get the following output in the console:

Boot 1.51 R5 1.1 (Oct  8 2012 - 18:25:04)
Booting from nand . . .
Starting OS Bootloader...


U-Boot 2010.06 (Oct 08 2012 - 18:08:16) R5 1.2

I2C:   ready
DRAM:  256 MiB
NAND:  HW ECC selected
1024 MiB
Using default environment

In:    serial
Out:   serial
Err:   serial
Die ID #63d60001000000000160ae2c1701d017
8 BIT SW ECC selected
Hit any key to stop autoboot:  0
Booting from nand ...
HW ECC selected

NAND read: device 0 offset 0xe0000, size 0x400000
 4194304 bytes read: OK
8 BIT SW ECC selected

NAND read: device 0 offset 0x4e0000, size 0x1296000
 19488768 bytes read: OK
## Booting kernel from Legacy Image at 82000000 ...
   Image Name:   Linux-2.6.37-r5_1.2
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    2696892 Bytes = 2.6 MiB
   Load Address: 80008000
   Entry Point:  80008000
   Verifying Checksum ... OK
   Loading Kernel Image ... OK
OK

Starting kernel ...

[    0.000000] Linux version 2.6.37-r5_1.2 (root@ubuntu9) (gcc version 4.4.6 (crosstool-NG 1.13.2 - buildroot 2011.11) ) #6 Thu Mar 7 15:02:17 CET 2013
[    0.000000] CPU: ARMv7 Processor [411fc087] revision 7 (ARMv7), cr=10c53c7f
[    0.000000] CPU: VIPT nonaliasing data cache, VIPT nonaliasing instruction cache
[    0.000000] Machine: AM3517 R5CDU
[    0.000000] Reserving 10485760 bytes SDRAM for VRAM
[    0.000000] Memory policy: ECC disabled, Data cache writeback
[    0.000000] AM3517 ES1.1 (l2cache iva sgx neon isp )
[    0.000000] SRAM: Mapped pa 0x40200000 to va 0xfe400000 size: 0x10000
[    0.000000] Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 62464
[    0.000000] Kernel command line: mem=256M ubi.mtd=4,2048 root=/dev/ram0 rw initrd=0x8ed6a000,19032k vram=10M omapfb.vram=0:4M,1:3M,2:3M console=ttyO2,115200n8 r5cdugpio.hw_rev=0 r5cdugpio.boot_pin=0
[    0.000000] PID hash table entries: 1024 (order: 0, 4096 bytes)
[    0.000000] Dentry cache hash table entries: 32768 (order: 5, 131072 bytes)
[    0.000000] Inode-cache hash table entries: 16384 (order: 4, 65536 bytes)
[    0.000000] Memory: 226MB 20MB = 246MB total
[    0.000000] Memory: 217756k/217756k available, 44388k reserved, 0K highmem
[    0.000000] Virtual kernel memory layout:
[    0.000000]     vector  : 0xffff0000 - 0xffff1000   (   4 kB)
[    0.000000]     fixmap  : 0xfff00000 - 0xfffe0000   ( 896 kB)
[    0.000000]     DMA     : 0xffc00000 - 0xffe00000   (   2 MB)
[    0.000000]     vmalloc : 0xd0800000 - 0xf8000000   ( 632 MB)
[    0.000000]     lowmem  : 0xc0000000 - 0xd0000000   ( 256 MB)
[    0.000000]     modules : 0xbf000000 - 0xc0000000   (  16 MB)
[    0.000000]       .init : 0xc0008000 - 0xc0093000   ( 556 kB)
[    0.000000]       .text : 0xc0093000 - 0xc0541018   (4793 kB)
[    0.000000]       .data : 0xc0542000 - 0xc06f0d60   (1724 kB)
[    0.000000] NR_IRQS:375
[    0.000000] Clocking rate (Crystal/Core/MPU): 26.0/332/500 MHz
[    0.000000] clock: set_rate for clock dpll5_ck to rate 120000000
[    0.000000] clk->set_rate(clk, rate)
[    0.000000] clock: set_rate for clock dpll5_m2_ck to rate 120000000
[    0.000000] Reprogramming SDRC clock to 332000000 Hz
[    0.000000] clock: set_rate for clock dpll3_m2_ck to rate 332000000
[    0.000000] clk->set_rate(clk, rate)
[    0.000000] omap3_core_dpll_m2_set_rate
[    0.000000] omap2_clksel_round_rate_div
[    0.000000] omap2_sdrc_get_params
[    0.000000] dpll3_m2_clk rate change failed: -22
[    0.000000] IRQ: Found an INTC at 0xfa200000 (revision 4.0) with 96 interrupts
[    0.000000] Total of 96 interrupts on 1 active controller
[    0.000000] GPMC revision 5.0
[    0.000000] Trying to install interrupt handler for IRQ368
[    0.000000] Trying to install interrupt handler for IRQ369
[    0.000000] Trying to install interrupt handler for IRQ370
[    0.000000] Trying to install interrupt handler for IRQ371
[    0.000000] Trying to install interrupt handler for IRQ372
[    0.000000] Trying to install interrupt handler for IRQ373
[    0.000000] Trying to install interrupt handler for IRQ374
[    0.000000] Trying to install type control for IRQ375
[    0.000000] Trying to set irq flags for IRQ375
[    0.000000] OMAP clockevent source: GPTIMER1 at 32768 Hz
[    0.000000] Console: colour dummy device 80x30
[    0.000000] Lock dependency validator: Copyright (c) 2006 Red Hat, Inc., Ingo Molnar
[    0.000000] ... MAX_LOCKDEP_SUBCLASSES:  8
[    0.000000] ... MAX_LOCK_DEPTH:          48
[    0.000000] ... MAX_LOCKDEP_KEYS:        8191
[    0.000000] ... CLASSHASH_SIZE:          4096
[    0.000000] ... MAX_LOCKDEP_ENTRIES:     16384
[    0.000000] ... MAX_LOCKDEP_CHAINS:      32768
[    0.000000] ... CHAINHASH_SIZE:          16384
[    0.000000]  memory used by lock dependency info: 3951 kB
[    0.000000]  per task-struct memory footprint: 2304 bytes
[    0.000000] Calibrating delay loop... 502.07 BogoMIPS (lpj=1961984)
[    0.000000] pid_max: default: 32768 minimum: 301
[    0.000000] Security Framework initialized
[    0.000000] Mount-cache hash table entries: 512
[    0.000000] CPU: Testing write buffer coherency: ok
[    0.000000] devtmpfs: initialized
[    0.000000] regulator: core version 0.5
[    0.000000] regulator: dummy:
[    0.000000] NET: Registered protocol family 16
[    0.000000] OMAP GPIO hardware version 2.5
[    0.000000] OMAP GPIO hardware version 2.5
[    0.000000] OMAP GPIO hardware version 2.5
[    0.000000] OMAP GPIO hardware version 2.5
[    0.000000] OMAP GPIO hardware version 2.5
[    0.000000] OMAP GPIO hardware version 2.5
[    0.000000] omap_mux_init: Add partition: #1: core, flags: 0
[    0.000000] Display initialized successfully
[    0.000000] R5 CDU PWM driver register successfully
[    0.000000] _omap_mux_init_gpio: Multiple gpio paths (2) for gpio126
[    0.000000] hw-breakpoint: debug architecture 0x4 unsupported.
[    0.000000] OMAP DMA hardware revision 4.0
[    0.089019] bio: create slab <bio-0> at 0
[    0.099151] SCSI subsystem initialized
[    0.117980] usbcore: registered new interface driver usbfs
[    0.119873] usbcore: registered new interface driver hub
[    0.121124] usbcore: registered new device driver usb
[    0.127929] omap_device: omap_i2c.1: new worst case activate latency 0: 30517
[    0.128143] omap_i2c omap_i2c.1: bus 1 rev3.12 at 400 kHz
[    0.139160] regulator: VDCDC1: 1800 mV normal
[    0.141571] regulator: VDCDC2: 3300 mV normal
[    0.143737] regulator: VDCDC3: 1200 mV normal
[    0.145568] regulator: LDO1: 1800 mV normal
[    0.147247] regulator: LDO2: 1800 mV normal
[    0.148925] tps6507x_i2c_probe(): Setting TPS6507X_REG_CHGCONFIG1 to 0x30
[    0.149536] tps6507x_i2c_probe(): TPS6507X_REG_CHGCONFIG1 = 0x30
[    0.149749] omap_device: omap_i2c.1: new worst case deactivate latency 0: 30517
[    0.150177] omap_i2c omap_i2c.2: bus 2 rev3.12 at 400 kHz
[    0.163330] Advanced Linux Sound Architecture Driver Version 1.0.23.
[    0.169036] Switching to clocksource 32k_counter
[    0.356079] musb-hdrc: version 6.0, host, debug=0
[    0.356658] musb-hdrc musb-hdrc.0: degrade from otg to host-only mode
[    0.356872] musb-hdrc musb-hdrc.0: dma type: dma-cppi41
[    0.358642] <6>Waiting for PHY clock good...
[    0.374328] musb-hdrc musb-hdrc.0: MUSB HDRC host driver
[    0.376617] musb-hdrc musb-hdrc.0: new USB bus registered, assigned bus number 1
[    0.377777] usb usb1: New USB device found, idVendor=1d6b, idProduct=0002
[    0.377807] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[    0.377838] usb usb1: Product: MUSB HDRC host driver
[    0.377838] usb usb1: Manufacturer: Linux 2.6.37-r5_1.2 musb-hcd
[    0.377868] usb usb1: SerialNumber: musb-hdrc.0
[    0.386138] hub 1-0:1.0: USB hub found
[    0.386657] hub 1-0:1.0: 1 port detected
[    0.392974] musb-hdrc musb-hdrc.0: USB Host mode controller at d0810000 using DMA, IRQ 71
[    0.395355] NET: Registered protocol family 2
[    0.396545] IP route cache hash table entries: 2048 (order: 1, 8192 bytes)
[    0.398925] TCP established hash table entries: 8192 (order: 4, 65536 bytes)
[    0.399444] TCP bind hash table entries: 8192 (order: 6, 360448 bytes)
[    0.405059] TCP: Hash tables configured (established 8192 bind 8192)
[    0.405212] TCP reno registered
[    0.405242] UDP hash table entries: 128 (order: 1, 12288 bytes)
[    0.405670] UDP-Lite hash table entries: 128 (order: 1, 12288 bytes)
[    0.407073] NET: Registered protocol family 1
[    0.408630] Trying to unpack rootfs image as initramfs...
[    0.410308] rootfs image is not initramfs (junk in compressed archive); looks like an initrd
[    0.593566] Freeing initrd memory: 19032K
[    0.593597] NetWinder Floating Point Emulator V0.97 (double precision)
[    0.596343] omap_init_opp_table: no hwmod or odev for iva, [9] cannot add OPPs.
[    0.600189] AM3517  Linux PSP version 04.02.00.07 (AM3517R5CDU)
[    0.766693] VFS: Disk quotas dquot_6.5.2
[    0.766845] Dquot-cache hash table entries: 1024 (order 0, 4096 bytes)
[    0.768981] msgmni has been set to 462
[    0.776092] io scheduler noop registered
[    0.776123] io scheduler deadline registered
[    0.776336] io scheduler cfq registered (default)
[    0.841308] OMAP DSS rev 2.0
[    0.841430] omapdss supply vdds_dsi not found, using dummy regulator
[    0.842071] OMAP DISPC rev 3.0
[    0.842620] OMAP DSI rev 1.0
[    1.008850] Serial: 8250/16550 driver, 4 ports, IRQ sharing enabled
[    1.021820] omap_uart.0: ttyO0 at MMIO 0x4806a000 (irq = 72) is a OMAP UART0
[    1.024871] omap_uart.1: ttyO1 at MMIO 0x4806c000 (irq = 73) is a OMAP UART1
[    1.026916] omap_uart.2: ttyO2 at MMIO 0x49020000 (irq = 74) is a OMAP UART2
[    1.824829] console [ttyO2] enabled
[    1.829895] usb 1-1: new high speed USB device using musb-hdrc and address 2
[    1.840332] omap_uart.3: ttyO3 at MMIO 0x4809e000 (irq = 84) is a OMAP UART3
[    1.911987] brd: module loaded
[    1.946197] loop: module loaded
[    1.949859] at24 2-0050: 16384 byte 24c128 EEPROM (writable)
[    1.956420] omap_device: omap_i2c.2: new worst case activate latency 0: 122070
[    1.964721] Read MAC addr from EEPROM: ff:ff:ff:ff:ff:ff
[    1.971984] PWM0 init, clk rate: 13000000Hz
[    1.976593] PWM1 init, clk rate: 13000000Hz
[    1.981048] PWM2 init, clk rate: 13000000Hz
[    1.985595] PWM3 init, clk rate: 13000000Hz
[    1.993865] R5 CDU PWM driver initialized successfully
[    2.003173] R5 CDU LED dirver initialized successfully
[    2.012145] R5 CDU ADC driver initialized successfully
[    2.019561] [GPIO] 13 irq 173
[    2.023254] [GPIO] 140 irq 300
[    2.026672] [GPIO] 156 irq 316
[    2.033966] usb 1-1: New USB device found, idVendor=0781, idProduct=5406
[    2.041107] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[    2.048645] usb 1-1: Product: U3 Cruzer Micro
[    2.053253] usb 1-1: Manufacturer: SanDisk
[    2.057525] usb 1-1: SerialNumber: 0001187062503B8C
[    2.065612] R5 CDU GPIO driver initialized successfully
[    2.074737] R5 fpga spi: clkout2_src_ck=96000000Hz
[    2.079895] R5 fpga spi: sys_clkout2=96000000Hz
[    2.108673] mtdoops: mtd device (mtddev=name/number) must be supplied
[    2.117065] omap2-nand driver initializing
[    2.121917] ONFI flash detected
[    2.125488] ONFI param page 0 valid
[    2.129119] NAND device: Manufacturer ID: 0x2c, Chip ID: 0xd3 (Micron NAND 1GiB 3,3V 8-bit)
[    2.139556] cmdlinepart partition parsing not available
[    2.145019] Creating 5 MTD partitions on "omap2-nand.0":
[    2.150726] 0x000000000000-0x000000080000 : "xloader-nand"
[    2.170043] 0x000000080000-0x0000000e0000 : "uboot-nand"
[    2.184753] 0x0000000e0000-0x0000004e0000 : "linux-nand"
[    2.204956] 0x0000004e0000-0x0000084e0000 : "root-fs-nand"
[    2.288330] 0x0000084e0000-0x000040000000 : "rw-fs-nand"
[    2.778411] UBI: attaching mtd4 to ubi0
[    2.782623] UBI: physical eraseblock size:   131072 bytes (128 KiB)
[    2.789245] UBI: logical eraseblock size:    126976 bytes
[    2.794982] UBI: smallest flash I/O unit:    2048
[    2.799865] UBI: VID header offset:          2048 (aligned 2048)
[    2.806213] UBI: data offset:                4096
[    9.941711] UBI: max. sequence number:       74
[    9.997283] UBI: attached mtd4 to ubi0
[   10.001373] UBI: MTD device name:            "rw-fs-nand"
[   10.007110] UBI: MTD device size:            891 MiB
[   10.012268] UBI: number of good PEBs:        7129
[   10.017272] UBI: number of bad PEBs:         0
[   10.021972] UBI: number of corrupted PEBs:   0
[   10.026611] UBI: max. allowed volumes:       128
[   10.031494] UBI: wear-leveling threshold:    4096
[   10.036468] UBI: number of internal volumes: 1
[   10.041107] UBI: number of user volumes:     1
[   10.045837] UBI: available PEBs:             0
[   10.050445] UBI: total number of reserved PEBs: 7129
[   10.055694] UBI: number of PEBs reserved for bad PEB handling: 71
[   10.062133] UBI: max/mean erase counter: 2/1
[   10.066589] UBI: image sequence number:  388443473
[   10.072265] UBI: background thread "ubi_bgt0d" started, PID 469
[   10.130279] davinci_mdio davinci_mdio: davinci mdio revision 1.5
[   10.136596] davinci_mdio davinci_mdio: detected phy mask fffffffc
[   10.149871] davinci_mdio: probed
[   10.153259] davinci_mdio davinci_mdio: phy[0]: device ffffffff:00, driver unknown
[   10.161193] davinci_mdio davinci_mdio: phy[1]: device ffffffff:01, driver unknown
[   10.170928] vcan: Virtual CAN interface driver
[   10.175628] CAN device driver interface
[   10.179748] TI High End CAN Controller Driver 0.7
[   10.189270] ti_hecc ti_hecc: device registered (reg_base=d0880000, irq=24)
[   10.199554] Initializing USB Mass Storage driver...
[   10.207275] scsi0 : usb-storage 1-1:1.0
[   10.218566] usbcore: registered new interface driver usb-storage
[   10.225036] USB Mass Storage support registered.
[   10.231628] usbcore: registered new interface driver usbtest
[   10.242858] mice: PS/2 mouse device common for all mice
[   10.254455] input: gpio-keys as /devices/platform/gpio-keys/input/input0
[   10.284881] input: TPS6507x Touchscreen as /devices/platform/omap/omap_i2c.1/i2c-1/1-0048/input/input1
[   10.300720] i2c /dev entries driver
[   10.314941] lm75 1-004b: hwmon0: sensor 'lm75'
[   10.329437] OMAP Watchdog Timer Rev 0x31: initial timeout 60 sec
[   10.335906] omap_device: omap_wdt.-1: new worst case deactivate latency 0: 30517
[   10.371154] usbcore: registered new interface driver usbhid
[   10.377166] usbhid: USB HID core driver
[   10.387817] usbcore: registered new interface driver snd-usb-audio
[   10.413909] AM3517 R5 CDU SoC init
[   10.420379] 2-0018 supply IOVDD not found, using dummy regulator
[   10.426818] 2-0018 supply DVDD not found, using dummy regulator
[   10.433258] 2-0018 supply AVDD not found, using dummy regulator
[   10.439636] 2-0018 supply DRVDD not found, using dummy regulator
[   10.460876] asoc: tlv320aic3x-hifi <-> omap-mcbsp-dai.1 mapping ok
[   10.481353] R5CDU Sound DAC: sys_clkout1=26000000Hz
[   10.486633] ALSA device list:
[   10.489837]   #0: am3517_r5cdu
[   10.493011] oprofile: hardware counters not available
[   10.498352] oprofile: using timer interrupt.
[   10.503540] TCP cubic registered
[   10.507049] Initializing XFRM netlink socket
[   10.511749] NET: Registered protocol family 17
[   10.516967] NET: Registered protocol family 15
[   10.521697] can: controller area network core (rev 20090105 abi 8)
[   10.528808] NET: Registered protocol family 29
[   10.533599] can: raw protocol (rev 20090105)
[   10.538299] can: broadcast manager protocol (rev 20090105 t)
[   10.544403] Registering the dns_resolver key type
[   10.550140] VFP support v0.3: implementor 41 architecture 3 part 30 variant c rev 1
[   10.572265] ThumbEE CPU extension supported.
[   10.592285] am3517_vdd_data_configure: PMIC info requried to configure vdd_mpu notpopulated.Hence cannot initialize vdd_mpu
[   10.603973] am3517_vdd_data_configure: PMIC info requried to configure vdd_core notpopulated.Hence cannot initialize vdd_core
[   10.615936] omap_voltage_scale_vdd: No voltage scale API registered for vdd_mpu
[   10.623657] omap_voltage_scale_vdd: No voltage scale API registered for vdd_core
[   10.631469] Power Management for TI OMAP3.
[   10.691253] clock: disabling unused clocks to save power
[   10.777801] Console: switching to colour frame buffer device 100x30
[   10.803436] clock: set_rate for clock dpll4_m4_ck to rate 33230769
[   10.809875] clk->set_rate(clk, rate)
[   10.813751] omapdss DPI: Could not find exact pixel clock. Requested 33000 kHz, got 33230 kHz
[   10.882446] regulator_init_complete: incomplete constraints, leaving LDO2 on
[   10.890655] regulator_init_complete: incomplete constraints, leaving LDO1 on
[   10.899353] davinci_emac_probe: using random MAC addr: 8e:23:bc:7d:fb:fe
[   10.912628] drivers/rtc/hctosys.c: unable to open rtc device (rtc0)
[   10.924713] RAMDISK: cramfs filesystem found at block 0
[   10.930358] RAMDISK: Loading 19032KiB [1 disk] into ram disk... \
[   11.132720] omap_device: omap_i2c.1: new worst case deactivate latency 0: 61035
[   11.152038] |
[   11.228607] scsi 0:0:0:0: Direct-Access     SanDisk  U3 Cruzer Micro  6.51 PQ: 0 ANSI: 0 CCS
[   11.240844] \
[   11.295684] sd 0:0:0:0: [sda] 2025471 512-byte logical blocks: (1.03 GB/988 MiB)
[   11.318969] /
[   11.325744] sd 0:0:0:0: [sda] Write Protect is off
[   11.330963] sd 0:0:0:0: [sda] Assuming drive cache: write through
[   11.340026] -
[   11.376647] sd 0:0:0:0: [sda] Assuming drive cache: write through
[   11.386535] |
[   11.399353]  sda: sda1
[   11.417999] |
[   11.435882] sd 0:0:0:0: [sda] Assuming drive cache: write through
[   11.442413] sd 0:0:0:0: [sda] Attached SCSI removable disk
[   11.448944] done.
[   13.200561] omap_device: omap_i2c.1: new worst case deactivate latency 0: 122070
[   13.242828] VFS: Mounted root (cramfs filesystem) readonly on device 1:0.
[   13.251312] devtmpfs: mounted
[   13.254882] Freeing init memory: 556K
[   13.906524] UBIFS: mounted UBI device 0, volume 0, name "rw-fs-nand"
[   13.913330] UBIFS: file system size:   894291968 bytes (873332 KiB, 852 MiB, 7043 LEBs)
[   13.921752] UBIFS: journal size:       9023488 bytes (8812 KiB, 8 MiB, 72 LEBs)
[   13.929473] UBIFS: media format:       w4/r0 (latest is w4/r0)
[   13.935638] UBIFS: default compressor: lzo
[   13.939910] UBIFS: reserved for root:  0 bytes (0 KiB)
Starting logging: OK
Starting mdev...
sh: 0: unknown operand
Initializing random number generator... read-only file system detected...done
Starting network...
[   16.997497] omap_device: omap_i2c.1: new worst case deactivate latency 0: 183105
[   17.224822] davinci_mdio davinci_mdio: resetting idled controller
[   17.231628] net eth0: attached PHY driver [Generic PHY] (mii_bus:phy_addr=ffffffff:00, id=221537)
route: SIOCADDRT: Invalid argument
[   17.483825] ti_hecc ti_hecc: setting CANBTC=0xc00a8
Load R5 CDU FPGA...
[   17.587921] R5 fpga Firmware: register spi
[   17.685424] Waiting for INIT_B to go high...
[   17.689910] Starting SPI transfer, firmware size = 340604
[   17.907318] SPI transfer complete, waiting for FPGA_PRGRM_DONE..
[   17.923797] FPGA firmware loaded
Starting telnetd: OK
Starting applications....OK
Boot pin active

Welcome to Buildroot
buildroot login: [   19.225219] PHY: ffffffff:00 - Link is Up - 100/Full

  • The log shows the thumb drive is enumerated as /dev/sda1, so kernel has no problem to detect and enumerate the drive, the issue seems to be related to the root filesystem. What filesystem do you use? Have you tried the one in the AMSDK?

  • Hi,

    Thank you for your input.

    At boot the kernel often detects the USB drive and enumerate as /dev/sda1 but refuses to mount it on /mnt/usb. If I insert it after boot the kernel sometimes detects and mounts the memory correctly and sometimes it is not detected at all and no device nodes are created. It is very inconsistent.

    I use buildroot to create my own filesystem but I have a similar setup on an OMAPL138 based custom board and there I have no problem with USB.

    I have not tried with the root fs from the AMSDK, I do not have a AM3517 EVM, only my custom board. But since the hotplug function works sometimes I do not think it is a problem with the root fs. I am not really sure how hotplug function in Linux works but I guess that a hotplug event is created when a USB device is detected by the port and it seems that this hotplug event is not always created.

    I read somewhere in a wiki (that I can't find right now) that there is a known problem with hotplug with USB OTG port on the AM3517 and that it may be necessary to write "echo "F" > /proc/driver/musb_hdrc.0" to start a USB Host session. So I guess I have to do some sort of workaround in my user applications to make sure that USB drives are enumerated and mounted every time?

  • Henrik,

    Can you please clarify when the issue happens, does the drive get enumerated but not mounted? or it is not even got enumerated at all? you can find it from 'dmesg' command after insertion.

    If the drive is not enumerated, it is kernel issue. If it is enumerated but not mounted, I think that is user space (filesystem) issue.

    I think you could still use the AMSDK root filesystem on your board, at least from OTG perspective.

    Henrik Abrahamsson said:
    I read somewhere in a wiki (that I can't find right now) that there is a known problem with hotplug with USB OTG port on the AM3517 and that it may be necessary to write "echo "F" > /proc/driver/musb_hdrc.0" to start a USB Host session

    I believe you already have the workaround in your kernel, otherwise, the drive will not be enumerated at once, and you have to do 'echo F ...' for every time plugged the drive.

  • The behaviour is very inconsistent. Sometimes it gets both enumerated and mounted and everything works fine. Sometimes it gets enumerated but not mounted and sometimes it doesn't even get enumerated so I get no sda1 device node.

    It is also a problem when unplugging the device, sometimes it does not detect the unplugging so it is still enumerated and mounted but no thumb drive is inserted in the host port.

    Therefor I still think that the problem is in the kernel somewhere.

    Best regards,

    Henrik

  • It sounds like a kernel or even a h/w issue.

    Which PSP or SDK release do you use to get the kernel?

    When the drive is not enumerated, what message do you get from 'dmesg'? and please provide the log of 'cat /proc/driver/musb_hdrc.0' as while.

    How big of the capacitor do you have on OTG VBUS? Is it possible for you to share the Schematics, or just the MUSB portion? If you have a TI FAE contact, you can send him/her the SCH to forward to me.

  • I have attached schematics of the USB part on our custom boards. Attached to the CPU board is a daughter card with all the interface connectors where the USB Host connector is attached. On that daughter card we also have some ESD protection for the USB. Please let me know if we have done something stupid. All your help is much appreciated.

    CPU board:

    Daughter card with connectors:

    Just because I wanted to show you logs of when it didn't work I had real trouble provoking the error. Now all my USB thumb drives were detected and mounted correctly. But I eventually found one USB memory that was taken directly from a new package and it was detected but did not get mounted. The reason why it did not get mounted was because it was formatted as a super floppy, so I only got a sda device node but no sda1. The script on my root fs that mounts the USB file system could only handle thumb drives with partitions. So I will change the script so it can also handle super floppys without partitions somehow.

    But please take a look at the schematics and tell me if there is something wrong because I previously had trouble detecting the USB thumb drives that magically worked today.

    Below is also logs from /proc/driver/musb_hdrc.0 and dmesg:

    # cat /proc/driver/musb_hdrc.0
    Status: MHDRC, Mode=Host (Power=f0, DevCtl=5d)
    OTG state: a_host; active
    Options: ?dma?, host, debug=0 [eps=16]
    Root port status: 00000503
    CPPI: txcr=0 txsrc=0 txena=0; rxcr=0 rxsrc=0 rxena=0
    #

    dmsg
    # [  967.947875] musb_h_ep0_irq 1162: no URB for end 0
    [  968.231903] usb 1-1: new high speed USB device using musb-hdrc and address 22
    [  968.396820] usb 1-1: New USB device found, idVendor=058f, idProduct=6387
    [  968.403961] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
    [  968.411499] usb 1-1: Product: Mass Storage
    [  968.415740] usb 1-1: Manufacturer: Generic
    [  968.420104] usb 1-1: SerialNumber: AF9E43C0
    [  968.467071] scsi18 : usb-storage 1-1:1.0
    [  969.501403] scsi 18:0:0:0: Direct-Access     Generic  Flash Disk       8.07 PQ: 0 ANSI: 4
    [  969.542236] sd 18:0:0:0: [sda] 15667200 512-byte logical blocks: (8.02 GB/7.47 GiB)
    [  969.591278] sd 18:0:0:0: [sda] Write Protect is off
    [  969.596374] sd 18:0:0:0: [sda] Assuming drive cache: write through
    [  969.632812] sd 18:0:0:0: [sda] Assuming drive cache: write through
    [  969.666870]  sda:
    [  969.681793] sd 18:0:0:0: [sda] Assuming drive cache: write through
    [  969.688385] sd 18:0:0:0: [sda] Attached SCSI removable disk

    Regards,

    Henrik

  • I don't see major issues in the SCH. Just keep in mind that the DP/DM must be routed as 90 ohm differential signals without any stubs to achieve the required signal integrity. So

    1. ensure not to add stubs for TP18/19;

    2. Be careful on the connection between the CPU board and daughter board, since DP/DM is crossing the two boards;

    Also ensure L1 does not cause too much voltage troop on VCC.