Configuring imx8mm to not use USB Type-C

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Configuring imx8mm to not use USB Type-C

771 Views
jclsn
Contributor IV

Our custom board doesn't use a USB Type-C connector. Our device tree is based on the imx8mm-evk.dts. We therefore have modified the device tree to no use it with the following patch:

 

diff --git a/arch/arm/dts/custom-imx8mm.dts b/arch/arm/dts/custom-imx8mm.dts
index 4a4fd8ca0d2..33630081e84 100644
--- a/arch/arm/dts/custom-imx8mm.dts
+++ b/arch/arm/dts/custom-imx8mm.dts
@@ -35,6 +35,15 @@
 		startup-delay-us = <100>;
 		off-on-delay-us = <12000>;
 	};
+
+	reg_usbotg1_vbus: regulator-usbotg1-vbus {
+		compatible = "regulator-fixed";
+		regulator-name = "usbotg1_vbus";
+		regulator-min-microvolt = <5000000>;
+		regulator-max-microvolt = <5000000>;
+		gpio = <&gpio1 12 0>;
+		enable-active-high;
+	};
 };
 
 &iomuxc {
@@ -230,6 +239,12 @@
 				MX8MM_IOMUXC_GPIO1_IO02_WDOG1_WDOG_B		0xc6
 			>;
 		};
+
+		pinctrl_usbotg1: usbotg1grp {
+			fsl,pins = <
+				MX8MM_IOMUXC_GPIO1_IO12_GPIO1_IO12	0x6	/* AB10  GPIO1_IO12  GPIO1_IO12  USB1_OTG_PWR_1V8 */
+			>;
+		};
 	};
 };
 
@@ -400,32 +415,6 @@
 	scl-gpios = <&gpio5 16 GPIO_ACTIVE_HIGH>;
 	sda-gpios = <&gpio5 17 GPIO_ACTIVE_HIGH>;
 	status = "okay";
-
-	typec_ptn5110_1: ptn5110@50 {
-		compatible = "usb,tcpci";
-		reg = <0x50>;
-		src-pdos = <0x380190c8>;
-		snk-pdos = <0x380190c8 0x3802d0c8>;
-		max-snk-mv = <9000>;
-		max-snk-ma = <2000>;
-		op-snk-mw = <9000>;
-		max-snk-mw = <18000>;
-		port-type = "drp";
-		default-role = "sink";
-	};
-
-	typec_ptn5110_2: ptn5110@52 {
-		compatible = "usb,tcpci";
-		reg = <0x52>;
-		src-pdos = <0x380190c8>;
-		snk-pdos = <0x380190c8 0x3802d0c8>;
-		max-snk-mv = <9000>;
-		max-snk-ma = <2000>;
-		op-snk-mw = <9000>;
-		max-snk-mw = <18000>;
-		port-type = "drp";
-		default-role = "sink";
-	};
 };
 
 &i2c3 {
@@ -513,12 +502,15 @@
 	arm-supply = <&buck2_reg>;
 };
 
-&usbotg1 {
+&usbotg1 { /* USB1 (Type Micro) */
+	vbus-supply = <&reg_usbotg1_vbus>;
+	pinctrl-names = "default";
+	pinctrl-0 = <&pinctrl_usbotg1>;
+	dr_mode = "otg";
 	status = "okay";
-	extcon = <&typec_ptn5110_1>;
 };
 
-&usbotg2 {
+&usbotg2 { /* USB2 (Type A) */
+	dr_mode = "host";
 	status = "okay";
-	extcon = <&typec_ptn5110_2>;
 };

 

In the latest uboot-imx version the USB section of the device tree looks quite different though. I have tried

diff --git a/arch/arm/dts/custom-imx8mm.dtsi b/arch/arm/dts/custom-imx8mm.dtsi
index a0161c2f53..f720a08b38 100644                                     
--- a/arch/arm/dts/custom-imx8mm.dtsi                                      
+++ b/arch/arm/dts/custom-imx8mm.dtsi                                      
@@ -41,6 +41,15 @@                                                      
        enable-active-high;                                             
    };                                                                  
                                                                        
+   reg_usbotg1_vbus: regulator-usbotg1-vbus {                          
+       compatible = "regulator-fixed";                                 
+       regulator-name = "usbotg1_vbus";                                
+       regulator-min-microvolt = <5000000>;                            
+       regulator-max-microvolt = <5000000>;                            
+       gpio = <&gpio1 12 0>;                                           
+       enable-active-high;                                             
+   };                                                                  
+                                                                       
    ir-receiver {                                                       
        compatible = "gpio-ir-receiver";                                
        gpios = <&gpio1 13 GPIO_ACTIVE_LOW>;                            
@@ -312,34 +321,34 @@                                                   
        };                                                              
    };                                                                  
                                                                        
-   ptn5110: tcpc@50 {                                                  
-       compatible = "nxp,ptn5110";                                     
-       pinctrl-names = "default";                                      
-       pinctrl-0 = <&pinctrl_typec1>;                                  
-       reg = <0x50>;                                                   
-       interrupt-parent = <&gpio2>;                                    
-       interrupts = <11 8>;                                            
-       status = "okay";                                                
-                                                                       
-       port {                                                          
-           typec1_dr_sw: endpoint {                                    
-               remote-endpoint = <&usb1_drd_sw>;                       
-           };                                                          
-       };                                                              
-                                                                       
-       typec1_con: connector {                                         
-           compatible = "usb-c-connector";                             
-           label = "USB-C";                                            
-           power-role = "dual";                                        
-           data-role = "dual";                                         
-           try-power-role = "sink";                                    
-           source-pdos = <PDO_FIXED(5000, 3000, PDO_FIXED_USB_COMM)>;  
-           sink-pdos = <PDO_FIXED(5000, 3000, PDO_FIXED_USB_COMM)      
-                    PDO_VAR(5000, 20000, 3000)>;                       
-           op-sink-microwatt = <15000000>;                             
-           self-powered;                                               
-       };                                                              
-   };                                                                  
+   /* ptn5110: tcpc@50 { */                                            
+   /*  compatible = "nxp,ptn5110"; */                                  
+   /*  pinctrl-names = "default"; */                                   
+   /*  pinctrl-0 = <&pinctrl_typec1>; */                               
+   /*  reg = <0x50>; */                                                
+   /*  interrupt-parent = <&gpio2>; */                                 
+   /*  interrupts = <11 8>; */                                         
+   /*  status = "okay"; */                                             
+                                                                       
+   /*  port { */                                                       
+   /*      typec1_dr_sw: endpoint { */                                 
+   /*          remote-endpoint = <&usb1_drd_sw>; */                    
+   /*      }; */                                                       
+   /*  }; */                                                           
+                                                                       
+   /*  typec1_con: connector { */                                      
+   /*      compatible = "usb-c-connector"; */                          
+   /*      label = "USB-C"; */                                                                          
+   /*      power-role = "dual"; */                                                                      
+   /*      data-role = "dual"; */                                                                       
+   /*      try-power-role = "sink"; */                                                                  
+   /*      source-pdos = <PDO_FIXED(5000, 3000, PDO_FIXED_USB_COMM)>; */                                
+   /*      sink-pdos = <PDO_FIXED(5000, 3000, PDO_FIXED_USB_COMM) */                                    
+   /*               PDO_VAR(5000, 20000, 3000)>; */                                                     
+   /*      op-sink-microwatt = <15000000>; */                                                           
+   /*      self-powered; */                                                                             
+   /*  }; */                                                                                            
+   /* }; */                                                                                             
 };                                                                                                      
                                                                                                         
 &i2c3 {                                                                                                 
@@ -378,22 +387,35 @@                                                                                    
    status = "okay";                                                                                     
 };                                                                                                      
                                                                                                         
-&usbotg1 {                                                                                              
-   dr_mode = "otg";                                                                                     
-   hnp-disable;                                                                                         
-   srp-disable;                                                                                         
-   adp-disable;                                                                                         
-   usb-role-switch;                                                                                     
-   disable-over-current;                                                                                
-   samsung,picophy-pre-emp-curr-control = <3>;                                                          
-   samsung,picophy-dc-vol-level-adjust = <7>;                                                           
-   status = "okay";                                                                                     
+/* &usbotg1 { */                                                                                        
+/*     dr_mode = "otg"; */                                                                              
+/*     hnp-disable; */                                                                                  
+/*     srp-disable; */                                                                                  
+/*     adp-disable; */                                                                                  
+/*     usb-role-switch; */                                                                              
+/*     disable-over-current; */                                                                         
+/*     samsung,picophy-pre-emp-curr-control = <3>; */                                                   
+/*     samsung,picophy-dc-vol-level-adjust = <7>; */                                                    
+/*     status = "okay"; */                                                                              
+                                                                                                        
+/*     port { */                                                                                        
+/*         usb1_drd_sw: endpoint { */                                                                   
+/*             remote-endpoint = <&typec1_dr_sw>; */                                                    
+/*         }; */                                                                                        
+/*     }; */                                                                                            
+/* }; */                                                                                                
+                                                                                                        
+&usbotg1 { /* USB1 (Type Micro) */                                                                      
+    vbus-supply = <&reg_usbotg1_vbus>;                                                                  
+    pinctrl-names = "default";                                                                          
+    pinctrl-0 = <&pinctrl_usbotg1>;                                                                     
+    dr_mode = "otg";                                                                                    
+    status = "okay";                                                                                    
+};                                                                                                      
                                                                                                         
-   port {                                                                                               
-       usb1_drd_sw: endpoint {                                                                          
-           remote-endpoint = <&typec1_dr_sw>;                                                           
-       };                                                                                               
-   };                                                                                                   
+&usbotg2 { /* USB2 (Type A) */                                                                          
+    dr_mode = "host";                                                                                   
+    status = "okay";                                                                                    
 };                                                                                                      
                                                                                                         
 &usdhc2 {                                                                                               
@@ -564,6 +586,12 @@                                                                                     
        >;                                                                                               
    };                                                                                                   
                                                                                                         
+    pinctrl_usbotg1: usbotg1grp {                                                                       
+        fsl,pins = <                                                                                    
+            MX8MM_IOMUXC_GPIO1_IO12_GPIO1_IO12  0x6 /* AB10  GPIO1_IO12  GPIO1_IO12  USB1_OTG_PWR_1V8 */
+        >;                                                                                              
+    };                                                                                                  
+                                                                                                        
    pinctrl_uart2: uart2grp {                          
        fsl,pins = <                                   
            MX8MM_IOMUXC_UART2_RXD_UART2_DCE_RX 0x140  

 

but the USB initialization is failing. I have been looking for quite some time now as to why this is. I have got rid of all the typec-related configurations and the new USB configuration looks correct according to the example from the i.MX8 reference manual.

Can you tell me what is missing?

Thank you

0 Kudos
1 Reply

733 Views
AldoG
NXP TechSupport
NXP TechSupport

Hello,

Your configuration does look correct, even one could use the i.MX6 as reference for this:

https://source.codeaurora.org/external/imx/uboot-imx/tree/arch/arm/dts/imx6qdl-sabresd.dtsi?h=lf_v20...

Also, is there any logs you could share regarding the issue you have seen?

Best regards,
Aldo.

0 Kudos