我想通过 configfs 使用 USB 小工具设备(手机)作为主机。设置 configfs 后,主机外围设备(手机)上不会设置任何小工具。执行 init 脚本并产生以下结果
[0.678485] file system registered
[0.681070] UDC core: g1: couldn't find an available UDC or it's busy
g1 是在 configfs 中设置的小工具功能。问题是我没有在设备树中正确设置 USB 平台驱动程序。我尝试在我的设备树中创建节点如下
设备树
usb: usb@11200000 {
status = "ok";
compatible = "mediatek,mt2701-musb", "mediatek,mtk-musb";
reg = <0 0x11200000 0 0x10000>;
interrupts = <GIC_SPI 97 IRQ_TYPE_LEVEL_LOW>;
interrupt-names = "mc";
clocks = <&infracfg_ao CLK_INFRA_ICUSB>, <&topckgen CLK_TOP_USB_TOP>, <&topckgen CLK_TOP_UNIVPLL_D3_D4>;
clock-names = "main", "mcu", "univpll";
phys = <&u2port0 PHY_TYPE_USB2>;
usb-role-switch;
dr_mode = "otg";
power-domains = <&scpsys MT2701_POWER_DOMAIN_IFR_MSC>;
mode = <2>;
multipoint = <1>;
num_eps = <16>;
pericfg = <&pericfg>;
connector {
status = "ok";
compatible = "usb-c-connector";
label = "USB-C";
vbus-supply = <&mt6370_otg_vbus>;
power-role = "dual";
try-power-role = "sink";
data-role = "dual";
typec-power-opmode = "default";
pd-disable;
};
};
u2phy0: t-phy@11cc0000 {
status = "ok";
compatible = "mediatek,mt2701-tphy", "mediatek,generic-tphy-v1";
reg = <0 0x11cc0000 0 0x800>;
mediatek,src-ref-clk-mhz = <26>;
mediatek,src-coef = <17>;
#address-cells = <2>;
#size-cells = <2>;
ranges;
u2port0: usb-phy@11cc0800 {
reg = <0 0x11cc0800 0 0x100>;
clocks = <&clk26m>;
clock-names = "ref";
#phy-cells = <1>;
mediatek,eye-term = <3>;
mediatek,eye-vrt = <5>;
mediatek,eye-rev6 = <3>;
mediatek,eye-disc = <15>;
mediatek,host-eye-term = <3>;
mediatek,host-eye-vrt = <5>;
mediatek,host-eye-rev6 = <3>;
mediatek,host-eye-disc = <8>;
status = "okay";
};
};
我觉得我没有在树中设置其他东西来加载 musb-hdrc 驱动程序,以便找到 UDC 设备。中节点内容/sys/devices/platform/11200000.usb
如下
> event
OF_NAME=usb
OF_FULLNAME=/usb@11200000
OF_COMPATIBLE_0=mediatek,mt2701-musb
OF_COMPATIBLE_1=mediatek,mtk-musb
OF_COMPATIBLE_N=2
MODALIAS=of:NusbT(null)Cmediatek,mt2701-musbCmediatek,mtk-musb
> /power/runtime_active_time
0
> /power/runtime_status
unsupported
> waiting_for_supplier
0
我的节点似乎没有缺少任何依赖项,但它仍然无法启动小工具。 musb-hdrc 小工具驱动程序需要什么才能让小工具驱动程序找到可用的 UDC