我使用的是 Linux 5.7.1 内核,在 sun8i-v3s.dtsi文件中已经配置好了usb,如下:
usb_otg: usb@1c19000 {
compatible = "allwinner,sun8i-h3-musb";
reg = <0x01c19000 0x0400>;
clocks = <&ccu CLK_BUS_OTG>;
resets = <&ccu RST_BUS_OTG>;
interrupts = <GIC_SPI 71 IRQ_TYPE_LEVEL_HIGH>;
interrupt-names = "mc";
phys = <&usbphy 0>;
phy-names = "usb";
extcon = <&usbphy 0>;
status = "disabled";
};
usbphy: phy@1c19400 {
compatible = "allwinner,sun8i-v3s-usb-phy";
reg = <0x01c19400 0x2c>,
<0x01c1a800 0x4>;
reg-names = "phy_ctrl",
"pmu0";
clocks = <&ccu CLK_USB_PHY0>;
clock-names = "usb0_phy";
resets = <&ccu RST_USB_PHY0>;
reset-names = "usb0_reset";
status = "disabled";
#phy-cells = <1>;
};
ehci0: usb@01c1a000 {
compatible = "allwinner,sun8i-v3s-ehci", "generic-ehci";
reg = <0x01c1a000 0x100>;
interrupts = <GIC_SPI 72 IRQ_TYPE_LEVEL_HIGH>;
clocks = <&ccu CLK_BUS_EHCI0>, <&ccu CLK_BUS_OHCI0>;
resets = <&ccu RST_BUS_EHCI0>, <&ccu RST_BUS_OHCI0>;
status = "disabled";
};
ohci0: usb@01c1a400 {
compatible = "allwinner,sun8i-v3s-ohci", "generic-ohci";
reg = <0x01c1a400 0x100>;
interrupts = <GIC_SPI 73 IRQ_TYPE_LEVEL_HIGH>;
clocks = <&ccu CLK_BUS_EHCI0>, <&ccu CLK_BUS_OHCI0>,
<&ccu CLK_USB_OHCI0>;
resets = <&ccu RST_BUS_EHCI0>, <&ccu RST_BUS_OHCI0>;
status = "disabled";
};
在sun8i-v3s-licheepi-zero.dts中也进行了配置,如下:
&ehci0 {
status = "okay";
};
&ohci0 {
status = "okay";
};
&usb_otg {
dr_mode = "host";
status = "okay";
};
&usbphy {
usb0_id_det-gpios = <&pio 5 6 GPIO_ACTIVE_LOW>; //PF6
status = "okay";
};
在上面这段代码中,usb_id的配置我不清楚是否正确,不确定V3X的usb_id口是不是PF6,原理图、数据手册上也没写这个(小白一枚)。
我用的开发板是下面这个(https://whycan.com/t_7567.html)。按照网上的教程,usb配置为host模式,usb_id是要拉低的,但是这个开发板的PF6接了一个10K的电阻接3.3V直接拉高了(电阻已经焊死,不是拔插式的)。 (不知道是不是受这个的影响 )
另外,还按照这个教程(https://www.cnblogs.com/twzy/p/15243838.html)配置了 make menuconfig;
编译烧录后,启动日志中,usb相关如下:
[ 0.853804] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[ 0.860495] ehci-platform: EHCI generic platform driver
[ 0.866018] ehci-platform 1c1a000.usb: EHCI Host Controller
[ 0.871748] ehci-platform 1c1a000.usb: new USB bus registered, assigned bus number 1
[ 0.880000] ehci-platform 1c1a000.usb: irq 25, io mem 0x01c1a000
[ 0.908891] ehci-platform 1c1a000.usb: USB 2.0 started, EHCI 1.00
[ 0.916154] hub 1-0:1.0: USB hub found
[ 0.920153] hub 1-0:1.0: 1 port detected
[ 0.924782] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
[ 0.931141] ohci-platform: OHCI generic platform driver
[ 0.936729] ohci-platform 1c1a400.usb: Generic Platform OHCI controller
[ 0.943490] ohci-platform 1c1a400.usb: new USB bus registered, assigned bus number 2
[ 0.951691] ohci-platform 1c1a400.usb: irq 26, io mem 0x01c1a400
[ 1.024002] hub 2-0:1.0: USB hub found
[ 1.027867] hub 2-0:1.0: 1 port detected
[ 1.035236] usbcore: registered new interface driver usb-storage
...
[ 1.169107] usbcore: registered new interface driver usbhid
[ 1.174710] usbhid: USB HID core driver
...
[ 2.021980] usb_phy_generic usb_phy_generic.1.auto: supply vcc not found, using dummy regulator
[ 2.033347] musb-hdrc musb-hdrc.2.auto: MUSB HDRC host driver
[ 2.040119] musb-hdrc musb-hdrc.2.auto: new USB bus registered, assigned bus number 3
[ 2.051677] hub 3-0:1.0: USB hub found
[ 2.056236] hub 3-0:1.0: 1 port detected
启动后插入键盘,报错如下:
[ 2.958892] usb 2-1: device descriptor read/64, error -62
[ 3.288869] usb 2-1: device descriptor read/64, error -62
[ 3.618935] usb 2-1: new low-speed USB device number 3 using ohci-platform
[ 3.838888] usb 2-1: device descriptor read/64, error -62
[ 4.168877] usb 2-1: device descriptor read/64, error -62
[ 4.289016] usb usb2-port1: attempt power cycle
[ 4.838973] usb 2-1: new low-speed USB device number 4 using ohci-platform
[ 5.278881] usb 2-1: device not accepting address 4, error -62
[ 5.488907] usb 2-1: new low-speed USB device number 5 using ohci-platform
[ 5.928875] usb 2-1: device not accepting address 5, error -62
[ 5.935753] usb usb2-port1: unable to enumerate USB device
有看到这个贴子说可能是硬件的问题https://whycan.com/t_1954.html,但是现在硬件电路已经直接把PF6给拉高了,也没去拆那个10k的电阻。麻烦各位大佬指导一下。
离线
检测V3x底部焊盘是否焊接良好,U盘供电,如无问题,这个应该是layout问题,USB D+ D-线太长或者过孔多,缩短线做等长包地,重新lay一版试试
离线
检测V3x底部焊盘是否焊接良好,U盘供电,如无问题,这个应该是layout问题,USB D+ D-线太长或者过孔多,缩短线做等长包地,重新lay一版试试
有插过U盘试过,插上去直接兹拉兹拉的电流声,U盘都直接烧臭了。
但U盘居然还能用
离线