WhyCan Forum

人过留名,雁过留声,感谢各位朋友不离不弃地支持。 QQ: 516333132, 微信: whycan_cn (哇酷网/挖坑网/填坑网) admin@whycan.cn

您尚未登录。

#1 2018-09-11 11:27:34

szyusong
会员
所在地: 深圳
注册时间: 2018-09-08
累计积分: 35

f1c100s USB otg device 模式可以用吗?

进 device 模式,能调用 USBC_EnableDpDmPullUp,但是 D+ 脚没有拉高,所以接电脑没反应。请各位大神指点下,多谢了!

离线

#2 2018-09-11 11:38:23

晕哥
Administrator
注册时间: 2017-09-06
累计积分: 8,528

Re: f1c100s USB otg device 模式可以用吗?

还没有用过 USB, 路过

离线

#3 2018-09-13 13:40:21

ippen
会员
注册时间: 2018-07-22
累计积分: 275

Re: f1c100s USB otg device 模式可以用吗?

szyusong 说:

进 device 模式,能调用 USBC_EnableDpDmPullUp,但是 D+ 脚没有拉高,所以接电脑没反应。请各位大神指点下,多谢了!

你是怎样进入device模式的?

我也在搞f1c100s的device模式,驱动加载都没问题,就是usb插电脑没反应
尝试过改设备树文件,强制指定device模式,都没有效果
udc的状态明显没识别usb端口状态
不知道是不是要指定vbus_det 的管脚?

离线

#4 2018-09-13 13:44:56

daydayup
会员
注册时间: 2017-10-09
累计积分: 308

Re: f1c100s USB otg device 模式可以用吗?

ippen 说:
szyusong 说:

进 device 模式,能调用 USBC_EnableDpDmPullUp,但是 D+ 脚没有拉高,所以接电脑没反应。请各位大神指点下,多谢了!

你是怎样进入device模式的?

我也在搞f1c100s的device模式,驱动加载都没问题,就是usb插电脑没反应
尝试过改设备树文件,强制指定device模式,都没有效果
udc的状态明显没识别usb端口状态
不知道是不是要指定vbus_det 的管脚?

你是用主线 linux 吗?
据说主线linux 还没驱动 usb.

离线

#5 2018-09-13 18:11:14

ippen
会员
注册时间: 2018-07-22
累计积分: 275

Re: f1c100s USB otg device 模式可以用吗?

daydayup 说:

你是用主线 linux 吗?
据说主线linux 还没驱动 usb.

用的是bsp内核

离线

#6 2018-09-14 17:26:42

Mitko
会员
注册时间: 2018-03-13
累计积分: 129

Re: f1c100s USB otg device 模式可以用吗?

daydayup 说:

据说主线linux 还没驱动 usb.

我向SUNXI Linux小组提交了一个关于USB支持的问题。还在等待回应。

离线

#7 2018-09-19 14:23:50

szyusong
会员
所在地: 深圳
注册时间: 2018-09-08
累计积分: 35

Re: f1c100s USB otg device 模式可以用吗?

daydayup 说:
ippen 说:
szyusong 说:

进 device 模式,能调用 USBC_EnableDpDmPullUp,但是 D+ 脚没有拉高,所以接电脑没反应。请各位大神指点下,多谢了!

你是怎样进入device模式的?

我也在搞f1c100s的device模式,驱动加载都没问题,就是usb插电脑没反应
尝试过改设备树文件,强制指定device模式,都没有效果
udc的状态明显没识别usb端口状态
不知道是不是要指定vbus_det 的管脚?

你是用主线 linux 吗?
据说主线linux 还没驱动 usb.

用的这个里面的 kernel:
https://bitbucket.org/qq516333132/c600.git

离线

#8 2018-09-19 14:27:09

晕哥
Administrator
注册时间: 2017-09-06
累计积分: 8,528

Re: f1c100s USB otg device 模式可以用吗?

https://whycan.cn/t_1522.html   16楼

我觉得这个版本的 bsp linux 驱动 usb device 不改肯定是不行的,连时钟都没有配置.

离线

#9 2018-09-19 14:31:18

szyusong
会员
所在地: 深圳
注册时间: 2018-09-08
累计积分: 35

Re: f1c100s USB otg device 模式可以用吗?

ippen 说:
szyusong 说:

进 device 模式,能调用 USBC_EnableDpDmPullUp,但是 D+ 脚没有拉高,所以接电脑没反应。请各位大神指点下,多谢了!

你是怎样进入device模式的?

我也在搞f1c100s的device模式,驱动加载都没问题,就是usb插电脑没反应
尝试过改设备树文件,强制指定device模式,都没有效果
udc的状态明显没识别usb端口状态
不知道是不是要指定vbus_det 的管脚?

修改 sunxi_usb_device_enable:

	is_udc_enable = 1; // 添加这句 !!!

	if (udc->driver && is_udc_enable) {
		sunxi_udc_enable(udc);
		cfg_udc_command(SW_UDC_P_ENABLE);
	}

	DMSG_INFO_UDC("sunxi_usb_device_enable end\n");

离线

#10 2018-09-19 14:32:50

晕哥
Administrator
注册时间: 2017-09-06
累计积分: 8,528

Re: f1c100s USB otg device 模式可以用吗?

szyusong 说:
ippen 说:
szyusong 说:

进 device 模式,能调用 USBC_EnableDpDmPullUp,但是 D+ 脚没有拉高,所以接电脑没反应。请各位大神指点下,多谢了!

你是怎样进入device模式的?

我也在搞f1c100s的device模式,驱动加载都没问题,就是usb插电脑没反应
尝试过改设备树文件,强制指定device模式,都没有效果
udc的状态明显没识别usb端口状态
不知道是不是要指定vbus_det 的管脚?

修改 sunxi_usb_device_enable:

	is_udc_enable = 1; // 添加这句 !!!

	if (udc->driver && is_udc_enable) {
		sunxi_udc_enable(udc);
		cfg_udc_command(SW_UDC_P_ENABLE);
	}

	DMSG_INFO_UDC("sunxi_usb_device_enable end\n");

这样改完, device 就可以跑起来了?

离线

#11 2018-09-19 15:12:41

szyusong
会员
所在地: 深圳
注册时间: 2018-09-08
累计积分: 35

Re: f1c100s USB otg device 模式可以用吗?

晕哥 说:

这样改完, device 就可以跑起来了?

可以枚举,但是我测试 RNDIS 还有问题,INT 节点通讯有问题。

离线

#12 2018-09-19 15:28:45

晕哥
Administrator
注册时间: 2017-09-06
累计积分: 8,528

Re: f1c100s USB otg device 模式可以用吗?

szyusong 说:
晕哥 说:

这样改完, device 就可以跑起来了?

可以枚举,但是我测试 RNDIS 还有问题,INT 节点通讯有问题。

其他的CDC, AUDIO有没有测试?

离线

#13 2018-09-19 15:31:55

szyusong
会员
所在地: 深圳
注册时间: 2018-09-08
累计积分: 35

Re: f1c100s USB otg device 模式可以用吗?

启动 log

U-Boot SPL 2018.01-05676-g0018878-dirty (Apr 19 2018 - 20:06:23)
DRAM: 32 MiB
Trying to boot from sunxi SPI


U-Boot 2018.01-05676-g0018878-dirty (Apr 19 2018 - 20:06:23 +0800) Allwinner Technology

CPU:   Allwinner F Series (SUNIV)
Model: Lichee Pi Nano
DRAM:  32 MiB
MMC:   SUNXI SD/MMC: 0
SF: Detected w25q128bv with page size 256 Bytes, erase size 4 KiB, total 16 MiB
Setting up a 480x272 lcd console (overscan 0x0)
In:    serial@1c25000
Out:   serial@1c25000
Err:   serial@1c25000
Net:   No ethernet found.
starting USB...
No controllers found
Hit any key to stop autoboot:  0 
SF: Detected w25q128bv with page size 256 Bytes, erase size 4 KiB, total 16 MiB
device 0 offset 0x100000, size 0x2e0000
SF: 3014656 bytes @ 0x100000 Read: OK
device 0 offset 0x3e0000, size 0x10000
SF: 65536 bytes @ 0x3e0000 Read: OK
## Flattened Device Tree blob at 80c00000
   Booting using the fdt blob at 0x80c00000
   reserving fdt memory region: addr=81000000 size=10000
   Loading Device Tree to 80e5d000, end 80e66d34 ... OK

Starting kernel ...

[    0.000000] Booting Linux on physical CPU 0x0
[    0.000000] Initializing cgroup subsys cpuset
[    0.000000] Initializing cgroup subsys cpuacct
[    0.000000] Linux version 3.10.65 (root@debian) (gcc version 4.8.3 20140320 (prerelease) (Sourcery CodeBench Lite 2014.05-29) ) #68 PREEMPT Wed Sep 19 15:27:48 CST 2018
[    0.000000] CPU: ARM926EJ-S [41069265] revision 5 (ARMv5TEJ), cr=00053177
[    0.000000] CPU: VIVT data cache, VIVT instruction cache
[    0.000000] Machine: Allwinner A1X (Device Tree), model: sun3iw1p1
[    0.000000] bootconsole [earlycon0] enabled
[    0.000000] cma: CMA: failed to reserve 16 MiB
[    0.000000] Memory policy: ECC disabled, Data cache writethrough
[    0.000000] Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 8128
[    0.000000] Kernel command line: earlyprintk panic=5 rootwait root=/dev/mtdblock3 ro rootfstype=squashfs console=ttyS0,115200
[    0.000000] PID hash table entries: 128 (order: -3, 512 bytes)
[    0.000000] Dentry cache hash table entries: 4096 (order: 2, 16384 bytes)
[    0.000000] Inode-cache hash table entries: 2048 (order: 1, 8192 bytes)
[    0.000000] Memory: 32MB = 32MB total
[    0.000000] Memory: 27448k/27448k available, 5320k 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]     vmalloc : 0xc2800000 - 0xff000000   ( 968 MB)
[    0.000000]     lowmem  : 0xc0000000 - 0xc2000000   (  32 MB)
[    0.000000]     modules : 0xbf000000 - 0xc0000000   (  16 MB)
[    0.000000]       .text : 0xc0008000 - 0xc043dfb4   (4312 kB)
[    0.000000]       .init : 0xc043e000 - 0xc045ce3c   ( 124 kB)
[    0.000000]       .data : 0xc045e000 - 0xc0493428   ( 214 kB)
[    0.000000]        .bss : 0xc0493428 - 0xc04bde40   ( 171 kB)
[    0.000000] SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[    0.000000] Preemptible hierarchical RCU implementation.
[    0.000000] NR_IRQS:256
[    0.000000] of_sunxi_clocks_init : sunxi_clk_base[0xf1c20000]
[    0.000000] pll_cpu-set_default_rate=552000000 success!
[    0.000000] pll_video-set_default_rate=297000000 success!
[    0.000000] pll_ddr-set_default_rate=312000000 success!
[    0.000000] sched_clock: 32 bits at 24MHz, resolution 41ns, wraps every 178956ms
[    0.000000] Console: colour dummy device 80x30
[    0.005519] Calibrating delay loop... 274.02 BogoMIPS (lpj=1370112)
[    0.075314] pid_max: default: 32768 minimum: 301
[    0.080799] Mount-cache hash table entries: 512
[    0.088143] CPU: Testing write buffer coherency: ok
[    0.094534] Setting up static identity map for 0xc03453d8 - 0xc0345414
[    0.106737] devtmpfs: initialized
[    0.112969] pinctrl core: initialized pinctrl subsystem
[    0.118937] NET: Registered protocol family 16
[    0.124205] DMA: failed to allocate 256 KiB pool for atomic coherent allocation
[    0.132640] dump_class_init,844, success
[    0.145628] sun3iw1p1-pinctrl pio: initialized sunXi PIO driver
[    0.179492] bio: create slab <bio-0> at 0
[    0.187895] SCSI subsystem initialized
[    0.192447] usbcore: registered new interface driver usbfs
[    0.198552] usbcore: registered new interface driver hub
[    0.204693] usbcore: registered new device driver usb
[    0.213029] Advanced Linux Sound Architecture Driver Initialized.
[    0.222860] cfg80211: Calling CRDA to update world regulatory domain
[    0.230620] Switching to clocksource sun3i high-res couter
[    0.278474] NET: Registered protocol family 2
[    0.288148] TCP established hash table entries: 512 (order: 0, 4096 bytes)
[    0.295204] TCP bind hash table entries: 512 (order: -1, 2048 bytes)
[    0.301887] TCP: Hash tables configured (established 512 bind 512)
[    0.308635] TCP: reno registered
[    0.312033] UDP hash table entries: 256 (order: 0, 4096 bytes)
[    0.318191] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
[    0.325822] NET: Registered protocol family 1
[    0.354525] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[    0.361569] jffs2: version 2.2. 漏 2001-2006 Red Hat, Inc.
[    0.368495] msgmni has been set to 53
[    0.379319] io scheduler noop registered
[    0.383382] io scheduler deadline registered
[    0.388216] io scheduler cfq registered (default)
[    0.419085] uart0: ttyS0 at MMIO 0x1c25000 (irq = 104) is a SUNXI
[    0.425365] sw_console_setup()1324 - console setup baud 115200 parity n bits 8, flow n
[    0.433854] console [ttyS0] enabled, bootconsole disabled
[    0.433854] console [ttyS0] enabled, bootconsole disabled
[    0.447635] uart1: ttyS1 at MMIO 0x1c25400 (irq = 105) is a SUNXI
[    0.455847] misc dump reg init
[    0.474325] loop: module loaded
[    0.478244] [NAND]ERROR! get nand0 node failed
[    0.488705] spi spi0: master is unqueued, this is deprecated
[    0.497611] m25p80 spi0.0: found w25q128, expected m25p64
[    0.503713] m25p80 spi0.0: w25q128 (16384 Kbytes)
[    0.509430] 4 ofpart partitions found on MTD device (null)
[    0.515577] Creating 4 MTD partitions on "(null)":
[    0.521230] 0x000000000000-0x000000100000 : "uboot"
[    0.530340] 0x000000100000-0x000000350000 : "kernel"
[    0.539709] 0x000000350000-0x000000400000 : "dtb"
[    0.548836] 0x000000400000-0x000001000000 : "rootfs"
[    0.558671] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[    0.566973] usbcore: registered new interface driver usb-storage
[    0.574000] [udc]: alloc request: ep(0xc0488370, ep0, 64), req(0xc191eae0)
[    0.582079] g_ether gadget: using random self ethernet address
[    0.588744] g_ether gadget: using random host ethernet address
[    0.597445] usb0: MAC 2a:e2:e6:08:4f:db
[    0.601763] usb0: HOST MAC 16:17:7c:52:ce:82
[    0.607002] [udc]: alloc request: ep(0xc0488538, ep4-int, 512), req(0xc191ec00)
[    0.615263] [udc]: alloc request: ep(0xc0488538, ep4-int, 512), req(0xc191ec60)
[    0.623618] g_ether gadget: Ethernet Gadget, version: Memorial Day 2008
[    0.631124] g_ether gadget: g_ether ready
[    0.635626] [udc]: [sunxi_usb_udc]: binding gadget driver 'g_ether'
[    0.643406] [hcd0]: usb host driver initialize........
[    0.649826] [hcd0]: open_usb_clock
[    0.653924] get regulator_io is no nocare
[    0.658601] [hcd0]: host_init_state = 0
[    0.662895] [hcd0]: platform is usb host
[    0.667663] [hcd0]: sunxi_hcd_init_controller: sunxi_hcd_host0: USB Host mode controller at f1c13000 using PIO, IRQ 108
[    0.679841] sunxi_hcd_host0 1c13000.otghci0-controller: sunxi_hcd host driver
[    0.687960] sunxi_hcd_host0 1c13000.otghci0-controller: new USB bus registered, assigned bus number 1
[    0.701092] hub 1-0:1.0: USB hub found
[    0.705364] hub 1-0:1.0: 1 port detected
[    0.710874] [hcd0]: [sunxi_hcd_host0]:hcd0 set_regulator_io:ON
[    0.717728] [hcd0]: sunxi_usb_host0_disable start
[    0.723001] [hcd0]: sunxi_hcd_wait_for_disconnect cnt=0
[    0.729068] [hcd0]: -------sunxi_hcd0_soft_disconnect---------
[    0.735576] wrn: hcd is not enable, need not stop hcd
[    0.741356] [hcd0]: [sunxi_hcd_host0]: Set USB Power OFF
[    0.747355] [hcd0]: [sunxi_hcd_host0]:hcd0 set_regulator_io:OFF
[    0.754000] [hcd0]: close_usb_clock
[    0.758064] [hcd0]: sunxi_usb_host0_disable end
[    0.777546] sunxi-internal-codec 1c23c00.codec: ASoC: DAPM unknown pin HPOUTR
[    0.785550] sunxi-internal-codec 1c23c00.codec: ASoC: DAPM unknown pin HPOUTL
[    0.793835] sunxi-internal-codec 1c23c00.codec: ASoC: DAPM unknown pin SPKL
[    0.801870] sunxi-internal-codec 1c23c00.codec: ASoC: DAPM unknown pin SPKR
[    0.810064] sunxi-codec-machine sound.0: ASoC: DAPM unknown pin External Speaker
[    0.819198] sunxi-internal-cpudai 1c23c00.cpudai0-controller: ASoC: pcm constructor failed: -12
[    0.829103] sunxi-codec-machine sound.0: ASoC: can't create pcm SUNXI-CODEC :-12
[    0.837489] sunxi-codec-machine sound.0: ASoC: failed to instantiate card -12
[    0.846872] snd_soc_register_card failed -12
[    0.851736] sunxi-codec-machine: probe of sound.0 failed with error -12
[    0.860430] ipip: IPv4 over IPv4 tunneling driver
[    0.867975] gre: GRE over IPv4 demultiplexor driver
[    0.873451] ip_gre: GRE over IPv4 tunneling driver
[    0.882993] TCP: cubic registered
[    0.886883] Initializing XFRM netlink socket
[    0.891768] NET: Registered protocol family 17
[    0.897038] NET: Registered protocol family 15
[    0.902426] VFP support v0.3: not present
[    0.909951] drivers/rtc/hctosys.c: unable to open rtc device (rtc0)
[    0.917968] ALSA device list:
[    0.921314]   No soundcards found.
[    0.942625] VFS: Mounted root (squashfs filesystem) readonly on device 31:3.
[    0.964566] devtmpfs: mounted
[    0.969737] Freeing unused kernel memory: 120K (c043e000 - c045c000)
Starting logging: OK
Starting network: OK

Welcome to Buildroot
buildroot login: [    6.486512] 
[    6.486512] insmod_device_driver
[    6.486512] 
[    6.493465] [udc]: sunxi_usb_device_enable start
[    6.501559] [udc]: open_usb_clock
[    6.505354] sunxi_udc_disable
[    6.510459] [udc]: usbd_stop_work
[    6.514323] sunxi_udc_enable called
[    6.520230] [udc]: CONFIG_USB_GADGET_DUALSPEED: USBC_TS_MODE_HS
[    6.528155] [udc]: usbd_start_work
[    6.532009] [udc]: usbd_start_work
[    6.535807] [udc]: sunxi_usb_device_enable end
[    6.587526] [udc]: IRQ: suspend
[    6.591083] [udc]: ERR: usb speed is unkown
[    6.695260] [udc]: IRQ: reset
[    6.698649] [udc]: (1:star,2:end): vfs_read:0, vfs_write:0,dma_working:0,amount:0,file_offset:0
[    6.708326] [udc]: irq: reset happen, throw away all urb
[    6.732285] USB ep0 irq
[    6.735083] [udc]: 
[    6.735083] +++++++++++++++++++++++++++++++++++++
[    6.742660] [udc]:  usb enter high speed.
[    6.747126] [udc]: 
[    6.747126] +++++++++++++++++++++++++++++++++++++
[    6.754702] sunxi_udc_handle_ep0--3--0
[    6.758899] ep0: bRequest = 6 bRequestType 128 wLength = 64
[    6.765140] W: req.actual(0), req.length(18), len(18), total(18)
[    6.771848] pw: (0xc191eae8, 18, 18)
[    6.775989] USB ep0 irq
[    6.778764] sunxi_udc_handle_ep0--3--0
[    6.782972] [udc]: IRQ: reset
[    6.786312] [udc]: (1:star,2:end): vfs_read:0, vfs_write:0,dma_working:0,amount:0,file_offset:0
[    6.795978] [udc]: irq: reset happen, throw away all urb
[    6.816255] USB ep0 irq
[    6.819041] sunxi_udc_handle_ep0--3--0
[    6.823220] ep0: bRequest = 5 bRequestType 0 wLength = 0
[    6.829132] USB_REQ_SET_ADDRESS ... 
[    6.833342] USB ep0 irq
[    6.836104] sunxi_udc_handle_ep0--3--3
[    6.840280] EP0_END_XFER ... what now?
[    6.844453] crq_bRequest = 0x5
[    6.847855] [udc]: Set address 5
[    6.861265] USB ep0 irq
[    6.864044] sunxi_udc_handle_ep0--3--0
[    6.868253] ep0: bRequest = 6 bRequestType 128 wLength = 18
[    6.874515] W: req.actual(0), req.length(18), len(18), total(18)
[    6.881228] pw: (0xc191eae8, 18, 18)
[    6.885369] USB ep0 irq
[    6.888132] sunxi_udc_handle_ep0--3--0
[    6.892328] ep0: bRequest = 6 bRequestType 128 wLength = 255
[    6.898659] W: req.actual(0), req.length(75), len(64), total(64)
[    6.905363] pw: (0xc191eae8, 75, 64)
[    6.909379] USB ep0 irq
[    6.912122] sunxi_udc_handle_ep0--3--1
[    6.916293] EP0_IN_DATA_PHASE ... what now?
[    6.920947] W: req.actual(64), req.length(75), len(11), total(75)
[    6.927747] pw: (0xc191eae8, 75, 75)
[    6.931755] USB ep0 irq
[    6.934496] sunxi_udc_handle_ep0--3--0
[    6.938691] ep0: bRequest = 6 bRequestType 128 wLength = 255
[    6.945023] W: req.actual(0), req.length(4), len(4), total(4)
[    6.951432] pw: (0xc191eae8, 4, 4)
[    6.955228] USB ep0 irq
[    6.957956] sunxi_udc_handle_ep0--3--0
[    6.962162] ep0: bRequest = 6 bRequestType 128 wLength = 255
[    6.968500] W: req.actual(0), req.length(44), len(44), total(44)
[    6.975206] pw: (0xc191eae8, 44, 44)
[    6.979216] USB ep0 irq
[    6.981959] sunxi_udc_handle_ep0--3--0
[    6.986158] ep0: bRequest = 6 bRequestType 128 wLength = 18
[    6.992385] W: req.actual(0), req.length(18), len(18), total(18)
[    6.999083] pw: (0xc191eae8, 18, 18)
[    7.003086] USB ep0 irq
[    7.005823] sunxi_udc_handle_ep0--3--0
[    7.010016] ep0: bRequest = 6 bRequestType 128 wLength = 255
[    7.016330] W: req.actual(0), req.length(4), len(4), total(4)
[    7.022735] pw: (0xc191eae8, 4, 4)
[    7.026531] USB ep0 irq
[    7.029259] sunxi_udc_handle_ep0--3--0
[    7.033464] ep0: bRequest = 6 bRequestType 128 wLength = 255
[    7.039798] W: req.actual(0), req.length(66), len(64), total(64)
[    7.046495] pw: (0xc191eae8, 66, 64)
[    7.050495] USB ep0 irq
[    7.053237] sunxi_udc_handle_ep0--3--1
[    7.057423] EP0_IN_DATA_PHASE ... what now?
[    7.062078] W: req.actual(64), req.length(66), len(2), total(66)
[    7.068745] pw: (0xc191eae8, 66, 66)
[    7.072735] USB ep0 irq
[    7.075477] sunxi_udc_handle_ep0--3--0
[    7.079670] ep0: bRequest = 6 bRequestType 128 wLength = 255
[    7.085997] W: req.actual(0), req.length(44), len(44), total(44)
[    7.092702] pw: (0xc191eae8, 44, 44)
[    7.096702] USB ep0 irq
[    7.099437] sunxi_udc_handle_ep0--3--0
[    7.119925] USB ep0 irq
[    7.122723] sunxi_udc_handle_ep0--3--0
[    7.126905] ep0: bRequest = 6 bRequestType 128 wLength = 18
[    7.133130] W: req.actual(0), req.length(18), len(18), total(18)
[    7.139818] pw: (0xc191eae8, 18, 18)
[    7.144049] USB ep0 irq
[    7.146818] sunxi_udc_handle_ep0--3--0
[    7.151010] ep0: bRequest = 6 bRequestType 128 wLength = 9
[    7.157147] W: req.actual(0), req.length(9), len(9), total(9)
[    7.163562] pw: (0xc191eae8, 9, 9)
[    7.167493] USB ep0 irq
[    7.170251] sunxi_udc_handle_ep0--3--0
[    7.174447] ep0: bRequest = 6 bRequestType 128 wLength = 75
[    7.180676] W: req.actual(0), req.length(75), len(64), total(64)
[    7.187384] pw: (0xc191eae8, 75, 64)
[    7.191488] USB ep0 irq
[    7.194245] sunxi_udc_handle_ep0--3--1
[    7.198428] EP0_IN_DATA_PHASE ... what now?
[    7.203106] W: req.actual(64), req.length(75), len(11), total(75)
[    7.209891] pw: (0xc191eae8, 75, 75)
[    7.213980] USB ep0 irq
[    7.216736] sunxi_udc_handle_ep0--3--0
[    7.220916] ep0: bRequest = 9 bRequestType 0 wLength = 0
[    7.226811] USB_REQ_SET_CONFIGURATION ... 
[    7.231410] g_ether gadget: high-speed config #2: RNDIS
[    7.237243] [udc]: ep enable: ep4(0xc0488538, ep4-int, 128, 8)
[    7.243752] [udc]: ep enable: ep4(0xc0488538, ep4-int, 128, 8), fifo(3584, 512, 0)
[    7.252213] [udc]: ep enable: ep1(0xc04883bc, ep1in-bulk, 128, 512)
[    7.259211] [udc]: ep enable: ep1(0xc04883bc, ep1in-bulk, 128, 512), fifo(512, 512, 0)
[    7.268037] [udc]: ep enable: ep1(0xc0488408, ep1out-bulk, 0, 512)
[    7.274941] [udc]: ep enable: ep1(0xc0488408, ep1out-bulk, 0, 512), fifo(1024, 512, 0)
[    7.283779] [udc]: alloc request: ep(0xc04883bc, ep1in-bulk, 512), req(0xc193ef60)
[    7.292190] [udc]: alloc request: ep(0xc04883bc, ep1in-bulk, 512), req(0xc193ec60)
[    7.300609] [udc]: alloc request: ep(0xc04883bc, ep1in-bulk, 512), req(0xc193e9c0)
[    7.309044] [udc]: alloc request: ep(0xc04883bc, ep1in-bulk, 512), req(0xc193ea80)
[    7.317480] [udc]: alloc request: ep(0xc04883bc, ep1in-bulk, 512), req(0xc193ec00)
[    7.325920] [udc]: alloc request: ep(0xc04883bc, ep1in-bulk, 512), req(0xc193ed80)
[    7.334333] [udc]: alloc request: ep(0xc04883bc, ep1in-bulk, 512), req(0xc193eba0)
[    7.342751] [udc]: alloc request: ep(0xc04883bc, ep1in-bulk, 512), req(0xc193ef00)
[    7.351184] [udc]: alloc request: ep(0xc04883bc, ep1in-bulk, 512), req(0xc193eb40)
[    7.359615] [udc]: alloc request: ep(0xc04883bc, ep1in-bulk, 512), req(0xc193ed20)
[    7.368040] [udc]: alloc request: ep(0xc04883bc, ep1in-bulk, 512), req(0xc193ea20)
[    7.376456] [udc]: alloc request: ep(0xc04883bc, ep1in-bulk, 512), req(0xc194cde0)
[    7.384874] [udc]: alloc request: ep(0xc04883bc, ep1in-bulk, 512), req(0xc194cd80)
[    7.393306] [udc]: alloc request: ep(0xc04883bc, ep1in-bulk, 512), req(0xc194cc00)
[    7.401742] [udc]: alloc request: ep(0xc04883bc, ep1in-bulk, 512), req(0xc194cba0)
[    7.410177] [udc]: alloc request: ep(0xc04883bc, ep1in-bulk, 512), req(0xc194c960)
[    7.418588] [udc]: alloc request: ep(0xc04883bc, ep1in-bulk, 512), req(0xc194ce40)
[    7.427005] [udc]: alloc request: ep(0xc04883bc, ep1in-bulk, 512), req(0xc194cf60)
[    7.435431] [udc]: alloc request: ep(0xc04883bc, ep1in-bulk, 512), req(0xc194cc60)
[    7.443862] [udc]: alloc request: ep(0xc04883bc, ep1in-bulk, 512), req(0xc194cea0)
[    7.452301] [udc]: alloc request: ep(0xc0488408, ep1out-bulk, 512), req(0xc194c9c0)
[    7.460807] [udc]: alloc request: ep(0xc0488408, ep1out-bulk, 512), req(0xc194ca80)
[    7.469342] [udc]: alloc request: ep(0xc0488408, ep1out-bulk, 512), req(0xc194c6c0)
[    7.477873] [udc]: alloc request: ep(0xc0488408, ep1out-bulk, 512), req(0xc194cf00)
[    7.486405] [udc]: alloc request: ep(0xc0488408, ep1out-bulk, 512), req(0xc194ca20)
[    7.494972] [udc]: alloc request: ep(0xc0488408, ep1out-bulk, 512), req(0xc1a0d000)
[    7.503508] [udc]: alloc request: ep(0xc0488408, ep1out-bulk, 512), req(0xc1a0d060)
[    7.512037] [udc]: alloc request: ep(0xc0488408, ep1out-bulk, 512), req(0xc1a0d0c0)
[    7.520561] [udc]: alloc request: ep(0xc0488408, ep1out-bulk, 512), req(0xc1a0d120)
[    7.529096] [udc]: alloc request: ep(0xc0488408, ep1out-bulk, 512), req(0xc1a0d180)
[    7.537629] [udc]: alloc request: ep(0xc0488408, ep1out-bulk, 512), req(0xc1a0d1e0)
[    7.546150] [udc]: alloc request: ep(0xc0488408, ep1out-bulk, 512), req(0xc1a0d240)
[    7.554657] [udc]: alloc request: ep(0xc0488408, ep1out-bulk, 512), req(0xc1a0d2a0)
[    7.563172] [udc]: alloc request: ep(0xc0488408, ep1out-bulk, 512), req(0xc1a0d300)
[    7.571696] [udc]: alloc request: ep(0xc0488408, ep1out-bulk, 512), req(0xc1a0d360)
[    7.580226] [udc]: alloc request: ep(0xc0488408, ep1out-bulk, 512), req(0xc1a0d3c0)
[    7.588755] [udc]: alloc request: ep(0xc0488408, ep1out-bulk, 512), req(0xc1a0d420)
[    7.597290] [udc]: alloc request: ep(0xc0488408, ep1out-bulk, 512), req(0xc1a0d480)
[    7.605818] [udc]: alloc request: ep(0xc0488408, ep1out-bulk, 512), req(0xc1a0d4e0)
[    7.614350] [udc]: alloc request: ep(0xc0488408, ep1out-bulk, 512), req(0xc1a0d540)
[    7.622924] sunxi_udc_vbus_draw
[    7.626637] USB ep0 irq
[    7.629413] sunxi_udc_handle_ep0--3--0
[    7.633604] [udc]: nuke: ep num is 0
[    7.637608] ep0: bRequest = 0 bRequestType 33 wLength = 24
[    7.643753] R: req.actual(24), req.length(24), len(24), total(48)
[    7.650575] W: req.actual(0), req.length(8), len(8), total(8)
[    7.656999] pw: (0xc191ec08, 8, 8)
[    7.660802] =============== rndis_response_complete, ep: 0x84 status: 0
[    7.668156] =============== rndis_response_available: 0
[    7.673971] rndis_command_complete: MaxTransferSize: 16384 : Multi_pkt_txr: enabled
[    7.682622] USB ep0 irq
[    7.685377] sunxi_udc_handle_ep0--3--0
[    7.689565] ep0: bRequest = 1 bRequestType 2 wLength = 0
[    7.695491] ======= clear ep: 0x81
[    7.699425] USB ep0 irq
[    7.702183] sunxi_udc_handle_ep0--3--0
[    7.706375] ep0: bRequest = 1 bRequestType 2 wLength = 0
[    7.712295] ======= clear ep: 0x01
[    7.716207] USB ep0 irq
[    7.718960] sunxi_udc_handle_ep0--3--0
[    7.723140] ep0: bRequest = 1 bRequestType 2 wLength = 0
[    7.729046] ======= clear ep: 0x84
[    7.732895] USB ep0 irq
[    7.735625] sunxi_udc_handle_ep0--3--0
[    7.739824] ep0: bRequest = 0 bRequestType 33 wLength = 24
[    7.745968] R: req.actual(24), req.length(24), len(24), total(48)
[    7.752785] W: req.actual(0), req.length(8), len(8), total(8)
[    7.759202] pw: (0xc191ec08, 8, 8)
[    7.763015] =============== rndis_response_complete, ep: 0x84 status: 0
[    7.770379] =============== rndis_response_available: 0
[    7.776208] rndis_command_complete: MaxTransferSize: 16384 : Multi_pkt_txr: enabled
[    7.784789] USB ep0 irq
[    7.787529] sunxi_udc_handle_ep0--3--0
[    7.791731] ep0: bRequest = 6 bRequestType 128 wLength = 9
[    7.797875] W: req.actual(0), req.length(9), len(9), total(9)
[    7.804296] pw: (0xc191eae8, 9, 9)
[    7.808215] USB ep0 irq
[    7.810969] sunxi_udc_handle_ep0--3--0
[    7.815161] ep0: bRequest = 6 bRequestType 128 wLength = 75
[    7.821387] W: req.actual(0), req.length(75), len(64), total(64)
[    7.828091] pw: (0xc191eae8, 75, 64)
[    7.832196] USB ep0 irq
[    7.834954] sunxi_udc_handle_ep0--3--1
[    7.839139] EP0_IN_DATA_PHASE ... what now?
[    7.843817] W: req.actual(64), req.length(75), len(11), total(75)
[    7.850615] pw: (0xc191eae8, 75, 75)
[    7.854712] USB ep0 irq
[    7.857466] sunxi_udc_handle_ep0--3--0
[    7.892691] USB ep0 irq
[    7.895480] sunxi_udc_handle_ep0--3--0
[    7.899685] ep0: bRequest = 6 bRequestType 128 wLength = 255
[    7.906034] W: req.actual(0), req.length(4), len(4), total(4)
[    7.912457] pw: (0xc191eae8, 4, 4)
[    7.916466] USB ep0 irq
[    7.919239] sunxi_udc_handle_ep0--3--0
[    7.944367] USB ep0 irq
[    7.947165] sunxi_udc_handle_ep0--3--0
[    7.951362] ep0: bRequest = 6 bRequestType 128 wLength = 255
[    7.957705] W: req.actual(0), req.length(66), len(64), total(64)
[    7.964409] pw: (0xc191eae8, 66, 64)
[    7.968631] USB ep0 irq
[    7.971405] sunxi_udc_handle_ep0--3--1
[    7.975589] EP0_IN_DATA_PHASE ... what now?
[    7.980264] W: req.actual(64), req.length(66), len(2), total(66)
[    7.986957] pw: (0xc191eae8, 66, 66)
[    7.991090] USB ep0 irq
[    7.993850] sunxi_udc_handle_ep0--3--0
[    7.998042] ep0: bRequest = 6 bRequestType 128 wLength = 255
[    8.004378] W: req.actual(0), req.length(44), len(44), total(44)
[    8.011077] pw: (0xc191eae8, 44, 44)
[    8.015226] USB ep0 irq
[    8.017976] sunxi_udc_handle_ep0--3--0
[    8.057087] USB ep0 irq
[    8.059887] sunxi_udc_handle_ep0--3--0
[    8.064077] ep0: bRequest = 6 bRequestType 128 wLength = 255
[    8.070430] W: req.actual(0), req.length(58), len(58), total(58)
[    8.077136] pw: (0xc191eae8, 58, 58)
[    8.081353] USB ep0 irq
[    8.084111] sunxi_udc_handle_ep0--3--0
[    8.123105] USB ep0 irq
[    8.125898] sunxi_udc_handle_ep0--3--0
[    8.130102] ep0: bRequest = 6 bRequestType 128 wLength = 255
[    8.136449] W: req.actual(0), req.length(40), len(40), total(40)
[    8.143162] pw: (0xc191eae8, 40, 40)
[    8.147373] USB ep0 irq
[    8.150123] sunxi_udc_handle_ep0--3--0
[   13.158661] USB ep0 irq
[   13.161465] sunxi_udc_handle_ep0--3--0
[   13.165667] ep0: bRequest = 6 bRequestType 128 wLength = 9
[   13.171816] W: req.actual(0), req.length(9), len(9), total(9)
[   13.178226] pw: (0xc191eae8, 9, 9)
[   13.182150] USB ep0 irq
[   13.184918] sunxi_udc_handle_ep0--3--0
[   13.189100] ep0: bRequest = 6 bRequestType 128 wLength = 75
[   13.195305] W: req.actual(0), req.length(75), len(64), total(64)
[   13.201980] pw: (0xc191eae8, 75, 64)
[   13.205990] USB ep0 irq
[   13.208740] sunxi_udc_handle_ep0--3--1
[   13.212921] EP0_IN_DATA_PHASE ... what now?
[   13.217589] W: req.actual(64), req.length(75), len(11), total(75)
[   13.224381] pw: (0xc191eae8, 75, 75)
[   13.228392] USB ep0 irq
[   13.231119] sunxi_udc_handle_ep0--3--0
[   13.235293] ep0: bRequest = 6 bRequestType 128 wLength = 255
[   13.241624] W: req.actual(0), req.length(4), len(4), total(4)
[   13.248033] pw: (0xc191eae8, 4, 4)
[   13.251861] USB ep0 irq
[   13.254597] sunxi_udc_handle_ep0--3--0
[   13.258786] ep0: bRequest = 6 bRequestType 128 wLength = 255
[   13.265115] W: req.actual(0), req.length(66), len(64), total(64)
[   13.271813] pw: (0xc191eae8, 66, 64)
[   13.275821] USB ep0 irq
[   13.278557] sunxi_udc_handle_ep0--3--1
[   13.282741] EP0_IN_DATA_PHASE ... what now?
[   13.287411] W: req.actual(64), req.length(66), len(2), total(66)
[   13.294097] pw: (0xc191eae8, 66, 66)
[   13.298100] USB ep0 irq
[   13.300836] sunxi_udc_handle_ep0--3--0
[   13.305026] ep0: bRequest = 6 bRequestType 128 wLength = 255
[   13.311348] W: req.actual(0), req.length(44), len(44), total(44)
[   13.318052] pw: (0xc191eae8, 44, 44)
[   13.322066] USB ep0 irq
[   13.324816] sunxi_udc_handle_ep0--3--0
[   13.329011] ep0: bRequest = 6 bRequestType 128 wLength = 255
[   13.335335] W: req.actual(0), req.length(58), len(58), total(58)
[   13.342025] pw: (0xc191eae8, 58, 58)
[   13.346034] USB ep0 irq
[   13.348779] sunxi_udc_handle_ep0--3--0
[   13.352977] ep0: bRequest = 6 bRequestType 128 wLength = 255
[   13.359295] W: req.actual(0), req.length(40), len(40), total(40)
[   13.365993] pw: (0xc191eae8, 40, 40)
[   13.370012] USB ep0 irq
[   13.372756] sunxi_udc_handle_ep0--3--0

离线

#14 2018-09-19 15:35:19

szyusong
会员
所在地: 深圳
注册时间: 2018-09-08
累计积分: 35

Re: f1c100s USB otg device 模式可以用吗?

晕哥 说:

其他的CDC, AUDIO有没有测试?

没有,我比较关心 RNDIS,这个通了就相当于有个网卡了,调试东西会方便很多。

离线

#15 2018-09-19 15:37:09

szyusong
会员
所在地: 深圳
注册时间: 2018-09-08
累计积分: 35

Re: f1c100s USB otg device 模式可以用吗?

szyusong 说:
晕哥 说:

其他的CDC, AUDIO有没有测试?

没有,我比较关心 RNDIS,这个通了就相当于有个网卡了,调试东西会方便很多。

但是如果接 linux 的主机,RNDIS 是可以的,就是在 Windows 下不行。

离线

#16 2018-09-19 15:38:35

晕哥
Administrator
注册时间: 2017-09-06
累计积分: 8,528

Re: f1c100s USB otg device 模式可以用吗?

szyusong 说:
szyusong 说:
晕哥 说:

其他的CDC, AUDIO有没有测试?

没有,我比较关心 RNDIS,这个通了就相当于有个网卡了,调试东西会方便很多。

但是如果接 linux 的主机,RNDIS 是可以的,就是在 Windows 下不行。

这样哦,那说驱动 usb device 问题不大了,昨天一直纠结的 usb device 时钟没有配置不知道是什么问题了?


https://whycan.cn/t_1522.html   16楼

离线

#17 2018-09-19 15:41:02

szyusong
会员
所在地: 深圳
注册时间: 2018-09-08
累计积分: 35

Re: f1c100s USB otg device 模式可以用吗?

windows 下 RNDIS 枚举抓包

Bus Hound 6.01 capture on Windows Vista Service Pack 1 (x64). Complements of www.perisoft.net

  Device - Device ID (followed by the endpoint for USB devices)
            (32) Linux USB Ethernet/RNDIS Gadget
  Length - Total transfer length
  Phase  - Phase Type
            CTL   USB control transfer       
            IN    Data in transfer           
            OUT   Data out transfer          
            RESET bus reset                  
            USTS  USB status                 
  Data   - Hex dump of the data transferred
  Descr  - Description of the phase
  Cmd... - Position in the captured data
  Time   - Time the phase occurred in hour:minute:second.millisec form


Device  Length    Phase  Data                                                Description       Cmd.Phase.Ofs(rep)  Time        
------  --------  -----  --------------------------------------------------  ----------------  ------------------  ------------
  32.0            CTL    80 06 00 01  00 00 12 00                            GET DESCRIPTOR           1.1.0        14:13:45.968  
  32.0        18  IN     12 01 00 02  02 00 00 40  25 05 a2 a4  10 03 01 02  .......@%.......         1.2.0        14:13:45.992  
                         00 02                                               ..                       1.2.16                     
  32.0            CTL    80 06 00 02  00 00 09 00                            GET DESCRIPTOR           2.1.0        14:13:45.992  
  32.0         9  IN     09 02 4b 00  02 02 00 c0  fa                        ..K......                2.2.0        14:13:46.015  
  32.0            CTL    80 06 00 02  00 00 4b 00                            GET DESCRIPTOR           3.1.0        14:13:46.015  
  32.0        75  IN     09 02 4b 00  02 02 00 c0  fa 08 0b 00  02 02 06 00  ..K.............         3.2.0        14:13:46.062  
                         06 09 04 00  00 01 ef 04  01 04 05 24  00 10 01 05  ...........$....         3.2.16                     
                         24 01 00 01  04 24 02 00  05 24 06 00  01 07 05 84  $....$...$......         3.2.32                     
                         03 08 00 09  09 04 01 00  02 0a 00 00  05 07 05 81  ................         3.2.48                     
                         02 00 02 00  07 05 01 02  00 02 00                  ...........              3.2.64                     
  32.0            CTL    00 09 02 00  00 00 00 00                            SET CONFIG               4.1.0        14:13:46.062  
  32.0            CTL    21 00 00 00  00 00 18 00                            CLASS                    5.1.0        14:13:46.475  
  32.0        24  OUT    02 00 00 00  18 00 00 00  02 00 00 00  01 00 00 00  ................         5.2.0        14:13:46.499  
                         00 00 00 00  00 40 00 00                            .....@..                 5.2.16                     
  32.4            USTS   c0000011                                            xact error               6.1.0        14:13:46.510  
  32.1            RESET                                                                               7.1.0        14:13:46.510  
  32.1            RESET                                                                               8.1.0        14:13:46.567  
  32.4            RESET                                                                               9.1.0        14:13:46.630  

32.4            USTS   c0000011                                            xact error
这个错误就是 INT 节点(地址为0x84)出问题的报错。

离线

#18 2018-09-19 15:43:28

szyusong
会员
所在地: 深圳
注册时间: 2018-09-08
累计积分: 35

Re: f1c100s USB otg device 模式可以用吗?

晕哥 说:

这样哦,那说驱动 usb device 问题不大了,昨天一直纠结的 usb device 时钟没有配置不知道是什么问题了?
https://whycan.cn/t_1522.html   16楼

usb device 能工作的。在 dts 中配置 usb_port_type 为 2 就可以

		usbc0:usbc0@0 {
			device_type = "usbc0";
			compatible = "allwinner,sunxi-otg-manager";
			usb_port_type = <2>; /* 0: for device, 1: for host */
			usb_detect_type = <1>;
			usb_detect_mode = <0>;
			//usb_id_gpio = <&pio PD 9 0 1 1 1>;
			usb_id_gpio = <&pio PE 2 0 1 1 1>;
			//usb_det_vbus_gpio = <&pio PD 10 0 1 1 1>;
			usb_det_vbus_gpio = <&pio PE 2 0 1 1 1>;
			//usb_drv_vbus_gpio = <&pio PD 11 1 1 1 1>;
			usb_host_init_state = <0>;
			usb_regulator_io = "nocare";
			usb_wakeup_suspend = <0>;
			usb_luns = <1>;
			usb_serial_unique = <0>;
			usb_serial_number = "20080411";
			rndis_wceis = <1>;
			status = "okay";
		};

离线

#19 2018-09-19 15:48:19

晕哥
Administrator
注册时间: 2017-09-06
累计积分: 8,528

Re: f1c100s USB otg device 模式可以用吗?

多谢指教,那可以动态切换吗?

离线

#20 2018-09-19 15:49:29

晕哥
Administrator
注册时间: 2017-09-06
累计积分: 8,528

Re: f1c100s USB otg device 模式可以用吗?

有空我也试一试 windows 下 RNDIS 问题.

离线

#21 2018-09-19 15:54:18

szyusong
会员
所在地: 深圳
注册时间: 2018-09-08
累计积分: 35

Re: f1c100s USB otg device 模式可以用吗?

晕哥 说:

多谢指教,那可以动态切换吗?

你指的OTG? 应该是可以的。还没时间验证。

离线

#22 2018-09-19 15:56:15

szyusong
会员
所在地: 深圳
注册时间: 2018-09-08
累计积分: 35

Re: f1c100s USB otg device 模式可以用吗?

晕哥 说:

多谢指教,那可以动态切换吗?

你指的OTG? 应该是可以的。还没时间验证。

离线

#23 2018-09-19 15:56:18

晕哥
Administrator
注册时间: 2017-09-06
累计积分: 8,528

Re: f1c100s USB otg device 模式可以用吗?

szyusong 说:
晕哥 说:

多谢指教,那可以动态切换吗?

你指的OTG? 应该是可以的。还没时间验证。

是的,在运行中动态切换OTG的device与host模式,插入U盘就要识别成U盘,插入电脑就要进入device模式.

离线

#24 2018-09-20 09:08:03

ippen
会员
注册时间: 2018-07-22
累计积分: 275

Re: f1c100s USB otg device 模式可以用吗?

[    0.623618] g_ether gadget: Ethernet Gadget, version: Memorial Day 2008
[    0.631124] g_ether gadget: g_ether ready
[    0.635626] [udc]: [sunxi_usb_udc]: binding gadget driver 'g_ether'
[    6.486512] insmod_device_driver
[    6.486512] 
[    6.493465] [udc]: sunxi_usb_device_enable start
[    6.501559] [udc]: open_usb_clock
[    6.505354] sunxi_udc_disable
[    6.510459] [udc]: usbd_stop_work
[    6.514323] sunxi_udc_enable called
[    6.520230] [udc]: CONFIG_USB_GADGET_DUALSPEED: USBC_TS_MODE_HS

感觉有点问题,0.623秒的时候加载了g_ether的模块,但6.48秒的时候才加载usb device的驱动,顺序是不是反了?g_ether模块应该是依赖usb_device驱动,应该在后面加载的

最近编辑记录 ippen (2018-09-20 09:08:35)

离线

#25 2018-09-20 09:16:11

ippen
会员
注册时间: 2018-07-22
累计积分: 275

Re: f1c100s USB otg device 模式可以用吗?

[   27.926832]
[   27.926832]
[   27.926832] insmod_device_driver
[   27.926832]
[   27.935352] [sw_udc]: sunxi_usb_device_enable start
[   27.940846] [sw_udc]: open_usb_clock
[   27.944874] Unable to handle kernel NULL pointer dereference at virtual address 00000400
[   27.953899] pgd = c0004000
[   27.956948] [00000400] *pgd=00000000
[   27.960926] Internal error: Oops: 17 [#1] ARM
[   27.965745] Modules linked in:
[   27.969139] CPU: 0 PID: 13 Comm: usb-hardware-sc Not tainted 3.10.65 #156
[   27.976653] task: c18f0000 ti: c18f2000 task.ti: c18f2000
[   27.982665] PC is at USBC_EnableDpDmPullUp+0x14/0x2c
[   27.988172] LR is at sunxi_udc_bsp_init+0x24/0x7c
[   27.993384] pc : [<c01ac988>]    lr : [<c01b8938>]    psr: 60000013
[   27.993384] sp : c18f3ec8  ip : c18f3ee0  fp : c18f3edc
[   28.006081] r10: 00000000  r9 : 00000000  r8 : c185f000
[   28.011861] r7 : 00000001  r6 : c02f1084  r5 : c02f1080  r4 : c02f0d70
[   28.019081] r3 : 00000000  r2 : 00000504  r1 : ffffffff  r0 : c02f0d70
[   28.026304] Flags: nZCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment kernel
[   28.034388] Control: 0005317f  Table: 81a70000  DAC: 00000017
[   28.040743]
[   28.040743] PC: 0xc01ac908:
[   28.045470] c908  e89da800 e1a0c00d e92dd800 e24cb004 e89da800 e1a0c00d e92dd818 e24cb004
[   28.054563] c928  e5903004 e1a04000 e5930400 e3800802 ebffffee e5943004 e5830400 e89da818
[   28.063654] c948  e1a0c00d e92dd818 e24cb004 e5903004 e1a04000 e5930400 e3c00802 ebffffe3
[   28.072749] c968  e5943004 e5830400 e89da818 e1a0c00d e92dd818 e24cb004 e5903004 e1a04000
[   28.081841] c988  e5930400 e3800801 ebffffd8 e5943004 e5830400 e89da818 e1a0c00d e92dd818
[   28.090937] c9a8  e24cb004 e5903004 e1a04000 e5930400 e3c00801 ebffffcd e5943004 e5830400
[   28.100028] c9c8  e89da818 e1a0c00d e92dd818 e24cb004 e3510001 e5904004 0a000002 e3510002
[   28.109125] c9e8  1a000007 ea000003 e5940400 e3c00903 e3800902 ea000004 e5940400 e3800903
[   28.118224]
[   28.118224] LR: 0xc01b88b8:
[   28.122948] 88b8  e5944038 e1a00004 eb00879f e1a00004 eb008b43 e59f3034 e59f0034 e5933004
[   28.132038] 88d8  e12fff33 ea000004 e58d3000 e59f0024 e594203c e5943040 eb00af0f e3a00000
[   28.141134] 88f8  e24bd014 e89da830 c028afe0 c028a6e9 c02d6630 0010624c c028beb2 e1a0c00d
[   28.150223] 8918  e92dd830 e24cb004 e1a04000 ebffff87 e5940030 ebffcfa3 e5940030 ebffd00e
[   28.159315] 8938  e5940030 ebffcff6 e5940030 e3a01002 ebffd01f e5940030 e3a01002 ebffd031
[   28.168412] 8958  e3a01000 e5940030 e1a02001 e1a03001 ebffceb9 e10f5000 e3853080 e121f003
[   28.177507] 8978  e3a01a02 e5940030 ebffcdf7 e121f005 e3a00000 e89da830 e1a0c00d e92dd818
[   28.186599] 8998  e24cb004 e1a04000 e5900030 ebffcffd e5940030 ebffcfe5 e5940030 e3a01000
[   28.195696]
[   28.195696] SP: 0xc18f3e48:
[   28.200420] 3e48  00000002 00000001 00000000 00000000 00000000 c01ac988 60000013 ffffffff
[   28.209509] 3e68  c18f3eb4 c185f000 c18f3edc c18f3e80 c000aa78 c000a1a0 c02f0d70 ffffffff
[   28.218602] 3e88  00000504 00000000 c02f0d70 c02f1080 c02f1084 00000001 c185f000 00000000
[   28.227695] 3ea8  00000000 c18f3edc c18f3ee0 c18f3ec8 c01b8938 c01ac988 60000013 ffffffff
[   28.236788] 3ec8  00000001 c02f1084 c18f3ef4 c18f3ee0 c01b8938 c01ac984 c02f0e44 c02f1080
[   28.245880] 3ee8  c18f3f34 c18f3ef8 c01b71e0 c01b8924 c18f3f24 c18f3f08 c01e456c c00191e0
[   28.254976] 3f08  c028a4c0 c02f0e44 00000000 c02f0d8c c01b2360 00000000 00000000 00000000
[   28.264063] 3f28  c18f3f4c c18f3f38 c01b3168 c01b719c c02f0d8c 00000000 c18f3f64 c18f3f50
[   28.273160]
[   28.273160] IP: 0xc18f3e60:
[   28.277886] 3e60  60000013 ffffffff c18f3eb4 c185f000 c18f3edc c18f3e80 c000aa78 c000a1a0
[   28.286979] 3e80  c02f0d70 ffffffff 00000504 00000000 c02f0d70 c02f1080 c02f1084 00000001
[   28.296070] 3ea0  c185f000 00000000 00000000 c18f3edc c18f3ee0 c18f3ec8 c01b8938 c01ac988
[   28.305161] 3ec0  60000013 ffffffff 00000001 c02f1084 c18f3ef4 c18f3ee0 c01b8938 c01ac984
[   28.314257] 3ee0  c02f0e44 c02f1080 c18f3f34 c18f3ef8 c01b71e0 c01b8924 c18f3f24 c18f3f08
[   28.323351] 3f00  c01e456c c00191e0 c028a4c0 c02f0e44 00000000 c02f0d8c c01b2360 00000000
[   28.332444] 3f20  00000000 00000000 c18f3f4c c18f3f38 c01b3168 c01b719c c02f0d8c 00000000
[   28.341537] 3f40  c18f3f64 c18f3f50 c01b23a4 c01b30b4 00000000 c1835dc0 c18f3fac c18f3f68
[   28.350635]
[   28.350635] FP: 0xc18f3e5c:
[   28.355358] 3e5c  c01ac988 60000013 ffffffff c18f3eb4 c185f000 c18f3edc c18f3e80 c000aa78
[   28.364453] 3e7c  c000a1a0 c02f0d70 ffffffff 00000504 00000000 c02f0d70 c02f1080 c02f1084
[   28.373546] 3e9c  00000001 c185f000 00000000 00000000 c18f3edc c18f3ee0 c18f3ec8 c01b8938
[   28.382638] 3ebc  c01ac988 60000013 ffffffff 00000001 c02f1084 c18f3ef4 c18f3ee0 c01b8938
[   28.391734] 3edc  c01ac984 c02f0e44 c02f1080 c18f3f34 c18f3ef8 c01b71e0 c01b8924 c18f3f24
[   28.400829] 3efc  c18f3f08 c01e456c c00191e0 c028a4c0 c02f0e44 00000000 c02f0d8c c01b2360
[   28.409922] 3f1c  00000000 00000000 00000000 c18f3f4c c18f3f38 c01b3168 c01b719c c02f0d8c
[   28.419016] 3f3c  00000000 c18f3f64 c18f3f50 c01b23a4 c01b30b4 00000000 c1835dc0 c18f3fac
[   28.428114]
[   28.428114] R0: 0xc02f0cf0:
[   28.432839] 0cf0  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[   28.441931] 0d10  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[   28.451019] 0d30  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[   28.460110] 0d50  c18c0ac0 00000000 00000000 00002000 00000000 00000000 00000000 00000000
[   28.469200] 0d70  00000000 00000000 00000000 00000000 f1c13000 f1c13000 00000000 00000001
[   28.478289] 0d90  00000000 00000001 00000000 00000002 00000000 00000001 c0973734 00000001
[   28.487376] 0db0  00000000 00000000 00000000 00000000 00000000 00000001 00000082 00000000
[   28.496464] 0dd0  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[   28.505561]
[   28.505561] R4: 0xc02f0cf0:
[   28.510287] 0cf0  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[   28.519377] 0d10  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[   28.528469] 0d30  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[   28.537556] 0d50  c18c0ac0 00000000 00000000 00002000 00000000 00000000 00000000 00000000
[   28.546647] 0d70  00000000 00000000 00000000 00000000 f1c13000 f1c13000 00000000 00000001
[   28.555739] 0d90  00000000 00000001 00000000 00000002 00000000 00000001 c0973734 00000001
[   28.564828] 0db0  00000000 00000000 00000000 00000000 00000000 00000001 00000082 00000000
[   28.573920] 0dd0  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[   28.583011]
[   28.583011] R5: 0xc02f1000:
[   28.587735] 1000  f1c00000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[   28.596826] 1020  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[   28.605914] 1040  00000000 00000000 00000001 00000000 00000000 00000000 00000000 00000000
[   28.615004] 1060  00000000 00000000 00000000 00000000 c185f200 00000000 00000000 00000000
[   28.624095] 1080  00000001 00000000 00000000 f1c13000 00000000 00000000 f1c00000 00000000
[   28.633188] 10a0  00000000 00000000 00000000 f1c13000 f1c00000 c02f0d70 00000001 c1804fc0
[   28.642281] 10c0  00000000 c1804f40 00000000 00000000 00000000 c02e1098 c185f000 00000000
[   28.651373] 10e0  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[   28.660465]
[   28.660465] R6: 0xc02f1004:
[   28.665190] 1004  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[   28.674280] 1024  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[   28.683372] 1044  00000000 00000001 00000000 00000000 00000000 00000000 00000000 00000000
[   28.692461] 1064  00000000 00000000 00000000 c185f200 00000000 00000000 00000000 00000001
[   28.701550] 1084  00000000 00000000 f1c13000 00000000 00000000 f1c00000 00000000 00000000
[   28.710639] 10a4  00000000 00000000 f1c13000 f1c00000 c02f0d70 00000001 c1804fc0 00000000
[   28.719734] 10c4  c1804f40 00000000 00000000 00000000 c02e1098 c185f000 00000000 00000000
[   28.728827] 10e4  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[   28.737920]
[   28.737920] R8: 0xc185ef80:
[   28.742644] ef80  00000001 00000000 c185ef00 c0280d67 00000001 c185efd0 c1861050 00000000
[   28.751731] efa0  00000000 659e97a7 c02dba2c 00000000 00000000 81240002 00000199 00000000
[   28.760822] efc0  00000001 00000000 c185ef00 c0280d76 c185ef91 c18610d0 00000000 00000000
[   28.769912] efe0  00000000 669ed79a c02dba3c 00000000 00000000 81240002 0000019a 00000000
[   28.779001] f000  c1858f80 ffffffff 00000000 00000000 c1830e10 c185a840 c1858f80 c185f21c
[   28.788091] f020  c185ce1c c1830e18 c1851080 c02db470 c185ea00 00000007 00000007 00000000
[   28.797183] f040  00000000 00000001 c185f048 c185f048 c02db5a8 c02e1054 00000000 00000000
[   28.806275] f060  00000020 c185f264 c185ce64 7fffffff c185f070 c185f070 00000000 00000000
[   28.815372] Process usb-hardware-sc (pid: 13, stack limit = 0xc18f21b8)
[   28.822688] Stack: (0xc18f3ec8 to 0xc18f4000)
[   28.827748] 3ec0:                   00000001 c02f1084 c18f3ef4 c18f3ee0 c01b8938 c01ac984
[   28.836979] 3ee0: c02f0e44 c02f1080 c18f3f34 c18f3ef8 c01b71e0 c01b8924 c18f3f24 c18f3f08
[   28.846057] 3f00: c01e456c c00191e0 c028a4c0 c02f0e44 00000000 c02f0d8c c01b2360 00000000
[   28.855187] 3f20: 00000000 00000000 c18f3f4c c18f3f38 c01b3168 c01b719c c02f0d8c 00000000
[   28.864311] 3f40: c18f3f64 c18f3f50 c01b23a4 c01b30b4 00000000 c1835dc0 c18f3fac c18f3f68
[   28.873636] 3f60: c00334e8 c01b2370 00000000 00000000 00000000 c02f0d8c 00000000 c18f3f7c
[   28.882862] 3f80: c18f3f7c 00000000 c18f3f88 c18f3f88 c1835dc0 c0033434 00000000 00000000
[   28.892691] 3fa0: 00000000 c18f3fb0 c000aef0 c0033444 00000000 00000000 00000000 00000000
[   28.911209] 3fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[   28.920429] 3fe0: 00000000 00000000 00000000 00000000 00000013 00000000 00000000 00000000
[   28.929536] Backtrace:
[   28.932330] [<c01ac974>] (USBC_EnableDpDmPullUp+0x0/0x2c) from [<c01b8938>] (sunxi_udc_bsp_init+0x24/0x7c)
[   28.943077]  r4:c02f1084 r3:00000001
[   28.947125] [<c01b8914>] (sunxi_udc_bsp_init+0x0/0x7c) from [<c01b71e0>] (sunxi_usb_device_enable+0x54/0x180)
[   28.958147]  r5:c02f1080 r4:c02f0e44
[   28.962170] [<c01b718c>] (sunxi_usb_device_enable+0x0/0x180) from [<c01b3168>] (usb_msg_center+0xc4/0x174)
[   28.972939] [<c01b30a4>] (usb_msg_center+0x0/0x174) from [<c01b23a4>] (usb_hardware_scan_thread+0x44/0x6c)
[   28.983668]  r5:00000000 r4:c02f0d8c
[   28.987732] [<c01b2360>] (usb_hardware_scan_thread+0x0/0x6c) from [<c00334e8>] (kthread+0xb4/0xc0)
[   28.997700]  r4:c1835dc0 r3:00000000
[   29.001701] [<c0033434>] (kthread+0x0/0xc0) from [<c000aef0>] (ret_from_fork+0x14/0x24)
[   29.010614]  r7:00000000 r6:00000000 r5:c0033434 r4:c1835dc0
[   29.016973] Code: e92dd818 e24cb004 e5903004 e1a04000 (e5930400)
[   29.023729] ---[ end trace eac2d74e73483729 ]---

我设置为otg模式,usb插入pc后,提示加载usb_device驱动,然后就崩溃了

离线

#26 2018-09-20 09:42:16

晕哥
Administrator
注册时间: 2017-09-06
累计积分: 8,528

Re: f1c100s USB otg device 模式可以用吗?

路过路过, 帮顶一下.

离线

#27 2018-09-21 00:42:37

ippen
会员
注册时间: 2018-07-22
累计积分: 275

Re: f1c100s USB otg device 模式可以用吗?

[    4.257062]
[    4.257062] insmod_device_driver
[    4.257062]
[    4.265583] [sw_udc]: sunxi_usb_device_enable start
[    4.271087] [sw_udc]: open_usb_clock
[    4.275104] [sw_udc]: udc->driver is null, udc is need not stop
[    4.281816] [sw_udc]: sunxi_usb_device_enable end
[    4.287096] device_chose finished 64!

看来我的不太一样,错误是 udc->driver is null

离线

#28 2018-09-21 08:51:30

szyusong
会员
所在地: 深圳
注册时间: 2018-09-08
累计积分: 35

Re: f1c100s USB otg device 模式可以用吗?

我的修改,希望能帮大家出坑。

diff --git a/drivers/usb/gadget/f_rndis.c b/drivers/usb/gadget/f_rndis.c
index 5c274f1..c36c1a6 100644
--- a/drivers/usb/gadget/f_rndis.c
+++ b/drivers/usb/gadget/f_rndis.c
@@ -15,6 +15,7 @@
 
 /* #define VERBOSE_DEBUG */
 
+#include <linux/module.h>
 #include <linux/slab.h>
 #include <linux/kernel.h>
 #include <linux/device.h>
diff --git a/drivers/usb/sunxi_usb/udc/sunxi_udc.c b/drivers/usb/sunxi_usb/udc/sunxi_udc.c
index b3039d6..9815546 100755
--- a/drivers/usb/sunxi_usb/udc/sunxi_udc.c
+++ b/drivers/usb/sunxi_usb/udc/sunxi_udc.c
@@ -60,7 +60,7 @@ static const char	driver_desc[] = DRIVER_DESC;
 static u64 sunxi_udc_mask = DMA_BIT_MASK(32);
 
 static struct sunxi_udc	*the_controller = NULL;
-static u32 usbd_port_no = 0;
+static u32 usbd_port_no = 1;
 static sunxi_udc_io_t g_sunxi_udc_io;
 static u32 usb_connect = 0;
 static u32 is_controller_alive = 0;
@@ -2856,6 +2856,7 @@ int sunxi_usb_device_enable(void)
 		goto err;
 	}
 
+	is_udc_enable = 1;
 	if (udc->driver && is_udc_enable) {
 		sunxi_udc_enable(udc);
 		cfg_udc_command(SW_UDC_P_ENABLE);
diff --git a/drivers/usb/sunxi_usb/usbc/usbc.c b/drivers/usb/sunxi_usb/usbc/usbc.c
index c09e879..33d0f53 100755
--- a/drivers/usb/sunxi_usb/usbc/usbc.c
+++ b/drivers/usb/sunxi_usb/usbc/usbc.c
@@ -1406,7 +1406,7 @@ __u32 USBC_TestMode_ReadReg(__hdle hUSB, __u32 offset, __u32 reg_width)
 
 __hdle USBC_open_otg(__u32 otg_no)
 {
-	__usbc_otg_t *usbc_otg = usbc_otg_array;
+	__usbc_otg_t *usbc_otg = &usbc_otg_array[otg_no];
 
 	usbc_otg->used      = 1;
 	usbc_otg->no        = otg_no;
diff --git a/drivers/usb/sunxi_usb/usbc/usbc_i.h b/drivers/usb/sunxi_usb/usbc/usbc_i.h
index 797c9f4..4e50e16 100755
--- a/drivers/usb/sunxi_usb/usbc/usbc_i.h
+++ b/drivers/usb/sunxi_usb/usbc/usbc_i.h
@@ -18,7 +18,7 @@
 
 #include "../include/sunxi_usb_config.h"
 
-#define  USBC_MAX_OPEN_NUM    1
+#define  USBC_MAX_OPEN_NUM    2
 
 void __iomem *get_otgc_vbase(void);

离线

#29 2018-09-21 09:04:23

晕哥
Administrator
注册时间: 2017-09-06
累计积分: 8,528

Re: f1c100s USB otg device 模式可以用吗?

@szyusong 感谢分享!

你用的是主线 u-boot + bsp linux 吗?  如果全部按照官方bsp的做法,应该是改 sys_config.fex 设备树的, 改dts 好像起不到作用。

离线

#30 2018-09-21 09:05:33

szyusong
会员
所在地: 深圳
注册时间: 2018-09-08
累计积分: 35

Re: f1c100s USB otg device 模式可以用吗?

晕哥 说:

@szyusong 感谢分享!

你用的是主线 u-boot + bsp linux 吗?  如果全部按照官方bsp的做法,应该是改 sys_config.fex 设备树的, 改dts 好像起不到作用。

用的这个里面的 kernel:https://bitbucket.org/qq516333132/c600.git

离线

#31 2018-09-21 09:07:01

szyusong
会员
所在地: 深圳
注册时间: 2018-09-08
累计积分: 35

Re: f1c100s USB otg device 模式可以用吗?

离线

#32 2018-09-21 10:04:14

晕哥
Administrator
注册时间: 2017-09-06
累计积分: 8,528

Re: f1c100s USB otg device 模式可以用吗?

对, 我就是从那里克隆的.


cd /opt/c600
./build.sh config ###配置
./build.sh -p sunivw1p1 -k linux-3.10 -m all   ###编译
./build.sh pack   ####打包

你是用这个流程编译的吗?

离线

#33 2018-09-21 13:55:23

szyusong
会员
所在地: 深圳
注册时间: 2018-09-08
累计积分: 35

Re: f1c100s USB otg device 模式可以用吗?

我把 kernel 目录抠出来单独编译的。就是那个 linux-3.10 目录。

最近编辑记录 szyusong (2018-09-21 13:55:53)

离线

#34 2018-09-21 14:33:37

晕哥
Administrator
注册时间: 2017-09-06
累计积分: 8,528

Re: f1c100s USB otg device 模式可以用吗?

szyusong 说:

我把 kernel 目录抠出来单独编译的。就是那个 linux-3.10 目录。

原来如此,大神是否方便提供一个能用OTG的flash固件?

/ # insmod /lib/modules/3.10.65/libcomposite.ko
/ # insmod /lib/modules/3.10.65/gadgetfs.ko
[  165.311374] gadgetfs: USB Gadget filesystem, version 24 Aug 2004
/ # insmod /lib/modules/3.10.65/g_audio.ko
[  177.379077] udc 1c13000.udc-controller: registering UDC driver [g_audio]
[  177.386695] [sw_udc]: alloc request: ep(0xc04900d8, ep0, 64), req(0xc1b55120)
[  177.402742] g_audio gadget: adding config #1 'Linux USB Audio Gadget'/bf013164
[  177.410836] g_audio gadget: adding 'uac2_func'/c1b7c410 to config 'Linux USB Audio Gadget'/bf013164
[  177.421004] (null): afunc_bind:968 Error!
[  177.425622] g_audio gadget: adding 'uac2_func'/c1b7c410 --> -22
[  177.432201] g_audio gadget: cfg 1/bf013164 speeds:
[  177.437564] g_audio gadget:   interface 0 = uac2_func/c1b7c410
[  177.444084] g_audio gadget:   interface 1 = uac2_func/c1b7c410
[  177.450568] g_audio gadget:   interface 2 = uac2_func/c1b7c410
[  177.457091] g_audio gadget: Linux USB Audio Gadget, version: Feb 2, 2012
[  177.464563] g_audio gadget: g_audio ready
[  177.469007] [sw_udc]: [sunxi_usb_udc]: binding gadget driver 'g_audio'

我按你上面的修改,出现这个错误.

离线

#35 2018-09-21 14:45:03

晕哥
Administrator
注册时间: 2017-09-06
累计积分: 8,528

Re: f1c100s USB otg device 模式可以用吗?

/ # insmod /lib/modules/3.10.65/libcomposite.ko
/ # insmod /lib/modules/3.10.65/gadgetfs.ko
[   62.296130] gadgetfs: USB Gadget filesystem, version 24 Aug 2004
#
#
/ # insmod /lib/modules/3.10.65/snd-rawmidi.ko
/ # insmod /lib/modules/3.10.65/g_midi.ko
[  115.004128] udc 1c13000.udc-controller: registering UDC driver [MIDI Gadget]
[  115.011998] [sw_udc]: alloc request: ep(0xc04900d8, ep0, 64), req(0xc1b57300)
[  115.030894] MIDI Gadget gadget: adding config #1 'MIDI Gadget'/bf023cf0
[  115.061726] MIDI Gadget gadget: adding 'gmidi function'/c1b43800 to config 'MIDI Gadget'/bf023cf0
[  115.071793] MIDI Gadget gadget: cfg 1/bf023cf0 speeds: high full
[  115.078532] MIDI Gadget gadget:   interface 0 = gmidi function/c1b43800
[  115.085911] MIDI Gadget gadget:   interface 1 = gmidi function/c1b43800
[  115.093282] MIDI Gadget
[  115.096018] MIDI Gadget gadget: MIDI Gadget ready
[  115.101241] [sw_udc]: [sunxi_usb_udc]: binding gadget driver 'MIDI Gadget'

这样看起来正常吗? 可是插入USB线到电脑,电脑没有反应,f1c100s也没反应.

离线

#36 2018-09-21 16:40:12

晕哥
Administrator
注册时间: 2017-09-06
累计积分: 8,528

Re: f1c100s USB otg device 模式可以用吗?

ippen 说:
[    4.257062]
[    4.257062] insmod_device_driver
[    4.257062]
[    4.265583] [sw_udc]: sunxi_usb_device_enable start
[    4.271087] [sw_udc]: open_usb_clock
[    4.275104] [sw_udc]: udc->driver is null, udc is need not stop
[    4.281816] [sw_udc]: sunxi_usb_device_enable end
[    4.287096] device_chose finished 64!

看来我的不太一样,错误是 udc->driver is null

我的也一样, 哭

离线

#37 2018-09-21 22:31:29

szyusong
会员
所在地: 深圳
注册时间: 2018-09-08
累计积分: 35

Re: f1c100s USB otg device 模式可以用吗?

usb_port_type 为 2 的固件:zImage_dtb.rar

kernel 配置:sunivw1p1_licheepi_nano_defconfig.rar

sunivw1p1.dtsi 修改:

diff --git a/arch/arm/boot/dts/sunivw1p1.dtsi b/arch/arm/boot/dts/sunivw1p1.dtsi
index d80127d..3883da6 100644
--- a/arch/arm/boot/dts/sunivw1p1.dtsi
+++ b/arch/arm/boot/dts/sunivw1p1.dtsi
@@ -568,10 +568,13 @@
                usbc0:usbc0@0 {
                        device_type         = "usbc0";
                        compatible          = "allwinner,sun50i-otg-manager";
-                       usb_port_type       = <1>; /* 0: for device, 1: for host */
+                       usb_port_type       = <2>; /* 0: for device, 1: for host */
                        usb_detect_type     = <1>;
+                       usb_detect_mode         = <0>;
 //                     usb_id_gpio         = <&pio PH 9 0 1 1 1>;
-                       usb_det_vbus_gpio   = <&pio PA 2 0 1 1 1>;
+                       usb_id_gpio             = <&pio PE 2 0 1 1 1>;
+//                     usb_det_vbus_gpio   = <&pio PA 2 0 1 1 1>;
+                       usb_det_vbus_gpio       = <&pio PE 2 0 1 1 1>;
 //                     usb_drv_vbus_gpio   = <&axp_pio PP 3 1 1 1 1>;
                        usb_host_init_state = <0>;
                        usb_regulator_io    = "nocare";

启动 log:

U-Boot SPL 2018.01-05676-g0018878-dirty (Apr 19 2018 - 20:06:23)
DRAM: 32 MiB
Trying to boot from sunxi SPI


U-Boot 2018.01-05676-g0018878-dirty (Apr 19 2018 - 20:06:23 +0800) Allwinner Technology

CPU:   Allwinner F Series (SUNIV)
Model: Lichee Pi Nano
DRAM:  32 MiB
MMC:   SUNXI SD/MMC: 0
SF: Detected w25q128bv with page size 256 Bytes, erase size 4 KiB, total 16 MiB
Setting up a 480x272 lcd console (overscan 0x0)
In:    serial@1c25000
Out:   serial@1c25000
Err:   serial@1c25000
Net:   No ethernet found.
starting USB...
No controllers found
Hit any key to stop autoboot:  0 
SF: Detected w25q128bv with page size 256 Bytes, erase size 4 KiB, total 16 MiB
device 0 offset 0x100000, size 0x280000
SF: 2621440 bytes @ 0x100000 Read: OK
device 0 offset 0x380000, size 0x10000
SF: 65536 bytes @ 0x380000 Read: OK
## Flattened Device Tree blob at 80c00000
   Booting using the fdt blob at 0x80c00000
   reserving fdt memory region: addr=81000000 size=10000
   Loading Device Tree to 80e5e000, end 80e67a83 ... OK

Starting kernel ...

[    0.000000] Booting Linux on physical CPU 0x0
[    0.000000] Linux version 3.10.65+ (root@debian) (gcc version 4.8.3 20140320 (prerelease) (Sourcery CodeBench Lite 2014.05-29) ) #17 Fri Sep 21 22:13:46 CST 2018
[    0.000000] CPU: ARM926EJ-S [41069265] revision 5 (ARMv5TEJ), cr=00053177
[    0.000000] CPU: VIVT data cache, VIVT instruction cache
[    0.000000] Machine: Allwinner A1X (Device Tree), model: sunivw1p1
[    0.000000] bootconsole [earlycon0] enabled
[    0.000000] Memory policy: ECC disabled, Data cache writethrough
[    0.000000] Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 8128
[    0.000000] Kernel command line: earlyprintk panic=5 rootwait root=/dev/mtdblock3 ro rootfstype=squashfs init=/linuxrc console=ttyS0,115200
[    0.000000] PID hash table entries: 128 (order: -3, 512 bytes)
[    0.000000] Dentry cache hash table entries: 4096 (order: 2, 16384 bytes)
[    0.000000] Inode-cache hash table entries: 2048 (order: 1, 8192 bytes)
[    0.000000] Memory: 32MB = 32MB total
[    0.000000] Memory: 27836k/27836k available, 4932k 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]     vmalloc : 0xc2800000 - 0xff000000   ( 968 MB)
[    0.000000]     lowmem  : 0xc0000000 - 0xc2000000   (  32 MB)
[    0.000000]     modules : 0xbf000000 - 0xc0000000   (  16 MB)
[    0.000000]       .text : 0xc0008000 - 0xc03fbf44   (4048 kB)
[    0.000000]       .init : 0xc03fc000 - 0xc041b184   ( 125 kB)
[    0.000000]       .data : 0xc041c000 - 0xc044ae68   ( 188 kB)
[    0.000000]        .bss : 0xc044ae68 - 0xc045e828   (  79 kB)
[    0.000000] SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[    0.000000] NR_IRQS:256
[    0.000000] of_sunxi_clocks_init : sunxi_clk_base[0xf1c20000]
[    0.000000] pll_cpu-set_default_rate=528000000 success!
[    0.000000] pll_video-set_default_rate=297000000 success!
[    0.000000] pll_ddr-set_default_rate=312000000 success!
[    0.000000] sched_clock: 32 bits at 24MHz, resolution 41ns, wraps every 178956ms
[    0.000000] Console: colour dummy device 80x30
[    0.005447] Calibrating delay loop... 262.96 BogoMIPS (lpj=1314816)
[    0.075370] pid_max: default: 32768 minimum: 301
[    0.080826] Mount-cache hash table entries: 512
[    0.087647] CPU: Testing write buffer coherency: ok
[    0.093873] Setting up static identity map for 0xc02de6b0 - 0xc02de708
[    0.105310] devtmpfs: initialized
[    0.111824] pinctrl core: initialized pinctrl subsystem
[    0.117720] NET: Registered protocol family 16
[    0.124805] DMA: preallocated 256 KiB pool for atomic coherent allocations
[    0.133199] dump_class_init,821, success
[    0.145212] sunivw1p1-pinctrl 1c20800.pinctrl: initialized sunXi PIO driver
[    0.166828] No ATAGs?
[    0.185067] bio: create slab <bio-0> at 0
[    0.192818] SCSI subsystem initialized
[    0.197212] usbcore: registered new interface driver usbfs
[    0.203037] usbcore: registered new interface driver hub
[    0.209060] usbcore: registered new device driver usb
[    0.216039] Advanced Linux Sound Architecture Driver Initialized.
[    0.225838] cfg80211: Calling CRDA to update world regulatory domain
[    0.232991] [pm]aw_pm_init!
[    0.236309] [pm]aw_pm_valid!
[    0.239293] Notice: sunivw1p1 just support normal standby.
[    0.244969] [pm]aw_pm_valid!
[    0.247944] Notice: sunivw1p1 just support normal standby.
[    0.254085] Switching to clocksource suniv high-res couter
[    0.310095] NET: Registered protocol family 2
[    0.319017] TCP established hash table entries: 512 (order: 0, 4096 bytes)
[    0.326153] TCP bind hash table entries: 512 (order: -1, 2048 bytes)
[    0.332659] TCP: Hash tables configured (established 512 bind 512)
[    0.339078] TCP: reno registered
[    0.342497] UDP hash table entries: 256 (order: 0, 4096 bytes)
[    0.348499] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
[    0.355679] NET: Registered protocol family 1
[    0.384076] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[    0.390936] jffs2: version 2.2. (NAND) © 2001-2006 Red Hat, Inc.
[    0.398893] msgmni has been set to 54
[    0.407481] io scheduler noop registered
[    0.411691] io scheduler deadline registered
[    0.416213] io scheduler cfq registered (default)
[    0.457316] sw_uart_request_gpio(753)
[    0.461398] uart0: ttyS0 at MMIO 0x1c25000 (irq = 103) is a SUNXI
[    0.467657] sw_console_setup()1175 - console setup baud 115200 parity n bits 8, flow n
[    0.475831] console [ttyS0] enabled, bootconsole disabled
[    0.475831] console [ttyS0] enabled, bootconsole disabled
[    0.489281] sw_uart_request_gpio(753)
[    0.493599] uart1: ttyS1 at MMIO 0x1c25400 (irq = 104) is a SUNXI
[    0.501936] misc dump reg init
[    0.511229] spi spi0: master is unqueued, this is deprecated
[    0.519683] NorFlash ID: 0xef4018 - 0x0
[    0.524205] m25p80 spi0.0: found w25q128, expected m25p64
[    0.530302] m25p80 spi0.0: w25q128 (16384 Kbytes)
[    0.549601] partitions_register()874 - Invalid partitions count: -1
[    0.556708] partition_register: enter
[    0.560955] 4 ofpart partitions found on MTD device (null)
[    0.567058] Creating 4 MTD partitions on "(null)":
[    0.572446] 0x000000000000-0x000000100000 : "uboot"
[    0.581924] 0x000000100000-0x000000350000 : "kernel"
[    0.591235] 0x000000350000-0x000000400000 : "dtb"
[    0.600317] 0x000000400000-0x000001000000 : "rootfs"
[    0.610447] usbcore: registered new interface driver usb-storage
[    0.617631] g_ether gadget: using random self ethernet address
[    0.624262] g_ether gadget: using random host ethernet address
[    0.632795] usb0: MAC 52:a0:e4:e3:5d:72
[    0.637083] usb0: HOST MAC 4e:d8:b4:1b:10:6b
[    0.642046] gadget_is_softwinner_otg is not -int
[    0.647192] gadget_is_softwinner_otg is not -int
[    0.652507] gadget_is_softwinner_otg is not -int
[    0.657645] gadget_is_softwinner_otg is not -int
[    0.662933] g_ether gadget: Ethernet Gadget, version: Memorial Day 2008
[    0.670360] g_ether gadget: g_ether ready
[    0.675885] usb otg host probe
[    0.679877] sunxi_hcd_host0 1c13000.otghci0-controller: sunxi_hcd host driver
[    0.687873] sunxi_hcd_host0 1c13000.otghci0-controller: new USB bus registered, assigned bus number 1
[    0.701362] hub 1-0:1.0: USB hub found
[    0.705651] hub 1-0:1.0: 1 port detected
[    0.712627] support report repeat key value. 
[    0.718416] input: sunxi-keyboard as /devices/virtual/input/input0
[    0.727145] i2c /dev entries driver
[    0.731262] IR NEC protocol handler initialized
[    0.737039] pdev->dev.of_node name :cir
[    0.741837] Registered IR keymap rc_map_sunxi
[    0.749658] input: sunxi_ir_recv as /devices/soc.0/1c22c00.cir/rc/rc0/input1
[    0.758561] rc0: sunxi_ir_recv as /devices/soc.0/1c22c00.cir/rc/rc0
[    0.773276] 
[    0.773276] sunxi_daudio->tx_data_mode =0
[    0.780227] failed to get headphone-dect gpio from dts,headphone-dect:-2
[    0.788674] no jack gpio or irq
[    0.805982] sunxi-codec-machine sound.4:  sun8iw10codec <-> 1c23c00.cpudai0-controller mapping ok
[    0.821489] TCP: cubic registered
[    0.825201] Initializing XFRM netlink socket
[    0.830167] NET: Registered protocol family 17
[    0.835637] VFP support v0.3: not present
[    0.844597] input: gpio_keys.6 as /devices/soc.0/gpio_keys.6/input/input2
[    0.853875] drivers/rtc/hctosys.c: unable to open rtc device (rtc0)
[    0.861281] ALSA device list:
[    0.864616]   #0: audiocodec
[    0.888001] VFS: Mounted root (squashfs filesystem) readonly on device 31:3.
[    0.907105] devtmpfs: mounted
[    0.912480] Freeing unused kernel memory: 124K (c03fc000 - c041b000)
Starting logging: OK
read-only file system detected...done
Starting network: OK

Welcome to Buildroot
buildroot login: [    6.781323] setup:composite_setup...
[    6.785344] setup:USB_REQ_GET_DESCRIPTOR...
[    6.789992] setup:USB_DT_DEVICE...
[    6.903185] setup:composite_setup...
[    6.907189] setup:USB_REQ_GET_DESCRIPTOR...
[    6.911834] setup:USB_DT_DEVICE...
[    6.915983] setup:composite_setup...
[    6.919977] setup:USB_REQ_GET_DESCRIPTOR...
[    6.924628] setup:USB_DT_CONFIG...
[    6.929561] setup:composite_setup...
[    6.933577] setup:USB_REQ_GET_DESCRIPTOR...
[    6.938222] setup:USB_DT_STRING...
[    6.942176] setup:composite_setup...
[    6.946160] setup:USB_REQ_GET_DESCRIPTOR...
[    6.950806] setup:USB_DT_STRING...
[    6.983999] setup:composite_setup...
[    6.988021] setup:USB_REQ_GET_DESCRIPTOR...
[    6.992671] setup:USB_DT_DEVICE...
[    6.997226] setup:composite_setup...
[    7.001202] setup:USB_REQ_GET_DESCRIPTOR...
[    7.005853] setup:USB_DT_STRING...
[    7.010228] setup:composite_setup...
[    7.014207] setup:USB_REQ_GET_DESCRIPTOR...
[    7.018855] setup:USB_DT_STRING...
[    7.022985] setup:composite_setup...
[    7.026983] setup:USB_REQ_GET_DESCRIPTOR...
[    7.031628] setup:USB_DT_STRING...
[    7.048864] setup:composite_setup...
[    7.052894] setup:USB_REQ_GET_DESCRIPTOR...
[    7.057552] setup:USB_DT_DEVICE...
[    7.061483] setup:composite_setup...
[    7.065463] setup:USB_REQ_GET_DESCRIPTOR...
[    7.070097] setup:USB_DT_CONFIG...
[    7.074044] setup:composite_setup...
[    7.078031] setup:USB_REQ_GET_DESCRIPTOR...
[    7.082673] setup:USB_DT_CONFIG...
[    7.091845] setup:composite_setup...
[    7.095865] setup:USB_REQ_SET_CONFIGURATION...
[    7.100829] g_ether gadget: high-speed config #2: RNDIS
[    7.133224] setup:composite_setup...
[    7.137225] setup:USB_REQ_GET_STATUS...
[    7.141493] setup:USB_RECIP_INTERFACE...
[    7.146029] rndis_command_complete: MaxTransferSize: 16384 : Multi_pkt_txr: enabled
[    7.161868] setup:composite_setup...
[    7.165883] setup:USB_REQ_GET_STATUS...
[    7.170137] setup:USB_RECIP_INTERFACE...
[    7.174782] rndis_command_complete: MaxTransferSize: 16384 : Multi_pkt_txr: enabled
[    7.552190] setup:composite_setup...
[    7.556211] setup:USB_REQ_GET_DESCRIPTOR...
[    7.560855] setup:USB_DT_STRING...
[    7.564927] setup:composite_setup...
[    7.568916] setup:USB_REQ_GET_DESCRIPTOR...
[    7.573559] setup:USB_DT_STRING...
[    7.577515] setup:composite_setup...
[    7.581503] setup:USB_REQ_GET_DESCRIPTOR...
[    7.586148] setup:USB_DT_STRING...
[   12.151904] setup:composite_setup...
[   12.155923] setup:USB_REQ_SET_CONFIGURATION...
[   12.161050] g_ether gadget: high-speed config #0: unconfigured

离线

#38 2018-09-21 22:32:30

szyusong
会员
所在地: 深圳
注册时间: 2018-09-08
累计积分: 35

Re: f1c100s USB otg device 模式可以用吗?

晕哥 说:
szyusong 说:

我把 kernel 目录抠出来单独编译的。就是那个 linux-3.10 目录。

原来如此,大神是否方便提供一个能用OTG的flash固件?

/ # insmod /lib/modules/3.10.65/libcomposite.ko
/ # insmod /lib/modules/3.10.65/gadgetfs.ko
[  165.311374] gadgetfs: USB Gadget filesystem, version 24 Aug 2004
/ # insmod /lib/modules/3.10.65/g_audio.ko
[  177.379077] udc 1c13000.udc-controller: registering UDC driver [g_audio]
[  177.386695] [sw_udc]: alloc request: ep(0xc04900d8, ep0, 64), req(0xc1b55120)
[  177.402742] g_audio gadget: adding config #1 'Linux USB Audio Gadget'/bf013164
[  177.410836] g_audio gadget: adding 'uac2_func'/c1b7c410 to config 'Linux USB Audio Gadget'/bf013164
[  177.421004] (null): afunc_bind:968 Error!
[  177.425622] g_audio gadget: adding 'uac2_func'/c1b7c410 --> -22
[  177.432201] g_audio gadget: cfg 1/bf013164 speeds:
[  177.437564] g_audio gadget:   interface 0 = uac2_func/c1b7c410
[  177.444084] g_audio gadget:   interface 1 = uac2_func/c1b7c410
[  177.450568] g_audio gadget:   interface 2 = uac2_func/c1b7c410
[  177.457091] g_audio gadget: Linux USB Audio Gadget, version: Feb 2, 2012
[  177.464563] g_audio gadget: g_audio ready
[  177.469007] [sw_udc]: [sunxi_usb_udc]: binding gadget driver 'g_audio'

我按你上面的修改,出现这个错误.

不要编译为 module,直接和内核编译在一起试试。

离线

#39 2018-09-22 08:34:08

晕哥
Administrator
注册时间: 2017-09-06
累计积分: 8,528

Re: f1c100s USB otg device 模式可以用吗?

[    1.552757] async_continuing @ 1 after 3 usec
[    1.571423] VFS: Mounted root (squashfs filesystem) readonly on device 31:2.
[    1.591727] devtmpfs: mounted
[    1.595278] async_waiting @ 1
[    1.598597] async_continuing @ 1 after 2 usec
[    1.603951] Freeing unused kernel memory: 128K (c0452000 - c0472000)
[    4.285172]
[    4.285172]
[    4.285172] insmod_device_driver
[    4.285172]
[    4.293715] [sw_udc]: open_usb_clock
[    4.297816] [sw_udc]: usbd_stop_work
[    4.301904] [sw_udc]: CONFIG_USB_GADGET_DUALSPEED: USBC_TS_MODE_HS
[    4.308856] [sw_udc]: usbd_start_work
[    4.312954] [sw_udc]: usbd_start_work
[    4.317063] [sw_udc]: sunxi_usb_device_enable end
[    4.322284] device_chose finished 64!
[    4.368423] [sw_udc]: IRQ: suspend
[    4.372235] [sw_udc]: ERR: usb speed is unkown
/etc/init.d/rcS: line 12: /usr/sbin/net.sh: not found

/ #
/ #
/ #
/ # [   12.843789] [sw_udc]: IRQ: reset
[   12.847402] [sw_udc]: (1:star,2:end): vfs_read:0, vfs_write:0,dma_working:0,amount:0,file_offset:0
[   12.857327] [sw_udc]: irq: reset happen, throw away all urb
[   13.029539] [sw_udc]:
+++++++++++++++++++++++++++++++++++++
[   13.035939] [sw_udc]:  usb enter high speed.
[   13.040660] [sw_udc]:
+++++++++++++++++++++++++++++++++++++
[   13.047028] setup:composite_setup...
[   13.050988] setup:USB_REQ_GET_DESCRIPTOR...
[   13.055613] setup:USB_DT_DEVICE...
[   13.064198] [sw_udc]: IRQ: reset
[   13.067794] [sw_udc]: (1:star,2:end): vfs_read:0, vfs_write:0,dma_working:0,amount:0,file_offset:0
[   13.077716] [sw_udc]: irq: reset happen, throw away all urb
[   13.232340] [sw_udc]: Set address 2
[   13.263548] setup:composite_setup...
[   13.267544] setup:USB_REQ_GET_DESCRIPTOR...
[   13.272173] setup:USB_DT_DEVICE...
[   13.276133] setup:composite_setup...
[   13.280099] setup:USB_REQ_GET_DESCRIPTOR...
[   13.284724] setup:USB_DT_CONFIG...
[   13.289094] setup:composite_setup...
[   13.293086] setup:USB_REQ_GET_DESCRIPTOR...
[   13.297712] setup:USB_DT_STRING...
[   13.301732] setup:composite_setup...
[   13.305707] setup:USB_REQ_GET_DESCRIPTOR...
[   13.310332] setup:USB_DT_STRING...
[   13.317436] setup:composite_setup...
[   13.321437] setup:USB_REQ_GET_DESCRIPTOR...
[   13.326066] setup:USB_DT_DEVICE...
[   13.330111] setup:composite_setup...
[   13.334101] setup:USB_REQ_GET_DESCRIPTOR...
[   13.338728] setup:USB_DT_CONFIG...
[   13.342708] setup:composite_setup...
[   13.346676] setup:USB_REQ_GET_DESCRIPTOR...
[   13.351299] setup:USB_DT_CONFIG...
[   13.355369] setup:composite_setup...
[   13.359342] setup:USB_REQ_SET_CONFIGURATION...
[   13.364281] MIDI Gadget gadget: high-speed config #1: MIDI Gadget
[   13.371026] [sw_udc]: ep enable: ep1(0xc049c5b4, ep1in-bulk, 128, 512)
[   13.378261] [sw_udc]: ep enable: ep1(0xc049c5b4, ep1in-bulk, 128, 512), fifo(512, 512, 0)
[   13.387332] [sw_udc]: ep enable: ep1(0xc049c600, ep1out-bulk, 0, 512)
[   13.394466] [sw_udc]: ep enable: ep1(0xc049c600, ep1out-bulk, 0, 512), fifo(1024, 512, 0)
[   13.403526] [sw_udc]: ep disable: ep1(0xc049c600, ep1out-bulk, 0, 200)
[   13.410756] [sw_udc]: ep enable: ep1(0xc049c600, ep1out-bulk, 0, 512)
[   13.417884] [sw_udc]: ep enable: ep1(0xc049c600, ep1out-bulk, 0, 512), fifo(1024, 512, 0)
[   13.426942] [sw_udc]: alloc request: ep(0xc049c600, ep1out-bulk, 512), req(0xc1b0c600)
[   13.435711] [sw_udc]: alloc request: ep(0xc049c600, ep1out-bulk, 512), req(0xc1b0c120)
[   13.444470] [sw_udc]: alloc request: ep(0xc049c600, ep1out-bulk, 512), req(0xc1b0c480)
[   13.453226] [sw_udc]: alloc request: ep(0xc049c600, ep1out-bulk, 512), req(0xc1b0c4e0)
[   13.461984] [sw_udc]: alloc request: ep(0xc049c600, ep1out-bulk, 512), req(0xc1b0c420)
[   13.470744] [sw_udc]: alloc request: ep(0xc049c600, ep1out-bulk, 512), req(0xc1b0c0c0)
[   13.479505] [sw_udc]: alloc request: ep(0xc049c600, ep1out-bulk, 512), req(0xc1b0c660)
[   13.488296] [sw_udc]: alloc request: ep(0xc049c600, ep1out-bulk, 512), req(0xc1b0c6c0)
[   13.497064] [sw_udc]: alloc request: ep(0xc049c600, ep1out-bulk, 512), req(0xc1b0c720)
[   13.505824] [sw_udc]: alloc request: ep(0xc049c600, ep1out-bulk, 512), req(0xc1b0c780)
[   13.514584] [sw_udc]: alloc request: ep(0xc049c600, ep1out-bulk, 512), req(0xc1b0c7e0)
[   13.523343] [sw_udc]: alloc request: ep(0xc049c600, ep1out-bulk, 512), req(0xc1b0c840)
[   13.532102] [sw_udc]: alloc request: ep(0xc049c600, ep1out-bulk, 512), req(0xc1b0c8a0)
[   13.540861] [sw_udc]: alloc request: ep(0xc049c600, ep1out-bulk, 512), req(0xc1b0c900)
[   13.549622] [sw_udc]: alloc request: ep(0xc049c600, ep1out-bulk, 512), req(0xc1b0c960)
[   13.558381] [sw_udc]: alloc request: ep(0xc049c600, ep1out-bulk, 512), req(0xc1b0c9c0)
[   13.567136] [sw_udc]: alloc request: ep(0xc049c600, ep1out-bulk, 512), req(0xc1b0ca20)
[   13.575895] [sw_udc]: alloc request: ep(0xc049c600, ep1out-bulk, 512), req(0xc1b0ca80)
[   13.584655] [sw_udc]: alloc request: ep(0xc049c600, ep1out-bulk, 512), req(0xc1b0cae0)
[   13.593413] [sw_udc]: alloc request: ep(0xc049c600, ep1out-bulk, 512), req(0xc1b0cb40)
[   13.602172] [sw_udc]: alloc request: ep(0xc049c600, ep1out-bulk, 512), req(0xc1b0cba0)
[   13.610930] [sw_udc]: alloc request: ep(0xc049c600, ep1out-bulk, 512), req(0xc1b0cc00)
[   13.619691] [sw_udc]: alloc request: ep(0xc049c600, ep1out-bulk, 512), req(0xc1b0cc60)
[   13.628459] [sw_udc]: alloc request: ep(0xc049c600, ep1out-bulk, 512), req(0xc1b0ccc0)
[   13.637221] [sw_udc]: alloc request: ep(0xc049c600, ep1out-bulk, 512), req(0xc1b0cd20)
[   13.645981] [sw_udc]: alloc request: ep(0xc049c600, ep1out-bulk, 512), req(0xc1b0cd80)
[   13.654740] [sw_udc]: alloc request: ep(0xc049c600, ep1out-bulk, 512), req(0xc1b0cde0)
[   13.663499] [sw_udc]: alloc request: ep(0xc049c600, ep1out-bulk, 512), req(0xc1b0ce40)
[   13.672260] [sw_udc]: alloc request: ep(0xc049c600, ep1out-bulk, 512), req(0xc1b0cea0)
[   13.681018] [sw_udc]: alloc request: ep(0xc049c600, ep1out-bulk, 512), req(0xc1b0cf00)
[   13.689777] [sw_udc]: alloc request: ep(0xc049c600, ep1out-bulk, 512), req(0xc1b0cf60)
[   13.698537] [sw_udc]: alloc request: ep(0xc049c600, ep1out-bulk, 512), req(0xc18f9660)
[   13.707298] [sw_udc]: ep disable: ep1(0xc049c5b4, ep1in-bulk, 128, 200)
[   13.714622] [sw_udc]: ep enable: ep1(0xc049c5b4, ep1in-bulk, 128, 512)
[   13.721846] [sw_udc]: ep enable: ep1(0xc049c5b4, ep1in-bulk, 128, 512), fifo(512, 512, 0)
[   13.730901] [sw_udc]: ep disable: ep1(0xc049c600, ep1out-bulk, 0, 200)
[   13.738127] [sw_udc]: nuke: ep num is 1
[   13.742378] [sw_udc]: free request: ep(0xc049c600, ep1out-bulk, 512), req(0xc1b0c600)
[   13.751047] [sw_udc]: nuke: ep num is 1
[   13.755296] [sw_udc]: free request: ep(0xc049c600, ep1out-bulk, 512), req(0xc1b0c120)
[   13.763966] [sw_udc]: nuke: ep num is 1
[   13.768211] [sw_udc]: free request: ep(0xc049c600, ep1out-bulk, 512), req(0xc1b0c480)
[   13.776876] [sw_udc]: nuke: ep num is 1
[   13.781120] [sw_udc]: free request: ep(0xc049c600, ep1out-bulk, 512), req(0xc1b0c4e0)
[   13.789784] [sw_udc]: nuke: ep num is 1
[   13.794027] [sw_udc]: free request: ep(0xc049c600, ep1out-bulk, 512), req(0xc1b0c420)
[   13.802691] [sw_udc]: nuke: ep num is 1
[   13.806933] [sw_udc]: free request: ep(0xc049c600, ep1out-bulk, 512), req(0xc1b0c0c0)
[   13.815598] [sw_udc]: nuke: ep num is 1
[   13.819842] [sw_udc]: free request: ep(0xc049c600, ep1out-bulk, 512), req(0xc1b0c660)
[   13.828509] [sw_udc]: nuke: ep num is 1
[   13.832753] [sw_udc]: free request: ep(0xc049c600, ep1out-bulk, 512), req(0xc1b0c6c0)
[   13.841420] [sw_udc]: nuke: ep num is 1
[   13.845663] [sw_udc]: free request: ep(0xc049c600, ep1out-bulk, 512), req(0xc1b0c720)
[   13.854326] [sw_udc]: nuke: ep num is 1
[   13.858569] [sw_udc]: free request: ep(0xc049c600, ep1out-bulk, 512), req(0xc1b0c780)
[   13.867231] [sw_udc]: nuke: ep num is 1
[   13.871473] [sw_udc]: free request: ep(0xc049c600, ep1out-bulk, 512), req(0xc1b0c7e0)
[   13.880136] [sw_udc]: nuke: ep num is 1
[   13.884378] [sw_udc]: free request: ep(0xc049c600, ep1out-bulk, 512), req(0xc1b0c840)
[   13.893043] [sw_udc]: nuke: ep num is 1
[   13.897286] [sw_udc]: free request: ep(0xc049c600, ep1out-bulk, 512), req(0xc1b0c8a0)
[   13.905954] [sw_udc]: nuke: ep num is 1
[   13.910199] [sw_udc]: free request: ep(0xc049c600, ep1out-bulk, 512), req(0xc1b0c900)
[   13.918864] [sw_udc]: nuke: ep num is 1
[   13.923106] [sw_udc]: free request: ep(0xc049c600, ep1out-bulk, 512), req(0xc1b0c960)
[   13.931769] [sw_udc]: nuke: ep num is 1
[   13.936011] [sw_udc]: free request: ep(0xc049c600, ep1out-bulk, 512), req(0xc1b0c9c0)
[   13.944674] [sw_udc]: nuke: ep num is 1
[   13.948916] [sw_udc]: free request: ep(0xc049c600, ep1out-bulk, 512), req(0xc1b0ca20)
[   13.957579] [sw_udc]: nuke: ep num is 1
[   13.961821] [sw_udc]: free request: ep(0xc049c600, ep1out-bulk, 512), req(0xc1b0ca80)
[   13.970485] [sw_udc]: nuke: ep num is 1
[   13.974729] [sw_udc]: free request: ep(0xc049c600, ep1out-bulk, 512), req(0xc1b0cae0)
[   13.983398] [sw_udc]: nuke: ep num is 1
[   13.987643] [sw_udc]: free request: ep(0xc049c600, ep1out-bulk, 512), req(0xc1b0cb40)
[   13.996307] [sw_udc]: nuke: ep num is 1
[   14.000548] [sw_udc]: free request: ep(0xc049c600, ep1out-bulk, 512), req(0xc1b0cba0)
[   14.009212] [sw_udc]: nuke: ep num is 1
[   14.013454] [sw_udc]: free request: ep(0xc049c600, ep1out-bulk, 512), req(0xc1b0cc00)
[   14.022119] [sw_udc]: nuke: ep num is 1
[   14.026361] [sw_udc]: free request: ep(0xc049c600, ep1out-bulk, 512), req(0xc1b0cc60)
[   14.035024] [sw_udc]: nuke: ep num is 1
[   14.039266] [sw_udc]: free request: ep(0xc049c600, ep1out-bulk, 512), req(0xc1b0ccc0)
[   14.047930] [sw_udc]: nuke: ep num is 1
[   14.052175] [sw_udc]: free request: ep(0xc049c600, ep1out-bulk, 512), req(0xc1b0cd20)
[   14.060842] [sw_udc]: nuke: ep num is 1
[   14.065087] [sw_udc]: free request: ep(0xc049c600, ep1out-bulk, 512), req(0xc1b0cd80)
[   14.073749] [sw_udc]: nuke: ep num is 1
[   14.077992] [sw_udc]: free request: ep(0xc049c600, ep1out-bulk, 512), req(0xc1b0cde0)
[   14.086657] [sw_udc]: nuke: ep num is 1
[   14.090898] [sw_udc]: free request: ep(0xc049c600, ep1out-bulk, 512), req(0xc1b0ce40)
[   14.099562] [sw_udc]: nuke: ep num is 1
[   14.103805] [sw_udc]: free request: ep(0xc049c600, ep1out-bulk, 512), req(0xc1b0cea0)
[   14.112471] [sw_udc]: nuke: ep num is 1
[   14.116714] [sw_udc]: free request: ep(0xc049c600, ep1out-bulk, 512), req(0xc1b0cf00)
[   14.125381] [sw_udc]: nuke: ep num is 1
[   14.129626] [sw_udc]: free request: ep(0xc049c600, ep1out-bulk, 512), req(0xc1b0cf60)
[   14.138293] [sw_udc]: nuke: ep num is 1
[   14.142534] [sw_udc]: free request: ep(0xc049c600, ep1out-bulk, 512), req(0xc18f9660)
[   14.151202] [sw_udc]: ep enable: ep1(0xc049c600, ep1out-bulk, 0, 512)
[   14.158333] [sw_udc]: ep enable: ep1(0xc049c600, ep1out-bulk, 0, 512), fifo(1024, 512, 0)
[   14.167389] [sw_udc]: ep disable: ep1(0xc049c600, ep1out-bulk, 0, 200)
[   14.174617] [sw_udc]: ep enable: ep1(0xc049c600, ep1out-bulk, 0, 512)
[   14.181746] [sw_udc]: ep enable: ep1(0xc049c600, ep1out-bulk, 0, 512), fifo(1024, 512, 0)
[   14.190803] [sw_udc]: alloc request: ep(0xc049c600, ep1out-bulk, 512), req(0xc18f9660)
[   14.199569] [sw_udc]: alloc request: ep(0xc049c600, ep1out-bulk, 512), req(0xc1b0cf60)
[   14.208333] [sw_udc]: alloc request: ep(0xc049c600, ep1out-bulk, 512), req(0xc1b0cf00)
[   14.217093] [sw_udc]: alloc request: ep(0xc049c600, ep1out-bulk, 512), req(0xc1b0cea0)
[   14.225852] [sw_udc]: alloc request: ep(0xc049c600, ep1out-bulk, 512), req(0xc1b0ce40)
[   14.234611] [sw_udc]: alloc request: ep(0xc049c600, ep1out-bulk, 512), req(0xc1b0cde0)
[   14.243371] [sw_udc]: alloc request: ep(0xc049c600, ep1out-bulk, 512), req(0xc1b0cd80)
[   14.252131] [sw_udc]: alloc request: ep(0xc049c600, ep1out-bulk, 512), req(0xc1b0cd20)
[   14.260892] [sw_udc]: alloc request: ep(0xc049c600, ep1out-bulk, 512), req(0xc1b0ccc0)
[   14.269650] [sw_udc]: alloc request: ep(0xc049c600, ep1out-bulk, 512), req(0xc1b0cc60)
[   14.278409] [sw_udc]: alloc request: ep(0xc049c600, ep1out-bulk, 512), req(0xc1b0cc00)
[   14.287170] [sw_udc]: alloc request: ep(0xc049c600, ep1out-bulk, 512), req(0xc1b0cba0)
[   14.295928] [sw_udc]: alloc request: ep(0xc049c600, ep1out-bulk, 512), req(0xc1b0cb40)
[   14.304688] [sw_udc]: alloc request: ep(0xc049c600, ep1out-bulk, 512), req(0xc1b0cae0)
[   14.313448] [sw_udc]: alloc request: ep(0xc049c600, ep1out-bulk, 512), req(0xc1b0ca80)
[   14.322207] [sw_udc]: alloc request: ep(0xc049c600, ep1out-bulk, 512), req(0xc1b0ca20)
[   14.330966] [sw_udc]: alloc request: ep(0xc049c600, ep1out-bulk, 512), req(0xc1b0c9c0)
[   14.339726] [sw_udc]: alloc request: ep(0xc049c600, ep1out-bulk, 512), req(0xc1b0c960)
[   14.348484] [sw_udc]: alloc request: ep(0xc049c600, ep1out-bulk, 512), req(0xc1b0c900)
[   14.357245] [sw_udc]: alloc request: ep(0xc049c600, ep1out-bulk, 512), req(0xc1b0c8a0)
[   14.366003] [sw_udc]: alloc request: ep(0xc049c600, ep1out-bulk, 512), req(0xc1b0c840)
[   14.374763] [sw_udc]: alloc request: ep(0xc049c600, ep1out-bulk, 512), req(0xc1b0c7e0)
[   14.383522] [sw_udc]: alloc request: ep(0xc049c600, ep1out-bulk, 512), req(0xc1b0c780)
[   14.392281] [sw_udc]: alloc request: ep(0xc049c600, ep1out-bulk, 512), req(0xc1b0c720)
[   14.401039] [sw_udc]: alloc request: ep(0xc049c600, ep1out-bulk, 512), req(0xc1b0c6c0)
[   14.409796] [sw_udc]: alloc request: ep(0xc049c600, ep1out-bulk, 512), req(0xc1b0c660)
[   14.418554] [sw_udc]: alloc request: ep(0xc049c600, ep1out-bulk, 512), req(0xc1b0c0c0)
[   14.427313] [sw_udc]: alloc request: ep(0xc049c600, ep1out-bulk, 512), req(0xc1b0c420)
[   14.436069] [sw_udc]: alloc request: ep(0xc049c600, ep1out-bulk, 512), req(0xc1b0c4e0)
[   14.444828] [sw_udc]: alloc request: ep(0xc049c600, ep1out-bulk, 512), req(0xc1b0c480)
[   14.453588] [sw_udc]: alloc request: ep(0xc049c600, ep1out-bulk, 512), req(0xc1b0c120)
[   14.462345] [sw_udc]: alloc request: ep(0xc049c600, ep1out-bulk, 512), req(0xc1b0c600)
[   14.471838] [sw_udc]: nuke: ep num is 0
[   14.476123] MIDI Gadget gadget: setup complete --> -71, 0/0
[   14.482292] setup:composite_setup...
[   14.486246] setup:USB_REQ_GET_DESCRIPTOR...
[   14.490866] setup:USB_DT_STRING...
[   14.494880] setup:composite_setup...
[   14.498839] setup:USB_REQ_GET_DESCRIPTOR...
[   14.503463] setup:USB_DT_STRING...
[   14.510859] setup:composite_setup...
[   14.514850] setup:USB_REQ_GET_DESCRIPTOR...
[   14.519482] setup:USB_DT_STRING...
[   14.523463] setup:composite_setup...
[   14.527432] setup:USB_REQ_GET_DESCRIPTOR...
[   14.532056] setup:USB_DT_STRING...
[   16.194195] setup:composite_setup...
[   16.198190] setup:USB_REQ_GET_DESCRIPTOR...
[   16.202826] setup:USB_DT_CONFIG...
[   16.207024] setup:composite_setup...
[   16.210997] setup:USB_REQ_GET_DESCRIPTOR...
[   16.215623] setup:USB_DT_CONFIG...

QQ20180922143540.png

感谢 @szyusong 大神,  把 gadget驱动编译到内核就可以了.
可是问题来了,为什么编译成模块安装不行呢?

离线

#40 2018-09-22 16:46:46

晕哥
Administrator
注册时间: 2017-09-06
累计积分: 8,528

Re: f1c100s USB otg device 模式可以用吗?

[    4.285393] insmod_device_driver
[    4.285393]
[    4.293934] [sw_udc]: open_usb_clock
[    4.298036] [sw_udc]: usbd_stop_work
[    4.302235] [sw_udc]: CONFIG_USB_GADGET_DUALSPEED: USBC_TS_MODE_HS
[    4.309192] [sw_udc]: usbd_start_work
[    4.313270] [sw_udc]: usbd_start_work
[    4.317395] [sw_udc]: sunxi_usb_device_enable end
[    4.322632] device_chose finished 64!
[    4.368741] [sw_udc]: IRQ: suspend
[    4.372548] [sw_udc]: ERR: usb speed is unkown
[    4.495732] [sw_udc]: IRQ: reset
[    4.499346] [sw_udc]: (1:star,2:end): vfs_read:0, vfs_write:0,dma_working:0,amount:0,file_offset:0
[    4.509267] [sw_udc]: irq: reset happen, throw away all urb
[    4.681484] [sw_udc]:
[    4.681484] +++++++++++++++++++++++++++++++++++++
[    4.687890] [sw_udc]:  usb enter high speed.
[    4.692611] [sw_udc]:
[    4.692611] +++++++++++++++++++++++++++++++++++++
[    4.698985] setup:composite_setup...
[    4.702941] setup:USB_REQ_GET_DESCRIPTOR...
[    4.707563] setup:USB_DT_DEVICE...
[    4.712905] android_work: sent uevent USB_STATE=CONNECTED
[    4.718996] [sw_udc]: IRQ: reset
[    4.722582] [sw_udc]: (1:star,2:end): vfs_read:0, vfs_write:0,dma_working:0,amount:0,file_offset:0
[    4.732501] [sw_udc]: irq: reset happen, throw away all urb
[    4.884313] [sw_udc]: Set address 2
[    4.915558] setup:composite_setup...
[    4.915567] setup:USB_REQ_GET_DESCRIPTOR...
[    4.915572] setup:USB_DT_DEVICE...
[    4.915759] setup:composite_setup...
[    4.915764] setup:USB_REQ_GET_DESCRIPTOR...
[    4.915768] setup:USB_DT_CONFIG...
[    4.915789] ERR: dev->driver->setup failed. (-22)
[    4.920607] [sw_udc]: IRQ: reset
[    4.920636] [sw_udc]: (1:star,2:end): vfs_read:0, vfs_write:0,dma_working:0,amount:0,file_offset:0
[    4.920648] [sw_udc]: irq: reset happen, throw away all urb
[    5.102734] setup:composite_setup...
[    5.106723] setup:USB_REQ_GET_DESCRIPTOR...
[    5.111348] setup:USB_DT_DEVICE...
[    5.119979] [sw_udc]: IRQ: reset
[    5.123603] [sw_udc]: (1:star,2:end): vfs_read:0, vfs_write:0,dma_working:0,amount:0,file_offset:0
[    5.133530] [sw_udc]: irq: reset happen, throw away all urb
[    5.385512] [sw_udc]: Set address 2
[    5.416775] setup:composite_setup...
[    5.420767] setup:USB_REQ_GET_DESCRIPTOR...
[    5.425395] setup:USB_DT_DEVICE...
[    5.429391] setup:composite_setup...
[    5.433366] setup:USB_REQ_GET_DESCRIPTOR...
[    5.437992] setup:USB_DT_CONFIG...
[    5.441757] ERR: dev->driver->setup failed. (-22)
[    5.450428] [sw_udc]: IRQ: suspend
[    5.454288] android_usb gadget: suspend
[    5.459867] android_work: sent uevent USB_STATE=DISCONNECTED
[    5.466307] [sw_udc]: IRQ: reset
[    5.469900] [sw_udc]: (1:star,2:end): vfs_read:0, vfs_write:0,dma_working:0,amount:0,file_offset:0
[    5.479823] [sw_udc]: irq: reset happen, throw away all urb
[    5.650718] setup:composite_setup...
[    5.654709] setup:USB_REQ_GET_DESCRIPTOR...
[    5.659335] setup:USB_DT_DEVICE...
[    5.664451] android_work: sent uevent USB_STATE=CONNECTED
[    5.670606] [sw_udc]: IRQ: reset
[    5.674197] [sw_udc]: (1:star,2:end): vfs_read:0, vfs_write:0,dma_working:0,amount:0,file_offset:0
[    5.684124] [sw_udc]: irq: reset happen, throw away all urb
[    5.931556] [sw_udc]: Set address 2
[    5.962789] setup:composite_setup...
[    5.966776] setup:USB_REQ_GET_DESCRIPTOR...
[    5.971401] setup:USB_DT_DEVICE...
[    5.975446] setup:composite_setup...
[    5.979415] setup:USB_REQ_GET_DESCRIPTOR...
[    5.984038] setup:USB_DT_CONFIG...
[    5.987803] ERR: dev->driver->setup failed. (-22)
[    5.996357] [sw_udc]: IRQ: suspend
[    6.000210] android_usb gadget: suspend
[    6.007656] android_work: sent uevent USB_STATE=DISCONNECTED
[    6.013988] [sw_udc]: IRQ: reset
[    6.017569] [sw_udc]: (1:star,2:end): vfs_read:0, vfs_write:0,dma_working:0,amount:0,file_offset:0
[    6.027485] [sw_udc]: irq: reset happen, throw away all urb
[    6.196734] setup:composite_setup...
[    6.200720] setup:USB_REQ_GET_DESCRIPTOR...
[    6.205347] setup:USB_DT_DEVICE...
[    6.210460] android_work: sent uevent USB_STATE=CONNECTED
[    6.216616] [sw_udc]: IRQ: reset
[    6.220210] [sw_udc]: (1:star,2:end): vfs_read:0, vfs_write:0,dma_working:0,amount:0,file_offset:0
[    6.230139] [sw_udc]: irq: reset happen, throw away all urb
[    6.479538] [sw_udc]: Set address 2
[    6.510814] setup:composite_setup...
[    6.514806] setup:USB_REQ_GET_DESCRIPTOR...
[    6.519434] setup:USB_DT_DEVICE...
[    6.523374] setup:composite_setup...
[    6.527344] setup:USB_REQ_GET_DESCRIPTOR...
[    6.531968] setup:USB_DT_CONFIG...
[    6.535732] ERR: dev->driver->setup failed. (-22)
[    6.544334] [sw_udc]: IRQ: suspend
[    6.548204] android_usb gadget: suspend
[    6.556207] android_work: sent uevent USB_STATE=DISCONNECTED
[   56.085355] [sw_udc]: IRQ: suspend
[   56.089211] android_usb gadget: suspend
[   56.093585] android_work: did not send uevent (0 0   (null))
[   56.212096] [sw_udc]: IRQ: reset
[   56.215707] [sw_udc]: (1:star,2:end): vfs_read:0, vfs_write:0,dma_working:0,amount:0,file_offset:0
[   56.225631] [sw_udc]: irq: reset happen, throw away all urb
[   56.399933] setup:composite_setup...
[   56.403925] setup:USB_REQ_GET_DESCRIPTOR...
[   56.408550] setup:USB_DT_DEVICE...
[   56.413671] android_work: sent uevent USB_STATE=CONNECTED
[   56.419825] [sw_udc]: IRQ: reset
[   56.423419] [sw_udc]: (1:star,2:end): vfs_read:0, vfs_write:0,dma_working:0,amount:0,file_offset:0
[   56.433344] [sw_udc]: irq: reset happen, throw away all urb
[   56.587142] [sw_udc]: Set address 2
[   56.618276] setup:composite_setup...
[   56.622266] setup:USB_REQ_GET_DESCRIPTOR...
[   56.626893] setup:USB_DT_DEVICE...
[   56.630951] setup:composite_setup...
[   56.634920] setup:USB_REQ_GET_DESCRIPTOR...
[   56.639546] setup:USB_DT_CONFIG...
[   56.643310] ERR: dev->driver->setup failed. (-22)
[   56.651872] [sw_udc]: IRQ: suspend
[   56.655744] android_usb gadget: suspend
[   56.663648] android_work: sent uevent USB_STATE=DISCONNECTED
[   56.670091] [sw_udc]: IRQ: reset
[   56.673685] [sw_udc]: (1:star,2:end): vfs_read:0, vfs_write:0,dma_working:0,amount:0,file_offset:0
[   56.683617] [sw_udc]: irq: reset happen, throw away all urb
[   56.854346] setup:composite_setup...
[   56.858333] setup:USB_REQ_GET_DESCRIPTOR...
[   56.862957] setup:USB_DT_DEVICE...
[   56.868123] android_work: sent uevent USB_STATE=CONNECTED
[   56.874172] [sw_udc]: IRQ: reset
[   56.877756] [sw_udc]: (1:star,2:end): vfs_read:0, vfs_write:0,dma_working:0,amount:0,file_offset:0
[   56.887671] [sw_udc]: irq: reset happen, throw away all urb
[   57.135180] [sw_udc]: Set address 2
[   57.167283] setup:composite_setup...
[   57.171272] setup:USB_REQ_GET_DESCRIPTOR...
[   57.175899] setup:USB_DT_DEVICE...
[   57.179866] setup:composite_setup...
[   57.183836] setup:USB_REQ_GET_DESCRIPTOR...
[   57.188463] setup:USB_DT_CONFIG...
[   57.192230] ERR: dev->driver->setup failed. (-22)
[   57.200799] [sw_udc]: IRQ: suspend
[   57.204673] android_usb gadget: suspend
[   57.210283] android_work: sent uevent USB_STATE=DISCONNECTED
[   57.216723] [sw_udc]: IRQ: reset
[   57.220316] [sw_udc]: (1:star,2:end): vfs_read:0, vfs_write:0,dma_working:0,amount:0,file_offset:0
[   57.230237] [sw_udc]: irq: reset happen, throw away all urb
[   57.383134] setup:composite_setup...
[   57.387121] setup:USB_REQ_GET_DESCRIPTOR...
[   57.391748] setup:USB_DT_DEVICE...
[   57.396872] android_work: sent uevent USB_STATE=CONNECTED
[   57.402920] [sw_udc]: IRQ: reset
[   57.406504] [sw_udc]: (1:star,2:end): vfs_read:0, vfs_write:0,dma_working:0,amount:0,file_offset:0
[   57.416423] [sw_udc]: irq: reset happen, throw away all urb
[   57.663898] [sw_udc]: Set address 2
[   57.695184] setup:composite_setup...
[   57.699172] setup:USB_REQ_GET_DESCRIPTOR...
[   57.703799] setup:USB_DT_DEVICE...
[   57.707813] setup:composite_setup...
[   57.711788] setup:USB_REQ_GET_DESCRIPTOR...
[   57.716418] setup:USB_DT_CONFIG...
[   57.720186] ERR: dev->driver->setup failed. (-22)
[   57.728738] [sw_udc]: IRQ: suspend
[   57.732601] android_usb gadget: suspend
[   57.738187] android_work: sent uevent USB_STATE=DISCONNECTED
[   57.744526] [sw_udc]: IRQ: reset
[   57.748110] [sw_udc]: (1:star,2:end): vfs_read:0, vfs_write:0,dma_working:0,amount:0,file_offset:0
[   57.758029] [sw_udc]: irq: reset happen, throw away all urb
[   57.929139] setup:composite_setup...
[   57.933131] setup:USB_REQ_GET_DESCRIPTOR...
[   57.937759] setup:USB_DT_DEVICE...
[   57.943035] android_work: sent uevent USB_STATE=CONNECTED
[   57.949204] [sw_udc]: IRQ: reset
[   57.952799] [sw_udc]: (1:star,2:end): vfs_read:0, vfs_write:0,dma_working:0,amount:0,file_offset:0
[   57.962722] [sw_udc]: irq: reset happen, throw away all urb
[   58.209903] [sw_udc]: Set address 2
[   58.241124] setup:composite_setup...
[   58.245113] setup:USB_REQ_GET_DESCRIPTOR...
[   58.249739] setup:USB_DT_DEVICE...
[   58.253775] setup:composite_setup...
[   58.257746] setup:USB_REQ_GET_DESCRIPTOR...
[   58.262371] setup:USB_DT_CONFIG...
[   58.266137] ERR: dev->driver->setup failed. (-22)
[   58.274701] [sw_udc]: IRQ: suspend
[   58.278566] android_usb gadget: suspend
[   58.284138] android_work: sent uevent USB_STATE=DISCONNECTED

gadget 选择 adb, 电脑出现一个 "Unknow Device", 无法识别的设备.

[   57.396872] android_work: sent uevent USB_STATE=CONNECTED
[   57.402920] [sw_udc]: IRQ: reset
[   57.406504] [sw_udc]: (1:star,2:end): vfs_read:0, vfs_write:0,dma_working:0,amount:0,file_offset:0
[   57.416423] [sw_udc]: irq: reset happen, throw away all urb
[   57.663898] [sw_udc]: Set address 2
[   57.695184] setup:composite_setup...
[   57.699172] setup:USB_REQ_GET_DESCRIPTOR...
[   57.703799] setup:USB_DT_DEVICE...
[   57.707813] setup:composite_setup...
[   57.711788] setup:USB_REQ_GET_DESCRIPTOR...
[   57.716418] setup:USB_DT_CONFIG...
[   57.720186] ERR: dev->driver->setup failed. (-22)
[   57.728738] [sw_udc]: IRQ: suspend

离线

#41 2018-09-22 17:37:14

晕哥
Administrator
注册时间: 2017-09-06
累计积分: 8,528

Re: f1c100s USB otg device 模式可以用吗?

QQ20180922174301.png

直接编译到内核, 模块方式暂时不行,问题未知。



QQ20180922173703.png

Ubuntu Linux 跑 RIDIS 基本正常。

QQ20180922174606.png

Win7 枚举正常,得找个驱动装装.

离线

#42 2018-09-22 19:01:27

ippen
会员
注册时间: 2018-07-22
累计积分: 275

Re: f1c100s USB otg device 模式可以用吗?

赞助晕哥一个rndis驱动

https://whycan.cn/files/members/1028/RNDIS.rar

离线

#43 2018-09-22 19:25:28

晕哥
Administrator
注册时间: 2017-09-06
累计积分: 8,528

Re: f1c100s USB otg device 模式可以用吗?

ippen 说:

谢谢,一会我试一试。

离线

#44 2018-09-22 22:25:12

晕哥
Administrator
注册时间: 2017-09-06
累计积分: 8,528

Re: f1c100s USB otg device 模式可以用吗?

QQ20180922222312.png

装上了楼上朋友的驱动程序,果然设备无法启动,代码10.

放狗搜了一圈

https://social.technet.microsoft.com/Forums/lync/en-US/04195a63-4c57-4881-a17f-47b823452849/rndis-over-usb-device-works-on-some-installs-of-windows-10-but-not-others-?forum=win10itprohardware

权威答案:

我终于想通了。

由于响应时间的原因,设备未能成功完成某些信息的枚举。IE usb设备在枚举期间没有响应足够的时间。

一旦我修复了这个问题,我就能成功运行设备而不会出现ErrorCode 10问题。

看来得改gadget驱动了。

离线

#45 2018-09-23 00:16:57

ippen
会员
注册时间: 2018-07-22
累计积分: 275

Re: f1c100s USB otg device 模式可以用吗?

晕哥 说:

https://whycan.cn/files/members/3/QQ20180922222312.png

装上了楼上朋友的驱动程序,果然设备无法启动,代码10.

放狗搜了一圈

https://social.technet.microsoft.com/Forums/lync/en-US/04195a63-4c57-4881-a17f-47b823452849/rndis-over-usb-device-works-on-some-installs-of-windows-10-but-not-others-?forum=win10itprohardware

权威答案:

我终于想通了。

由于响应时间的原因,设备未能成功完成某些信息的枚举。IE usb设备在枚举期间没有响应足够的时间。

一旦我修复了这个问题,我就能成功运行设备而不会出现ErrorCode 10问题。

看来得改gadget驱动了。

我的驱动,用licheepi zero+linux-4.13.0的内核是可以正常使用的,看来3.10这个版本还是有不少坑

离线

#46 2018-09-23 00:19:22

ippen
会员
注册时间: 2018-07-22
累计积分: 275

Re: f1c100s USB otg device 模式可以用吗?

我现在测试的情况更悲剧,我要用mass_storage,按上面 @szyusong 大师的方法该了代码和配置,usb插入pc后,仍然毫无反应。
用g_serial就有反应,看样子cdc驱动是可以的,但mass_storage就不行了

离线

#47 2018-09-23 06:47:14

晕哥
Administrator
注册时间: 2017-09-06
累计积分: 8,528

Re: f1c100s USB otg device 模式可以用吗?

linux 3.10 是LTS长支持版本,如果是gadget驱动引起,应该可以打上补丁包解决这个问题。

离线

#48 2018-09-23 10:10:30

szyusong
会员
所在地: 深圳
注册时间: 2018-09-08
累计积分: 35

Re: f1c100s USB otg device 模式可以用吗?

晕哥 说:

https://whycan.cn/files/members/3/QQ20180922222312.png

装上了楼上朋友的驱动程序,果然设备无法启动,代码10.

放狗搜了一圈

https://social.technet.microsoft.com/Forums/lync/en-US/04195a63-4c57-4881-a17f-47b823452849/rndis-over-usb-device-works-on-some-installs-of-windows-10-but-not-others-?forum=win10itprohardware

权威答案:

我终于想通了。

由于响应时间的原因,设备未能成功完成某些信息的枚举。IE usb设备在枚举期间没有响应足够的时间。

一旦我修复了这个问题,我就能成功运行设备而不会出现ErrorCode 10问题。

看来得改gadget驱动了。

在 Windows 下可以使用 Bus Hound 抓包分析,我前面的帖子有写抓包的内容,问题出在中断节点 0x84 无法传输数据造成的。Windows下 RNDIS 驱动需要通过中断节点获取 device 的网卡状态变化及数据是否就绪等信息,因此中断节点无法通讯,RNDIS 就无法使用。而 RNDIS 在 Linux 下使用时,好像不会用到中断节点,所以没问题。

离线

#49 2018-09-23 10:12:36

szyusong
会员
所在地: 深圳
注册时间: 2018-09-08
累计积分: 35

Re: f1c100s USB otg device 模式可以用吗?

ippen 说:

我的驱动,用licheepi zero+linux-4.13.0的内核是可以正常使用的,看来3.10这个版本还是有不少坑

能否提供一个用于荔枝派nano的固件(包括dtb),我对比一下。

离线

#50 2018-09-23 10:15:27

szyusong
会员
所在地: 深圳
注册时间: 2018-09-08
累计积分: 35

Re: f1c100s USB otg device 模式可以用吗?

@晕哥 咱们论坛帖子被回复,不会发邮件提醒的吗?

离线

#51 2018-09-23 10:16:51

晕哥
Administrator
注册时间: 2017-09-06
累计积分: 8,528

Re: f1c100s USB otg device 模式可以用吗?

szyusong 说:
ippen 说:

我的驱动,用licheepi zero+linux-4.13.0的内核是可以正常使用的,看来3.10这个版本还是有不少坑

能否提供一个用于荔枝派nano的固件(包括dtb),我对比一下。

有一位网友搞定了licheepi nano 4.19 usb otg,但是我照着他的没搞定,晚点上传文件。

离线

#52 2018-09-23 10:18:24

szyusong
会员
所在地: 深圳
注册时间: 2018-09-08
累计积分: 35

Re: f1c100s USB otg device 模式可以用吗?

晕哥 说:

https://whycan.cn/files/members/3/QQ20180922174301.png

直接编译到内核, 模块方式暂时不行,问题未知。



https://whycan.cn/files/members/3/QQ20180922173703.png

Ubuntu Linux 跑 RIDIS 基本正常。

https://whycan.cn/files/members/3/QQ20180922174606.png

Win7 枚举正常,得找个驱动装装.

在 windows 下安装 RNDIS 驱动只需要用 kernel 目录下的 Documentation/usb/linux.inf 手动安装就可以。

离线

#53 2018-09-23 10:18:29

晕哥
Administrator
注册时间: 2017-09-06
累计积分: 8,528

Re: f1c100s USB otg device 模式可以用吗?

szyusong 说:

@晕哥 咱们论坛帖子被回复,不会发邮件提醒的吗?

抱歉,现在还没有这个功能,不过已经在todo list里面了。

离线

#54 2018-09-23 10:20:00

szyusong
会员
所在地: 深圳
注册时间: 2018-09-08
累计积分: 35

Re: f1c100s USB otg device 模式可以用吗?

晕哥 说:
szyusong 说:
ippen 说:

我的驱动,用licheepi zero+linux-4.13.0的内核是可以正常使用的,看来3.10这个版本还是有不少坑

能否提供一个用于荔枝派nano的固件(包括dtb),我对比一下。

有一位网友搞定了licheepi nano 4.19 usb otg,但是我照着他的没搞定,晚点上传文件。

能否把相关链接发一下,大家一起努力,一鼓作气搞定这个问题。

最近编辑记录 szyusong (2018-09-23 10:21:05)

离线

#55 2018-09-23 10:27:50

晕哥
Administrator
注册时间: 2017-09-06
累计积分: 8,528

Re: f1c100s USB otg device 模式可以用吗?

有的,现在在外面,一会回家上传。

离线

#56 2018-09-23 13:14:30

晕哥
Administrator
注册时间: 2017-09-06
累计积分: 8,528

Re: f1c100s USB otg device 模式可以用吗?

https://whycan.cn/t_1672.html

已经上传好了!

离线

#57 2018-09-23 14:00:46

ippen
会员
注册时间: 2018-07-22
累计积分: 275

Re: f1c100s USB otg device 模式可以用吗?

果然足够蛋疼
明显是sunxi的udc驱动问题
我在本贴的24楼曾经发过疑问,加载驱动的顺序问题,结果在usb_manager.c里面找到一段代码

static int usb_hardware_scan_thread(void * pArg)
{
        struct usb_cfg *cfg = pArg;

        /* delay for udc & hcd ready */

        msleep(3000);

        while(thread_run_flag) {
                msleep(1000);  /* 1s */

                if (atomic_read(&thread_suspend_flag))
                        continue;
                usb_hw_scan(cfg);
                usb_msg_center(cfg);
        }

        thread_stopped_flag = 1;
        return 0;
}

里面先是延时3秒,然后循环里面又延时一秒,所以g_mass_storage初始化的时候,usb还没完成初始化

我在msg_init里面插入一个4.5秒延时,结果usb插入pc有反应了

最近编辑记录 ippen (2018-09-23 14:01:36)

离线

#58 2018-09-23 14:06:40

ippen
会员
注册时间: 2018-07-22
累计积分: 275

Re: f1c100s USB otg device 模式可以用吗?

szyusong 说:
ippen 说:

我的驱动,用licheepi zero+linux-4.13.0的内核是可以正常使用的,看来3.10这个版本还是有不少坑

能否提供一个用于荔枝派nano的固件(包括dtb),我对比一下。

nano我也没搞定,zero 用的是主线内核,所以没问题,如果你有zero的板子,可以下载主线内核测试,比较简单,选好参数就可以,没有任何特殊设置和代码改动

离线

#59 2018-09-24 10:55:39

szyusong
会员
所在地: 深圳
注册时间: 2018-09-08
累计积分: 35

Re: f1c100s USB otg device 模式可以用吗?

晕哥 说:

我试了下,直接把 RNDIS 编译进内核,没反应,而且 USB ID 的管脚配置有问题。有能跑起来的启动 log 吗?

[    0.506832] sun4i-usb-phy 1c13400.phy: Couldn't request ID GPIO
Starting kernel ...

[    0.000000] Booting Linux on physical CPU 0x0
[    0.000000] Linux version 4.19.0-rc3-licheepi-nano+ (root@debian) (gcc version 4.8.3 20140320 (prerelease) (Sourcery CodeBench Lite 2014.05-29)) #5 PREEMPT Mon Sep 24 10:49:35 CST 2018
[    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: Lichee Pi Nano
[    0.000000] bootconsole [earlycon0] enabled
[    0.000000] Memory policy: Data cache writeback
[    0.000000] random: get_random_bytes called from start_kernel+0x74/0x398 with crng_init=0
[    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 8128
[    0.000000] Kernel command line: earlyprintk panic=5 rootwait root=/dev/mtdblock3 ro rootfstype=squashfs init=/linuxrc console=ttyS0,115200
[    0.000000] Dentry cache hash table entries: 4096 (order: 2, 16384 bytes)
[    0.000000] Inode-cache hash table entries: 2048 (order: 1, 8192 bytes)
[    0.000000] Memory: 23720K/32768K available (5120K kernel code, 234K rwdata, 1140K rodata, 1024K init, 228K bss, 9048K reserved, 0K 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 : 0xc2800000 - 0xff800000   ( 976 MB)
[    0.000000]     lowmem  : 0xc0000000 - 0xc2000000   (  32 MB)
[    0.000000]     pkmap   : 0xbfe00000 - 0xc0000000   (   2 MB)
[    0.000000]     modules : 0xbf000000 - 0xbfe00000   (  14 MB)
[    0.000000]       .text : 0x(ptrval) - 0x(ptrval)   (6112 kB)
[    0.000000]       .init : 0x(ptrval) - 0x(ptrval)   (1024 kB)
[    0.000000]       .data : 0x(ptrval) - 0x(ptrval)   ( 235 kB)
[    0.000000]        .bss : 0x(ptrval) - 0x(ptrval)   ( 229 kB)
[    0.000000] SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[    0.000000] rcu: Preemptible hierarchical RCU implementation.
[    0.000000] rcu:     RCU event tracing is enabled.
[    0.000000]  Tasks RCU enabled.
[    0.000000] NR_IRQS: 16, nr_irqs: 16, preallocated irqs: 16
[    0.000050] sched_clock: 32 bits at 24MHz, resolution 41ns, wraps every 89478484971ns
[    0.007933] clocksource: timer: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 79635851949 ns
[    0.017557] Console: colour dummy device 80x30
[    0.022078] Calibrating delay loop... 203.16 BogoMIPS (lpj=1015808)
[    0.093397] pid_max: default: 32768 minimum: 301
[    0.098475] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.105101] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.113813] CPU: Testing write buffer coherency: ok
[    0.121409] Setting up static identity map for 0x80100000 - 0x80100058
[    0.128605] rcu: Hierarchical SRCU implementation.
[    0.139974] devtmpfs: initialized
[    0.151257] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[    0.161302] futex hash table entries: 256 (order: -1, 3072 bytes)
[    0.167887] pinctrl core: initialized pinctrl subsystem
[    0.175548] NET: Registered protocol family 16
[    0.181625] DMA: preallocated 256 KiB pool for atomic coherent allocations
[    0.191348] cpuidle: using governor menu
[    0.225657] SCSI subsystem initialized
[    0.230158] usbcore: registered new interface driver usbfs
[    0.235795] usbcore: registered new interface driver hub
[    0.241715] usbcore: registered new device driver usb
[    0.247324] pps_core: LinuxPPS API ver. 1 registered
[    0.252300] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <giometti@linux.it>
[    0.261550] PTP clock support registered
[    0.266004] Advanced Linux Sound Architecture Driver Initialized.
[    0.274002] clocksource: Switched to clocksource timer
[    0.311030] NET: Registered protocol family 2
[    0.317236] tcp_listen_portaddr_hash hash table entries: 512 (order: 0, 4096 bytes)
[    0.325189] TCP established hash table entries: 1024 (order: 0, 4096 bytes)
[    0.332191] TCP bind hash table entries: 1024 (order: 0, 4096 bytes)
[    0.338750] TCP: Hash tables configured (established 1024 bind 1024)
[    0.345552] UDP hash table entries: 256 (order: 0, 4096 bytes)
[    0.351429] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
[    0.358371] NET: Registered protocol family 1
[    0.364406] RPC: Registered named UNIX socket transport module.
[    0.370341] RPC: Registered udp transport module.
[    0.375284] RPC: Registered tcp transport module.
[    0.379995] RPC: Registered tcp NFSv4.1 backchannel transport module.
[    0.387256] NetWinder Floating Point Emulator V0.97 (double precision)
[    0.396059] Initialise system trusted keyrings
[    0.401103] workingset: timestamp_bits=30 max_order=13 bucket_order=0
[    0.425517] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[    0.433956] NFS: Registering the id_resolver key type
[    0.439362] Key type id_resolver registered
[    0.443551] Key type id_legacy registered
[    0.464358] Key type asymmetric registered
[    0.468480] Asymmetric key parser 'x509' registered
[    0.473517] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 251)
[    0.481509] io scheduler noop registered
[    0.485935] io scheduler deadline registered
[    0.490768] io scheduler cfq registered (default)
[    0.495851] io scheduler mq-deadline registered
[    0.500396] io scheduler kyber registered
[    0.506832] sun4i-usb-phy 1c13400.phy: Couldn't request ID GPIO
[    0.524384] suniv-pinctrl 1c20800.pinctrl: initialized sunXi PIO driver
[    0.732377] Serial: 8250/16550 driver, 8 ports, IRQ sharing disabled
[    0.746641] console [ttyS0] disabled
[    0.770638] 1c25000.serial: ttyS0 at MMIO 0x1c25000 (irq = 23, base_baud = 6250000) is a 16550A
[    0.779681] console [ttyS0] enabled
[    0.779681] console [ttyS0] enabled
[    0.786848] bootconsole [earlycon0] disabled
[    0.786848] bootconsole [earlycon0] disabled
[    0.797944] SCSI Media Changer driver v0.25 
[    0.805953] m25p80 spi0.0: w25q128 (16384 Kbytes)
[    0.811995] 4 fixed-partitions partitions found on MTD device spi0.0
[    0.818607] Creating 4 MTD partitions on "spi0.0":
[    0.823431] 0x000000000000-0x000000100000 : "uboot"
[    0.831528] 0x000000100000-0x000000480000 : "kernel"
[    0.839682] 0x000000480000-0x000000530000 : "dtb"
[    0.847557] 0x000000500000-0x000001000000 : "rootfs"
[    0.857075] udc-core: couldn't find an available UDC - added [g_ether] to list of pending drivers
[    0.866498] i2c /dev entries driver
[    0.872250] sunxi-mmc 1c0f000.mmc: Linked as a consumer to regulator.1
[    0.906091] sunxi-mmc 1c0f000.mmc: initialized, max. request size: 16384 KB
[    0.931364] NET: Registered protocol family 17
[    0.936375] Key type dns_resolver registered
[    0.943810] Loading compiled-in X.509 certificates
[    0.963233] usb_phy_generic usb_phy_generic.0.auto: usb_phy_generic.0.auto supply vcc not found, using dummy regulator
[    0.974513] usb_phy_generic usb_phy_generic.0.auto: Linked as a consumer to regulator.0
[    0.983491] musb-hdrc musb-hdrc.1.auto: MUSB HDRC host driver
[    0.989560] musb-hdrc musb-hdrc.1.auto: new USB bus registered, assigned bus number 1
[    0.999757] hub 1-0:1.0: USB hub found
[    1.003690] hub 1-0:1.0: 1 port detected
[    1.009619] using random self ethernet address
[    1.014371] using random host ethernet address
[    1.020262] usb0: HOST MAC 5e:08:52:bd:42:4c
[    1.024960] usb0: MAC 06:22:55:2a:02:e8
[    1.028905] using random self ethernet address
[    1.033358] using random host ethernet address
[    1.038399] g_ether gadget: Ethernet Gadget, version: Memorial Day 2008
[    1.045240] g_ether gadget: g_ether ready
[    1.050481] vcc3v3: disabling
[    1.053487] ALSA device list:
[    1.057361]   #0: Loopback 1
[    1.068149] random: fast init done
[    1.073073] VFS: Mounted root (squashfs filesystem) readonly on device 31:3.
[    1.085353] devtmpfs: mounted
[    1.092613] Freeing unused kernel memory: 1024K
[    1.097333] Run /linuxrc as init process
[    1.481138] random: crng init done
Starting logging: OK
read-only file system detected...done
Starting network: OK

Welcome to Buildroot
buildroot login: 

离线

#60 2018-09-24 13:16:08

晕哥
Administrator
注册时间: 2017-09-06
累计积分: 8,528

Re: f1c100s USB otg device 模式可以用吗?

这情况和我的一样, 我已经给 @chong QQ发信息了,晚点应该会看到.

离线

#61 2018-09-24 21:37:22

szyusong
会员
所在地: 深圳
注册时间: 2018-09-08
累计积分: 35

Re: f1c100s USB otg device 模式可以用吗?

3.10 内核可枚举的寄存器配置,在 sunxi_udc_irq 中调用 print_usb_reg_by_ep 打印出来的:

		if (dev->gadget.speed == USB_SPEED_UNKNOWN) {

			print_usb_reg_by_ep(NULL, g_sunxi_udc_io.usb_vbase, 0, "");
			
			if (USBC_Dev_QueryTransferMode(g_sunxi_udc_io.usb_bsp_hdle) == USBC_TS_MODE_HS) {
				dev->gadget.speed = USB_SPEED_HIGH;

				DMSG_INFO_UDC("\n+++++++++++++++++++++++++++++++++++++\n");
				DMSG_INFO_UDC(" usb enter high speed.\n");
				DMSG_INFO_UDC("\n+++++++++++++++++++++++++++++++++++++\n");
			} else {
				dev->gadget.speed= USB_SPEED_FULL;

				DMSG_INFO_UDC("\n+++++++++++++++++++++++++++++++++++++\n");
				DMSG_INFO_UDC(" usb enter full speed.\n");
				DMSG_INFO_UDC("\n+++++++++++++++++++++++++++++++++++++\n");
			}
		}
[    6.795614] --------------------------ep0: --------------------------
[    6.802792] old_ep_index = 0, ep_index = 0
[    6.807357] USBC_REG_o_FADDR         = 0x0
[    6.811921] USBC_REG_o_PCTL          = 0x70
[    6.816570] USBC_REG_o_INTTx         = 0x0
[    6.821115] USBC_REG_o_INTRx         = 0x0
[    6.825678] USBC_REG_o_INTTxE        = 0x1
[    6.830234] USBC_REG_o_INTRxE        = 0x0
[    6.834792] USBC_REG_o_INTUSB        = 0x8
[    6.839344] USBC_REG_o_INTUSBE       = 0x7
[    6.843890] USBC_REG_o_EPIND         = 0x0
[    6.848450] USBC_REG_o_TXMAXP        = 0x0
[    6.853006] USBC_REG_o_CSR0          = 0x1
[    6.857565] USBC_REG_o_TXCSR         = 0x1
[    6.862129] USBC_REG_o_RXMAXP        = 0x0
[    6.866704] USBC_REG_o_RXCSR         = 0x0
[    6.871267] USBC_REG_o_COUNT0        = 0x8
[    6.875831] USBC_REG_o_RXCOUNT       = 0x8
[    6.880398] USBC_REG_o_TXTYPE        = 0x0
[    6.884962] USBC_REG_o_NAKLIMIT0     = 0x0
[    6.889527] USBC_REG_o_TXINTERVAL    = 0x0
[    6.894089] USBC_REG_o_RXTYPE        = 0x0
[    6.898648] USBC_REG_o_RXINTERVAL    = 0x0
[    6.903210] USBC_REG_o_CONFIGDATA    = 0xde
[    6.907868] USBC_REG_o_DEVCTL        = 0x99
[    6.912530] USBC_REG_o_TXFIFOSZ      = 0x0
[    6.917083] USBC_REG_o_RXFIFOSZ      = 0x0
[    6.921628] USBC_REG_o_TXFIFOAD      = 0x0
[    6.926191] USBC_REG_o_RXFIFOAD      = 0x0
[    6.930752] USBC_REG_o_VEND0         = 0x0
[    6.935309] USBC_REG_o_VEND1         = 0x0
[    6.939871] TXFADDRx(0)             = 0x0
[    6.944348] TXHADDRx(0              = 0x0
[    6.948820] TXHPORTx(0)             = 0x0
[    6.953285] RXFADDRx(0)             = 0x0
[    6.957753] RXHADDRx(0)             = 0x0
[    6.962207] RXHPORTx(0)             = 0x0
[    6.966679] RPCOUNTx(0)             = 0x0
[    6.971160] USBC_REG_o_ISCR          = 0x5303f000
[    6.976402] USBC_REG_o_PHYCTL        = 0x12b80
[    6.981345] USBC_REG_o_PHYBIST       = 0x0
[    6.985911] ---------------------------------------------------------------------------

4.19-rc3 内核的不能枚举的寄存器配置:

# mount -t debugfs none /sys/kernel/debug/
# cat /sys/kernel/debug/musb-hdrc.1.auto/regdump 
[   28.586763] musb-sunxi 1c13000.usb: Error unknown readw offset 0x0
[   28.593011] musb-sunxi 1c13000.usb: Error unknown readw offset 0x69
[   28.600874] musb-sunxi 1c13000.usb: Error unknown readb offset 0x7a
[   28.608273] musb-sunxi 1c13000.usb: Error unknown readb offset 0x7b
[   28.615653] musb-sunxi 1c13000.usb: Error unknown readb offset 0x7c
[   28.621949] musb-sunxi 1c13000.usb: Error unknown readb offset 0x7d
[   28.629593] musb-sunxi 1c13000.usb: Error unknown readb offset 0x7e
[   28.636881] musb-sunxi 1c13000.usb: Error unknown readb offset 0x7f
[   28.643177] musb-sunxi 1c13000.usb: Error unknown readw offset 0x204
[   28.650830] musb-sunxi 1c13000.usb: Error unknown readw offset 0x214
[   28.658210] musb-sunxi 1c13000.usb: Error unknown readw offset 0x224
[   28.665595] musb-sunxi 1c13000.usb: Error unknown readw offset 0x234
[   28.671985] musb-sunxi 1c13000.usb: Error unknown readw offset 0x244
[   28.679637] musb-sunxi 1c13000.usb: Error unknown readw offset 0x254
[   28.687019] musb-sunxi 1c13000.usb: Error unknown readw offset 0x264
[   28.693412] musb-sunxi 1c13000.usb: Error unknown readw offset 0x274
[   28.701066] musb-sunxi 1c13000.usb: Error unknown readb offset 0x61
[   28.708375] musb-sunxi 1c13000.usb: Error unknown readb offset 0x78
[   28.715660] musb-sunxi 1c13000.usb: Error unknown readb offset 0x79
MUSB (M)HDRC Register Dump
FAddr       : 00
Power       : e0
Frame       : 0000
Index       : 05
Testmode    : 00
TxMaxPp     : 0000
TxCSRp      : 0000
RxMaxPp     : 0000
RxCSR       : 000f
RxCount     : 000e
IntrRxE     : 000e
IntrTxE     : 000f
IntrUsbE    : f7
DevCtl      : 81
VControl    : 00000000
HWVers      : 0000
LinkInfo    : 00
VPLen       : 00
HS_EOF1     : 00
FS_EOF1     : 00
LS_EOF1     : 00
SOFT_RST    : 00
DMA_CNTLch0 : 0000
DMA_ADDRch0 : 00000000
DMA_COUNTch0: 00000000
DMA_CNTLch1 : 0000
DMA_ADDRch1 : 00000000
DMA_COUNTch1: 00000000
DMA_CNTLch2 : 0000
DMA_ADDRch2 : 00000000
DMA_COUNTch2: 00000000
DMA_CNTLch3 : 0000
DMA_ADDRch3 : 00000000
DMA_COUNTch3: 00000000
DMA_CNTLch4 : 0000
DMA_ADDRch4 : 00000000
DMA_COUNTch4: 00000000
DMA_CNTLch5 : 0000
DMA_ADDRch5 : 00000000
DMA_COUNTch5: 00000000
DMA_CNTLch6 : 0000
DMA_ADDRch6 : 00000000
DMA_COUNTch6: 00000000
DMA_CNTLch7 : 0000
DMA_ADDRch7 : 00000000
DMA_COUNTch7: 00000000
ConfigData  : 00
BabbleCtl   : 00
TxFIFOsz    : 00
RxFIFOsz    : 00
TxFIFOadd   : 0000
RxFIFOadd   : 0000
EPInfo      : 00
RAMInfo     : 00
ISCR        : 5303f000
PHYCTL      : 00012b80
PHYBIST     : 00000000

几个主要的寄存器的值都差不多,但是不能枚举,不知道问题出在哪儿。

离线

#62 2018-09-24 23:04:29

szyusong
会员
所在地: 深圳
注册时间: 2018-09-08
累计积分: 35

Re: f1c100s USB otg device 模式可以用吗?

3.10 内核的 RNDIS 搞定了。

f1c100s 的手册中关于 USB 有这样的说明:
Supports up to 3 User-Configurable Endpoints for Bulk , Isochronous, Control and Interrupt
bi-directional transfers (Endpoint1, Endpoint2)
支持 INT 传输的只有 EP1 和 EP2,目前代码采用的是 EP4,是无法工作的。

按如下修改后,在 Windows 下 RNDIS 没问题了。

static const char ep0name [] = "ep0";
static const char ep1in_bulk_name []  = "ep1in-bulk";
static const char ep1out_bulk_name [] = "ep1out-bulk";
#if 1
static const char ep2in_bulk_name []  = "ep2-int"; // 作为 INT 节点,为了 usb_ep_autoconfig 能查询到
#else
static const char ep2in_bulk_name []  = "ep2in-bulk";
#endif
static const char ep2out_bulk_name [] = "ep2out-bulk";
static const char ep3_iso_name []     = "ep3-iso";
static const char ep4_int_name []     = "ep4-int";
static const char ep5in_bulk_name []  = "ep5in-bulk";
static const char ep5out_bulk_name [] = "ep5out-bulk";
	.ep[3] = {
		.num			= 2,
		.ep = {
			.name		= ep2in_bulk_name,
			.ops		= &sunxi_udc_ep_ops,
			.maxpacket	= SW_UDC_EP_FIFO_SIZE,
		},
		.dev		        = &sunxi_udc,
		//.fifo_size	        = SW_UDC_EP_FIFO_SIZE,
		.bEndpointAddress   = (USB_DIR_IN | 2),
#if 1
		.bmAttributes	    = USB_ENDPOINT_XFER_INT,
#else
		.bmAttributes	    = USB_ENDPOINT_XFER_BULK,
#endif

离线

#63 2018-09-24 23:16:56

路人甲
会员
注册时间: 2017-09-07
累计积分: 59

Re: f1c100s USB otg device 模式可以用吗?

厉害厉害,改天我也试一试。

离线

#64 2018-09-25 08:45:12

晕哥
Administrator
注册时间: 2017-09-06
累计积分: 8,528

Re: f1c100s USB otg device 模式可以用吗?

在 windows 下安装 RNDIS 驱动只需要用 kernel 目录下的 Documentation/usb/linux.inf 手动安装就可以。

QQ20180925084237.png

按 @szyusong 大神 62#的修改, 装上 52# 的驱动, 看起来终于正常了!
接下来配个ip通讯试一试.

离线

#65 2018-09-25 08:59:30

晕哥
Administrator
注册时间: 2017-09-06
累计积分: 8,528

Re: f1c100s USB otg device 模式可以用吗?

QQ20180925085609.png

Windows RNDIS 工作看起来正常了, 再次感谢 @szyusong !

离线

#66 2018-09-25 09:12:31

晕哥
Administrator
注册时间: 2017-09-06
累计积分: 8,528

Re: f1c100s USB otg device 模式可以用吗?

现在我这里还有一个问题, 请教 @szyusong, USB只能工作在 device 模式才能驱动 RNDIS, 而选择 OTG的时候, 插入电脑或者U盘都是没反应的, 这个问题应该如何解决呢?

离线

#67 2018-09-25 12:37:37

ippen
会员
注册时间: 2018-07-22
累计积分: 275

Re: f1c100s USB otg device 模式可以用吗?

szyusong 说:

3.10 内核的 RNDIS 搞定了。

f1c100s 的手册中关于 USB 有这样的说明:
Supports up to 3 User-Configurable Endpoints for Bulk , Isochronous, Control and Interrupt
bi-directional transfers (Endpoint1, Endpoint2)
支持 INT 传输的只有 EP1 和 EP2,目前代码采用的是 EP4,是无法工作的。

按如下修改后,在 Windows 下 RNDIS 没问题了。

static const char ep0name [] = "ep0";
static const char ep1in_bulk_name []  = "ep1in-bulk";
static const char ep1out_bulk_name [] = "ep1out-bulk";
#if 1
static const char ep2in_bulk_name []  = "ep2-int"; // 作为 INT 节点,为了 usb_ep_autoconfig 能查询到
#else
static const char ep2in_bulk_name []  = "ep2in-bulk";
#endif
static const char ep2out_bulk_name [] = "ep2out-bulk";
static const char ep3_iso_name []     = "ep3-iso";
static const char ep4_int_name []     = "ep4-int";
static const char ep5in_bulk_name []  = "ep5in-bulk";
static const char ep5out_bulk_name [] = "ep5out-bulk";
	.ep[3] = {
		.num			= 2,
		.ep = {
			.name		= ep2in_bulk_name,
			.ops		= &sunxi_udc_ep_ops,
			.maxpacket	= SW_UDC_EP_FIFO_SIZE,
		},
		.dev		        = &sunxi_udc,
		//.fifo_size	        = SW_UDC_EP_FIFO_SIZE,
		.bEndpointAddress   = (USB_DIR_IN | 2),
#if 1
		.bmAttributes	    = USB_ENDPOINT_XFER_INT,
#else
		.bmAttributes	    = USB_ENDPOINT_XFER_BULK,
#endif

厉害!!!
昨天我测试的时候,看到数据传输有停顿的情况,抓包看,两次传输数据有时间隔20秒,一直怀疑是中断问题,因为每次传数据都有irq reset,正发毛...........

离线

#68 2018-09-25 12:40:13

ippen
会员
注册时间: 2018-07-22
累计积分: 275

Re: f1c100s USB otg device 模式可以用吗?

晕哥 说:

现在我这里还有一个问题, 请教 @szyusong, USB只能工作在 device 模式才能驱动 RNDIS, 而选择 OTG的时候, 插入电脑或者U盘都是没反应的, 这个问题应该如何解决呢?

感觉也是中断引起的,单独device或者单独host都正常,就是otg状态,只能识别device,不能识别host

离线

#69 2018-09-25 12:42:57

晕哥
Administrator
注册时间: 2017-09-06
累计积分: 8,528

Re: f1c100s USB otg device 模式可以用吗?

ippen 说:
晕哥 说:

现在我这里还有一个问题, 请教 @szyusong, USB只能工作在 device 模式才能驱动 RNDIS, 而选择 OTG的时候, 插入电脑或者U盘都是没反应的, 这个问题应该如何解决呢?

感觉也是中断引起的,单独device或者单独host都正常,就是otg状态,只能识别device,不能识别host

我的配置成otg,无论device还是host都无法识别。

离线

#70 2018-09-25 13:17:23

szyusong
会员
所在地: 深圳
注册时间: 2018-09-08
累计积分: 35

Re: f1c100s USB otg device 模式可以用吗?

晕哥 说:

现在我这里还有一个问题, 请教 @szyusong, USB只能工作在 device 模式才能驱动 RNDIS, 而选择 OTG的时候, 插入电脑或者U盘都是没反应的, 这个问题应该如何解决呢?

我手头的板子没法测试,得确保 usb_id_gpio, usb_det_vbus_gpio, usb_drv_vbus_gpio 这几个都有有效的管脚相对应。

离线

#71 2018-09-25 14:27:16

晕哥
Administrator
注册时间: 2017-09-06
累计积分: 8,528

Re: f1c100s USB otg device 模式可以用吗?

szyusong 说:
晕哥 说:

现在我这里还有一个问题, 请教 @szyusong, USB只能工作在 device 模式才能驱动 RNDIS, 而选择 OTG的时候, 插入电脑或者U盘都是没反应的, 这个问题应该如何解决呢?

我手头的板子没法测试,得确保 usb_id_gpio, usb_det_vbus_gpio, usb_drv_vbus_gpio 这几个都有有效的管脚相对应。

这个是 olimex 在 github A10-OLinuXino-Lime_Rev_A.pdf 原理图, 上面三个引脚都有的.

我手上这个是licheepi nano, 从原理图Lichee_nano.pdf上面看,只有 usb_id, 其他两个脚是没有的. 但是我修改 sys_config.fex :

usb_id_gpio = port:PE02<0><1><default><default>

仍然无法正常检测device或者host.

离线

#72 2018-09-25 23:19:12

ippen
会员
注册时间: 2018-07-22
累计积分: 275

Re: f1c100s USB otg device 模式可以用吗?

mass_storage 模块还是不能用

截图

从主机抓包,抓到的数据不是连续的,时间是跳跃的,0秒,5秒,25秒,45秒,66秒等,不知道系统卡在哪个环节了

离线

#73 2018-09-25 23:39:32

晕哥
Administrator
注册时间: 2017-09-06
累计积分: 8,528

Re: f1c100s USB otg device 模式可以用吗?

@szyusong  这个得再请出大神才行。

离线

#74 2018-09-26 14:24:51

ippen
会员
注册时间: 2018-07-22
累计积分: 275

Re: f1c100s USB otg device 模式可以用吗?

szyusong 说:

3.10 内核的 RNDIS 搞定了。

f1c100s 的手册中关于 USB 有这样的说明:
Supports up to 3 User-Configurable Endpoints for Bulk , Isochronous, Control and Interrupt
bi-directional transfers (Endpoint1, Endpoint2)
支持 INT 传输的只有 EP1 和 EP2,目前代码采用的是 EP4,是无法工作的。

@szyusong,你的手册是哪里找到的?我找了一圈,没找到,据说和f1c100s相同的f1c600的手册,里面写的是8 User-Configurable Endpoints
方便的话共享一下手册

离线

#75 2018-09-26 14:27:19

ippen
会员
注册时间: 2018-07-22
累计积分: 275

Re: f1c100s USB otg device 模式可以用吗?

晕哥 说:

@szyusong  这个得再请出大神才行。

按 @szyusong看到的手册,f1c100s是3 个endpoints,而我们找到的bsp是f1c600的,c600是8 个endpoint,所以这两者的差异,导致usb 驱动不能通用
应该要找f1c100s专用的bsp

离线

#76 2018-09-26 14:34:28

晕哥
Administrator
注册时间: 2017-09-06
累计积分: 8,528

Re: f1c100s USB otg device 模式可以用吗?

在Q群听说 f1c100s, f1c600是同一个 die, 在封装芯片的时候某些IO上拉下拉就成为了另外一个型号,在不开源的u-boot里面区分开来.

听说而已,仅供参考.

离线

#77 2018-09-26 16:42:40

szyusong
会员
所在地: 深圳
注册时间: 2018-09-08
累计积分: 35

Re: f1c100s USB otg device 模式可以用吗?

ippen 说:
szyusong 说:

3.10 内核的 RNDIS 搞定了。

f1c100s 的手册中关于 USB 有这样的说明:
Supports up to 3 User-Configurable Endpoints for Bulk , Isochronous, Control and Interrupt
bi-directional transfers (Endpoint1, Endpoint2)
支持 INT 传输的只有 EP1 和 EP2,目前代码采用的是 EP4,是无法工作的。

@szyusong,你的手册是哪里找到的?我找了一圈,没找到,据说和f1c100s相同的f1c600的手册,里面写的是8 User-Configurable Endpoints
方便的话共享一下手册

http://dl.linux-sunxi.org/F1C100/Allwinner_F1C100_datasheet_20110331.pdf
在其中搜“Endpoint1”。
本地下载:Allwinner_F1C100_datasheet_20110331.pdf

最近编辑记录 szyusong (2018-09-26 16:47:30)

离线

#78 2018-09-26 19:47:02

ippen
会员
注册时间: 2018-07-22
累计积分: 275

Re: f1c100s USB otg device 模式可以用吗?

f1c100 和 f1c100s 是不同的芯片
f1c100 是 2011年出的

离线

#79 2018-09-26 20:39:47

晕哥
Administrator
注册时间: 2017-09-06
累计积分: 8,528

Re: f1c100s USB otg device 模式可以用吗?

ippen 说:

f1c100 和 f1c100s 是不同的芯片
f1c100 是 2011年出的

f1c100 和 f1c100s 肯定是共一个die 无疑了,
只是f1c100s 封装了一个 32M DDR,
可能引出来的pin没有 f1c100多.

离线

#80 2018-09-26 21:10:29

ippen
会员
注册时间: 2018-07-22
累计积分: 275

Re: f1c100s USB otg device 模式可以用吗?

晕哥 说:
ippen 说:

f1c100 和 f1c100s 是不同的芯片
f1c100 是 2011年出的

f1c100 和 f1c100s 肯定是共一个die 无疑了,
只是f1c100s 封装了一个 32M DDR,
可能引出来的pin没有 f1c100多.

如果这样,那么f1c600就是不同芯片了,因为c600 usb部分写着8 user-configure endpoint

如果f1c100s和f1c100相同,找f1c100的bsp看看应该有帮助

最近编辑记录 ippen (2018-09-26 21:11:50)

离线

#81 2018-09-26 21:38:35

晕哥
Administrator
注册时间: 2017-09-06
累计积分: 8,528

Re: f1c100s USB otg device 模式可以用吗?

如果有板子,可以通过jtag获取芯片core id来确定是否是同一芯片。

离线

#82 2019-11-21 16:06:53

ffplay
会员
注册时间: 2019-08-31
累计积分: 74

Re: f1c100s USB otg device 模式可以用吗?

szyusong 说:

3.10 内核的 RNDIS 搞定了。

f1c100s 的手册中关于 USB 有这样的说明:
Supports up to 3 User-Configurable Endpoints for Bulk , Isochronous, Control and Interrupt
bi-directional transfers (Endpoint1, Endpoint2)
支持 INT 传输的只有 EP1 和 EP2,目前代码采用的是 EP4,是无法工作的。

按如下修改后,在 Windows 下 RNDIS 没问题了。

static const char ep0name [] = "ep0";
static const char ep1in_bulk_name []  = "ep1in-bulk";
static const char ep1out_bulk_name [] = "ep1out-bulk";
#if 1
static const char ep2in_bulk_name []  = "ep2-int"; // 作为 INT 节点,为了 usb_ep_autoconfig 能查询到
#else
static const char ep2in_bulk_name []  = "ep2in-bulk";
#endif
static const char ep2out_bulk_name [] = "ep2out-bulk";
static const char ep3_iso_name []     = "ep3-iso";
static const char ep4_int_name []     = "ep4-int";
static const char ep5in_bulk_name []  = "ep5in-bulk";
static const char ep5out_bulk_name [] = "ep5out-bulk";
	.ep[3] = {
		.num			= 2,
		.ep = {
			.name		= ep2in_bulk_name,
			.ops		= &sunxi_udc_ep_ops,
			.maxpacket	= SW_UDC_EP_FIFO_SIZE,
		},
		.dev		        = &sunxi_udc,
		//.fifo_size	        = SW_UDC_EP_FIFO_SIZE,
		.bEndpointAddress   = (USB_DIR_IN | 2),
#if 1
		.bmAttributes	    = USB_ENDPOINT_XFER_INT,
#else
		.bmAttributes	    = USB_ENDPOINT_XFER_BULK,
#endif

是在sunxi_udc.h和sunxi_udc.c里修改吗?

离线

页脚