This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TDA4VM: Enable CPSW0 Main Domain Ethernet Switch with SGMII Interface in U-Boot

Part Number: TDA4VM

Hi TI,

I want to enable networking on a custom board in U-Boot. Our hardware looks the following:

  • Ethernet Ports are all connected to Main Domain Ethernet Switch (CPSW0)
  • We are using SGMII interface for all connected PHYs.
  • We are using only TI DP83867 Ethernet PHYs. 
  • In specific: SGMII5 is connected to Phy with adress 0x0; SGMII6 is connected to Phy with adress 0x1; SGMII7 is connected to Phy with adress 0x2

I applied the following patches mentioned in this thread (https://e2e.ti.com/support/processors-group/processors/f/processors-forum/1266033/dra829v-enable-cpsw0-main-domain-ethernet-switch-in-u-boot/4805685): 0001, 0002, 0003, 0010, 0011, 0012, 0013 0014.

At the moment, I am only interested in the PHY connected to SGMII7 interface with hardware defined address 0x2.

The relevant device tree files are the following:

Board Specific Device Tree:

// SPDX-License-Identifier: GPL-2.0
/*
 * Copyright (C) 2019 Texas Instruments Incorporated - https://www.ti.com/
 */

/dts-v1/;

#include "k3-j721e-som-p0.dtsi"
#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/input/input.h>
#include <dt-bindings/net/ti-dp83867.h>
#include <dt-bindings/phy/phy-cadence.h>

/ {
	chosen {
		stdout-path = "serial8:115200n8";
		bootargs = "console=ttyS8,115200n8 earlycon=ns16550a,mmio32,0x02860000";
	};

	evm_12v0: fixedregulator-evm12v0 {
		/* main supply */
		compatible = "regulator-fixed";
		regulator-name = "evm_12v0";
		regulator-min-microvolt = <12000000>;
		regulator-max-microvolt = <12000000>;
		regulator-always-on;
		regulator-boot-on;
	};

	vsys_3v3: fixedregulator-vsys3v3 {
		/* Output of LMS140 */
		compatible = "regulator-fixed";
		regulator-name = "vsys_3v3";
		regulator-min-microvolt = <3300000>;
		regulator-max-microvolt = <3300000>;
		vin-supply = <&evm_12v0>;
		regulator-always-on;
		regulator-boot-on;
	};

	vsys_5v0: fixedregulator-vsys5v0 {
		/* Output of LM5140 */
		compatible = "regulator-fixed";
		regulator-name = "vsys_5v0";
		regulator-min-microvolt = <5000000>;
		regulator-max-microvolt = <5000000>;
		vin-supply = <&evm_12v0>;
		regulator-always-on;
		regulator-boot-on;
	};
};

&main_pmx0 {

	mycpts0_pins_default: mycpts0-default-pins {
		pinctrl-single,pins = <
			J721E_IOPAD(0x228, PIN_INPUT, 1) /* (Y6) I2C1_SCL.CPTS0_HW1TSPUSH */
			J721E_IOPAD(0x22c, PIN_INPUT, 1) /* (AA6) I2C1_SDA.CPTS0_HW2TSPUSH */
			J721E_IOPAD(0x230, PIN_INPUT, 2) /* (U2) ECAP0_IN_APWM_OUT.CPTS0_RFT_CLK */
			J721E_IOPAD(0x1c4, PIN_INPUT, 1) /* (Y4) SPI0_CS1.CPTS0_TS_COMP */
			J721E_IOPAD(0x1d8, PIN_INPUT, 1) /* (W4) SPI1_CS1.CPTS0_TS_SYNC */
		>;
	};

	mymdio1_pins_default: mymdio1-default-pins {
		pinctrl-single,pins = <
			J721E_IOPAD(0x1bc, PIN_OUTPUT, 0) /* (V24) MDIO0_MDC */
			J721E_IOPAD(0x1b8, PIN_INPUT, 0) /* (V26) MDIO0_MDIO */
		>;
	};


	myuart6_main_pins_default: myuart6_main-default-pins {
		pinctrl-single,pins = <
			J721E_IOPAD(0xd0, PIN_INPUT, 14) /* (AC27) PRG0_PRU0_GPO8.UART6_RXD */
			J721E_IOPAD(0xd4, PIN_OUTPUT, 14) /* (AB26) PRG0_PRU0_GPO9.UART6_TXD */
		>;
	};

	myusb0_spare_pins_default: myusb0_spare-default-pins {
		pinctrl-single,pins = <
			J721E_IOPAD(0x210, PIN_OUTPUT, 3) /* (W3) MCAN1_RX.USB0_DRVVBUS */
		>;
	};
	
	mygpio0_pins_default: mygpio0-default-pins {
		pinctrl-single,pins = <
			J721E_IOPAD(0x18, PIN_INPUT, 7) /* (AD20) PRG1_PRU0_GPO5.GPIO0_6 */
			J721E_IOPAD(0x20, PIN_OUTPUT, 7) /* (AE20) PRG1_PRU0_GPO7.GPIO0_8 */
			J721E_IOPAD(0x2c, PIN_INPUT, 7) /* (AD21) PRG1_PRU0_GPO10.GPIO0_11 */
			J721E_IOPAD(0x4c, PIN_OUTPUT, 7) /* (AJ21) PRG1_PRU0_GPO17.GPIO0_18 */
			J721E_IOPAD(0x50, PIN_OUTPUT, 7) /* (AE21) PRG1_PRU0_GPO18.GPIO0_19 */
			J721E_IOPAD(0x54, PIN_INPUT, 7) /* (AH21) PRG1_PRU0_GPO19.GPIO0_20 */
			J721E_IOPAD(0x58, PIN_INPUT, 7) /* (AE22) PRG1_PRU1_GPO0.GPIO0_21 */
			J721E_IOPAD(0x5c, PIN_INPUT, 7) /* (AG23) PRG1_PRU1_GPO1.GPIO0_22 */
			J721E_IOPAD(0x60, PIN_INPUT, 7) /* (AF23) PRG1_PRU1_GPO2.GPIO0_23 */
			J721E_IOPAD(0x6c, PIN_INPUT, 7) /* (AG21) PRG1_PRU1_GPO5.GPIO0_26 */
			J721E_IOPAD(0x70, PIN_INPUT, 7) /* (AE23) PRG1_PRU1_GPO6.GPIO0_27 */
			J721E_IOPAD(0x78, PIN_INPUT, 7) /* (Y23) PRG1_PRU1_GPO8.GPIO0_29 */
			J721E_IOPAD(0x88, PIN_INPUT_PULLUP, 7) /* (AH25) PRG1_PRU1_GPO12.GPIO0_33 */
			J721E_IOPAD(0x8c, PIN_INPUT_PULLUP, 7) /* (AG25) PRG1_PRU1_GPO13.GPIO0_34 */
			J721E_IOPAD(0x90, PIN_INPUT_PULLUP, 7) /* (AH26) PRG1_PRU1_GPO14.GPIO0_35 */
			J721E_IOPAD(0x94, PIN_INPUT, 7) /* (AJ27) PRG1_PRU1_GPO15.GPIO0_36 */
			J721E_IOPAD(0x98, PIN_INPUT, 7) /* (AJ26) PRG1_PRU1_GPO16.GPIO0_37 */
			J721E_IOPAD(0xac, PIN_OUTPUT, 7) /* (AD18) PRG1_MDIO0_MDC.GPIO0_42 */
			J721E_IOPAD(0xc4, PIN_INPUT, 7) /* (AC29) PRG0_PRU0_GPO5.GPIO0_48 */
			J721E_IOPAD(0xd8, PIN_INPUT, 7) /* (AB25) PRG0_PRU0_GPO10.GPIO0_53 */
			J721E_IOPAD(0xfc, PIN_INPUT, 7) /* (AB28) PRG0_PRU0_GPO19.GPIO0_62 */
			J721E_IOPAD(0x114, PIN_INPUT, 7) /* (AB27) PRG0_PRU1_GPO5.GPIO0_68 */
			J721E_IOPAD(0x120, PIN_INPUT, 7) /* (AA28) PRG0_PRU1_GPO8.GPIO0_71 */
			J721E_IOPAD(0x124, PIN_INPUT, 7) /* (Y24) PRG0_PRU1_GPO9.GPIO0_72 */
			J721E_IOPAD(0x128, PIN_INPUT, 7) /* (AA25) PRG0_PRU1_GPO10.GPIO0_73 */
			J721E_IOPAD(0x1a4, PIN_INPUT, 7) /* (W26) RGMII6_RXC.GPIO0_104 */
		>;
	};
};

&wkup_pmx0 {
	mywkup_gpio0_pins_default: mywkup_gpio0-default-pins {
		pinctrl-single,pins = <
			J721E_WKUP_IOPAD(0x4, PIN_OUTPUT, 7) /* (C21) MCU_OSPI0_LBCLKO.WKUP_GPIO0_17 */
			J721E_WKUP_IOPAD(0x8, PIN_OUTPUT, 7) /* (D21) MCU_OSPI0_DQS.WKUP_GPIO0_18 */
			J721E_WKUP_IOPAD(0x1c, PIN_OUTPUT, 7) /* (F21) MCU_OSPI0_D4.WKUP_GPIO0_23 */
			J721E_WKUP_IOPAD(0x20, PIN_OUTPUT, 7) /* (E21) MCU_OSPI0_D5.WKUP_GPIO0_24 */
			J721E_WKUP_IOPAD(0x24, PIN_OUTPUT, 7) /* (B22) MCU_OSPI0_D6.WKUP_GPIO0_25 */
			J721E_WKUP_IOPAD(0x28, PIN_OUTPUT, 7) /* (G21) MCU_OSPI0_D7.WKUP_GPIO0_26 */
			J721E_WKUP_IOPAD(0x58, PIN_INPUT, 7) /* (B27) MCU_RGMII1_TX_CTL.WKUP_GPIO0_38 */
			J721E_WKUP_IOPAD(0x5c, PIN_INPUT, 7) /* (C25) MCU_RGMII1_RX_CTL.WKUP_GPIO0_39 */
			J721E_WKUP_IOPAD(0x6c, PIN_OUTPUT, 7) /* (B25) MCU_RGMII1_TD0.WKUP_GPIO0_43 */
			J721E_WKUP_IOPAD(0x70, PIN_INPUT, 7) /* (B26) MCU_RGMII1_TXC.WKUP_GPIO0_44 */
			J721E_WKUP_IOPAD(0x74, PIN_INPUT, 7) /* (C24) MCU_RGMII1_RXC.WKUP_GPIO0_45 */
			J721E_WKUP_IOPAD(0x7c, PIN_OUTPUT, 7) /* (D24) MCU_RGMII1_RD2.WKUP_GPIO0_47 */
			J721E_WKUP_IOPAD(0x84, PIN_INPUT, 7) /* (B24) MCU_RGMII1_RD0.WKUP_GPIO0_49 */
			J721E_WKUP_IOPAD(0x88, PIN_INPUT, 7) /* (E23) MCU_MDIO0_MDIO.WKUP_GPIO0_50 */
		>;
	};
};

&main_cpsw0 {
	status = "okay";
	pinctrl-names = "default";
	pinctrl-0 = <&mymdio1_pins_default>;
};

&main_cpsw0_mdio {

	//reset-gpios = <&wkup_gpio1 50 GPIO_ACTIVE_LOW>;
	reset-port-delay-us = <120000>;
	
	cpsw9g_phy0: ethernet-phy@0 {
		reg = <0>;
	};
	cpsw9g_phy1: ethernet-phy@1 {
		reg = <1>;
	};
	cpsw9g_phy2: ethernet-phy@2 {
		reg = <2>;
	};
};


//&main_cpsw0_port5 {
//        phy-mode = "sgmii";
//        mac-address = [00 00 00 00 00 00];
//        phys = <&main_phy_gmii_sel 5>;
//        phy-handle = <&cpsw9g_phy0>;
//};

//&main_cpsw0_port6 {
//        phy-mode = "sgmii";
//        mac-address = [00 00 00 00 00 00];
//        phys = <&main_phy_gmii_sel 6>;
//        phy-names = "portmode", "serdes-phy";
//        phy-handle = <&cpsw9g_phy1>;
//};

&main_cpsw0_port7 {
        phy-mode = "sgmii";
        mac-address = [00 00 00 00 00 00];
        phys = <&main_phy_gmii_sel 7>;
        phy-handle = <&cpsw9g_phy2>;
};

&wkup_uart0 {
	/* Wakeup UART is used by System firmware */
	status = "reserved";
};

&main_uart0 {
	/* UART not brought out */
	status = "disabled";
};

&main_uart3 {
	/* UART not brought out */
	status = "disabled";
};

&main_uart4 {
	status = "disabled";
};

&main_uart5 {
	/* UART not brought out */
	status = "disabled";
};

&main_uart6 {
	pinctrl-names = "default";
	pinctrl-0 = <&myuart6_main_pins_default>;
	status = "okay";
	power-domains = <&k3_pds 283 TI_SCI_PD_SHARED>;
};

&main_uart7 {
	/* UART not brought out */
	status = "disabled";
};

&main_uart8 {
	/* UART not brought out */
	status = "disabled";
};

&main_uart9 {
	/* UART not brought out */
	status = "disabled";
};

&main_gpio2 {
	status = "disabled";
};

&main_gpio3 {
	status = "disabled";
};

&main_gpio4 {
	status = "disabled";
};

&main_gpio5 {
	status = "disabled";
};

&main_gpio6 {
	status = "disabled";
};

&main_gpio7 {
	status = "disabled";
};

&wkup_gpio1 {
	status = "disabled";
};

&main_sdhci0 {
	/* eMMC */
	non-removable;
	ti,driver-strength-ohm = <50>;
	disable-wp;
};

&main_sdhci1 {
	/* Unused */
	status = "disabled";
};

&main_sdhci2 {
	/* Unused */
	status = "disabled";
};

&usb_serdes_mux {
	idle-states = <1>, <0>; /* USB0 to SERDES3, USB1 to SERDES1 */
};

&serdes_ln_ctrl {
	idle-states = <J721E_SERDES0_LANE0_PCIE0_LANE0>, <J721E_SERDES0_LANE1_QSGMII_LANE2>,
		      <J721E_SERDES1_LANE0_PCIE1_LANE0>, <J721E_SERDES1_LANE1_PCIE1_LANE1>,
		      <J721E_SERDES2_LANE0_PCIE2_LANE0>, <J721E_SERDES2_LANE1_PCIE2_LANE1>,
		      <J721E_SERDES3_LANE0_USB3_0_SWAP>, <J721E_SERDES3_LANE1_USB3_0>,
		      <J721E_SERDES4_LANE0_QSGMII_LANE5>, <J721E_SERDES4_LANE1_QSGMII_LANE6>,
		      <J721E_SERDES4_LANE2_QSGMII_LANE7>, <J721E_SERDES4_LANE3_QSGMII_LANE8>;
};

&serdes_wiz3 {
	typec-dir-gpios = <&main_gpio1 3 GPIO_ACTIVE_HIGH>;
	typec-dir-debounce-ms = <700>;	/* TUSB321, tCCB_DEFAULT 133 ms */
};

&serdes3 {
	serdes3_usb_link: phy@0 {
		reg = <0>;
		cdns,num-lanes = <2>;
		#phy-cells = <0>;
		cdns,phy-type = <PHY_TYPE_USB3>;
		resets = <&serdes_wiz3 1>, <&serdes_wiz3 2>;
	};
};

&usbss0 {
	pinctrl-names = "default";
	pinctrl-0 = <&myusb0_spare_pins_default>;
	ti,vbus-divider;
};

&usb0 {
	dr_mode = "otg";
	maximum-speed = "super-speed";
	phys = <&serdes3_usb_link>;
	phy-names = "cdns3,usb3-phy";
};

&usbss1 {
	status = "disabled";
};

&usb1 {
	status = "disabled";
};

&mcu_cpsw {
	status = "disabled";
	pinctrl-names = "default";
	//pinctrl-0 = <&mcu_cpsw_pins_default &mcu_mdio_pins_default>;
};

&davinci_mdio {
	status = "disabled";
	phy0: ethernet-phy@0 {
		reg = <0>;
		ti,rx-internal-delay = <DP83867_RGMIIDCTL_2_00_NS>;
		ti,fifo-depth = <DP83867_PHYCR_FIFO_DEPTH_4_B_NIB>;
	};
};

&cpsw_port1 {
	status = "disabled";
	phy-mode = "rgmii-rxid";
	phy-handle = <&phy0>;
};

&mcasp0 {
	status = "disabled";
};

&mcasp1 {
	status = "disabled";
};

&mcasp2 {
	status = "disabled";
};

&mcasp3 {
	status = "disabled";
};

&mcasp4 {
	status = "disabled";
};

&mcasp5 {
	status = "disabled";
};

&mcasp6 {
	status = "disabled";
};

&mcasp7 {
	status = "disabled";
};

&mcasp8 {
	status = "disabled";
};

&mcasp9 {
	status = "disabled";
};

&mcasp10 {
	status = "disabled";
};

&mcasp11 {
	status = "disabled";
};

&cmn_refclk1 {
	clock-frequency = <100000000>;
};

&wiz0_pll1_refclk {
	assigned-clocks = <&wiz0_pll1_refclk>;
	assigned-clock-parents = <&cmn_refclk1>;
};

&wiz0_refclk_dig {
	assigned-clocks = <&wiz0_refclk_dig>;
	assigned-clock-parents = <&cmn_refclk1>;
};

&serdes0 {
	assigned-clocks = <&serdes0 CDNS_SIERRA_PLL_CMNLC>, <&serdes0 CDNS_SIERRA_PLL_CMNLC1>;
	assigned-clock-parents = <&wiz0_pll1_refclk>, <&wiz0_pll1_refclk>;

	serdes0_qsgmii_link: phy@1 {
		reg = <1>;
		cdns,num-lanes = <1>;
		#phy-cells = <0>;
		cdns,phy-type = <PHY_TYPE_QSGMII>;
		resets = <&serdes_wiz0 2>;
	};
};

&pcie0_rc {
	status = "disabled";
};

&pcie1_rc {
	status = "disabled";
};

&pcie2_rc {
	status = "disabled";
};

&pcie0_ep {
	status = "disabled";
};

&pcie1_ep {
	status = "disabled";
};

&pcie2_ep {
	status = "disabled";
};

&pcie3_rc {
	status = "disabled";
};

&pcie3_ep {
	status = "disabled";
};

&dss {
	status = "disabled";
};

&icssg0_mdio {
	status = "disabled";
};

&icssg1_mdio {
	status = "disabled";
};

k3-j721e-main.dtsi:

// SPDX-License-Identifier: GPL-2.0
/*
 * Device Tree Source for J721E SoC Family Main Domain peripherals
 *
 * Copyright (C) 2016-2020 Texas Instruments Incorporated - https://www.ti.com/
 */
#include <dt-bindings/phy/phy.h>
#include <dt-bindings/mux/mux.h>
#include <dt-bindings/mux/ti-serdes.h>

/ {
	cmn_refclk: clock-cmnrefclk {
		#clock-cells = <0>;
		compatible = "fixed-clock";
		clock-frequency = <0>;
	};

	cmn_refclk1: clock-cmnrefclk1 {
		#clock-cells = <0>;
		compatible = "fixed-clock";
		clock-frequency = <0>;
	};
};

&cbass_main {
	msmc_ram: sram@70000000 {
		compatible = "mmio-sram";
		reg = <0x0 0x70000000 0x0 0x800000>;
		#address-cells = <1>;
		#size-cells = <1>;
		ranges = <0x0 0x0 0x70000000 0x800000>;

		atf-sram@0 {
			reg = <0x0 0x20000>;
		};
	};

	scm_conf: scm-conf@100000 {
		compatible = "ti,j721e-system-controller", "syscon", "simple-mfd";
		reg = <0 0x00100000 0 0x1c000>; /* excludes pinctrl region */
		#address-cells = <1>;
		#size-cells = <1>;
		ranges = <0x0 0x0 0x00100000 0x1c000>;

		serdes_ln_ctrl: mux@4080 {
			compatible = "mmio-mux";
			reg = <0x00004080 0x50>;
			#mux-control-cells = <1>;
			mux-reg-masks = <0x4080 0x3>, <0x4084 0x3>, /* SERDES0 lane0/1 select */
					<0x4090 0x3>, <0x4094 0x3>, /* SERDES1 lane0/1 select */
					<0x40a0 0x3>, <0x40a4 0x3>, /* SERDES2 lane0/1 select */
					<0x40b0 0x3>, <0x40b4 0x3>, /* SERDES3 lane0/1 select */
					<0x40c0 0x3>, <0x40c4 0x3>, /* SERDES4 lane0/1/2/3 select */
					<0x40c8 0x3>, <0x40cc 0x3>; /* SERDES4 lane0/1/2/3 select */
					
			idle-states = <J721E_SERDES0_LANE0_PCIE0_LANE0>, <J721E_SERDES0_LANE1_PCIE0_LANE1>,
				      <J721E_SERDES1_LANE0_PCIE1_LANE0>, <J721E_SERDES1_LANE1_PCIE1_LANE1>,
				      <J721E_SERDES2_LANE0_PCIE2_LANE0>, <J721E_SERDES2_LANE1_PCIE2_LANE1>,
				      <MUX_IDLE_AS_IS>, <J721E_SERDES3_LANE1_USB3_0>,
				      <J721E_SERDES4_LANE0_EDP_LANE0>, <J721E_SERDES4_LANE1_EDP_LANE1>,
				      <J721E_SERDES4_LANE2_EDP_LANE2>, <J721E_SERDES4_LANE3_EDP_LANE3>;
		};

		usb_serdes_mux: mux-controller@4000 {
			compatible = "mmio-mux";
			#mux-control-cells = <1>;
			mux-reg-masks = <0x4000 0x8000000>, /* USB0 to SERDES0/3 mux */
					<0x4010 0x8000000>; /* USB1 to SERDES1/2 mux */
	        };

		main_phy_gmii_sel: phy@4044 {
			compatible = "ti,am654-phy-gmii-sel";
			reg = <0x4044 0x20>;
			#phy-cells = <1>;
		};
	};

	gic500: interrupt-controller@1800000 {
		compatible = "arm,gic-v3";
		#address-cells = <2>;
		#size-cells = <2>;
		ranges;
		#interrupt-cells = <3>;
		interrupt-controller;
		reg = <0x00 0x01800000 0x00 0x10000>,	/* GICD */
		      <0x00 0x01900000 0x00 0x100000>;	/* GICR */

		/* vcpumntirq: virtual CPU interface maintenance interrupt */
		interrupts = <GIC_PPI 9 IRQ_TYPE_LEVEL_HIGH>;

		gic_its: msi-controller@1820000 {
			compatible = "arm,gic-v3-its";
			reg = <0x00 0x01820000 0x00 0x10000>;
			socionext,synquacer-pre-its = <0x1000000 0x400000>;
			msi-controller;
			#msi-cells = <1>;
		};
	};

	main_gpio_intr: interrupt-controller@a00000 {
		compatible = "ti,sci-intr";
		reg = <0x00 0x00a00000 0x00 0x800>;
		ti,intr-trigger-type = <1>;
		interrupt-controller;
		interrupt-parent = <&gic500>;
		#interrupt-cells = <1>;
		ti,sci = <&dmsc>;
		ti,sci-dev-id = <131>;
		ti,interrupt-ranges = <8 392 56>;
	};

	main_navss: bus@30000000 {
		compatible = "simple-mfd";
		#address-cells = <2>;
		#size-cells = <2>;
		ranges = <0x00 0x30000000 0x00 0x30000000 0x00 0x0c400000>;
		dma-coherent;
		dma-ranges;

		ti,sci-dev-id = <199>;

		main_navss_intr: interrupt-controller@310e0000 {
			compatible = "ti,sci-intr";
			reg = <0x0 0x310e0000 0x0 0x4000>;
			ti,intr-trigger-type = <4>;
			interrupt-controller;
			interrupt-parent = <&gic500>;
			#interrupt-cells = <1>;
			ti,sci = <&dmsc>;
			ti,sci-dev-id = <213>;
			ti,interrupt-ranges = <0 64 64>,
					      <64 448 64>,
					      <128 672 64>;
		};

		main_udmass_inta: interrupt-controller@33d00000 {
			compatible = "ti,sci-inta";
			reg = <0x0 0x33d00000 0x0 0x100000>;
			interrupt-controller;
			interrupt-parent = <&main_navss_intr>;
			msi-controller;
			#interrupt-cells = <0>;
			ti,sci = <&dmsc>;
			ti,sci-dev-id = <209>;
			ti,interrupt-ranges = <0 0 256>;
		};

		secure_proxy_main: mailbox@32c00000 {
			compatible = "ti,am654-secure-proxy";
			#mbox-cells = <1>;
			reg-names = "target_data", "rt", "scfg";
			reg = <0x00 0x32c00000 0x00 0x100000>,
			      <0x00 0x32400000 0x00 0x100000>,
			      <0x00 0x32800000 0x00 0x100000>;
			interrupt-names = "rx_011";
			interrupts = <GIC_SPI 37 IRQ_TYPE_LEVEL_HIGH>;
		};

		smmu0: iommu@36600000 {
			compatible = "arm,smmu-v3";
			reg = <0x0 0x36600000 0x0 0x100000>;
			interrupt-parent = <&gic500>;
			interrupts = <GIC_SPI 772 IRQ_TYPE_EDGE_RISING>,
				     <GIC_SPI 768 IRQ_TYPE_EDGE_RISING>;
			interrupt-names = "eventq", "gerror";
			#iommu-cells = <1>;
		};

		hwspinlock: spinlock@30e00000 {
			compatible = "ti,am654-hwspinlock";
			reg = <0x00 0x30e00000 0x00 0x1000>;
			#hwlock-cells = <1>;
		};

		mailbox0_cluster0: mailbox@31f80000 {
			compatible = "ti,am654-mailbox";
			reg = <0x00 0x31f80000 0x00 0x200>;
			#mbox-cells = <1>;
			ti,mbox-num-users = <4>;
			ti,mbox-num-fifos = <16>;
			interrupt-parent = <&main_navss_intr>;
		};

		mailbox0_cluster1: mailbox@31f81000 {
			compatible = "ti,am654-mailbox";
			reg = <0x00 0x31f81000 0x00 0x200>;
			#mbox-cells = <1>;
			ti,mbox-num-users = <4>;
			ti,mbox-num-fifos = <16>;
			interrupt-parent = <&main_navss_intr>;
		};

		mailbox0_cluster2: mailbox@31f82000 {
			compatible = "ti,am654-mailbox";
			reg = <0x00 0x31f82000 0x00 0x200>;
			#mbox-cells = <1>;
			ti,mbox-num-users = <4>;
			ti,mbox-num-fifos = <16>;
			interrupt-parent = <&main_navss_intr>;
		};

		mailbox0_cluster3: mailbox@31f83000 {
			compatible = "ti,am654-mailbox";
			reg = <0x00 0x31f83000 0x00 0x200>;
			#mbox-cells = <1>;
			ti,mbox-num-users = <4>;
			ti,mbox-num-fifos = <16>;
			interrupt-parent = <&main_navss_intr>;
		};

		mailbox0_cluster4: mailbox@31f84000 {
			compatible = "ti,am654-mailbox";
			reg = <0x00 0x31f84000 0x00 0x200>;
			#mbox-cells = <1>;
			ti,mbox-num-users = <4>;
			ti,mbox-num-fifos = <16>;
			interrupt-parent = <&main_navss_intr>;
		};

		mailbox0_cluster5: mailbox@31f85000 {
			compatible = "ti,am654-mailbox";
			reg = <0x00 0x31f85000 0x00 0x200>;
			#mbox-cells = <1>;
			ti,mbox-num-users = <4>;
			ti,mbox-num-fifos = <16>;
			interrupt-parent = <&main_navss_intr>;
		};

		mailbox0_cluster6: mailbox@31f86000 {
			compatible = "ti,am654-mailbox";
			reg = <0x00 0x31f86000 0x00 0x200>;
			#mbox-cells = <1>;
			ti,mbox-num-users = <4>;
			ti,mbox-num-fifos = <16>;
			interrupt-parent = <&main_navss_intr>;
		};

		mailbox0_cluster7: mailbox@31f87000 {
			compatible = "ti,am654-mailbox";
			reg = <0x00 0x31f87000 0x00 0x200>;
			#mbox-cells = <1>;
			ti,mbox-num-users = <4>;
			ti,mbox-num-fifos = <16>;
			interrupt-parent = <&main_navss_intr>;
		};

		mailbox0_cluster8: mailbox@31f88000 {
			compatible = "ti,am654-mailbox";
			reg = <0x00 0x31f88000 0x00 0x200>;
			#mbox-cells = <1>;
			ti,mbox-num-users = <4>;
			ti,mbox-num-fifos = <16>;
			interrupt-parent = <&main_navss_intr>;
		};

		mailbox0_cluster9: mailbox@31f89000 {
			compatible = "ti,am654-mailbox";
			reg = <0x00 0x31f89000 0x00 0x200>;
			#mbox-cells = <1>;
			ti,mbox-num-users = <4>;
			ti,mbox-num-fifos = <16>;
			interrupt-parent = <&main_navss_intr>;
		};

		mailbox0_cluster10: mailbox@31f8a000 {
			compatible = "ti,am654-mailbox";
			reg = <0x00 0x31f8a000 0x00 0x200>;
			#mbox-cells = <1>;
			ti,mbox-num-users = <4>;
			ti,mbox-num-fifos = <16>;
			interrupt-parent = <&main_navss_intr>;
		};

		mailbox0_cluster11: mailbox@31f8b000 {
			compatible = "ti,am654-mailbox";
			reg = <0x00 0x31f8b000 0x00 0x200>;
			#mbox-cells = <1>;
			ti,mbox-num-users = <4>;
			ti,mbox-num-fifos = <16>;
			interrupt-parent = <&main_navss_intr>;
		};

		main_ringacc: ringacc@3c000000 {
			compatible = "ti,am654-navss-ringacc";
			reg =	<0x0 0x3c000000 0x0 0x400000>,
				<0x0 0x38000000 0x0 0x400000>,
				<0x0 0x31120000 0x0 0x100>,
				<0x0 0x33000000 0x0 0x40000>;
			reg-names = "rt", "fifos", "proxy_gcfg", "proxy_target";
			ti,num-rings = <1024>;
			ti,sci-rm-range-gp-rings = <0x1>; /* GP ring range */
			ti,sci = <&dmsc>;
			ti,sci-dev-id = <211>;
			msi-parent = <&main_udmass_inta>;
		};

		main_udmap: dma-controller@31150000 {
			compatible = "ti,j721e-navss-main-udmap";
			reg =	<0x0 0x31150000 0x0 0x100>,
				<0x0 0x34000000 0x0 0x100000>,
				<0x0 0x35000000 0x0 0x100000>;
			reg-names = "gcfg", "rchanrt", "tchanrt";
			msi-parent = <&main_udmass_inta>;
			#dma-cells = <1>;

			ti,sci = <&dmsc>;
			ti,sci-dev-id = <212>;
			ti,ringacc = <&main_ringacc>;

			ti,sci-rm-range-tchan = <0x0d>, /* TX_CHAN */
						<0x0f>, /* TX_HCHAN */
						<0x10>; /* TX_UHCHAN */
			ti,sci-rm-range-rchan = <0x0a>, /* RX_CHAN */
						<0x0b>, /* RX_HCHAN */
						<0x0c>; /* RX_UHCHAN */
			ti,sci-rm-range-rflow = <0x00>; /* GP RFLOW */
		};

		cpts@310d0000 {
			compatible = "ti,j721e-cpts";
			reg = <0x0 0x310d0000 0x0 0x400>;
			reg-names = "cpts";
			clocks = <&k3_clks 201 1>;
			clock-names = "cpts";
			interrupts-extended = <&main_navss_intr 391>;
			interrupt-names = "cpts";
			ti,cpts-periodic-outputs = <6>;
			ti,cpts-ext-ts-inputs = <8>;
		};
	};

	main_crypto: crypto@4e00000 {
		compatible = "ti,j721e-sa2ul";
		reg = <0x0 0x4e00000 0x0 0x1200>;
		power-domains = <&k3_pds 264 TI_SCI_PD_EXCLUSIVE>;
		#address-cells = <2>;
		#size-cells = <2>;
		ranges = <0x0 0x04e00000 0x00 0x04e00000 0x0 0x30000>;

		dmas = <&main_udmap 0xc000>, <&main_udmap 0x4000>,
				<&main_udmap 0x4001>;
		dma-names = "tx", "rx1", "rx2";
		dma-coherent;

		rng: rng@4e10000 {
			compatible = "inside-secure,safexcel-eip76";
			reg = <0x0 0x4e10000 0x0 0x7d>;
			interrupts = <GIC_SPI 11 IRQ_TYPE_LEVEL_HIGH>;
			clocks = <&k3_clks 264 1>;
		};
	};

	main_pmx0: pinctrl@11c000 {
		compatible = "pinctrl-single";
		/* Proxy 0 addressing */
		reg = <0x0 0x11c000 0x0 0x2b4>;
		#pinctrl-cells = <1>;
		pinctrl-single,register-width = <32>;
		pinctrl-single,function-mask = <0xffffffff>;
	};

	serdes_wiz0: wiz@5000000 {
		compatible = "ti,j721e-wiz-16g";
		#address-cells = <1>;
		#size-cells = <1>;
		power-domains = <&k3_pds 292 TI_SCI_PD_EXCLUSIVE>;
		clocks = <&k3_clks 292 5>, <&k3_clks 292 11>, <&cmn_refclk>;
		clock-names = "fck", "core_ref_clk", "ext_ref_clk";
		assigned-clocks = <&k3_clks 292 11>, <&k3_clks 292 0>;
		assigned-clock-parents = <&k3_clks 292 15>, <&k3_clks 292 4>;
		num-lanes = <2>;
		#reset-cells = <1>;
		ranges = <0x5000000 0x0 0x5000000 0x10000>;

		wiz0_pll0_refclk: pll0-refclk {
			clocks = <&k3_clks 292 11>, <&cmn_refclk>;
			#clock-cells = <0>;
			assigned-clocks = <&wiz0_pll0_refclk>;
			assigned-clock-parents = <&k3_clks 292 11>;
		};

		wiz0_pll1_refclk: pll1-refclk {
			clocks = <&k3_clks 292 0>, <&cmn_refclk1>;
			#clock-cells = <0>;
			assigned-clocks = <&wiz0_pll1_refclk>;
			assigned-clock-parents = <&k3_clks 292 0>;
		};

		wiz0_refclk_dig: refclk-dig {
			clocks = <&k3_clks 292 11>, <&k3_clks 292 0>, <&cmn_refclk>, <&cmn_refclk1>;
			#clock-cells = <0>;
			assigned-clocks = <&wiz0_refclk_dig>;
			assigned-clock-parents = <&k3_clks 292 11>;
		};

		wiz0_cmn_refclk_dig_div: cmn-refclk-dig-div {
			clocks = <&wiz0_refclk_dig>;
			#clock-cells = <0>;
		};

		wiz0_cmn_refclk1_dig_div: cmn-refclk1-dig-div {
			clocks = <&wiz0_pll1_refclk>;
			#clock-cells = <0>;
		};

		serdes0: serdes@5000000 {
			compatible = "ti,sierra-phy-t0";
			reg-names = "serdes";
			reg = <0x5000000 0x10000>;
			#address-cells = <1>;
			#size-cells = <0>;
			#clock-cells = <1>;
			resets = <&serdes_wiz0 0>;
			reset-names = "sierra_reset";
			clocks = <&wiz0_cmn_refclk_dig_div>, <&wiz0_cmn_refclk1_dig_div>,
				 <&wiz0_pll0_refclk>, <&wiz0_pll1_refclk>;
			clock-names = "cmn_refclk_dig_div", "cmn_refclk1_dig_div",
				      "pll0_refclk", "pll1_refclk";
		};
	};

	serdes_wiz1: wiz@5010000 {
		compatible = "ti,j721e-wiz-16g";
		#address-cells = <1>;
		#size-cells = <1>;
		power-domains = <&k3_pds 293 TI_SCI_PD_EXCLUSIVE>;
		clocks = <&k3_clks 293 5>, <&k3_clks 293 13>, <&cmn_refclk>;
		clock-names = "fck", "core_ref_clk", "ext_ref_clk";
		assigned-clocks = <&k3_clks 293 13>, <&k3_clks 293 0>;
		assigned-clock-parents = <&k3_clks 293 17>, <&k3_clks 293 4>;
		num-lanes = <2>;
		#reset-cells = <1>;
		ranges = <0x5010000 0x0 0x5010000 0x10000>;

		wiz1_pll0_refclk: pll0-refclk {
			clocks = <&k3_clks 293 13>, <&cmn_refclk>;
			#clock-cells = <0>;
			assigned-clocks = <&wiz1_pll0_refclk>;
			assigned-clock-parents = <&k3_clks 293 13>;
		};

		wiz1_pll1_refclk: pll1-refclk {
			clocks = <&k3_clks 293 0>, <&cmn_refclk1>;
			#clock-cells = <0>;
			assigned-clocks = <&wiz1_pll1_refclk>;
			assigned-clock-parents = <&k3_clks 293 0>;
		};

		wiz1_refclk_dig: refclk-dig {
			clocks = <&k3_clks 293 13>, <&k3_clks 293 0>, <&cmn_refclk>, <&cmn_refclk1>;
			#clock-cells = <0>;
			assigned-clocks = <&wiz1_refclk_dig>;
			assigned-clock-parents = <&k3_clks 293 13>;
		};

		wiz1_cmn_refclk_dig_div: cmn-refclk-dig-div{
			clocks = <&wiz1_refclk_dig>;
			#clock-cells = <0>;
		};

		wiz1_cmn_refclk1_dig_div: cmn-refclk1-dig-div {
			clocks = <&wiz1_pll1_refclk>;
			#clock-cells = <0>;
		};

		serdes1: serdes@5010000 {
			compatible = "ti,sierra-phy-t0";
			reg-names = "serdes";
			reg = <0x5010000 0x10000>;
			#address-cells = <1>;
			#size-cells = <0>;
			#clock-cells = <1>;
			resets = <&serdes_wiz1 0>;
			reset-names = "sierra_reset";
			clocks = <&wiz1_cmn_refclk_dig_div>, <&wiz1_cmn_refclk1_dig_div>,
				 <&wiz1_pll0_refclk>, <&wiz1_pll1_refclk>;
			clock-names = "cmn_refclk_dig_div", "cmn_refclk1_dig_div",
				      "pll0_refclk", "pll1_refclk";
		};
	};

	serdes_wiz2: wiz@5020000 {
		compatible = "ti,j721e-wiz-16g";
		#address-cells = <1>;
		#size-cells = <1>;
		power-domains = <&k3_pds 294 TI_SCI_PD_EXCLUSIVE>;
		clocks = <&k3_clks 294 5>, <&k3_clks 294 11>, <&cmn_refclk>;
		clock-names = "fck", "core_ref_clk", "ext_ref_clk";
		assigned-clocks = <&k3_clks 294 11>, <&k3_clks 294 0>;
		assigned-clock-parents = <&k3_clks 294 15>, <&k3_clks 294 4>;
		num-lanes = <2>;
		#reset-cells = <1>;
		ranges = <0x5020000 0x0 0x5020000 0x10000>;

		wiz2_pll0_refclk: pll0-refclk {
			clocks = <&k3_clks 294 11>, <&cmn_refclk>;
			#clock-cells = <0>;
			assigned-clocks = <&wiz2_pll0_refclk>;
			assigned-clock-parents = <&k3_clks 294 11>;
		};

		wiz2_pll1_refclk: pll1-refclk {
			clocks = <&k3_clks 294 0>, <&cmn_refclk1>;
			#clock-cells = <0>;
			assigned-clocks = <&wiz2_pll1_refclk>;
			assigned-clock-parents = <&k3_clks 294 0>;
		};

		wiz2_refclk_dig: refclk-dig {
			clocks = <&k3_clks 294 11>, <&k3_clks 294 0>, <&cmn_refclk>, <&cmn_refclk1>;
			#clock-cells = <0>;
			assigned-clocks = <&wiz2_refclk_dig>;
			assigned-clock-parents = <&k3_clks 294 11>;
		};

		wiz2_cmn_refclk_dig_div: cmn-refclk-dig-div {
			clocks = <&wiz2_refclk_dig>;
			#clock-cells = <0>;
		};

		wiz2_cmn_refclk1_dig_div: cmn-refclk1-dig-div {
			clocks = <&wiz2_pll1_refclk>;
			#clock-cells = <0>;
		};

		serdes2: serdes@5020000 {
			compatible = "ti,sierra-phy-t0";
			reg-names = "serdes";
			reg = <0x5020000 0x10000>;
			#address-cells = <1>;
			#size-cells = <0>;
			#clock-cells = <1>;
			resets = <&serdes_wiz2 0>;
			reset-names = "sierra_reset";
			clocks = <&wiz2_cmn_refclk_dig_div>, <&wiz2_cmn_refclk1_dig_div>,
				 <&wiz2_pll0_refclk>, <&wiz2_pll1_refclk>;
			clock-names = "cmn_refclk_dig_div", "cmn_refclk1_dig_div",
				      "pll0_refclk", "pll1_refclk";
		};
	};

	serdes_wiz3: wiz@5030000 {
		compatible = "ti,j721e-wiz-16g";
		#address-cells = <1>;
		#size-cells = <1>;
		power-domains = <&k3_pds 295 TI_SCI_PD_EXCLUSIVE>;
		clocks = <&k3_clks 295 5>, <&k3_clks 295 9>, <&cmn_refclk>;
		clock-names = "fck", "core_ref_clk", "ext_ref_clk";
		assigned-clocks = <&k3_clks 295 9>, <&k3_clks 295 0>;
		assigned-clock-parents = <&k3_clks 295 13>, <&k3_clks 295 4>;
		num-lanes = <2>;
		#reset-cells = <1>;
		ranges = <0x5030000 0x0 0x5030000 0x10000>;

		wiz3_pll0_refclk: pll0-refclk {
			clocks = <&k3_clks 295 9>, <&cmn_refclk>;
			#clock-cells = <0>;
			assigned-clocks = <&wiz3_pll0_refclk>;
			assigned-clock-parents = <&k3_clks 295 9>;
		};

		wiz3_pll1_refclk: pll1-refclk {
			clocks = <&k3_clks 295 0>, <&cmn_refclk1>;
			#clock-cells = <0>;
			assigned-clocks = <&wiz3_pll1_refclk>;
			assigned-clock-parents = <&k3_clks 295 0>;
		};

		wiz3_refclk_dig: refclk-dig {
			clocks = <&k3_clks 295 9>, <&k3_clks 295 0>, <&cmn_refclk>, <&cmn_refclk1>;
			#clock-cells = <0>;
			assigned-clocks = <&wiz3_refclk_dig>;
			assigned-clock-parents = <&k3_clks 295 9>;
		};

		wiz3_cmn_refclk_dig_div: cmn-refclk-dig-div {
			clocks = <&wiz3_refclk_dig>;
			#clock-cells = <0>;
		};

		wiz3_cmn_refclk1_dig_div: cmn-refclk1-dig-div {
			clocks = <&wiz3_pll1_refclk>;
			#clock-cells = <0>;
		};

		serdes3: serdes@5030000 {
			compatible = "ti,sierra-phy-t0";
			reg-names = "serdes";
			reg = <0x5030000 0x10000>;
			#address-cells = <1>;
			#size-cells = <0>;
			#clock-cells = <1>;
			resets = <&serdes_wiz3 0>;
			reset-names = "sierra_reset";
			clocks = <&wiz3_cmn_refclk_dig_div>, <&wiz3_cmn_refclk1_dig_div>,
				 <&wiz3_pll0_refclk>, <&wiz3_pll1_refclk>;
			clock-names = "cmn_refclk_dig_div", "cmn_refclk1_dig_div",
				      "pll0_refclk", "pll1_refclk";
		};
	};
	
	serdes_wiz4: wiz@5050000 {
		compatible = "ti,j721e-wiz-16g";
		#address-cells = <1>;
		#size-cells = <1>;
		power-domains = <&k3_pds 297 TI_SCI_PD_EXCLUSIVE>;
		clocks = <&k3_clks 297 1>, <&k3_clks 297 9>, <&cmn_refclk>;
		clock-names = "fck", "core_ref_clk", "ext_ref_clk";
		assigned-clocks = <&k3_clks 297 9>;
		assigned-clock-parents = <&k3_clks 297 10>;
		assigned-clock-rates = <19200000>;
		num-lanes = <4>;
		#reset-cells = <1>;
		ranges = <0x5050000 0x0 0x5050000 0x10000>,
			<0xa030a00 0x0 0xa030a00 0x40>;

		wiz4_pll0_refclk: pll0-refclk {
			clocks = <&k3_clks 297 9>, <&cmn_refclk>;
			clock-output-names = "wiz4_pll0_refclk";
			#clock-cells = <0>;
			assigned-clocks = <&wiz4_pll0_refclk>;
			assigned-clock-parents = <&k3_clks 297 9>;
		};

		wiz4_pll1_refclk: pll1-refclk {
			clocks = <&k3_clks 297 9>, <&cmn_refclk>;
			clock-output-names = "wiz4_pll1_refclk";
			#clock-cells = <0>;
			assigned-clocks = <&wiz4_pll1_refclk>;
			assigned-clock-parents = <&k3_clks 297 9>;
		};

		wiz4_refclk_dig: refclk-dig {
			clocks = <&k3_clks 297 9>, <&cmn_refclk>;
			clock-output-names = "wiz4_refclk_dig";
			#clock-cells = <0>;
			assigned-clocks = <&wiz4_refclk_dig>;
			assigned-clock-parents = <&k3_clks 297 9>;
		};

		wiz4_cmn_refclk_dig_div: cmn-refclk-dig-div {
			clocks = <&wiz4_refclk_dig>;
			#clock-cells = <0>;
		};

		wiz4_cmn_refclk1_dig_div: cmn-refclk1-dig-div {
			clocks = <&wiz4_pll1_refclk>;
			#clock-cells = <0>;
		};

		serdes4: serdes@5050000 {
			/*
			 * Note: we also map DPTX PHY registers as the Torrent
			 * needs to manage those.
			 */
			compatible = "ti,j721e-serdes-10g";
			reg = <0x5050000 0x10000>,
			      <0xa030a00 0x40>; /* DPTX PHY */
			reg-names = "torrent_phy", "dptx_phy";

			resets = <&serdes_wiz4 0>;
			reset-names = "torrent_reset";
			clocks = <&wiz4_pll0_refclk>;
			clock-names = "refclk";
			#address-cells = <1>;
			#size-cells = <0>;
			
			serdes4_sgmii_link: phy@0 {
				reg = <0>;
				resets = <&serdes_wiz4 1>, <&serdes_wiz4  2>, <&serdes_wiz4 3>, <&serdes_wiz4 4>;
				cdns,phy-type = <PHY_TYPE_SGMII>;
				cdns,num-lanes = <4>;
				#phy-cells = <0>;
			};
		};
	};

	pcie0_rc: pcie@2900000 {
		compatible = "ti,j721e-pcie-host";
		reg = <0x00 0x02900000 0x00 0x1000>,
		      <0x00 0x02907000 0x00 0x400>,
		      <0x00 0x0d000000 0x00 0x00800000>,
		      <0x00 0x10000000 0x00 0x00001000>;
		reg-names = "intd_cfg", "user_cfg", "reg", "cfg";
		interrupt-names = "link_state";
		interrupts = <GIC_SPI 318 IRQ_TYPE_EDGE_RISING>;
		device_type = "pci";
		ti,syscon-pcie-ctrl = <&scm_conf 0x4070>;
		max-link-speed = <3>;
		num-lanes = <2>;
		power-domains = <&k3_pds 239 TI_SCI_PD_EXCLUSIVE>;
		clocks = <&k3_clks 239 1>;
		clock-names = "fck";
		#address-cells = <3>;
		#size-cells = <2>;
		bus-range = <0x0 0xf>;
		vendor-id = <0x104c>;
		device-id = <0xb00d>;
		msi-map = <0x0 &gic_its 0x0 0x10000>;
		dma-coherent;
		ranges = <0x01000000 0x0 0x10001000 0x0 0x10001000 0x0 0x0010000>,
			 <0x02000000 0x0 0x10011000 0x0 0x10011000 0x0 0x7fef000>;
		dma-ranges = <0x02000000 0x0 0x0 0x0 0x0 0x10000 0x0>;
	};

	pcie0_ep: pcie-ep@2900000 {
		compatible = "ti,j721e-pcie-ep";
		reg = <0x00 0x02900000 0x00 0x1000>,
		      <0x00 0x02907000 0x00 0x400>,
		      <0x00 0x0d000000 0x00 0x00800000>,
		      <0x00 0x10000000 0x00 0x08000000>;
		reg-names = "intd_cfg", "user_cfg", "reg", "mem";
		interrupt-names = "link_state";
		interrupts = <GIC_SPI 318 IRQ_TYPE_EDGE_RISING>;
		ti,syscon-pcie-ctrl = <&scm_conf 0x4070>;
		max-link-speed = <3>;
		num-lanes = <2>;
		power-domains = <&k3_pds 239 TI_SCI_PD_EXCLUSIVE>;
		clocks = <&k3_clks 239 1>;
		clock-names = "fck";
		max-functions = /bits/ 8 <6>;
		max-virtual-functions = /bits/ 16 <4 4 4 4 0 0>;
		dma-coherent;
	};

	pcie1_rc: pcie@2910000 {
		compatible = "ti,j721e-pcie-host";
		reg = <0x00 0x02910000 0x00 0x1000>,
		      <0x00 0x02917000 0x00 0x400>,
		      <0x00 0x0d800000 0x00 0x00800000>,
		      <0x00 0x18000000 0x00 0x00001000>;
		reg-names = "intd_cfg", "user_cfg", "reg", "cfg";
		interrupt-names = "link_state";
		interrupts = <GIC_SPI 330 IRQ_TYPE_EDGE_RISING>;
		device_type = "pci";
		ti,syscon-pcie-ctrl = <&scm_conf 0x4074>;
		max-link-speed = <3>;
		num-lanes = <2>;
		power-domains = <&k3_pds 240 TI_SCI_PD_EXCLUSIVE>;
		clocks = <&k3_clks 240 1>;
		clock-names = "fck";
		#address-cells = <3>;
		#size-cells = <2>;
		bus-range = <0x0 0xf>;
		vendor-id = <0x104c>;
		device-id = <0xb00d>;
		msi-map = <0x0 &gic_its 0x10000 0x10000>;
		dma-coherent;
		ranges = <0x01000000 0x0 0x18001000 0x0 0x18001000 0x0 0x0010000>,
			 <0x02000000 0x0 0x18011000 0x0 0x18011000 0x0 0x7fef000>;
		dma-ranges = <0x02000000 0x0 0x0 0x0 0x0 0x10000 0x0>;
	};

	pcie1_ep: pcie-ep@2910000 {
		compatible = "ti,j721e-pcie-ep";
		reg = <0x00 0x02910000 0x00 0x1000>,
		      <0x00 0x02917000 0x00 0x400>,
		      <0x00 0x0d800000 0x00 0x00800000>,
		      <0x00 0x18000000 0x00 0x08000000>;
		reg-names = "intd_cfg", "user_cfg", "reg", "mem";
		interrupt-names = "link_state";
		interrupts = <GIC_SPI 330 IRQ_TYPE_EDGE_RISING>;
		ti,syscon-pcie-ctrl = <&scm_conf 0x4074>;
		max-link-speed = <3>;
		num-lanes = <2>;
		power-domains = <&k3_pds 240 TI_SCI_PD_EXCLUSIVE>;
		clocks = <&k3_clks 240 1>;
		clock-names = "fck";
		max-functions = /bits/ 8 <6>;
		max-virtual-functions = /bits/ 16 <4 4 4 4 0 0>;
		dma-coherent;
	};

	pcie2_rc: pcie@2920000 {
		compatible = "ti,j721e-pcie-host";
		reg = <0x00 0x02920000 0x00 0x1000>,
		      <0x00 0x02927000 0x00 0x400>,
		      <0x00 0x0e000000 0x00 0x00800000>,
		      <0x44 0x00000000 0x00 0x00001000>;
		reg-names = "intd_cfg", "user_cfg", "reg", "cfg";
		interrupt-names = "link_state";
		interrupts = <GIC_SPI 342 IRQ_TYPE_EDGE_RISING>;
		device_type = "pci";
		ti,syscon-pcie-ctrl = <&scm_conf 0x4078>;
		max-link-speed = <3>;
		num-lanes = <2>;
		power-domains = <&k3_pds 241 TI_SCI_PD_EXCLUSIVE>;
		clocks = <&k3_clks 241 1>;
		clock-names = "fck";
		#address-cells = <3>;
		#size-cells = <2>;
		bus-range = <0x0 0xf>;
		vendor-id = <0x104c>;
		device-id = <0xb00d>;
		msi-map = <0x0 &gic_its 0x20000 0x10000>;
		dma-coherent;
		ranges = <0x01000000 0x0 0x00001000 0x44 0x00001000 0x0 0x0010000>,
			 <0x02000000 0x0 0x00011000 0x44 0x00011000 0x0 0x7fef000>;
		dma-ranges = <0x02000000 0x0 0x0 0x0 0x0 0x10000 0x0>;
	};

	pcie2_ep: pcie-ep@2920000 {
		compatible = "ti,j721e-pcie-ep";
		reg = <0x00 0x02920000 0x00 0x1000>,
		      <0x00 0x02927000 0x00 0x400>,
		      <0x00 0x0e000000 0x00 0x00800000>,
		      <0x44 0x00000000 0x00 0x08000000>;
		reg-names = "intd_cfg", "user_cfg", "reg", "mem";
		interrupt-names = "link_state";
		interrupts = <GIC_SPI 342 IRQ_TYPE_EDGE_RISING>;
		ti,syscon-pcie-ctrl = <&scm_conf 0x4078>;
		max-link-speed = <3>;
		num-lanes = <2>;
		power-domains = <&k3_pds 241 TI_SCI_PD_EXCLUSIVE>;
		clocks = <&k3_clks 241 1>;
		clock-names = "fck";
		max-functions = /bits/ 8 <6>;
		max-virtual-functions = /bits/ 16 <4 4 4 4 0 0>;
		dma-coherent;
	};

	pcie3_rc: pcie@2930000 {
		compatible = "ti,j721e-pcie-host";
		reg = <0x00 0x02930000 0x00 0x1000>,
		      <0x00 0x02937000 0x00 0x400>,
		      <0x00 0x0e800000 0x00 0x00800000>,
		      <0x44 0x10000000 0x00 0x00001000>;
		reg-names = "intd_cfg", "user_cfg", "reg", "cfg";
		interrupt-names = "link_state";
		interrupts = <GIC_SPI 354 IRQ_TYPE_EDGE_RISING>;
		device_type = "pci";
		ti,syscon-pcie-ctrl = <&scm_conf 0x407c>;
		max-link-speed = <3>;
		num-lanes = <2>;
		power-domains = <&k3_pds 242 TI_SCI_PD_EXCLUSIVE>;
		clocks = <&k3_clks 242 1>;
		clock-names = "fck";
		#address-cells = <3>;
		#size-cells = <2>;
		bus-range = <0x0 0xf>;
		vendor-id = <0x104c>;
		device-id = <0xb00d>;
		msi-map = <0x0 &gic_its 0x30000 0x10000>;
		dma-coherent;
		ranges = <0x01000000 0x0 0x00001000 0x44 0x10001000 0x0 0x0010000>,
			 <0x02000000 0x0 0x00011000 0x44 0x10011000 0x0 0x7fef000>;
		dma-ranges = <0x02000000 0x0 0x0 0x0 0x0 0x10000 0x0>;
	};

	pcie3_ep: pcie-ep@2930000 {
		compatible = "ti,j721e-pcie-ep";
		reg = <0x00 0x02930000 0x00 0x1000>,
		      <0x00 0x02937000 0x00 0x400>,
		      <0x00 0x0e800000 0x00 0x00800000>,
		      <0x44 0x10000000 0x00 0x08000000>;
		reg-names = "intd_cfg", "user_cfg", "reg", "mem";
		interrupt-names = "link_state";
		interrupts = <GIC_SPI 354 IRQ_TYPE_EDGE_RISING>;
		ti,syscon-pcie-ctrl = <&scm_conf 0x407c>;
		max-link-speed = <3>;
		num-lanes = <2>;
		power-domains = <&k3_pds 242 TI_SCI_PD_EXCLUSIVE>;
		clocks = <&k3_clks 242 1>;
		clock-names = "fck";
		max-functions = /bits/ 8 <6>;
		max-virtual-functions = /bits/ 16 <4 4 4 4 0 0>;
		dma-coherent;
		#address-cells = <2>;
		#size-cells = <2>;
	};

	main_uart0: serial@2800000 {
		compatible = "ti,j721e-uart", "ti,am654-uart";
		reg = <0x00 0x02800000 0x00 0x100>;
		interrupts = <GIC_SPI 192 IRQ_TYPE_LEVEL_HIGH>;
		clock-frequency = <48000000>;
		current-speed = <115200>;
		power-domains = <&k3_pds 146 TI_SCI_PD_EXCLUSIVE>;
		clocks = <&k3_clks 146 0>;
		clock-names = "fclk";
	};

	main_uart1: serial@2810000 {
		compatible = "ti,j721e-uart", "ti,am654-uart";
		reg = <0x00 0x02810000 0x00 0x100>;
		interrupts = <GIC_SPI 193 IRQ_TYPE_LEVEL_HIGH>;
		clock-frequency = <48000000>;
		current-speed = <115200>;
		power-domains = <&k3_pds 278 TI_SCI_PD_EXCLUSIVE>;
		clocks = <&k3_clks 278 0>;
		clock-names = "fclk";
	};

	main_uart2: serial@2820000 {
		compatible = "ti,j721e-uart", "ti,am654-uart";
		reg = <0x00 0x02820000 0x00 0x100>;
		interrupts = <GIC_SPI 194 IRQ_TYPE_LEVEL_HIGH>;
		clock-frequency = <48000000>;
		current-speed = <115200>;
		power-domains = <&k3_pds 279 TI_SCI_PD_EXCLUSIVE>;
		clocks = <&k3_clks 279 0>;
		clock-names = "fclk";
	};

	main_uart3: serial@2830000 {
		compatible = "ti,j721e-uart", "ti,am654-uart";
		reg = <0x00 0x02830000 0x00 0x100>;
		interrupts = <GIC_SPI 195 IRQ_TYPE_LEVEL_HIGH>;
		clock-frequency = <48000000>;
		current-speed = <115200>;
		power-domains = <&k3_pds 280 TI_SCI_PD_EXCLUSIVE>;
		clocks = <&k3_clks 280 0>;
		clock-names = "fclk";
	};

	main_uart4: serial@2840000 {
		compatible = "ti,j721e-uart", "ti,am654-uart";
		reg = <0x00 0x02840000 0x00 0x100>;
		interrupts = <GIC_SPI 196 IRQ_TYPE_LEVEL_HIGH>;
		clock-frequency = <48000000>;
		current-speed = <115200>;
		power-domains = <&k3_pds 281 TI_SCI_PD_EXCLUSIVE>;
		clocks = <&k3_clks 281 0>;
		clock-names = "fclk";
	};

	main_uart5: serial@2850000 {
		compatible = "ti,j721e-uart", "ti,am654-uart";
		reg = <0x00 0x02850000 0x00 0x100>;
		interrupts = <GIC_SPI 197 IRQ_TYPE_LEVEL_HIGH>;
		clock-frequency = <48000000>;
		current-speed = <115200>;
		power-domains = <&k3_pds 282 TI_SCI_PD_EXCLUSIVE>;
		clocks = <&k3_clks 282 0>;
		clock-names = "fclk";
	};

	main_uart6: serial@2860000 {
		compatible = "ti,j721e-uart", "ti,am654-uart";
		reg = <0x00 0x02860000 0x00 0x100>;
		interrupts = <GIC_SPI 198 IRQ_TYPE_LEVEL_HIGH>;
		clock-frequency = <48000000>;
		current-speed = <115200>;
		power-domains = <&k3_pds 283 TI_SCI_PD_EXCLUSIVE>;
		clocks = <&k3_clks 283 0>;
		clock-names = "fclk";
	};

	main_uart7: serial@2870000 {
		compatible = "ti,j721e-uart", "ti,am654-uart";
		reg = <0x00 0x02870000 0x00 0x100>;
		interrupts = <GIC_SPI 199 IRQ_TYPE_LEVEL_HIGH>;
		clock-frequency = <48000000>;
		current-speed = <115200>;
		power-domains = <&k3_pds 284 TI_SCI_PD_EXCLUSIVE>;
		clocks = <&k3_clks 284 0>;
		clock-names = "fclk";
	};

	main_uart8: serial@2880000 {
		compatible = "ti,j721e-uart", "ti,am654-uart";
		reg = <0x00 0x02880000 0x00 0x100>;
		interrupts = <GIC_SPI 248 IRQ_TYPE_LEVEL_HIGH>;
		clock-frequency = <48000000>;
		current-speed = <115200>;
		power-domains = <&k3_pds 285 TI_SCI_PD_EXCLUSIVE>;
		clocks = <&k3_clks 285 0>;
		clock-names = "fclk";
	};

	main_uart9: serial@2890000 {
		compatible = "ti,j721e-uart", "ti,am654-uart";
		reg = <0x00 0x02890000 0x00 0x100>;
		interrupts = <GIC_SPI 249 IRQ_TYPE_LEVEL_HIGH>;
		clock-frequency = <48000000>;
		current-speed = <115200>;
		power-domains = <&k3_pds 286 TI_SCI_PD_EXCLUSIVE>;
		clocks = <&k3_clks 286 0>;
		clock-names = "fclk";
	};

	main_gpio0: gpio@600000 {
		compatible = "ti,j721e-gpio", "ti,keystone-gpio";
		reg = <0x0 0x00600000 0x0 0x100>;
		gpio-controller;
		#gpio-cells = <2>;
		interrupt-parent = <&main_gpio_intr>;
		interrupts = <256>, <257>, <258>, <259>,
			     <260>, <261>, <262>, <263>;
		interrupt-controller;
		#interrupt-cells = <2>;
		ti,ngpio = <128>;
		ti,davinci-gpio-unbanked = <0>;
		power-domains = <&k3_pds 105 TI_SCI_PD_EXCLUSIVE>;
		clocks = <&k3_clks 105 0>;
		clock-names = "gpio";
	};

	main_gpio1: gpio@601000 {
		compatible = "ti,j721e-gpio", "ti,keystone-gpio";
		reg = <0x0 0x00601000 0x0 0x100>;
		gpio-controller;
		#gpio-cells = <2>;
		interrupt-parent = <&main_gpio_intr>;
		interrupts = <288>, <289>, <290>;
		interrupt-controller;
		#interrupt-cells = <2>;
		ti,ngpio = <36>;
		ti,davinci-gpio-unbanked = <0>;
		power-domains = <&k3_pds 106 TI_SCI_PD_EXCLUSIVE>;
		clocks = <&k3_clks 106 0>;
		clock-names = "gpio";
	};

	main_gpio2: gpio@610000 {
		compatible = "ti,j721e-gpio", "ti,keystone-gpio";
		reg = <0x0 0x00610000 0x0 0x100>;
		gpio-controller;
		#gpio-cells = <2>;
		interrupt-parent = <&main_gpio_intr>;
		interrupts = <264>, <265>, <266>, <267>,
			     <268>, <269>, <270>, <271>;
		interrupt-controller;
		#interrupt-cells = <2>;
		ti,ngpio = <128>;
		ti,davinci-gpio-unbanked = <0>;
		power-domains = <&k3_pds 107 TI_SCI_PD_EXCLUSIVE>;
		clocks = <&k3_clks 107 0>;
		clock-names = "gpio";
	};

	main_gpio3: gpio@611000 {
		compatible = "ti,j721e-gpio", "ti,keystone-gpio";
		reg = <0x0 0x00611000 0x0 0x100>;
		gpio-controller;
		#gpio-cells = <2>;
		interrupt-parent = <&main_gpio_intr>;
		interrupts = <292>, <293>, <294>;
		interrupt-controller;
		#interrupt-cells = <2>;
		ti,ngpio = <36>;
		ti,davinci-gpio-unbanked = <0>;
		power-domains = <&k3_pds 108 TI_SCI_PD_EXCLUSIVE>;
		clocks = <&k3_clks 108 0>;
		clock-names = "gpio";
	};

	main_gpio4: gpio@620000 {
		compatible = "ti,j721e-gpio", "ti,keystone-gpio";
		reg = <0x0 0x00620000 0x0 0x100>;
		gpio-controller;
		#gpio-cells = <2>;
		interrupt-parent = <&main_gpio_intr>;
		interrupts = <272>, <273>, <274>, <275>,
			     <276>, <277>, <278>, <279>;
		interrupt-controller;
		#interrupt-cells = <2>;
		ti,ngpio = <128>;
		ti,davinci-gpio-unbanked = <0>;
		power-domains = <&k3_pds 109 TI_SCI_PD_EXCLUSIVE>;
		clocks = <&k3_clks 109 0>;
		clock-names = "gpio";
	};

	main_gpio5: gpio@621000 {
		compatible = "ti,j721e-gpio", "ti,keystone-gpio";
		reg = <0x0 0x00621000 0x0 0x100>;
		gpio-controller;
		#gpio-cells = <2>;
		interrupt-parent = <&main_gpio_intr>;
		interrupts = <296>, <297>, <298>;
		interrupt-controller;
		#interrupt-cells = <2>;
		ti,ngpio = <36>;
		ti,davinci-gpio-unbanked = <0>;
		power-domains = <&k3_pds 110 TI_SCI_PD_EXCLUSIVE>;
		clocks = <&k3_clks 110 0>;
		clock-names = "gpio";
	};

	main_gpio6: gpio@630000 {
		compatible = "ti,j721e-gpio", "ti,keystone-gpio";
		reg = <0x0 0x00630000 0x0 0x100>;
		gpio-controller;
		#gpio-cells = <2>;
		interrupt-parent = <&main_gpio_intr>;
		interrupts = <280>, <281>, <282>, <283>,
			     <284>, <285>, <286>, <287>;
		interrupt-controller;
		#interrupt-cells = <2>;
		ti,ngpio = <128>;
		ti,davinci-gpio-unbanked = <0>;
		power-domains = <&k3_pds 111 TI_SCI_PD_EXCLUSIVE>;
		clocks = <&k3_clks 111 0>;
		clock-names = "gpio";
	};

	main_gpio7: gpio@631000 {
		compatible = "ti,j721e-gpio", "ti,keystone-gpio";
		reg = <0x0 0x00631000 0x0 0x100>;
		gpio-controller;
		#gpio-cells = <2>;
		interrupt-parent = <&main_gpio_intr>;
		interrupts = <300>, <301>, <302>;
		interrupt-controller;
		#interrupt-cells = <2>;
		ti,ngpio = <36>;
		ti,davinci-gpio-unbanked = <0>;
		power-domains = <&k3_pds 112 TI_SCI_PD_EXCLUSIVE>;
		clocks = <&k3_clks 112 0>;
		clock-names = "gpio";
	};

	main_sdhci0: mmc@4f80000 {
		compatible = "ti,j721e-sdhci-8bit";
		reg = <0x0 0x4f80000 0x0 0x1000>, <0x0 0x4f88000 0x0 0x400>;
		interrupts = <GIC_SPI 3 IRQ_TYPE_LEVEL_HIGH>;
		power-domains = <&k3_pds 91 TI_SCI_PD_EXCLUSIVE>;
		clock-names = "clk_ahb", "clk_xin";
		clocks = <&k3_clks 91 0>, <&k3_clks 91 1>;
		assigned-clocks = <&k3_clks 91 1>;
		assigned-clock-parents = <&k3_clks 91 2>;
		bus-width = <8>;
		mmc-hs200-1_8v;
		mmc-ddr-1_8v;
		ti,otap-del-sel-legacy = <0xf>;
		ti,otap-del-sel-mmc-hs = <0xf>;
		ti,otap-del-sel-ddr52 = <0x5>;
		ti,otap-del-sel-hs200 = <0x6>;
		ti,otap-del-sel-hs400 = <0x0>;
		ti,itap-del-sel-legacy = <0x10>;
		ti,itap-del-sel-mmc-hs = <0xa>;
		ti,itap-del-sel-ddr52 = <0x3>;
		ti,trm-icp = <0x8>;
		ti,strobe-sel = <0x77>;
		dma-coherent;
	};

	main_sdhci1: mmc@4fb0000 {
		compatible = "ti,j721e-sdhci-4bit";
		reg = <0x0 0x04fb0000 0x0 0x1000>, <0x0 0x4fb8000 0x0 0x400>;
		interrupts = <GIC_SPI 4 IRQ_TYPE_LEVEL_HIGH>;
		power-domains = <&k3_pds 92 TI_SCI_PD_EXCLUSIVE>;
		clock-names = "clk_ahb", "clk_xin";
		clocks = <&k3_clks 92 5>, <&k3_clks 92 0>;
		assigned-clocks = <&k3_clks 92 0>;
		assigned-clock-parents = <&k3_clks 92 1>;
		ti,otap-del-sel-legacy = <0x0>;
		ti,otap-del-sel-sd-hs = <0xf>;
		ti,otap-del-sel-sdr12 = <0xf>;
		ti,otap-del-sel-sdr25 = <0xf>;
		ti,otap-del-sel-sdr50 = <0xc>;
		ti,otap-del-sel-ddr50 = <0xc>;
		ti,itap-del-sel-legacy = <0x0>;
		ti,itap-del-sel-sd-hs = <0x0>;
		ti,itap-del-sel-sdr12 = <0x0>;
		ti,itap-del-sel-sdr25 = <0x0>;
		ti,itap-del-sel-ddr50 = <0x2>;
		ti,trm-icp = <0x8>;
		ti,clkbuf-sel = <0x7>;
		dma-coherent;
		sdhci-caps-mask = <0x2 0x0>;
	};

	main_sdhci2: mmc@4f98000 {
		compatible = "ti,j721e-sdhci-4bit";
		reg = <0x0 0x4f98000 0x0 0x1000>, <0x0 0x4f90000 0x0 0x400>;
		interrupts = <GIC_SPI 5 IRQ_TYPE_LEVEL_HIGH>;
		power-domains = <&k3_pds 93 TI_SCI_PD_EXCLUSIVE>;
		clock-names = "clk_ahb", "clk_xin";
		clocks = <&k3_clks 93 5>, <&k3_clks 93 0>;
		assigned-clocks = <&k3_clks 93 0>;
		assigned-clock-parents = <&k3_clks 93 1>;
		ti,otap-del-sel-legacy = <0x0>;
		ti,otap-del-sel-sd-hs = <0xf>;
		ti,otap-del-sel-sdr12 = <0xf>;
		ti,otap-del-sel-sdr25 = <0xf>;
		ti,otap-del-sel-sdr50 = <0xc>;
		ti,otap-del-sel-ddr50 = <0xc>;
		ti,itap-del-sel-legacy = <0x0>;
		ti,itap-del-sel-sd-hs = <0x0>;
		ti,itap-del-sel-sdr12 = <0x0>;
		ti,itap-del-sel-sdr25 = <0x0>;
		ti,itap-del-sel-ddr50 = <0x2>;
		ti,trm-icp = <0x8>;
		ti,clkbuf-sel = <0x7>;
		dma-coherent;
		sdhci-caps-mask = <0x2 0x0>;
	};

	usbss0: cdns-usb@4104000 {
		compatible = "ti,j721e-usb";
		reg = <0x00 0x4104000 0x00 0x100>;
		dma-coherent;
		power-domains = <&k3_pds 288 TI_SCI_PD_EXCLUSIVE>;
		clocks = <&k3_clks 288 15>, <&k3_clks 288 3>;
		clock-names = "ref", "lpm";
		assigned-clocks = <&k3_clks 288 15>;	/* USB2_REFCLK */
		assigned-clock-parents = <&k3_clks 288 16>; /* HFOSC0 */
		#address-cells = <2>;
		#size-cells = <2>;
		ranges;

		usb0: usb@6000000 {
			compatible = "cdns,usb3";
			reg = <0x00 0x6000000 0x00 0x10000>,
			      <0x00 0x6010000 0x00 0x10000>,
			      <0x00 0x6020000 0x00 0x10000>;
			reg-names = "otg", "xhci", "dev";
			interrupts = <GIC_SPI 96 IRQ_TYPE_LEVEL_HIGH>,	/* irq.0 */
				     <GIC_SPI 102 IRQ_TYPE_LEVEL_HIGH>,	/* irq.6 */
				     <GIC_SPI 120 IRQ_TYPE_LEVEL_HIGH>;	/* otgirq.0 */
			interrupt-names = "host",
					  "peripheral",
					  "otg";
			maximum-speed = "super-speed";
			dr_mode = "otg";
		};
	};

	usbss1: cdns-usb@4114000 {
		compatible = "ti,j721e-usb";
		reg = <0x00 0x4114000 0x00 0x100>;
		dma-coherent;
		power-domains = <&k3_pds 289 TI_SCI_PD_EXCLUSIVE>;
		clocks = <&k3_clks 289 15>, <&k3_clks 289 3>;
		clock-names = "ref", "lpm";
		assigned-clocks = <&k3_clks 289 15>;	/* USB2_REFCLK */
		assigned-clock-parents = <&k3_clks 289 16>; /* HFOSC0 */
		#address-cells = <2>;
		#size-cells = <2>;
		ranges;

		usb1: usb@6400000 {
			compatible = "cdns,usb3";
			reg = <0x00 0x6400000 0x00 0x10000>,
			      <0x00 0x6410000 0x00 0x10000>,
			      <0x00 0x6420000 0x00 0x10000>;
			reg-names = "otg", "xhci", "dev";
			interrupts = <GIC_SPI 104 IRQ_TYPE_LEVEL_HIGH>,	/* irq.0 */
				     <GIC_SPI 110 IRQ_TYPE_LEVEL_HIGH>,	/* irq.6 */
				     <GIC_SPI 121 IRQ_TYPE_LEVEL_HIGH>;	/* otgirq.0 */
			interrupt-names = "host",
					  "peripheral",
					  "otg";
			maximum-speed = "super-speed";
			dr_mode = "otg";
		};
	};

	main_i2c0: i2c@2000000 {
		compatible = "ti,j721e-i2c", "ti,omap4-i2c";
		reg = <0x0 0x2000000 0x0 0x100>;
		interrupts = <GIC_SPI 200 IRQ_TYPE_LEVEL_HIGH>;
		#address-cells = <1>;
		#size-cells = <0>;
		clock-names = "fck";
		clocks = <&k3_clks 187 0>;
		power-domains = <&k3_pds 187 TI_SCI_PD_SHARED>;
	};

	main_i2c1: i2c@2010000 {
		compatible = "ti,j721e-i2c", "ti,omap4-i2c";
		reg = <0x0 0x2010000 0x0 0x100>;
		interrupts = <GIC_SPI 201 IRQ_TYPE_LEVEL_HIGH>;
		#address-cells = <1>;
		#size-cells = <0>;
		clock-names = "fck";
		clocks = <&k3_clks 188 0>;
		power-domains = <&k3_pds 188 TI_SCI_PD_EXCLUSIVE>;
	};

	main_i2c2: i2c@2020000 {
		compatible = "ti,j721e-i2c", "ti,omap4-i2c";
		reg = <0x0 0x2020000 0x0 0x100>;
		interrupts = <GIC_SPI 202 IRQ_TYPE_LEVEL_HIGH>;
		#address-cells = <1>;
		#size-cells = <0>;
		clock-names = "fck";
		clocks = <&k3_clks 189 0>;
		power-domains = <&k3_pds 189 TI_SCI_PD_EXCLUSIVE>;
	};

	main_i2c3: i2c@2030000 {
		compatible = "ti,j721e-i2c", "ti,omap4-i2c";
		reg = <0x0 0x2030000 0x0 0x100>;
		interrupts = <GIC_SPI 203 IRQ_TYPE_LEVEL_HIGH>;
		#address-cells = <1>;
		#size-cells = <0>;
		clock-names = "fck";
		clocks = <&k3_clks 190 0>;
		power-domains = <&k3_pds 190 TI_SCI_PD_EXCLUSIVE>;
	};

	main_i2c4: i2c@2040000 {
		compatible = "ti,j721e-i2c", "ti,omap4-i2c";
		reg = <0x0 0x2040000 0x0 0x100>;
		interrupts = <GIC_SPI 204 IRQ_TYPE_LEVEL_HIGH>;
		#address-cells = <1>;
		#size-cells = <0>;
		clock-names = "fck";
		clocks = <&k3_clks 191 0>;
		power-domains = <&k3_pds 191 TI_SCI_PD_EXCLUSIVE>;
	};

	main_i2c5: i2c@2050000 {
		compatible = "ti,j721e-i2c", "ti,omap4-i2c";
		reg = <0x0 0x2050000 0x0 0x100>;
		interrupts = <GIC_SPI 205 IRQ_TYPE_LEVEL_HIGH>;
		#address-cells = <1>;
		#size-cells = <0>;
		clock-names = "fck";
		clocks = <&k3_clks 192 0>;
		power-domains = <&k3_pds 192 TI_SCI_PD_EXCLUSIVE>;
	};

	main_i2c6: i2c@2060000 {
		compatible = "ti,j721e-i2c", "ti,omap4-i2c";
		reg = <0x0 0x2060000 0x0 0x100>;
		interrupts = <GIC_SPI 206 IRQ_TYPE_LEVEL_HIGH>;
		#address-cells = <1>;
		#size-cells = <0>;
		clock-names = "fck";
		clocks = <&k3_clks 193 0>;
		power-domains = <&k3_pds 193 TI_SCI_PD_EXCLUSIVE>;
	};

	ufs_wrapper: ufs-wrapper@4e80000 {
		compatible = "ti,j721e-ufs";
		reg = <0x0 0x4e80000 0x0 0x100>;
		power-domains = <&k3_pds 277 TI_SCI_PD_EXCLUSIVE>;
		clocks = <&k3_clks 277 1>;
		assigned-clocks = <&k3_clks 277 1>;
		assigned-clock-parents = <&k3_clks 277 4>;
		ranges;
		#address-cells = <2>;
		#size-cells = <2>;

		ufs@4e84000 {
			compatible = "cdns,ufshc-m31-16nm", "jedec,ufs-2.0";
			reg = <0x0 0x4e84000 0x0 0x10000>;
			interrupts = <GIC_SPI 17 IRQ_TYPE_LEVEL_HIGH>;
			freq-table-hz = <250000000 250000000>, <19200000 19200000>, <19200000 19200000>;
			clocks = <&k3_clks 277 0>, <&k3_clks 277 1>, <&k3_clks 277 1>;
			clock-names = "core_clk", "phy_clk", "ref_clk";
			dma-coherent;
		};
	};

	dss: dss@4a00000 {
		compatible = "ti,j721e-dss";
		reg =
			<0x00 0x04a00000 0x00 0x10000>, /* common_m */
			<0x00 0x04a10000 0x00 0x10000>, /* common_s0*/
			<0x00 0x04b00000 0x00 0x10000>, /* common_s1*/
			<0x00 0x04b10000 0x00 0x10000>, /* common_s2*/

			<0x00 0x04a20000 0x00 0x10000>, /* vidl1 */
			<0x00 0x04a30000 0x00 0x10000>, /* vidl2 */
			<0x00 0x04a50000 0x00 0x10000>, /* vid1 */
			<0x00 0x04a60000 0x00 0x10000>, /* vid2 */

			<0x00 0x04a70000 0x00 0x10000>, /* ovr1 */
			<0x00 0x04a90000 0x00 0x10000>, /* ovr2 */
			<0x00 0x04ab0000 0x00 0x10000>, /* ovr3 */
			<0x00 0x04ad0000 0x00 0x10000>, /* ovr4 */

			<0x00 0x04a80000 0x00 0x10000>, /* vp1 */
			<0x00 0x04aa0000 0x00 0x10000>, /* vp2 */
			<0x00 0x04ac0000 0x00 0x10000>, /* vp3 */
			<0x00 0x04ae0000 0x00 0x10000>, /* vp4 */
			<0x00 0x04af0000 0x00 0x10000>; /* wb */

		reg-names = "common_m", "common_s0",
			"common_s1", "common_s2",
			"vidl1", "vidl2","vid1","vid2",
			"ovr1", "ovr2", "ovr3", "ovr4",
			"vp1", "vp2", "vp3", "vp4",
			"wb";

		clocks =	<&k3_clks 152 0>,
				<&k3_clks 152 1>,
				<&k3_clks 152 4>,
				<&k3_clks 152 9>,
				<&k3_clks 152 13>;
		clock-names = "fck", "vp1", "vp2", "vp3", "vp4";

		power-domains = <&k3_pds 152 TI_SCI_PD_EXCLUSIVE>;

		interrupts = <GIC_SPI 602 IRQ_TYPE_LEVEL_HIGH>,
			     <GIC_SPI 603 IRQ_TYPE_LEVEL_HIGH>,
			     <GIC_SPI 604 IRQ_TYPE_LEVEL_HIGH>,
			     <GIC_SPI 605 IRQ_TYPE_LEVEL_HIGH>;
		interrupt-names = "common_m",
				  "common_s0",
				  "common_s1",
				  "common_s2";

		dss_ports: ports {
			#address-cells = <1>;
			#size-cells = <0>;
		};
	};

	mcasp0: mcasp@2b00000 {
		compatible = "ti,am33xx-mcasp-audio";
		reg = <0x0 0x02b00000 0x0 0x2000>,
			<0x0 0x02b08000 0x0 0x1000>;
		reg-names = "mpu","dat";
		interrupts = <GIC_SPI 544 IRQ_TYPE_LEVEL_HIGH>,
				<GIC_SPI 545 IRQ_TYPE_LEVEL_HIGH>;
		interrupt-names = "tx", "rx";

		dmas = <&main_udmap 0xc400>, <&main_udmap 0x4400>;
		dma-names = "tx", "rx";

		clocks = <&k3_clks 174 1>;
		clock-names = "fck";
		power-domains = <&k3_pds 174 TI_SCI_PD_EXCLUSIVE>;
	};

	mcasp1: mcasp@2b10000 {
		compatible = "ti,am33xx-mcasp-audio";
		reg = <0x0 0x02b10000 0x0 0x2000>,
			<0x0 0x02b18000 0x0 0x1000>;
		reg-names = "mpu","dat";
		interrupts = <GIC_SPI 546 IRQ_TYPE_LEVEL_HIGH>,
				<GIC_SPI 547 IRQ_TYPE_LEVEL_HIGH>;
		interrupt-names = "tx", "rx";

		dmas = <&main_udmap 0xc401>, <&main_udmap 0x4401>;
		dma-names = "tx", "rx";

		clocks = <&k3_clks 175 1>;
		clock-names = "fck";
		power-domains = <&k3_pds 175 TI_SCI_PD_EXCLUSIVE>;
	};

	mcasp2: mcasp@2b20000 {
		compatible = "ti,am33xx-mcasp-audio";
		reg = <0x0 0x02b20000 0x0 0x2000>,
			<0x0 0x02b28000 0x0 0x1000>;
		reg-names = "mpu","dat";
		interrupts = <GIC_SPI 548 IRQ_TYPE_LEVEL_HIGH>,
				<GIC_SPI 549 IRQ_TYPE_LEVEL_HIGH>;
		interrupt-names = "tx", "rx";

		dmas = <&main_udmap 0xc402>, <&main_udmap 0x4402>;
		dma-names = "tx", "rx";

		clocks = <&k3_clks 176 1>;
		clock-names = "fck";
		power-domains = <&k3_pds 176 TI_SCI_PD_EXCLUSIVE>;
	};

	mcasp3: mcasp@2b30000 {
		compatible = "ti,am33xx-mcasp-audio";
		reg = <0x0 0x02b30000 0x0 0x2000>,
			<0x0 0x02b38000 0x0 0x1000>;
		reg-names = "mpu","dat";
		interrupts = <GIC_SPI 550 IRQ_TYPE_LEVEL_HIGH>,
				<GIC_SPI 551 IRQ_TYPE_LEVEL_HIGH>;
		interrupt-names = "tx", "rx";

		dmas = <&main_udmap 0xc500>, <&main_udmap 0x4500>;
		dma-names = "tx", "rx";

		clocks = <&k3_clks 177 1>;
		clock-names = "fck";
		power-domains = <&k3_pds 177 TI_SCI_PD_EXCLUSIVE>;
	};

	mcasp4: mcasp@2b40000 {
		compatible = "ti,am33xx-mcasp-audio";
		reg = <0x0 0x02b40000 0x0 0x2000>,
			<0x0 0x02b48000 0x0 0x1000>;
		reg-names = "mpu","dat";
		interrupts = <GIC_SPI 552 IRQ_TYPE_LEVEL_HIGH>,
				<GIC_SPI 553 IRQ_TYPE_LEVEL_HIGH>;
		interrupt-names = "tx", "rx";

		dmas = <&main_udmap 0xc501>, <&main_udmap 0x4501>;
		dma-names = "tx", "rx";

		clocks = <&k3_clks 178 1>;
		clock-names = "fck";
		power-domains = <&k3_pds 178 TI_SCI_PD_EXCLUSIVE>;
	};

	mcasp5: mcasp@2b50000 {
		compatible = "ti,am33xx-mcasp-audio";
		reg = <0x0 0x02b50000 0x0 0x2000>,
			<0x0 0x02b58000 0x0 0x1000>;
		reg-names = "mpu","dat";
		interrupts = <GIC_SPI 554 IRQ_TYPE_LEVEL_HIGH>,
				<GIC_SPI 555 IRQ_TYPE_LEVEL_HIGH>;
		interrupt-names = "tx", "rx";

		dmas = <&main_udmap 0xc502>, <&main_udmap 0x4502>;
		dma-names = "tx", "rx";

		clocks = <&k3_clks 179 1>;
		clock-names = "fck";
		power-domains = <&k3_pds 179 TI_SCI_PD_EXCLUSIVE>;
	};

	mcasp6: mcasp@2b60000 {
		compatible = "ti,am33xx-mcasp-audio";
		reg = <0x0 0x02b60000 0x0 0x2000>,
			<0x0 0x02b68000 0x0 0x1000>;
		reg-names = "mpu","dat";
		interrupts = <GIC_SPI 556 IRQ_TYPE_LEVEL_HIGH>,
				<GIC_SPI 557 IRQ_TYPE_LEVEL_HIGH>;
		interrupt-names = "tx", "rx";

		dmas = <&main_udmap 0xc503>, <&main_udmap 0x4503>;
		dma-names = "tx", "rx";

		clocks = <&k3_clks 180 1>;
		clock-names = "fck";
		power-domains = <&k3_pds 180 TI_SCI_PD_EXCLUSIVE>;
	};

	mcasp7: mcasp@2b70000 {
		compatible = "ti,am33xx-mcasp-audio";
		reg = <0x0 0x02b70000 0x0 0x2000>,
			<0x0 0x02b78000 0x0 0x1000>;
		reg-names = "mpu","dat";
		interrupts = <GIC_SPI 558 IRQ_TYPE_LEVEL_HIGH>,
				<GIC_SPI 559 IRQ_TYPE_LEVEL_HIGH>;
		interrupt-names = "tx", "rx";

		dmas = <&main_udmap 0xc504>, <&main_udmap 0x4504>;
		dma-names = "tx", "rx";

		clocks = <&k3_clks 181 1>;
		clock-names = "fck";
		power-domains = <&k3_pds 181 TI_SCI_PD_EXCLUSIVE>;
	};

	mcasp8: mcasp@2b80000 {
		compatible = "ti,am33xx-mcasp-audio";
		reg = <0x0 0x02b80000 0x0 0x2000>,
			<0x0 0x02b88000 0x0 0x1000>;
		reg-names = "mpu","dat";
		interrupts = <GIC_SPI 560 IRQ_TYPE_LEVEL_HIGH>,
				<GIC_SPI 561 IRQ_TYPE_LEVEL_HIGH>;
		interrupt-names = "tx", "rx";

		dmas = <&main_udmap 0xc505>, <&main_udmap 0x4505>;
		dma-names = "tx", "rx";

		clocks = <&k3_clks 182 1>;
		clock-names = "fck";
		power-domains = <&k3_pds 182 TI_SCI_PD_EXCLUSIVE>;
	};

	mcasp9: mcasp@2b90000 {
		compatible = "ti,am33xx-mcasp-audio";
		reg = <0x0 0x02b90000 0x0 0x2000>,
			<0x0 0x02b98000 0x0 0x1000>;
		reg-names = "mpu","dat";
		interrupts = <GIC_SPI 562 IRQ_TYPE_LEVEL_HIGH>,
				<GIC_SPI 563 IRQ_TYPE_LEVEL_HIGH>;
		interrupt-names = "tx", "rx";

		dmas = <&main_udmap 0xc506>, <&main_udmap 0x4506>;
		dma-names = "tx", "rx";

		clocks = <&k3_clks 183 1>;
		clock-names = "fck";
		power-domains = <&k3_pds 183 TI_SCI_PD_EXCLUSIVE>;
	};

	mcasp10: mcasp@2ba0000 {
		compatible = "ti,am33xx-mcasp-audio";
		reg = <0x0 0x02ba0000 0x0 0x2000>,
			<0x0 0x02ba8000 0x0 0x1000>;
		reg-names = "mpu","dat";
		interrupts = <GIC_SPI 564 IRQ_TYPE_LEVEL_HIGH>,
				<GIC_SPI 565 IRQ_TYPE_LEVEL_HIGH>;
		interrupt-names = "tx", "rx";

		dmas = <&main_udmap 0xc507>, <&main_udmap 0x4507>;
		dma-names = "tx", "rx";

		clocks = <&k3_clks 184 1>;
		clock-names = "fck";
		power-domains = <&k3_pds 184 TI_SCI_PD_EXCLUSIVE>;
	};

	mcasp11: mcasp@2bb0000 {
		compatible = "ti,am33xx-mcasp-audio";
		reg = <0x0 0x02bb0000 0x0 0x2000>,
			<0x0 0x02bb8000 0x0 0x1000>;
		reg-names = "mpu","dat";
		interrupts = <GIC_SPI 566 IRQ_TYPE_LEVEL_HIGH>,
				<GIC_SPI 567 IRQ_TYPE_LEVEL_HIGH>;
		interrupt-names = "tx", "rx";

		dmas = <&main_udmap 0xc508>, <&main_udmap 0x4508>;
		dma-names = "tx", "rx";

		clocks = <&k3_clks 185 1>;
		clock-names = "fck";
		power-domains = <&k3_pds 185 TI_SCI_PD_EXCLUSIVE>;
	};

	watchdog0: watchdog@2200000 {
		compatible = "ti,j7-rti-wdt";
		reg = <0x0 0x2200000 0x0 0x100>;
		clocks = <&k3_clks 252 1>;
		power-domains = <&k3_pds 252 TI_SCI_PD_EXCLUSIVE>;
		assigned-clocks = <&k3_clks 252 1>;
		assigned-clock-parents = <&k3_clks 252 5>;
	};

	watchdog1: watchdog@2210000 {
		compatible = "ti,j7-rti-wdt";
		reg = <0x0 0x2210000 0x0 0x100>;
		clocks = <&k3_clks 253 1>;
		power-domains = <&k3_pds 253 TI_SCI_PD_EXCLUSIVE>;
		assigned-clocks = <&k3_clks 253 1>;
		assigned-clock-parents = <&k3_clks 253 5>;
	};

	main_r5fss0: r5fss@5c00000 {
		compatible = "ti,j721e-r5fss";
		ti,cluster-mode = <1>;
		#address-cells = <1>;
		#size-cells = <1>;
		ranges = <0x5c00000 0x00 0x5c00000 0x20000>,
			 <0x5d00000 0x00 0x5d00000 0x20000>;
		power-domains = <&k3_pds 243 TI_SCI_PD_EXCLUSIVE>;

		main_r5fss0_core0: r5f@5c00000 {
			compatible = "ti,j721e-r5f";
			reg = <0x5c00000 0x00008000>,
			      <0x5c10000 0x00008000>;
			reg-names = "atcm", "btcm";
			ti,sci = <&dmsc>;
			ti,sci-dev-id = <245>;
			ti,sci-proc-ids = <0x06 0xff>;
			resets = <&k3_reset 245 1>;
			firmware-name = "j7-main-r5f0_0-fw";
			ti,atcm-enable = <1>;
			ti,btcm-enable = <1>;
			ti,loczrama = <1>;
		};

		main_r5fss0_core1: r5f@5d00000 {
			compatible = "ti,j721e-r5f";
			reg = <0x5d00000 0x00008000>,
			      <0x5d10000 0x00008000>;
			reg-names = "atcm", "btcm";
			ti,sci = <&dmsc>;
			ti,sci-dev-id = <246>;
			ti,sci-proc-ids = <0x07 0xff>;
			resets = <&k3_reset 246 1>;
			firmware-name = "j7-main-r5f0_1-fw";
			ti,atcm-enable = <1>;
			ti,btcm-enable = <1>;
			ti,loczrama = <1>;
		};
	};

	main_r5fss1: r5fss@5e00000 {
		compatible = "ti,j721e-r5fss";
		ti,cluster-mode = <1>;
		#address-cells = <1>;
		#size-cells = <1>;
		ranges = <0x5e00000 0x00 0x5e00000 0x20000>,
			 <0x5f00000 0x00 0x5f00000 0x20000>;
		power-domains = <&k3_pds 244 TI_SCI_PD_EXCLUSIVE>;

		main_r5fss1_core0: r5f@5e00000 {
			compatible = "ti,j721e-r5f";
			reg = <0x5e00000 0x00008000>,
			      <0x5e10000 0x00008000>;
			reg-names = "atcm", "btcm";
			ti,sci = <&dmsc>;
			ti,sci-dev-id = <247>;
			ti,sci-proc-ids = <0x08 0xff>;
			resets = <&k3_reset 247 1>;
			firmware-name = "j7-main-r5f1_0-fw";
			ti,atcm-enable = <1>;
			ti,btcm-enable = <1>;
			ti,loczrama = <1>;
		};

		main_r5fss1_core1: r5f@5f00000 {
			compatible = "ti,j721e-r5f";
			reg = <0x5f00000 0x00008000>,
			      <0x5f10000 0x00008000>;
			reg-names = "atcm", "btcm";
			ti,sci = <&dmsc>;
			ti,sci-dev-id = <248>;
			ti,sci-proc-ids = <0x09 0xff>;
			resets = <&k3_reset 248 1>;
			firmware-name = "j7-main-r5f1_1-fw";
			ti,atcm-enable = <1>;
			ti,btcm-enable = <1>;
			ti,loczrama = <1>;
		};
	};

	c66_0: dsp@4d80800000 {
		compatible = "ti,j721e-c66-dsp";
		reg = <0x4d 0x80800000 0x00 0x00048000>,
		      <0x4d 0x80e00000 0x00 0x00008000>,
		      <0x4d 0x80f00000 0x00 0x00008000>;
		reg-names = "l2sram", "l1pram", "l1dram";
		ti,sci = <&dmsc>;
		ti,sci-dev-id = <142>;
		ti,sci-proc-ids = <0x03 0xff>;
		resets = <&k3_reset 142 1>;
		firmware-name = "j7-c66_0-fw";
	};

	c66_1: dsp@4d81800000 {
		compatible = "ti,j721e-c66-dsp";
		reg = <0x4d 0x81800000 0x00 0x00048000>,
		      <0x4d 0x81e00000 0x00 0x00008000>,
		      <0x4d 0x81f00000 0x00 0x00008000>;
		reg-names = "l2sram", "l1pram", "l1dram";
		ti,sci = <&dmsc>;
		ti,sci-dev-id = <143>;
		ti,sci-proc-ids = <0x04 0xff>;
		resets = <&k3_reset 143 1>;
		firmware-name = "j7-c66_1-fw";
	};

	c71_0: dsp@64800000 {
		compatible = "ti,j721e-c71-dsp";
		reg = <0x00 0x64800000 0x00 0x00080000>,
		      <0x00 0x64e00000 0x00 0x0000c000>;
		reg-names = "l2sram", "l1dram";
		ti,sci = <&dmsc>;
		ti,sci-dev-id = <15>;
		ti,sci-proc-ids = <0x30 0xff>;
		resets = <&k3_reset 15 1>;
		firmware-name = "j7-c71_0-fw";
	};
	
	
	main_cpsw0: ethernet@c000000 {
		compatible = "ti,j721e-cpsw-nuss";
		#address-cells = <2>;
		#size-cells = <2>;
		reg = <0x0 0xc000000 0x0 0x200000>;
		reg-names = "cpsw_nuss";
		ranges = <0x0 0x0 0x0 0xc000000 0x0 0x200000>;
		dma-coherent;
		clocks = <&k3_clks 19 89>;
		clock-names = "fck";
		power-domains = <&k3_pds 19 TI_SCI_PD_EXCLUSIVE>;

		dmas = <&main_udmap 0xca00>,
		       <&main_udmap 0xca01>,
		       <&main_udmap 0xca02>,
		       <&main_udmap 0xca03>,
		       <&main_udmap 0xca04>,
		       <&main_udmap 0xca05>,
		       <&main_udmap 0xca06>,
		       <&main_udmap 0xca07>,
		       <&main_udmap 0x4a00>;
		dma-names = "tx0", "tx1", "tx2", "tx3",
			    "tx4", "tx5", "tx6", "tx7",
			    "rx";

		ethernet-ports {
			#address-cells = <1>;
			#size-cells = <0>;
			
			//main_cpsw0_port5: port@5 {
			//	reg = <5>;
			//	ti,mac-only;
			//	label = "port5";
			//	phys = <&main_phy_gmii_sel 5>;
			//};

			//main_cpsw0_port6: port@6 {
			//	reg = <6>;
			//	ti,mac-only;
			//	label = "port6";
			//	phys = <&main_phy_gmii_sel 6>;
			//};

			main_cpsw0_port7: port@7 {
				reg = <7>;
				ti,mac-only;
				label = "port7";
				phys = <&main_phy_gmii_sel 7>;
			};
		};

		main_cpsw0_mdio: mdio@f00 {
			compatible = "ti,cpsw-mdio", "ti,davinci_mdio";
			reg = <0x0 0xf00 0x0 0x100>;
			#address-cells = <1>;
			#size-cells = <0>;
			clocks = <&k3_clks 19 89>;
			clock-names = "fck";
			bus_freq = <1000000>;
		};

		cpts@3d000 {
			compatible = "ti,j721e-cpts";
			reg = <0x0 0x3d000 0x0 0x400>;
			clocks = <&k3_clks 19 16>;
			clock-names = "cpts";
			interrupts-extended = <&gic500 GIC_SPI 16 IRQ_TYPE_LEVEL_HIGH>;
			interrupt-names = "cpts";
			ti,cpts-ext-ts-inputs = <4>;
			ti,cpts-periodic-outputs = <2>;
		};
	};

	icssg0: icssg@b000000 {
		compatible = "ti,j721e-icssg";
		reg = <0x00 0xb000000 0x00 0x80000>;
		power-domains = <&k3_pds 119 TI_SCI_PD_EXCLUSIVE>;
		#address-cells = <1>;
		#size-cells = <1>;
		ranges = <0x0 0x00 0x0b000000 0x100000>;

		icssg0_mem: memories@0 {
			reg = <0x0 0x2000>,
			      <0x2000 0x2000>,
			      <0x10000 0x10000>;
			reg-names = "dram0", "dram1",
				    "shrdram2";
		};

		icssg0_cfg: cfg@26000 {
			compatible = "ti,pruss-cfg", "syscon";
			reg = <0x26000 0x200>;
			#address-cells = <1>;
			#size-cells = <1>;
			ranges = <0x0 0x26000 0x2000>;

			clocks {
				#address-cells = <1>;
				#size-cells = <0>;

				icssg0_coreclk_mux: coreclk-mux@3c {
					reg = <0x3c>;
					#clock-cells = <0>;
					clocks = <&k3_clks 119 24>, /* icssg0_core_clk */
						 <&k3_clks 119 1>;  /* icssg0_iclk */
					assigned-clocks = <&icssg0_coreclk_mux>;
					assigned-clock-parents = <&k3_clks 119 1>;
				};

				icssg0_iepclk_mux: iepclk-mux@30 {
					reg = <0x30>;
					#clock-cells = <0>;
					clocks = <&k3_clks 119 3>,	/* icssg0_iep_clk */
						 <&icssg0_coreclk_mux>;	/* core_clk */
					assigned-clocks = <&icssg0_iepclk_mux>;
					assigned-clock-parents = <&icssg0_coreclk_mux>;
				};
			};
		};

		icssg0_mii_rt: mii-rt@32000 {
			compatible = "ti,pruss-mii", "syscon";
			reg = <0x32000 0x100>;
		};

		icssg0_mii_g_rt: mii-g-rt@33000 {
			compatible = "ti,pruss-mii-g", "syscon";
			reg = <0x33000 0x1000>;
		};

		icssg0_intc: interrupt-controller@20000 {
			compatible = "ti,icssg-intc";
			reg = <0x20000 0x2000>;
			interrupt-controller;
			#interrupt-cells = <3>;
			interrupts = <GIC_SPI 254 IRQ_TYPE_LEVEL_HIGH>,
				     <GIC_SPI 255 IRQ_TYPE_LEVEL_HIGH>,
				     <GIC_SPI 256 IRQ_TYPE_LEVEL_HIGH>,
				     <GIC_SPI 257 IRQ_TYPE_LEVEL_HIGH>,
				     <GIC_SPI 258 IRQ_TYPE_LEVEL_HIGH>,
				     <GIC_SPI 259 IRQ_TYPE_LEVEL_HIGH>,
				     <GIC_SPI 260 IRQ_TYPE_LEVEL_HIGH>,
				     <GIC_SPI 261 IRQ_TYPE_LEVEL_HIGH>;
			interrupt-names = "host_intr0", "host_intr1",
					  "host_intr2", "host_intr3",
					  "host_intr4", "host_intr5",
					  "host_intr6", "host_intr7";
		};

		pru0_0: pru@34000 {
			compatible = "ti,j721e-pru";
			reg = <0x34000 0x3000>,
			      <0x22000 0x100>,
			      <0x22400 0x100>;
			reg-names = "iram", "control", "debug";
			firmware-name = "j7-pru0_0-fw";
		};

		rtu0_0: rtu@4000 {
			compatible = "ti,j721e-rtu";
			reg = <0x4000 0x2000>,
			      <0x23000 0x100>,
			      <0x23400 0x100>;
			reg-names = "iram", "control", "debug";
			firmware-name = "j7-rtu0_0-fw";
		};

		tx_pru0_0: txpru@a000 {
			compatible = "ti,j721e-tx-pru";
			reg = <0xa000 0x1800>,
			      <0x25000 0x100>,
			      <0x25400 0x100>;
			reg-names = "iram", "control", "debug";
			firmware-name = "j7-txpru0_0-fw";
		};

		pru0_1: pru@38000 {
			compatible = "ti,j721e-pru";
			reg = <0x38000 0x3000>,
			      <0x24000 0x100>,
			      <0x24400 0x100>;
			reg-names = "iram", "control", "debug";
			firmware-name = "j7-pru0_1-fw";
		};

		rtu0_1: rtu@6000 {
			compatible = "ti,j721e-rtu";
			reg = <0x6000 0x2000>,
			      <0x23800 0x100>,
			      <0x23c00 0x100>;
			reg-names = "iram", "control", "debug";
			firmware-name = "j7-rtu0_1-fw";
		};

		tx_pru0_1: txpru@c000 {
			compatible = "ti,j721e-tx-pru";
			reg = <0xc000 0x1800>,
			      <0x25800 0x100>,
			      <0x25c00 0x100>;
			reg-names = "iram", "control", "debug";
			firmware-name = "j7-txpru0_1-fw";
		};

		icssg0_mdio: mdio@32400 {
			compatible = "ti,davinci_mdio";
			reg = <0x32400 0x100>;
			clocks = <&k3_clks 119 1>;
			clock-names = "fck";
			#address-cells = <1>;
			#size-cells = <0>;
			bus_freq = <1000000>;
		};
	};

	icssg1: icssg@b100000 {
		compatible = "ti,j721e-icssg";
		reg = <0x00 0xb100000 0x00 0x80000>;
		power-domains = <&k3_pds 120 TI_SCI_PD_EXCLUSIVE>;
		#address-cells = <1>;
		#size-cells = <1>;
		ranges = <0x0 0x00 0x0b100000 0x100000>;

		icssg1_mem: memories@b100000 {
			reg = <0x0 0x2000>,
			      <0x2000 0x2000>,
			      <0x10000 0x10000>;
			reg-names = "dram0", "dram1",
				    "shrdram2";
		};

		icssg1_cfg: cfg@26000 {
			compatible = "ti,pruss-cfg", "syscon";
			reg = <0x26000 0x200>;
			#address-cells = <1>;
			#size-cells = <1>;
			ranges = <0x0 0x26000 0x2000>;

			clocks {
				#address-cells = <1>;
				#size-cells = <0>;

				icssg1_coreclk_mux: coreclk-mux@3c {
					reg = <0x3c>;
					#clock-cells = <0>;
					clocks = <&k3_clks 120 54>, /* icssg1_core_clk */
						 <&k3_clks 120 4>;  /* icssg1_iclk */
					assigned-clocks = <&icssg1_coreclk_mux>;
					assigned-clock-parents = <&k3_clks 120 4>;
				};

				icssg1_iepclk_mux: iepclk-mux@30 {
					reg = <0x30>;
					#clock-cells = <0>;
					clocks = <&k3_clks 120 9>,	/* icssg1_iep_clk */
						 <&icssg1_coreclk_mux>;	/* core_clk */
					assigned-clocks = <&icssg1_iepclk_mux>;
					assigned-clock-parents = <&icssg1_coreclk_mux>;
				};
			};
		};

		icssg1_mii_rt: mii-rt@32000 {
			compatible = "ti,pruss-mii", "syscon";
			reg = <0x32000 0x100>;
		};

		icssg1_mii_g_rt: mii-g-rt@33000 {
			compatible = "ti,pruss-mii-g", "syscon";
			reg = <0x33000 0x1000>;
		};

		icssg1_intc: interrupt-controller@20000 {
			compatible = "ti,icssg-intc";
			reg = <0x20000 0x2000>;
			interrupt-controller;
			#interrupt-cells = <3>;
			interrupts = <GIC_SPI 262 IRQ_TYPE_LEVEL_HIGH>,
				     <GIC_SPI 263 IRQ_TYPE_LEVEL_HIGH>,
				     <GIC_SPI 264 IRQ_TYPE_LEVEL_HIGH>,
				     <GIC_SPI 265 IRQ_TYPE_LEVEL_HIGH>,
				     <GIC_SPI 266 IRQ_TYPE_LEVEL_HIGH>,
				     <GIC_SPI 267 IRQ_TYPE_LEVEL_HIGH>,
				     <GIC_SPI 268 IRQ_TYPE_LEVEL_HIGH>,
				     <GIC_SPI 269 IRQ_TYPE_LEVEL_HIGH>;
			interrupt-names = "host_intr0", "host_intr1",
					  "host_intr2", "host_intr3",
					  "host_intr4", "host_intr5",
					  "host_intr6", "host_intr7";
		};

		pru1_0: pru@34000 {
			compatible = "ti,j721e-pru";
			reg = <0x34000 0x4000>,
			      <0x22000 0x100>,
			      <0x22400 0x100>;
			reg-names = "iram", "control", "debug";
			firmware-name = "j7-pru1_0-fw";
		};

		rtu1_0: rtu@4000 {
			compatible = "ti,j721e-rtu";
			reg = <0x4000 0x2000>,
			      <0x23000 0x100>,
			      <0x23400 0x100>;
			reg-names = "iram", "control", "debug";
			firmware-name = "j7-rtu1_0-fw";
		};

		tx_pru1_0: txpru@a000 {
			compatible = "ti,j721e-tx-pru";
			reg = <0xa000 0x1800>,
			      <0x25000 0x100>,
			      <0x25400 0x100>;
			reg-names = "iram", "control", "debug";
			firmware-name = "j7-txpru1_0-fw";
		};

		pru1_1: pru@38000 {
			compatible = "ti,j721e-pru";
			reg = <0x38000 0x4000>,
			      <0x24000 0x100>,
			      <0x24400 0x100>;
			reg-names = "iram", "control", "debug";
			firmware-name = "j7-pru1_1-fw";
		};

		rtu1_1: rtu@6000 {
			compatible = "ti,j721e-rtu";
			reg = <0x6000 0x2000>,
			      <0x23800 0x100>,
			      <0x23c00 0x100>;
			reg-names = "iram", "control", "debug";
			firmware-name = "j7-rtu1_1-fw";
		};

		tx_pru1_1: txpru@c000 {
			compatible = "ti,j721e-tx-pru";
			reg = <0xc000 0x1800>,
			      <0x25800 0x100>,
			      <0x25c00 0x100>;
			reg-names = "iram", "control", "debug";
			firmware-name = "j7-txpru1_1-fw";
		};

		icssg1_mdio: mdio@32400 {
			compatible = "ti,davinci_mdio";
			reg = <0x32400 0x100>;
			clocks = <&k3_clks 120 4>;
			clock-names = "fck";
			#address-cells = <1>;
			#size-cells = <0>;
			bus_freq = <1000000>;
		};
	};

	main_esm: esm@700000 {
		compatible = "ti,j721e-esm";
		reg = <0x0 0x700000 0x0 0x1000>;
		ti,esm-pins = <344>, <345>;
		bootph-pre-ram;
	};
};

The boot log for U-Boot is the following (Booted via USB Boot):

U-Boot SPL 2023.04-r5-initial-gb0f0c0fb4d-dirty (Mar 22 2024 - 10:48:35 +0100)
SYSFW ABI: 3.1 (firmware rev 0x0009 '9.1.2--v09.01.02 (Kool Koala)')
Trying to boot from DFU
#################################################DOWNLOAD ... OK
Ctrl+C to exit ...
Loading Environment from nowhere... OK
init_env from device 18 not supported!
Starting ATF on ARM64 core...

DM Built On: Mar 14 2024 14:05:26
Sciserver Version: v2023.10.0.0
RM_PM_HAL Version: 
Starting Sciserver..... PASSED

U-Boot SPL 2023.04-a72-initial-gb0f0c0fb4d-dirty (Mar 22 2024 - 10:48:30 +0100)
SYSFW ABI: 3.1 (firmware rev 0x0009 '9.1.2--v09.01.02 (Kool Koala)')
Trying to boot from DFU
cdns-usb3-peripheral usb@6000000: Unable to get USB2 phy (ret -61)
cdns-usb3-peripheral usb@6000000: Unable to get USB3 phy (ret -22)
cdns-usb3-peripheral usb@6000000: DRD version v1 (ID: 0004024e, rev: 00000200)
cdns-usb3-peripheral usb@6000000: Initialized  ep0 support:  
cdns-usb3-peripheral usb@6000000: Initialized  ep1out support: BULK, INT ISO
cdns-usb3-peripheral usb@6000000: Initialized  ep2out support: BULK, INT ISO
cdns-usb3-peripheral usb@6000000: Initialized  ep3out support: BULK, INT ISO
cdns-usb3-peripheral usb@6000000: Initialized  ep4out support: BULK, INT ISO
cdns-usb3-peripheral usb@6000000: Initialized  ep5out support: BULK, INT ISO
cdns-usb3-peripheral usb@6000000: Initialized  ep6out support: BULK, INT ISO
cdns-usb3-peripheral usb@6000000: Initialized  ep7out support: BULK, INT ISO
cdns-usb3-peripheral usb@6000000: Initialized  ep8out support: BULK, INT ISO
cdns-usb3-peripheral usb@6000000: Initialized  ep9out support: BULK, INT ISO
cdns-usb3-peripheral usb@6000000: Initialized  ep10out support: BULK, INT ISO
cdns-usb3-peripheral usb@6000000: Initialized  ep11out support: BULK, INT ISO
cdns-usb3-peripheral usb@6000000: Initialized  ep12out support: BULK, INT ISO
cdns-usb3-peripheral usb@6000000: Initialized  ep13out support: BULK, INT ISO
cdns-usb3-peripheral usb@6000000: Initialized  ep14out support: BULK, INT ISO
cdns-usb3-peripheral usb@6000000: Initialized  ep15out support: BULK, INT ISO
cdns-usb3-peripheral usb@6000000: Initialized  ep1in support: BULK, INT ISO
cdns-usb3-peripheral usb@6000000: Initialized  ep2in support: BULK, INT ISO
cdns-usb3-peripheral usb@6000000: Initialized  ep3in support: BULK, INT ISO
cdns-usb3-peripheral usb@6000000: Initialized  ep4in support: BULK, INT ISO
cdns-usb3-peripheral usb@6000000: Initialized  ep5in support: BULK, INT ISO
cdns-usb3-peripheral usb@6000000: Initialized  ep6in support: BULK, INT ISO
cdns-usb3-peripheral usb@6000000: Initialized  ep7in support: BULK, INT ISO
cdns-usb3-peripheral usb@6000000: Initialized  ep8in support: BULK, INT ISO
cdns-usb3-peripheral usb@6000000: Initialized  ep9in support: BULK, INT ISO
cdns-usb3-peripheral usb@6000000: Initialized  ep10in support: BULK, INT ISO
cdns-usb3-peripheral usb@6000000: Initialized  ep11in support: BULK, INT ISO
cdns-usb3-peripheral usb@6000000: Initialized  ep12in support: BULK, INT ISO
cdns-usb3-peripheral usb@6000000: Initialized  ep13in support: BULK, INT ISO
cdns-usb3-peripheral usb@6000000: Initialized  ep14in support: BULK, INT ISO
cdns-usb3-peripheral usb@6000000: Initialized  ep15in support: BULK, INT ISO
##########DOWNLOAD ... OK
Ctrl+C to exit ...


U-Boot 2023.04-a72-initial-gb0f0c0fb4d-dirty (Mar 22 2024 - 10:48:30 +0100)

SoC:   J721E SR1.1 GP
Model: Texas Instruments K3 J721E SoC
DRAM:  4 GiB
Core:  115 devices, 34 uclasses, devicetree: separate
Warning: Device tree includes old 'u-boot,dm-' tags: please fix by 2023.07!
Flash: 0 Bytes
MMC:   mmc@4f80000: 0
Loading Environment from MMC... OK
In:    serial@2860000
Out:   serial@2860000
Err:   serial@2860000
am65_cpsw_nuss ethernet@c000000: K3 CPSW: nuss_ver: 0x6BA01901 cpsw_ver: 0x6BA80101 ale_ver: 0x00294104 Ports:1 mdio_freq:1000000
Net:   
Warning: ethernet@c000000port@7 (eth0) using random MAC address - e2:c6:b5:1a:10:68
eth0: ethernet@c000000port@7
Hit any key to stop autoboot:  0 
=> 

 I am able to access the PHY via MDIO interface. Ethernet cable is plugged in on the according RJ45 port. The link is up. I am getting the following output when calling mdio, net and mii commands:

=> mdio list
mdio@f00:
ethernet@c000000port@7:
2 - TI DP83867 <--> ethernet@c000000port@7
=> net list
eth0 : ethernet@c000000port@7 e2:c6:b5:1a:10:68 active
=> mii dump 2 1
1.     (796d)                 -- PHY status register --
  (8000:0000) 1.15    =     0     100BASE-T4 able
  (4000:4000) 1.14    =     1     100BASE-X  full duplex able
  (2000:2000) 1.13    =     1     100BASE-X  half duplex able
  (1000:1000) 1.12    =     1     10 Mbps    full duplex able
  (0800:0800) 1.11    =     1     10 Mbps    half duplex able
  (0400:0000) 1.10    =     0     100BASE-T2 full duplex able
  (0200:0000) 1. 9    =     0     100BASE-T2 half duplex able
  (0100:0100) 1. 8    =     1     extended status
  (0080:0000) 1. 7    =     0     (reserved)
  (0040:0040) 1. 6    =     1     MF preamble suppression
  (0020:0020) 1. 5    =     1     A/N complete
  (0010:0000) 1. 4    =     0     remote fault
  (0008:0008) 1. 3    =     1     A/N able
  (0004:0004) 1. 2    =     1     link status
  (0002:0000) 1. 1    =     0     jabber detect
  (0001:0001) 1. 0    =     1     extended capabilities


So I think everything looks fine until now. However, when calling dhcp to get a valid IP address, I get the following output:

=> dhcp
k3-navss-ringacc ringacc@3c000000: Ring Accelerator probed rings:1024, gp-rings[440,150] sci-dev-id:211
k3-navss-ringacc ringacc@3c000000: dma-ring-reset-quirk: disabled
am65_cpsw_nuss_port ethernet@c000000port@7: K3 CPSW: rflow_id_base: 16
link up on port 7, speed 1000, full duplex
BOOTP broadcast 1
BOOTP broadcast 2
BOOTP broadcast 3
BOOTP broadcast 4
BOOTP broadcast 5
BOOTP broadcast 6
BOOTP broadcast 7
BOOTP broadcast 8
BOOTP broadcast 9
BOOTP broadcast 10
BOOTP broadcast 11
BOOTP broadcast 12
BOOTP broadcast 13
BOOTP broadcast 14
BOOTP broadcast 15
BOOTP broadcast 16
BOOTP broadcast 17

Retry time exceeded; starting again

Additionally, no packets sent or received from the custom board can be seen on Wireshark. However, the CPSW_STAT registers shows, that there where good frames received:

=> md 0x0c03a000
0c03a000: 00000011 00000011 00000000 00000000  ................
0c03a010: 00000000 00000000 00000000 00000000  ................
0c03a020: 00000000 00000000 00000000 00000000  ................
0c03a030: 000016fa 00000000 00000000 00000000  ................
0c03a040: 00000000 00000000 00000000 00000000  ................
0c03a050: 00000000 00000000 00000000 00000000  ................
0c03a060: 00000000 00000000 00000000 00000000  ................
0c03a070: 00000000 00000011 00000000 00000000  ................
0c03a080: 000016fa 00000000 00000000 00000000  ................
0c03a090: 00000000 00000000 00000000 00000000  ................
0c03a0a0: 00000000 00000000 00000000 00000000  ................
0c03a0b0: 00000000 00000000 00000011 000016fa  ................
0c03a0c0: 00000000 00000000 00000000 00000000  ................
0c03a0d0: 00000000 00000000 00000000 00000000  ................
0c03a0e0: 00000000 00000000 00000000 00000000  ................
0c03a0f0: 00000000 00000000 00000000 00000000  ................

I suspect that there is something wrong with SGMII. MDIO Interface works fine.

Do you have any hint on where I should investigate further?

Thanks for your help and best regards,

Felix

  • Hi Felix,

    As you are using SGMII MAC port 7, you would be using the 4 lane serdes. This serdes is not powered on be default and the probe for this serdes has to be added. Have you done this?

    It looks like serdes might be the issue. Can you print out the following registers:

    • 0x0505E000
    • 0x05050480
    • 0x050504C0
    • 0x05050500
    • 0x05050540
    • 0x05050484
    • 0x050504C4
    • 0x05050504
    • 0x05050544
    • 0x05050488
    • 0x050504C8
    • 0x05050508
    • 0x05050548
    • 0x0505040C
    • 0x05050408

    If you get a crash while reading the registers, the serdes is not powered on.

    Regards,
    Tanmay

  • Hi Tanmay,

    thanks for your quick response. I did not get a crash while reading out these registers. This are the results:

    => md 0x505E000 1
    0505e000: 000c0000                             ....
    => md 0x5050480 1
    05050480: 00000000                             ....
    => md 0x50504c0 1
    050504c0: 00000000                             ....
    => md 0x5050500 1
    05050500: 00000000                             ....
    => md 0x5050540 1
    05050540: 00000000                             ....
    => md 0x5050484 1
    05050484: 00000000                             ....
    => md 0x50504c4 1
    050504c4: 00000000                             ....
    => md 0x5050504 1
    05050504: 00000000                             ....
    => md 0x5050544 1
    05050544: 00000000                             ....
    => md 0x5050488 1
    05050488: 00000000                             ....
    => md 0x50504c8 1
    050504c8: 00000000                             ....
    => md 0x5050508 1
    05050508: 00000000                             ....
    => md 0x5050548 1
    05050548: 00000000                             ....
    => md 0x505040c 1
    0505040c: 00000000                             ....
    => md 0x5050408 1
    05050408: 08000000                             ....
    

    serdes 4 device tree node (from k3-j721e-main.dts) looks the following:

    	serdes_wiz4: wiz@5050000 {
    		compatible = "ti,j721e-wiz-16g";
    		#address-cells = <1>;
    		#size-cells = <1>;
    		power-domains = <&k3_pds 297 TI_SCI_PD_EXCLUSIVE>;
    		clocks = <&k3_clks 297 1>, <&k3_clks 297 9>, <&cmn_refclk>;
    		clock-names = "fck", "core_ref_clk", "ext_ref_clk";
    		assigned-clocks = <&k3_clks 297 9>;
    		assigned-clock-parents = <&k3_clks 297 10>;
    		assigned-clock-rates = <19200000>;
    		num-lanes = <4>;
    		#reset-cells = <1>;
    		ranges = <0x5050000 0x0 0x5050000 0x10000>,
    			<0xa030a00 0x0 0xa030a00 0x40>;
    
    		wiz4_pll0_refclk: pll0-refclk {
    			clocks = <&k3_clks 297 9>, <&cmn_refclk>;
    			clock-output-names = "wiz4_pll0_refclk";
    			#clock-cells = <0>;
    			assigned-clocks = <&wiz4_pll0_refclk>;
    			assigned-clock-parents = <&k3_clks 297 9>;
    		};
    
    		wiz4_pll1_refclk: pll1-refclk {
    			clocks = <&k3_clks 297 9>, <&cmn_refclk>;
    			clock-output-names = "wiz4_pll1_refclk";
    			#clock-cells = <0>;
    			assigned-clocks = <&wiz4_pll1_refclk>;
    			assigned-clock-parents = <&k3_clks 297 9>;
    		};
    
    		wiz4_refclk_dig: refclk-dig {
    			clocks = <&k3_clks 297 9>, <&cmn_refclk>;
    			clock-output-names = "wiz4_refclk_dig";
    			#clock-cells = <0>;
    			assigned-clocks = <&wiz4_refclk_dig>;
    			assigned-clock-parents = <&k3_clks 297 9>;
    		};
    
    		wiz4_cmn_refclk_dig_div: cmn-refclk-dig-div {
    			clocks = <&wiz4_refclk_dig>;
    			#clock-cells = <0>;
    		};
    
    		wiz4_cmn_refclk1_dig_div: cmn-refclk1-dig-div {
    			clocks = <&wiz4_pll1_refclk>;
    			#clock-cells = <0>;
    		};
    
    		serdes4: serdes@5050000 {
    			/*
    			 * Note: we also map DPTX PHY registers as the Torrent
    			 * needs to manage those.
    			 */
    			compatible = "ti,j721e-serdes-10g";
    			reg = <0x5050000 0x10000>,
    			      <0xa030a00 0x40>; /* DPTX PHY */
    			reg-names = "torrent_phy", "dptx_phy";
    
    			resets = <&serdes_wiz4 0>;
    			reset-names = "torrent_reset";
    			clocks = <&wiz4_pll0_refclk>;
    			clock-names = "refclk";
    			#address-cells = <1>;
    			#size-cells = <0>;
    			
    			serdes4_sgmii_link: phy@0 {
    				reg = <0>;
    				resets = <&serdes_wiz4 1>, <&serdes_wiz4  2>, <&serdes_wiz4 3>, <&serdes_wiz4 4>;
    				cdns,phy-type = <PHY_TYPE_SGMII>;
    				cdns,num-lanes = <4>;
    				#phy-cells = <0>;
    			};
    		};
    	};

    I tried to change the "compatible" field to "ti,j721e-wiz-10g", since in TRM this SERDES instance is mentioned as SERDES_10G0. But this results in a crash, when I try to read out register 0x0505E000.

    Best regards,

    Felix

  • Update:

    Strangely, I am now getting a crash everytime, when I try to read out 0x0505E000. Although I went back to the serdes device tree node I posted in the previous post.

    The crash dump looks the following:

    => md 0x505E000 1
    "Error" handler, esr 0xbf000000
    elr: 00000000808bda68 lr : 00000000808ba13c (reloc)
    elr: 00000000fff8fa68 lr : 00000000fff8c13c
    x0 : 00000000fde99109 x1 : 00000000fffac8c9
    x2 : 00000000fde99020 x3 : 00000000ffffffd0
    x4 : 00000000ffffffff x5 : 00000000fde98e98
    x6 : 0000000000000030 x7 : 00000000fde99050
    x8 : 00000000fff13ed4 x9 : 0000000000000008
    x10: 00000000ffffffd8 x11: 0000000000000010
    x12: 0000000000000040 x13: 000000000001869f
    x14: 00000000fde99470 x15: 0000000000000021
    x16: 00000000ffee9268 x17: 0000000000000000
    x18: 00000000fdeb1db0 x19: 0000000000000004
    x20: 0000000000000004 x21: 0000000000000001
    x22: 000000000505e004 x23: 00000000fde99109
    x24: 0000000000000000 x25: 00000000fde990b8
    x26: 00000000fffac8c9 x27: 0000000000000008
    x28: 0000000000000004 x29: 00000000fde98fd0
    
    Code: b9004fff a9430fe2 a9010fe2 a9440fe2 (a9020fe2) 
    Resetting CPU ...
    
    resetting ...
    

  • Update: 

    Reading CPSW_SGMII_STATUS_REG_j gives the following output:

    => md 0x0c000114 1
    0c000114: 00000028                             (...
    => md 0x0c000214 1
    0c000214: 00000028                             (...
    => md 0x0c000314 1
    0c000314: 0000002c                             ,...
    => md 0x0c000414 1
    0c000414: 0000002c                             ,...
    => md 0x0c000514 1
    0c000514: 00000028                             (...
    => md 0x0c000614 1
    0c000614: 00000028                             (...
    => md 0x0c000714 1
    0c000714: 00000000                             ....
    => md 0x0c000814 1
    0c000814: 0000002a                             *...
    

    So for SGMII on port 7 (0x0c000714), The SERDES PLL is not locked and link is therefore also not up.

    Can you show me how to properly initialize serdes4 instance for my use case?

    Thanks for your help and best regards,

    Felix

  • Hi TI, 

    I would just like to kindly remind you of this question.

    Best regards,

    Felix

  • Hi TI,

    the following parts were missing in my U-Boot code:

    • CONFIG_PHY_CADENCE_TORRENT was not activated in my config
    • configure_serdes_torrent() was not called in board_late_init()

    With these changes, I am now getting the following U-Boot Log:

    U-Boot 2023.04-a72-emmc-develop-g3849cd137b-dirty (Apr 05 2024 - 12:22:32 +0200)
    
    SoC:   J721E SR1.1 GP
    Model: Texas Instruments K3 J721E SoC
    DRAM:  4 GiB
    Core:  116 devices, 34 uclasses, devicetree: separate
    Warning: Device tree includes old 'u-boot,dm-' tags: please fix by 2023.07!
    Flash: 0 Bytes
    MMC:   mmc@4f80000: 0
    Loading Environment from MMC... OK
    In:    serial@2860000
    Out:   serial@2860000
    Err:   serial@2860000
    am65_cpsw_nuss ethernet@c000000: K3 CPSW: nuss_ver: 0x6BA01901 cpsw_ver: 0x6BA80101 ale_ver: 0x00294104 Ports:3 mdio_freq:1000000
    cdns,sierra serdes@5000000: sierra probed
    cdns,torrent serdes@5050000: phy ref clock not found
    Torrent init failed:-19
    Net:   eth1: ethernet@c000000port@5, eth2: ethernet@c000000port@6, eth0: ethernet@c000000port@7
    Hit any key to stop autoboot:  0 
    => 
    

    Still, there seems to be some error with Serdes4 instance: cdns,torrent serdes@5050000: phy ref clock not found

    The Device Tree for Serdes4 looks the following:

    	serdes_wiz4: wiz@5050000 {
    		compatible = "ti,am64-wiz-10g";
    		#address-cells = <1>;
    		#size-cells = <1>;
    		power-domains = <&k3_pds 297 TI_SCI_PD_EXCLUSIVE>;
    		clocks = <&k3_clks 297 1>, <&k3_clks 297 9>, <&cmn_refclk>;
    		clock-names = "fck", "core_ref_clk", "ext_ref_clk";
    		assigned-clocks = <&k3_clks 297 9>;
    		assigned-clock-parents = <&k3_clks 297 13>;
    		num-lanes = <4>;
    		#reset-cells = <1>;
    		ranges = <0x5050000 0x0 0x5050000 0x10000>,
    			<0xa030a00 0x0 0xa030a00 0x40>;
    
    		wiz4_pll0_refclk: pll0-refclk {
    			clocks = <&k3_clks 297 9>, <&cmn_refclk>;
    			clock-output-names = "wiz4_pll0_refclk";
    			#clock-cells = <0>;
    			assigned-clocks = <&wiz4_pll0_refclk>;
    			assigned-clock-parents = <&k3_clks 297 9>;
    		};
    
    		wiz4_pll1_refclk: pll1-refclk {
    			clocks = <&k3_clks 297 9>, <&cmn_refclk>;
    			clock-output-names = "wiz4_pll1_refclk";
    			#clock-cells = <0>;
    			assigned-clocks = <&wiz4_pll1_refclk>;
    			assigned-clock-parents = <&k3_clks 297 9>;
    		};
    
    		wiz4_refclk_dig: refclk-dig {
    			clocks = <&k3_clks 297 9>, <&cmn_refclk>;
    			clock-output-names = "wiz4_refclk_dig";
    			#clock-cells = <0>;
    			assigned-clocks = <&wiz4_refclk_dig>;
    			assigned-clock-parents = <&k3_clks 297 9>;
    		};
    
    		wiz4_cmn_refclk_dig_div: cmn-refclk-dig-div {
    			clocks = <&wiz4_refclk_dig>;
    			#clock-cells = <0>;
    		};
    
    		wiz4_cmn_refclk1_dig_div: cmn-refclk1-dig-div {
    			clocks = <&wiz4_pll1_refclk>;
    			#clock-cells = <0>;
    		};
    
    		serdes4: serdes@5050000 {
    			/*
    			 * Note: we also map DPTX PHY registers as the Torrent
    			 * needs to manage those.
    			 */
    			compatible = "ti,j721e-serdes-10g";
    			reg = <0x5050000 0x10000>,
    			      <0xa030a00 0x40>; /* DPTX PHY */
    			reg-names = "torrent_phy", "dptx_phy";
    
    			resets = <&serdes_wiz4 0>;
    			reset-names = "torrent_reset";
    			clocks = <&wiz4_pll0_refclk>;
    			clock-names = "refclk";
    			#address-cells = <1>;
    			#size-cells = <0>;
    			serdes4_sgmii_link: phy@0 {
    				reg = <0>;
    				resets = <&serdes_wiz4 1>, <&serdes_wiz4  2>, <&serdes_wiz4 3>, <&serdes_wiz4 4>;
    				cdns,phy-type = <PHY_TYPE_SGMII>;
    				cdns,num-lanes = <4>;
    				#phy-cells = <0>;
    			};
    		};
    	};

    I changed the compatible field to "ti,am64-wiz-10g" and I changed assigned-clock-parents = <&k3_clks 297 13>;

    Print out of Serdes4 registers gives the following:

    => md 0x505E000 1
    0505e000: 000c0000                             ....
    => md 0x5050480 1
    05050480: 30000000                             ...0
    => md 0x50504c0 1
    050504c0: 30000000                             ...0
    => md 0x5050500 1
    05050500: 30000000                             ...0
    => md 0x5050540 1
    05050540: 30000000                             ...0
    => md 0x5050484 1
    05050484: 00010002                             ....
    => md 0x50504c4 1
    050504c4: 00010002                             ....
    => md 0x5050504 1
    05050504: 00010002                             ....
    => md 0x5050544 1
    05050544: 00010002                             ....
    => md 0x5050488 1
    05050488: 00000000                             ....
    => md 0x50504c8 1
    050504c8: 00000000                             ....
    => md 0x5050508 1
    05050508: 00000000                             ....
    => md 0x5050548 1
    05050548: 00000000                             ....
    => md 0x505040c 1
    0505040c: 00000000                             ....
    => md 0x5050408 1
    05050408: 98000000                             ....

    Reading CPSW_SGMII_STATUS_REG_j gives the following output:

    => md 0x0c000114 1
    0c000114: 00000028                             (...
    => md 0x0c000214 1
    0c000214: 00000028                             (...
    => md 0x0c000314 1
    0c000314: 00000028                             (...
    => md 0x0c000414 1
    0c000414: 0000002c                             ,...
    => md 0x0c000514 1
    0c000514: 00000000                             ....
    => md 0x0c000614 1
    0c000614: 00000000                             ....
    => md 0x0c000714 1
    0c000714: 00000000                             ....
    => md 0x0c000814 1
    0c000814: 00000028                             (...
    

    Best regards,

    Felix

  • Hi TI,

    just a quick reminder regarding this issue.

    Best regards,

    Felix

  • Hi Felix,

    Sorry for the delay.

    Can you make the following changes in your current setup:

    1. Make the compatible sting for wiz as : "ti,j721e-wiz-10g"
    2. Make the compatible string for serdes as : "ti,j721e-serdes-10g"
    3. Remove the DPHY ranges from the serdes node.
    4. In the "clocks" property in the serdes node, put "&k3_clks 297 9" instead of "&wiz4_pll0_refclk"

    Regards,
    Tanmay

  • Hi Tanmay,

    thanks for your response.

    I applied all of your suggestions. The Boot log looks now the following: (I added " dev_info(dev, "torrent probed\n");" at the end of cdns_torrent_phy_probe)

    U-Boot 2023.04-a72-emmc-develop-g3849cd137b-dirty (Apr 17 2024 - 11:08:19 +0200)
    
    SoC:   J721E SR1.1 GP
    Model: Texas Instruments K3 J721E SoC
    DRAM:  4 GiB
    Core:  116 devices, 34 uclasses, devicetree: separate
    Warning: Device tree includes old 'u-boot,dm-' tags: please fix by 2023.07!
    Flash: 0 Bytes
    MMC:   mmc@4f80000: 0
    Loading Environment from MMC... OK
    In:    serial@2860000
    Out:   serial@2860000
    Err:   serial@2860000
    am65_cpsw_nuss ethernet@c000000: K3 CPSW: nuss_ver: 0x6BA01901 cpsw_ver: 0x6BA80101 ale_ver: 0x00294104 Ports:3 mdio_freq:1000000
    cdns,sierra serdes@5000000: sierra probed
    cdns,torrent serdes@5050000: torrent probed
    Net:   eth1: ethernet@c000000port@5, eth2: ethernet@c000000port@6, eth0: ethernet@c000000port@7
    Hit any key to stop autoboot:  0 
    =>

    So the previous mentioned error  "phy ref clock not found" seems to be solved. However, I still can not get a valid IP address using dhcp command:

    => mdio list
    mdio@f00:
    ethernet@c000000port@5:
    0 - TI DP83867 <--> ethernet@c000000port@5
    1 - TI DP83867 <--> ethernet@c000000port@6
    2 - TI DP83867 <--> ethernet@c000000port@7
    => net list 
    eth1 : ethernet@c000000port@5 2e:a2:59:4c:cc:4f 
    eth2 : ethernet@c000000port@6 6a:7a:c7:02:0a:a4 
    eth0 : ethernet@c000000port@7 82:11:18:93:eb:cd active
    => dhcp
    k3-navss-ringacc ringacc@3c000000: Ring Accelerator probed rings:1024, gp-rings[440,150] sci-dev-id:211
    k3-navss-ringacc ringacc@3c000000: dma-ring-reset-quirk: disabled
    am65_cpsw_nuss_port ethernet@c000000port@7: K3 CPSW: rflow_id_base: 16
    link up on port 7, speed 1000, full duplex
    BOOTP broadcast 1
    BOOTP broadcast 2
    BOOTP broadcast 3
    BOOTP broadcast 4
    BOOTP broadcast 5
    BOOTP broadcast 6
    BOOTP broadcast 7
    BOOTP broadcast 8
    BOOTP broadcast 9
    BOOTP broadcast 10
    BOOTP broadcast 11
    BOOTP broadcast 12
    BOOTP broadcast 13
    BOOTP broadcast 14
    BOOTP broadcast 15
    BOOTP broadcast 16
    BOOTP broadcast 17
    
    Retry time exceeded; starting again
    

    Print out of Serdes4 registers gives the following:

    => md 0x505E000 1
    0505e000: 000c0000                             ....
    => md 0x5050480 1
    05050480: 30000000                             ...0
    => md 0x50504c0 1
    050504c0: 30000000                             ...0
    => md 0x5050500 1
    05050500: 30000000                             ...0
    => md 0x5050540 1
    05050540: 30000000                             ...0
    => md 0x5050484 1
    05050484: 00010002                             ....
    => md 0x50504c4 1
    050504c4: 00010002                             ....
    => md 0x5050504 1
    05050504: 00010002                             ....
    => md 0x5050544 1
    05050544: 00010002                             ....
    => md 0x5050488 1
    05050488: 00000000                             ....
    => md 0x50504c8 1
    050504c8: 00000000                             ....
    => md 0x5050508 1
    05050508: 00000000                             ....
    => md 0x5050548 1
    05050548: 00000000                             ....
    => md 0x505040c 1
    0505040c: 00000000                             ....
    => md 0x5050408 1
    05050408: 98000000                             ....

    Print out CPSW_SGMII_STATUS_REG_j gives the following:

    => md 0x0c000114 1
    0c000114: 00000028                             (...
    => md 0x0c000214 1
    0c000214: 00000028                             (...
    => md 0x0c000314 1
    0c000314: 00000028                             (...
    => md 0x0c000414 1
    0c000414: 0000002c                             ,...
    => md 0x0c000514 1
    0c000514: 00000000                             ....
    => md 0x0c000614 1
    0c000614: 00000000                             ....
    => md 0x0c000714 1
    0c000714: 00000000                             ....
    => md 0x0c000814 1
    0c000814: 0000002a                             *...
    

    So for SERDES4 Registers nothing changed and CPSW_SGMII_STATUS_REG_j for port 5,6,7 is also the same.

    I think that at least for the LANECTLx SERDES registers, which currently read as 0x3000'0000 there is something not correct and also CPSW_SGMII_STATUS_REG_j  should not be 0x0 for port5, port6 and port7. 

    One drawback of the current hardware design is, that I am not able to reset the PHY's via a GPIO on TDA4. Is resetting necessary so that PHY works properly? The Strap Configuration should be correct.

    Do you have any other ideas on what is still missing here?

    Thanks again for your help.

    Best regards,

    Felix

  • Hi Felix,

    From the register dump, I can see that the PLL for serdes is not being locked. Its is some issue with the clocking of the serdes itself.

    In the "clocks" property in the serdes node, put "&k3_clks 297 9" instead of "&wiz4_pll0_refclk"

    Can you revert back only the above change and try.

    Is resetting necessary so that PHY works properly? The Strap Configuration should be correct.

    The power-on reset should work with the proper strap configuration. But if you want to use the same phy from linux kernel later, I would think that it would be better to reset it. This question is better asked to the hardware team and I am not very sure regarding this.

    Regards,
    Tanmay

  • Hi Tanmay,

    I reverted the line you suggested. This is how the serdes4 node looks right now:

    	serdes_wiz4: wiz@5050000 {
    		compatible = "ti,j721e-wiz-10g";
    		#address-cells = <1>;
    		#size-cells = <1>;
    		power-domains = <&k3_pds 297 TI_SCI_PD_EXCLUSIVE>;
    		clocks = <&k3_clks 297 1>, <&k3_clks 297 9>, <&cmn_refclk>;
    		clock-names = "fck", "core_ref_clk", "ext_ref_clk";
    		assigned-clocks = <&k3_clks 297 9>;
    		assigned-clock-parents = <&k3_clks 297 13>;
    		num-lanes = <4>;
    		#reset-cells = <1>;
    		ranges = <0x5050000 0x0 0x5050000 0x10000>;
    
    		wiz4_pll0_refclk: pll0-refclk {
    			clocks = <&k3_clks 297 9>, <&cmn_refclk>;
    			clock-output-names = "wiz4_pll0_refclk";
    			#clock-cells = <0>;
    			assigned-clocks = <&wiz4_pll0_refclk>;
    			assigned-clock-parents = <&k3_clks 297 9>;
    		};
    
    		wiz4_pll1_refclk: pll1-refclk {
    			clocks = <&k3_clks 297 9>, <&cmn_refclk>;
    			clock-output-names = "wiz4_pll1_refclk";
    			#clock-cells = <0>;
    			assigned-clocks = <&wiz4_pll1_refclk>;
    			assigned-clock-parents = <&k3_clks 297 9>;
    		};
    
    		wiz4_refclk_dig: refclk-dig {
    			clocks = <&k3_clks 297 9>, <&cmn_refclk>;
    			clock-output-names = "wiz4_refclk_dig";
    			#clock-cells = <0>;
    			assigned-clocks = <&wiz4_refclk_dig>;
    			assigned-clock-parents = <&k3_clks 297 9>;
    		};
    
    		wiz4_cmn_refclk_dig_div: cmn-refclk-dig-div {
    			clocks = <&wiz4_refclk_dig>;
    			#clock-cells = <0>;
    		};
    
    		wiz4_cmn_refclk1_dig_div: cmn-refclk1-dig-div {
    			clocks = <&wiz4_pll1_refclk>;
    			#clock-cells = <0>;
    		};
    
    		serdes4: serdes@5050000 {
    			/*
    			 * Note: we also map DPTX PHY registers as the Torrent
    			 * needs to manage those.
    			 */
    			compatible = "ti,j721e-serdes-10g";
    			reg = <0x5050000 0x10000>;
    			reg-names = "torrent_phy";
    
    			resets = <&serdes_wiz4 0>;
    			reset-names = "torrent_reset";
    			clocks = <&wiz4_pll0_refclk>;
    			clock-names = "refclk";
    			#address-cells = <1>;
    			#size-cells = <0>;
    		};
    	};

    processor-board-device treee contains the following ethernet related nodes:

    &main_pmx0 {
    	mymdio1_pins_default: mymdio1-default-pins {
    		pinctrl-single,pins = <
    			J721E_IOPAD(0x1bc, PIN_OUTPUT, 0) /* (V24) MDIO0_MDC */
    			J721E_IOPAD(0x1b8, PIN_INPUT, 0) /* (V26) MDIO0_MDIO */
    		>;
    	};
    	
    };
    
    &serdes4 {
    	serdes4_sgmii_link: phy@0 {
    		reg = <0>;
    		resets = <&serdes_wiz4 1>, <&serdes_wiz4  2>, <&serdes_wiz4 3>, <&serdes_wiz4 4>;
    		cdns,phy-type = <PHY_TYPE_SGMII>;
    		cdns,num-lanes = <4>;
    		#phy-cells = <0>;
    	};
    };
    
    &main_cpsw0 {
    	status = "okay";
    	pinctrl-names = "default";
    	pinctrl-0 = <&mymdio1_pins_default>;
    };
    
    &main_cpsw0_mdio {
    
    	//reset-gpios = <&wkup_gpio1 50 GPIO_ACTIVE_LOW>;
    	//reset-port-delay-us = <120000>;
    	
    	cpsw9g_phy0: ethernet-phy@0 {
    		reg = <0>;
    		compatible = "ti,dp83867";
    	};
    	cpsw9g_phy1: ethernet-phy@1 {
    		reg = <1>;
    		compatible = "ti,dp83867";
    	};
    	cpsw9g_phy2: ethernet-phy@2 {
    		reg = <2>;
    		compatible = "ti,dp83867";
    	};
    };
    
    
    &main_cpsw0_port5 {
    	status = "okay";
        phy-mode = "sgmii";
        mac-address = [00 00 00 00 00 00];
        phys = <&main_phy_gmii_sel 5>, <&serdes4_sgmii_link>;
    	phy-names = "mac", "serdes";
        phy-handle = <&cpsw9g_phy0>;
    };
    
    &main_cpsw0_port6 {
    	status = "okay";
        phy-mode = "sgmii";
        mac-address = [00 00 00 00 00 00];
        phys = <&main_phy_gmii_sel 6>, <&serdes4_sgmii_link>;
        phy-names = "mac", "serdes";
        phy-handle = <&cpsw9g_phy1>;
    };
    
    &main_cpsw0_port7 {
    	status = "okay";
        phy-mode = "sgmii";
        mac-address = [00 00 00 00 00 00];
        phys = <&main_phy_gmii_sel 7>, <&serdes4_sgmii_link>;
        phy-names = "mac", "serdes";
        phy-handle = <&cpsw9g_phy2>;
    };

    The bootlog and serdes registers show now the following:

    U-Boot 2023.04-a72-emmc-develop-g3849cd137b-dirty (Apr 18 2024 - 08:31:22 +0200)
    
    SoC:   J721E SR1.1 GP
    Model: Texas Instruments K3 J721E SoC
    DRAM:  4 GiB
    Core:  116 devices, 34 uclasses, devicetree: separate
    Warning: Device tree includes old 'u-boot,dm-' tags: please fix by 2023.07!
    Flash: 0 Bytes
    MMC:   mmc@4f80000: 0
    Loading Environment from MMC... OK
    In:    serial@2860000
    Out:   serial@2860000
    Err:   serial@2860000
    am65_cpsw_nuss ethernet@c000000: K3 CPSW: nuss_ver: 0x6BA01901 cpsw_ver: 0x6BA80101 ale_ver: 0x00294104 Ports:3 mdio_freq:1000000
    cdns,sierra serdes@5000000: sierra probed
    cdns,torrent serdes@5050000: Failed to prepare ref clock
    Torrent init failed:-38
    Net:   eth1: ethernet@c000000port@5, eth2: ethernet@c000000port@6, eth0: ethernet@c000000port@7
    Hit any key to stop autoboot:  0 
    => md 0x505E000 1
    0505e000: 000c0000                             ....
    => md 0x5050480 1
    05050480: 30000000                             ...0
    => md 0x50504c0 1
    050504c0: 30000000                             ...0
    => md 0x5050500 1
    05050500: 30000000                             ...0
    => md 0x5050540 1
    05050540: 30000000                             ...0
    => md 0x5050484 1
    05050484: 00010002                             ....
    => md 0x50504c4 1
    050504c4: 00010002                             ....
    => md 0x5050504 1
    05050504: 00010002                             ....
    => md 0x5050544 1
    05050544: 00010002                             ....
    => md 0x5050488 1
    05050488: 00000000                             ....
    => md 0x50504c8 1
    050504c8: 00000000                             ....
    => md 0x5050508 1
    05050508: 00000000                             ....
    => md 0x5050548 1
    05050548: 00000000                             ....
    => md 0x505040c 1
    0505040c: 10000000                             ....
    => md 0x5050408 1
    05050408: 98000000                             ....
    

    So Torrent init fails now again, but with a different error code. Serdes registers are the same except 0x505040c (SERDES_RST).

    Best regards,

    Felix

  • Just one additional information: I am using U-Boot from PSDK Linux v09.01. The patches I mentioned in my initial question were based on PSDK Linux 08.02. Maybe there is some conflict here?

    My current phy-j721e-wiz.c looks the following:

    // SPDX-License-Identifier: GPL-2.0+
    /*
     * Copyright (C) 2017-2018 Texas Instruments Incorporated - http://www.ti.com/
     * Jean-Jacques Hiblot <jjhiblot@ti.com>
     */
    
    #include <common.h>
    #include <clk-uclass.h>
    #include <dm.h>
    #include <dm/device_compat.h>
    #include <asm/gpio.h>
    #include <dm/lists.h>
    #include <dm/device-internal.h>
    #include <regmap.h>
    #include <reset-uclass.h>
    #include <dt-bindings/phy/phy.h>
    
    #include <dt-bindings/phy/phy-ti.h>
    
    #define WIZ_MAX_INPUT_CLOCKS	4
    /* To include mux clocks, divider clocks and gate clocks */
    #define WIZ_MAX_OUTPUT_CLOCKS	32
    
    #define WIZ_MAX_LANES		4
    #define WIZ_MUX_NUM_CLOCKS	3
    #define WIZ_DIV_NUM_CLOCKS_16G	2
    #define WIZ_DIV_NUM_CLOCKS_10G	1
    
    #define WIZ_SERDES_CTRL		0x404
    #define WIZ_SERDES_TOP_CTRL	0x408
    #define WIZ_SERDES_RST		0x40c
    #define WIZ_SERDES_TYPEC	0x410
    #define WIZ_LANECTL(n)		(0x480 + (0x40 * (n)))
    #define WIZ_LANEDIV(n)		(0x484 + (0x40 * (n)))
    
    #define WIZ_MAX_LANES		4
    #define WIZ_MUX_NUM_CLOCKS	3
    #define WIZ_DIV_NUM_CLOCKS_16G	2
    #define WIZ_DIV_NUM_CLOCKS_10G	1
    
    #define WIZ_SERDES_TYPEC_LN10_SWAP	BIT(30)
    #define WIZ_SERDES_TYPEC_LN23_SWAP	BIT(31)
    
    enum wiz_lane_standard_mode {
    	LANE_MODE_GEN1,
    	LANE_MODE_GEN2,
    	LANE_MODE_GEN3,
    	LANE_MODE_GEN4,
    };
    
    enum wiz_refclk_mux_sel {
    	PLL0_REFCLK,
    	PLL1_REFCLK,
    	REFCLK_DIG,
    };
    
    enum wiz_refclk_div_sel {
    	CMN_REFCLK,
    	CMN_REFCLK1,
    };
    
    enum wiz_clock_input {
    	WIZ_CORE_REFCLK,
    	WIZ_EXT_REFCLK,
    	WIZ_CORE_REFCLK1,
    	WIZ_EXT_REFCLK1,
    };
    
    /*
     * List of master lanes used for lane swapping
     */
    enum wiz_typec_master_lane {
    	LANE0 = 0,
    	LANE2 = 2,
    };
    
    static const struct reg_field por_en = REG_FIELD(WIZ_SERDES_CTRL, 31, 31);
    static const struct reg_field phy_reset_n = REG_FIELD(WIZ_SERDES_RST, 31, 31);
    static const struct reg_field pll1_refclk_mux_sel =
    					REG_FIELD(WIZ_SERDES_RST, 29, 29);
    static const struct reg_field pll1_refclk_mux_sel_2 =
    					REG_FIELD(WIZ_SERDES_RST, 22, 23);
    static const struct reg_field pll0_refclk_mux_sel =
    					REG_FIELD(WIZ_SERDES_RST, 28, 28);
    static const struct reg_field pll0_refclk_mux_sel_2 =
    					REG_FIELD(WIZ_SERDES_RST, 28, 29);
    static const struct reg_field refclk_dig_sel_16g =
    					REG_FIELD(WIZ_SERDES_RST, 24, 25);
    static const struct reg_field refclk_dig_sel_10g =
    					REG_FIELD(WIZ_SERDES_RST, 24, 24);
    static const struct reg_field pma_cmn_refclk_int_mode =
    					REG_FIELD(WIZ_SERDES_TOP_CTRL, 28, 29);
    static const struct reg_field pma_cmn_refclk1_int_mode =
    					REG_FIELD(WIZ_SERDES_TOP_CTRL, 20, 21);
    static const struct reg_field pma_cmn_refclk_mode =
    					REG_FIELD(WIZ_SERDES_TOP_CTRL, 30, 31);
    static const struct reg_field pma_cmn_refclk_dig_div =
    					REG_FIELD(WIZ_SERDES_TOP_CTRL, 26, 27);
    static const struct reg_field pma_cmn_refclk1_dig_div =
    					REG_FIELD(WIZ_SERDES_TOP_CTRL, 24, 25);
    
    static const struct reg_field p_enable[WIZ_MAX_LANES] = {
    	REG_FIELD(WIZ_LANECTL(0), 30, 31),
    	REG_FIELD(WIZ_LANECTL(1), 30, 31),
    	REG_FIELD(WIZ_LANECTL(2), 30, 31),
    	REG_FIELD(WIZ_LANECTL(3), 30, 31),
    };
    
    enum p_enable { P_ENABLE = 2, P_ENABLE_FORCE = 1, P_ENABLE_DISABLE = 0 };
    
    static const struct reg_field p_align[WIZ_MAX_LANES] = {
    	REG_FIELD(WIZ_LANECTL(0), 29, 29),
    	REG_FIELD(WIZ_LANECTL(1), 29, 29),
    	REG_FIELD(WIZ_LANECTL(2), 29, 29),
    	REG_FIELD(WIZ_LANECTL(3), 29, 29),
    };
    
    static const struct reg_field p_raw_auto_start[WIZ_MAX_LANES] = {
    	REG_FIELD(WIZ_LANECTL(0), 28, 28),
    	REG_FIELD(WIZ_LANECTL(1), 28, 28),
    	REG_FIELD(WIZ_LANECTL(2), 28, 28),
    	REG_FIELD(WIZ_LANECTL(3), 28, 28),
    };
    
    static const struct reg_field p_standard_mode[WIZ_MAX_LANES] = {
    	REG_FIELD(WIZ_LANECTL(0), 24, 25),
    	REG_FIELD(WIZ_LANECTL(1), 24, 25),
    	REG_FIELD(WIZ_LANECTL(2), 24, 25),
    	REG_FIELD(WIZ_LANECTL(3), 24, 25),
    };
    
    static const struct reg_field p0_fullrt_div[WIZ_MAX_LANES] = {
    	REG_FIELD(WIZ_LANECTL(0), 22, 23),
    	REG_FIELD(WIZ_LANECTL(1), 22, 23),
    	REG_FIELD(WIZ_LANECTL(2), 22, 23),
    	REG_FIELD(WIZ_LANECTL(3), 22, 23),
    };
    
    static const struct reg_field p_mac_div_sel0[WIZ_MAX_LANES] = {
    	REG_FIELD(WIZ_LANEDIV(0), 16, 22),
    	REG_FIELD(WIZ_LANEDIV(1), 16, 22),
    	REG_FIELD(WIZ_LANEDIV(2), 16, 22),
    	REG_FIELD(WIZ_LANEDIV(3), 16, 22),
    };
    
    static const struct reg_field p_mac_div_sel1[WIZ_MAX_LANES] = {
    	REG_FIELD(WIZ_LANEDIV(0), 0, 8),
    	REG_FIELD(WIZ_LANEDIV(1), 0, 8),
    	REG_FIELD(WIZ_LANEDIV(2), 0, 8),
    	REG_FIELD(WIZ_LANEDIV(3), 0, 8),
    };
    
    struct wiz_clk_mux_sel {
    	enum wiz_refclk_mux_sel mux_sel;
    	u32			table[WIZ_MAX_INPUT_CLOCKS];
    	const char		*node_name;
    	u32			num_parents;
    	u32			parents[WIZ_MAX_INPUT_CLOCKS];
    };
    
    struct wiz_clk_div_sel {
    	enum wiz_refclk_div_sel div_sel;
    	const char		*node_name;
    };
    
    static struct wiz_clk_mux_sel clk_mux_sel_16g[] = {
    	{
    		/*
    		 * Mux value to be configured for each of the input clocks
    		 * in the order populated in device tree
    		 */
    		.num_parents = 2,
    		.parents = { WIZ_CORE_REFCLK, WIZ_EXT_REFCLK },
    		.mux_sel = PLL0_REFCLK,
    		.table = { 1, 0 },
    		.node_name = "pll0-refclk",
    	},
    	{
    		.num_parents = 2,
    		.parents = { WIZ_CORE_REFCLK1, WIZ_EXT_REFCLK1 },
    		.mux_sel = PLL1_REFCLK,
    		.table = { 1, 0 },
    		.node_name = "pll1-refclk",
    	},
    	{
    		.num_parents = 4,
    		.parents = { WIZ_CORE_REFCLK, WIZ_CORE_REFCLK1, WIZ_EXT_REFCLK, WIZ_EXT_REFCLK1 },
    		.mux_sel = REFCLK_DIG,
    		.table = { 1, 3, 0, 2 },
    		.node_name = "refclk-dig",
    	},
    };
    
    static struct wiz_clk_mux_sel clk_mux_sel_10g[] = {
    	{
    		/*
    		 * Mux value to be configured for each of the input clocks
    		 * in the order populated in device tree
    		 */
    		.num_parents = 2,
    		.parents = { WIZ_CORE_REFCLK, WIZ_EXT_REFCLK },
    		.mux_sel = PLL0_REFCLK,
    		.table = { 1, 0 },
    		.node_name = "pll0-refclk",
    	},
    	{
    		.num_parents = 2,
    		.parents = { WIZ_CORE_REFCLK, WIZ_EXT_REFCLK },
    		.mux_sel = PLL1_REFCLK,
    		.table = { 1, 0 },
    		.node_name = "pll1-refclk",
    	},
    	{
    		.num_parents = 2,
    		.parents = { WIZ_CORE_REFCLK, WIZ_EXT_REFCLK },
    		.mux_sel = REFCLK_DIG,
    		.table = { 1, 0 },
    		.node_name = "refclk-dig",
    	},
    };
    
    static const struct wiz_clk_mux_sel clk_mux_sel_10g_2_refclk[] = {
    	{
    		.num_parents = 3,
    		.parents = { WIZ_CORE_REFCLK, WIZ_CORE_REFCLK1, WIZ_EXT_REFCLK },
    		.table = { 2, 3, 0 },
    		.node_name = "pll0-refclk",
    	},
    	{
    		.num_parents = 3,
    		.parents = { WIZ_CORE_REFCLK, WIZ_CORE_REFCLK1, WIZ_EXT_REFCLK },
    		.table = { 2, 3, 0 },
    		.node_name = "pll1-refclk",
    	},
    	{
    		.num_parents = 3,
    		.parents = { WIZ_CORE_REFCLK, WIZ_CORE_REFCLK1, WIZ_EXT_REFCLK },
    		.table = { 2, 3, 0 },
    		.node_name = "refclk-dig",
    	},
    };
    
    static struct wiz_clk_div_sel clk_div_sel[] = {
    	{
    		.div_sel = CMN_REFCLK,
    		.node_name = "cmn-refclk-dig-div",
    	},
    	{
    		.div_sel = CMN_REFCLK1,
    		.node_name = "cmn-refclk1-dig-div",
    	},
    };
    
    enum wiz_type {
    	J721E_WIZ_16G,
    	J721E_WIZ_10G,
    	AM64_WIZ_10G,
    	J784S4_WIZ_10G,
    	J721S2_WIZ_10G,
    };
    
    struct wiz_data {
    	enum wiz_type type;
    	const struct reg_field *pll0_refclk_mux_sel;
    	const struct reg_field *pll1_refclk_mux_sel;
    	const struct reg_field *refclk_dig_sel;
    	const struct reg_field *pma_cmn_refclk1_dig_div;
    	const struct reg_field *pma_cmn_refclk1_int_mode;
    	const struct wiz_clk_mux_sel *clk_mux_sel;
    	unsigned int clk_div_sel_num;
    };
    
    static const struct wiz_data j721e_16g_data = {
    	.type = J721E_WIZ_16G,
    	.pll0_refclk_mux_sel = &pll0_refclk_mux_sel,
    	.pll1_refclk_mux_sel = &pll1_refclk_mux_sel,
    	.refclk_dig_sel = &refclk_dig_sel_16g,
    	.pma_cmn_refclk1_dig_div = &pma_cmn_refclk1_dig_div,
    	.clk_mux_sel = clk_mux_sel_16g,
    	.clk_div_sel_num = WIZ_DIV_NUM_CLOCKS_16G,
    };
    
    static const struct wiz_data j721e_10g_data = {
    	.type = J721E_WIZ_10G,
    	.pll0_refclk_mux_sel = &pll0_refclk_mux_sel,
    	.pll1_refclk_mux_sel = &pll1_refclk_mux_sel,
    	.refclk_dig_sel = &refclk_dig_sel_10g,
    	.clk_mux_sel = clk_mux_sel_10g,
    	.clk_div_sel_num = WIZ_DIV_NUM_CLOCKS_10G,
    };
    
    static struct wiz_data am64_10g_data = {
    	.type = AM64_WIZ_10G,
    	.pll0_refclk_mux_sel = &pll0_refclk_mux_sel,
    	.pll1_refclk_mux_sel = &pll1_refclk_mux_sel,
    	.refclk_dig_sel = &refclk_dig_sel_10g,
    	.clk_mux_sel = clk_mux_sel_10g,
    	.clk_div_sel_num = WIZ_DIV_NUM_CLOCKS_10G,
    };
    
    static struct wiz_data j784s4_wiz_10g = {
    	.type = J784S4_WIZ_10G,
    	.pll0_refclk_mux_sel = &pll0_refclk_mux_sel_2,
    	.pll1_refclk_mux_sel = &pll1_refclk_mux_sel_2,
    	.refclk_dig_sel = &refclk_dig_sel_16g,
    	.pma_cmn_refclk1_int_mode = &pma_cmn_refclk1_int_mode,
    	.clk_mux_sel = clk_mux_sel_10g_2_refclk,
    	.clk_div_sel_num = WIZ_DIV_NUM_CLOCKS_10G,
    };
    
    static struct wiz_data j721s2_10g_data = {
    	.type = J721S2_WIZ_10G,
    	.pll0_refclk_mux_sel = &pll0_refclk_mux_sel,
    	.pll1_refclk_mux_sel = &pll1_refclk_mux_sel,
    	.refclk_dig_sel = &refclk_dig_sel_10g,
    	.clk_mux_sel = clk_mux_sel_10g,
    	.clk_div_sel_num = WIZ_DIV_NUM_CLOCKS_10G,
    };
    
    #define WIZ_TYPEC_DIR_DEBOUNCE_MIN	100	/* ms */
    #define WIZ_TYPEC_DIR_DEBOUNCE_MAX	1000
    
    struct wiz {
    	struct regmap		*regmap;
    	enum wiz_type		type;
    	struct wiz_clk_mux_sel	*clk_mux_sel;
    	struct wiz_clk_div_sel	*clk_div_sel;
    	unsigned int		clk_div_sel_num;
    	struct regmap_field	*por_en;
    	struct regmap_field	*phy_reset_n;
    	struct regmap_field	*phy_en_refclk;
    	struct regmap_field	*p_enable[WIZ_MAX_LANES];
    	struct regmap_field	*p_align[WIZ_MAX_LANES];
    	struct regmap_field	*p_raw_auto_start[WIZ_MAX_LANES];
    	struct regmap_field	*p_standard_mode[WIZ_MAX_LANES];
    	struct regmap_field	*p_mac_div_sel0[WIZ_MAX_LANES];
    	struct regmap_field	*p_mac_div_sel1[WIZ_MAX_LANES];
    	struct regmap_field	*p0_fullrt_div[WIZ_MAX_LANES];
    	struct regmap_field	*pma_cmn_refclk_int_mode;
    	struct regmap_field	*pma_cmn_refclk1_int_mode;
    	struct regmap_field	*pma_cmn_refclk_mode;
    	struct regmap_field	*pma_cmn_refclk_dig_div;
    	struct regmap_field	*pma_cmn_refclk1_dig_div;
    	struct regmap_field	*div_sel_field[WIZ_DIV_NUM_CLOCKS_16G];
    	struct regmap_field	*mux_sel_field[WIZ_MUX_NUM_CLOCKS];
    
    	struct udevice		*dev;
    	u32			num_lanes;
    	struct gpio_desc	*gpio_typec_dir;
    	u32			lane_phy_type[WIZ_MAX_LANES];
    	u32			master_lane_num[WIZ_MAX_LANES];
    	struct clk		*input_clks[WIZ_MAX_INPUT_CLOCKS];
    	unsigned int		id;
    	const struct wiz_data	*data;
    };
    
    struct wiz_div_clk {
    	struct clk parent_clk;
    	struct wiz *wiz;
    };
    
    struct wiz_mux_clk {
    	struct clk parent_clks[4];
    	struct wiz *wiz;
    };
    
    struct wiz_clk {
    	struct wiz *wiz;
    };
    
    struct wiz_reset {
    	struct wiz *wiz;
    };
    
    static ulong wiz_div_clk_get_rate(struct clk *clk)
    {
    	struct udevice *dev = clk->dev;
    	struct wiz_div_clk *priv = dev_get_priv(dev);
    	struct wiz_clk_div_sel *data = dev_get_plat(dev);
    	struct wiz *wiz = priv->wiz;
    	ulong parent_rate = clk_get_rate(&priv->parent_clk);
    	u32 val;
    
    	regmap_field_read(wiz->div_sel_field[data->div_sel], &val);
    
    	return parent_rate >> val;
    }
    
    static ulong wiz_div_clk_set_rate(struct clk *clk, ulong rate)
    {
    	struct udevice *dev = clk->dev;
    	struct wiz_div_clk *priv = dev_get_priv(dev);
    	struct wiz_clk_div_sel *data = dev_get_plat(dev);
    	struct wiz *wiz = priv->wiz;
    	ulong parent_rate = clk_get_rate(&priv->parent_clk);
    	u32 div = parent_rate / rate;
    
    	div = __ffs(div);
    	regmap_field_write(wiz->div_sel_field[data->div_sel], div);
    
    	return parent_rate >> div;
    }
    
    const struct clk_ops wiz_div_clk_ops = {
    	.get_rate = wiz_div_clk_get_rate,
    	.set_rate = wiz_div_clk_set_rate,
    };
    
    int wiz_div_clk_probe(struct udevice *dev)
    {
    	struct wiz_div_clk *priv = dev_get_priv(dev);
    	struct clk parent_clk;
    	int rc;
    
    	rc = clk_get_by_index(dev, 0, &parent_clk);
    	if (rc) {
    		dev_err(dev, "unable to get parent clock. ret %d\n", rc);
    		return rc;
    	}
    	priv->parent_clk = parent_clk;
    	priv->wiz = dev_get_priv(dev->parent);
    	return 0;
    }
    
    U_BOOT_DRIVER(wiz_div_clk) = {
    	.name		= "wiz_div_clk",
    	.id		= UCLASS_CLK,
    	.priv_auto	= sizeof(struct wiz_div_clk),
    	.ops		= &wiz_div_clk_ops,
    	.probe		= wiz_div_clk_probe,
    };
    
    static int wiz_clk_mux_set_parent(struct clk *clk,  struct clk *parent)
    {
    	struct udevice *dev = clk->dev;
    	struct wiz_mux_clk *priv = dev_get_priv(dev);
    	struct wiz_clk_mux_sel *data = dev_get_plat(dev);
    	struct wiz *wiz = priv->wiz;
    	int i;
    
    	for (i = 0; i < ARRAY_SIZE(priv->parent_clks); i++)
    		if (parent->dev == priv->parent_clks[i].dev)
    			break;
    
    	if (i == ARRAY_SIZE(priv->parent_clks))
    		return -EINVAL;
    
    	regmap_field_write(wiz->mux_sel_field[data->mux_sel], data->table[i]);
    	return 0;
    }
    
    static int wiz_clk_xlate(struct clk *clk, struct ofnode_phandle_args *args)
    {
    	struct udevice *dev = clk->dev;
    	struct wiz_mux_clk *priv = dev_get_priv(dev);
    	struct wiz *wiz = priv->wiz;
    
    	clk->id = wiz->id;
    
    	return 0;
    }
    
    static const struct clk_ops wiz_clk_mux_ops = {
    	.set_parent = wiz_clk_mux_set_parent,
    	.of_xlate = wiz_clk_xlate,
    };
    
    int wiz_mux_clk_probe(struct udevice *dev)
    {
    	struct wiz_mux_clk *priv = dev_get_priv(dev);
    	int rc;
    	int i;
    
    	for (i = 0; i < ARRAY_SIZE(priv->parent_clks); i++) {
    		rc = clk_get_by_index(dev, i, &priv->parent_clks[i]);
    		if (rc)
    			priv->parent_clks[i].dev = NULL;
    	}
    	priv->wiz = dev_get_priv(dev->parent);
    	return 0;
    }
    
    U_BOOT_DRIVER(wiz_mux_clk) = {
    	.name		= "wiz_mux_clk",
    	.id		= UCLASS_CLK,
    	.priv_auto	= sizeof(struct wiz_mux_clk),
    	.ops		= &wiz_clk_mux_ops,
    	.probe		= wiz_mux_clk_probe,
    };
    
    static int wiz_clk_set_parent(struct clk *clk,  struct clk *parent)
    {
    	struct udevice *dev = clk->dev;
    	struct wiz_clk *priv = dev_get_priv(dev);
    	const struct wiz_clk_mux_sel *mux_sel;
    	struct wiz *wiz = priv->wiz;
    	int num_parents;
    	int i, j, id;
    
    	id = clk->id >> 10;
    
    	/* set_parent is applicable only for MUX clocks */
    	if (id > TI_WIZ_REFCLK_DIG)
    		return 0;
    
    	for (i = 0; i < WIZ_MAX_INPUT_CLOCKS; i++)
    		if (wiz->input_clks[i]->dev == parent->dev)
    			break;
    
    	if (i == WIZ_MAX_INPUT_CLOCKS)
    		return -EINVAL;
    
    	mux_sel = &wiz->clk_mux_sel[id];
    	num_parents = mux_sel->num_parents;
    	for (j = 0; j < num_parents; j++)
    		if (mux_sel->parents[j] == i)
    			break;
    
    	if (j == num_parents)
    		return -EINVAL;
    
    	regmap_field_write(wiz->mux_sel_field[id], mux_sel->table[j]);
    
    	return 0;
    }
    
    static int wiz_clk_of_xlate(struct clk *clk, struct ofnode_phandle_args *args)
    {
    	struct udevice *dev = clk->dev;
    	struct wiz_clk *priv = dev_get_priv(dev);
    	struct wiz *wiz = priv->wiz;
    
    	clk->id = args->args[0] << 10 | wiz->id;
    
    	return 0;
    }
    
    static const struct clk_ops wiz_clk_ops = {
    	.set_parent = wiz_clk_set_parent,
    	.of_xlate = wiz_clk_of_xlate,
    };
    
    int wiz_clk_probe(struct udevice *dev)
    {
    	struct wiz_clk *priv = dev_get_priv(dev);
    
    	priv->wiz = dev_get_priv(dev->parent);
    
    	return 0;
    }
    
    U_BOOT_DRIVER(wiz_clk) = {
    	.name		= "wiz_clk",
    	.id		= UCLASS_CLK,
    	.priv_auto	= sizeof(struct wiz_clk),
    	.ops		= &wiz_clk_ops,
    	.probe		= wiz_clk_probe,
    };
    
    static int wiz_reset_request(struct reset_ctl *reset_ctl)
    {
    	return 0;
    }
    
    static int wiz_reset_free(struct reset_ctl *reset_ctl)
    {
    	return 0;
    }
    
    static int wiz_reset_assert(struct reset_ctl *reset_ctl)
    {
    	struct wiz_reset *priv = dev_get_priv(reset_ctl->dev);
    	struct wiz *wiz = priv->wiz;
    	int ret;
    	int id = reset_ctl->id;
    
    	if (id == 0) {
    		ret = regmap_field_write(wiz->phy_reset_n, false);
    		return ret;
    	}
    
    	ret = regmap_field_write(wiz->p_enable[id - 1], P_ENABLE_DISABLE);
    	return ret;
    }
    
    static int wiz_phy_fullrt_div(struct wiz *wiz, int lane)
    {
    	switch (wiz->type) {
    	case AM64_WIZ_10G:
    		if (wiz->lane_phy_type[lane] == PHY_TYPE_PCIE)
    			return regmap_field_write(wiz->p0_fullrt_div[lane], 0x1);
    		else if (wiz->lane_phy_type[lane] == PHY_TYPE_SGMII)
    			return regmap_field_write(wiz->p0_fullrt_div[lane], 0x2);
    		break;
    	case J721E_WIZ_10G:
    	case J784S4_WIZ_10G:
    		if (wiz->lane_phy_type[lane] == PHY_TYPE_SGMII)
    			return regmap_field_write(wiz->p0_fullrt_div[lane], 0x2);
    		break;
    	default:
    		break;
    	}
    	return 0;
    }
    
    static int wiz_reset_deassert(struct reset_ctl *reset_ctl)
    {
    	struct wiz_reset *priv = dev_get_priv(reset_ctl->dev);
    	struct wiz *wiz = priv->wiz;
    	int ret;
    	int id = reset_ctl->id;
    
    	ret = wiz_phy_fullrt_div(wiz, id - 1);
    	if (ret)
    		return ret;
    
    	/* if typec-dir gpio was specified, set LN10 SWAP bit based on that */
    	if (id == 0) {
    		if (wiz->gpio_typec_dir) {
    			if (dm_gpio_get_value(wiz->gpio_typec_dir)) {
    				regmap_update_bits(wiz->regmap, WIZ_SERDES_TYPEC,
    						WIZ_SERDES_TYPEC_LN10_SWAP,
    						WIZ_SERDES_TYPEC_LN10_SWAP);
    			} else {
    				regmap_update_bits(wiz->regmap, WIZ_SERDES_TYPEC,
    						WIZ_SERDES_TYPEC_LN10_SWAP, 0);
    			}
    		}
    	} else {
    		/* if no typec-dir gpio was specified and PHY type is
    		 * USB3 with master lane number is '0', set LN10 SWAP
    		 * bit to '1'
    		 */
    		u32 num_lanes = wiz->num_lanes;
    		int i;
    
    		for (i = 0; i < num_lanes; i++) {
    			if (wiz->lane_phy_type[i] == PHY_TYPE_USB3) {
    				switch (wiz->master_lane_num[i]) {
    				case LANE0:
    					regmap_update_bits(wiz->regmap, WIZ_SERDES_TYPEC,
    							WIZ_SERDES_TYPEC_LN10_SWAP,
    							WIZ_SERDES_TYPEC_LN10_SWAP);
    					break;
    				case LANE2:
    					 regmap_update_bits(wiz->regmap, WIZ_SERDES_TYPEC,
    							WIZ_SERDES_TYPEC_LN23_SWAP,
    							WIZ_SERDES_TYPEC_LN23_SWAP);
    					break;
    				default:
    					break;
    				}
    			}
    		}
    	}
    
    	if (id == 0) {
    		ret = regmap_field_write(wiz->phy_reset_n, true);
    		return ret;
    	}
    
    	if (wiz->lane_phy_type[id - 1] == PHY_TYPE_DP)
    		ret = regmap_field_write(wiz->p_enable[id - 1], P_ENABLE);
    	else
    		ret = regmap_field_write(wiz->p_enable[id - 1], P_ENABLE_FORCE);
    
    	return ret;
    }
    
    static struct reset_ops wiz_reset_ops = {
    	.request = wiz_reset_request,
    	.rfree = wiz_reset_free,
    	.rst_assert = wiz_reset_assert,
    	.rst_deassert = wiz_reset_deassert,
    };
    
    int wiz_reset_probe(struct udevice *dev)
    {
    	struct wiz_reset *priv = dev_get_priv(dev);
    
    	priv->wiz = dev_get_priv(dev->parent);
    
    	return 0;
    }
    
    U_BOOT_DRIVER(wiz_reset) = {
    	.name = "wiz-reset",
    	.id = UCLASS_RESET,
    	.probe = wiz_reset_probe,
    	.ops = &wiz_reset_ops,
    	.flags = DM_FLAG_LEAVE_PD_ON,
    };
    
    static int wiz_reset(struct wiz *wiz)
    {
    	int ret;
    
    	ret = regmap_field_write(wiz->por_en, 0x1);
    	if (ret)
    		return ret;
    
    	mdelay(1);
    
    	ret = regmap_field_write(wiz->por_en, 0x0);
    	if (ret)
    		return ret;
    
    	return 0;
    }
    
    static int wiz_p_mac_div_sel(struct wiz *wiz)
    {
    	u32 num_lanes = wiz->num_lanes;
    	int ret;
    	int i;
    
    	for (i = 0; i < num_lanes; i++) {
    		if (wiz->lane_phy_type[i] == PHY_TYPE_SGMII ||
    		    wiz->lane_phy_type[i] == PHY_TYPE_QSGMII) {
    			ret = regmap_field_write(wiz->p_mac_div_sel0[i], 1);
    			if (ret)
    				return ret;
    
    			ret = regmap_field_write(wiz->p_mac_div_sel1[i], 2);
    			if (ret)
    				return ret;
    		}
    	}
    
    	return 0;
    }
    
    static int wiz_mode_select(struct wiz *wiz)
    {
    	u32 num_lanes = wiz->num_lanes;
    	int ret;
    	int i;
    
    	for (i = 0; i < num_lanes; i++) {
    		if (wiz->lane_phy_type[i] == PHY_TYPE_QSGMII) {
    			ret = regmap_field_write(wiz->p_standard_mode[i],
    						 LANE_MODE_GEN2);
    			if (ret)
    				return ret;
    		}
    	}
    
    	return 0;
    }
    
    static int wiz_init_raw_interface(struct wiz *wiz, bool enable)
    {
    	u32 num_lanes = wiz->num_lanes;
    	int i;
    	int ret;
    
    	for (i = 0; i < num_lanes; i++) {
    		ret = regmap_field_write(wiz->p_align[i], enable);
    		if (ret)
    			return ret;
    
    		ret = regmap_field_write(wiz->p_raw_auto_start[i], enable);
    		if (ret)
    			return ret;
    	}
    
    	return 0;
    }
    
    static int wiz_init(struct wiz *wiz)
    {
    	struct udevice *dev = wiz->dev;
    	int ret;
    
    	ret = wiz_reset(wiz);
    	if (ret) {
    		dev_err(dev, "WIZ reset failed\n");
    		return ret;
    	}
    
    	ret = wiz_mode_select(wiz);
    	if (ret) {
    		dev_err(dev, "WIZ mode select failed\n");
    		return ret;
    	}
    
    	ret = wiz_p_mac_div_sel(wiz);
    	if (ret) {
    		dev_err(dev, "Configuring P0 MAC DIV SEL failed\n");
    		return ret;
    	}
    
    	ret = wiz_init_raw_interface(wiz, true);
    	if (ret) {
    		dev_err(dev, "WIZ interface initialization failed\n");
    		return ret;
    	}
    
    	return 0;
    }
    
    static int wiz_regfield_init(struct wiz *wiz)
    {
    	struct regmap *regmap = wiz->regmap;
    	int num_lanes = wiz->num_lanes;
    	struct udevice *dev = wiz->dev;
    	const struct wiz_data *data = wiz->data;
    	int i;
    
    	wiz->por_en = devm_regmap_field_alloc(dev, regmap, por_en);
    	if (IS_ERR(wiz->por_en)) {
    		dev_err(dev, "POR_EN reg field init failed\n");
    		return PTR_ERR(wiz->por_en);
    	}
    
    	wiz->phy_reset_n = devm_regmap_field_alloc(dev, regmap,
    						   phy_reset_n);
    	if (IS_ERR(wiz->phy_reset_n)) {
    		dev_err(dev, "PHY_RESET_N reg field init failed\n");
    		return PTR_ERR(wiz->phy_reset_n);
    	}
    
    	wiz->pma_cmn_refclk_int_mode =
    		devm_regmap_field_alloc(dev, regmap, pma_cmn_refclk_int_mode);
    	if (IS_ERR(wiz->pma_cmn_refclk_int_mode)) {
    		dev_err(dev, "PMA_CMN_REFCLK_INT_MODE reg field init failed\n");
    		return PTR_ERR(wiz->pma_cmn_refclk_int_mode);
    	}
    
    	if (data->pma_cmn_refclk1_int_mode) {
    		wiz->pma_cmn_refclk1_int_mode =
    			devm_regmap_field_alloc(dev, regmap, *data->pma_cmn_refclk1_int_mode);
    		if (IS_ERR(wiz->pma_cmn_refclk1_int_mode)) {
    			dev_err(dev, "PMA_CMN_REFCLK1_INT_MODE reg field init failed\n");
    			return PTR_ERR(wiz->pma_cmn_refclk1_int_mode);
    		}
    	}
    
    	wiz->pma_cmn_refclk_mode =
    		devm_regmap_field_alloc(dev, regmap, pma_cmn_refclk_mode);
    	if (IS_ERR(wiz->pma_cmn_refclk_mode)) {
    		dev_err(dev, "PMA_CMN_REFCLK_MODE reg field init failed\n");
    		return PTR_ERR(wiz->pma_cmn_refclk_mode);
    	}
    
    	wiz->div_sel_field[CMN_REFCLK] =
    		devm_regmap_field_alloc(dev, regmap, pma_cmn_refclk_dig_div);
    	if (IS_ERR(wiz->div_sel_field[CMN_REFCLK])) {
    		dev_err(dev, "PMA_CMN_REFCLK_DIG_DIV reg field init failed\n");
    		return PTR_ERR(wiz->div_sel_field[CMN_REFCLK]);
    	}
    
    	if (data->pma_cmn_refclk1_dig_div) {
    		wiz->div_sel_field[CMN_REFCLK1] =
    			devm_regmap_field_alloc(dev, regmap, *data->pma_cmn_refclk1_dig_div);
    		if (IS_ERR(wiz->div_sel_field[CMN_REFCLK1])) {
    			dev_err(dev, "PMA_CMN_REFCLK1_DIG_DIV reg field init failed\n");
    			return PTR_ERR(wiz->div_sel_field[CMN_REFCLK1]);
    		}
    	}
    
    	wiz->mux_sel_field[PLL0_REFCLK] =
    		devm_regmap_field_alloc(dev, regmap, *data->pll0_refclk_mux_sel);
    	if (IS_ERR(wiz->mux_sel_field[PLL0_REFCLK])) {
    		dev_err(dev, "PLL0_REFCLK_SEL reg field init failed\n");
    		return PTR_ERR(wiz->mux_sel_field[PLL0_REFCLK]);
    	}
    
    	wiz->mux_sel_field[PLL1_REFCLK] =
    		devm_regmap_field_alloc(dev, regmap, *data->pll1_refclk_mux_sel);
    	if (IS_ERR(wiz->mux_sel_field[PLL1_REFCLK])) {
    		dev_err(dev, "PLL1_REFCLK_SEL reg field init failed\n");
    		return PTR_ERR(wiz->mux_sel_field[PLL1_REFCLK]);
    	}
    
    	wiz->mux_sel_field[REFCLK_DIG] =
    		devm_regmap_field_alloc(dev, regmap, *data->refclk_dig_sel);
    	if (IS_ERR(wiz->mux_sel_field[REFCLK_DIG])) {
    		dev_err(dev, "REFCLK_DIG_SEL reg field init failed\n");
    		return PTR_ERR(wiz->mux_sel_field[REFCLK_DIG]);
    	}
    
    	for (i = 0; i < num_lanes; i++) {
    		wiz->p_enable[i] = devm_regmap_field_alloc(dev, regmap,
    							   p_enable[i]);
    		if (IS_ERR(wiz->p_enable[i])) {
    			dev_err(dev, "P%d_ENABLE reg field init failed\n", i);
    			return PTR_ERR(wiz->p_enable[i]);
    		}
    
    		wiz->p_align[i] = devm_regmap_field_alloc(dev, regmap,
    							  p_align[i]);
    		if (IS_ERR(wiz->p_align[i])) {
    			dev_err(dev, "P%d_ALIGN reg field init failed\n", i);
    			return PTR_ERR(wiz->p_align[i]);
    		}
    
    		wiz->p_raw_auto_start[i] =
    		  devm_regmap_field_alloc(dev, regmap, p_raw_auto_start[i]);
    		if (IS_ERR(wiz->p_raw_auto_start[i])) {
    			dev_err(dev, "P%d_RAW_AUTO_START reg field init fail\n",
    				i);
    			return PTR_ERR(wiz->p_raw_auto_start[i]);
    		}
    
    		wiz->p_standard_mode[i] =
    		  devm_regmap_field_alloc(dev, regmap, p_standard_mode[i]);
    		if (IS_ERR(wiz->p_standard_mode[i])) {
    			dev_err(dev, "P%d_STANDARD_MODE reg field init fail\n",
    				i);
    			return PTR_ERR(wiz->p_standard_mode[i]);
    		}
    
    		wiz->p0_fullrt_div[i] = devm_regmap_field_alloc(dev, regmap, p0_fullrt_div[i]);
    		if (IS_ERR(wiz->p0_fullrt_div[i])) {
    			dev_err(dev, "P%d_FULLRT_DIV reg field init failed\n", i);
    			return PTR_ERR(wiz->p0_fullrt_div[i]);
    		}
    
    		wiz->p_mac_div_sel0[i] =
    		  devm_regmap_field_alloc(dev, regmap, p_mac_div_sel0[i]);
    		if (IS_ERR(wiz->p_mac_div_sel0[i])) {
    			dev_err(dev, "P%d_MAC_DIV_SEL0 reg field init fail\n",
    				i);
    			return PTR_ERR(wiz->p_mac_div_sel0[i]);
    		}
    
    		wiz->p_mac_div_sel1[i] =
    		  devm_regmap_field_alloc(dev, regmap, p_mac_div_sel1[i]);
    		if (IS_ERR(wiz->p_mac_div_sel1[i])) {
    			dev_err(dev, "P%d_MAC_DIV_SEL1 reg field init fail\n",
    				i);
    			return PTR_ERR(wiz->p_mac_div_sel1[i]);
    		}
    	}
    
    	return 0;
    }
    
    static int wiz_clock_init(struct wiz *wiz)
    {
    	struct udevice *dev = wiz->dev;
    	unsigned long rate;
    	struct clk *clk;
    	int ret;
    
    	clk = devm_clk_get(dev, "core_ref_clk");
    	if (IS_ERR(clk)) {
    		dev_err(dev, "core_ref_clk clock not found\n");
    		ret = PTR_ERR(clk);
    		return ret;
    	}
    	wiz->input_clks[WIZ_CORE_REFCLK] = clk;
    
    	rate = clk_get_rate(clk);
    	if (rate >= 100000000)
    		regmap_field_write(wiz->pma_cmn_refclk_int_mode, 0x1);
    	else
    		regmap_field_write(wiz->pma_cmn_refclk_int_mode, 0x3);
    
    	if (wiz->data->pma_cmn_refclk1_int_mode) {
    		clk = devm_clk_get(dev, "core_ref1_clk");
    		if (IS_ERR(clk)) {
    			dev_err(dev, "core_ref1_clk clock not found\n");
    			ret = PTR_ERR(clk);
    			return ret;
    		}
    		wiz->input_clks[WIZ_CORE_REFCLK1] = clk;
    
    		rate = clk_get_rate(clk);
    		if (rate >= 100000000)
    			regmap_field_write(wiz->pma_cmn_refclk1_int_mode, 0x1);
    		else
    			regmap_field_write(wiz->pma_cmn_refclk1_int_mode, 0x3);
    	} else {
    		/* Initialize CORE_REFCLK1 to the same clock reference to maintain old DT compatibility */
    		wiz->input_clks[WIZ_CORE_REFCLK1] = clk;
    	}
    
    	clk = devm_clk_get(dev, "ext_ref_clk");
    	if (IS_ERR(clk)) {
    		dev_err(dev, "ext_ref_clk clock not found\n");
    		ret = PTR_ERR(clk);
    		return ret;
    	}
    
    	wiz->input_clks[WIZ_EXT_REFCLK] = clk;
    	/* Initialize EXT_REFCLK1 to the same clock reference to maintain old DT compatibility */
    	wiz->input_clks[WIZ_EXT_REFCLK1] = clk;
    
    	rate = clk_get_rate(clk);
    	if (rate >= 100000000)
    		regmap_field_write(wiz->pma_cmn_refclk_mode, 0x0);
    	else
    		regmap_field_write(wiz->pma_cmn_refclk_mode, 0x2);
    
    	return 0;
    }
    
    static ofnode get_child_by_name(struct udevice *dev, const char *name)
    {
    	int l = strlen(name);
    	ofnode node = dev_read_first_subnode(dev);
    
    	while (ofnode_valid(node)) {
    		const char *child_name = ofnode_get_name(node);
    
    		if (!strncmp(child_name, name, l)) {
    			if (child_name[l] == '\0' || child_name[l] == '@')
    				return node;
    		}
    		node = dev_read_next_subnode(node);
    	}
    	return node;
    }
    
    static int j721e_wiz_bind_clocks(struct wiz *wiz)
    {
    	struct udevice *dev = wiz->dev;
    	struct driver *wiz_clk_drv;
    	int i, rc;
    
    	wiz_clk_drv = lists_driver_lookup_name("wiz_clk");
    	if (!wiz_clk_drv) {
    		dev_err(dev, "Cannot find driver 'wiz_clk'\n");
    		return -ENOENT;
    	}
    
    	for (i = 0; i < WIZ_DIV_NUM_CLOCKS_10G; i++) {
    		rc = device_bind(dev, wiz_clk_drv, clk_div_sel[i].node_name,
    				 &clk_div_sel[i], dev_ofnode(dev), NULL);
    		if (rc) {
    			dev_err(dev, "cannot bind driver for clock %s\n",
    				clk_div_sel[i].node_name);
    		}
    	}
    
    	for (i = 0; i < WIZ_MUX_NUM_CLOCKS; i++) {
    		rc = device_bind(dev, wiz_clk_drv, clk_mux_sel_10g[i].node_name,
    				 &clk_mux_sel_10g[i], dev_ofnode(dev), NULL);
    		if (rc) {
    			dev_err(dev, "cannot bind driver for clock %s\n",
    				clk_mux_sel_10g[i].node_name);
    		}
    	}
    
    	return 0;
    }
    
    static int j721e_wiz_bind_of_clocks(struct wiz *wiz)
    {
    	struct wiz_clk_mux_sel *clk_mux_sel = wiz->clk_mux_sel;
    	struct udevice *dev = wiz->dev;
    	enum wiz_type type = wiz->type;
    	struct driver *div_clk_drv;
    	struct driver *mux_clk_drv;
    	ofnode node;
    	int i, rc;
    
    	if (type == AM64_WIZ_10G || type == J721E_WIZ_10G)
     		return j721e_wiz_bind_clocks(wiz);
    
    	div_clk_drv = lists_driver_lookup_name("wiz_div_clk");
    	if (!div_clk_drv) {
    		dev_err(dev, "Cannot find driver 'wiz_div_clk'\n");
    		return -ENOENT;
    	}
    
    	mux_clk_drv = lists_driver_lookup_name("wiz_mux_clk");
    	if (!mux_clk_drv) {
    		dev_err(dev, "Cannot find driver 'wiz_mux_clk'\n");
    		return -ENOENT;
    	}
    
    	for (i = 0; i < wiz->clk_div_sel_num; i++) {
    		node = get_child_by_name(dev, clk_div_sel[i].node_name);
    		if (!ofnode_valid(node)) {
    			dev_err(dev, "cannot find node for clock %s\n",
    				clk_div_sel[i].node_name);
    			continue;
    		}
    		rc = device_bind(dev, div_clk_drv, clk_div_sel[i].node_name,
    				 &clk_div_sel[i], node, NULL);
    		if (rc) {
    			dev_err(dev, "cannot bind driver for clock %s\n",
    				clk_div_sel[i].node_name);
    		}
    	}
    
    	for (i = 0; i < WIZ_MUX_NUM_CLOCKS; i++) {
    		node = get_child_by_name(dev, clk_mux_sel[i].node_name);
    		if (!ofnode_valid(node)) {
    			dev_err(dev, "cannot find node for clock %s\n",
    				clk_mux_sel[i].node_name);
    			continue;
    		}
    		rc = device_bind(dev, mux_clk_drv, clk_mux_sel[i].node_name,
    				 &clk_mux_sel[i], node, NULL);
    		if (rc) {
    			dev_err(dev, "cannot bind driver for clock %s\n",
    				clk_mux_sel[i].node_name);
    		}
    	}
    
    	return 0;
    }
    
    static int j721e_wiz_bind_reset(struct udevice *dev)
    {
    	int rc;
    	struct driver *drv;
    
    	drv = lists_driver_lookup_name("wiz-reset");
    	if (!drv) {
    		dev_err(dev, "Cannot find driver 'wiz-reset'\n");
    		return -ENOENT;
    	}
    
    	rc = device_bind(dev, drv, "wiz-reset", NULL, dev_ofnode(dev), NULL);
    	if (rc) {
    		dev_err(dev, "cannot bind driver for wiz-reset\n");
    		return rc;
    	}
    
    	return 0;
    }
    
    static int j721e_wiz_bind(struct udevice *dev)
    {
    	dm_scan_fdt_dev(dev);
    
    	return 0;
    }
    
    static int wiz_get_lane_phy_types(struct udevice *dev, struct wiz *wiz)
    {
    	ofnode child, serdes;
    
    	serdes = get_child_by_name(dev, "serdes");
    	if (!ofnode_valid(serdes)) {
    		dev_err(dev, "%s: Getting \"serdes\"-node failed\n", __func__);
    		return -EINVAL;
    	}
    
    	ofnode_for_each_subnode(child, serdes) {
    		u32 reg, num_lanes = 1, phy_type = PHY_NONE;
    		int ret, i;
    
    		ret = ofnode_read_u32(child, "reg", &reg);
    		if (ret) {
    			dev_err(dev, "%s: Reading \"reg\" from failed: %d\n",
    				__func__, ret);
    			return ret;
    		}
    		ofnode_read_u32(child, "cdns,num-lanes", &num_lanes);
    		ofnode_read_u32(child, "cdns,phy-type", &phy_type);
    
    		dev_dbg(dev, "%s: Lanes %u-%u have phy-type %u\n", __func__,
    			reg, reg + num_lanes - 1, phy_type);
    
    		for (i = reg; i < reg + num_lanes; i++) {
    			wiz->lane_phy_type[i] = phy_type;
    			wiz->master_lane_num[i] = reg;
    		}
    	}
    
    	return 0;
    }
    
    static int j721e_wiz_probe(struct udevice *dev)
    {
    	struct wiz *wiz = dev_get_priv(dev);
    	struct ofnode_phandle_args args;
    	unsigned int val;
    	int rc, i;
    	ofnode node;
    	struct regmap *regmap;
    	u32 num_lanes;
    
    	node = get_child_by_name(dev, "serdes");
    
    	if (!ofnode_valid(node)) {
    		dev_err(dev, "Failed to get SERDES child DT node\n");
    		return -ENODEV;
    	}
    
    	rc = regmap_init_mem(node, &regmap);
    	if (rc)  {
    		dev_err(dev, "Failed to get memory resource\n");
    		return rc;
    	}
    	rc = dev_read_u32(dev, "num-lanes", &num_lanes);
    	if (rc) {
    		dev_err(dev, "Failed to read num-lanes property\n");
    		goto err_addr_to_resource;
    	}
    
    	if (num_lanes > WIZ_MAX_LANES) {
    		dev_err(dev, "Cannot support %d lanes\n", num_lanes);
    		goto err_addr_to_resource;
    	}
    
    	wiz->gpio_typec_dir = devm_gpiod_get_optional(dev, "typec-dir",
    						      GPIOD_IS_IN);
    	if (IS_ERR(wiz->gpio_typec_dir)) {
    		rc = PTR_ERR(wiz->gpio_typec_dir);
    		dev_err(dev, "Failed to request typec-dir gpio: %d\n", rc);
    		goto err_addr_to_resource;
    	}
    
    	rc = dev_read_phandle_with_args(dev, "power-domains", "#power-domain-cells", 0, 0, &args);
    	if (rc) {
    		dev_err(dev, "Failed to get power domain: %d\n", rc);
    		goto err_addr_to_resource;
    	}
    
    	wiz->id = args.args[0];
    	wiz->regmap = regmap;
    	wiz->num_lanes = num_lanes;
    	wiz->dev = dev;
    	wiz->clk_div_sel = clk_div_sel;
    
    	wiz->data = (struct wiz_data *)dev_get_driver_data(dev);
    	wiz->type = wiz->data->type;
    
    	wiz->clk_mux_sel = (struct wiz_clk_mux_sel *)wiz->data->clk_mux_sel;
    	wiz->clk_div_sel_num = wiz->data->clk_div_sel_num;
    
    	rc = wiz_get_lane_phy_types(dev, wiz);
    	if (rc) {
    		dev_err(dev, "Failed to get lane PHY types\n");
    		goto err_addr_to_resource;
    	}
    
    	rc = wiz_regfield_init(wiz);
    	if (rc) {
    		dev_err(dev, "Failed to initialize regfields\n");
    		goto err_addr_to_resource;
    	}
    
    	for (i = 0; i < wiz->num_lanes; i++) {
    		regmap_field_read(wiz->p_enable[i], &val);
    		if (val & (P_ENABLE | P_ENABLE_FORCE)) {
    			dev_err(dev, "SERDES already configured\n");
    			rc = -EBUSY;
    			goto err_addr_to_resource;
    		}
    	}
    
    	rc = j721e_wiz_bind_of_clocks(wiz);
    	if (rc) {
    		dev_err(dev, "Failed to bind clocks\n");
    		goto err_addr_to_resource;
    	}
    
    	rc = j721e_wiz_bind_reset(dev);
    	if (rc) {
    		dev_err(dev, "Failed to bind reset\n");
    		goto err_addr_to_resource;
    	}
    
    	rc = wiz_clock_init(wiz);
    	if (rc) {
    		dev_warn(dev, "Failed to initialize clocks\n");
    		goto err_addr_to_resource;
    	}
    
    	rc = wiz_init(wiz);
    	if (rc) {
    		dev_err(dev, "WIZ initialization failed\n");
    		goto err_addr_to_resource;
    	}
    
    	return 0;
    
    err_addr_to_resource:
    	free(regmap);
    
    	return rc;
    }
    
    static int j721e_wiz_remove(struct udevice *dev)
    {
    	struct wiz *wiz = dev_get_priv(dev);
    
    	if (wiz->regmap)
    		free(wiz->regmap);
    
    	return 0;
    }
    
    static const struct udevice_id j721e_wiz_ids[] = {
    	{
    		.compatible = "ti,j721e-wiz-16g", .data = (ulong)&j721e_16g_data,
    	},
    	{
    		.compatible = "ti,j721e-wiz-10g", .data = (ulong)&j721e_10g_data,
    	},
    	{
    		.compatible = "ti,am64-wiz-10g", .data = (ulong)&am64_10g_data,
    	},
    	{
    		.compatible = "ti,j784s4-wiz-10g", .data = (ulong)&j784s4_wiz_10g,
    	},
    	{
    		.compatible = "ti,j721s2-wiz-10g", .data = (ulong)&j721s2_10g_data,
    	},
    	{}
    };
    
    U_BOOT_DRIVER(phy_j721e_wiz) = {
    	.name		= "phy-j721e-wiz",
    	.id		= UCLASS_NOP,
    	.of_match	= j721e_wiz_ids,
    	.bind		= j721e_wiz_bind,
    	.probe		= j721e_wiz_probe,
    	.remove		= j721e_wiz_remove,
    	.priv_auto	= sizeof(struct wiz),
    	.flags		= DM_FLAG_LEAVE_PD_ON,
    };

    am65-cpsw-nuss.c looks the following:

    // SPDX-License-Identifier: GPL-2.0+
    /*
     * Texas Instruments K3 AM65 Ethernet Switch SubSystem Driver
     *
     * Copyright (C) 2019, Texas Instruments, Incorporated
     *
     */
    
    #include <common.h>
    #include <malloc.h>
    #include <asm/cache.h>
    #include <asm/io.h>
    #include <asm/processor.h>
    #include <asm/gpio.h>
    #include <clk.h>
    #include <dm.h>
    #include <dm/device_compat.h>
    #include <dm/lists.h>
    #include <dm/pinctrl.h>
    #include <dma-uclass.h>
    #include <dm/of_access.h>
    #include <miiphy.h>
    #include <net.h>
    #include <phy.h>
    #include <power-domain.h>
    #include <regmap.h>
    #include <soc.h>
    #include <syscon.h>
    #include <linux/bitops.h>
    #include <linux/delay.h>
    #include <linux/soc/ti/ti-udma.h>
    
    #include "cpsw_mdio.h"
    
    #define AM65_CPSW_CPSWNU_MAX_PORTS 9
    
    #define DEFAULT_GPIO_RESET_DELAY		10
    
    #define AM65_CPSW_SS_BASE		0x0
    #define AM65_CPSW_SGMII_BASE	0x100
    #define AM65_CPSW_MDIO_BASE	0xf00
    #define AM65_CPSW_XGMII_BASE	0x2100
    #define AM65_CPSW_CPSW_NU_BASE	0x20000
    #define AM65_CPSW_CPSW_NU_ALE_BASE 0x1e000
    
    #define AM65_CPSW_CPSW_NU_PORTS_OFFSET	0x1000
    #define AM65_CPSW_CPSW_NU_PORT_MACSL_OFFSET	0x330
    
    #define AM65_CPSW_MDIO_BUS_FREQ_DEF 1000000
    
    #define AM65_CPSW_CTL_REG		0x4
    #define AM65_CPSW_SGMII_CONTROL_REG	0x10
    #define AM65_CPSW_STAT_PORT_EN_REG	0x14
    #define AM65_CPSW_PTYPE_REG		0x18
    
    #define AM65_CPSW_CTL_REG_P0_ENABLE			BIT(2)
    #define AM65_CPSW_CTL_REG_P0_TX_CRC_REMOVE		BIT(13)
    #define AM65_CPSW_CTL_REG_P0_RX_PAD			BIT(14)
    
    #define AM65_CPSW_SGMII_CONTROL_MR_AN_ENABLE	BIT(0)
    
    #define AM65_CPSW_P0_FLOW_ID_REG			0x8
    #define AM65_CPSW_PN_RX_MAXLEN_REG		0x24
    #define AM65_CPSW_PN_REG_SA_L			0x308
    #define AM65_CPSW_PN_REG_SA_H			0x30c
    
    #define AM65_CPSW_ALE_CTL_REG			0x8
    #define AM65_CPSW_ALE_CTL_REG_ENABLE		BIT(31)
    #define AM65_CPSW_ALE_CTL_REG_RESET_TBL		BIT(30)
    #define AM65_CPSW_ALE_CTL_REG_BYPASS		BIT(4)
    #define AM65_CPSW_ALE_PN_CTL_REG(x)		(0x40 + (x) * 4)
    #define AM65_CPSW_ALE_PN_CTL_REG_MODE_FORWARD	0x3
    #define AM65_CPSW_ALE_PN_CTL_REG_MAC_ONLY	BIT(11)
    
    #define AM65_CPSW_ALE_THREADMAPDEF_REG		0x134
    #define AM65_CPSW_ALE_DEFTHREAD_EN		BIT(15)
    
    #define AM65_CPSW_MACSL_CTL_REG			0x0
    #define AM65_CPSW_MACSL_CTL_REG_IFCTL_A		BIT(15)
    #define AM65_CPSW_MACSL_CTL_EXT_EN		BIT(18)
    #define AM65_CPSW_MACSL_CTL_REG_GIG		BIT(7)
    #define AM65_CPSW_MACSL_CTL_REG_GMII_EN		BIT(5)
    #define AM65_CPSW_MACSL_CTL_REG_LOOPBACK	BIT(1)
    #define AM65_CPSW_MACSL_CTL_REG_FULL_DUPLEX	BIT(0)
    #define AM65_CPSW_MACSL_RESET_REG		0x8
    #define AM65_CPSW_MACSL_RESET_REG_RESET		BIT(0)
    #define AM65_CPSW_MACSL_STATUS_REG		0x4
    #define AM65_CPSW_MACSL_RESET_REG_PN_IDLE	BIT(31)
    #define AM65_CPSW_MACSL_RESET_REG_PN_E_IDLE	BIT(30)
    #define AM65_CPSW_MACSL_RESET_REG_PN_P_IDLE	BIT(29)
    #define AM65_CPSW_MACSL_RESET_REG_PN_TX_IDLE	BIT(28)
    #define AM65_CPSW_MACSL_RESET_REG_IDLE_MASK \
    	(AM65_CPSW_MACSL_RESET_REG_PN_IDLE | \
    	 AM65_CPSW_MACSL_RESET_REG_PN_E_IDLE | \
    	 AM65_CPSW_MACSL_RESET_REG_PN_P_IDLE | \
    	 AM65_CPSW_MACSL_RESET_REG_PN_TX_IDLE)
    
    #define AM65_CPSW_CPPI_PKT_TYPE			0x7
    
    struct am65_cpsw_port {
    	fdt_addr_t	port_base;
    	fdt_addr_t	sgmii_base;
    	fdt_addr_t	macsl_base;
    	bool		disabled;
    	u32		mac_control;
    };
    
    struct am65_cpsw_common {
    	struct udevice		*dev;
    	fdt_addr_t		ss_base;
    	fdt_addr_t		cpsw_base;
    	fdt_addr_t		mdio_base;
    	fdt_addr_t		ale_base;
    
    	struct clk		fclk;
    	struct power_domain	pwrdmn;
    
    	u32			port_num;
    	struct am65_cpsw_port	ports[AM65_CPSW_CPSWNU_MAX_PORTS];
    	u32			qsgmii_main_ports;
    	struct mii_dev		*bus;
    	u32			bus_freq;
    	struct gpio_desc	mdio_gpio_reset;
    	u32			reset_delay_us;
    	u32			reset_post_delay_us;
    
    	struct dma		dma_tx;
    	struct dma		dma_rx;
    	u32			rx_next;
    	u32			rx_pend;
    	bool			started;
    };
    
    struct am65_cpsw_priv {
    	struct udevice		*dev;
    	struct am65_cpsw_common	*cpsw_common;
    	u32			port_id;
    
    	struct phy_device	*phydev;
    	bool			has_phy;
    	ofnode			phy_node;
    	u32			phy_addr;
    
    	bool			mdio_manual_mode;
    };
    
    #ifdef PKTSIZE_ALIGN
    #define UDMA_RX_BUF_SIZE PKTSIZE_ALIGN
    #else
    #define UDMA_RX_BUF_SIZE ALIGN(1522, ARCH_DMA_MINALIGN)
    #endif
    
    #ifdef PKTBUFSRX
    #define UDMA_RX_DESC_NUM PKTBUFSRX
    #else
    #define UDMA_RX_DESC_NUM 4
    #endif
    
    #define mac_hi(mac)	(((mac)[0] << 0) | ((mac)[1] << 8) |    \
    			 ((mac)[2] << 16) | ((mac)[3] << 24))
    #define mac_lo(mac)	(((mac)[4] << 0) | ((mac)[5] << 8))
    
    static void am65_cpsw_set_sl_mac(struct am65_cpsw_port *slave,
    				 unsigned char *addr)
    {
    	writel(mac_hi(addr),
    	       slave->port_base + AM65_CPSW_PN_REG_SA_H);
    	writel(mac_lo(addr),
    	       slave->port_base + AM65_CPSW_PN_REG_SA_L);
    }
    
    int am65_cpsw_macsl_reset(struct am65_cpsw_port *slave)
    {
    	u32 i = 100;
    
    	/* Set the soft reset bit */
    	writel(AM65_CPSW_MACSL_RESET_REG_RESET,
    	       slave->macsl_base + AM65_CPSW_MACSL_RESET_REG);
    
    	while ((readl(slave->macsl_base + AM65_CPSW_MACSL_RESET_REG) &
    		AM65_CPSW_MACSL_RESET_REG_RESET) && i--)
    		cpu_relax();
    
    	/* Timeout on the reset */
    	return i;
    }
    
    static int am65_cpsw_macsl_wait_for_idle(struct am65_cpsw_port *slave)
    {
    	u32 i = 100;
    
    	while ((readl(slave->macsl_base + AM65_CPSW_MACSL_STATUS_REG) &
    		AM65_CPSW_MACSL_RESET_REG_IDLE_MASK) && i--)
    		cpu_relax();
    
    	return i;
    }
    
    static int am65_cpsw_update_link(struct am65_cpsw_priv *priv)
    {
    	struct am65_cpsw_common	*common = priv->cpsw_common;
    	struct am65_cpsw_port *port = &common->ports[priv->port_id];
    	struct phy_device *phy = priv->phydev;
    	u32 mac_control = 0;
    
    	if (phy->link) { /* link up */
    		mac_control = /*AM65_CPSW_MACSL_CTL_REG_LOOPBACK |*/
    			      AM65_CPSW_MACSL_CTL_REG_GMII_EN;
    		if (phy->speed == 1000)
    			mac_control |= AM65_CPSW_MACSL_CTL_REG_GIG;
    		if (phy->speed == 10 && phy_interface_is_rgmii(phy))
    			/* Can be used with in band mode only */
    			mac_control |= AM65_CPSW_MACSL_CTL_EXT_EN;
    		if (phy->duplex == DUPLEX_FULL)
    			mac_control |= AM65_CPSW_MACSL_CTL_REG_FULL_DUPLEX;
    		if (phy->speed == 100)
    			mac_control |= AM65_CPSW_MACSL_CTL_REG_IFCTL_A;
    	}
    
    	if (mac_control == port->mac_control)
    		goto out;
    
    	if (mac_control) {
    		printf("link up on port %d, speed %d, %s duplex\n",
    		       priv->port_id, phy->speed,
    		       (phy->duplex == DUPLEX_FULL) ? "full" : "half");
    	} else {
    		printf("link down on port %d\n", priv->port_id);
    	}
    
    	writel(mac_control, port->macsl_base + AM65_CPSW_MACSL_CTL_REG);
    	port->mac_control = mac_control;
    
    out:
    	return phy->link;
    }
    
    #define AM65_GMII_SEL_PORT_OFFS(x)	(0x4 * ((x) - 1))
    
    #define AM65_GMII_SEL_MODE_MII		0
    #define AM65_GMII_SEL_MODE_RMII		1
    #define AM65_GMII_SEL_MODE_RGMII	2
    #define AM65_GMII_SEL_MODE_SGMII	3
    #define AM65_GMII_SEL_MODE_QSGMII	4
    #define AM65_GMII_SEL_MODE_QSGMII_SUB	6
    
    #define AM65_GMII_SEL_RGMII_IDMODE	BIT(4)
    
    static int am65_cpsw_gmii_sel_k3(struct am65_cpsw_priv *priv,
    				 phy_interface_t phy_mode)
    {
    	struct udevice *dev = priv->dev;
    	u32 offset, reg, phandle;
    	bool rgmii_id = false;
    	fdt_addr_t gmii_sel;
    	u32 mode = 0;
    	ofnode node;
    	int ret;
    
    	ret = ofnode_read_u32(dev_ofnode(dev), "phys", &phandle);
    	if (ret)
    		return ret;
    
    	ret = ofnode_read_u32_index(dev_ofnode(dev), "phys", 1, &offset);
    	if (ret)
    		return ret;
    
    	node = ofnode_get_by_phandle(phandle);
    	if (!ofnode_valid(node))
    		return -ENODEV;
    
    	gmii_sel = ofnode_get_addr(node);
    	if (gmii_sel == FDT_ADDR_T_NONE)
    		return -ENODEV;
    
    	gmii_sel += AM65_GMII_SEL_PORT_OFFS(offset);
    	reg = readl(gmii_sel);
    
    	dev_dbg(dev, "old gmii_sel: %08x\n", reg);
    
    	switch (phy_mode) {
    	case PHY_INTERFACE_MODE_RMII:
    		mode = AM65_GMII_SEL_MODE_RMII;
    		break;
    
    	case PHY_INTERFACE_MODE_RGMII:
    	case PHY_INTERFACE_MODE_RGMII_RXID:
    		mode = AM65_GMII_SEL_MODE_RGMII;
    		break;
    
    	case PHY_INTERFACE_MODE_RGMII_ID:
    	case PHY_INTERFACE_MODE_RGMII_TXID:
    		mode = AM65_GMII_SEL_MODE_RGMII;
    		rgmii_id = true;
    		break;
    		
    	case PHY_INTERFACE_MODE_SGMII:
    		mode = AM65_GMII_SEL_MODE_SGMII;
    		break;
    
    	default:
    		dev_warn(dev,
    			 "Unsupported PHY mode: %u. Defaulting to MII.\n",
    			 phy_mode);
    		/* fallthrough */
    	case PHY_INTERFACE_MODE_MII:
    		mode = AM65_GMII_SEL_MODE_MII;
    		break;
    	};
    
    	if (rgmii_id)
    		mode |= AM65_GMII_SEL_RGMII_IDMODE;
    
    	reg = mode;
    	dev_dbg(dev, "gmii_sel PHY mode: %u, new gmii_sel: %08x\n",
    		phy_mode, reg);
    	writel(reg, gmii_sel);
    
    	reg = readl(gmii_sel);
    	if (reg != mode) {
    		dev_err(dev,
    			"gmii_sel PHY mode NOT SET!: requested: %08x, gmii_sel: %08x\n",
    			mode, reg);
    		return 0;
    	}
    
    	return 0;
    }
    
    static int am65_cpsw_start(struct udevice *dev)
    {
    	struct eth_pdata *pdata = dev_get_plat(dev);
    	struct am65_cpsw_priv *priv = dev_get_priv(dev);
    	struct am65_cpsw_common	*common = priv->cpsw_common;
    	struct am65_cpsw_port *port = &common->ports[priv->port_id];
    	struct am65_cpsw_port *port0 = &common->ports[0];
    	struct ti_udma_drv_chan_cfg_data *dma_rx_cfg_data;
    	int ret, i;
    
    	ret = power_domain_on(&common->pwrdmn);
    	if (ret) {
    		dev_err(dev, "power_domain_on() failed %d\n", ret);
    		goto out;
    	}
    
    	ret = clk_enable(&common->fclk);
    	if (ret) {
    		dev_err(dev, "clk enabled failed %d\n", ret);
    		goto err_off_pwrdm;
    	}
    
    	common->rx_next = 0;
    	common->rx_pend = 0;
    	ret = dma_get_by_name(common->dev, "tx0", &common->dma_tx);
    	if (ret) {
    		dev_err(dev, "TX dma get failed %d\n", ret);
    		goto err_off_clk;
    	}
    	ret = dma_get_by_name(common->dev, "rx", &common->dma_rx);
    	if (ret) {
    		dev_err(dev, "RX dma get failed %d\n", ret);
    		goto err_free_tx;
    	}
    
    	for (i = 0; i < UDMA_RX_DESC_NUM; i++) {
    		ret = dma_prepare_rcv_buf(&common->dma_rx,
    					  net_rx_packets[i],
    					  UDMA_RX_BUF_SIZE);
    		if (ret) {
    			dev_err(dev, "RX dma add buf failed %d\n", ret);
    			goto err_free_tx;
    		}
    	}
    
    	ret = dma_enable(&common->dma_tx);
    	if (ret) {
    		dev_err(dev, "TX dma_enable failed %d\n", ret);
    		goto err_free_rx;
    	}
    	ret = dma_enable(&common->dma_rx);
    	if (ret) {
    		dev_err(dev, "RX dma_enable failed %d\n", ret);
    		goto err_dis_tx;
    	}
    
    	/* Control register */
    	writel(AM65_CPSW_CTL_REG_P0_ENABLE |
    	       AM65_CPSW_CTL_REG_P0_TX_CRC_REMOVE |
    	       AM65_CPSW_CTL_REG_P0_RX_PAD,
    	       common->cpsw_base + AM65_CPSW_CTL_REG);
    
    	/* disable priority elevation */
    	writel(0, common->cpsw_base + AM65_CPSW_PTYPE_REG);
    
    	/* enable statistics */
    	writel(BIT(0) | BIT(priv->port_id),
    	       common->cpsw_base + AM65_CPSW_STAT_PORT_EN_REG);
    
    	/* Port 0  length register */
    	writel(PKTSIZE_ALIGN, port0->port_base + AM65_CPSW_PN_RX_MAXLEN_REG);
    
    	/* set base flow_id */
    	dma_get_cfg(&common->dma_rx, 0, (void **)&dma_rx_cfg_data);
    	writel(dma_rx_cfg_data->flow_id_base,
    	       port0->port_base + AM65_CPSW_P0_FLOW_ID_REG);
    	dev_info(dev, "K3 CPSW: rflow_id_base: %u\n",
    		 dma_rx_cfg_data->flow_id_base);
    		 
    	if (pdata->phy_interface == PHY_INTERFACE_MODE_SGMII ||
    	    pdata->phy_interface == PHY_INTERFACE_MODE_QSGMII)
    		writel(AM65_CPSW_SGMII_CONTROL_MR_AN_ENABLE,
    		       port->sgmii_base + AM65_CPSW_SGMII_CONTROL_REG);
    
    	/* Reset and enable the ALE */
    	writel(AM65_CPSW_ALE_CTL_REG_ENABLE | AM65_CPSW_ALE_CTL_REG_RESET_TBL |
    	       AM65_CPSW_ALE_CTL_REG_BYPASS,
    	       common->ale_base + AM65_CPSW_ALE_CTL_REG);
    
    	/* port 0 put into forward mode */
    	writel(AM65_CPSW_ALE_PN_CTL_REG_MODE_FORWARD,
    	       common->ale_base + AM65_CPSW_ALE_PN_CTL_REG(0));
    
    	writel(AM65_CPSW_ALE_DEFTHREAD_EN,
    	       common->ale_base + AM65_CPSW_ALE_THREADMAPDEF_REG);
    
    	/* PORT x configuration */
    
    	/* Port x Max length register */
    	writel(PKTSIZE_ALIGN, port->port_base + AM65_CPSW_PN_RX_MAXLEN_REG);
    
    	/* Port x set mac */
    	am65_cpsw_set_sl_mac(port, pdata->enetaddr);
    
    	/* Port x ALE: mac_only, Forwarding */
    	writel(AM65_CPSW_ALE_PN_CTL_REG_MAC_ONLY |
    	       AM65_CPSW_ALE_PN_CTL_REG_MODE_FORWARD,
    	       common->ale_base + AM65_CPSW_ALE_PN_CTL_REG(priv->port_id));
    
    	port->mac_control = 0;
    	if (!am65_cpsw_macsl_reset(port)) {
    		dev_err(dev, "mac_sl reset failed\n");
    		ret = -EFAULT;
    		goto err_dis_rx;
    	}
    
    	ret = phy_startup(priv->phydev);
    	if (ret) {
    		dev_err(dev, "phy_startup failed\n");
    		goto err_dis_rx;
    	}
    
    	ret = am65_cpsw_update_link(priv);
    	if (!ret) {
    		ret = -ENODEV;
    		goto err_phy_shutdown;
    	}
    
    	common->started = true;
    
    	return 0;
    
    err_phy_shutdown:
    	phy_shutdown(priv->phydev);
    err_dis_rx:
    	/* disable ports */
    	writel(0, common->ale_base + AM65_CPSW_ALE_PN_CTL_REG(priv->port_id));
    	writel(0, common->ale_base + AM65_CPSW_ALE_PN_CTL_REG(0));
    	if (!am65_cpsw_macsl_wait_for_idle(port))
    		dev_err(dev, "mac_sl idle timeout\n");
    	writel(0, port->macsl_base + AM65_CPSW_MACSL_CTL_REG);
    	writel(0, common->ale_base + AM65_CPSW_ALE_CTL_REG);
    	writel(0, common->cpsw_base + AM65_CPSW_CTL_REG);
    
    	dma_disable(&common->dma_rx);
    err_dis_tx:
    	dma_disable(&common->dma_tx);
    err_free_rx:
    	dma_free(&common->dma_rx);
    err_free_tx:
    	dma_free(&common->dma_tx);
    err_off_clk:
    	clk_disable(&common->fclk);
    err_off_pwrdm:
    	power_domain_off(&common->pwrdmn);
    out:
    	dev_err(dev, "%s end error\n", __func__);
    
    	return ret;
    }
    
    static int am65_cpsw_send(struct udevice *dev, void *packet, int length)
    {
    	struct am65_cpsw_priv *priv = dev_get_priv(dev);
    	struct am65_cpsw_common	*common = priv->cpsw_common;
    	struct ti_udma_drv_packet_data packet_data;
    	int ret;
    
    	packet_data.pkt_type = AM65_CPSW_CPPI_PKT_TYPE;
    	packet_data.dest_tag = priv->port_id;
    	ret = dma_send(&common->dma_tx, packet, length, &packet_data);
    	if (ret) {
    		dev_err(dev, "TX dma_send failed %d\n", ret);
    		return ret;
    	}
    
    	return 0;
    }
    
    static int am65_cpsw_recv(struct udevice *dev, int flags, uchar **packetp)
    {
    	struct am65_cpsw_priv *priv = dev_get_priv(dev);
    	struct am65_cpsw_common	*common = priv->cpsw_common;
    
    	/* try to receive a new packet */
    	return dma_receive(&common->dma_rx, (void **)packetp, NULL);
    }
    
    static int am65_cpsw_free_pkt(struct udevice *dev, uchar *packet, int length)
    {
    	struct am65_cpsw_priv *priv = dev_get_priv(dev);
    	struct am65_cpsw_common	*common = priv->cpsw_common;
    	int ret;
    
    	if (length > 0) {
    		u32 pkt = common->rx_next % UDMA_RX_DESC_NUM;
    
    		ret = dma_prepare_rcv_buf(&common->dma_rx,
    					  net_rx_packets[pkt],
    					  UDMA_RX_BUF_SIZE);
    		if (ret)
    			dev_err(dev, "RX dma free_pkt failed %d\n", ret);
    		common->rx_next++;
    	}
    
    	return 0;
    }
    
    static void am65_cpsw_stop(struct udevice *dev)
    {
    	struct am65_cpsw_priv *priv = dev_get_priv(dev);
    	struct am65_cpsw_common *common = priv->cpsw_common;
    	struct am65_cpsw_port *port = &common->ports[priv->port_id];
    
    	if (!common->started)
    		return;
    
    	phy_shutdown(priv->phydev);
    
    	writel(0, common->ale_base + AM65_CPSW_ALE_PN_CTL_REG(priv->port_id));
    	writel(0, common->ale_base + AM65_CPSW_ALE_PN_CTL_REG(0));
    	if (!am65_cpsw_macsl_wait_for_idle(port))
    		dev_err(dev, "mac_sl idle timeout\n");
    	writel(0, port->macsl_base + AM65_CPSW_MACSL_CTL_REG);
    	writel(0, common->ale_base + AM65_CPSW_ALE_CTL_REG);
    	writel(0, common->cpsw_base + AM65_CPSW_CTL_REG);
    
    	dma_disable(&common->dma_tx);
    	dma_free(&common->dma_tx);
    
    	dma_disable(&common->dma_rx);
    	dma_free(&common->dma_rx);
    
    	common->started = false;
    }
    
    static int am65_cpsw_am654_get_efuse_macid(struct udevice *dev,
    					   int slave, u8 *mac_addr)
    {
    	u32 mac_lo, mac_hi, offset;
    	struct regmap *syscon;
    	int ret;
    
    	syscon = syscon_regmap_lookup_by_phandle(dev, "ti,syscon-efuse");
    	if (IS_ERR(syscon)) {
    		if (PTR_ERR(syscon) == -ENODEV)
    			return 0;
    		return PTR_ERR(syscon);
    	}
    
    	ret = dev_read_u32_index(dev, "ti,syscon-efuse", 1, &offset);
    	if (ret)
    		return ret;
    
    	regmap_read(syscon, offset, &mac_lo);
    	regmap_read(syscon, offset + 4, &mac_hi);
    
    	mac_addr[0] = (mac_hi >> 8) & 0xff;
    	mac_addr[1] = mac_hi & 0xff;
    	mac_addr[2] = (mac_lo >> 24) & 0xff;
    	mac_addr[3] = (mac_lo >> 16) & 0xff;
    	mac_addr[4] = (mac_lo >> 8) & 0xff;
    	mac_addr[5] = mac_lo & 0xff;
    
    	return 0;
    }
    
    static int am65_cpsw_read_rom_hwaddr(struct udevice *dev)
    {
    	struct am65_cpsw_priv *priv = dev_get_priv(dev);
    	struct eth_pdata *pdata = dev_get_plat(dev);
    
    	am65_cpsw_am654_get_efuse_macid(dev,
    					priv->port_id,
    					pdata->enetaddr);
    
    	return 0;
    }
    
    static const struct eth_ops am65_cpsw_ops = {
    	.start		= am65_cpsw_start,
    	.send		= am65_cpsw_send,
    	.recv		= am65_cpsw_recv,
    	.free_pkt	= am65_cpsw_free_pkt,
    	.stop		= am65_cpsw_stop,
    	.read_rom_hwaddr = am65_cpsw_read_rom_hwaddr,
    };
    
    static const struct soc_attr k3_mdio_soc_data[] = {
    	{ .family = "AM62X", .revision = "SR1.0" },
    	{ .family = "AM64X", .revision = "SR1.0" },
    	{ .family = "AM64X", .revision = "SR2.0" },
    	{ .family = "AM65X", .revision = "SR1.0" },
    	{ .family = "AM65X", .revision = "SR2.0" },
    	{ .family = "J7200", .revision = "SR1.0" },
    	{ .family = "J7200", .revision = "SR2.0" },
    	{ .family = "J721E", .revision = "SR1.0" },
    	{ .family = "J721E", .revision = "SR1.1" },
    	{ .family = "J721S2", .revision = "SR1.0" },
    	{ /* sentinel */ },
    };
    
    static ofnode am65_cpsw_find_mdio(ofnode parent)
    {
    	ofnode node;
    
    	ofnode_for_each_subnode(node, parent)
    		if (ofnode_device_is_compatible(node, "ti,cpsw-mdio"))
    			return node;
    
    	return ofnode_null();
    }
    
    static int am65_cpsw_mdio_setup(struct udevice *dev)
    {
    	struct am65_cpsw_priv *priv = dev_get_priv(dev);
    	struct am65_cpsw_common	*cpsw_common = priv->cpsw_common;
    	struct udevice *mdio_dev;
    	ofnode mdio;
    	int ret;
    
    	mdio = am65_cpsw_find_mdio(dev_ofnode(cpsw_common->dev));
    	if (!ofnode_valid(mdio))
    		return 0;
    
    	/*
    	 * The MDIO controller is represented in the DT binding by a
    	 * subnode of the MAC controller.
    	 *
    	 * We don't have a DM driver for the MDIO device yet, and thus any
    	 * pinctrl setting on its node will be ignored.
    	 *
    	 * However, we do need to make sure the pins states tied to the
    	 * MDIO node are configured properly. Fortunately, the core DM
    	 * does that for use when we get a device, so we can work around
    	 * that whole issue by just requesting a dummy MDIO driver to
    	 * probe, and our pins will get muxed.
    	 */
    	ret = uclass_get_device_by_ofnode(UCLASS_MDIO, mdio, &mdio_dev);
    	if (ret)
    		return ret;
    
    	return 0;
    }
    
    static int am65_cpsw_mdio_init(struct udevice *dev)
    {
    	struct am65_cpsw_priv *priv = dev_get_priv(dev);
    	struct am65_cpsw_common	*cpsw_common = priv->cpsw_common;
    	int ret;
    
    	if (!priv->has_phy || cpsw_common->bus)
    		return 0;
    		
    	if (dm_gpio_is_valid(&cpsw_common->mdio_gpio_reset)) {
    		dm_gpio_set_value(&cpsw_common->mdio_gpio_reset, 1);
    		udelay(cpsw_common->reset_delay_us);
    		dm_gpio_set_value(&cpsw_common->mdio_gpio_reset, 0);
    		if (cpsw_common->reset_post_delay_us > 0)
    			udelay(cpsw_common->reset_post_delay_us);
    	}
    
    	ret = am65_cpsw_mdio_setup(dev);
    	if (ret)
    		return ret;
    
    	cpsw_common->bus = cpsw_mdio_init(dev->name,
    					  cpsw_common->mdio_base,
    					  cpsw_common->bus_freq,
    					  clk_get_rate(&cpsw_common->fclk),
    					  priv->mdio_manual_mode);
    	if (!cpsw_common->bus)
    		return -EFAULT;
    
    	return 0;
    }
    
    static int am65_cpsw_phy_init(struct udevice *dev)
    {
    	struct am65_cpsw_priv *priv = dev_get_priv(dev);
    	struct am65_cpsw_common *cpsw_common = priv->cpsw_common;
    	struct eth_pdata *pdata = dev_get_plat(dev);
    	struct phy_device *phydev;
    	u32 supported = PHY_GBIT_FEATURES;
    	int ret;
    
    	phydev = phy_connect(cpsw_common->bus,
    			     priv->phy_addr,
    			     priv->dev,
    			     pdata->phy_interface);
    
    	if (!phydev) {
    		dev_err(dev, "phy_connect() failed\n");
    		return -ENODEV;
    	}
    
    	phydev->supported &= supported;
    	if (pdata->max_speed) {
    		ret = phy_set_supported(phydev, pdata->max_speed);
    		if (ret)
    			return ret;
    	}
    	phydev->advertising = phydev->supported;
    
    	if (ofnode_valid(priv->phy_node))
    		phydev->node = priv->phy_node;
    
    	priv->phydev = phydev;
    	ret = phy_config(phydev);
    	if (ret < 0)
    		pr_err("phy_config() failed: %d", ret);
    
    	return ret;
    }
    
    static int am65_cpsw_ofdata_parse_phy(struct udevice *dev)
    {
    	struct eth_pdata *pdata = dev_get_plat(dev);
    	struct am65_cpsw_priv *priv = dev_get_priv(dev);
    	struct ofnode_phandle_args out_args;
    	int ret = 0;
    
    	dev_read_u32(dev, "reg", &priv->port_id);
    
    	pdata->phy_interface = dev_read_phy_mode(dev);
    	if (pdata->phy_interface == PHY_INTERFACE_MODE_NA) {
    		dev_err(dev, "Invalid PHY mode, port %u\n", priv->port_id);
    		return -EINVAL;
    	}
    
    	dev_read_u32(dev, "max-speed", (u32 *)&pdata->max_speed);
    	if (pdata->max_speed)
    		dev_err(dev, "Port %u speed froced to %uMbit\n",
    			priv->port_id, pdata->max_speed);
    
    	priv->has_phy  = true;
    	ret = ofnode_parse_phandle_with_args(dev_ofnode(dev), "phy-handle",
    					     NULL, 0, 0, &out_args);
    	if (ret) {
    		dev_err(dev, "can't parse phy-handle port %u (%d)\n",
    			priv->port_id, ret);
    		priv->has_phy  = false;
    		ret = 0;
    	}
    
    	priv->phy_node = out_args.node;
    	if (priv->has_phy) {
    		ret = ofnode_read_u32(priv->phy_node, "reg", &priv->phy_addr);
    		if (ret) {
    			dev_err(dev, "failed to get phy_addr port %u (%d)\n",
    				priv->port_id, ret);
    			goto out;
    		}
    	}
    
    out:
    	return ret;
    }
    
    static int am65_cpsw_port_probe(struct udevice *dev)
    {
    	struct am65_cpsw_priv *priv = dev_get_priv(dev);
    	struct eth_pdata *pdata = dev_get_plat(dev);
    	struct am65_cpsw_common *cpsw_common;
    	char portname[15];
    	int ret;
    
    	priv->dev = dev;
    
    	cpsw_common = dev_get_priv(dev->parent);
    	priv->cpsw_common = cpsw_common;
    
    	sprintf(portname, "%s%s", dev->parent->name, dev->name);
    	device_set_name(dev, portname);
    
    	priv->mdio_manual_mode = false;
    	if (soc_device_match(k3_mdio_soc_data))
    		priv->mdio_manual_mode = true;
    
    	ret = am65_cpsw_ofdata_parse_phy(dev);
    	if (ret)
    		goto out;
    
    	ret = am65_cpsw_gmii_sel_k3(priv, pdata->phy_interface);
    	if (ret)
    		goto out;
    
    	ret = am65_cpsw_mdio_init(dev);
    	if (ret)
    		goto out;
    
    	ret = am65_cpsw_phy_init(dev);
    	if (ret)
    		goto out;
    out:
    	return ret;
    }
    
    static int am65_cpsw_probe_nuss(struct udevice *dev)
    {
    	struct am65_cpsw_common *cpsw_common = dev_get_priv(dev);
    	ofnode ports_np, node, mdio_np;
    	int ret, i;
    	struct udevice *port_dev;
    
    	cpsw_common->dev = dev;
    	cpsw_common->ss_base = dev_read_addr(dev);
    	if (cpsw_common->ss_base == FDT_ADDR_T_NONE)
    		return -EINVAL;
    
    	ret = power_domain_get_by_index(dev, &cpsw_common->pwrdmn, 0);
    	if (ret) {
    		dev_err(dev, "failed to get pwrdmn: %d\n", ret);
    		return ret;
    	}
    
    	ret = clk_get_by_name(dev, "fck", &cpsw_common->fclk);
    	if (ret) {
    		power_domain_free(&cpsw_common->pwrdmn);
    		dev_err(dev, "failed to get clock %d\n", ret);
    		return ret;
    	}
    
    	cpsw_common->cpsw_base = cpsw_common->ss_base + AM65_CPSW_CPSW_NU_BASE;
    	cpsw_common->ale_base = cpsw_common->cpsw_base +
    				AM65_CPSW_CPSW_NU_ALE_BASE;
    	cpsw_common->mdio_base = cpsw_common->ss_base + AM65_CPSW_MDIO_BASE;
    	
    	/* get bus level PHY reset GPIO details */
    	mdio_np = dev_read_subnode(dev, "mdio");
    	if (!ofnode_valid(mdio_np)) {
    		ret = -ENOENT;
    		goto out;
    	}
    
    	cpsw_common->reset_delay_us = ofnode_read_u32_default(mdio_np,
    						"reset-delay-us",
    						DEFAULT_GPIO_RESET_DELAY);
    	cpsw_common->reset_post_delay_us = ofnode_read_u32_default(mdio_np,
    						"reset-post-delay-us", 0);
    	ret = gpio_request_by_name_nodev(mdio_np, "reset-gpios", 0,
    					 &cpsw_common->mdio_gpio_reset,
    					 GPIOD_IS_OUT | GPIOD_IS_OUT_ACTIVE);
    
    	ports_np = dev_read_subnode(dev, "ethernet-ports");
    	if (!ofnode_valid(ports_np)) {
    		ret = -ENOENT;
    		goto out;
    	}
    
    	ofnode_for_each_subnode(node, ports_np) {
    		const char *node_name;
    		u32 port_id;
    		bool disabled;
    
    		node_name = ofnode_get_name(node);
    
    		disabled = !ofnode_is_enabled(node);
    
    		ret = ofnode_read_u32(node, "reg", &port_id);
    		if (ret) {
    			dev_err(dev, "%s: failed to get port_id (%d)\n",
    				node_name, ret);
    			goto out;
    		}
    
    		if (port_id >= AM65_CPSW_CPSWNU_MAX_PORTS) {
    			dev_err(dev, "%s: invalid port_id (%d)\n",
    				node_name, port_id);
    			ret = -EINVAL;
    			goto out;
    		}
    		cpsw_common->port_num++;
    
    		if (!port_id)
    			continue;
    
    		cpsw_common->ports[port_id].disabled = disabled;
    		if (disabled)
    			continue;
    
    		ret = device_bind_driver_to_node(dev, "am65_cpsw_nuss_port", ofnode_get_name(node), node, &port_dev);
    		if (ret)
    			dev_err(dev, "Failed to bind to %s node\n", ofnode_get_name(node));
    	}
    
    	for (i = 0; i < AM65_CPSW_CPSWNU_MAX_PORTS; i++) {
    		struct am65_cpsw_port *port = &cpsw_common->ports[i];
    
    		port->sgmii_base = cpsw_common->ss_base +
    					(AM65_CPSW_SGMII_BASE * i);
    		port->port_base = cpsw_common->cpsw_base +
    				  AM65_CPSW_CPSW_NU_PORTS_OFFSET +
    				  (i * AM65_CPSW_CPSW_NU_PORTS_OFFSET);
    		port->macsl_base = port->port_base +
    				   AM65_CPSW_CPSW_NU_PORT_MACSL_OFFSET;
    	}
    
    	cpsw_common->bus_freq =
    			dev_read_u32_default(dev, "bus_freq",
    					     AM65_CPSW_MDIO_BUS_FREQ_DEF);
    
    	dev_info(dev, "K3 CPSW: nuss_ver: 0x%08X cpsw_ver: 0x%08X ale_ver: 0x%08X Ports:%u mdio_freq:%u\n",
    		 readl(cpsw_common->ss_base),
    		 readl(cpsw_common->cpsw_base),
    		 readl(cpsw_common->ale_base),
    		 cpsw_common->port_num,
    		 cpsw_common->bus_freq);
    
    out:
    	clk_free(&cpsw_common->fclk);
    	power_domain_free(&cpsw_common->pwrdmn);
    	return ret;
    }
    
    static const struct udevice_id am65_cpsw_nuss_ids[] = {
    	{ .compatible = "ti,am654-cpsw-nuss" },
    	{ .compatible = "ti,j721e-cpsw-nuss" },
    	{ .compatible = "ti,am642-cpsw-nuss" },
    	{ }
    };
    
    U_BOOT_DRIVER(am65_cpsw_nuss) = {
    	.name	= "am65_cpsw_nuss",
    	.id	= UCLASS_MISC,
    	.of_match = am65_cpsw_nuss_ids,
    	.probe	= am65_cpsw_probe_nuss,
    	.priv_auto = sizeof(struct am65_cpsw_common),
    };
    
    U_BOOT_DRIVER(am65_cpsw_nuss_port) = {
    	.name	= "am65_cpsw_nuss_port",
    	.id	= UCLASS_ETH,
    	.probe	= am65_cpsw_port_probe,
    	.ops	= &am65_cpsw_ops,
    	.priv_auto	= sizeof(struct am65_cpsw_priv),
    	.plat_auto	= sizeof(struct eth_pdata),
    	.flags = DM_FLAG_ALLOC_PRIV_DMA | DM_FLAG_OS_PREPARE,
    };
    
    static const struct udevice_id am65_cpsw_mdio_ids[] = {
    	{ .compatible = "ti,cpsw-mdio" },
    	{ }
    };
    
    U_BOOT_DRIVER(am65_cpsw_mdio) = {
    	.name		= "am65_cpsw_mdio",
    	.id		= UCLASS_MDIO,
    	.of_match	= am65_cpsw_mdio_ids,
    };

  • And another additional information, since the issue seems to be related to clocking: We are using 25 MHz external oscillator (instead of 19.2 MHz) as main clock source for TDA4.

  • Hi Felix,

    And have you made appropriate changes for the same in the dm firmware?

    Are you able to boot to the kernel. We can check the clock values using k3conf utility from there.

    Regards,
    Tanmay

  • Hi Tanmay,

    is dm firmware = MCU1_0 firmware? And which appropriate changes are you referring to?

    I am able to boot to kernel. I deactivated all Ethernet/SERDES4 related device tree nodes. This is the output of k3conf for SERDES4:

    root@e3g-e3mn:~# k3conf dump clock 297
    |------------------------------------------------------------------------------|
    | VERSION INFO                                                                 |
    |------------------------------------------------------------------------------|
    | K3CONF | (version 0.3-nogit built Fri Oct 06 12:20:16 UTC 2023)              |
    | SoC    | J721E SR1.1                                                         |
    | SYSFW  | ABI: 3.1 (firmware version 0x0009 '9.1.2--v09.01.02 (Kool Koala))') |
    |------------------------------------------------------------------------------|
    
    |----------------------------------------------------------------------------------------------------------------------------------|
    | Device ID | Clock ID | Clock Name                                                            | Status          | Clock Frequency |
    |----------------------------------------------------------------------------------------------------------------------------------|
    |   297     |     0    | DEV_SERDES_10G0_IP1_LN3_TXCLK                                         | CLK_STATE_READY | 0               |
    |   297     |     1    | DEV_SERDES_10G0_CLK                                                   | CLK_STATE_READY | 125000000       |
    |   297     |     2    | DEV_SERDES_10G0_IP3_LN2_TXCLK                                         | CLK_STATE_READY | 0               |
    |   297     |     3    | DEV_SERDES_10G0_IP1_LN2_TXCLK                                         | CLK_STATE_READY | 0               |
    |   297     |     4    | DEV_SERDES_10G0_IP1_LN0_TXCLK                                         | CLK_STATE_READY | 0               |
    |   297     |     5    | DEV_SERDES_10G0_IP3_LN1_TXCLK                                         | CLK_STATE_READY | 0               |
    |   297     |     6    | DEV_SERDES_10G0_IP3_LN3_TXCLK                                         | CLK_STATE_READY | 0               |
    |   297     |     7    | DEV_SERDES_10G0_IP3_LN0_TXCLK                                         | CLK_STATE_READY | 0               |
    |   297     |     8    | DEV_SERDES_10G0_IP1_LN1_TXCLK                                         | CLK_STATE_READY | 0               |
    |   297     |     9    | DEV_SERDES_10G0_CORE_REF_CLK                                          | CLK_STATE_READY | 100000000       |
    |   297     |    10    | DEV_SERDES_10G0_CORE_REF_CLK_PARENT_GLUELOGIC_HFOSC0_CLKOUT           | CLK_STATE_READY | 25000000        |
    |   297     |    11    | DEV_SERDES_10G0_CORE_REF_CLK_PARENT_BOARD_0_HFOSC1_CLK_OUT            | CLK_STATE_READY | 0               |
    |   297     |    12    | DEV_SERDES_10G0_CORE_REF_CLK_PARENT_HSDIV4_16FFT_MAIN_3_HSDIVOUT4_CLK | CLK_STATE_READY | 153846153       |
    |   297     |    13    | DEV_SERDES_10G0_CORE_REF_CLK_PARENT_HSDIV4_16FFT_MAIN_2_HSDIVOUT4_CLK | CLK_STATE_READY | 100000000       |
    |   297     |    14    | DEV_SERDES_10G0_IP1_LN1_REFCLK                                        | CLK_STATE_READY | 0               |
    |   297     |    15    | DEV_SERDES_10G0_IP1_LN2_RXCLK                                         | CLK_STATE_READY | 0               |
    |   297     |    16    | DEV_SERDES_10G0_IP3_LN1_TXFCLK                                        | CLK_STATE_READY | 0               |
    |   297     |    17    | DEV_SERDES_10G0_IP1_LN0_RXFCLK                                        | CLK_STATE_READY | 0               |
    |   297     |    18    | DEV_SERDES_10G0_IP1_LN3_RXCLK                                         | CLK_STATE_READY | 0               |
    |   297     |    19    | DEV_SERDES_10G0_IP3_LN3_RXCLK                                         | CLK_STATE_READY | 0               |
    |   297     |    20    | DEV_SERDES_10G0_IP3_LN1_TXMCLK                                        | CLK_STATE_READY | 0               |
    |   297     |    21    | DEV_SERDES_10G0_IP3_LN3_RXFCLK                                        | CLK_STATE_READY | 0               |
    |   297     |    22    | DEV_SERDES_10G0_IP3_LN3_REFCLK                                        | CLK_STATE_READY | 0               |
    |   297     |    23    | DEV_SERDES_10G0_IP3_LN2_RXCLK                                         | CLK_STATE_READY | 0               |
    |   297     |    24    | DEV_SERDES_10G0_IP1_LN0_TXFCLK                                        | CLK_STATE_READY | 0               |
    |   297     |    25    | DEV_SERDES_10G0_IP3_LN3_TXMCLK                                        | CLK_STATE_READY | 0               |
    |   297     |    26    | DEV_SERDES_10G0_IP3_LN1_RXFCLK                                        | CLK_STATE_READY | 0               |
    |   297     |    27    | DEV_SERDES_10G0_IP3_LN0_RXFCLK                                        | CLK_STATE_READY | 0               |
    |   297     |    28    | DEV_SERDES_10G0_IP1_LN1_TXMCLK                                        | CLK_STATE_READY | 0               |
    |   297     |    29    | DEV_SERDES_10G0_IP1_LN1_RXFCLK                                        | CLK_STATE_READY | 0               |
    |   297     |    30    | DEV_SERDES_10G0_IP3_LN3_TXFCLK                                        | CLK_STATE_READY | 0               |
    |   297     |    31    | DEV_SERDES_10G0_IP1_LN3_TXFCLK                                        | CLK_STATE_READY | 0               |
    |   297     |    32    | DEV_SERDES_10G0_IP1_LN3_TXMCLK                                        | CLK_STATE_READY | 0               |
    |   297     |    33    | DEV_SERDES_10G0_IP3_LN1_REFCLK                                        | CLK_STATE_READY | 0               |
    |   297     |    34    | DEV_SERDES_10G0_IP3_LN0_REFCLK                                        | CLK_STATE_READY | 0               |
    |   297     |    35    | DEV_SERDES_10G0_IP1_LN3_REFCLK                                        | CLK_STATE_READY | 0               |
    |   297     |    36    | DEV_SERDES_10G0_IP3_LN0_RXCLK                                         | CLK_STATE_READY | 0               |
    |   297     |    37    | DEV_SERDES_10G0_IP3_LN2_REFCLK                                        | CLK_STATE_READY | 0               |
    |   297     |    38    | DEV_SERDES_10G0_IP1_LN0_RXCLK                                         | CLK_STATE_READY | 0               |
    |   297     |    39    | DEV_SERDES_10G0_IP1_LN0_REFCLK                                        | CLK_STATE_READY | 0               |
    |   297     |    40    | DEV_SERDES_10G0_IP1_LN2_RXFCLK                                        | CLK_STATE_READY | 0               |
    |   297     |    41    | DEV_SERDES_10G0_IP1_LN1_TXFCLK                                        | CLK_STATE_READY | 0               |
    |   297     |    42    | DEV_SERDES_10G0_IP3_LN0_TXFCLK                                        | CLK_STATE_READY | 0               |
    |   297     |    43    | DEV_SERDES_10G0_REF_OUT_CLK                                           | CLK_STATE_READY | 0               |
    |   297     |    44    | DEV_SERDES_10G0_IP3_LN1_RXCLK                                         | CLK_STATE_READY | 0               |
    |   297     |    45    | DEV_SERDES_10G0_IP1_LN2_TXFCLK                                        | CLK_STATE_READY | 0               |
    |   297     |    46    | DEV_SERDES_10G0_IP1_LN0_TXMCLK                                        | CLK_STATE_READY | 0               |
    |   297     |    47    | DEV_SERDES_10G0_IP3_LN2_RXFCLK                                        | CLK_STATE_READY | 0               |
    |   297     |    48    | DEV_SERDES_10G0_IP1_LN2_TXMCLK                                        | CLK_STATE_READY | 0               |
    |   297     |    49    | DEV_SERDES_10G0_IP3_LN2_TXMCLK                                        | CLK_STATE_READY | 0               |
    |   297     |    50    | DEV_SERDES_10G0_IP1_LN2_REFCLK                                        | CLK_STATE_READY | 0               |
    |   297     |    51    | DEV_SERDES_10G0_IP3_LN2_TXFCLK                                        | CLK_STATE_READY | 0               |
    |   297     |    52    | DEV_SERDES_10G0_IP3_LN0_TXMCLK                                        | CLK_STATE_READY | 0               |
    |   297     |    53    | DEV_SERDES_10G0_IP1_LN3_RXFCLK                                        | CLK_STATE_READY | 0               |
    |   297     |    54    | DEV_SERDES_10G0_IP1_LN1_RXCLK                                         | CLK_STATE_READY | 0               |
    |----------------------------------------------------------------------------------------------------------------------------------|
    

    Best regards,

    Felix

  • When disabling CPSW related nodes in U-boot and enabling them in Linux, I get the following Kernel output:

    root@j721e-evm:~# dmesg | grep cpsw
    [    1.194858] am65-cpsw-nuss c000000.ethernet: initializing am65 cpsw nuss version 0x6BA01901, cpsw version 0x6BA80101 Ports: 9 quirks:00000000
    [    1.454870] am65-cpsw-nuss c000000.ethernet: initializing am65 cpsw nuss version 0x6BA01901, cpsw version 0x6BA80101 Ports: 9 quirks:00000000
    [    1.468727] am65-cpsw-nuss c000000.ethernet: initialized cpsw ale version 1.4
    [    1.475870] am65-cpsw-nuss c000000.ethernet: ALE Table size 512
    [    1.482232] am65-cpsw-nuss c000000.ethernet: CPTS ver 0x4e8a010a, freq:200000000, add_val:4 pps:0
    [    1.494038] am65-cpsw-nuss c000000.ethernet: set new flow-id-base 140
    root@j721e-evm:~# dmesg | grep mdio
    [    1.143390] davinci_mdio c000f00.mdio: Configuring MDIO in manual mode
    [    1.187142] davinci_mdio c000f00.mdio: davinci mdio revision 9.7, bus freq 1000000
    [    1.403436] davinci_mdio c000f00.mdio: Configuring MDIO in manual mode
    [    1.447146] davinci_mdio c000f00.mdio: davinci mdio revision 9.7, bus freq 1000000
    root@j721e-evm:~# dmesg | grep serdes
    root@j721e-evm:~# dmesg | grep wiz
    root@j721e-evm:~# ifconfig -a
    eth0      Link encap:Ethernet  HWaddr B2:A5:CC:1C:90:A9  
              BROADCAST MULTICAST  MTU:1500  Metric:1
              RX packets:0 errors:0 dropped:0 overruns:0 frame:0
              TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:1000 
              RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
    
    lo        Link encap:Local Loopback  
              inet addr:127.0.0.1  Mask:255.0.0.0
              UP LOOPBACK RUNNING  MTU:65536  Metric:1
              RX packets:0 errors:0 dropped:0 overruns:0 frame:0
              TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:1000 
              RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
    
    root@j721e-evm:~# ping 192.168.50.66
    PING 192.168.50.66 (192.168.50.66): 56 data bytes
    ping: sendto: Network is unreachable
    root@j721e-evm:~# 
    

    The corresponding serdes registers look the following:

    0x505E000: 0x00490011
    0x5050480: 0x70800000
    0x50504C0: 0x70800000
    0x5050500: 0x70800000
    0x5050540: 0x70800000
    0x5050484: 0x00010002
    0x50504C4: 0x00010002
    0x5050504: 0x00010002
    0x5050544: 0x00010002
    0x5050488: 0x00000000
    0x50504C8: 0x00000000
    0x5050508: 0x00000007
    0x5050548: 0x00000000
    0x505040c: 0xB1000000
    0x5050408: 0x98000000

    CPSW_SGMII_STATUS_REG_j:

    0x0c000714: 0x00000039

    However, ping is still not possible. Also, there is no PHY message in Kernel boot log.

    Best regards,

    Felix

  • Hi TI, 

    I just want to kindly remind of this issue.

    Best regards,

    Felix

    PS: I was able to get Ethernet connection working on Linux. So there is no hardware issue. The remaining issue in U-Boot is I think mainly related with faulty configuration of SERDES4 instance. Do you have a working example based on PSDK Linux v09.01 with SERDES4 activated for U-Boot?

  • Hi TI, 

    I just want to again kindly remind of this issue.

    Best regards,

    Felix

  • Following, I am also looking to get SGMII interface working in U-Boot

  • Hi Tanmay, 

    any feedback on this issue is appreciated.

    Best regards,

    Felix

  • Just trying to avoid that this issue gets closed...

  • Checkout this thread. They have patches for some of the drivers and device trees, and I was able to get SGMII configured correctly for U-boot

    e2e.ti.com/.../dra829v-enable-cpsw0-main-domain-ethernet-switch-in-u-boot