yanghn2002

View My GitHub Profile

需要在全志平台适配 RTL8512 的 USB 网卡,首先打开驱动:

CONFIG_USB_RTL8152=y

这时候在启动的时候就会加载平台驱动:

[    1.806705] usbcore: registered new interface driver r8152
[    1.812910] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[    1.820231] sunxi-ehci: EHCI SUNXI driver

但还没完成,需要配置 USB controllor 到 host 模式,而且我没有接 ID/VBUS ,并且是我的 USB 网卡是焊在板子上的所以需要这样配置:

/*
 *usb_port_type: usb mode. 0-device, 1-host, 2-otg.
 *usb_detect_type: usb hotplug detect mode. 0-none, 1-vbus/id detect, 2-id/dpdm detect.
 *usb_detect_mode: 0-thread scan, 1-id gpio interrupt.
 *usb_id_gpio: gpio for id detect.
 *usb_det_vbus_gpio: gpio for id detect. gpio or "axp_ctrl";
 *usb_wakeup_suspend:0-SUPER_STANDBY, 1-USB_STANDBY.
 */
&usbc1 {
    device_type = "usbc1";
    usb_port_type = <1>;
    usb_detect_type = <0>;
    usb_detect_mode = <0>;
    usb_wakeup_suspend = <0>;
    status = "okay";
};
&ehci1 {
	status = "okay";
};

这样 USB controllor 就能检测到我的 8152 然后 bind 了