NVIDIA Jetson working

AGX Xavier USB(Remove TYPE-C)

2019-04-16  本文已影响3人  童年雅趣

由于项目需要,自己重新设计了Xavier载板(Carrier board),即与NV Xavier 官方载板(Carrier board)硬件不同,故需修改软件进行匹配(去除TYPE-C 支持),中间过程踩过的坑就不提了,下面把修改内容Po上来分享出来。

NV Xavier Carrier board载板 :
TYPE-C Aport --- 支持OTG(Host 和 Device)
TYPE-C Bprot --- 仅支持Host 功能
MicroUSB --- 仅Log print (不支持USB 功能)
TYPE-A USB(共用E-SATA口) --- 仅支持Host 功能
自定义Carrier board载板:
TYPE-C Aport --- 支持OTG(Host 和 Device)
TYPE-C Bprot --- 仅支持Host 功能
MicroUSB --- 仅Log print (不支持USB 功能)
TYPE-A USB(共用E-SATA口) --- 仅支持Host 功能

Debug过程参考:Xavier Forum USB-Does-Not-Working Topic

USB 设备插入拔出识别过程的dmesg log:

插入Micro-USB(Xavier) --- TYPE-A(PC)
nvidia@tw-xavier:~$ dmesg | grep "extcon"
[    1.290319] extcon probe enter(VBUS)
[    1.291297] extcon-gpio-states external-connection:extcon@1: Cable state:1, cable id:1
[    4.445684] extcon-disp-state external-connection:disp-state: cable 48 state 1
[    4.628094] extcon-disp-state external-connection:disp-state: cable 48 state 0
[    4.715092] extcon-disp-state external-connection:disp-state: cable 48 state 1
[    6.808447] extcon-disp-state external-connection:disp-state: cable 40 state 1
[   10.002730] tegra-xusb 3610000.xhci: extcon 0: ffffffc3ebc49000 id
[   21.711515] extcon-disp-state external-connection:disp-state: cable 48 state 0
[   21.761044] extcon-disp-state external-connection:disp-state: cable 48 state 1

插入Micro-USB(Xavier) --- TYPE-A(U盘)
[  191.594782] extcon-gpio-states external-connection:extcon@1: Cable state:1, cable id:2
[  205.126747] extcon-gpio-states external-connection:extcon@1: Cable state:0, cable id:0

以验证Okay的代码Patch包如下:

  • 去除ucsi支持(TYPE-C)
  • 支持OTG,需添加DTS 节点 vbus_id_extcon: extcon
  • 修改tegra_xhci和tegra_xudc 节点下的“extcon”
  • 去除head0/1/2,extcon(即去除了 TYPE-C Display支持)
--- a/JetPack_4.2_Linux_P2888/Linux_for_Tegra/sources/hardware/nvidia/platform/t19x/galen/kernel-dts/common/tegra194-p2888-0001-p2822-0000-common.dtsi
+++ b/JetPack_4.2_Linux_P2888/Linux_for_Tegra/sources/hardware/nvidia/platform/t19x/galen/kernel-dts/common/tegra194-p2888-0001-p2822-0000-common.dtsi
@@ -25,6 +25,10 @@
 #include "tegra194-plugin-manager-p2822-0000.dtsi"
 #include "tegra194-super-module-e2614-p2888-0000.dtsi"
 
+#define EXTCON_NONE                            0
+#define EXTCON_USB                     1
+#define EXTCON_USB_Host                2
@@ -25,6 +25,10 @@
 #include "tegra194-plugin-manager-p2822-0000.dtsi"
 #include "tegra194-super-module-e2614-p2888-0000.dtsi"
 
+#define EXTCON_NONE                            0
+#define EXTCON_USB                     1
+#define EXTCON_USB_Host                2
+
 / {
        nvidia,dtsfilename = __FILE__;
        nvidia,dtbbuildtime = __DATE__, __TIME__;
@@ -96,7 +100,7 @@
                        status = "okay";
                };
                ucsi_ccg: ucsi_ccg@8 {
-                       status = "okay";
+                       status = "disabled";
                        typec-extcon {
                                typec_port0: port-0 {
                                        status = "okay";
@@ -115,7 +119,7 @@
                        };
                };
        };
-
+       
 #if TEGRA_XUSB_PADCONTROL_VERSION >= DT_VERSION_2
 
        xusb_padctl: xusb_padctl@3520000 {
@@ -161,7 +165,7 @@
                };
 
                ports {
-                       usb2-0 {
+                       usb2-0 {/* A501 USB Ports */
                                mode = "otg";
                                status = "okay";
                        };
@@ -194,10 +198,30 @@
        };
 #endif
 
+       external-connection {
+               vbus_id_extcon: extcon@1 {
+                       compatible = "extcon-gpio-states";
+                       reg = <0x01>;
+                       extcon-gpio,name = "VBUS";
+                       extcon-gpio,wait-for-gpio-scan = <0>;
+                       extcon-gpio,cable-states = <0x3 0x0
+                                                   0x0 0x2
+                                                   0x1 0x2
+                                                   0x2 0x1>;
+                       gpios = <&tegra_main_gpio TEGRA194_MAIN_GPIO(M, 3) 0
+                               &tegra_main_gpio TEGRA194_MAIN_GPIO(Q, 0) 0>;
+                       extcon-gpio,out-cable-name-strings = "USB", "USB-Host";
+                       extcon-gpio,out-cable-names = <EXTCON_USB EXTCON_USB_HOST EXTCON_NONE>;
+                       wakeup-source;
+                       #extcon-cells = <1>;
+               };
+       };
+       
        tegra_xudc: xudc@3550000 {
-               extcon-cables = <&typec_port0 0>;
+               extcon-cables = <&vbus_id_extcon 0>;
                extcon-cable-names = "vbus";
                #extcon-cells = <1>;
+               
 #if TEGRA_XUSB_PADCONTROL_VERSION >= DT_VERSION_2
                phys = <&{/xusb_padctl@3520000/pads/usb2/lanes/usb2-0}>,
                        <&{/xusb_padctl@3520000/pads/usb3/lanes/usb3-2}>;
@@ -209,9 +233,10 @@
        };
 
        tegra_xhci: xhci@3610000 {
-               extcon-cables = <&typec_port0 1>;
+               extcon-cables = <&vbus_id_extcon 1>;
                extcon-cable-names = "id";
                #extcon-cells = <1>;
+               
 #if TEGRA_XUSB_PADCONTROL_VERSION >= DT_VERSION_2
                phys = <&{/xusb_padctl@3520000/pads/usb2/lanes/usb2-0}>,
                        <&{/xusb_padctl@3520000/pads/usb2/lanes/usb2-1}>,
@@ -319,21 +344,27 @@
 };
 
 &head0 {
+/*
        extcon-cables = <&typec_port0 2 &typec_port1 2>;
        extcon-cable-names = "typec0", "typec1";
        #extcon-cells = <1>;
+*/
 };
 
 &head1 {
+/*
        extcon-cables = <&typec_port0 2 &typec_port1 2>;
        extcon-cable-names = "typec0", "typec1";
        #extcon-cells = <1>;
+*/
 };
 
 &head2 {
+/*
        extcon-cables = <&typec_port0 2 &typec_port1 2>;
        extcon-cable-names = "typec0", "typec1";
        #extcon-cells = <1>;
+*/
 };

上一篇下一篇

猜你喜欢

热点阅读