插上U盘或者鼠标 没有任何反应,是内核哪里没配置好吗?
# lsusb 只有这个
Bus 001 Device 001: ID 1d6b:0002
下边是启动记录,看起来驱动加载也正常
Starting kernel ...
[ 0.000000] Booting Linux on physical CPU 0x0
[ 0.000000] Linux version 5.4.180 (xfdr@Latitude-E6530) (gcc version 10.3.0 (Buildroot -gef012cf7)) #2 Fri Jun 10 23:00:09 CST 2022
[ 0.000000] CPU: ARM926EJ-S [41069265] revision 5 (ARMv5TEJ), cr=0005317f
[ 0.000000] CPU: VIVT data cache, VIVT instruction cache
[ 0.000000] OF: fdt: Machine model: weather station
[ 0.000000] Memory policy: Data cache writeback
[ 0.000000] cma: Reserved 16 MiB at 0x83000000
[ 0.000000] Built 1 zonelists, mobility grouping on. Total pages: 16256
[ 0.000000] Kernel command line: console=ttyS0,115200 earlyprintk rootwait init=/preinit root=/dev/mtdblock2 rootfstype=squashfs overlayfsdev=/dev/mtdblock3 net.ifnames=0 vt.global_cursor_default=0
[ 0.000000] Dentry cache hash table entries: 8192 (order: 3, 32768 bytes, linear)
[ 0.000000] Inode-cache hash table entries: 4096 (order: 2, 16384 bytes, linear)
[ 0.000000] mem auto-init: stack:off, heap alloc:off, heap free:off
[ 0.000000] Memory: 37548K/65536K available (7168K kernel code, 385K rwdata, 1708K rodata, 1024K init, 246K bss, 11604K reserved, 16384K cma-reserved)
[ 0.000000] SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[ 0.000000] NR_IRQS: 16, nr_irqs: 16, preallocated irqs: 16
[ 0.000000] random: get_random_bytes called from start_kernel+0x254/0x454 with crng_init=0
[ 0.000048] sched_clock: 32 bits at 24MHz, resolution 41ns, wraps every 89478484971ns
[ 0.000138] clocksource: timer: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 79635851949 ns
[ 0.000881] Console: colour dummy device 80x30
[ 0.000987] Calibrating delay loop... 203.16 BogoMIPS (lpj=1015808)
[ 0.070257] pid_max: default: 32768 minimum: 301
[ 0.070723] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes, linear)
[ 0.070772] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes, linear)
[ 0.072672] CPU: Testing write buffer coherency: ok
[ 0.074685] Setting up static identity map for 0x80100000 - 0x80100058
[ 0.075983] devtmpfs: initialized
[ 0.087516] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[ 0.087579] futex hash table entries: 256 (order: -1, 3072 bytes, linear)
[ 0.091596] pinctrl core: initialized pinctrl subsystem
[ 0.094209] NET: Registered protocol family 16
[ 0.097801] DMA: preallocated 256 KiB pool for atomic coherent allocations
[ 0.099973] cpuidle: using governor menu
[ 0.164830] SCSI subsystem initialized
[ 0.165238] usbcore: registered new interface driver usbfs
[ 0.165404] usbcore: registered new interface driver hub
[ 0.165557] usbcore: registered new device driver usb
[ 0.166130] pps_core: LinuxPPS API ver. 1 registered
[ 0.166154] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <giometti@linux.it>
[ 0.166225] PTP clock support registered
[ 0.166719] Advanced Linux Sound Architecture Driver Initialized.
[ 0.168966] clocksource: Switched to clocksource timer
[ 0.198714] thermal_sys: Registered thermal governor 'step_wise'
[ 0.199541] NET: Registered protocol family 2
[ 0.199893] IP idents hash table entries: 2048 (order: 2, 16384 bytes, linear)
[ 0.201183] tcp_listen_portaddr_hash hash table entries: 512 (order: 0, 4096 bytes, linear)
[ 0.201262] TCP established hash table entries: 1024 (order: 0, 4096 bytes, linear)
[ 0.201320] TCP bind hash table entries: 1024 (order: 0, 4096 bytes, linear)
[ 0.201373] TCP: Hash tables configured (established 1024 bind 1024)
[ 0.201676] UDP hash table entries: 256 (order: 0, 4096 bytes, linear)
[ 0.201743] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes, linear)
[ 0.202213] NET: Registered protocol family 1
[ 0.204657] NetWinder Floating Point Emulator V0.97 (double precision)
[ 0.206496] Initialise system trusted keyrings
[ 0.207073] workingset: timestamp_bits=30 max_order=14 bucket_order=0
[ 0.228753] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[ 0.229516] jffs2: version 2.2. (NAND) (SUMMARY) © 2001-2006 Red Hat, Inc.
[ 0.335459] Key type asymmetric registered
[ 0.335496] Asymmetric key parser 'x509' registered
[ 0.335671] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 250)
[ 0.335700] io scheduler mq-deadline registered
[ 0.335718] io scheduler kyber registered
[ 0.351049] suniv-f1c100s-pinctrl 1c20800.pinctrl: initialized sunXi PIO driver
[ 0.351966] suniv-f1c100s-pinctrl 1c20800.pinctrl: 1c20800.pinctrl supply vcc-pe not found, using dummy regulator
[ 0.353839] pwm-backlight backlight: backlight supply power not found, using dummy regulator
[ 0.451633] Serial: 8250/16550 driver, 8 ports, IRQ sharing disabled
[ 0.458418] printk: console [ttyS0] disabled
[ 0.478737] 1c25000.serial: ttyS0 at MMIO 0x1c25000 (irq = 29, base_baud = 6250000) is a 16550A
[ 0.912782] printk: console [ttyS0] enabled
[ 0.918124] suniv-f1c100s-pinctrl 1c20800.pinctrl: 1c20800.pinctrl supply vcc-pa not found, using dummy regulator
[ 0.950162] 1c25400.serial: ttyS1 at MMIO 0x1c25400 (irq = 30, base_baud = 6250000) is a 16550A
[ 0.964408] suniv-f1c100s-pinctrl 1c20800.pinctrl: 1c20800.pinctrl supply vcc-pd not found, using dummy regulator
[ 0.987080] SCSI Media Changer driver v0.25
[ 0.992931] suniv-f1c100s-pinctrl 1c20800.pinctrl: 1c20800.pinctrl supply vcc-pc not found, using dummy regulator
[ 1.005737] spi-nor spi0.0: found w25q256, expected w25q128
[ 1.012093] spi-nor spi0.0: w25q256 (32768 Kbytes)
[ 1.017868] 4 fixed-partitions partitions found on MTD device spi0.0
[ 1.024333] Creating 4 MTD partitions on "spi0.0":
[ 1.029234] 0x000000000000-0x000000070000 : "u-boot"
[ 1.037594] 0x000000070000-0x000000600000 : "kernel"
[ 1.045983] 0x000000600000-0x000000d00000 : "rom"
[ 1.054134] 0x000000d00000-0x000001000000 : "overlay"
[ 1.063145] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[ 1.069789] ehci-platform: EHCI generic platform driver
[ 1.075428] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
[ 1.081733] ohci-platform: OHCI generic platform driver
[ 1.087490] usbcore: registered new interface driver usb-storage
[ 1.094544] usb_phy_generic usb_phy_generic.0.auto: usb_phy_generic.0.auto supply vcc not found, using dummy regulator
[ 1.106468] musb-hdrc musb-hdrc.1.auto: MUSB HDRC host driver
[ 1.112431] musb-hdrc musb-hdrc.1.auto: new USB bus registered, assigned bus number 1
[ 1.122403] hub 1-0:1.0: USB hub found
[ 1.126292] hub 1-0:1.0: 1 port detected
[ 1.134216] input: 1c23400.lradc as /devices/platform/soc/1c23400.lradc/input/input0
[ 1.143184] i2c /dev entries driver
[ 1.147353] suniv-f1c100s-pinctrl 1c20800.pinctrl: 1c20800.pinctrl supply vcc-pd not found, using dummy regulator
[ 1.160609] IR NEC protocol handler initialized
[ 1.166067] Registered IR keymap rc-nec-remote
[ 1.170955] rc rc0: sunxi-ir as /devices/platform/soc/1c22c00.cir/rc/rc0
[ 1.178039] input: sunxi-ir as /devices/platform/soc/1c22c00.cir/rc/rc0/input1
[ 1.186293] sunxi-ir 1c22c00.cir: initialized sunXi IR driver
[ 1.193769] sunxi-wdt 1c20ca0.watchdog: Watchdog enabled (timeout=16 sec, nowayout=0)
[ 1.203761] suniv-f1c100s-pinctrl 1c20800.pinctrl: 1c20800.pinctrl supply vcc-pf not found, using dummy regulator
[ 1.241804] sunxi-mmc 1c0f000.mmc: initialized, max. request size: 16384 KB
[ 1.251213] usbcore: registered new interface driver usbhid
[ 1.256786] usbhid: USB HID core driver
[ 1.264970] debugfs: Directory '1c23c00.codec' with parent 'F1C100s Audio Codec' already present!
[ 1.278832] sun4i-codec 1c23c00.codec: Codec <-> 1c23c00.codec mapping ok
[ 1.294623] NET: Registered protocol family 17
[ 1.299302] Key type dns_resolver registered
[ 1.304526] Loading compiled-in X.509 certificates
[ 1.322620] sun4i-drm soc:display-engine: bound 1e00000.display-frontend (ops 0xc083b420)
[ 1.331735] sun4i-drm soc:display-engine: bound 1e60000.display-backend (ops 0xc083ac60)
[ 1.341316] sun4i-drm soc:display-engine: bound 1c0c000.lcd-controller (ops 0xc0839800)
[ 1.349435] [drm] Supports vblank timestamp caching Rev 2 (21.10.2013).
[ 1.356037] [drm] No driver support for vblank timestamp query.
[ 1.363370] [drm] Initialized sun4i-drm 1.0.0 20150629 for soc:display-engine on minor 0
[ 1.393236] mmc0: new high speed SDIO card at address 0001
[ 1.395148] random: fast init done
[ 1.401132] bFWReady == _FALSE call reset 8051...
[ 1.437695] Console: switching to colour frame buffer device 100x30
[ 1.498409] sun4i-drm soc:display-engine: fb0: sun4i-drmdrmfb frame buffer device
[ 1.506927] cfg80211: Loading compiled-in X.509 certificates for regulatory database
[ 1.524030] cfg80211: Loaded X.509 cert 'sforshee: 00b28ddf47aef9cea7'
[ 1.530885] ALSA device list:
[ 1.533876] #0: F1C100s Audio Codec
[ 1.538079] platform regulatory.0: Direct firmware load for regulatory.db failed with error -2
[ 1.546826] cfg80211: failed to load regulatory.db
[ 1.557291] VFS: Mounted root (squashfs filesystem) readonly on device 31:2.
[ 1.571020] devtmpfs: mounted
[ 1.580116] Freeing unused kernel memory: 1024K
[ 1.584782] Run /preinit as init process
[ 1.792382] crng init done
[ 2.302922] overlayfs: upper fs does not support tmpfile.
[ 2.308349] overlayfs: upper fs does not support xattr, falling back to index=off and metacopy=off.
Starting syslogd: OK
Starting klogd: OK
Running sysctl: OK
Populating /dev using udev:
[ 3.069623] udevd[95]: starting version 3.2.11
[ 3.327012] udevd[96]: starting eudev-3.2.11
done
Initializing random number generator: OK
Saving random seed: OK
Starting haveged: haveged: command socket is listening at fd 3
OK
Starting network: OK
Welcome to sipeed Lichee Nano
lichee-nano login: root
# lsusb
Bus 001 Device 001: ID 1d6b:0002
#
# echo peripheral > /sys/devices/platform/soc/1c13000.usb/musb-hdrc.1.auto/mode
# cat /sys/devices/platform/soc/1c13000.usb/musb-hdrc.1.auto/mode
b_idle
# echo host > /sys/devices/platform/soc/1c13000.usb/musb-hdrc.1.auto/mode
# cat /sys/devices/platform/soc/1c13000.usb/musb-hdrc.1.auto/mode
b_idle
离线
答主请问这个问题解决了吗?
离线
dts文件设置了为OTG模式,但又没加载gadget,host起不来,要先加载gadget给usb初始化,host才能启动,搞不懂kernel为什么要这个逻辑.跟了一下,函数static int musb_has_gadget(struct musb *musb)强制返回1即可.
离线