186e7de8bSSiddharth Vadapalli// SPDX-License-Identifier: GPL-2.0
286e7de8bSSiddharth Vadapalli/**
386e7de8bSSiddharth Vadapalli * DT Overlay for CPSW9G in QSGMII mode using J7 Quad Port ETH EXP Add-On Ethernet Card with
486e7de8bSSiddharth Vadapalli * J721E board.
586e7de8bSSiddharth Vadapalli *
686e7de8bSSiddharth Vadapalli * Copyright (C) 2023 Texas Instruments Incorporated - https://www.ti.com/
786e7de8bSSiddharth Vadapalli */
886e7de8bSSiddharth Vadapalli
986e7de8bSSiddharth Vadapalli/dts-v1/;
1086e7de8bSSiddharth Vadapalli/plugin/;
1186e7de8bSSiddharth Vadapalli
1286e7de8bSSiddharth Vadapalli#include <dt-bindings/gpio/gpio.h>
1386e7de8bSSiddharth Vadapalli#include <dt-bindings/phy/phy.h>
1486e7de8bSSiddharth Vadapalli#include <dt-bindings/phy/phy-cadence.h>
1586e7de8bSSiddharth Vadapalli
1686e7de8bSSiddharth Vadapalli#include "k3-pinctrl.h"
17*8d08d7aaSJayesh Choudhary#include "k3-serdes.h"
1886e7de8bSSiddharth Vadapalli
1986e7de8bSSiddharth Vadapalli&{/} {
2086e7de8bSSiddharth Vadapalli	aliases {
2186e7de8bSSiddharth Vadapalli		ethernet1 = "/bus@100000/ethernet@c000000/ethernet-ports/port@1";
2286e7de8bSSiddharth Vadapalli		ethernet2 = "/bus@100000/ethernet@c000000/ethernet-ports/port@2";
2386e7de8bSSiddharth Vadapalli		ethernet3 = "/bus@100000/ethernet@c000000/ethernet-ports/port@3";
2486e7de8bSSiddharth Vadapalli		ethernet4 = "/bus@100000/ethernet@c000000/ethernet-ports/port@4";
2586e7de8bSSiddharth Vadapalli	};
2686e7de8bSSiddharth Vadapalli};
2786e7de8bSSiddharth Vadapalli
2886e7de8bSSiddharth Vadapalli&cpsw0 {
2986e7de8bSSiddharth Vadapalli	status = "okay";
3086e7de8bSSiddharth Vadapalli};
3186e7de8bSSiddharth Vadapalli
3286e7de8bSSiddharth Vadapalli&cpsw0_port1 {
3386e7de8bSSiddharth Vadapalli	status = "okay";
3486e7de8bSSiddharth Vadapalli	phy-handle = <&cpsw9g_phy0>;
3586e7de8bSSiddharth Vadapalli	phy-mode = "qsgmii";
3686e7de8bSSiddharth Vadapalli	mac-address = [00 00 00 00 00 00];
3786e7de8bSSiddharth Vadapalli	phys = <&cpsw0_phy_gmii_sel 1>;
3886e7de8bSSiddharth Vadapalli};
3986e7de8bSSiddharth Vadapalli
4086e7de8bSSiddharth Vadapalli&cpsw0_port2 {
4186e7de8bSSiddharth Vadapalli	status = "okay";
4286e7de8bSSiddharth Vadapalli	phy-handle = <&cpsw9g_phy1>;
4386e7de8bSSiddharth Vadapalli	phy-mode = "qsgmii";
4486e7de8bSSiddharth Vadapalli	mac-address = [00 00 00 00 00 00];
4586e7de8bSSiddharth Vadapalli	phys = <&cpsw0_phy_gmii_sel 2>;
4686e7de8bSSiddharth Vadapalli};
4786e7de8bSSiddharth Vadapalli
4886e7de8bSSiddharth Vadapalli&cpsw0_port3 {
4986e7de8bSSiddharth Vadapalli	status = "okay";
5086e7de8bSSiddharth Vadapalli	phy-handle = <&cpsw9g_phy2>;
5186e7de8bSSiddharth Vadapalli	phy-mode = "qsgmii";
5286e7de8bSSiddharth Vadapalli	mac-address = [00 00 00 00 00 00];
5386e7de8bSSiddharth Vadapalli	phys = <&cpsw0_phy_gmii_sel 3>;
5486e7de8bSSiddharth Vadapalli};
5586e7de8bSSiddharth Vadapalli
5686e7de8bSSiddharth Vadapalli&cpsw0_port4 {
5786e7de8bSSiddharth Vadapalli	status = "okay";
5886e7de8bSSiddharth Vadapalli	phy-handle = <&cpsw9g_phy3>;
5986e7de8bSSiddharth Vadapalli	phy-mode = "qsgmii";
6086e7de8bSSiddharth Vadapalli	mac-address = [00 00 00 00 00 00];
6186e7de8bSSiddharth Vadapalli	phys = <&cpsw0_phy_gmii_sel 4>;
6286e7de8bSSiddharth Vadapalli};
6386e7de8bSSiddharth Vadapalli
6486e7de8bSSiddharth Vadapalli&cpsw9g_mdio {
6586e7de8bSSiddharth Vadapalli	status = "okay";
6686e7de8bSSiddharth Vadapalli	pinctrl-names = "default";
6786e7de8bSSiddharth Vadapalli	pinctrl-0 = <&mdio0_pins_default>;
6886e7de8bSSiddharth Vadapalli	reset-gpios = <&exp2 17 GPIO_ACTIVE_LOW>;
6986e7de8bSSiddharth Vadapalli	reset-post-delay-us = <120000>;
7086e7de8bSSiddharth Vadapalli	#address-cells = <1>;
7186e7de8bSSiddharth Vadapalli	#size-cells = <0>;
7286e7de8bSSiddharth Vadapalli
7386e7de8bSSiddharth Vadapalli	cpsw9g_phy0: ethernet-phy@17 {
7486e7de8bSSiddharth Vadapalli		reg = <17>;
7586e7de8bSSiddharth Vadapalli	};
7686e7de8bSSiddharth Vadapalli	cpsw9g_phy1: ethernet-phy@16 {
7786e7de8bSSiddharth Vadapalli		reg = <16>;
7886e7de8bSSiddharth Vadapalli	};
7986e7de8bSSiddharth Vadapalli	cpsw9g_phy2: ethernet-phy@18 {
8086e7de8bSSiddharth Vadapalli		reg = <18>;
8186e7de8bSSiddharth Vadapalli	};
8286e7de8bSSiddharth Vadapalli	cpsw9g_phy3: ethernet-phy@19 {
8386e7de8bSSiddharth Vadapalli		reg = <19>;
8486e7de8bSSiddharth Vadapalli	};
8586e7de8bSSiddharth Vadapalli};
8686e7de8bSSiddharth Vadapalli
8786e7de8bSSiddharth Vadapalli&exp2 {
8886e7de8bSSiddharth Vadapalli	qsgmii-line-hog {
8986e7de8bSSiddharth Vadapalli		gpio-hog;
9086e7de8bSSiddharth Vadapalli		gpios = <16 GPIO_ACTIVE_HIGH>;
9186e7de8bSSiddharth Vadapalli		output-low;
9286e7de8bSSiddharth Vadapalli		line-name = "qsgmii-pwrdn-line";
9386e7de8bSSiddharth Vadapalli	};
9486e7de8bSSiddharth Vadapalli};
9586e7de8bSSiddharth Vadapalli
9686e7de8bSSiddharth Vadapalli&main_pmx0 {
97a4956811STony Lindgren	mdio0_pins_default: mdio0-default-pins {
9886e7de8bSSiddharth Vadapalli		pinctrl-single,pins = <
9986e7de8bSSiddharth Vadapalli			J721E_IOPAD(0x1bc, PIN_OUTPUT, 0) /* (V24) MDIO0_MDC */
10086e7de8bSSiddharth Vadapalli			J721E_IOPAD(0x1b8, PIN_INPUT, 0) /* (V26) MDIO0_MDIO */
10186e7de8bSSiddharth Vadapalli		>;
10286e7de8bSSiddharth Vadapalli	};
10386e7de8bSSiddharth Vadapalli};
10486e7de8bSSiddharth Vadapalli
10586e7de8bSSiddharth Vadapalli&serdes_ln_ctrl {
10686e7de8bSSiddharth Vadapalli	idle-states = <J721E_SERDES0_LANE0_PCIE0_LANE0>, <J721E_SERDES0_LANE1_QSGMII_LANE2>,
10786e7de8bSSiddharth Vadapalli		      <J721E_SERDES1_LANE0_PCIE1_LANE0>, <J721E_SERDES1_LANE1_PCIE1_LANE1>,
10886e7de8bSSiddharth Vadapalli		      <J721E_SERDES2_LANE0_PCIE2_LANE0>, <J721E_SERDES2_LANE1_PCIE2_LANE1>,
10986e7de8bSSiddharth Vadapalli		      <J721E_SERDES3_LANE0_USB3_0_SWAP>, <J721E_SERDES3_LANE1_USB3_0>,
11086e7de8bSSiddharth Vadapalli		      <J721E_SERDES4_LANE0_EDP_LANE0>, <J721E_SERDES4_LANE1_EDP_LANE1>,
11186e7de8bSSiddharth Vadapalli		      <J721E_SERDES4_LANE2_EDP_LANE2>, <J721E_SERDES4_LANE3_EDP_LANE3>;
11286e7de8bSSiddharth Vadapalli};
11386e7de8bSSiddharth Vadapalli
11486e7de8bSSiddharth Vadapalli&serdes_wiz0 {
11586e7de8bSSiddharth Vadapalli	status = "okay";
11686e7de8bSSiddharth Vadapalli};
11786e7de8bSSiddharth Vadapalli
11886e7de8bSSiddharth Vadapalli&serdes0 {
11986e7de8bSSiddharth Vadapalli	status = "okay";
12086e7de8bSSiddharth Vadapalli
12186e7de8bSSiddharth Vadapalli	assigned-clocks = <&serdes0 CDNS_SIERRA_PLL_CMNLC>, <&serdes0 CDNS_SIERRA_PLL_CMNLC1>;
12286e7de8bSSiddharth Vadapalli	assigned-clock-parents = <&wiz0_pll1_refclk>, <&wiz0_pll1_refclk>;
12386e7de8bSSiddharth Vadapalli	#address-cells = <1>;
12486e7de8bSSiddharth Vadapalli	#size-cells = <0>;
12586e7de8bSSiddharth Vadapalli
12686e7de8bSSiddharth Vadapalli	serdes0_qsgmii_link: phy@1 {
12786e7de8bSSiddharth Vadapalli		reg = <1>;
12886e7de8bSSiddharth Vadapalli		cdns,num-lanes = <1>;
12986e7de8bSSiddharth Vadapalli		#phy-cells = <0>;
13086e7de8bSSiddharth Vadapalli		cdns,phy-type = <PHY_TYPE_QSGMII>;
13186e7de8bSSiddharth Vadapalli		resets = <&serdes_wiz0 2>;
13286e7de8bSSiddharth Vadapalli	};
13386e7de8bSSiddharth Vadapalli};
134