您尚未登录。

楼主 # 2023-02-24 16:29:33

colin
会员
注册时间: 2023-02-13
已发帖子: 10
积分: 10

求助:全志 A10 芯片在主线 u-boot 中是否可以使用 ums 命令?

在设备树里启用了 usb otg:

&otg_sram {
	status = "okay";
};

&usb_otg {
	dr_mode = "otg";
	status = "okay";
};

&reg_usb0_vbus {
	status = "okay";
};

&reg_usb1_vbus {
	gpio = <&pio 7 7 GPIO_ACTIVE_HIGH>;
	status = "okay";
};

&reg_usb2_vbus {
	status = "disabled";
};

&usbphy {
	usb0_id_det-gpios = <&pio 7 6 GPIO_ACTIVE_HIGH>; /* PH6 */
	usb0_vbus_det-gpios = <&pio 7 5 GPIO_ACTIVE_HIGH>; /* PH5 */
	usb0_vbus-supply = <&reg_usb0_vbus>;
	usb1_vbus-supply = <&reg_usb1_vbus>;
	usb2_vbus-supply = <&reg_usb2_vbus>;
	status = "okay";
};

u-boot 使用最新主线版本,启用了 CONFIG_CMD_USB_MASS_STORAGE, USB_FUNCTION_MASS_STORAGE, USB_GADGET, USB_GADGET_DOWNLOAD

进入 u-boot 交互命令行后,使用 dm tree 可以看到已经有了相关驱动了:

 usb           0  [   ]   sunxi-musb            |   |-- usb@1c13000

但是没有 probed,不知道是不是这里的问题,然后运行 ums 0 mmc 1 报以下错误:

Controller uninitialized
g_dnl_register: failed!, error: -6
g_dnl_register failed

离线

楼主 #1 2023-03-31 00:34:44

colin
会员
注册时间: 2023-02-13
已发帖子: 10
积分: 10

Re: 求助:全志 A10 芯片在主线 u-boot 中是否可以使用 ums 命令?

暂时打这个 patch 解决了,也不知道这样做对不对。

diff --git a/board/sunxi/board.c b/board/sunxi/board.c
index 827e545032..22c84f0e56 100644
--- a/board/sunxi/board.c
+++ b/board/sunxi/board.c
@@ -673,6 +673,25 @@ void sunxi_board_init(void)
 #endif /* CONFIG_SPL_BUILD */
 
 #ifdef CONFIG_USB_GADGET
+#include <usb.h>
+#include <dm/device-internal.h>
+int board_usb_init(int index, enum usb_init_type init)
+{
+       struct udevice *dev;
+       int ret;
+       ret = uclass_get_device(UCLASS_USB_GADGET_GENERIC, index, &dev);
+       return ret;
+}
+int board_usb_cleanup(int index, enum usb_init_type init)
+{
+       struct udevice *dev;
+       int ret;
+       ret = uclass_get_device(UCLASS_USB_GADGET_GENERIC, index, &dev);
+       if (!ret) {
+               device_remove(dev, DM_REMOVE_NORMAL);
+       }
+       return 0;
+}
 int g_dnl_board_usb_cable_connected(void)
 {
        struct udevice *dev;

离线

#2 2024-11-01 15:30:01

baidxi
会员
注册时间: 2018-10-27
已发帖子: 42
积分: 43.5

Re: 求助:全志 A10 芯片在主线 u-boot 中是否可以使用 ums 命令?

@colin
不用改这里啊。把sunxi_glue.c的bind方法实现就行了。默认没有实现 。所以不能自动probe

离线

#3 2024-11-24 22:23:27

billymc
会员
注册时间: 2020-05-26
已发帖子: 39
积分: 18.5

Re: 求助:全志 A10 芯片在主线 u-boot 中是否可以使用 ums 命令?

T113也能uboot挂载mmc成U盘吗,运行ums 0 mmc 0后,没有挂载U盘,设备管理器里面显示USB download gadget

离线

#4 今天 07:41:47

batsd
会员
注册时间: 2025-03-09
已发帖子: 2
积分: 2

Re: 求助:全志 A10 芯片在主线 u-boot 中是否可以使用 ums 命令?

我在A64上遇到了同样的问题:

Hit any key to stop autoboot: 0
A64 =>
A64 => ums 0 mmc 1
UMS: LUN 0, dev mmc 1, hwpart 0, sector 0x0, count 0xe90000
Controller uninitialized
g_dnl_register: failed!, error: -6
g_dnl_register failed

我发现如果开启了 [  ] USB Ethernet Gadget

 
  │     -> Device Drivers                                                                                 
  │       -> USB support (USB [=y])                                                                    
  │         -> USB Ethernet Gadget (USB_ETHER [=y])                                             
  │           -> USB Ethernet Gadget Model (<choice> [=y])
                       

ums就可以用了:

U-Boot 2026.04-rc2 (Feb 16 2026 - 07:27:29 +0800) Allwinner A64
CPU:   Allwinner A64 (SUN50I)
Model: HDG-CPU-A64C-A (HelperA64)
DRAM:  1 GiB
Core:  86 devices, 22 uclasses, devicetree: separate
WDT:   Not starting watchdog@1c20ca0
MMC:   mmc@1c0f000: 0, mmc@1c10000: 3, mmc@1c11000: 1
Loading Environment from FAT... Unable to read "uboot.env" from mmc0:1... 
In:    serial,usbkbd
Out:   serial,vidconsole
Err:   serial,vidconsole
Allwinner mUSB OTG (Peripheral)
Net:   using musb-hdrc, OUT ep1out IN ep1in STATUS ep2in
MAC de:ad:be:ef:00:01
HOST MAC de:ad:be:ef:00:00
RNDIS ready
eth0: usb_ether

USB not auto load
Hit any key to stop autoboot: 0
A64 => ums mmc 1
UMS: LUN 0, dev mmc 1, hwpart 0, sector 0x0, count 0xe90000
\

我还并不清楚为什么会这样,暂时用着吧

离线

页脚

工信部备案:粤ICP备20025096号 Powered by FluxBB

感谢为中文互联网持续输出优质内容的各位老铁们。 QQ: 516333132, 微信(wechat): whycan_cn (哇酷网/挖坑网/填坑网) service@whycan.cn


太原小智科技有限责任公司 - 东莞哇酷科技有限公司联合开发