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.

Linux/TDA2PXEVM: How to force usb to device

Part Number: TDA2PXEVM
Other Parts Discussed in Thread: PMP

Tool/software: Linux

Now i change the board , remove the vbus and id of usb1,i want use the usb1 as a mass storage device.

In software i make some modification as follows:

(1).dra7-evm-common.dtsi

-&omap_dwc3_1 {
- extcon = <&extcon_usb1>;
-};
&usb1 {
- dr_mode = "otg";
+ dr_mode = "peripheral";
};
(2) then insmod some ko:
insmod configfs.ko 
insmod libcomposite.ko
insmod usb_f_mass_storage.ko 
insmod g_mass_storage.ko  file=/dev/mmcblk0p1 stall=0 removable=1
have print info :
[  482.681589] Mass Storage Function, version: 2009/09/11
[  482.688258] LUN: removable file: (no medium)
[  482.692718] LUN: removable file: /dev/mmcblk0p1
[  482.698864] Number of LUNs=1
[  482.701853] g_mass_storage gadget: Mass Storage Gadget, version: 2009/09/11
[  482.710377] g_mass_storage gadget: userspace failed to provide iSerialNumber
[  482.718269] g_mass_storage gadget: g_mass_storage ready
My question is that when i insert usb into pc, pc does't detect a device,both D+ and D- are not pullup .
 

  • Can you tell the version of the TI Linux SDK release you are using?
    Also can you provide the complete kernel log for analysis (dmesg) ?

    Thanks.
  • Hi Praveen,

    the version of ti linux SDK release is

    Linux dra7xx-evm 4.4.84 #4 SMP PREEMPT Wed Sep 5 23:26:18 PDT 2018 armv7l GNU/Linux

    this is my complete kernel log:

    root@dra7xx-evm:~# dmesg
    [ 0.000000] Booting Linux on physical CPU 0x0
    [ 0.000000] Initializing cgroup subsys cpuset
    [ 0.000000] Initializing cgroup subsys cpu
    [ 0.000000] Initializing cgroup subsys cpuacct
    [ 0.000000] Linux version 4.4.84 (gang@ubuntu) (gcc version 5.3.1 20160113 (Linaro GCC 5.3-2016.02) ) #4 SMP PREEMPT Wed Sep 5 23:26:18 PDT 2018
    [ 0.000000] CPU: ARMv7 Processor [412fc0f2] revision 2 (ARMv7), cr=10c5387d
    [ 0.000000] CPU: PIPT / VIPT nonaliasing data cache, PIPT instruction cache
    [ 0.000000] Machine model: TI DRA762 EVM
    [ 0.000000] Reserved memory: created DMA memory pool at 0x40300000, size 3 MiB
    [ 0.000000] Reserved memory: initialized node cmem@40300000, compatible id shared-dma-pool
    [ 0.000000] Reserved memory: regions without no-map are not yet supported
    [ 0.000000] Reserved memory: created CMA memory pool at 0x99000000, size 32 MiB
    [ 0.000000] Reserved memory: initialized node ipu2_cma@95800000, compatible id shared-dma-pool
    [ 0.000000] Reserved memory: created CMA memory pool at 0x9b000000, size 16 MiB
    [ 0.000000] Reserved memory: initialized node dsp1_cma@99000000, compatible id shared-dma-pool
    [ 0.000000] Reserved memory: created CMA memory pool at 0x9c000000, size 16 MiB
    [ 0.000000] Reserved memory: initialized node dsp2_cma@9f000000, compatible id shared-dma-pool
    [ 0.000000] Reserved memory: incorrect alignment of CMA region
    [ 0.000000] Reserved memory: regions without no-map are not yet supported
    [ 0.000000] Reserved memory: created DMA memory pool at 0x9d200000, size 32 MiB
    [ 0.000000] Reserved memory: initialized node cmem@9d200000, compatible id shared-dma-pool
    [ 0.000000] Reserved memory: regions without no-map are not yet supported
    [ 0.000000] cma: Reserved 24 MiB at 0x97800000
    [ 0.000000] Memory policy: Data cache writealloc
    [ 0.000000] OMAP4: Map 0x9fe00000 to fe600000 for dram barrier
    [ 0.000000] On node 0 totalpages: 121344
    [ 0.000000] free_area_init_node: node 0, pgdat c0981780, node_mem_map df64c000
    [ 0.000000] Normal zone: 1152 pages used for memmap
    [ 0.000000] Normal zone: 0 pages reserved
    [ 0.000000] Normal zone: 121344 pages, LIFO batch:31
    [ 0.000000] DRA762 ES1.0
    [ 0.000000] PERCPU: Embedded 11 pages/cpu @df5d1000 s14912 r8192 d21952 u45056
    [ 0.000000] pcpu-alloc: s14912 r8192 d21952 u45056 alloc=11*4096
    [ 0.000000] pcpu-alloc: [0] 0 [0] 1
    [ 0.000000] Built 1 zonelists in Zone order, mobility grouping on. Total pages: 120192
    [ 0.000000] Kernel command line: console=ttyS9,115200n8 vram=16M root=PARTUUID=0ea5b25c-02 rw rootwait ip=none mem=512M
    [ 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: 161728K/485376K available (6663K kernel code, 319K rwdata, 2392K rodata, 332K init, 286K bss, 233536K reserved, 90112K cma-reserved, 0K highmem)
    [ 0.000000] Virtual kernel memory layout:
    [ 0.000000] vector : 0xffff0000 - 0xffff1000 ( 4 kB)
    [ 0.000000] fixmap : 0xffc00000 - 0xfff00000 (3072 kB)
    [ 0.000000] vmalloc : 0xe0800000 - 0xff800000 ( 496 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 - 0xc08e000c (9057 kB)
    [ 0.000000] .init : 0xc08e1000 - 0xc0934000 ( 332 kB)
    [ 0.000000] .data : 0xc0934000 - 0xc0983e20 ( 320 kB)
    [ 0.000000] .bss : 0xc0985000 - 0xc09cc980 ( 287 kB)
    [ 0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=2, Nodes=1
    [ 0.000000] Preemptible hierarchical RCU implementation.
    [ 0.000000] Build-time adjustment of leaf fanout to 32.
    [ 0.000000] NR_IRQS:16 nr_irqs:16 16
    [ 0.000000] ti_dt_clocks_register: failed to lookup clock node gmac_gmii_ref_clk_div
    [ 0.000000] OMAP clockevent source: timer1 at 32786 Hz
    [ 0.000000] Architected cp15 timer(s) running at 6.14MHz (phys).
    [ 0.000000] clocksource: arch_sys_counter: mask: 0xffffffffffffff max_cycles: 0x16af5adb9, max_idle_ns: 440795202250 ns
    [ 0.000005] sched_clock: 56 bits at 6MHz, resolution 162ns, wraps every 4398046511023ns
    [ 0.000016] Switching to timer-based delay loop, resolution 162ns
    [ 0.000329] clocksource: 32k_counter: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 58327039986419 ns
    [ 0.000337] OMAP clocksource: 32k_counter at 32768 Hz
    [ 0.000792] Console: colour dummy device 80x30
    [ 0.000812] Calibrating delay loop (skipped), value calculated using timer frequency.. 12.29 BogoMIPS (lpj=61475)
    [ 0.000825] pid_max: default: 32768 minimum: 301
    [ 0.000921] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
    [ 0.000932] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
    [ 0.001472] Initializing cgroup subsys io
    [ 0.001488] Initializing cgroup subsys memory
    [ 0.001513] Initializing cgroup subsys devices
    [ 0.001527] Initializing cgroup subsys freezer
    [ 0.001538] Initializing cgroup subsys perf_event
    [ 0.001550] Initializing cgroup subsys pids
    [ 0.001575] CPU: Testing write buffer coherency: ok
    [ 0.001781] /cpus/cpu@0 missing clock-frequency property
    [ 0.001797] /cpus/cpu@1 missing clock-frequency property
    [ 0.001807] CPU0: thread -1, cpu 0, socket 0, mpidr 80000000
    [ 0.001850] Setting up static identity map for 0x80008340 - 0x800083a0
    [ 0.080099] CPU1: thread -1, cpu 1, socket 0, mpidr 80000001
    [ 0.080168] Brought up 2 CPUs
    [ 0.080182] SMP: Total of 2 processors activated (24.59 BogoMIPS).
    [ 0.080188] CPU: All CPU(s) started in HYP mode.
    [ 0.080194] CPU: Virtualization extensions available.
    [ 0.081232] devtmpfs: initialized
    [ 0.110824] VFP support v0.3: implementor 41 architecture 4 part 30 variant f rev 0
    [ 0.111795] omap_hwmod: l3_main_2 using broken dt data from ocp
    [ 0.227025] omap_hwmod: dcan1: _wait_target_disable failed
    [ 0.323883] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
    [ 0.323907] futex hash table entries: 512 (order: 3, 32768 bytes)
    [ 0.325806] pinctrl core: initialized pinctrl subsystem
    [ 0.326652] NET: Registered protocol family 16
    [ 0.327610] DMA: preallocated 256 KiB pool for atomic coherent allocations
    [ 0.350205] cpuidle: using governor ladder
    [ 0.380230] cpuidle: using governor menu
    [ 0.388840] OMAP GPIO hardware version 0.1
    [ 0.392999] GPIO line 161 (radio_rst) hogged as output/low
    [ 0.395422] irq: no irq domain found for /ocp/l4@4a000000/scm@2000/pinmux@1400 !
    [ 0.420898] hw-breakpoint: found 5 (+1 reserved) breakpoint and 4 watchpoint registers.
    [ 0.420908] hw-breakpoint: maximum watchpoint size is 8 bytes.
    [ 0.421382] omap4_sram_init:Unable to allocate sram needed to handle errata I688
    [ 0.421391] omap4_sram_init:Unable to get sram pool needed to handle errata I688
    [ 0.421865] OMAP DMA hardware revision 0.0
    [ 0.461352] omap-dma-engine 4a056000.dma-controller: OMAP DMA engine driver (LinkedList1/2/3 supported)
    [ 0.462518] edma 43300000.edma: memcpy is disabled
    [ 0.467186] edma 43300000.edma: TI EDMA DMA engine driver
    [ 0.471990] omap-iommu 40d01000.mmu: 40d01000.mmu registered
    [ 0.472164] omap-iommu 40d02000.mmu: 40d02000.mmu registered
    [ 0.472342] omap-iommu 58882000.mmu: 58882000.mmu registered
    [ 0.472498] omap-iommu 55082000.mmu: 55082000.mmu registered
    [ 0.472782] omap-iommu 41501000.mmu: 41501000.mmu registered
    [ 0.472964] omap-iommu 41502000.mmu: 41502000.mmu registered
    [ 0.476010] palmas 0-0058: IRQ missing: skipping irq request
    [ 0.490683] palmas 0-0058: Muxing GPIO 51, PWM 0, LED 2
    [ 0.541218] irq: no irq domain found for /ocp/i2c@48070000/tps65917@58 !
    [ 0.541771] pcf857x: probe of 0-0020 failed with error -121
    [ 0.542025] pcf857x: probe of 0-0021 failed with error -121
    [ 0.542249] pcf857x: probe of 0-0026 failed with error -121
    [ 0.542412] omap_i2c 48070000.i2c: bus 0 rev0.12 at 400 kHz
    [ 0.542818] omap_i2c 48060000.i2c: bus 2 rev0.12 at 400 kHz
    [ 0.560543] pcf857x: probe of 3-0021 failed with error -121
    [ 0.560580] omap_i2c 4807a000.i2c: bus 3 rev0.12 at 400 kHz
    [ 0.560784] media: Linux media interface: v0.10
    [ 0.560840] Linux video capture interface: v2.00
    [ 0.560879] pps_core: LinuxPPS API ver. 1 registered
    [ 0.560886] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <giometti@linux.it>
    [ 0.560909] PTP clock support registered
    [ 0.560951] EDAC MC: Ver: 3.0.0
    [ 0.561708] omap-mailbox 48840000.mailbox: omap mailbox rev 0x400
    [ 0.562006] omap-mailbox 48842000.mailbox: omap mailbox rev 0x400
    [ 0.562359] Advanced Linux Sound Architecture Driver Initialized.
    [ 0.563183] clocksource: Switched to clocksource arch_sys_counter
    [ 0.573534] NET: Registered protocol family 2
    [ 0.574029] TCP established hash table entries: 4096 (order: 2, 16384 bytes)
    [ 0.574069] TCP bind hash table entries: 4096 (order: 3, 32768 bytes)
    [ 0.574136] TCP: Hash tables configured (established 4096 bind 4096)
    [ 0.574174] UDP hash table entries: 256 (order: 1, 8192 bytes)
    [ 0.574194] UDP-Lite hash table entries: 256 (order: 1, 8192 bytes)
    [ 0.574384] NET: Registered protocol family 1
    [ 0.574631] RPC: Registered named UNIX socket transport module.
    [ 0.574640] RPC: Registered udp transport module.
    [ 0.574646] RPC: Registered tcp transport module.
    [ 0.574652] RPC: Registered tcp NFSv4.1 backchannel transport module.
    [ 0.574667] PCI: CLS 0 bytes, default 64
    [ 0.575641] hw perfevents: enabled with armv7_cortex_a15 PMU driver, 7 counters available
    [ 0.584612] squashfs: version 4.0 (2009/01/31) Phillip Lougher
    [ 0.585255] NFS: Registering the id_resolver key type
    [ 0.585281] Key type id_resolver registered
    [ 0.585289] Key type id_legacy registered
    [ 0.585357] ntfs: driver 2.1.32 [Flags: R/O].
    [ 0.586763] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 247)
    [ 0.586778] io scheduler noop registered
    [ 0.586789] io scheduler deadline registered
    [ 0.586820] io scheduler cfq registered (default)
    [ 0.589218] vsys_5v0: supplied by vsys_12v0
    [ 0.589265] ldo3: supplied by vsys_5v0
    [ 0.592957] pinctrl-single 4a003400.pinmux: 282 pins at pa fc003400 size 1128
    [ 0.596271] PCI host bridge /ocp/axi@0/pcie_rc@51000000 ranges:
    [ 0.596284] No bus range found for /ocp/axi@0/pcie_rc@51000000, using [bus 00-ff]
    [ 0.596318] IO 0x20003000..0x20012fff -> 0x00000000
    [ 0.596338] MEM 0x20013000..0x2fffffff -> 0x20013000
    [ 0.626167] dra7-pcie 51000000.pcie_rc: link is not up
    [ 0.626330] dra7-pcie 51000000.pcie_rc: PCI host bridge to bus 0000:00
    [ 0.626343] pci_bus 0000:00: root bus resource [bus 00-ff]
    [ 0.626354] pci_bus 0000:00: root bus resource [io 0x0000-0xffff]
    [ 0.626364] pci_bus 0000:00: root bus resource [mem 0x20013000-0x2fffffff]
    [ 0.626397] pci 0000:00:00.0: [104c:8888] type 01 class 0x060400
    [ 0.626441] pci 0000:00:00.0: reg 0x10: [mem 0x00000000-0x000fffff]
    [ 0.626463] pci 0000:00:00.0: reg 0x14: [mem 0x00000000-0x0000ffff]
    [ 0.626532] pci 0000:00:00.0: supports D1
    [ 0.626542] pci 0000:00:00.0: PME# supported from D0 D1 D3hot
    [ 0.626775] PCI: bus0: Fast back to back transfers disabled
    [ 0.626893] PCI: bus1: Fast back to back transfers enabled
    [ 0.626975] pci 0000:00:00.0: BAR 0: assigned [mem 0x20100000-0x201fffff]
    [ 0.626991] pci 0000:00:00.0: BAR 1: assigned [mem 0x20020000-0x2002ffff]
    [ 0.627003] pci 0000:00:00.0: PCI bridge to [bus 01]
    [ 0.627236] pcieport 0000:00:00.0: Signaling PME through PCIe PME interrupt
    [ 0.627249] pcie_pme 0000:00:00.0:pcie01: service driver pcie_pme loaded
    [ 0.627366] aer 0000:00:00.0:pcie02: service driver aer loaded
    [ 0.688049] Serial: 8250/16550 driver, 10 ports, IRQ sharing disabled
    [ 0.691422] 4806a000.serial: ttyS0 at MMIO 0x4806a000 (irq = 301, base_baud = 3000000) is a 8250
    [ 0.692290] 4806c000.serial: ttyS1 at MMIO 0x4806c000 (irq = 302, base_baud = 3000000) is a 8250
    [ 0.693140] 48020000.serial: ttyS2 at MMIO 0x48020000 (irq = 303, base_baud = 3000000) is a 8250
    [ 0.693975] console [ttyS9] disabled
    [ 0.694025] 4ae2b000.serial: ttyS9 at MMIO 0x4ae2b000 (irq = 304, base_baud = 3000000) is a 8250
    [ 1.724330] console [ttyS9] enabled
    [ 1.729041] [drm] Initialized drm 1.1.0 20060810
    [ 1.734566] [drm] Supports vblank timestamp caching Rev 2 (21.10.2013).
    [ 1.741211] [drm] No driver support for vblank timestamp query.
    [ 1.747374] [drm] Initialized vdrm 1.0.0 20110917 on minor 0
    [ 1.754280] vsys_3v3: supplied by vsys_12v0
    [ 1.758529] ldo5: supplied by vsys_3v3
    [ 1.762838] OMAP DSS rev 6.1
    [ 1.766638] omapdss_dss 58000000.dss: bound 58001000.dispc (ops dispc_component_ops)
    [ 1.782351] loop: module loaded
    [ 1.788260] vmemexp device MAJOR num = 245
    [ 1.792389] vmemexp class registered
    [ 1.796134] /dev/vmemexp device registered
    [ 1.800249] ioctl DBUFIOC_EXPORT_VIRTMEM = -1072899120
    [ 1.808449] m25p80 spi32766.0: unrecognized JEDEC id bytes: 00, 0, 0
    [ 1.816116] libphy: Fixed MDIO Bus: probed
    [ 1.863216] davinci_mdio 48485000.mdio: davinci mdio revision 1.6
    [ 1.869339] libphy: 48485000.mdio: probed
    [ 1.876492] davinci_mdio 48485000.mdio: phy[3]: device 48485000.mdio:03, driver RTL9000A Gigabit Ethernet
    [ 1.886771] cpsw 48484000.ethernet: Detected MACID = f4:84:4c:14:9b:7e
    [ 1.893456] cpsw 48484000.ethernet: cpts: overflow check period 800
    [ 1.900405] cpsw 48484000.ethernet: cpsw: Detected MACID = f4:84:4c:14:9b:7f
    [ 1.909095] mousedev: PS/2 mouse device common for all mice
    [ 1.915341] i2c /dev entries driver
    [ 1.924132] omap_hsmmc 4809c000.mmc: Got CD GPIO
    [ 1.928964] omap_hsmmc 4809c000.mmc: no pinctrl state for sdr104 mode
    [ 1.935478] omap_hsmmc 4809c000.mmc: no pinctrl state for ddr50 mode
    [ 1.941861] omap_hsmmc 4809c000.mmc: no pinctrl state for sdr50 mode
    [ 1.948259] omap_hsmmc 4809c000.mmc: no pinctrl state for sdr25 mode
    [ 1.954655] omap_hsmmc 4809c000.mmc: no pinctrl state for sdr12 mode
    [ 1.961229] vio_3v3: supplied by vsys_3v3
    [ 1.965316] vio_3v3_sd: supplied by vio_3v3
    [ 1.969656] ldo4: supplied by vsys_5v0
    [ 2.023622] omap_hsmmc 480b4000.mmc: no pinctrl state for sdr25 mode
    [ 2.030008] omap_hsmmc 480b4000.mmc: no pinctrl state for sdr12 mode
    [ 2.046761] smps5: supplied by vsys_3v3
    [ 2.050833] vio_1v8: supplied by smps5
    [ 2.094072] ledtrig-cpu: registered to indicate activity on CPUs
    [ 2.105189] hwspinlock_user gatemp: requested 20 hwspinlocks
    [ 2.112107] aic_dvdd: supplied by vio_3v3
    [ 2.117395] davinci-mcasp 48464000.mcasp: DAI is shared
    [ 2.123495] davinci-mcasp 48474000.mcasp: DAI is shared
    [ 2.129986] NET: Registered protocol family 10
    [ 2.145309] sit: IPv6 over IPv4 tunneling driver
    [ 2.150506] NET: Registered protocol family 17
    [ 2.155234] Key type dns_resolver registered
    [ 2.159630] omap_voltage_late_init: Voltage driver support not added
    [ 2.166531] Adding alias for supply vdd,cpu0 -> vdd,4a003b20.oppdm
    [ 2.172740] Adding alias for supply vbb,cpu0 -> vbb,4a003b20.oppdm
    [ 2.179033] buck10: supplied by vsys_3v3
    [ 2.183615] Adding alias for supply vdd,cpu0 -> vdd,4a003b20.oppdm
    [ 2.189825] Adding alias for supply vbb,cpu0 -> vbb,4a003b20.oppdm
    [ 2.197185] Power Management for TI OMAP4+ devices.
    [ 2.202272] Registering SWP/SWPB emulation handler
    [ 2.208395] dmm 4e000000.dmm: workaround for errata i878 in use
    [ 2.215798] dmm 4e000000.dmm: initialized all PAT entries
    [ 2.223605] [drm] Supports vblank timestamp caching Rev 2 (21.10.2013).
    [ 2.230248] [drm] No driver support for vblank timestamp query.
    [ 2.236694] [drm] Initialized omapdrm 1.0.0 20110917 on minor 1
    [ 2.244754] asoc-simple-card sound0: tlv320aic3x-hifi <-> 48468000.mcasp mapping ok
    [ 2.265498] hctosys: unable to open rtc device (rtc0)
    [ 2.282443] aic_dvdd: disabling
    [ 2.285848] ALSA device list:
    [ 2.288829] #0: DRA7xx-EVM
    [ 2.292288] Waiting for root device PARTUUID=0ea5b25c-02...
    [ 2.302596] mmc0: host does not support reading read-only switch, assuming write-enable
    [ 2.313635] mmc0: new high speed SDHC card at address aaaa
    [ 2.319569] mmcblk0: mmc0:aaaa SS08G 7.40 GiB
    [ 2.325208] mmcblk0: p1 p2
    [ 2.387725] mmc1: MAN_BKOPS_EN bit is not set
    [ 2.399688] mmc1: mmc_select_hs200 failed, error -74
    [ 2.404706] : switch to mmc1 failed
    [ 2.404731] EXT4-fs (mmcblk0p2): couldn't mount as ext3 due to feature incompatibilities
    [ 2.416375] EXT4-fs (mmcblk0p2): couldn't mount as ext2 due to feature incompatibilities
    [ 2.419242] mmc1: new MMC card at address 0001
    [ 2.439202] mmcblk1: mmc1:0001 DG4008 7.28 GiB
    [ 2.444474] mmcblk1boot0: mmc1:0001 DG4008 partition 1 4.00 MiB
    [ 2.451067] mmcblk1boot1: mmc1:0001 DG4008 partition 2 4.00 MiB
    [ 2.648431] EXT4-fs (mmcblk0p2): recovery complete
    [ 2.654775] EXT4-fs (mmcblk0p2): mounted filesystem with ordered data mode. Opts: (null)
    [ 2.662934] VFS: Mounted root (ext4 filesystem) on device 179:2.
    [ 2.670010] devtmpfs: mounted
    [ 2.673227] Freeing unused kernel memory: 332K
    [ 2.677690] This architecture does not have kernel memory protection.
    [ 2.859268] systemd[1]: System time before build time, advancing clock.
    [ 2.910011] random: systemd: uninitialized urandom read (16 bytes read, 15 bits of entropy available)
    [ 2.922419] random: systemd: uninitialized urandom read (16 bytes read, 15 bits of entropy available)
    [ 2.940151] systemd[1]: systemd 229 running in system mode. (+PAM -AUDIT -SELINUX +IMA -APPARMOR +SMACK +SYSVINIT +UTMP -LIBCRYPTSETUP -GCRYPT +GNUTLS +ACL +XZ -LZ4 -SECCOMP +BLKID -ELFUTILS +KMOD -IDN)
    [ 2.958777] systemd[1]: Detected architecture arm.
    [ 2.984177] systemd[1]: Set hostname to <dra7xx-evm>.
    [ 3.044831] random: systemd-gpt-aut: uninitialized urandom read (16 bytes read, 16 bits of entropy available)
    [ 3.055082] random: systemd-gpt-aut: uninitialized urandom read (16 bytes read, 16 bits of entropy available)
    [ 3.071907] random: systemd-sysv-ge: uninitialized urandom read (16 bytes read, 16 bits of entropy available)
    [ 3.094900] random: systemd-sysv-ge: uninitialized urandom read (16 bytes read, 18 bits of entropy available)
    [ 3.109494] random: systemd-sysv-ge: uninitialized urandom read (16 bytes read, 18 bits of entropy available)
    [ 3.191605] random: systemd: uninitialized urandom read (16 bytes read, 20 bits of entropy available)
    [ 3.201476] random: systemd: uninitialized urandom read (16 bytes read, 20 bits of entropy available)
    [ 3.211638] random: systemd: uninitialized urandom read (16 bytes read, 20 bits of entropy available)
    [ 3.602284] systemd[1]: sysinit.target: Found ordering cycle on sysinit.target/start
    [ 3.610134] systemd[1]: sysinit.target: Found dependency on alignment.service/start
    [ 3.617919] systemd[1]: sysinit.target: Found dependency on basic.target/start
    [ 3.625219] systemd[1]: sysinit.target: Found dependency on sysinit.target/start
    [ 3.632656] systemd[1]: sysinit.target: Breaking ordering cycle by deleting job alignment.service/start
    [ 3.642114] systemd[1]: alignment.service: Job alignment.service/start deleted to break ordering cycle starting with sysinit.target/start
    [ 3.675711] systemd[1]: Started Dispatch Password Requests to Console Directory Watch.
    [ 3.706012] systemd[1]: Created slice System Slice.
    [ 3.724071] systemd[1]: Created slice system-serial\x2dgetty.slice.
    [ 3.743545] systemd[1]: Listening on Network Service Netlink Socket.
    [ 3.773449] systemd[1]: Listening on /dev/initctl Compatibility Named Pipe.
    [ 3.803430] systemd[1]: Listening on Syslog Socket.
    [ 3.834221] systemd[1]: Reached target Swap.
    [ 3.853398] systemd[1]: Listening on udev Kernel Socket.
    [ 3.873497] systemd[1]: Started Forward Password Requests to Wall Directory Watch.
    [ 3.903447] systemd[1]: Listening on Journal Socket.
    [ 3.953566] systemd[1]: Starting Setup Virtual Console...
    [ 3.975838] systemd[1]: Mounting POSIX Message Queue File System...
    [ 4.007794] systemd[1]: Starting Load Kernel Modules...
    [ 4.035858] systemd[1]: Starting Remount Root and Kernel File Systems...
    [ 4.052972] EXT4-fs (mmcblk0p2): re-mounted. Opts: (null)
    [ 4.066985] systemd[1]: Mounting Temporary Directory...
    [ 4.096100] systemd[1]: Mounting Debug File System...
    [ 4.113369] systemd[1]: Reached target Paths.
    [ 4.133523] systemd[1]: Listening on Journal Socket (/dev/log).
    [ 4.154126] systemd[1]: Created slice system-getty.slice.
    [ 4.203620] systemd[1]: Starting Journal Service...
    [ 4.223680] systemd[1]: Listening on udev Control Socket.
    [ 4.246116] systemd[1]: Created slice User and Session Slice.
    [ 4.283357] systemd[1]: Reached target Slices.
    [ 4.293535] systemd[1]: Reached target Remote File Systems.
    [ 4.363624] systemd[1]: Starting Create list of required static device nodes for the current kernel...
    [ 4.400560] systemd[1]: Mounted Debug File System.
    [ 4.423437] systemd[1]: Mounted POSIX Message Queue File System.
    [ 4.443385] systemd[1]: Mounted Temporary Directory.
    [ 4.463595] systemd[1]: Started Journal Service.
    [ 5.162776] systemd-journald[118]: Received request to flush runtime journal from PID 1
    [ 5.762578] omap-rproc 55020000.ipu: assigned reserved memory node ipu2_cma@95800000
    [ 5.789482] remoteproc0: 55020000.ipu is available
    [ 5.811230] remoteproc0: Note: remoteproc is still under development and considered experimental.
    [ 5.864156] remoteproc0: THE BINARY FORMAT IS NOT YET FINALIZED, and backward compatibility isn't yet guaranteed.
    [ 5.887909] omap-rproc 40800000.dsp: assigned reserved memory node dsp1_cma@99000000
    [ 5.910317] remoteproc1: 40800000.dsp is available
    [ 5.936961] remoteproc1: Note: remoteproc is still under development and considered experimental.
    [ 5.969601] remoteproc1: THE BINARY FORMAT IS NOT YET FINALIZED, and backward compatibility isn't yet guaranteed.
    [ 6.001253] omap-rproc 41000000.dsp: assigned reserved memory node dsp2_cma@9f000000
    [ 6.039613] remoteproc2: 41000000.dsp is available
    [ 6.056539] remoteproc2: Note: remoteproc is still under development and considered experimental.
    [ 6.081148] remoteproc2: THE BINARY FORMAT IS NOT YET FINALIZED, and backward compatibility isn't yet guaranteed.
    [ 6.709084] remoteproc1: registered virtio0 (type 7)
    [ 6.825526] remoteproc2: registered virtio1 (type 7)
    [ 6.859265] omap_rng 48090000.rng: OMAP Random Number Generator ver. 20
    [ 6.880679] remoteproc0: registered virtio2 (type 7)
    [ 6.886904] omap-des 480a5000.des: OMAP DES hw accel rev: 2.2
    [ 6.928234] omap-sham 4b101000.sham: hw accel on OMAP rev 4.3
    [ 6.940436] omap-aes 4b500000.aes: OMAP AES hw accel rev: 3.3
    [ 6.956199] omap-aes 4b700000.aes: OMAP AES hw accel rev: 3.3
    [ 7.156141] SCSI subsystem initialized
    [ 7.505124] [drm] Initialized pvr 1.14.3699939 20110701 on minor 2
    [ 7.534061] libata version 3.00 loaded.
    [ 7.605152] ahci 4a140000.sata: SSS flag set, parallel bus scan disabled
    [ 7.633057] ahci 4a140000.sata: AHCI 0001.0300 32 slots 1 ports 3 Gbps 0x1 impl platform mode
    [ 7.633067] ahci 4a140000.sata: flags: 64bit ncq sntf stag pm led clo only pmp pio slum part ccc apst
    [ 7.656487] scsi host0: ahci
    [ 7.656846] ata1: SATA max UDMA/133 mmio [mem 0x4a140000-0x4a1410ff] port 0x100 irq 342
    [ 8.003299] ata1: SATA link down (SStatus 0 SControl 300)
    [ 8.041635] PVR_K: UM DDK-(3699939) and KM DDK-(3699939) match. [ OK ]
    [ 8.365331] net eth1: initializing cpsw version 1.15 (0)
    [ 8.387957] net eth0: initialized cpsw ale version 1.4
    [ 8.397917] FAT-fs (mmcblk0p1): Volume was not properly unmounted. Some data may be corrupt. Please run fsck.
    [ 8.417716] net eth0: ALE Table size 1024
    [ 8.595299] net eth1: phy found : id is : 0x1ccb00
    [ 8.629374] IPv6: ADDRCONF(NETDEV_UP): eth1: link is not ready
    [ 8.656790] net eth0: initializing cpsw version 1.15 (0)
    [ 8.684460] libphy: PHY 48485000.mdio:01 not found
    [ 8.710427] remoteproc1: powering up 40800000.dsp
    [ 8.735311] net eth0: phy "48485000.mdio:01" not found on slave 0, err -19
    [ 8.757959] remoteproc1: Booting fw image dra7-dsp1-fw.xe66, size 5583983
    [ 8.784099] omap_hwmod: mmu0_dsp1: _wait_target_disable failed
    [ 8.784778] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
    [ 8.795849] omap-iommu 40d01000.mmu: 40d01000.mmu: version 3.0
    [ 8.801790] omap-iommu 40d02000.mmu: 40d02000.mmu: version 3.0
    [ 8.829639] dwc3_probe id :-1
    [ 8.842866] remoteproc1: remote processor 40800000.dsp is now up
    [ 8.850303] virtio_rpmsg_bus virtio0: rpmsg host is online
    [ 8.859204] remoteproc2: powering up 41000000.dsp
    [ 8.871471] remoteproc2: Booting fw image dra7-dsp2-fw.xe66, size 5583983
    [ 8.886633] omap_hwmod: mmu0_dsp2: _wait_target_disable failed
    [ 8.892524] omap-iommu 41501000.mmu: 41501000.mmu: version 3.0
    [ 8.898466] omap-iommu 41502000.mmu: 41502000.mmu: version 3.0
    [ 8.928561] remoteproc2: remote processor 41000000.dsp is now up
    [ 8.936029] virtio_rpmsg_bus virtio1: rpmsg host is online
    [ 8.942589] remoteproc0: powering up 55020000.ipu
    [ 8.962673] remoteproc0: Booting fw image dra7-ipu2-fw.xem4, size 9478420
    [ 8.969765] omap-iommu 55082000.mmu: 55082000.mmu: version 2.1
    [ 9.014679] remoteproc0: remote processor 55020000.ipu is now up
    [ 9.022826] virtio_rpmsg_bus virtio2: rpmsg host is online
    [ 9.071614] virtio_rpmsg_bus virtio1: creating channel rpmsg-proto addr 0x50
    [ 9.086833] virtio_rpmsg_bus virtio0: creating channel rpmsg-proto addr 0x50
    [ 9.102670] virtio_rpmsg_bus virtio2: creating channel rpmsg-proto addr 0x50
    [ 9.113329] NET: Registered protocol family 41
    [ 9.190191] dwc3_core_init_mode:2
    [ 9.194983] dwc3_probe id :-1
    [ 9.400046] dwc3_core_init_mode:1
    [ 9.552285] usbcore: registered new interface driver usbfs
    [ 9.558688] usbcore: registered new interface driver hub
    [ 9.568336] usbcore: registered new device driver usb
    [ 9.642985] xhci-hcd xhci-hcd.2.auto: xHCI Host Controller
    [ 9.652494] xhci-hcd xhci-hcd.2.auto: new USB bus registered, assigned bus number 1
    [ 9.667066] xhci-hcd xhci-hcd.2.auto: hcc params 0x0220f04c hci version 0x100 quirks 0x00210010
    [ 9.680109] xhci-hcd xhci-hcd.2.auto: irq 464, io mem 0x488d0000
    [ 9.692710] hub 1-0:1.0: USB hub found
    [ 9.698559] hub 1-0:1.0: 1 port detected
    [ 9.702924] xhci-hcd xhci-hcd.2.auto: xHCI Host Controller
    [ 9.711872] xhci-hcd xhci-hcd.2.auto: new USB bus registered, assigned bus number 2
    [ 9.721006] usb usb2: We don't know the algorithms for LPM for this host, disabling LPM.
    [ 9.733375] hub 2-0:1.0: USB hub found
    [ 9.740777] hub 2-0:1.0: 1 port detected
    [ 124.168477] Mass Storage Function, version: 2009/09/11
    [ 124.174523] LUN: removable file: (no medium)
    [ 124.178977] LUN: removable file: /dev/mmcblk0p1
    [ 124.185046] Number of LUNs=1
    [ 124.188028] g_mass_storage gadget: Mass Storage Gadget, version: 2009/09/11
    [ 124.196561] g_mass_storage gadget: userspace failed to provide iSerialNumber
    [ 124.204452] g_mass_storage gadget: g_mass_storage ready
  • The log looks OK, We don't see anything wrong in it. Thanks for sharing it.

    I see from you have commented the extcon in the dts file, so can you tell the USB receptacle used on your board? Note that ID pin can be omitted since you are explicitly setting the driver to operate in device mode, but note that the receptacle used must of type-B standard/micro. Otherwise, we need to make sure that the id-pin is floating.

    Can you run below and provide the info:

    cat /sys/kernel/debug/48890000.usb/mode 

    lsmod

    Thanks.

  • Thanks for your reply.

    root@dra7xx-evm:~# lsmod Module Size Used by g_mass_storage 4414 0 usb_f_mass_storage 36968 2 g_mass_storage libcomposite 44313 2 usb_f_mass_storage,g_mass_storage configfs 25310 3 libcomposite,usb_f_mass_storage xhci_plat_hcd 5183 0 xhci_hcd 108888 1 xhci_plat_hcd usbcore 195666 2 xhci_plat_hcd,xhci_hcd rpmsg_proto 7791 0 dwc3 64398 0 udc_core 12920 2 dwc3,libcomposite virtio_rpmsg_bus 12974 1 rpmsg_proto bc_example 7122 0 ahci_platform 3218 0 libahci_platform 8821 1 ahci_platform libahci 27699 2 libahci_platform,ahci_platform extcon_usb_gpio 3564 0 pvrsrvkm 412289 1 bc_example libata 195997 3 libahci,libahci_platform,ahci_platform dwc3_omap 3938 0 extcon 13815 3 dwc3,dwc3_omap,extcon_usb_gpio scsi_mod 129780 1 libata omap_sham 21089 0 omap_des 11446 0 omap_aes_driver 19166 0 omap_rng 4835 0 rng_core 7755 1 omap_rng omap_remoteproc 13155 3 remoteproc 27121 3 omap_remoteproc,virtio_rpmsg_bus,rpmsg_proto virtio 7452 2 remoteproc,virtio_rpmsg_bus virtio_ring 12291 2 remoteproc,virtio_rpmsg_bus sch_fq_codel 8059 3 root@dra7xx-evm:~# cat /sys/kernel/debug/48890000.usb/mode device root@dra7xx-evm:~#

    Now, the USB receptacle we used is type A,but ithink it`s not matter,because  we just use three lines (DM DP GND),

    and  i can use the usb of my board as the device to boot (tda2p have a usb boot mode). 

  • Looked at lsmod and mode status provided and it looks fine.

    We checked to reproduce this on the TI-EVM with the same updates to dts file (removing extcon entry and setting the dr_mode to peripheral) and found the same behavior as yours. Introducing back the extcon entry to the dts file make the gadget to be detected by the host PC properly.

    So the answer to your issue is that you would need the extcon entry for the DWC3 driver to have the  gadget (device mode) to work correctly.

    The reason for this is that the linux dwc3 controller driver is configured to be in DRD mode.

    Check the .config file in your kernel directory and you would notice that below"

    # CONFIG_USB_DWC3_HOST is not set

    # CONFIG_USB_DWC3_GADGET is not set

    CONFIG_USB_DWC3_DUAL_ROLE=y

    For more understanding of this, Suggest you to look at the drivers/usb/dwc3/core.c file and look for the code flow dwc3_probe() -> dwc3_core_init_mode()  -> and dwc3_drd_init() ..

    Thanks.

  • I look at the driver about dwc3 before. linux dwc3 controller driver depends on the "dr_mode"  configed in dts to select mode.the code as fellow:

     

    static int dwc3_core_init_mode(struct dwc3 *dwc)
    {
    	struct device *dev = dwc->dev;
    	int ret;
    
    	switch (dwc->dr_mode) {
    	case USB_DR_MODE_PERIPHERAL:
    		dwc3_set_mode(dwc, DWC3_GCTL_PRTCAP_DEVICE);
    		ret = dwc3_gadget_init(dwc);
    		if (ret) {
    			dev_err(dev, "failed to initialize gadget\n");
    			return ret;
    		}
    		break;
    	case USB_DR_MODE_HOST:
    		dwc3_set_mode(dwc, DWC3_GCTL_PRTCAP_HOST);
    		ret = dwc3_host_init(dwc);
    		if (ret) {
    			dev_err(dev, "failed to initialize host\n");
    			return ret;
    		}
    		break;
    	case USB_DR_MODE_OTG:
    		ret = dwc3_drd_init(dwc);
    		if (ret) {
    			dev_err(dev, "limiting to peripheral only\n");
    			dwc->dr_mode = USB_DR_MODE_PERIPHERAL;
    			dwc3_set_mode(dwc, DWC3_GCTL_PRTCAP_DEVICE);
    			goto gadget_init;
    		}

    So it is no matter if CONFIG_USB_DWC3_DUAL_ROL was configed or CONFIG_USB_DWC3_GADGET was configed.

    CONFIG_USB_DWC3_DUAL_ROL  just have influence on build files.

    the code flow will is dwc3_probe() -> dwc3_core_init_mode()  -> and dwc3_gadget_init() .. 

    Another questions i don`t understand is when i add extcon entry in dts,i can`t find the usb1(48890000.usb) device in /sys/bus/platform/devices/.

    And i can`t find the definition of usb1 registers on tda2px TRM,can you tell me where the definition of usb1 registers

    Thanks

  • hi, do you find something?
  • Hello,

    As mentioned in my previous post, we could reproduce this issue on our TI EVM if I remove the extcon entry and set the dr_mode="peripheral". But, we get it back to work correctly if we put back the extcon entry in the dts file. So there is a dependency on the extcon which is doing something failing in your case.

    Suggest you to explore the code and see what is the this dependency that can be removed. This would solve the problem. 

    Thanks.

  • Hello,

    Now i resolve the problem. It indeed need to add the extcon. because when you load the dwc3-omap.ko,it will register a extcon and set UTMI_OTG_CTRL according to you detection by extcon. but we need make some changes. 

    diff --git a/ti_components/os_tools/linux/kernel/omap/arch/arm/boot/dts/dra7-evm-common.dtsi b/ti_components/os_tools/linux/kernel/omap/arch/arm/boot/dts/dra7-evm-common.dtsi
    index a644fed..2f48ea1 100755
    --- a/ti_components/os_tools/linux/kernel/omap/arch/arm/boot/dts/dra7-evm-common.dtsi
    +++ b/ti_components/os_tools/linux/kernel/omap/arch/arm/boot/dts/dra7-evm-common.dtsi
    @@ -234,7 +234,7 @@
     };
     
     &usb1 {
    -	dr_mode = "otg";
    +	dr_mode = "peripheral";
     };
     
     &usb2 {
    diff --git a/ti_components/os_tools/linux/kernel/omap/drivers/extcon/extcon-usb-gpio.c b/ti_components/os_tools/linux/kernel/omap/drivers/extcon/extcon-usb-gpio.c
    old mode 100644
    new mode 100755
    index c27404f..813d53d
    --- a/ti_components/os_tools/linux/kernel/omap/drivers/extcon/extcon-usb-gpio.c
    +++ b/ti_components/os_tools/linux/kernel/omap/drivers/extcon/extcon-usb-gpio.c
    @@ -67,16 +67,17 @@ static const unsigned int usb_extcon_cable[] = {
     */
     static void usb_extcon_detect_cable(struct work_struct *work)
     {
    -	int id, vbus;
    +	int id = 1, vbus = 1;
     	struct usb_extcon_info *info = container_of(to_delayed_work(work),
     						    struct usb_extcon_info,
     						    wq_detcable);
    -
    +#if 0
     	/* check ID and VBUS and update cable state */
     	id = info->id_gpiod ?
     		gpiod_get_value_cansleep(info->id_gpiod) : 1;
     	vbus = info->vbus_gpiod ?
     		gpiod_get_value_cansleep(info->vbus_gpiod) : id;
    +#endif
     
     	/* at first we clean states which are no longer active */
     	if (id)
    @@ -120,6 +121,9 @@ static int usb_extcon_probe(struct platform_device *pdev)
     	info->id_gpiod = devm_gpiod_get_optional(&pdev->dev, "id", GPIOD_IN);
     	info->vbus_gpiod = devm_gpiod_get_optional(&pdev->dev, "vbus",
     						   GPIOD_IN);
    +	info->id_gpiod = NULL;
    +	info->vbus_gpiod = NULL;
    +#if 0
     
     	if (!info->id_gpiod && !info->vbus_gpiod) {
     		dev_err(dev, "failed to get gpios\n");
    @@ -128,10 +132,10 @@ static int usb_extcon_probe(struct platform_device *pdev)
     
     	if (IS_ERR(info->id_gpiod))
     		return PTR_ERR(info->id_gpiod);
    -
    +	
     	if (IS_ERR(info->vbus_gpiod))
     		return PTR_ERR(info->vbus_gpiod);
    -
    +#endif
     	info->edev = devm_extcon_dev_allocate(dev, usb_extcon_cable);
     	if (IS_ERR(info->edev)) {
     		dev_err(dev, "failed to allocate extcon device\n");
    @@ -150,7 +154,7 @@ static int usb_extcon_probe(struct platform_device *pdev)
     	if (!ret && info->vbus_gpiod)
     		ret = gpiod_set_debounce(info->vbus_gpiod,
     					 USB_GPIO_DEBOUNCE_MS * 1000);
    -
    +	
     	if (ret < 0)
     		info->debounce_jiffies = msecs_to_jiffies(USB_GPIO_DEBOUNCE_MS);
     
    @@ -174,6 +178,7 @@ static int usb_extcon_probe(struct platform_device *pdev)
     		}
     	}
     
    +
     	if (info->vbus_gpiod) {
     		info->vbus_irq = gpiod_to_irq(info->vbus_gpiod);
     		if (info->vbus_irq < 0) {

    thanks for you help.