AM6548: USB Gadget Serial Issue

Part Number: AM6548

Tool/software:

I'm trying to enable the USB serial gadget function. When I load g_serial, it shows as "ready," but when I connect it to a PC, I can never detect the device (COM port) in Device Manager.

Also, after I connect the Type-C cable, the Kernel still shows "Disconnected," even though the related Vbus is detected as HIGH.

root@am65xx-evm:~# modprobe g_serial
[  195.827441] g_serial gadget.0: Gadget Serial v2.4
[  195.827461] g_serial gadget.0: g_serial ready
root@am65xx-evm:~# ls /dev/ttyGS*
/dev/ttyGS0
root@am65xx-evm:~#

root@am65xx-evm:/sys/kernel/config/usb_gadget/g1# gpioget gpiochip0 5

1

root@am65xx-evm:/sys/kernel/config/usb_gadget/g1# cat /sys/kernel/debug/usb/4010000.usb/link_state

Disconnected

The relevant device tree settings are below. Can someone tell me how to fix this?

&wkup_pmx0{

usb5vsignal_pins_default: usb5vsignal_pins_default {
		pinctrl-single,pins = <
			AM65X_WKUP_IOPAD(0x00c4, PIN_INPUT, 7) /* (AD3) WKUP_GPIO0_5 */
		>;
	};

}

&usb0_phy {
	status = "okay";
};

//typeC interface
&usb0 {
	status = "okay";
	pinctrl-names = "default";
	//pinctrl-0 = <&usb0_pins_default>;
	pinctrl-0 = <&usb5vsignal_pins_default>;
	vbus-gpios = <&wkup_gpio0 5 GPIO_ACTIVE_HIGH>;
	dr_mode = "peripheral";
};

&dwc3_0 {
	status = "okay";
};

  • Hi YunEn,

    Please attach the USB section of your board schematics, including all the connections from AM65x to the USB receptacle.

  • Hi Bin Liu , 

    I have a circuit diagram for a USB Type-C interface, as shown in the image as USB0. Can you tell me how to solve the problem?

  • When you connect AM65x USB0 type-C port to a PC, do you measure the USB0_VBUS pin on AM65x to have 5v?

  • My analysis is that the state is "not attached," which means the host has not detected the device. However, gpioget gpiochip0 5 returns 1, which is the VBUS detect pin, indicating that the hardware actually detects the host's 5V. Therefore, I believe the problem is that although there is power on the hardware, the Device Tree Source (DTS) does not properly inform the dwc3 driver about the VBUS detect GPIO or the regulator. As a result, the controller is permanently stuck in the "not attached" state.

    But I'm not sure how I should modify my Device Tree to fix this.

    root@am65xx-evm:~# cat /sys/class/udc/4010000.usb/state 
    not attached
    
    root@am65xx-evm:~# gpioget gpiochip0 5 
    1
    
    root@am65xx-evm:~# dmesg | grep -i -E 'dwc3|g_serial|udc|gadget' 
    [ 2321.461199] udc 4010000.usb: soft-connect without a gadget driver 
    [ 2373.249089] g_serial gadget.0: Gadget Serial v2.4 [ 2373.249109] g_serial gadget.0: g_serial ready 
    [ 2387.078122] udc 4010000.usb: UDC had already started

  • To provide additional context, I have upgraded from Kernel 5.x to Kernel 6.1 (the latest TI SDK 09_03_05_02). On the hardware side, I tested using the old BSP version, and everything worked correctly.

    However, when testing with the 6.1 DTS, issues appeared. Attached is the DTS file from the 5.x version.

    Currently, the device tree configuration related to typeC (USB0), including Pinctrl and usb0_phy dwc3_0, is identical to the 5.1 DTS. I have verified that USB0_VBUS indeed has 5V, and using gpioget gpiochip0 5 returns 1.

    However, the UDC status always shows:

    > cat /sys/kernel/debug/usb/4010000.usb/link_state
    Disconnected
    
    > cat /sys/class/udc/status
    not attached
    

    I suspect that the issue may be with dwc3 or that the kernel is not correctly using the GPIO I configured (AD3 WKUP_GPIO0_5) as VBUS. Perhaps it is simply being treated as a regular GPIO, and therefore cannot drive USB correctly.

    If there is a solution or if you need any additional information, please let me know. Thank you very much!

    Kernel 5.1 Dts :

    // SPDX-License-Identifier: GPL-2.0
    /*
     * Copyright (C) 2016-2018 Texas Instruments Incorporated - http://www.ti.com/
     */
    
    /dts-v1/;
    
    #include "k3-am654.dtsi"
    #include <dt-bindings/input/input.h>
    #include <dt-bindings/net/ti-dp83867.h>
    
    / {
    	compatible =  "ti,am654-evm", "ti,am654";
    	model = "Texas Instruments AM654 Base Board";
    
    	aliases {
    		ethernet1 = &pruss1_emac0; //Ethernet port 0
    		//ethernet2 = &pruss1_emac1; //EtherCAT port 1
    		ethernet2 = &pruss2_emac0; //Ethernet port 1
    	};
    
    	chosen {
    		stdout-path = "serial2:115200n8";
    		bootargs = "earlycon=ns16550a,mmio32,0x02800000";
    	};
    
    	memory@80000000 {
    		device_type = "memory";
    #if 0
    			/* 4G RAM */
    			reg = <0x00000000 0x80000000 0x00000000 0x80000000>,
    				<0x00000008 0x80000000 0x00000000 0x80000000>;
    #endif
    			/* 1G RAM */
    			reg = <0x00000000 0x80000000 0x00000000 0x40000000>;
            };
    
    	reserved_memory: reserved-memory {
    		#address-cells = <2>;
    		#size-cells = <2>;
    		ranges;
    
    		secure_ddr: secure_ddr@9e800000 {
    			reg = <0 0x9e800000 0 0x01800000>; /* for OP-TEE */
    			alignment = <0x1000>;
    			no-map;
    		};
    
    		mcu_r5fss0_core0_dma_memory_region: r5f-dma-memory@a0000000 {
    			compatible = "shared-dma-pool";
    			reg = <0 0xa0000000 0 0x100000>;
    			no-map;
    		};
    
    		mcu_r5fss0_core0_memory_region: r5f-memory@a0100000 {
    			compatible = "shared-dma-pool";
    			reg = <0 0xa0100000 0 0xf00000>;
    			no-map;
    		};
    
    		mcu_r5fss0_core1_dma_memory_region: r5f-dma-memory@a1000000 {
    			compatible = "shared-dma-pool";
    			reg = <0 0xa1000000 0 0x100000>;
    			no-map;
    		};
    
    		mcu_r5fss0_core1_memory_region: r5f-memory@a1100000 {
    			compatible = "shared-dma-pool";
    			reg = <0 0xa1100000 0 0xf00000>;
    			no-map;
    		};
    
    		rtos_ipc_memory_region: ipc-memories@a2000000 {
    			reg = <0x00 0xa2000000 0x00 0x00200000>;
    			alignment = <0x1000>;
    			no-map;
    		};
    	};
    
    	eeprom_gpio: eeprom_gpio {
    		compatible = "eeprom-gpio";
    		eeprom-gpio = <&wkup_gpio0 7 GPIO_ACTIVE_HIGH>;
    	};
    
    	clk_ov5640_fixed: fixed-clock-ov5640 {
    		compatible = "fixed-clock";
    		#clock-cells = <0>;
    		clock-frequency = <24000000>;
    	};
    
    	leds {
    		pinctrl-names = "default";
    		pinctrl-0 = <&ledgpio0_pins_default &ledgpio1_pins_default &ledgpio2_pins_default>;
    
    		compatible = "gpio-leds";
    
    		led1 {
    			label = "LED-RUN";
    			gpios = <&main_gpio0 27 GPIO_ACTIVE_LOW>;
    		};
    
    		led2 {
    			label = "LED-ERR";
    			gpios = <&main_gpio1 70 GPIO_ACTIVE_HIGH>;
    		};
    
    		led3 {
    			label = "LED-BUS";
    			gpios = <&main_gpio1 48 GPIO_ACTIVE_HIGH>;
    		};
    
    		led4 {
    			label = "LED-232TX";
    			gpios = <&main_gpio1 21 GPIO_ACTIVE_HIGH>;
    		};
    
    		led5 {
    			label = "LED-232RX";
    			gpios = <&main_gpio0 26 GPIO_ACTIVE_HIGH>;
    		};
    
    		led6 {
    			label = "LED-485TX";
    			gpios = <&main_gpio1 87 GPIO_ACTIVE_HIGH>;
    		};
    
    		led7 {
    			label = "LED-485RX";
    			gpios = <&main_gpio1 46 GPIO_ACTIVE_HIGH>;
    		};
    
    		led8 {
    			label = "LED-SD";
    			gpios = <&main_gpio0 23 GPIO_ACTIVE_HIGH>;
    		};
    	};
    
    	//Eric+{
    		/* Dual Ethernet application node on PRU-ICSSG1 */
    	pruss1_eth: pruss1_eth {
    		compatible = "ti,am654-icssg-prueth";
    		pinctrl-names = "default";
    		pinctrl-0 = <&ethernet0_pins_default>;
    		sram = <&msmc_ram>;
    		prus = <&pru1_0>, <&rtu1_0>, <&tx_pru1_0>,
    				<&pru1_1>, <&rtu1_1>, <&tx_pru1_1>;
    		firmware-name = "ti-pruss/am65x-sr2-pru0-prueth-fw.elf",
    				"ti-pruss/am65x-sr2-rtu0-prueth-fw.elf",
    				"ti-pruss/am65x-sr2-txpru0-prueth-fw.elf",
    				"ti-pruss/am65x-sr2-pru1-prueth-fw.elf",
    				"ti-pruss/am65x-sr2-rtu1-prueth-fw.elf",
    				"ti-pruss/am65x-sr2-txpru1-prueth-fw.elf";
    
    		ti,pruss-gp-mux-sel = <2>,      /* MII mode */
    						<2>,
    						<2>,
    						<2>,      /* MII mode */
    						<2>,
    						<2>;
    		mii-g-rt = <&icssg1_mii_g_rt>;
    		mii-rt = <&icssg1_mii_rt>;
    		dma-coherent;
    		dmas = <&main_udmap 0xc200>, /* egress slice 0 */
    			   <&main_udmap 0xc201>, /* egress slice 0 */
    			   <&main_udmap 0xc202>, /* egress slice 0 */
    			   <&main_udmap 0xc203>, /* egress slice 0 */
    			   <&main_udmap 0xc204>, /* egress slice 1 */
    			   <&main_udmap 0xc205>, /* egress slice 1 */
    			   <&main_udmap 0xc206>, /* egress slice 1 */
    			   <&main_udmap 0xc207>, /* egress slice 1 */
    
    			   <&main_udmap 0x4200>, /* ingress slice 0 */
    			   <&main_udmap 0x4201>, /* ingress slice 1 */
    			   <&main_udmap 0x4202>, /* mgmnt rsp slice 0 */
    			   <&main_udmap 0x4203>; /* mgmnt rsp slice 1 */
    		dma-names = "tx0-0", "tx0-1", "tx0-2", "tx0-3",
    					"tx1-0", "tx1-1", "tx1-2", "tx1-3",
    					"rx0", "rx1",
    					"rxmgm0", "rxmgm1";
    
            pruss1_emac0: ethernet-mii0 {
                    phy-handle = <&pruss1_eth0_phy>;
                    phy-mode = "rgmii-rxid";
                    ti,half-duplex-capable;
                    interrupts-extended = <&icssg1_intc 24>;
                    syscon-rgmii-delay = <&scm_conf 0x4110>;
                    iep = <&icssg1_iep0>;
                    /* Filled in by bootloader */
                    local-mac-address = [00 00 00 00 00 00];
            };
    #if 0
            pruss1_emac1: ethernet-mii1 {
                    phy-handle = <&pruss1_eth1_phy>;
                    phy-mode = "rgmii-rxid";
                    interrupts-extended = <&icssg1_intc 25>;
                    syscon-rgmii-delay = <&scm_conf 0x4114>;
                    /* Filled in by bootloader */
                    local-mac-address = [00 00 00 00 00 00];
            };
    #endif
    	};
    	//Eric+}
    
    	/* Single Ethernet application node on PRU-ICSSG2 */ 
    	pruss2_eth: pruss2_eth {
    		compatible = "ti,am654-icssg-prueth";
    		pinctrl-names = "default";
    		pinctrl-0 = <&ethernet1_pins_default>;
    		sram = <&msmc_ram>;
    		prus = <&pru2_0>, <&rtu2_0>, <&tx_pru2_0>,
    			<&pru2_1>, <&rtu2_1>, <&tx_pru2_1>;
    		firmware-name = "ti-pruss/am65x-sr2-pru0-prueth-fw.elf",
    				"ti-pruss/am65x-sr2-rtu0-prueth-fw.elf",
    				"ti-pruss/am65x-sr2-txpru0-prueth-fw.elf",
    				"ti-pruss/am65x-sr2-pru1-prueth-fw.elf",
    				"ti-pruss/am65x-sr2-rtu1-prueth-fw.elf",
    				"ti-pruss/am65x-sr2-txpru1-prueth-fw.elf";
    
    		ti,pruss-gp-mux-sel = <2>,      /* MII mode */
    				      <2>,
    				      <2>,
    				      <2>,	/* MII mode */
    				      <2>,
    				      <2>;
    		mii-g-rt = <&icssg2_mii_g_rt>;
    		mii-rt = <&icssg2_mii_rt>;
    		dma-coherent;
    		dmas = <&main_udmap 0xc300>, /* egress slice 0 */
    		       <&main_udmap 0xc301>, /* egress slice 0 */
    		       <&main_udmap 0xc302>, /* egress slice 0 */
    		       <&main_udmap 0xc303>, /* egress slice 0 */
    		       <&main_udmap 0xc304>, /* egress slice 1 */
    		       <&main_udmap 0xc305>, /* egress slice 1 */
    		       <&main_udmap 0xc306>, /* egress slice 1 */
    		       <&main_udmap 0xc307>, /* egress slice 1 */
    
    		       <&main_udmap 0x4300>, /* ingress slice 0 */
    		       <&main_udmap 0x4301>, /* ingress slice 1 */
    		       <&main_udmap 0x4302>, /* mgmnt rsp slice 0 */
    		       <&main_udmap 0x4303>; /* mgmnt rsp slice 1 */
    		dma-names = "tx0-0", "tx0-1", "tx0-2", "tx0-3",
    			    "tx1-0", "tx1-1", "tx1-2", "tx1-3",
    			    "rx0", "rx1",
    			    "rxmgm0", "rxmgm1";
    
    		pruss2_emac0: ethernet-mii0 {
    			phy-handle = <&pruss2_eth0_phy>;
    			phy-mode = "rgmii-rxid";
    			ti,half-duplex-capable;
    			interrupts-extended = <&icssg2_intc 24>;
    			syscon-rgmii-delay = <&scm_conf 0x4120>;
    			iep = <&icssg2_iep0>;
    			/* Filled in by bootloader */
    			local-mac-address = [00 00 00 00 00 00];
    		};
    	};
    };
    
    &wkup_pmx0 {
    	pinctrl-names = "default";
    	pinctrl-0 = <&eepromdone_pins_default &iovolctrl_pins_default &vbusctrl_pins_default &mcuboot_pins_default>;
    
    	phy2ax58100_pins_default: phy2ax58100_pins_default {
    		pinctrl-single,pins = <
    			AM65X_WKUP_IOPAD(0x0058, PIN_INPUT, 1) /* (N4) MCU_RGMII1_TX_CTL.MCU_RMII1_CRS_DV */
    			AM65X_WKUP_IOPAD(0x005c, PIN_INPUT, 1) /* (N5) MCU_RGMII1_RX_CTL.MCU_RMII1_RX_ER */
    			AM65X_WKUP_IOPAD(0x0068, PIN_OUTPUT, 1) /* (M4) MCU_RGMII1_TD1.MCU_RMII1_TXD1 */
    			AM65X_WKUP_IOPAD(0x006c, PIN_OUTPUT, 1) /* (M5) MCU_RGMII1_TD0.MCU_RMII1_TXD0 */
    			AM65X_WKUP_IOPAD(0x0080, PIN_INPUT, 1) /* (M6) MCU_RGMII1_RD1.MCU_RMII1_RXD1 */
    			AM65X_WKUP_IOPAD(0x0084, PIN_INPUT, 1) /* (L6) MCU_RGMII1_RD0.MCU_RMII1_RXD0 */
    			AM65X_WKUP_IOPAD(0x0070, PIN_OUTPUT, 1) /* (N1) MCU_RGMII1_TXC.MCU_RMII1_TX_EN */
    			AM65X_WKUP_IOPAD(0x0074, PIN_INPUT, 1) /* (M1) MCU_RGMII1_RXC.MCU_RMII1_REF_CLK */
    		>;
    	};
    
    	mcan0_pins_default: mcan0_pins_default {
    		pinctrl-single,pins = <
    			AM65X_WKUP_IOPAD(0x00ac, PIN_INPUT, 0) /* (W2) MCU_MCAN0_RX */
    			AM65X_WKUP_IOPAD(0x00a8, PIN_OUTPUT, 0) /* (W1) MCU_MCAN0_TX */
    		>;
    	};
    
    	phy2ax58100_mdio2_pins_default: phy2ax58100_mdio2_pins_default {
    		pinctrl-single,pins = <
    			AM65X_WKUP_IOPAD(0x008c, PIN_OUTPUT, 0) /* (L1) MCU_MDIO0_MDC */
    			AM65X_WKUP_IOPAD(0x0088, PIN_INPUT, 0) /* (L4) MCU_MDIO0_MDIO */
    		>;
    	};
    
    	usb5vsignal_pins_default: usb5vsignal_pins_default {
    		pinctrl-single,pins = <
    			AM65X_WKUP_IOPAD(0x00c4, PIN_INPUT, 7) /* (AD3) WKUP_GPIO0_5 */
    		>;
    	};
    
    	iovolctrl_pins_default: iovolctrl_pins_default {
    		pinctrl-single,pins = <
    			AM65X_WKUP_IOPAD(0x00c8, PIN_OUTPUT, 7) /* (AC2) WKUP_GPIO0_6 */ /*IO_VOLCTRL*/
    		>;
    	};
    
    	eepromdone_pins_default: eepromdone_pins_default {
    		pinctrl-single,pins = <
    			AM65X_WKUP_IOPAD(0x00cc, PIN_INPUT, 7) /* (AC1) WKUP_GPIO0_7 */ /*EEP_DONE*/
    		>;
    	};
    
    	vbusctrl_pins_default: vbusctrl_pins_default {
    		pinctrl-single,pins = <
    			AM65X_WKUP_IOPAD(0x00D8, PIN_OUTPUT, 7) /* (AB3) WKUP_GPIO0_10 */ /*USBVBUSCTRL*/
    		>;
    	};
    
        mcuboot_pins_default: mcuboot_pins_default {
    		pinctrl-single,pins = <
    			AM65X_WKUP_IOPAD(0x00B0, PIN_INPUT, 7) /* (AF4) WKUP_GPIO0_0 */ /*MCU-BOOT0*/
                AM65X_WKUP_IOPAD(0x00B4, PIN_INPUT, 7) /* (AF3) WKUP_GPIO0_1 */ /*MCU-BOOT1*/
                AM65X_WKUP_IOPAD(0x00B8, PIN_INPUT_PULLDOWN, 7) /* (AE3) WKUP_GPIO0_2 */ /*MCU-BOOT2*/
                AM65X_WKUP_IOPAD(0x00BC, PIN_INPUT_PULLDOWN, 7) /* (AD1) WKUP_GPIO0_3 */ /*MCU-BOOT3*/
                AM65X_WKUP_IOPAD(0x00C0, PIN_INPUT_PULLDOWN, 7) /* (AC3) WKUP_GPIO0_4 */ /*MCU-BOOT4*/
                AM65X_WKUP_IOPAD(0x00D0, PIN_INPUT_PULLDOWN, 7) /* (AC5) WKUP_GPIO0_8 */ /*MCU-BOOT8*/
                AM65X_WKUP_IOPAD(0x00D4, PIN_INPUT, 7) /* (AB4) WKUP_GPIO0_9 */ /*MCU-BOOT9*/
                AM65X_WKUP_IOPAD(0x0098, PIN_INPUT_PULLDOWN, 7) /* (Y2) */ /*MCU-BOOT5*/
                AM65X_WKUP_IOPAD(0x0090, PIN_INPUT_PULLDOWN, 7) /* (Y1) */ /*MCU-BOOT6*/
                AM65X_WKUP_IOPAD(0x0094, PIN_INPUT_PULLDOWN, 7) /* (Y3) */ /*MCU-BOOT7*/
    		>;
    	};
    };
    
    &main_pmx0 {
    	pinctrl-names = "default";
    	pinctrl-0 = <&gpio0_pins_default &gpio1_pins_default>;
    
    	gpio1_pins_default: gpio1_pins_default {
    		pinctrl-single,pins = <
    			AM65X_IOPAD(0x01ec, PIN_OUTPUT, 7)  /* (AG11) GPIO1_27 */ /*Latch*/
    			AM65X_IOPAD(0x01f0, PIN_INPUT, 7)   /* (AD11) GPIO1_28 */ /*/DO-FAULT*/
    			AM65X_IOPAD(0x01f4, PIN_INPUT, 1)   /* (V24) PRG0_PRU0_GPO0.GPIO1_29 */
    			AM65X_IOPAD(0x01f8, PIN_INPUT, 1)   /* (W25) PRG0_PRU0_GPO1.GPIO1_30 */
    			AM65X_IOPAD(0x01fc, PIN_INPUT, 1)   /* (W24) PRG0_PRU0_GPO2.GPIO1_31 */
    			AM65X_IOPAD(0x0200, PIN_INPUT, 1)   /* (AA27) PRG0_PRU0_GPO3.GPIO1_32 */
    			AM65X_IOPAD(0x0204, PIN_INPUT, 1)   /* (Y24) PRG0_PRU0_GPO4.GPIO1_33 */
    			AM65X_IOPAD(0x0208, PIN_INPUT, 1)   /* (V28) PRG0_PRU0_GPO5.GPIO1_34 */
    			AM65X_IOPAD(0x020c, PIN_INPUT, 1)   /* (Y25) PRG0_PRU0_GPO6.GPIO1_35 */
    			AM65X_IOPAD(0x0210, PIN_INPUT, 1)   /* (U27) PRG0_PRU0_GPO7.GPIO1_36 */
    			AM65X_IOPAD(0x0214, PIN_INPUT, 7)   /* (V27) PRG0_PRU0_GPO8.GPIO1_37 */
    			AM65X_IOPAD(0x0218, PIN_INPUT, 7)   /* (V26) PRG0_PRU0_GPO9.GPIO1_38 */
    			AM65X_IOPAD(0x021c, PIN_INPUT, 7)   /* (U25) PRG0_PRU0_GPO10.GPIO1_39 */
    			AM65X_IOPAD(0x0220, PIN_INPUT, 7)   /* (AB25) PRG0_PRU0_GPO11.GPIO1_40 */
    			AM65X_IOPAD(0x0224, PIN_INPUT, 7)   /* (AD27) PRG0_PRU0_GPO12.GPIO1_41 */
    			AM65X_IOPAD(0x0228, PIN_INPUT, 7)   /* (AC26) PRG0_PRU0_GPO13.GPIO1_42 */
    			AM65X_IOPAD(0x022c, PIN_INPUT, 7)   /* (AD26) PRG0_PRU0_GPO14.GPIO1_43 */
    			AM65X_IOPAD(0x0230, PIN_INPUT, 7)   /* (AA24) PRG0_PRU0_GPO15.GPIO1_44 */
    			AM65X_IOPAD(0x0234, PIN_INPUT, 1)   /* (AD28) GPIO1_45 */ /*HS_PRU0_LV*/
    			AM65X_IOPAD(0x023C, PIN_OUTPUT, 7)   /* (V25) GPIO1_47 */ /*HS_PRU0_IRQ*/
    			AM65X_IOPAD(0x0244, PIN_OUTPUT_PULLDOWN, 7) /* (AB28) PRG0_PRU1_GPO0.GPIO1_49 */ /*****************************************************************************/
    			AM65X_IOPAD(0x0248, PIN_OUTPUT_PULLDOWN, 7) /* (AC28) PRG0_PRU1_GPO1.GPIO1_50 */ /*We set the mode as 7 due to PRU cannot control default status of output pin*/
    			AM65X_IOPAD(0x024c, PIN_OUTPUT_PULLDOWN, 7) /* (AC27) PRG0_PRU1_GPO2.GPIO1_51 */ /*And we set the mode back to 0 using memdev2 after PRU init*/
    			AM65X_IOPAD(0x0250, PIN_OUTPUT_PULLDOWN, 7) /* (AB26) PRG0_PRU1_GPO3.GPIO1_52 */ /*****************************************************************************/
    			AM65X_IOPAD(0x0284, PIN_INPUT, 7)   /* (AC24) GPIO1_65 */
    			AM65X_IOPAD(0x0290, PIN_INPUT, 7)   /* (W26) GPIO1_68 */
    			AM65X_IOPAD(0x0294, PIN_INPUT, 7)   /* (AE26) GPIO1_69 */
    			AM65X_IOPAD(0x01d0, PIN_OUTPUT_PULLDOWN, 7) /* (AD12) GPIO1_20 */ /*SEL-OUT*/
    		>;
    	};
    
    	ledgpio1_pins_default: ledgpio1_pins_default {
    		pinctrl-single,pins = <
    			AM65X_IOPAD(0x01d4, PIN_OUTPUT, 7)  /* (AG12) GPIO1_21 */ /* RS232-TX-LED */
    			AM65X_IOPAD(0x0238, PIN_OUTPUT, 7)  /* (U26) GPIO1_46 */ /* RS485-RX-LED */
    			AM65X_IOPAD(0x0240, PIN_OUTPUT, 7)  /* (U24) GPIO1_48 */ /* BUSFAULT-LED */
    			AM65X_IOPAD(0x0298, PIN_OUTPUT, 7)  /* (AE28) GPIO1_70 */ /* ERROR-LED */
    		>;
    	};
    
    	gpio0_pins_default: gpio0_pins_default {
    		pinctrl-single,pins = <
    			AM65X_IOPAD(0x0040, PIN_OUTPUT, 7)  /* (R28) GPIO0_16 */ /*ETH1-PHY-RESET*/
    			AM65X_IOPAD(0x0058, PIN_INPUT, 7)   /* (R26) GPIO0_22 */ /*RUN/STOP SW*/
    			AM65X_IOPAD(0x005c, PIN_OUTPUT, 7)  /* (R23) GPIO0_23 */ /* SD-CARD-READY-LED */
    			AM65X_IOPAD(0x0060, PIN_OUTPUT, 7)  /* (T25) GPIO0_24 */ /*/AX58100-RST*/
    			AM65X_IOPAD(0x0064, PIN_OUTPUT, 7)  /* (T24) GPIO0_25 */ /*/AX58100-PYH-RST*/
    			AM65X_IOPAD(0x0068, PIN_OUTPUT, 7)  /* (R24) GPIO0_26 */ /* RS232-RX-LED */
    			AM65X_IOPAD(0x0070, PIN_OUTPUT, 7)  /* (R25) GPIO0_28 */ /*GPIO-eMMC-RST*/
    			AM65X_IOPAD(0x0074, PIN_INPUT, 7)   /* (T27) GPIO0_29 */ /*/24V-LV*/
    			AM65X_IOPAD(0x00ac, PIN_INPUT, 1)   /* (AH15) PRG2_PRU1_GPO0.GPIO0_43 */
    			AM65X_IOPAD(0x00b0, PIN_INPUT, 1)   /* (AC16) PRG2_PRU1_GPO1.GPIO0_44 */
    			AM65X_IOPAD(0x00b4, PIN_INPUT, 1)   /* (AD17) PRG2_PRU1_GPO2.GPIO0_45 */
    			AM65X_IOPAD(0x00b8, PIN_INPUT, 1)   /* (AH14) PRG2_PRU1_GPO3.GPIO0_46 */
    			AM65X_IOPAD(0x00d4, PIN_OUTPUT, 7)  /* (AC15) GPIO0_53 */ /*CAN-TERM*/
    			AM65X_IOPAD(0x00d8, PIN_INPUT, 1)   /* (AD14) GPIO0_54 */ /*HS_PRU2_LV*/
    			AM65X_IOPAD(0x00dc, PIN_OUTPUT, 7)   /* (AE14) GPIO0_55 */ /*HS_PRU2_IRQ*/
    			AM65X_IOPAD(0x00f4, PIN_INPUT | PIN_OUTPUT, 7)   /* (AF27) GPIO0_61 */ /*PRU0-IRQ*/
    			AM65X_IOPAD(0x00fc, PIN_INPUT | PIN_OUTPUT, 7)   /* (AG27) GPIO0_63 */ /*PRU2-IRQ*/
    			AM65X_IOPAD(0x0108, PIN_OUTPUT, 7)  /* (AH25) GPIO0_66 */ /*ETH0-PHY-RESET*/
    			AM65X_IOPAD(0x0124, PIN_OUTPUT, 7)  /* (AH26) GPIO0_73 */ /*ECAT2-PHY-RST*/
    
                AM65X_IOPAD(0x0000, PIN_INPUT_PULLDOWN, 7)  /* (M27) GPIO0_0 */
                AM65X_IOPAD(0x0004, PIN_INPUT, 7)  /* (M23) GPIO0_1 */
                AM65X_IOPAD(0x0008, PIN_INPUT, 7)  /* (M28) GPIO0_2 */
                AM65X_IOPAD(0x000C, PIN_INPUT_PULLDOWN, 7)  /* (M24) GPIO0_3 */
                AM65X_IOPAD(0x0010, PIN_INPUT_PULLDOWN, 7)  /* (N24) GPIO0_4 */
                AM65X_IOPAD(0x0014, PIN_INPUT_PULLDOWN, 7)  /* (N27) GPIO0_5 */
                AM65X_IOPAD(0x0018, PIN_INPUT, 7)  /* (N28) GPIO0_6 */
                AM65X_IOPAD(0x001C, PIN_INPUT_PULLDOWN, 7)  /* (M25) GPIO0_7 */
                AM65X_IOPAD(0x0020, PIN_INPUT_PULLDOWN, 7)  /* (N23) GPIO0_8 */
                AM65X_IOPAD(0x0024, PIN_INPUT_PULLDOWN, 7)  /* (M26) GPIO0_9 */
                AM65X_IOPAD(0x0028, PIN_INPUT_PULLDOWN, 7)  /* (P28) GPIO0_10 */
                AM65X_IOPAD(0x002C, PIN_INPUT_PULLDOWN, 7)  /* (P27) GPIO0_11 */
                AM65X_IOPAD(0x0030, PIN_INPUT_PULLDOWN, 7)  /* (N26) GPIO0_12 */
                AM65X_IOPAD(0x0034, PIN_INPUT, 7)  /* (N25) GPIO0_13 */
                AM65X_IOPAD(0x0038, PIN_INPUT_PULLDOWN, 7)  /* (P24) GPIO0_14 */
                AM65X_IOPAD(0x003C, PIN_INPUT_PULLDOWN, 7)  /* (R27) GPIO0_15 */
                AM65X_IOPAD(0x0044, PIN_INPUT_PULLDOWN, 7)  /* (P25) GPIO0_17 */
                AM65X_IOPAD(0x0048, PIN_INPUT, 7)  /* (P26) GPIO0_18 */
                AM65X_IOPAD(0x004C, PIN_INPUT, 7)  /* (U28) GPIO0_19 */
    		>;
    	};
    
    	ledgpio0_pins_default: ledgpio0_pins_default {
    		pinctrl-single,pins = <
    			AM65X_IOPAD(0x006c, PIN_OUTPUT | PIN_INPUT, 7) /* (T23) GPIO0_27 */ /* RUN-LED */
    		>;
    	};
    
    	main_mmc0_pins_default: main-mmc0-pins-default {
    		pinctrl-single,pins = <
    			AM65X_IOPAD(0x01a8, PIN_INPUT_PULLDOWN, 0) /* (B25) MMC0_CLK */
    			AM65X_IOPAD(0x01ac, PIN_INPUT_PULLUP, 0) /* (B27) MMC0_CMD */
    			AM65X_IOPAD(0x01a4, PIN_INPUT_PULLUP, 0) /* (A26) MMC0_DAT0 */
    			AM65X_IOPAD(0x01a0, PIN_INPUT_PULLUP, 0) /* (E25) MMC0_DAT1 */
    			AM65X_IOPAD(0x019c, PIN_INPUT_PULLUP, 0) /* (C26) MMC0_DAT2 */
    			AM65X_IOPAD(0x0198, PIN_INPUT_PULLUP, 0) /* (A25) MMC0_DAT3 */
    			AM65X_IOPAD(0x0194, PIN_INPUT_PULLUP, 0) /* (E24) MMC0_DAT4 */
    			AM65X_IOPAD(0x0190, PIN_INPUT_PULLUP, 0) /* (A24) MMC0_DAT5 */
    			AM65X_IOPAD(0x018c, PIN_INPUT_PULLUP, 0) /* (B26) MMC0_DAT6 */
    			AM65X_IOPAD(0x0188, PIN_INPUT_PULLUP, 0) /* (D25) MMC0_DAT7 */
    			AM65X_IOPAD(0x01b0, PIN_INPUT, 0) /* (C25) MMC0_DS */
    		>;
    	};
    
    	main_mmc1_pins_default: main-mmc1-pins-default {
    		pinctrl-single,pins = <
    			AM65X_IOPAD(0x02d4, PIN_INPUT_PULLDOWN, 0) /* (C27) MMC1_CLK */
    			AM65X_IOPAD(0x02d8, PIN_INPUT_PULLUP, 0) /* (C28) MMC1_CMD */
    			AM65X_IOPAD(0x02d0, PIN_INPUT_PULLUP, 0) /* (D28) MMC1_DAT0 */
    			AM65X_IOPAD(0x02cc, PIN_INPUT_PULLUP, 0) /* (E27) MMC1_DAT1 */
    			AM65X_IOPAD(0x02c8, PIN_INPUT_PULLUP, 0) /* (D26) MMC1_DAT2 */
    			AM65X_IOPAD(0x02c4, PIN_INPUT_PULLUP, 0) /* (D27) MMC1_DAT3 */
    			AM65X_IOPAD(0x02dc, PIN_INPUT_PULLUP, 0) /* (B24) MMC1_SDCD */
    			AM65X_IOPAD(0x02e0, PIN_INPUT, 0) /* (C24) MMC1_SDWP */
    		>;
    	};
    
    	icssg1_mdio_pins_default: icssg1_mdio_pins_default {
    		pinctrl-single,pins = <
    			AM65X_IOPAD(0x0180, PIN_INPUT, 0) /* (AD18) PRG1_MDIO0_MDIO */
    			AM65X_IOPAD(0x0184, PIN_OUTPUT, 0) /* (AH18) PRG1_MDIO0_MDC */
    		>;
    	};
    
    	ethernet0_pins_default: ethernet0_pins_default {
    		pinctrl-single,pins = <
    			AM65X_IOPAD(0x00e0, PIN_INPUT, 2) /* (AE22) PRG1_PRU0_GPO0.PRG1_RGMII1_RD0 */
    			AM65X_IOPAD(0x00e4, PIN_INPUT, 2) /* (AG24) PRG1_PRU0_GPO1.PRG1_RGMII1_RD1 */
    			AM65X_IOPAD(0x00e8, PIN_INPUT, 2) /* (AF23) PRG1_PRU0_GPO2.PRG1_RGMII1_RD2 */
    			AM65X_IOPAD(0x00ec, PIN_INPUT, 2) /* (AD21) PRG1_PRU0_GPO3.PRG1_RGMII1_RD3 */
    			AM65X_IOPAD(0x0110, PIN_OUTPUT, 2) /* (AH20) PRG1_PRU0_GPO12.PRG1_RGMII1_TD0 */
    			AM65X_IOPAD(0x0114, PIN_OUTPUT, 2) /* (AH21) PRG1_PRU0_GPO13.PRG1_RGMII1_TD1 */
    			AM65X_IOPAD(0x0118, PIN_OUTPUT, 2) /* (AG20) PRG1_PRU0_GPO14.PRG1_RGMII1_TD2 */
    			AM65X_IOPAD(0x011c, PIN_OUTPUT, 2) /* (AD19) PRG1_PRU0_GPO15.PRG1_RGMII1_TD3 */
    			AM65X_IOPAD(0x0120, PIN_INPUT, 2) /* (AD20) PRG1_PRU0_GPO16.PRG1_RGMII1_TXC */
    			AM65X_IOPAD(0x010c, PIN_OUTPUT, 2) /* (AF21) PRG1_PRU0_GPO11.PRG1_RGMII1_TX_CTL */
    			AM65X_IOPAD(0x00f8, PIN_INPUT, 2) /* (AF22) PRG1_PRU0_GPO6.PRG1_RGMII1_RXC */
    			AM65X_IOPAD(0x00f0, PIN_INPUT, 2) /* (AG23) PRG1_PRU0_GPO4.PRG1_RGMII1_RX_CTL */
    
    			//ethercat1_pins_default
    			AM65X_IOPAD(0x0130, PIN_INPUT, 2) /* (AH24) PRG1_PRU1_GPO0.PRG1_RGMII2_RD0 */
    			AM65X_IOPAD(0x0134, PIN_INPUT, 2) /* (AH23) PRG1_PRU1_GPO1.PRG1_RGMII2_RD1 */
    			AM65X_IOPAD(0x0138, PIN_INPUT, 2) /* (AG21) PRG1_PRU1_GPO2.PRG1_RGMII2_RD2 */
    			AM65X_IOPAD(0x013c, PIN_INPUT, 2) /* (AH22) PRG1_PRU1_GPO3.PRG1_RGMII2_RD3 */
    			AM65X_IOPAD(0x0160, PIN_OUTPUT, 2) /* (AE20) PRG1_PRU1_GPO12.PRG1_RGMII2_TD0 */
    			AM65X_IOPAD(0x0164, PIN_OUTPUT, 2) /* (AF19) PRG1_PRU1_GPO13.PRG1_RGMII2_TD1 */
    			AM65X_IOPAD(0x0168, PIN_OUTPUT, 2) /* (AH19) PRG1_PRU1_GPO14.PRG1_RGMII2_TD2 */
    			AM65X_IOPAD(0x016c, PIN_OUTPUT, 2) /* (AG19) PRG1_PRU1_GPO15.PRG1_RGMII2_TD3 */
    			AM65X_IOPAD(0x0170, PIN_INPUT, 2) /* (AE19) PRG1_PRU1_GPO16.PRG1_RGMII2_TXC */
    			AM65X_IOPAD(0x015c, PIN_OUTPUT, 2) /* (AC20) PRG1_PRU1_GPO11.PRG1_RGMII2_TX_CTL */
    			AM65X_IOPAD(0x0148, PIN_INPUT, 2) /* (AG22) PRG1_PRU1_GPO6.PRG1_RGMII2_RXC */
    			AM65X_IOPAD(0x0140, PIN_INPUT, 2) /* (AE21) PRG1_PRU1_GPO4.PRG1_RGMII2_RX_CTL */
    		>;
    	};
    
    	icssg2_mdio_pins_default: icssg2_mdio_pins_default {
    		pinctrl-single,pins = <
    			AM65X_IOPAD(0x0094, PIN_INPUT, 2) /* (AC19) PRG2_PRU0_GPO7.PRG2_MDIO0_MDIO */
    			AM65X_IOPAD(0x00c8, PIN_OUTPUT, 2) /* (AE15) PRG2_PRU1_GPO7.PRG2_MDIO0_MDC */
    		>;
    	};
    
    	ethernet1_pins_default: ethernet1_pins_default {
    		pinctrl-single,pins = <
    			AM65X_IOPAD(0x0078, PIN_INPUT, 2) /* (AF18) PRG2_PRU0_GPO0.PRG2_RGMII1_RD0 */
    			AM65X_IOPAD(0x007c, PIN_INPUT, 2) /* (AE18) PRG2_PRU0_GPO1.PRG2_RGMII1_RD1 */
    			AM65X_IOPAD(0x0080, PIN_INPUT, 2) /* (AH17) PRG2_PRU0_GPO2.PRG2_RGMII1_RD2 */
    			AM65X_IOPAD(0x0084, PIN_INPUT, 2) /* (AG18) PRG2_PRU0_GPO3.PRG2_RGMII1_RD3 */
    			AM65X_IOPAD(0x0098, PIN_OUTPUT, 2) /* (AH16) PRG2_PRU0_GPO8.PRG2_RGMII1_TD0 */
    			AM65X_IOPAD(0x009c, PIN_OUTPUT, 2) /* (AG16) PRG2_PRU0_GPO9.PRG2_RGMII1_TD1 */
    			AM65X_IOPAD(0x00a0, PIN_OUTPUT, 2) /* (AF16) PRG2_PRU0_GPO10.PRG2_RGMII1_TD2 */
    			AM65X_IOPAD(0x00a4, PIN_OUTPUT, 2) /* (AE16) PRG2_PRU0_GPO11.PRG2_RGMII1_TD3 */
    			AM65X_IOPAD(0x00a8, PIN_INPUT, 2) /* (AD16) PRG2_PRU0_GPO16.PRG2_RGMII1_TXC */
    			AM65X_IOPAD(0x0090, PIN_OUTPUT, 2) /* (AE17) PRG2_PRU0_GPO6.PRG2_RGMII1_TX_CTL */
    			AM65X_IOPAD(0x008c, PIN_INPUT, 2) /* (AF17) PRG2_PRU0_GPO5.PRG2_RGMII1_RXC */
    			AM65X_IOPAD(0x0088, PIN_INPUT, 2) /* (AG17) PRG2_PRU0_GPO4.PRG2_RGMII1_RX_CTL */
    		>;
    	};
    
    	main_spi0_pins_default: main-spi0-pins-default {
    		pinctrl-single,pins = <
    			AM65X_IOPAD(0x01c4, PIN_INPUT_PULLUP, 0)  /* (AH13) GPIO1_17 */ /*SPI0-CLK*/
    			AM65X_IOPAD(0x01c8, PIN_OUTPUT, 0)  /* (AE13) GPIO1_18 */ /*SPI0_D0*/
    			AM65X_IOPAD(0x01cc, PIN_INPUT, 0)   /* (AD13) GPIO1_19 */ /*SPI0_D1*/
    			AM65X_IOPAD(0x01bc, PIN_OUTPUT, 0)  /* (AG13) GPIO1_15 */ /*SPI0_CS0*/
    			AM65X_IOPAD(0x01c0, PIN_OUTPUT, 0)  /* (AF13) GPIO1_16 */ /*SPI0_CS1*/
    		>;
    	};
    
    	myspi2_pins_default: myspi2_pins_default {
    		pinctrl-single,pins = <
    			AM65X_IOPAD(0x01d8, PIN_OUTPUT, 0)  /* (AH12) GPIO1_22 */ /*SPI1_CLK*/
    			AM65X_IOPAD(0x01dc, PIN_OUTPUT, 0)  /* (AE12) GPIO1_23 */ /*SPI1_D0*/
    			AM65X_IOPAD(0x01e0, PIN_INPUT, 0)   /* (AF12) GPIO1_24 */ /*SPI1_D1*/
    		>;
    	};
    
    	main_uart0_pins_default: main-uart0-pins-default {
    		pinctrl-single,pins = <
    			AM65X_IOPAD(0x01e4, PIN_INPUT, 0)   /* (AF11) GPIO1_25 */ /*UART0_RXD*/
    			AM65X_IOPAD(0x01e8, PIN_OUTPUT, 0)  /* (AE11) GPIO1_26 */ /*UART0_TXD*/
    		>;
    	};
    
    	rs232_pins_default: rs232_pins_default {
    		pinctrl-single,pins = <
    			AM65X_IOPAD(0x0288, PIN_INPUT, 6)   /* (Y27) GPIO1_66 */ /*RS232-RXD*/
    			AM65X_IOPAD(0x0260, PIN_OUTPUT, 6)  /* (W28) GPIO1_56 */ /*RS232-TXD*/
    		>;
    	};
    
    	rs485_pins_default: rs485_pins_default {
    		pinctrl-single,pins = <
    			AM65X_IOPAD(0x0174, PIN_INPUT, 6)   /* (AE23) GPIO0_93 */ /*RS485-RXD*/
    			AM65X_IOPAD(0x014c, PIN_OUTPUT, 6)  /* (AD23) GPIO0_83 */ /*RS485-TXD*/
    			AM65X_IOPAD(0x017c, PIN_OUTPUT_PULLDOWN, 7) /* (AC21) GPIO0_95 */ /*RS485-DIR*/
    		>;
    	};
    
    	usb0_pins_default: usb0_pins_default {
    		pinctrl-single,pins = <
    			AM65X_IOPAD(0x02bc, PIN_OUTPUT, 0) /* (AD9) GPIO1_71 */ /*USB0_DRVVBUS*/
    		>;
    	};
    
    	usb20_host_pins_default: usb20_host_pins_default {
    		pinctrl-single,pins = <
    			AM65X_IOPAD(0x02c0, PIN_OUTPUT, 0) /* (AC8) GPIO1_72 */ /*USB1_DRVVBUS*/
    		>;
    	};
    };
    
    &main_pmx1 {
    	pinctrl-names = "default";
            pinctrl-0 = <&gpio2_pins_default>;
    
    	main_i2c0_pins_default: main-i2c0-pins-default {
    		pinctrl-single,pins = <
    			AM65X_IOPAD(0x0000, PIN_INPUT, 0) /* (D20) I2C0_SCL */
    			AM65X_IOPAD(0x0004, PIN_INPUT, 0) /* (C21) I2C0_SDA */
    		>;
    	};
    
    	main_i2c1_pins_default: main-i2c1-pins-default {
    		pinctrl-single,pins = <
    			AM65X_IOPAD(0x0008, PIN_INPUT_PULLUP, 0) /* (B21) I2C1_SCL */
    			AM65X_IOPAD(0x000c, PIN_INPUT_PULLUP, 0) /* (E21) I2C1_SDA */
    		>;
    	};
    
    	gpio2_pins_default: gpio2_pins_default {
    		pinctrl-single,pins = <
    			AM65X_IOPAD(0x0010, PIN_OUTPUT, 7)  /* (D21) GPIO1_86 */ /* SER-COMM-EN */
    			AM65X_IOPAD(0x0018, PIN_INPUT, 7)   /* (B22) GPIO1_88 */ /* DDR-TP0 */
    			AM65X_IOPAD(0x001c, PIN_INPUT, 7)   /* (C23) GPIO1_89 */ /* DDR-TP1 */
    		>;
    	};
    
    	ledgpio2_pins_default: ledgpio2_pins_default {
    		pinctrl-single,pins = <
    			AM65X_IOPAD(0x0014, PIN_OUTPUT, 7) /* (A22) GPIO1_87 */	/* RS485-TX-LED */
    		>;
    	};
    };
    
    &wkup_uart0 {
    	/* Wakeup UART is used by System firmware */
    	status = "disabled";
    };
    
    &main_uart0 {
    	pinctrl-names = "default";
    	pinctrl-0 = <&main_uart0_pins_default>;
    	power-domains = <&k3_pds 146 TI_SCI_PD_SHARED>;
    };
    
    //Eric+{
    &main_uart2 {
    	pinctrl-names = "default";
    	power-domains = <&k3_pds 148 TI_SCI_PD_SHARED>;
    	pinctrl-0 = <&rs232_pins_default>;
    	status = "okay";
    };
    
    &main_uart1 {
    	pinctrl-names = "default";
    	pinctrl-0 = <&rs485_pins_default>;
    	power-domains = <&k3_pds 147 TI_SCI_PD_SHARED>;
    	rts-gpios = <&main_gpio0 95 GPIO_ACTIVE_HIGH>;
    	rs485-rts-active-high;
    	rs485-rts-delay = <0 0>;
    	linux,rs485-enabled-at-boot-time;
    	status = "okay";
    };
    //Eric+}
    
    &main_i2c0 {
    	status = "okay";
    
    	pinctrl-names = "default";
    	pinctrl-0 = <&main_i2c0_pins_default>;
    	clock-frequency = <100000>;
    
    #if 0
    	rx8130:rtc@32{
    		compatible = "epson,rx8130-legacy";
    		reg = <0x32>;
    	};
    #endif
    
    	eeprom: eeprom@50 {
    		compatible = "atmel,24c16";
    		reg = <0x50>;
    		pagesize = <16>;
    	};
    };
    
    &main_i2c1 {
    	status = "okay";
    
    	pinctrl-names = "default";
    	pinctrl-0 = <&main_i2c1_pins_default>;
    	clock-frequency = <100000>;
    
    	s35390a:rtc@30{
    		compatible = "sii,s35390a";
    		reg = <0x30>;
    	};
    };
    
    &main_spi0 {
        status = "okay";
    	pinctrl-names = "default";
    	pinctrl-0 = <&main_spi0_pins_default>;
    	#address-cells = <1>;
    	#size-cells= <0>;
    	ti,pindir-d0-out-d1-in = <1>;
    
        spidev@0 {
            status = "okay";
            //compatible = "fairchild,74hc595";
            compatible = "linux,spidev";
            reg = <0>;
            spi-max-frequency = <1000000>;
        };
    };
    
    &main_spi1 {
        status = "okay";
    	pinctrl-names = "default";
    	pinctrl-0 = <&myspi2_pins_default>;
    	#address-cells = <1>;
    	#size-cells= <0>;
    	ti,pindir-d0-out-d1-in = <1>;
    
        spidev@0 {
            status = "okay";
            //compatible = "fairchild,74hc595";
            compatible = "linux,spidev";
            gpio-controller;
            #gpio-cells = <2>;
            reg = <0>;
            registers-number = <2>;
            registers-default = /bits/ 8 <0xb7>;
            spi-max-frequency = <100000>;
        };
    };
    
    &sdhci0 {
    	pinctrl-names = "default";
    	pinctrl-0 = <&main_mmc0_pins_default>;
    	bus-width = <8>;
    	non-removable;
    	ti,driver-strength-ohm = <50>;
    	disable-wp;
    };
    
    &sdhci1 {
    	pinctrl-names = "default";
    	pinctrl-0 = <&main_mmc1_pins_default>;
    	ti,driver-strength-ohm = <50>;
    	disable-wp;
    };
    
    &dwc3_1 {
    	status = "okay";
    };
    
    &usb1_phy {
    	status = "okay";
    };
    
    &usb1 {
    	pinctrl-names = "default";
    	pinctrl-0 = <&usb20_host_pins_default>;
    	dr_mode = "host";
    };
    
    &dwc3_0 {
    	status = "okay";
    };
    
    &usb0_phy {
    	status = "okay";
    };
    
    //Eric+{
    
    &m_can0 {
    	status = "okay";
    	pinctrl-names = "default";
    	pinctrl-0 = <&mcan0_pins_default>;
    	//stb-gpios = <&main_gpio1 47 GPIO_ACTIVE_HIGH>;
    	can-transceiver {
    		max-bitrate = <5000000>;
    	};
    };
    
    &usb0 {
    	pinctrl-names = "default";
    	//pinctrl-0 = <&usb0_pins_default>;
    	dr_mode = "peripheral";
    };
    //Eric+}
    
    &tscadc0 {
    	adc {
    		ti,adc-channels = <0 1 2 3 4 5 6 7>;
    	};
    };
    
    &tscadc1 {
    	adc {
    		ti,adc-channels = <0 1 2 3 4 5 6 7>;
    	};
    };
    
    &serdes0 {
    	status = "disabled";
    };
    
    &serdes1 {
    	status = "disabled";
    };
    
    &pcie0_rc {
    	status = "disabled";
    };
    
    &pcie0_ep {
    	status = "disabled";
    };
    
    &pcie1_rc {
    	status = "disabled";
    };
    
    &pcie1_ep {
    	status = "disabled";
    };
    
    &mailbox0_cluster0 {
    	interrupts = <436>;
    
    	mbox_mcu_r5fss0_core0: mbox-mcu-r5fss0-core0 {
    		ti,mbox-tx = <1 0 0>;
    		ti,mbox-rx = <0 0 0>;
    	};
    };
    
    &mailbox0_cluster1 {
    	interrupts = <432>;
    
    	mbox_mcu_r5fss0_core1: mbox-mcu-r5fss0-core1 {
    		ti,mbox-tx = <1 0 0>;
    		ti,mbox-rx = <0 0 0>;
    	};
    };
    
    &mailbox0_cluster2 {
    	status = "disabled";
    };
    
    &mailbox0_cluster3 {
    	status = "disabled";
    };
    
    &mailbox0_cluster4 {
    	status = "disabled";
    };
    
    &mailbox0_cluster5 {
    	status = "disabled";
    };
    
    &mailbox0_cluster6 {
    	status = "disabled";
    };
    
    &mailbox0_cluster7 {
    	status = "disabled";
    };
    
    &mailbox0_cluster8 {
    	status = "disabled";
    };
    
    &mailbox0_cluster9 {
    	status = "disabled";
    };
    
    &mailbox0_cluster10 {
    	status = "disabled";
    };
    
    &mailbox0_cluster11 {
    	status = "disabled";
    };
    
    &mcu_r5fss0_core0 {
    	memory-region = <&mcu_r5fss0_core0_dma_memory_region>,
    			<&mcu_r5fss0_core0_memory_region>;
    	mboxes = <&mailbox0_cluster0 &mbox_mcu_r5fss0_core0>;
    };
    
    &mcu_r5fss0_core1 {
    	memory-region = <&mcu_r5fss0_core1_dma_memory_region>,
    			<&mcu_r5fss0_core1_memory_region>;
    	mboxes = <&mailbox0_cluster1 &mbox_mcu_r5fss0_core1>;
    };
    
    &mcu_cpsw {
    	pinctrl-names = "default";
    	//Eric- pinctrl-0 = <&mcu_cpsw_pins_default &mcu_mdio_pins_default>;
    	pinctrl-0 = <&phy2ax58100_pins_default &phy2ax58100_mdio2_pins_default>;
    };
    
    &davinci_mdio {
    	reset = <&main_gpio0 25 GPIO_ACTIVE_LOW>;
    	reset-delay-us = <2>;   /* PHY datasheet states 1us min */
    
    	phy0: ethernet-phy@3 {
    		reg = <3>;
    	};
    };
    
    &cpsw_port1 {
    	phy-mode = "rmii";
    	phy-handle = <&phy0>;
    };
    
    //Eric+{
    &icssg1_mdio {
    	status = "okay";
    	pinctrl-names = "default";
    	pinctrl-0 = <&icssg1_mdio_pins_default>;
    
    	reset = <&main_gpio0 66 GPIO_ACTIVE_LOW>; /*83867*/
    	//reset = <&main_gpio0 73 GPIO_ACTIVE_LOW>; /*83822*/
    	reset-delay-us = <2>;
    
    	/*83867*/
    	pruss1_eth0_phy: ethernet-phy@1 {
    		reg = <1>;
    		ti,rx-internal-delay = <DP83867_RGMIIDCTL_2_00_NS>;
    		ti,fifo-depth = <DP83867_PHYCR_FIFO_DEPTH_4_B_NIB>;
    	};
    #if 0
    	/*83822*/
    	pruss1_eth1_phy: ethernet-phy@7 {
    		reg = <7>;
    	};
    #endif
    };
    //Eric+}
    
    &icssg2_mdio {
    	status = "okay";
    	pinctrl-names = "default";
    	pinctrl-0 = <&icssg2_mdio_pins_default>;
    
    	reset = <&main_gpio0 16 GPIO_ACTIVE_LOW>;
    	reset-delay-us = <2>;
    
    	/*83867*/
    	pruss2_eth0_phy: ethernet-phy@2 {
    		reg = <2>;
    		ti,rx-internal-delay = <DP83867_RGMIIDCTL_2_00_NS>;
    		ti,fifo-depth = <DP83867_PHYCR_FIFO_DEPTH_4_B_NIB>;
    	};
    };
    

  • I did not get a chance to review the details. I will look into it tomorrow.

  • Hi Yun-En:

    Have you read this linik for the USB section?

    https://software-dl.ti.com/processor-sdk-linux/esd/AM62X/latest/exports/docs/linux/Foundational_Components/U-Boot/UG-Memory-K3.html

    BR Rio

    There are two instances of USB on AM62 SoC.

    On the SK board, zeroth instance is brought out through a Type C port and the first instance is brought through a Type A port.

    By default, USB0 port is configured to be in peripheral mode.

    Since U-Boot does not support dynamic switching of USB roles,

    below DT fragment needs to be applied and U-Boot image needs to be rebuilt to make USB0 port to be USB 2.0 host port.

    diff --git a/arch/arm/dts/k3-am625-sk-u-boot.dtsi b/arch/arm/dts/k3-am625-sk-u-boot.dtsi
    index 20c24d2fa7a4..2b662653023f 100644
    --- a/arch/arm/dts/k3-am625-sk-u-boot.dtsi
    +++ b/arch/arm/dts/k3-am625-sk-u-boot.dtsi
    @@ -117,5 +117,5 @@
     };
    
     &usb0 {
    -       dr_mode = "peripheral";
    +       dr_mode = "host";
            u-boot,dm-spl;
  • Hi Rio , 

    In the Linux stage, I'm unable to get usb0 to operate in peripheral mode and establish USB Serial Gadget communication using g_serial. My understanding is that the device trees used by U-Boot and the Linux kernel are not related.

    After using modprobe g_serial to create /dev/ttyGS0, the PC is still unable to correctly detect a COM port.

    The current usb0 device tree in my Linux DTS is as follows:

    usb5vsignal_pins_default: usb5vsignal_pins_default {
    		pinctrl-single,pins = <
    			AM65X_WKUP_IOPAD(0x00c4, PIN_INPUT, 7) /* (AD3) WKUP_GPIO0_5 */
    		>;
    	};

    &usb0_phy {
    	status = "okay";
    };
    
    &usb0 {
    	status = "okay";
    	pinctrl-names = "default";
    	pinctrl-0 = <&usb5vsignal_pins_default>;
    	dr_mode = "peripheral";
    };
    
    &dwc3_0 {
    	status = "okay";
    };

  • Hi YunEn,

    [ 2321.461199] udc 4010000.usb: soft-connect without a gadget driver 

    I don't think I never saw this message. Do you see it as well in kernel 5.x when USB0 works in device mode?

  • I didn't see this message in version 5.1.

    The message appears to indicate that the UDC cannot find a related gadget driver to define its functionality,

    but I have already confirmed that the g_serial kernel config is enabled.

  • Please compare /proc/config.gz in both kernel builds to see if there are any USB related configs are different.

  • Below is my current Kernel Config. According to the documentation provided on the official website, the two should be consistent.

    Compared to the previous kernel, the configuration is consistent, and both use only the g_serial driver.

    https://software-dl.ti.com/processor-sdk-linux-rt/esd/AM65X/09_03_05_02/exports/docs/linux/Foundational_Components/Kernel/Kernel_Drivers/USB/DWC3.html

    root@am65xx-evm:~# zcat /proc/config.gz | grep CONFIG_USB_
    CONFIG_USB_NET_DRIVERS=y
    # CONFIG_USB_CATC is not set
    # CONFIG_USB_KAWETH is not set
    CONFIG_USB_PEGASUS=m
    CONFIG_USB_RTL8150=m
    CONFIG_USB_RTL8152=m
    CONFIG_USB_LAN78XX=m
    CONFIG_USB_USBNET=m
    CONFIG_USB_NET_AX8817X=m
    CONFIG_USB_NET_AX88179_178A=m
    CONFIG_USB_NET_CDCETHER=m
    # CONFIG_USB_NET_CDC_EEM is not set
    CONFIG_USB_NET_CDC_NCM=m
    # CONFIG_USB_NET_HUAWEI_CDC_NCM is not set
    # CONFIG_USB_NET_CDC_MBIM is not set
    CONFIG_USB_NET_DM9601=m
    # CONFIG_USB_NET_SR9700 is not set
    CONFIG_USB_NET_SR9800=m
    CONFIG_USB_NET_SMSC75XX=m
    CONFIG_USB_NET_SMSC95XX=m
    # CONFIG_USB_NET_GL620A is not set
    CONFIG_USB_NET_NET1080=m
    CONFIG_USB_NET_PLUSB=m
    CONFIG_USB_NET_MCS7830=m
    # CONFIG_USB_NET_RNDIS_HOST is not set
    CONFIG_USB_NET_CDC_SUBSET_ENABLE=m
    CONFIG_USB_NET_CDC_SUBSET=m
    # CONFIG_USB_ALI_M5632 is not set
    # CONFIG_USB_AN2720 is not set
    CONFIG_USB_BELKIN=y
    CONFIG_USB_ARMLINUX=y
    # CONFIG_USB_EPSON2888 is not set
    # CONFIG_USB_KC2190 is not set
    CONFIG_USB_NET_ZAURUS=m
    # CONFIG_USB_NET_CX82310_ETH is not set
    # CONFIG_USB_NET_KALMIA is not set
    # CONFIG_USB_NET_QMI_WWAN is not set
    # CONFIG_USB_HSO is not set
    # CONFIG_USB_NET_INT51X1 is not set
    # CONFIG_USB_IPHETH is not set
    # CONFIG_USB_SIERRA_NET is not set
    # CONFIG_USB_VL600 is not set
    # CONFIG_USB_NET_CH9200 is not set
    # CONFIG_USB_NET_AQC111 is not set
    CONFIG_USB_RTL8153_ECM=m
    # CONFIG_USB_PULSE8_CEC is not set
    # CONFIG_USB_RAINSHADOW_CEC is not set
    # CONFIG_USB_GSPCA is not set
    # CONFIG_USB_PWC is not set
    # CONFIG_USB_S2255 is not set
    CONFIG_USB_VIDEO_CLASS=m
    CONFIG_USB_VIDEO_CLASS_INPUT_EVDEV=y
    # CONFIG_USB_AIRSPY is not set
    # CONFIG_USB_HACKRF is not set
    # CONFIG_USB_MSI2500 is not set
    # CONFIG_USB_DSBR is not set
    # CONFIG_USB_KEENE is not set
    # CONFIG_USB_MA901 is not set
    # CONFIG_USB_MR800 is not set
    # CONFIG_USB_RAREMONO is not set
    CONFIG_USB_HID=y
    # CONFIG_USB_HIDDEV is not set
    CONFIG_USB_OHCI_LITTLE_ENDIAN=y
    CONFIG_USB_SUPPORT=y
    CONFIG_USB_COMMON=y
    # CONFIG_USB_LED_TRIG is not set
    CONFIG_USB_ULPI_BUS=y
    CONFIG_USB_CONN_GPIO=y
    CONFIG_USB_ARCH_HAS_HCD=y
    CONFIG_USB_PCI=y
    # CONFIG_USB_ANNOUNCE_NEW_DEVICES is not set
    CONFIG_USB_DEFAULT_PERSIST=y
    # CONFIG_USB_FEW_INIT_RETRIES is not set
    # CONFIG_USB_DYNAMIC_MINORS is not set
    CONFIG_USB_OTG=y
    # CONFIG_USB_OTG_PRODUCTLIST is not set
    # CONFIG_USB_OTG_DISABLE_EXTERNAL_HUB is not set
    # CONFIG_USB_OTG_FSM is not set
    # CONFIG_USB_LEDS_TRIGGER_USBPORT is not set
    CONFIG_USB_AUTOSUSPEND_DELAY=2
    # CONFIG_USB_MON is not set
    # CONFIG_USB_C67X00_HCD is not set
    CONFIG_USB_XHCI_HCD=y
    # CONFIG_USB_XHCI_DBGCAP is not set
    CONFIG_USB_XHCI_PCI=m
    CONFIG_USB_XHCI_PCI_RENESAS=m
    CONFIG_USB_XHCI_PLATFORM=m
    CONFIG_USB_EHCI_HCD=y
    CONFIG_USB_EHCI_ROOT_HUB_TT=y
    CONFIG_USB_EHCI_TT_NEWSCHED=y
    CONFIG_USB_EHCI_PCI=y
    # CONFIG_USB_EHCI_FSL is not set
    CONFIG_USB_EHCI_HCD_PLATFORM=y
    # CONFIG_USB_OXU210HP_HCD is not set
    # CONFIG_USB_ISP116X_HCD is not set
    # CONFIG_USB_FOTG210_HCD is not set
    # CONFIG_USB_MAX3421_HCD is not set
    CONFIG_USB_OHCI_HCD=y
    CONFIG_USB_OHCI_HCD_PCI=y
    CONFIG_USB_OHCI_HCD_PLATFORM=y
    # CONFIG_USB_UHCI_HCD is not set
    # CONFIG_USB_SL811_HCD is not set
    # CONFIG_USB_R8A66597_HCD is not set
    # CONFIG_USB_HCD_TEST_MODE is not set
    CONFIG_USB_ACM=m
    # CONFIG_USB_PRINTER is not set
    # CONFIG_USB_WDM is not set
    # CONFIG_USB_TMC is not set
    CONFIG_USB_STORAGE=y
    # CONFIG_USB_STORAGE_DEBUG is not set
    # CONFIG_USB_STORAGE_REALTEK is not set
    # CONFIG_USB_STORAGE_DATAFAB is not set
    # CONFIG_USB_STORAGE_FREECOM is not set
    # CONFIG_USB_STORAGE_ISD200 is not set
    # CONFIG_USB_STORAGE_USBAT is not set
    # CONFIG_USB_STORAGE_SDDR09 is not set
    # CONFIG_USB_STORAGE_SDDR55 is not set
    # CONFIG_USB_STORAGE_JUMPSHOT is not set
    # CONFIG_USB_STORAGE_ALAUDA is not set
    # CONFIG_USB_STORAGE_ONETOUCH is not set
    # CONFIG_USB_STORAGE_KARMA is not set
    # CONFIG_USB_STORAGE_CYPRESS_ATACB is not set
    # CONFIG_USB_STORAGE_ENE_UB6250 is not set
    # CONFIG_USB_UAS is not set
    # CONFIG_USB_MDC800 is not set
    # CONFIG_USB_MICROTEK is not set
    CONFIG_USB_CDNS_SUPPORT=m
    CONFIG_USB_CDNS_HOST=y
    CONFIG_USB_CDNS3=m
    CONFIG_USB_CDNS3_GADGET=y
    CONFIG_USB_CDNS3_HOST=y
    CONFIG_USB_CDNS3_TI=m
    # CONFIG_USB_MUSB_HDRC is not set
    CONFIG_USB_DWC3=m
    # CONFIG_USB_DWC3_ULPI is not set
    # CONFIG_USB_DWC3_HOST is not set
    # CONFIG_USB_DWC3_GADGET is not set
    CONFIG_USB_DWC3_DUAL_ROLE=y
    CONFIG_USB_DWC3_HAPS=m
    CONFIG_USB_DWC3_KEYSTONE=m
    CONFIG_USB_DWC3_OF_SIMPLE=m
    CONFIG_USB_DWC3_AM62=m
    # CONFIG_USB_DWC2 is not set
    # CONFIG_USB_CHIPIDEA is not set
    # CONFIG_USB_ISP1760 is not set
    CONFIG_USB_SERIAL=m
    # CONFIG_USB_SERIAL_GENERIC is not set
    # CONFIG_USB_SERIAL_SIMPLE is not set
    # CONFIG_USB_SERIAL_AIRCABLE is not set
    # CONFIG_USB_SERIAL_ARK3116 is not set
    # CONFIG_USB_SERIAL_BELKIN is not set
    # CONFIG_USB_SERIAL_CH341 is not set
    # CONFIG_USB_SERIAL_WHITEHEAT is not set
    # CONFIG_USB_SERIAL_DIGI_ACCELEPORT is not set
    CONFIG_USB_SERIAL_CP210X=m
    # CONFIG_USB_SERIAL_CYPRESS_M8 is not set
    # CONFIG_USB_SERIAL_EMPEG is not set
    CONFIG_USB_SERIAL_FTDI_SIO=m
    # CONFIG_USB_SERIAL_VISOR is not set
    # CONFIG_USB_SERIAL_IPAQ is not set
    # CONFIG_USB_SERIAL_IR is not set
    # CONFIG_USB_SERIAL_EDGEPORT is not set
    # CONFIG_USB_SERIAL_EDGEPORT_TI is not set
    # CONFIG_USB_SERIAL_F81232 is not set
    # CONFIG_USB_SERIAL_F8153X is not set
    # CONFIG_USB_SERIAL_GARMIN is not set
    # CONFIG_USB_SERIAL_IPW is not set
    # CONFIG_USB_SERIAL_IUU is not set
    # CONFIG_USB_SERIAL_KEYSPAN_PDA is not set
    # CONFIG_USB_SERIAL_KEYSPAN is not set
    # CONFIG_USB_SERIAL_KLSI is not set
    # CONFIG_USB_SERIAL_KOBIL_SCT is not set
    # CONFIG_USB_SERIAL_MCT_U232 is not set
    # CONFIG_USB_SERIAL_METRO is not set
    # CONFIG_USB_SERIAL_MOS7720 is not set
    # CONFIG_USB_SERIAL_MOS7840 is not set
    # CONFIG_USB_SERIAL_MXUPORT is not set
    # CONFIG_USB_SERIAL_NAVMAN is not set
    # CONFIG_USB_SERIAL_PL2303 is not set
    # CONFIG_USB_SERIAL_OTI6858 is not set
    # CONFIG_USB_SERIAL_QCAUX is not set
    # CONFIG_USB_SERIAL_QUALCOMM is not set
    # CONFIG_USB_SERIAL_SPCP8X5 is not set
    # CONFIG_USB_SERIAL_SAFE is not set
    # CONFIG_USB_SERIAL_SIERRAWIRELESS is not set
    # CONFIG_USB_SERIAL_SYMBOL is not set
    # CONFIG_USB_SERIAL_TI is not set
    # CONFIG_USB_SERIAL_CYBERJACK is not set
    CONFIG_USB_SERIAL_WWAN=m
    CONFIG_USB_SERIAL_OPTION=m
    # CONFIG_USB_SERIAL_OMNINET is not set
    # CONFIG_USB_SERIAL_OPTICON is not set
    # CONFIG_USB_SERIAL_XSENS_MT is not set
    # CONFIG_USB_SERIAL_WISHBONE is not set
    # CONFIG_USB_SERIAL_SSU100 is not set
    # CONFIG_USB_SERIAL_QT2 is not set
    # CONFIG_USB_SERIAL_UPD78F0730 is not set
    # CONFIG_USB_SERIAL_XR is not set
    # CONFIG_USB_SERIAL_DEBUG is not set
    # CONFIG_USB_EMI62 is not set
    # CONFIG_USB_EMI26 is not set
    # CONFIG_USB_ADUTUX is not set
    # CONFIG_USB_SEVSEG is not set
    # CONFIG_USB_LEGOTOWER is not set
    # CONFIG_USB_LCD is not set
    # CONFIG_USB_CYPRESS_CY7C63 is not set
    # CONFIG_USB_CYTHERM is not set
    # CONFIG_USB_IDMOUSE is not set
    # CONFIG_USB_FTDI_ELAN is not set
    # CONFIG_USB_APPLEDISPLAY is not set
    # CONFIG_USB_SISUSBVGA is not set
    # CONFIG_USB_LD is not set
    # CONFIG_USB_TRANCEVIBRATOR is not set
    # CONFIG_USB_IOWARRIOR is not set
    # CONFIG_USB_TEST is not set
    # CONFIG_USB_EHSET_TEST_FIXTURE is not set
    # CONFIG_USB_ISIGHTFW is not set
    # CONFIG_USB_YUREX is not set
    # CONFIG_USB_EZUSB_FX2 is not set
    # CONFIG_USB_HUB_USB251XB is not set
    # CONFIG_USB_HSIC_USB3503 is not set
    # CONFIG_USB_HSIC_USB4604 is not set
    # CONFIG_USB_LINK_LAYER_TEST is not set
    # CONFIG_USB_CHAOSKEY is not set
    # CONFIG_USB_ONBOARD_HUB is not set
    CONFIG_USB_PHY=y
    # CONFIG_USB_GPIO_VBUS is not set
    # CONFIG_USB_ISP1301 is not set
    CONFIG_USB_ULPI=y
    CONFIG_USB_ULPI_VIEWPORT=y
    CONFIG_USB_GADGET=y
    # CONFIG_USB_GADGET_DEBUG is not set
    # CONFIG_USB_GADGET_DEBUG_FILES is not set
    # CONFIG_USB_GADGET_DEBUG_FS is not set
    CONFIG_USB_GADGET_VBUS_DRAW=2
    CONFIG_USB_GADGET_STORAGE_NUM_BUFFERS=32
    # CONFIG_USB_FOTG210_UDC is not set
    # CONFIG_USB_GR_UDC is not set
    # CONFIG_USB_R8A66597 is not set
    # CONFIG_USB_PXA27X is not set
    # CONFIG_USB_MV_UDC is not set
    # CONFIG_USB_MV_U3D is not set
    CONFIG_USB_SNP_CORE=y
    CONFIG_USB_SNP_UDC_PLAT=y
    # CONFIG_USB_M66592 is not set
    CONFIG_USB_BDC_UDC=y
    # CONFIG_USB_AMD5536UDC is not set
    # CONFIG_USB_NET2272 is not set
    # CONFIG_USB_NET2280 is not set
    # CONFIG_USB_GOKU is not set
    # CONFIG_USB_EG20T is not set
    # CONFIG_USB_GADGET_XILINX is not set
    # CONFIG_USB_MAX3420_UDC is not set
    # CONFIG_USB_DUMMY_HCD is not set
    CONFIG_USB_LIBCOMPOSITE=m
    CONFIG_USB_F_ACM=m
    CONFIG_USB_F_SS_LB=m
    CONFIG_USB_U_SERIAL=m
    CONFIG_USB_U_ETHER=m
    CONFIG_USB_F_SERIAL=m
    CONFIG_USB_F_OBEX=m
    CONFIG_USB_F_NCM=m
    CONFIG_USB_F_ECM=m
    CONFIG_USB_F_EEM=m
    CONFIG_USB_F_SUBSET=m
    CONFIG_USB_F_RNDIS=m
    CONFIG_USB_F_MASS_STORAGE=m
    CONFIG_USB_F_FS=m
    CONFIG_USB_CONFIGFS=m
    CONFIG_USB_CONFIGFS_SERIAL=y
    CONFIG_USB_CONFIGFS_ACM=y
    CONFIG_USB_CONFIGFS_OBEX=y
    CONFIG_USB_CONFIGFS_NCM=y
    CONFIG_USB_CONFIGFS_ECM=y
    CONFIG_USB_CONFIGFS_ECM_SUBSET=y
    CONFIG_USB_CONFIGFS_RNDIS=y
    CONFIG_USB_CONFIGFS_EEM=y
    CONFIG_USB_CONFIGFS_MASS_STORAGE=y
    # CONFIG_USB_CONFIGFS_F_LB_SS is not set
    CONFIG_USB_CONFIGFS_F_FS=y
    # CONFIG_USB_CONFIGFS_F_UAC1 is not set
    # CONFIG_USB_CONFIGFS_F_UAC1_LEGACY is not set
    # CONFIG_USB_CONFIGFS_F_UAC2 is not set
    # CONFIG_USB_CONFIGFS_F_MIDI is not set
    # CONFIG_USB_CONFIGFS_F_HID is not set
    # CONFIG_USB_CONFIGFS_F_UVC is not set
    # CONFIG_USB_CONFIGFS_F_PRINTER is not set
    CONFIG_USB_ZERO=m
    # CONFIG_USB_ZERO_HNPTEST is not set
    # CONFIG_USB_AUDIO is not set
    CONFIG_USB_ETH=m
    CONFIG_USB_ETH_RNDIS=y
    # CONFIG_USB_ETH_EEM is not set
    CONFIG_USB_G_NCM=m
    # CONFIG_USB_GADGETFS is not set
    # CONFIG_USB_FUNCTIONFS is not set
    CONFIG_USB_MASS_STORAGE=m
    CONFIG_USB_G_SERIAL=m
    # CONFIG_USB_MIDI_GADGET is not set
    # CONFIG_USB_G_PRINTER is not set
    CONFIG_USB_CDC_COMPOSITE=m
    # CONFIG_USB_G_ACM_MS is not set
    CONFIG_USB_G_MULTI=m
    CONFIG_USB_G_MULTI_RNDIS=y
    CONFIG_USB_G_MULTI_CDC=y
    # CONFIG_USB_G_HID is not set
    # CONFIG_USB_G_DBGP is not set
    # CONFIG_USB_G_WEBCAM is not set
    # CONFIG_USB_RAW_GADGET is not set
    CONFIG_USB_ROLE_SWITCH=y
    

  • It won't be easy for me to tell from this long list. You just need to compare it on both kernel. You also need to compare CDNS config options.

    By the way, AM65x uses CDNS USB controller, not DWC3.

  • Based on the k3-am65-main.dtsi file, the dwc3_0 node uses snps,dwc3.

    May I ask if my understanding is incorrect?

    Additionally, I compared the Kernel Configs of both versions and found no significant differences. Both configurations are consistent with the settings in the official documentation:

    https://software-dl.ti.com/processor-sdk-linux-rt/esd/AM65X/09_03_05_02/exports/docs/linux/Foundational_Components/Kernel/Kernel_Drivers/USB/DWC3.html

    dwc3_0: dwc3@4000000 {
    		compatible = "ti,am654-dwc3";
    		reg = <0x0 0x4000000 0x0 0x4000>;
    		#address-cells = <1>;
    		#size-cells = <1>;
    		ranges = <0x0 0x0 0x4000000 0x20000>;
    		interrupts = <GIC_SPI 97 IRQ_TYPE_LEVEL_HIGH>;
    		dma-coherent;
    		power-domains = <&k3_pds 151 TI_SCI_PD_EXCLUSIVE>;
    		clocks = <&k3_clks 151 2>, <&k3_clks 151 7>;
    		assigned-clocks = <&k3_clks 151 2>, <&k3_clks 151 7>;
    		assigned-clock-parents = <&k3_clks 151 4>,	/* set REF_CLK to 20MHz i.e. PER0_PLL/48 */
    					 <&k3_clks 151 9>;	/* set PIPE3_TXB_CLK to CLK_12M_RC/256 (for HS only) */
    
    		usb0: usb@10000 {
    			compatible = "snps,dwc3";
    			reg = <0x10000 0x10000>;
    			interrupts = <GIC_SPI 100 IRQ_TYPE_LEVEL_HIGH>,
    				     <GIC_SPI 100 IRQ_TYPE_LEVEL_HIGH>,
    				     <GIC_SPI 96 IRQ_TYPE_LEVEL_HIGH>;
    			interrupt-names = "peripheral",
    					  "host",
    					  "otg";
    			maximum-speed = "high-speed";
    			dr_mode = "otg";
    			phys = <&usb0_phy>;
    			phy-names = "usb2-phy";
    			snps,dis_u3_susphy_quirk;
    		};
    	};
    
    	usb0_phy: phy@4100000 {
    		compatible = "ti,am654-usb2", "ti,omap-usb2";
    		reg = <0x0 0x4100000 0x0 0x54>;
    		syscon-phy-power = <&scm_conf 0x4000>;
    		clocks = <&k3_clks 151 0>, <&k3_clks 151 1>;
    		clock-names = "wkupclk", "refclk";
    		#phy-cells = <0>;
    	};

  • Hi YunEn,

    Based on the k3-am65-main.dtsi file, the dwc3_0 node uses snps,dwc3.

    May I ask if my understanding is incorrect?

    Sorry, this is my bad. For whatever reasons, I thought AM65x uses CDNS USB controller. But you are right, it uses DWC3 controller.

    Do you see the same problem on AM65x EVM with the SDK9.3 prebuilt SD card WIC image?

  • I just tested it on the EVM with SDK 9.3 prebuilt image (linked below), but I am unable to see the problem. Note the EVM by default has usb0 disabled, so the g_serial gadget driver is bond to usb1.

    https://dr-download.ti.com/software-development/software-development-kit-sdk/MD-diW9VClvQJ/09.03.05.02/tisdk-default-image-am65xx-evm-09.03.05.02.wic.xz

    root@am65xx-evm:~# uname -a                                                                               
    Linux am65xx-evm 6.1.119-ti-gc490f4c0fe51 #1 SMP PREEMPT Wed Dec  4 17:16:52 UTC 2024 aarch64 aarch64 aarch64 GNU/Linux                                                                                              
    root@am65xx-evm:~# modprobe g_serial                                                                      
    [   33.808689] g_serial gadget.0: Gadget Serial v2.4                                                      
    [   33.813518] g_serial gadget.0: g_serial ready
    root@am65xx-evm:~# cat /sys/kernel/debug/usb/4030000.usb/link_state 
    On

    On Linux PC:

    [177557.162488] usb 1-1.1.3: new high-speed USB device number 21 using xhci_hcd
    [177557.252677] usb 1-1.1.3: New USB device found, idVendor=0525, idProduct=a4a7, bcdDevice= 6.01
    [177557.252684] usb 1-1.1.3: New USB device strings: Mfr=1, Product=2, SerialNumber=0
    [177557.252703] usb 1-1.1.3: Product: Gadget Serial v2.4
    [177557.252705] usb 1-1.1.3: Manufacturer: Linux 6.1.119-ti-gc490f4c0fe51 with dwc3-gadget
    [177557.255342] cdc_acm 1-1.1.3:2.0: ttyACM0: USB ACM device

  • 8345.config.gz

    For your reference, attached above is the kernel .config for this kernel build.

  • I will continue testing tomorrow. Additionally, I would like to ask if you can provide the device tree related to EVM USB1, or if I should just use USB0 for testing?

    I ask because when I modified it to use USB0, it stopped working even though I used the same configuration and set it as a peripheral.

    Thank you again for your help.

  • The device tree is in the kernel: k3-am654-base-board.dts

  • Understood. That should be consistent with my settings then. I'm currently using k3-am654-base-board.dts and modifying it, but for some reason, my USB0 isn't working correctly in peripheral mode.

    I'll check the config.gz in detail tomorrow for any discrepancies. I'll let you know if I find anything. Thanks again!

  • The EVM USB0 setting for USB2.0 is in device tree k3-am654-pcie-usb2.dtso file.

    As shown in this dtso file, please ensure you configured serdes0 and serdes1 to PCIe, not to USB0.

  • I have checked and disabled the relevant settings in k3-am654-base-board.dts as shown below. I am not certain if this is what you were referring to?

    &serdes0 {
    	status = "disabled";
    };
    
    &serdes1 {
    	status = "disabled";
    };
    
    &pcie0_rc {
    	status = "disabled";
    };
    
    &pcie0_ep {
    	status = "disabled";
    };
    
    &pcie1_rc {
    	status = "disabled";
    };
    
    &pcie1_ep {
    	status = "disabled";
    };

  • I compared the Kernel Config you provided with my current one. All USB-related settings are completely identical, but my USB0 still won't work in peripheral mode.

  • I have checked and disabled the relevant settings in k3-am654-base-board.dts as shown below. I am not certain if this is what you were referring to?

    No. Not to disable serdes, but please set the serdes configurations in k3-am654-pcie-usb2.dtso.

  • vbus-gpios = <&wkup_gpio0 5 GPIO_ACTIVE_HIGH>;

    What this gpio is doing to vbus?

  • My apologies, but I'm not sure how I should modify this part. Would it be possible for you to provide an example for me?

    My understanding is that I should rewrite the serdes node in k3-am654-base-board.dts. If I don't overlay it with a command, a .dtbo shouldn't take effect, correct?

  • I have now removed the vbus gpio. I believe the vbus property should not be included in the node's configuration when it's in peripheral mode.

    I have attached my current dts file for your reference. Thanks!

    // SPDX-License-Identifier: GPL-2.0
    /*
     * Copyright (C) 2016-2020 Texas Instruments Incorporated - https://www.ti.com/
     */
    
    /dts-v1/;
    
    #include "k3-am654.dtsi"
    #include <dt-bindings/input/input.h>
    #include <dt-bindings/net/ti-dp83867.h>
    
    / {
    	compatible = "ti,am654-evm", "ti,am654";
    	model = "Texas Instruments AM654 Base Board";
    
    	aliases {
    		ethernet1 = &icssg1_emac0;
    		ethernet2 = &icssg2_emac0;
    	};
    
    	chosen {
    		stdout-path = "serial2:115200n8";
    		bootargs = "earlycon=ns16550a,mmio32,0x02800000";
    	};
    
    	memory@80000000 {
    		device_type = "memory";
    
    		/*1G Ram*/
    		reg = <0x00000000 0x80000000 0x00000000 0x40000000>;
    	};
    
    	reserved-memory {
    		#address-cells = <2>;
    		#size-cells = <2>;
    		ranges;
    
    		secure_ddr: secure-ddr@9e800000 {
    			reg = <0 0x9e800000 0 0x01800000>; /* for OP-TEE */
    			alignment = <0x1000>;
    			no-map;
    		};
    
    		mcu_r5fss0_core0_dma_memory_region: r5f-dma-memory@a0000000 {
    			compatible = "shared-dma-pool";
    			reg = <0 0xa0000000 0 0x100000>;
    			no-map;
    		};
    
    		mcu_r5fss0_core0_memory_region: r5f-memory@a0100000 {
    			compatible = "shared-dma-pool";
    			reg = <0 0xa0100000 0 0xf00000>;
    			no-map;
    		};
    
    		mcu_r5fss0_core1_dma_memory_region: r5f-dma-memory@a1000000 {
    			compatible = "shared-dma-pool";
    			reg = <0 0xa1000000 0 0x100000>;
    			no-map;
    		};
    
    		mcu_r5fss0_core1_memory_region: r5f-memory@a1100000 {
    			compatible = "shared-dma-pool";
    			reg = <0 0xa1100000 0 0xf00000>;
    			no-map;
    		};
    
    		rtos_ipc_memory_region: ipc-memories@a2000000 {
    			reg = <0x00 0xa2000000 0x00 0x00100000>;
    			alignment = <0x1000>;
    			no-map;
    		};
    	};
    
    	eeprom_gpio: eeprom_gpio {
    		compatible = "eeprom-gpio";
    		eeprom-gpio = <&wkup_gpio0 7 GPIO_ACTIVE_HIGH>;
    	};
    
    	leds {
    		pinctrl-names = "default";
    		pinctrl-0 = <&ledgpio0_pins_default &ledgpio1_pins_default &ledgpio2_pins_default>;
    
    		compatible = "gpio-leds";
    
    		led1 {
    			label = "LED-RUN";
    			gpios = <&main_gpio0 27 GPIO_ACTIVE_LOW>;
    		};
    
    		led2 {
    			label = "LED-ERR";
    			gpios = <&main_gpio1 70 GPIO_ACTIVE_HIGH>;
    		};
    
    		led3 {
    			label = "LED-BUS";
    			gpios = <&main_gpio1 48 GPIO_ACTIVE_HIGH>;
    		};
    
    		led4 {
    			label = "LED-232TX";
    			gpios = <&main_gpio1 21 GPIO_ACTIVE_HIGH>;
    		};
    
    		led5 {
    			label = "LED-232RX";
    			gpios = <&main_gpio0 26 GPIO_ACTIVE_HIGH>;
    		};
    
    		led6 {
    			label = "LED-485TX";
    			gpios = <&main_gpio1 87 GPIO_ACTIVE_HIGH>;
    		};
    
    		led7 {
    			label = "LED-485RX";
    			gpios = <&main_gpio1 46 GPIO_ACTIVE_HIGH>;
    		};
    
    		led8 {
    			label = "LED-SD";
    			gpios = <&main_gpio0 23 GPIO_ACTIVE_HIGH>;
    		};
    	};
    
    	/* Dual Ethernet application node on PRU-ICSSG2 */
    	icssg1_eth: icssg1-eth {
    		compatible = "ti,am654-icssg-prueth";
    		pinctrl-names = "default";
    		pinctrl-0 = <&ethernet0_pins_default>;
    		sram = <&msmc_ram>;
    		ti,prus = <&pru1_0>, <&rtu1_0>, <&tx_pru1_0>,
    				<&pru1_1>, <&rtu1_1>, <&tx_pru1_1>;
    		firmware-name = "ti-pruss/am65x-sr2-pru0-prueth-fw.elf",
    				"ti-pruss/am65x-sr2-rtu0-prueth-fw.elf",
    				"ti-pruss/am65x-sr2-txpru0-prueth-fw.elf",
    				"ti-pruss/am65x-sr2-pru1-prueth-fw.elf",
    				"ti-pruss/am65x-sr2-rtu1-prueth-fw.elf",
    				"ti-pruss/am65x-sr2-txpru1-prueth-fw.elf";
    
    		ti,pruss-gp-mux-sel = <2>,      /* MII mode */
    				      <2>,
    				      <2>,
    				      <2>,	/* MII mode */
    				      <2>,
    				      <2>;
    
    		ti,mii-g-rt = <&icssg1_mii_g_rt>;
    		ti,mii-rt = <&icssg1_mii_rt>;
    		ti,pa-stats = <&icssg1_pa_stats>;
    		iep = <&icssg1_iep0>;
    
    		interrupt-parent = <&icssg1_intc>;
    		interrupts = <24 0 2>, <25 1 3>;
    		interrupt-names = "tx_ts0", "tx_ts1";
    
    		dma-coherent;
    		dmas = <&main_udmap 0xc200>, /* egress slice 0 */
    			   <&main_udmap 0xc201>, /* egress slice 0 */
    			   <&main_udmap 0xc202>, /* egress slice 0 */
    			   <&main_udmap 0xc203>, /* egress slice 0 */
    			   <&main_udmap 0xc204>, /* egress slice 1 */
    			   <&main_udmap 0xc205>, /* egress slice 1 */
    			   <&main_udmap 0xc206>, /* egress slice 1 */
    			   <&main_udmap 0xc207>, /* egress slice 1 */
    
    			   <&main_udmap 0x4200>, /* ingress slice 0 */
    			   <&main_udmap 0x4201>, /* ingress slice 1 */
    			   <&main_udmap 0x4202>, /* mgmnt rsp slice 0 */
    			   <&main_udmap 0x4203>; /* mgmnt rsp slice 1 */
    		dma-names = "tx0-0", "tx0-1", "tx0-2", "tx0-3",
    			    "tx1-0", "tx1-1", "tx1-2", "tx1-3",
    			    "rx0", "rx1";
    
    		ethernet-ports {
    			#address-cells = <1>;
    			#size-cells = <0>;
    			icssg1_emac0: port@0 {
    				reg = <0>;
    				phy-handle = <&icssg1_phy0>;
    				phy-mode = "rgmii-id";
    				//interrupts-extended = <&icssg1_intc 24 0 2>;
    				ti,syscon-rgmii-delay = <&scm_conf 0x4110>;
    				/* Filled in by bootloader */
    				local-mac-address = [00 00 00 00 00 00];
    			};
    		};
    	};
    
    	icssg2_eth: icssg2-eth {
    		compatible = "ti,am654-icssg-prueth";
    		pinctrl-names = "default";
    		pinctrl-0 = <&ethernet1_pins_default>;
    		sram = <&msmc_ram>;
    		ti,prus = <&pru2_0>, <&rtu2_0>, <&tx_pru2_0>,
    			<&pru2_1>, <&rtu2_1>, <&tx_pru2_1>;
    		firmware-name = "ti-pruss/am65x-sr2-pru0-prueth-fw.elf",
    				"ti-pruss/am65x-sr2-rtu0-prueth-fw.elf",
    				"ti-pruss/am65x-sr2-txpru0-prueth-fw.elf",
    				"ti-pruss/am65x-sr2-pru1-prueth-fw.elf",
    				"ti-pruss/am65x-sr2-rtu1-prueth-fw.elf",
    				"ti-pruss/am65x-sr2-txpru1-prueth-fw.elf";
    
    		ti,pruss-gp-mux-sel = <2>,      /* MII mode */
    				      <2>,
    				      <2>,
    				      <2>,	/* MII mode */
    				      <2>,
    				      <2>;
    
    		ti,mii-g-rt = <&icssg2_mii_g_rt>;
    		ti,mii-rt = <&icssg2_mii_rt>;
    		ti,pa-stats = <&icssg2_pa_stats>;
    		iep = <&icssg2_iep0>;
    
    		interrupt-parent = <&icssg2_intc>;
    		interrupts = <24 0 2>, <25 1 3>;
    		interrupt-names = "tx_ts0", "tx_ts1";
    
    		dmas = <&main_udmap 0xc300>, /* egress slice 0 */
    		       <&main_udmap 0xc301>, /* egress slice 0 */
    		       <&main_udmap 0xc302>, /* egress slice 0 */
    		       <&main_udmap 0xc303>, /* egress slice 0 */
    		       <&main_udmap 0xc304>, /* egress slice 1 */
    		       <&main_udmap 0xc305>, /* egress slice 1 */
    		       <&main_udmap 0xc306>, /* egress slice 1 */
    		       <&main_udmap 0xc307>, /* egress slice 1 */
    
    		       <&main_udmap 0x4300>, /* ingress slice 0 */
    		       <&main_udmap 0x4301>, /* ingress slice 1 */
    		       <&main_udmap 0x4302>, /* mgmnt rsp slice 0 */
    		       <&main_udmap 0x4303>; /* mgmnt rsp slice 1 */
    		dma-names = "tx0-0", "tx0-1", "tx0-2", "tx0-3",
    			    "tx1-0", "tx1-1", "tx1-2", "tx1-3",
    			    "rx0", "rx1";
    
    		ethernet-ports {
    			#address-cells = <1>;
    			#size-cells = <0>;
    			icssg2_emac0: port@0 {
    				reg = <0>;
    				phy-handle = <&icssg2_phy0>;
    				phy-mode = "rgmii-id";
    				ti,syscon-rgmii-delay = <&scm_conf 0x4120>;
    				/* Filled in by bootloader */
    				local-mac-address = [00 00 00 00 00 00];
    			};
    		};
    	};
    	
    };
    
    &wkup_pmx0 {
    	pinctrl-names = "default";
    	pinctrl-0 = <&eepromdone_pins_default &iovolctrl_pins_default &vbusctrl_pins_default &mcuboot_pins_default>;
    
    	phy2ax58100_pins_default: phy2ax58100_pins_default {
    		pinctrl-single,pins = <
    			AM65X_WKUP_IOPAD(0x0058, PIN_INPUT, 1) /* (N4) MCU_RGMII1_TX_CTL.MCU_RMII1_CRS_DV */
    			AM65X_WKUP_IOPAD(0x005c, PIN_INPUT, 1) /* (N5) MCU_RGMII1_RX_CTL.MCU_RMII1_RX_ER */
    			AM65X_WKUP_IOPAD(0x0068, PIN_OUTPUT, 1) /* (M4) MCU_RGMII1_TD1.MCU_RMII1_TXD1 */
    			AM65X_WKUP_IOPAD(0x006c, PIN_OUTPUT, 1) /* (M5) MCU_RGMII1_TD0.MCU_RMII1_TXD0 */
    			AM65X_WKUP_IOPAD(0x0080, PIN_INPUT, 1) /* (M6) MCU_RGMII1_RD1.MCU_RMII1_RXD1 */
    			AM65X_WKUP_IOPAD(0x0084, PIN_INPUT, 1) /* (L6) MCU_RGMII1_RD0.MCU_RMII1_RXD0 */
    			AM65X_WKUP_IOPAD(0x0070, PIN_OUTPUT, 1) /* (N1) MCU_RGMII1_TXC.MCU_RMII1_TX_EN */
    			AM65X_WKUP_IOPAD(0x0074, PIN_INPUT, 1) /* (M1) MCU_RGMII1_RXC.MCU_RMII1_REF_CLK */
    		>;
    	};
    
    	mcan0_pins_default: mcan0_pins_default {
    		pinctrl-single,pins = <
    			AM65X_WKUP_IOPAD(0x00ac, PIN_INPUT, 0) /* (W2) MCU_MCAN0_RX */
    			AM65X_WKUP_IOPAD(0x00a8, PIN_OUTPUT, 0) /* (W1) MCU_MCAN0_TX */
    		>;
    	};
    
    	phy2ax58100_mdio2_pins_default: phy2ax58100_mdio2_pins_default {
    		pinctrl-single,pins = <
    			AM65X_WKUP_IOPAD(0x008c, PIN_OUTPUT, 0) /* (L1) MCU_MDIO0_MDC */
    			AM65X_WKUP_IOPAD(0x0088, PIN_INPUT, 0) /* (L4) MCU_MDIO0_MDIO */
    		>;
    	};
    
    	usb5vsignal_pins_default: usb5vsignal_pins_default {
    		pinctrl-single,pins = <
    			AM65X_WKUP_IOPAD(0x00c4, PIN_INPUT, 7) /* (AD3) WKUP_GPIO0_5 */
    		>;
    	};
    
    	iovolctrl_pins_default: iovolctrl_pins_default {
    		pinctrl-single,pins = <
    			AM65X_WKUP_IOPAD(0x00c8, PIN_OUTPUT, 7) /* (AC2) WKUP_GPIO0_6 */ /*IO_VOLCTRL*/
    		>;
    	};
    
    	eepromdone_pins_default: eepromdone_pins_default {
    		pinctrl-single,pins = <
    			AM65X_WKUP_IOPAD(0x00cc, PIN_INPUT, 7) /* (AC1) WKUP_GPIO0_7 */ /*EEP_DONE*/
    		>;
    	};
    
    	vbusctrl_pins_default: vbusctrl_pins_default {
    		pinctrl-single,pins = <
    			AM65X_WKUP_IOPAD(0x00D8, PIN_OUTPUT, 7) /* (AB3) WKUP_GPIO0_10 */ /*USBVBUSCTRL*/
    		>;
    	};
    
        mcuboot_pins_default: mcuboot_pins_default {
    		pinctrl-single,pins = <
    			AM65X_WKUP_IOPAD(0x00B0, PIN_INPUT, 7) /* (AF4) WKUP_GPIO0_0 */ /*MCU-BOOT0*/
                AM65X_WKUP_IOPAD(0x00B4, PIN_INPUT, 7) /* (AF3) WKUP_GPIO0_1 */ /*MCU-BOOT1*/
                AM65X_WKUP_IOPAD(0x00B8, PIN_INPUT_PULLDOWN, 7) /* (AE3) WKUP_GPIO0_2 */ /*MCU-BOOT2*/
                AM65X_WKUP_IOPAD(0x00BC, PIN_INPUT_PULLDOWN, 7) /* (AD1) WKUP_GPIO0_3 */ /*MCU-BOOT3*/
                AM65X_WKUP_IOPAD(0x00C0, PIN_INPUT_PULLDOWN, 7) /* (AC3) WKUP_GPIO0_4 */ /*MCU-BOOT4*/
                AM65X_WKUP_IOPAD(0x00D0, PIN_INPUT_PULLDOWN, 7) /* (AC5) WKUP_GPIO0_8 */ /*MCU-BOOT8*/
                AM65X_WKUP_IOPAD(0x00D4, PIN_INPUT, 7) /* (AB4) WKUP_GPIO0_9 */ /*MCU-BOOT9*/
                AM65X_WKUP_IOPAD(0x0098, PIN_INPUT_PULLDOWN, 7) /* (Y2) */ /*MCU-BOOT5*/
                AM65X_WKUP_IOPAD(0x0090, PIN_INPUT_PULLDOWN, 7) /* (Y1) */ /*MCU-BOOT6*/
                AM65X_WKUP_IOPAD(0x0094, PIN_INPUT_PULLDOWN, 7) /* (Y3) */ /*MCU-BOOT7*/
    		>;
    	};
    };
    
    &main_pmx0 {
    	pinctrl-names = "default";
    	pinctrl-0 = <&gpio0_pins_default &gpio1_pins_default>;
    
    	gpio0_pins_default: gpio0_pins_default {
    		pinctrl-single,pins = <
    			AM65X_IOPAD(0x0040, PIN_OUTPUT, 7)  /* (R28) GPIO0_16 */ /*ETH1-PHY-RESET*/
    			AM65X_IOPAD(0x0058, PIN_INPUT, 7)   /* (R26) GPIO0_22 */ /*RUN/STOP SW*/
    			AM65X_IOPAD(0x005c, PIN_OUTPUT, 7)  /* (R23) GPIO0_23 */ /* SD-CARD-READY-LED */
    			AM65X_IOPAD(0x0060, PIN_OUTPUT, 7)  /* (T25) GPIO0_24 */ /*/AX58100-RST*/
    			AM65X_IOPAD(0x0064, PIN_OUTPUT, 7)  /* (T24) GPIO0_25 */ /*/AX58100-PYH-RST*/
    			AM65X_IOPAD(0x0068, PIN_OUTPUT, 7)  /* (R24) GPIO0_26 */ /* RS232-RX-LED */
    			AM65X_IOPAD(0x0070, PIN_OUTPUT, 7)  /* (R25) GPIO0_28 */ /*GPIO-eMMC-RST*/
    			AM65X_IOPAD(0x0074, PIN_INPUT, 7)   /* (T27) GPIO0_29 */ /*/24V-LV*/
    			AM65X_IOPAD(0x00ac, PIN_INPUT, 1)   /* (AH15) PRG2_PRU1_GPO0.GPIO0_43 */
    			AM65X_IOPAD(0x00b0, PIN_INPUT, 1)   /* (AC16) PRG2_PRU1_GPO1.GPIO0_44 */
    			AM65X_IOPAD(0x00b4, PIN_INPUT, 1)   /* (AD17) PRG2_PRU1_GPO2.GPIO0_45 */
    			AM65X_IOPAD(0x00b8, PIN_INPUT, 1)   /* (AH14) PRG2_PRU1_GPO3.GPIO0_46 */
    			AM65X_IOPAD(0x00d4, PIN_OUTPUT, 7)  /* (AC15) GPIO0_53 */ /*CAN-TERM*/
    			AM65X_IOPAD(0x00d8, PIN_INPUT, 1)   /* (AD14) GPIO0_54 */ /*HS_PRU2_LV*/
    			AM65X_IOPAD(0x00dc, PIN_OUTPUT, 7)   /* (AE14) GPIO0_55 */ /*HS_PRU2_IRQ*/
    			AM65X_IOPAD(0x00f4, PIN_INPUT | PIN_OUTPUT, 7)   /* (AF27) GPIO0_61 */ /*PRU0-IRQ*/
    			AM65X_IOPAD(0x00fc, PIN_INPUT | PIN_OUTPUT, 7)   /* (AG27) GPIO0_63 */ /*PRU2-IRQ*/
    			AM65X_IOPAD(0x0108, PIN_OUTPUT, 7)  /* (AH25) GPIO0_66 */ /*ETH0-PHY-RESET*/
    			AM65X_IOPAD(0x0124, PIN_OUTPUT, 7)  /* (AH26) GPIO0_73 */ /*ECAT2-PHY-RST*/
    
                AM65X_IOPAD(0x0000, PIN_INPUT_PULLDOWN, 7)  /* (M27) GPIO0_0 */
                AM65X_IOPAD(0x0004, PIN_INPUT, 7)  /* (M23) GPIO0_1 */
                AM65X_IOPAD(0x0008, PIN_INPUT, 7)  /* (M28) GPIO0_2 */
                AM65X_IOPAD(0x000C, PIN_INPUT_PULLDOWN, 7)  /* (M24) GPIO0_3 */
                AM65X_IOPAD(0x0010, PIN_INPUT_PULLDOWN, 7)  /* (N24) GPIO0_4 */
                AM65X_IOPAD(0x0014, PIN_INPUT_PULLDOWN, 7)  /* (N27) GPIO0_5 */
                AM65X_IOPAD(0x0018, PIN_INPUT, 7)  /* (N28) GPIO0_6 */
                AM65X_IOPAD(0x001C, PIN_INPUT_PULLDOWN, 7)  /* (M25) GPIO0_7 */
                AM65X_IOPAD(0x0020, PIN_INPUT_PULLDOWN, 7)  /* (N23) GPIO0_8 */
                AM65X_IOPAD(0x0024, PIN_INPUT_PULLDOWN, 7)  /* (M26) GPIO0_9 */
                AM65X_IOPAD(0x0028, PIN_INPUT_PULLDOWN, 7)  /* (P28) GPIO0_10 */
                AM65X_IOPAD(0x002C, PIN_INPUT_PULLDOWN, 7)  /* (P27) GPIO0_11 */
                AM65X_IOPAD(0x0030, PIN_INPUT_PULLDOWN, 7)  /* (N26) GPIO0_12 */
                AM65X_IOPAD(0x0034, PIN_INPUT, 7)  /* (N25) GPIO0_13 */
                AM65X_IOPAD(0x0038, PIN_INPUT_PULLDOWN, 7)  /* (P24) GPIO0_14 */
                AM65X_IOPAD(0x003C, PIN_INPUT_PULLDOWN, 7)  /* (R27) GPIO0_15 */
                AM65X_IOPAD(0x0044, PIN_INPUT_PULLDOWN, 7)  /* (P25) GPIO0_17 */
                AM65X_IOPAD(0x0048, PIN_INPUT, 7)  /* (P26) GPIO0_18 */
                AM65X_IOPAD(0x004C, PIN_INPUT, 7)  /* (U28) GPIO0_19 */
    		>;
    	};
    
    	gpio1_pins_default: gpio1_pins_default {
    		pinctrl-single,pins = <
    			AM65X_IOPAD(0x01ec, PIN_OUTPUT, 7)  /* (AG11) GPIO1_27 */ /*Latch*/
    			AM65X_IOPAD(0x01f0, PIN_INPUT, 7)   /* (AD11) GPIO1_28 */ /*/DO-FAULT*/
    			AM65X_IOPAD(0x01f4, PIN_INPUT, 1)   /* (V24) PRG0_PRU0_GPO0.GPIO1_29 */
    			AM65X_IOPAD(0x01f8, PIN_INPUT, 1)   /* (W25) PRG0_PRU0_GPO1.GPIO1_30 */
    			AM65X_IOPAD(0x01fc, PIN_INPUT, 1)   /* (W24) PRG0_PRU0_GPO2.GPIO1_31 */
    			AM65X_IOPAD(0x0200, PIN_INPUT, 1)   /* (AA27) PRG0_PRU0_GPO3.GPIO1_32 */
    			AM65X_IOPAD(0x0204, PIN_INPUT, 1)   /* (Y24) PRG0_PRU0_GPO4.GPIO1_33 */
    			AM65X_IOPAD(0x0208, PIN_INPUT, 1)   /* (V28) PRG0_PRU0_GPO5.GPIO1_34 */
    			AM65X_IOPAD(0x020c, PIN_INPUT, 1)   /* (Y25) PRG0_PRU0_GPO6.GPIO1_35 */
    			AM65X_IOPAD(0x0210, PIN_INPUT, 1)   /* (U27) PRG0_PRU0_GPO7.GPIO1_36 */
    			AM65X_IOPAD(0x0214, PIN_INPUT, 7)   /* (V27) PRG0_PRU0_GPO8.GPIO1_37 */
    			AM65X_IOPAD(0x0218, PIN_INPUT, 7)   /* (V26) PRG0_PRU0_GPO9.GPIO1_38 */
    			AM65X_IOPAD(0x021c, PIN_INPUT, 7)   /* (U25) PRG0_PRU0_GPO10.GPIO1_39 */
    			AM65X_IOPAD(0x0220, PIN_INPUT, 7)   /* (AB25) PRG0_PRU0_GPO11.GPIO1_40 */
    			AM65X_IOPAD(0x0224, PIN_INPUT, 7)   /* (AD27) PRG0_PRU0_GPO12.GPIO1_41 */
    			AM65X_IOPAD(0x0228, PIN_INPUT, 7)   /* (AC26) PRG0_PRU0_GPO13.GPIO1_42 */
    			AM65X_IOPAD(0x022c, PIN_INPUT, 7)   /* (AD26) PRG0_PRU0_GPO14.GPIO1_43 */
    			AM65X_IOPAD(0x0230, PIN_INPUT, 7)   /* (AA24) PRG0_PRU0_GPO15.GPIO1_44 */
    			AM65X_IOPAD(0x0234, PIN_INPUT, 1)   /* (AD28) GPIO1_45 */ /*HS_PRU0_LV*/
    			AM65X_IOPAD(0x023C, PIN_OUTPUT, 7)   /* (V25) GPIO1_47 */ /*HS_PRU0_IRQ*/
    			AM65X_IOPAD(0x0244, PIN_OUTPUT_PULLDOWN, 7) /* (AB28) PRG0_PRU1_GPO0.GPIO1_49 */ /*****************************************************************************/
    			AM65X_IOPAD(0x0248, PIN_OUTPUT_PULLDOWN, 7) /* (AC28) PRG0_PRU1_GPO1.GPIO1_50 */ /*We set the mode as 7 due to PRU cannot control default status of output pin*/
    			AM65X_IOPAD(0x024c, PIN_OUTPUT_PULLDOWN, 7) /* (AC27) PRG0_PRU1_GPO2.GPIO1_51 */ /*And we set the mode back to 0 using memdev2 after PRU init*/
    			AM65X_IOPAD(0x0250, PIN_OUTPUT_PULLDOWN, 7) /* (AB26) PRG0_PRU1_GPO3.GPIO1_52 */ /*****************************************************************************/
    			AM65X_IOPAD(0x0284, PIN_INPUT, 7)   /* (AC24) GPIO1_65 */
    			AM65X_IOPAD(0x0290, PIN_INPUT, 7)   /* (W26) GPIO1_68 */
    			AM65X_IOPAD(0x0294, PIN_INPUT, 7)   /* (AE26) GPIO1_69 */
    			AM65X_IOPAD(0x01d0, PIN_OUTPUT_PULLDOWN, 7) /* (AD12) GPIO1_20 */ /*SEL-OUT*/
    		>;
    	};
    
    	ledgpio1_pins_default: ledgpio1_pins_default {
    		pinctrl-single,pins = <
    			AM65X_IOPAD(0x01d4, PIN_OUTPUT, 7)  /* (AG12) GPIO1_21 */ /* RS232-TX-LED */
    			AM65X_IOPAD(0x0238, PIN_OUTPUT, 7)  /* (U26) GPIO1_46 */ /* RS485-RX-LED */
    			AM65X_IOPAD(0x0240, PIN_OUTPUT, 7)  /* (U24) GPIO1_48 */ /* BUSFAULT-LED */
    			AM65X_IOPAD(0x0298, PIN_OUTPUT, 7)  /* (AE28) GPIO1_70 */ /* ERROR-LED */
    		>;
    	};
    
    	ledgpio0_pins_default: ledgpio0_pins_default {
    		pinctrl-single,pins = <
    			AM65X_IOPAD(0x006c, PIN_OUTPUT | PIN_INPUT, 7) /* (T23) GPIO0_27 */ /* RUN-LED */
    		>;
    	};
    
    	main_mmc0_pins_default: main-mmc0-pins-default {
    		pinctrl-single,pins = <
    			AM65X_IOPAD(0x01a8, PIN_INPUT_PULLDOWN, 0) /* (B25) MMC0_CLK */
    			AM65X_IOPAD(0x01ac, PIN_INPUT_PULLUP, 0) /* (B27) MMC0_CMD */
    			AM65X_IOPAD(0x01a4, PIN_INPUT_PULLUP, 0) /* (A26) MMC0_DAT0 */
    			AM65X_IOPAD(0x01a0, PIN_INPUT_PULLUP, 0) /* (E25) MMC0_DAT1 */
    			AM65X_IOPAD(0x019c, PIN_INPUT_PULLUP, 0) /* (C26) MMC0_DAT2 */
    			AM65X_IOPAD(0x0198, PIN_INPUT_PULLUP, 0) /* (A25) MMC0_DAT3 */
    			AM65X_IOPAD(0x0194, PIN_INPUT_PULLUP, 0) /* (E24) MMC0_DAT4 */
    			AM65X_IOPAD(0x0190, PIN_INPUT_PULLUP, 0) /* (A24) MMC0_DAT5 */
    			AM65X_IOPAD(0x018c, PIN_INPUT_PULLUP, 0) /* (B26) MMC0_DAT6 */
    			AM65X_IOPAD(0x0188, PIN_INPUT_PULLUP, 0) /* (D25) MMC0_DAT7 */
    			AM65X_IOPAD(0x01b0, PIN_INPUT, 0) /* (C25) MMC0_DS */
    		>;
    	};
    
    	main_mmc1_pins_default: main-mmc1-pins-default {
    		pinctrl-single,pins = <
    			AM65X_IOPAD(0x02d4, PIN_INPUT_PULLDOWN, 0) /* (C27) MMC1_CLK */
    			AM65X_IOPAD(0x02d8, PIN_INPUT_PULLUP, 0) /* (C28) MMC1_CMD */
    			AM65X_IOPAD(0x02d0, PIN_INPUT_PULLUP, 0) /* (D28) MMC1_DAT0 */
    			AM65X_IOPAD(0x02cc, PIN_INPUT_PULLUP, 0) /* (E27) MMC1_DAT1 */
    			AM65X_IOPAD(0x02c8, PIN_INPUT_PULLUP, 0) /* (D26) MMC1_DAT2 */
    			AM65X_IOPAD(0x02c4, PIN_INPUT_PULLUP, 0) /* (D27) MMC1_DAT3 */
    			AM65X_IOPAD(0x02dc, PIN_INPUT_PULLUP, 0) /* (B24) MMC1_SDCD */
    			AM65X_IOPAD(0x02e0, PIN_INPUT, 0) /* (C24) MMC1_SDWP */
    		>;
    	};
    
    	icssg1_mdio_pins_default: icssg1_mdio_pins_default {
    		pinctrl-single,pins = <
    			AM65X_IOPAD(0x0180, PIN_INPUT, 0) /* (AD18) PRG1_MDIO0_MDIO */
    			AM65X_IOPAD(0x0184, PIN_OUTPUT, 0) /* (AH18) PRG1_MDIO0_MDC */
    		>;
    	};
    
    	ethernet0_pins_default: ethernet0_pins_default {
    		pinctrl-single,pins = <
    			AM65X_IOPAD(0x00e0, PIN_INPUT, 2) /* (AE22) PRG1_PRU0_GPO0.PRG1_RGMII1_RD0 */
    			AM65X_IOPAD(0x00e4, PIN_INPUT, 2) /* (AG24) PRG1_PRU0_GPO1.PRG1_RGMII1_RD1 */
    			AM65X_IOPAD(0x00e8, PIN_INPUT, 2) /* (AF23) PRG1_PRU0_GPO2.PRG1_RGMII1_RD2 */
    			AM65X_IOPAD(0x00ec, PIN_INPUT, 2) /* (AD21) PRG1_PRU0_GPO3.PRG1_RGMII1_RD3 */
    			AM65X_IOPAD(0x0110, PIN_OUTPUT, 2) /* (AH20) PRG1_PRU0_GPO12.PRG1_RGMII1_TD0 */
    			AM65X_IOPAD(0x0114, PIN_OUTPUT, 2) /* (AH21) PRG1_PRU0_GPO13.PRG1_RGMII1_TD1 */
    			AM65X_IOPAD(0x0118, PIN_OUTPUT, 2) /* (AG20) PRG1_PRU0_GPO14.PRG1_RGMII1_TD2 */
    			AM65X_IOPAD(0x011c, PIN_OUTPUT, 2) /* (AD19) PRG1_PRU0_GPO15.PRG1_RGMII1_TD3 */
    			AM65X_IOPAD(0x0120, PIN_INPUT, 2) /* (AD20) PRG1_PRU0_GPO16.PRG1_RGMII1_TXC */
    			AM65X_IOPAD(0x010c, PIN_OUTPUT, 2) /* (AF21) PRG1_PRU0_GPO11.PRG1_RGMII1_TX_CTL */
    			AM65X_IOPAD(0x00f8, PIN_INPUT, 2) /* (AF22) PRG1_PRU0_GPO6.PRG1_RGMII1_RXC */
    			AM65X_IOPAD(0x00f0, PIN_INPUT, 2) /* (AG23) PRG1_PRU0_GPO4.PRG1_RGMII1_RX_CTL */
    
    			//ethercat1_pins_default
    			AM65X_IOPAD(0x0130, PIN_INPUT, 2) /* (AH24) PRG1_PRU1_GPO0.PRG1_RGMII2_RD0 */
    			AM65X_IOPAD(0x0134, PIN_INPUT, 2) /* (AH23) PRG1_PRU1_GPO1.PRG1_RGMII2_RD1 */
    			AM65X_IOPAD(0x0138, PIN_INPUT, 2) /* (AG21) PRG1_PRU1_GPO2.PRG1_RGMII2_RD2 */
    			AM65X_IOPAD(0x013c, PIN_INPUT, 2) /* (AH22) PRG1_PRU1_GPO3.PRG1_RGMII2_RD3 */
    			AM65X_IOPAD(0x0160, PIN_OUTPUT, 2) /* (AE20) PRG1_PRU1_GPO12.PRG1_RGMII2_TD0 */
    			AM65X_IOPAD(0x0164, PIN_OUTPUT, 2) /* (AF19) PRG1_PRU1_GPO13.PRG1_RGMII2_TD1 */
    			AM65X_IOPAD(0x0168, PIN_OUTPUT, 2) /* (AH19) PRG1_PRU1_GPO14.PRG1_RGMII2_TD2 */
    			AM65X_IOPAD(0x016c, PIN_OUTPUT, 2) /* (AG19) PRG1_PRU1_GPO15.PRG1_RGMII2_TD3 */
    			AM65X_IOPAD(0x0170, PIN_INPUT, 2) /* (AE19) PRG1_PRU1_GPO16.PRG1_RGMII2_TXC */
    			AM65X_IOPAD(0x015c, PIN_OUTPUT, 2) /* (AC20) PRG1_PRU1_GPO11.PRG1_RGMII2_TX_CTL */
    			AM65X_IOPAD(0x0148, PIN_INPUT, 2) /* (AG22) PRG1_PRU1_GPO6.PRG1_RGMII2_RXC */
    			AM65X_IOPAD(0x0140, PIN_INPUT, 2) /* (AE21) PRG1_PRU1_GPO4.PRG1_RGMII2_RX_CTL */
    		>;
    	};
    
    	icssg2_mdio_pins_default: icssg2_mdio_pins_default {
    		pinctrl-single,pins = <
    			AM65X_IOPAD(0x0094, PIN_INPUT, 2) /* (AC19) PRG2_PRU0_GPO7.PRG2_MDIO0_MDIO */
    			AM65X_IOPAD(0x00c8, PIN_OUTPUT, 2) /* (AE15) PRG2_PRU1_GPO7.PRG2_MDIO0_MDC */
    		>;
    	};
    
    	ethernet1_pins_default: ethernet1_pins_default {
    		pinctrl-single,pins = <
    			AM65X_IOPAD(0x0078, PIN_INPUT, 2) /* (AF18) PRG2_PRU0_GPO0.PRG2_RGMII1_RD0 */
    			AM65X_IOPAD(0x007c, PIN_INPUT, 2) /* (AE18) PRG2_PRU0_GPO1.PRG2_RGMII1_RD1 */
    			AM65X_IOPAD(0x0080, PIN_INPUT, 2) /* (AH17) PRG2_PRU0_GPO2.PRG2_RGMII1_RD2 */
    			AM65X_IOPAD(0x0084, PIN_INPUT, 2) /* (AG18) PRG2_PRU0_GPO3.PRG2_RGMII1_RD3 */
    			AM65X_IOPAD(0x0098, PIN_OUTPUT, 2) /* (AH16) PRG2_PRU0_GPO8.PRG2_RGMII1_TD0 */
    			AM65X_IOPAD(0x009c, PIN_OUTPUT, 2) /* (AG16) PRG2_PRU0_GPO9.PRG2_RGMII1_TD1 */
    			AM65X_IOPAD(0x00a0, PIN_OUTPUT, 2) /* (AF16) PRG2_PRU0_GPO10.PRG2_RGMII1_TD2 */
    			AM65X_IOPAD(0x00a4, PIN_OUTPUT, 2) /* (AE16) PRG2_PRU0_GPO11.PRG2_RGMII1_TD3 */
    			AM65X_IOPAD(0x00a8, PIN_INPUT, 2) /* (AD16) PRG2_PRU0_GPO16.PRG2_RGMII1_TXC */
    			AM65X_IOPAD(0x0090, PIN_OUTPUT, 2) /* (AE17) PRG2_PRU0_GPO6.PRG2_RGMII1_TX_CTL */
    			AM65X_IOPAD(0x008c, PIN_INPUT, 2) /* (AF17) PRG2_PRU0_GPO5.PRG2_RGMII1_RXC */
    			AM65X_IOPAD(0x0088, PIN_INPUT, 2) /* (AG17) PRG2_PRU0_GPO4.PRG2_RGMII1_RX_CTL */
    		>;
    	};
    
    	main_spi0_pins_default: main-spi0-pins-default {
    		pinctrl-single,pins = <
    			AM65X_IOPAD(0x01c4, PIN_INPUT_PULLUP, 0)  /* (AH13) GPIO1_17 */ /*SPI0-CLK*/
    			AM65X_IOPAD(0x01c8, PIN_OUTPUT, 0)  /* (AE13) GPIO1_18 */ /*SPI0_D0*/
    			AM65X_IOPAD(0x01cc, PIN_INPUT, 0)   /* (AD13) GPIO1_19 */ /*SPI0_D1*/
    			AM65X_IOPAD(0x01bc, PIN_OUTPUT, 0)  /* (AG13) GPIO1_15 */ /*SPI0_CS0*/
    			AM65X_IOPAD(0x01c0, PIN_OUTPUT, 0)  /* (AF13) GPIO1_16 */ /*SPI0_CS1*/
    		>;
    	};
    
    	myspi2_pins_default: myspi2_pins_default {
    		pinctrl-single,pins = <
    			AM65X_IOPAD(0x01d8, PIN_OUTPUT, 0)  /* (AH12) GPIO1_22 */ /*SPI1_CLK*/
    			AM65X_IOPAD(0x01dc, PIN_OUTPUT, 0)  /* (AE12) GPIO1_23 */ /*SPI1_D0*/
    			AM65X_IOPAD(0x01e0, PIN_INPUT, 0)   /* (AF12) GPIO1_24 */ /*SPI1_D1*/
    		>;
    	};
    
    	main_uart0_pins_default: main-uart0-pins-default {
    		pinctrl-single,pins = <
    			AM65X_IOPAD(0x01e4, PIN_INPUT, 0)   /* (AF11) GPIO1_25 */ /*UART0_RXD*/
    			AM65X_IOPAD(0x01e8, PIN_OUTPUT, 0)  /* (AE11) GPIO1_26 */ /*UART0_TXD*/
    		>;
    	};
    
    	rs232_pins_default: rs232_pins_default {
    		pinctrl-single,pins = <
    			AM65X_IOPAD(0x0288, PIN_INPUT, 6)   /* (Y27) GPIO1_66 */ /*RS232-RXD*/
    			AM65X_IOPAD(0x0260, PIN_OUTPUT, 6)  /* (W28) GPIO1_56 */ /*RS232-TXD*/
    		>;
    	};
    
    	rs485_pins_default: rs485_pins_default {
    		pinctrl-single,pins = <
    			AM65X_IOPAD(0x0174, PIN_INPUT, 6)   /* (AE23) GPIO0_93 */ /*RS485-RXD*/
    			AM65X_IOPAD(0x014c, PIN_OUTPUT, 6)  /* (AD23) GPIO0_83 */ /*RS485-TXD*/
    			AM65X_IOPAD(0x017c, PIN_OUTPUT_PULLDOWN, 7) /* (AC21) GPIO0_95 */ /*RS485-DIR*/
    		>;
    	};
    
    	usb0_pins_default: usb0_pins_default {
    		pinctrl-single,pins = <
    			AM65X_IOPAD(0x02bc, PIN_OUTPUT, 0) /* (AD9) GPIO1_71 */ /*USB0_DRVVBUS*/
    		>;
    	};
    
    	usb20_host_pins_default: usb20_host_pins_default {
    		pinctrl-single,pins = <
    			AM65X_IOPAD(0x02c0, PIN_OUTPUT, 0) /* (AC8) GPIO1_72 */ /*USB1_DRVVBUS*/
    		>;
    	};
    };
    
    &main_pmx1 {
    	pinctrl-names = "default";
    	pinctrl-0 = <&gpio2_pins_default>;
    
    	main_i2c0_pins_default: main-i2c0-pins-default {
    		pinctrl-single,pins = <
    			AM65X_IOPAD(0x0000, PIN_INPUT, 0) /* (D20) I2C0_SCL */
    			AM65X_IOPAD(0x0004, PIN_INPUT, 0) /* (C21) I2C0_SDA */
    		>;
    	};
    
    	main_i2c1_pins_default: main-i2c1-pins-default {
    		pinctrl-single,pins = <
    			AM65X_IOPAD(0x0008, PIN_INPUT_PULLUP, 0) /* (B21) I2C1_SCL */
    			AM65X_IOPAD(0x000c, PIN_INPUT_PULLUP, 0) /* (E21) I2C1_SDA */
    		>;
    	};
    
    	gpio2_pins_default: gpio2_pins_default {
    		pinctrl-single,pins = <
    			AM65X_IOPAD(0x0010, PIN_OUTPUT, 7)  /* (D21) GPIO1_86 */ /* SER-COMM-EN */
    			AM65X_IOPAD(0x0018, PIN_INPUT, 7)   /* (B22) GPIO1_88 */ /* DDR-TP0 */
    			AM65X_IOPAD(0x001c, PIN_INPUT, 7)   /* (C23) GPIO1_89 */ /* DDR-TP1 */
    		>;
    	};
    
    	ledgpio2_pins_default: ledgpio2_pins_default {
    		pinctrl-single,pins = <
    			AM65X_IOPAD(0x0014, PIN_OUTPUT, 7) /* (A22) GPIO1_87 */	/* RS485-TX-LED */
    		>;
    	};
    };
    
    &wkup_uart0 {
    	/* Wakeup UART is used by System firmware */
    	status = "disabled";
    };
    
    /*&mcu_uart0 {
    	status = "disabled";
    }; */
    
    &main_uart0 {
    	status = "okay";
    	pinctrl-names = "default";
    	pinctrl-0 = <&main_uart0_pins_default>;
    	power-domains = <&k3_pds 146 TI_SCI_PD_SHARED>;
    };
    
    &main_uart1 {
    	status = "okay";
    	pinctrl-names = "default";
    	pinctrl-0 = <&rs485_pins_default>;
    	power-domains = <&k3_pds 147 TI_SCI_PD_SHARED>;
    	rts-gpios = <&main_gpio0 95 GPIO_ACTIVE_HIGH>;
    	rs485-rts-active-high;
    	rs485-rts-delay = <0 0>;
    	linux,rs485-enabled-at-boot-time;
    };
    
    &main_uart2 {
    	status = "okay";
    	pinctrl-names = "default";
    	pinctrl-0 = <&rs232_pins_default>;
    	power-domains = <&k3_pds 148 TI_SCI_PD_SHARED>;
    
    	current-speed = <115200>;
        fifo-size = <64>;
    };
    
    &main_i2c0 {
    	status = "okay";
    
    	pinctrl-names = "default";
    	pinctrl-0 = <&main_i2c0_pins_default>;
    	clock-frequency = <100000>;
    
    	eeprom: eeprom@50 {
    		compatible = "atmel,24c16";
    		reg = <0x50>;
    		pagesize = <16>;
    	};
    };
    
    &main_i2c1 {
    	status = "okay";
    
    	pinctrl-names = "default";
    	pinctrl-0 = <&main_i2c1_pins_default>;
    	clock-frequency = <100000>;
    
    	s35390a:rtc@30{
    		compatible = "sii,s35390a";
    		reg = <0x30>;
    	};
    };
    
    // 58100
    &main_spi0 {
        status = "okay";
    	pinctrl-names = "default";
    	pinctrl-0 = <&main_spi0_pins_default>;
    	#address-cells = <1>;
    	#size-cells= <0>;
    	ti,pindir-d0-out-d1-in = <1>;
    
        spidev@0 {
            status = "okay";
            compatible = "rohm,dh2228fv";
            reg = <0>;
            spi-max-frequency = <1000000>;
        };
    };
    
    // SN74HC595
    &main_spi1 {
        status = "okay";
    	pinctrl-names = "default";
    	pinctrl-0 = <&myspi2_pins_default>;
    	#address-cells = <1>;
    	#size-cells= <0>;
    	ti,pindir-d0-out-d1-in = <1>;
    
        spidev@0 {
            status = "okay";
            //compatible = "fairchild,74hc595";
            compatible = "rohm,dh2228fv";
            gpio-controller;
            #gpio-cells = <2>;
            reg = <0>;
            registers-number = <2>;
            registers-default = /bits/ 8 <0xb7>;
            spi-max-frequency = <100000>;
        };
    };
    
    &sdhci0 {
    	pinctrl-names = "default";
    	pinctrl-0 = <&main_mmc0_pins_default>;
    	bus-width = <8>;
    	non-removable;
    	ti,driver-strength-ohm = <50>;
    	disable-wp;
    };
    
    /*
     * Because of erratas i2025 and i2026 for silicon revision 1.0, the
     * SD card interface might fail. Boards with sr1.0 are recommended to
     * disable sdhci1
     */
    &sdhci1 {
    	//vmmc-supply = <&vdd_mmc1_sd>;
    	pinctrl-names = "default";
    	pinctrl-0 = <&main_mmc1_pins_default>;
    	ti,driver-strength-ohm = <50>;
    	disable-wp;
    };
    
    &usb1_phy {
    	status = "okay";
    };
    
    //typeA interface
    &usb1 {
    	status = "okay";
    	pinctrl-names = "default";
    	pinctrl-0 = <&usb20_host_pins_default>;
    	dr_mode = "host";
    };
    
    &dwc3_1 {
    	status = "okay";
    };
    
    &usb0_phy {
    	status = "okay";
    };
    
    &usb0 {
    	status = "okay";
    	pinctrl-names = "default";
    	pinctrl-0 = <&usb5vsignal_pins_default>;
    	dr_mode = "peripheral";
    };
    
    &dwc3_0 {
    	status = "okay";
    };
    
    
    &m_can0 {
    	status = "okay";
    	pinctrl-names = "default";
    	pinctrl-0 = <&mcan0_pins_default>;
    	//stb-gpios = <&main_gpio1 47 GPIO_ACTIVE_HIGH>;
    	can-transceiver {
    		max-bitrate = <5000000>;
    	};
    };
    
    &tscadc0 {
    	adc {
    		ti,adc-channels = <0 1 2 3 4 5 6 7>;
    	};
    };
    
    &tscadc1 {
    	adc {
    		ti,adc-channels = <0 1 2 3 4 5 6 7>;
    	};
    };
    
    &serdes0 {
    	status = "disabled";
    };
    
    &serdes1 {
    	status = "disabled";
    };
    
    &pcie0_rc {
    	status = "disabled";
    };
    
    &pcie0_ep {
    	status = "disabled";
    };
    
    &pcie1_rc {
    	status = "disabled";
    };
    
    &pcie1_ep {
    	status = "disabled";
    };
    
    
    &mailbox0_cluster0 {
    	status = "okay";
    	interrupts = <436>;
    
    	mbox_mcu_r5fss0_core0: mbox-mcu-r5fss0-core0 {
    		ti,mbox-tx = <1 0 0>;
    		ti,mbox-rx = <0 0 0>;
    	};
    };
    
    &mailbox0_cluster1 {
    	status = "okay";
    	interrupts = <432>;
    
    	mbox_mcu_r5fss0_core1: mbox-mcu-r5fss0-core1 {
    		ti,mbox-tx = <1 0 0>;
    		ti,mbox-rx = <0 0 0>;
    	};
    };
    
    
    &mailbox0_cluster2 {
    	status = "disabled";
    };
    
    &mailbox0_cluster3 {
    	status = "disabled";
    };
    
    &mailbox0_cluster4 {
    	status = "disabled";
    };
    
    &mailbox0_cluster5 {
    	status = "disabled";
    };
    
    &mailbox0_cluster6 {
    	status = "disabled";
    };
    
    &mailbox0_cluster7 {
    	status = "disabled";
    };
    
    &mailbox0_cluster8 {
    	status = "disabled";
    };
    
    &mailbox0_cluster9 {
    	status = "disabled";
    };
    
    &mailbox0_cluster10 {
    	status = "disabled";
    };
    
    &mailbox0_cluster11 {
    	status = "disabled";
    };
    
    
    &mcu_r5fss0_core0 {
    	memory-region = <&mcu_r5fss0_core0_dma_memory_region>,
    			<&mcu_r5fss0_core0_memory_region>;
    	mboxes = <&mailbox0_cluster0 &mbox_mcu_r5fss0_core0>;
    };
    
    
    
    &mcu_r5fss0_core1 {
    	memory-region = <&mcu_r5fss0_core1_dma_memory_region>,
    			<&mcu_r5fss0_core1_memory_region>;
    	mboxes = <&mailbox0_cluster1 &mbox_mcu_r5fss0_core1>;
    };
    
    
    /*
    &ospi0 {
    	pinctrl-names = "default";
    	pinctrl-0 = <&mcu_fss0_ospi0_pins_default>;
    
    	flash@0 {
    		compatible = "jedec,spi-nor";
    		reg = <0x0>;
    		spi-tx-bus-width = <8>;
    		spi-rx-bus-width = <8>;
    		spi-max-frequency = <25000000>;
    		cdns,tshsl-ns = <60>;
    		cdns,tsd2d-ns = <60>;
    		cdns,tchsh-ns = <60>;
    		cdns,tslch-ns = <60>;
    		cdns,read-delay = <0>;
    
    		partitions {
    			compatible = "fixed-partitions";
    			#address-cells = <1>;
    			#size-cells = <1>;
    
    			partition@0 {
    				label = "ospi.tiboot3";
    				reg = <0x0 0x80000>;
    			};
    
    			partition@80000 {
    				label = "ospi.tispl";
    				reg = <0x80000 0x200000>;
    			};
    
    			partition@280000 {
    				label = "ospi.u-boot";
    				reg = <0x280000 0x400000>;
    			};
    
    			partition@680000 {
    				label = "ospi.env";
    				reg = <0x680000 0x20000>;
    			};
    
    			partition@6a0000 {
    				label = "ospi.env.backup";
    				reg = <0x6a0000 0x20000>;
    			};
    
    			partition@6c0000 {
    				label = "ospi.sysfw";
    				reg = <0x6c0000 0x100000>;
    			};
    
    			partition@800000 {
    				label = "ospi.rootfs";
    				reg = <0x800000 0x37c0000>;
    			};
    
    			partition@3fe0000 {
    				label = "ospi.phypattern";
    				reg = <0x3fe0000 0x20000>;
    			};
    		};
    	};
    };
    */
    
    &mcu_cpsw {
    	pinctrl-names = "default";
    	//pinctrl-0 = <&mcu_cpsw_pins_default>;
    	pinctrl-0 = <&phy2ax58100_pins_default>, <&phy2ax58100_mdio2_pins_default>;
    };
    
    &davinci_mdio {
    	status = "okay";
    	reset-gpios = <&main_gpio0 25 GPIO_ACTIVE_LOW>;
    	reset-delay-us = <2>;   /* PHY datasheet states 1us min */
    
    	phy0: ethernet-phy@3 {
    		reg = <3>;
    	};
    };
    
    &cpsw_port1 {
    	phy-mode = "rmii";
    	phy-handle = <&phy0>;
    };
    
    &dss {
    	status = "disabled";
    };
    
    &icssg0_mdio {
    	status = "disabled";
    };
    
    &icssg1_mdio {
    	status = "okay";
    	pinctrl-names = "default";
    	pinctrl-0 = <&icssg1_mdio_pins_default>;
    
    	reset-gpios = <&main_gpio0 66 GPIO_ACTIVE_LOW>; /*83867*/
    	reset-delay-us = <2>;
    
    	icssg1_phy0: ethernet-phy@1 {
    		reg = <1>;
    		//interrupt-parent = <&main_gpio1>;
    		//interrupts = <87 0x2>;
    		ti,rx-internal-delay = <DP83867_RGMIIDCTL_2_00_NS>;
    		ti,fifo-depth = <DP83867_PHYCR_FIFO_DEPTH_4_B_NIB>;
    	};
    };
    
    &icssg2_mdio {
    	status = "okay";
    	pinctrl-names = "default";
    	pinctrl-0 = <&icssg2_mdio_pins_default>;
    	
    	reset-gpios = <&main_gpio0 16 GPIO_ACTIVE_LOW>; /*83867*/
    	reset-delay-us = <5>;
    
    	icssg2_phy0: ethernet-phy@2 {
    		reg = <2>;
    		//interrupt-parent = <&main_gpio1>;
    		//interrupts = <87 0x2>;
    		ti,rx-internal-delay = <DP83867_RGMIIDCTL_2_00_NS>;
    		ti,fifo-depth = <DP83867_PHYCR_FIFO_DEPTH_4_B_NIB>;
    	};
    };
    

  • I've made some modifications to my setup.

    &wkup_pmx0{
    
    ....
    usb5vsignal_pins_default: usb5vsignal_pins_default {
    		pinctrl-single,pins = <
    			AM65X_WKUP_IOPAD(0x00c4, PIN_INPUT, 7) /* (AD3) WKUP_GPIO0_5 */
    		>;
    	};
    ....
    
    }

    &usb0_phy {
    	status = "okay";
    };
    
    &usb0 {
    	status = "okay";
    	pinctrl-names = "default";
    	pinctrl-0 = <&usb5vsignal_pins_default>;
    	dr_mode = "peripheral";
    	maximum-speed = "high-speed";
    	vbus-gpios = <&wkup_gpio0 5 GPIO_ACTIVE_HIGH>;
    	phys = <&usb0_phy>;
    	phy-names = "usb2-phy";
    	snps,dis_u3_susphy_quirk;
    };
    
    &dwc3_0 {
    	status = "okay";
    };

    I'm able to use gpioget gpiochip0 5 to get the current 5V signal, and the state correctly changes from 0 to 1 when I plug in the USB cable. After using modprobe g_serial, the kernel logs appear to be normal. However, when I check the link_status, it consistently shows disconnected.

    root@am65xx-evm:~# gpioget gpiochip0 5
    0
    root@am65xx-evm:~# gpioget gpiochip0 5
    1
    root@am65xx-evm:~# modprobe g_serial
    [   43.518334] g_serial gadget.0: Gadget Serial v2.4
    [   43.518354] g_serial gadget.0: g_serial ready
    root@am65xx-evm:~#
    root@am65xx-evm:~# gpioget gpiochip0 5
    1
    root@am65xx-evm:~# cat /sys/kernel/debug/usb/4010000.usb/link_state
    Disconnected
    

    I've also checked the kernel logs with dmesg | grep dwc3 and found no relevant output. Is this related to the dwc3 and usbphy not starting up correctly?

    root@am65xx-evm:~# dmesg | grep usb
    [    0.689595] usbcore: registered new interface driver usbfs
    [    0.689650] usbcore: registered new interface driver hub
    [    0.689690] usbcore: registered new device driver usb
    [    0.854617] usbcore: registered new interface driver usb-storage
    [    0.858309] usbcore: registered new interface driver usbhid
    [    0.858314] usbhid: USB HID core driver
    [    8.067356] usb usb2: We don't know the algorithms for LPM for this host, disabling LPM.
    root@am65xx-evm:~# dmesg | grep dwc
    root@am65xx-evm:~# dmesg | grep dwc3
    root@am65xx-evm:~# dmesg | grep phy
    [    0.000000] Booting Linux on physical CPU 0x0000000000 [0x410fd034]
    [    0.000000] arch_timer: cp15 timer(s) running at 200.00MHz (phys).
    [    1.136772] davinci_mdio 46000f00.mdio: phy[3]: device 46000f00.mdio:03, driver TI DP83822
    [    5.985795] davinci_mdio b132400.mdio: phy[1]: device b132400.mdio:01, driver TI DP83867
    [    6.042527] davinci_mdio b232400.mdio: phy[2]: device b232400.mdio:02, driver TI DP83867
    [    7.679934] TI DP83867 b132400.mdio:01: attached PHY driver (mii_bus:phy_addr=b132400.mdio:01, irq=POLL)
    [    7.716448] TI DP83867 b232400.mdio:02: attached PHY driver (mii_bus:phy_addr=b232400.mdio:02, irq=POLL)
    [    9.171987] am65-cpsw-nuss 46000000.ethernet eth0: configuring for phy/rmii link mode
    root@am65xx-evm:~#
    

  • First of all, you should not need to manually control the VBUS (using a GPIO). The usb host provides VBUS 5v which should directly route to AM65x usb0 VBUS pin. 

    When you say GPIO turns on 5v on VBUS, did you check the voltage on usb0 VBUS pin next to AM65x? Then do you see usb0 DP pin goes high?

  • I removed the manual Vbus reading part, and I also confirmed that the pin has gone high. I re-tested the old kernel, and it can indeed correctly enable the USB Serial function. I have meticulously compared the device tree and the kernel differences, and they are identical.

  • Hi, I am out of office for 1.5 weeks. Please expect delayed response.