USB 子系统架构与源码总览
1. Host侧
1 | 用户态 / block / tty / net / input / media |
USB device可有多个configuration,每个configuration有多个interface;Linux通常把driver绑定到interface,而不是整台device。
2. Gadget侧
1 | ConfigFS / legacy gadget |
Host的URB与Gadget的usb_request是两套对向模型。
3. Type-C侧
Type-C/TCPM/PD决定:
- attach/orientation;
- source/sink;
- power role;
- data role;
-PD contract;
-alternate mode/mux。
USB role switch再通知DWC3进入host或device。Type-C不是USB数据协议栈本身。
4. 核心对象
usb_device:总线设备和地址;usb_interface:驱动绑定单元;usb_host_endpoint;urb;usb_driver/usb_device_driver;usb_hcd/hc_driver;usb_gadget/usb_ep/usb_request;typec_port/tcpm_port;usb_role_switch。
5. RK3588
- DWC3 DRD0:USB2 OTG + USB3/DP combo PHY;
- RK3588非S还增加DRD1;
- DWC3 host0:SuperSpeed host;
-两组独立EHCI/OHCI USB2 host;
-USB2 PHY0/1/2/3(依SoC变体);
-USBDP PHY把高速lanes在USB3和DP间复用;
-板级Type-C controller、VBUS regulator和extcon/role决定OTG行为。
6. 构建
rockchip_linux_defconfig列出了xHCI/EHCI/OHCI、DWC3/DWC2、Gadget/ConfigFS、Storage/UAS、Serial、usbmon以及TCPM/TCPCI/FUSB302/HUSB311;但该文件未显式列出顶层 CONFIG_USB=y。产品是否经过基础defconfig/fragment合并,必须以最终 .config为准。
7. 边界
Rockchip高速PHY实现主要位于 drivers/phy/rockchip/,不在 drivers/usb/phy/;后者是旧USB PHY框架及通用transceiver驱动。
正在加载留言…