Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

USB OTG Initialization Issue with dwc2 Driver and g_mass_storage Gadget on Raspberry Pi CM3 #6246

Open
techniker opened this issue Jul 1, 2024 · 0 comments

Comments

@techniker
Copy link

techniker commented Jul 1, 2024

Describe the bug

I’m experiencing issues with the USB OTG functionality on my Raspberry Pi Compute Module 3 (CM3). The problem seems to be related to the dwc2 driver and the g_mass_storage gadget. Upon boot, I see the following errors in the kernel log:

[ 3.546076] dwc2 3f980000.usb: 256 invalid for host_nperio_tx_fifo_size. Check HW configuration.
[ 3.557306] dwc2 3f980000.usb: 512 invalid for host_perio_tx_fifo_size. Check HW configuration.
[ 3.568522] dwc2 3f980000.usb: EPs: 8, dedicated fifos, 4080 entries in SPRAM
...
[ 3.609244] g_mass_storage gadget: Mass Storage Gadget, version: 2009/09/11
[ 3.617616] g_mass_storage gadget: userspace failed to provide iSerialNumber
[ 3.626124] g_mass_storage gadget: g_mass_storage ready
[ 3.632785] dwc2 3f980000.usb: bound driver g_mass_storage
[ 3.817578] dwc2 3f980000.usb: new device is high-speed
[ 3.846967] dwc2 3f980000.usb: new address 46
[ 3.869133] g_mass_storage gadget: high-speed config #1: Linux File-Backed Storage
...
[ 63.435425] WARNING: CPU: 0 PID: 0 at /home/qpc/builds/resinio/amber-etcher-kernel/build/tmp/work-shared/raspberrypi-cm3/kernel-source/drivers/usb/dwc2/gadget.c:195 dwc2_hsotg_init_fifo+0x1b0/0x1b8 [dwc2]
[ 63.456926] Modules linked in: g_mass_storage usb_f_mass_storage libcomposite dwc2

Steps to reproduce the behaviour

  1. Set up a Raspberry Pi Compute Module 3 with the following configuration in /boot/config.txt: dtoverlay=dwc2
  2. Connect the PI via USB OTG to a Computer to mount the eMMC flash drive.
    
  3. Observe the kernel log for errors related to dwc2 and g_mass_storage.

Device (s)

Raspberry Pi CM3

System

2024-03-15-raspios-bookworm-arm64-lite.img

Others not possible due to no boot.

Logs

[ 0.000000] PID hash table entries: 4096 (order: 2, 16384 bytes)
[ 0.000000] Dentry cache hash table entries: 131072 (order: 7, 524288 bytes)
[ 0.000000] Inode-cache hash table entries: 65536 (order: 6, 262144 bytes)
[ 0.000000] Memory: 989008K/1021952K available (7168K kernel code, 488K rwdata, 2116K rodata, 3072K init, 778K bss, 24752K reserved, 8192K cma-reserved)
[ 0.000000] Virtual kernel memory layout:
[ 0.000000] vector : 0xffff0000 - 0xffff1000 ( 4 kB)
[ 0.000000] fixmap : 0xffc00000 - 0xfff00000 (3072 kB)
[ 0.000000] vmalloc : 0xbe800000 - 0xff800000 (1040 MB)
[ 0.000000] lowmem : 0x80000000 - 0xbe600000 ( 998 MB)
[ 0.000000] modules : 0x7f000000 - 0x80000000 ( 16 MB)
[ 0.000000] .text : 0x80008000 - 0x80800000 (8160 kB)
[ 0.000000] .init : 0x80b00000 - 0x80e00000 (3072 kB)
[ 0.000000] .data : 0x80e00000 - 0x80e7a1c4 ( 489 kB)
[ 0.000000] .bss : 0x80e7c000 - 0x80f3e8d4 ( 779 kB)
[ 0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=4, Nodes=1
[ 0.000000] Hierarchical RCU implementation.
[ 0.000000] Build-time adjustment of leaf fanout to 32.
[ 0.000000] NR_IRQS:16 nr_irqs:16 16
[ 0.000000] Failed to get local register map. FIQ is disabled for cpus > 1
[ 0.000000] arm_arch_timer: Architected cp15 timer(s) running at 19.20MHz (phys).
[ 0.000000] clocksource: arch_sys_counter: mask: 0xffffffffffffff max_cycles: 0x46d987e47, max_idle_ns: 440795202767 ns
[ 0.000006] sched_clock: 56 bits at 19MHz, resolution 52ns, wraps every 4398046511078ns
[ 0.000022] Switching to timer-based delay loop, resolution 52ns
[ 0.000269] Console: colour dummy device 80x30
[ 0.001161] console [tty1] enabled
[ 0.001203] Calibrating delay loop (skipped), value calculated using timer frequency.. 38.40 BogoMIPS (lpj=192000)
[ 0.001269] pid_max: default: 32768 minimum: 301
[ 0.001595] Mount-cache hash table entries: 2048 (order: 1, 8192 bytes)
[ 0.001636] Mountpoint-cache hash table entries: 2048 (order: 1, 8192 bytes)
[ 0.002523] Disabling cpuset control group subsystem
[ 0.002684] CPU: Testing write buffer coherency: ok
[ 0.002748] ftrace: allocating 22526 entries in 67 pages
[ 0.052085] CPU0: thread -1, cpu 0, socket 0, mpidr 80000000
[ 0.052165] Setting up static identity map for 0x100000 - 0x100034
[ 0.053981] CPU1: thread -1, cpu 1, socket 0, mpidr 80000001
[ 0.054611] CPU2: thread -1, cpu 2, socket 0, mpidr 80000002
[ 0.055220] CPU3: thread -1, cpu 3, socket 0, mpidr 80000003
[ 0.055305] Brought up 4 CPUs
[ 0.055415] SMP: Total of 4 processors activated (153.60 BogoMIPS).
[ 0.055444] CPU: All CPU(s) started in HYP mode.
[ 0.055470] CPU: Virtualization extensions available.
[ 0.056280] devtmpfs: initialized
[ 0.069412] VFP support v0.3: implementor 41 architecture 3 part 40 variant 3 rev 4
[ 0.069745] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[ 0.069807] futex hash table entries: 1024 (order: 4, 65536 bytes)
[ 0.070393] pinctrl core: initialized pinctrl subsystem
[ 0.071334] NET: Registered protocol family 16
[ 0.073496] DMA: preallocated 1024 KiB pool for atomic coherent allocations
[ 0.082374] hw-breakpoint: found 5 (+1 reserved) breakpoint and 4 watchpoint registers.
[ 0.082422] hw-breakpoint: maximum watchpoint size is 8 bytes.
[ 0.082615] Serial: AMBA PL011 UART driver
[ 0.084521] bcm2835-mbox 3f00b880.mailbox: mailbox enabled
[ 0.152886] bcm2835-dma 3f007000.dma: DMA legacy API manager at be80d000, dmachans=0x1
[ 0.154793] SCSI subsystem initialized
[ 0.154976] usbcore: registered new interface driver usbfs
[ 0.155081] usbcore: registered new interface driver hub
[ 0.155197] usbcore: registered new device driver usb
[ 0.161869] raspberrypi-firmware soc:firmware: Attached to firmware from 2018-11-04 16:32
[ 0.163246] clocksource: Switched to clocksource arch_sys_counter
[ 0.210536] VFS: Disk quotas dquot_6.6.0
[ 0.210646] VFS: Dquot-cache hash table entries: 1024 (order 0, 4096 bytes)
[ 0.210866] FS-Cache: Loaded
[ 0.211138] CacheFiles: Loaded
[ 0.223360] NET: Registered protocol family 2
[ 0.224259] TCP established hash table entries: 8192 (order: 3, 32768 bytes)
[ 0.224397] TCP bind hash table entries: 8192 (order: 4, 65536 bytes)
[ 0.224607] TCP: Hash tables configured (established 8192 bind 8192)
[ 0.224723] UDP hash table entries: 512 (order: 2, 16384 bytes)
[ 0.224790] UDP-Lite hash table entries: 512 (order: 2, 16384 bytes)
[ 0.225021] NET: Registered protocol family 1
[ 0.225445] RPC: Registered named UNIX socket transport module.
[ 0.225476] RPC: Registered udp transport module.
[ 0.225504] RPC: Registered tcp transport module.
[ 0.225531] RPC: Registered tcp NFSv4.1 backchannel transport module.
[ 0.393996] hw perfevents: enabled with armv7_cortex_a7 PMU driver, 7 counters available
[ 0.396508] workingset: timestamp_bits=14 max_order=18 bucket_order=4
[ 0.412167] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[ 0.412650] FS-Cache: Netfs 'nfs' registered for caching
[ 0.413587] NFS: Registering the id_resolver key type
[ 0.413641] Key type id_resolver registered
[ 0.413669] Key type id_legacy registered
[ 0.415943] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 251)
[ 0.416099] io scheduler noop registered
[ 0.416128] io scheduler deadline registered
[ 0.416421] io scheduler cfq registered (default)
[ 0.422266] BCM2708FB: allocated DMA memory fdd10000
[ 0.422319] BCM2708FB: allocated DMA channel 0 @ be80d000
[ 0.427445] Console: switching to colour frame buffer device 82x26
[ 0.506273] bcm2835-rng 3f104000.rng: hwrng registered
[ 0.507728] vc-cma: Videocore CMA driver
[ 0.509034] vc-cma: vc_cma_base = 0x00000000
[ 0.510379] vc-cma: vc_cma_size = 0x00000000 (0 MiB)
[ 0.511708] vc-cma: vc_cma_initial = 0x00000000 (0 MiB)
[ 0.513156] vc-mem: phys_addr:0x00000000 mem_base=0x3f000000 mem_size:0x3f600000(1014 MiB)
[ 0.516167] vc-sm: Videocore shared memory driver
[ 0.532009] brd: module loaded
[ 0.542136] loop: module loaded
[ 0.543390] Loading iSCSI transport class v2.0-870.
[ 0.545129] usbcore: registered new interface driver smsc95xx
[ 0.546394] dwc_otg: version 3.00a 10-AUG-2012 (platform bus)
[ 0.547970] usbcore: registered new interface driver usb-storage
[ 0.549397] mousedev: PS/2 mouse device common for all mice
[ 0.551248] bcm2835-wdt 3f100000.watchdog: Broadcom BCM2835 watchdog timer
[ 0.552809] bcm2835-cpufreq: min=600000 max=1200000
[ 0.554511] sdhci: Secure Digital Host Controller Interface driver
[ 0.555835] sdhci: Copyright(c) Pierre Ossman
[ 0.557439] sdhost-bcm2835 3f202000.mmc: could not get clk, deferring probe
[ 0.559004] sdhci-pltfm: SDHCI platform and OF driver helper
[ 0.560790] ledtrig-cpu: registered to indicate activity on CPUs
[ 0.562257] hidraw: raw HID events driver (C) Jiri Kosina
[ 0.563826] usbcore: registered new interface driver usbhid
[ 0.565255] usbhid: USB HID core driver
[ 0.567496] vchiq: vchiq_init_state: slot_zero = 0xbdd80000, is_master = 0
[ 0.570240] [vc_sm_connected_init]: start
[ 0.573703] vc_vchi_sm_init: failed to open VCHI service (-1)
[ 0.573802] [vc_sm_connected_init]: failed to initialize shared memory service
[ 0.576725] [vc_sm_connected_init]: end - returning -1
[ 0.578594] Initializing XFRM netlink socket
[ 0.580149] NET: Registered protocol family 17
[ 0.581763] Key type dns_resolver registered
[ 0.583620] Registering SWP/SWPB emulation handler
[ 0.585839] registered taskstats version 1
[ 0.592753] 3f201000.serial: ttyAMA0 at MMIO 0x3f201000 (irq = 87, base_baud = 0) is a PL011 rev2
[ 1.388816] console [ttyAMA0] enabled
[ 1.395647] sdhost: log_buf @ bdd01000 (fdd01000)
[ 1.473276] mmc0: sdhost-bcm2835 loaded - DMA enabled (>1)
[ 1.480333] of_cfs_init
[ 1.484482] of_cfs_init: OK
[ 1.504127] Freeing unused kernel memory: 3072K
[ 3.331740] mmc0: new high speed MMC card at address 0001
[ 3.339298] mmcblk0: mmc0:0001 DG4008 7.28 GiB
[ 3.345370] mmcblk0boot0: mmc0:0001 DG4008 partition 1 4.00 MiB
[ 3.352856] mmcblk0boot1: mmc0:0001 DG4008 partition 2 4.00 MiB
[ 3.360323] mmcblk0rpmb: mmc0:0001 DG4008 partition 3 4.00 MiB
[ 3.371764] mmcblk0: p1 p2
[ 3.429258] 3f980000.usb supply vusb_d not found, using dummy regulator
[ 3.437319] 3f980000.usb supply vusb_a not found, using dummy regulator
[ 3.546076] dwc2 3f980000.usb: 256 invalid for host_nperio_tx_fifo_size. Check HW configuration.
[ 3.557306] dwc2 3f980000.usb: 512 invalid for host_perio_tx_fifo_size. Check HW configuration.
[ 3.568522] dwc2 3f980000.usb: EPs: 8, dedicated fifos, 4080 entries in SPRAM
[ 3.587765] Mass Storage Function, version: 2009/09/11
[ 3.594326] LUN: removable file: (no medium)
[ 3.600063] LUN: file: /dev/mmcblk0
[ 3.604902] Number of LUNs=1
[ 3.609244] g_mass_storage gadget: Mass Storage Gadget, version: 2009/09/11
[ 3.617616] g_mass_storage gadget: userspace failed to provide iSerialNumber
[ 3.626124] g_mass_storage gadget: g_mass_storage ready
[ 3.632785] dwc2 3f980000.usb: bound driver g_mass_storage
[ 3.817578] dwc2 3f980000.usb: new device is high-speed
[ 3.846967] dwc2 3f980000.usb: new address 46
[ 3.869133] g_mass_storage gadget: high-speed config #1: Linux File-Backed Storage
[ 5.028074] dwc2 3f980000.usb: dwc2_hsotg_ep_sethalt(ep bbce0090 ep1in, 1)
[ 5.153293] dwc2 3f980000.usb: dwc2_hsotg_ep_sethalt(ep bbce0090 ep1in, 1)
[ 5.161692] dwc2 3f980000.usb: dwc2_hsotg_start_req: ep1 is stalled
[ 5.169780] dwc2 3f980000.usb: dwc2_hsotg_ep_sethalt(ep bbce0090 ep1in, 0)
[ 5.178666] dwc2 3f980000.usb: dwc2_hsotg_ep_sethalt(ep bbce0090 ep1in, 1)
[ 5.303275] dwc2 3f980000.usb: dwc2_hsotg_ep_sethalt(ep bbce0090 ep1in, 1)
[ 5.311408] dwc2 3f980000.usb: dwc2_hsotg_start_req: ep1 is stalled
[ 5.319192] dwc2 3f980000.usb: dwc2_hsotg_ep_sethalt(ep bbce0090 ep1in, 0)
[ 5.327930] dwc2 3f980000.usb: dwc2_hsotg_ep_sethalt(ep bbce0090 ep1in, 1)
[ 5.453274] dwc2 3f980000.usb: dwc2_hsotg_ep_sethalt(ep bbce0090 ep1in, 1)
[ 5.461303] dwc2 3f980000.usb: dwc2_hsotg_start_req: ep1 is stalled
[ 5.468960] dwc2 3f980000.usb: dwc2_hsotg_ep_sethalt(ep bbce0090 ep1in, 0)
[ 5.641760] random: fast init done
[ 15.656524] random: crng init done
[ 63.429663] ------------[ cut here ]------------
[ 63.435425] WARNING: CPU: 0 PID: 0 at /home/qpc/builds/resinio/amber-etcher-kernel/build/tmp/work-shared/raspberrypi-cm3/kernel-source/drivers/usb/dwc2/gadget.c:195 dwc2_hsotg_init_fifo+0x1b0/0x1b8 [dwc2]
[ 63.456926] Modules linked in: g_mass_storage usb_f_mass_storage libcomposite dwc2

Additional context

Suggested Fix:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant