页次: 1
这个里面好像没有 AI 方面的。
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
没问题了,板子虚焊了。
[ 13.881607] key down
[ 13.895040] report data: key_val : 26 transfer_code: 255 , scancode: 4
[ 13.921882] report data: key_val : 25 transfer_code: 4 , scancode: 3
[ 13.948704] report data: key_val : 25 transfer_code: 3 , scancode: 3
[ 14.002270] report data: key_val : 26 transfer_code: 3 , scancode: 4
[ 14.029113] report data: key_val : 63 transfer_code: 4
[ 14.036106] key up
[ 14.898467] key down
[ 14.911895] report data: key_val : 20 transfer_code: 255 , scancode: 3
[ 14.938726] report data: key_val : 20 transfer_code: 3 , scancode: 3
[ 14.965560] report data: key_val : 20 transfer_code: 3 , scancode: 3
[ 14.992430] report data: key_val : 20 transfer_code: 3 , scancode: 3
[ 15.019221] report data: key_val : 20 transfer_code: 3 , scancode: 3
[ 15.046092] report data: key_val : 63 transfer_code: 3
[ 15.053174] key up
[ 16.303534] key down
[ 16.316968] report data: key_val : 14 transfer_code: 255 , scancode: 2
[ 16.343824] report data: key_val : 14 transfer_code: 2 , scancode: 2
[ 16.370668] report data: key_val : 14 transfer_code: 2 , scancode: 2
[ 16.410847] report data: key_val : 63 transfer_code: 2
[ 16.417921] key up
[ 16.852411] key down
[ 16.865815] report data: key_val : 7 transfer_code: 255 , scancode: 1
[ 16.892705] report data: key_val : 7 transfer_code: 1 , scancode: 1
[ 16.919527] report data: key_val : 7 transfer_code: 1 , scancode: 1
[ 16.959706] report data: key_val : 63 transfer_code: 1
[ 16.966763] key up
[ 17.575221] key down
[ 17.588669] report data: key_val : 7 transfer_code: 255 , scancode: 1
[ 17.615507] report data: key_val : 7 transfer_code: 1 , scancode: 1
[ 17.642386] report data: key_val : 7 transfer_code: 1 , scancode: 1
[ 17.669211] report data: key_val : 7 transfer_code: 1 , scancode: 1
[ 17.678124] report data: key_val : 7 transfer_code: 1
[ 17.685165] key up
[ 17.843348] key down
[ 17.856765] report data: key_val : 7 transfer_code: 255 , scancode: 1
[ 17.883631] report data: key_val : 7 transfer_code: 1 , scancode: 1
[ 17.910482] report data: key_val : 7 transfer_code: 1 , scancode: 1
[ 17.937308] report data: key_val : 63 transfer_code: 1
[ 17.944389] key up
[ 18.057853] key down
[ 18.071253] report data: key_val : 7 transfer_code: 255 , scancode: 1
[ 18.098114] report data: key_val : 7 transfer_code: 1 , scancode: 1
[ 18.138329] report data: key_val : 63 transfer_code: 1
[ 18.145410] key up
[ 18.446212] key down
[ 18.459637] report data: key_val : 14 transfer_code: 255 , scancode: 2
[ 18.486484] report data: key_val : 14 transfer_code: 2 , scancode: 2
[ 18.513351] report data: key_val : 14 transfer_code: 2 , scancode: 2
[ 18.553551] report data: key_val : 63 transfer_code: 2
[ 18.560625] key up
[ 18.687472] key down
[ 18.700914] report data: key_val : 14 transfer_code: 255 , scancode: 2
[ 18.727758] report data: key_val : 14 transfer_code: 2 , scancode: 2
[ 18.754610] report data: key_val : 14 transfer_code: 2 , scancode: 2
[ 18.794839] report data: key_val : 63 transfer_code: 2
[ 18.801915] key up
[ 19.651305] key down
[ 19.664763] report data: key_val : 20 transfer_code: 255 , scancode: 3
[ 19.691636] report data: key_val : 20 transfer_code: 3 , scancode: 3
[ 19.718463] report data: key_val : 20 transfer_code: 3 , scancode: 3
[ 19.745320] report data: key_val : 20 transfer_code: 3 , scancode: 3
[ 19.785539] report data: key_val : 63 transfer_code: 3
[ 19.792621] key up
[ 20.066696] key down
[ 20.080092] report data: key_val : 26 transfer_code: 255 , scancode: 4
[ 20.106950] report data: key_val : 25 transfer_code: 4 , scancode: 3
[ 20.187309] report data: key_val : 63 transfer_code: 3
[ 20.194395] key up
[ 20.401542] key down
[ 20.495201] key up
[ 20.615691] key down
[ 20.682554] key up
[ 20.829802] key down
[ 20.843217] report data: key_val : 26 transfer_code: 255 , scancode: 4
[ 20.896804] report data: key_val : 26 transfer_code: 4 , scancode: 4
[ 20.923671] report data: key_val : 63 transfer_code: 4
[ 20.930664] key up
[ 21.325104] key down
[ 21.338509] report data: key_val : 25 transfer_code: 255 , scancode: 3
[ 21.365357] report data: key_val : 25 transfer_code: 3 , scancode: 3
[ 21.418933] report data: key_val : 26 transfer_code: 3 , scancode: 4
[ 21.445764] report data: key_val : 63 transfer_code: 4
[ 21.452763] key up
[ 21.686708] key down
[ 21.700164] report data: key_val : 25 transfer_code: 255 , scancode: 3
[ 21.780491] report data: key_val : 26 transfer_code: 3 , scancode: 4
[ 21.807351] report data: key_val : 63 transfer_code: 4
[ 21.814346] key up
[ 21.927859] key down
[ 21.941271] report data: key_val : 26 transfer_code: 255 , scancode: 4
[ 22.008244] report data: key_val : 63 transfer_code: 4
[ 22.015243] key up
[ 22.128762] key down
[ 22.209025] key up
[ 22.530240] key down
[ 22.543658] report data: key_val : 26 transfer_code: 255 , scancode: 4
[ 22.597247] report data: key_val : 26 transfer_code: 4 , scancode: 4
[ 22.624134] report data: key_val : 26 transfer_code: 4 , scancode: 4
[ 22.637543] report data: key_val : 58 transfer_code: 4
[ 22.644519] key up
[ 22.731319] key down
[ 22.744759] report data: key_val : 26 transfer_code: 255 , scancode: 4
[ 22.771637] report data: key_val : 25 transfer_code: 4 , scancode: 3
[ 22.798443] report data: key_val : 26 transfer_code: 3 , scancode: 4
[ 22.838693] report data: key_val : 63 transfer_code: 4
[ 22.845688] key up
采用 3.10 内核。按原理图修改了 dts 中的配置:
keyboard0:keyboard{
compatible = "allwinner,keyboard_2000mv";
reg = <0x0 0x01c23400 0x0 0x400>;
interrupts = <22>;
status = "okay";
key_cnt = <4>;
key1 = <200 115>;
key2 = <400 114>;
key3 = <600 139>;
key4 = <800 28>;
};
打开调试,按几个键,发现在 sunxi_isr_key 中调用 sunxi_keyboard_read_data 获取的 ADC 值都是 0 或 1,和按键的 ADC 值对不上。
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
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
几个主要的寄存器的值都差不多,但是不能枚举,不知道问题出在哪儿。
我试了下,直接把 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:
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 手动安装就可以。
https://whycan.cn/files/members/3/QQ20180922222312.png
装上了楼上朋友的驱动程序,果然设备无法启动,代码10.
放狗搜了一圈
权威答案:
我终于想通了。
由于响应时间的原因,设备未能成功完成某些信息的枚举。IE usb设备在枚举期间没有响应足够的时间。
一旦我修复了这个问题,我就能成功运行设备而不会出现ErrorCode 10问题。
看来得改gadget驱动了。
在 Windows 下可以使用 Bus Hound 抓包分析,我前面的帖子有写抓包的内容,问题出在中断节点 0x84 无法传输数据造成的。Windows下 RNDIS 驱动需要通过中断节点获取 device 的网卡状态变化及数据是否就绪等信息,因此中断节点无法通讯,RNDIS 就无法使用。而 RNDIS 在 Linux 下使用时,好像不会用到中断节点,所以没问题。
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,直接和内核编译在一起试试。
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
我的修改,希望能帮大家出坑。
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);
这样哦,那说驱动 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";
};
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)出问题的报错。
启动 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
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");
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
可以从 UART0 输出 log 的.config。
修改 sunivw1p1-pinctrl.dtsi,uart0 的管脚配置采用 PE0,PE1:
uart0_pins_a: uart0@0 {
allwinner,pins = "PE1", "PE0";
allwinner,pname = "uart0_tx", "uart0_rx";
allwinner,function = "uart0";
allwinner,muxsel = <5>;
allwinner,drive = <1>;
allwinner,pull = <1>;
};
需要调整其他用到 PE0,PE1 的配置。
页次: 1