页次: 1
暂时打这个 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;
在设备树里启用了 usb otg:
&otg_sram {
status = "okay";
};
&usb_otg {
dr_mode = "otg";
status = "okay";
};
®_usb0_vbus {
status = "okay";
};
®_usb1_vbus {
gpio = <&pio 7 7 GPIO_ACTIVE_HIGH>;
status = "okay";
};
®_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 = <®_usb0_vbus>;
usb1_vbus-supply = <®_usb1_vbus>;
usb2_vbus-supply = <®_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