1*86e7de8bSSiddharth Vadapalli// SPDX-License-Identifier: GPL-2.0
2*86e7de8bSSiddharth Vadapalli/**
3*86e7de8bSSiddharth Vadapalli * DT Overlay for CPSW9G in QSGMII mode using J7 Quad Port ETH EXP Add-On Ethernet Card with
4*86e7de8bSSiddharth Vadapalli * J721E board.
5*86e7de8bSSiddharth Vadapalli *
6*86e7de8bSSiddharth Vadapalli * Copyright (C) 2023 Texas Instruments Incorporated - https://www.ti.com/
7*86e7de8bSSiddharth Vadapalli */
8*86e7de8bSSiddharth Vadapalli
9*86e7de8bSSiddharth Vadapalli/dts-v1/;
10*86e7de8bSSiddharth Vadapalli/plugin/;
11*86e7de8bSSiddharth Vadapalli
12*86e7de8bSSiddharth Vadapalli#include <dt-bindings/gpio/gpio.h>
13*86e7de8bSSiddharth Vadapalli#include <dt-bindings/mux/ti-serdes.h>
14*86e7de8bSSiddharth Vadapalli#include <dt-bindings/phy/phy.h>
15*86e7de8bSSiddharth Vadapalli#include <dt-bindings/phy/phy-cadence.h>
16*86e7de8bSSiddharth Vadapalli
17*86e7de8bSSiddharth Vadapalli#include "k3-pinctrl.h"
18*86e7de8bSSiddharth Vadapalli
19*86e7de8bSSiddharth Vadapalli&{/} {
20*86e7de8bSSiddharth Vadapalli	aliases {
21*86e7de8bSSiddharth Vadapalli		ethernet1 = "/bus@100000/ethernet@c000000/ethernet-ports/port@1";
22*86e7de8bSSiddharth Vadapalli		ethernet2 = "/bus@100000/ethernet@c000000/ethernet-ports/port@2";
23*86e7de8bSSiddharth Vadapalli		ethernet3 = "/bus@100000/ethernet@c000000/ethernet-ports/port@3";
24*86e7de8bSSiddharth Vadapalli		ethernet4 = "/bus@100000/ethernet@c000000/ethernet-ports/port@4";
25*86e7de8bSSiddharth Vadapalli	};
26*86e7de8bSSiddharth Vadapalli};
27*86e7de8bSSiddharth Vadapalli
28*86e7de8bSSiddharth Vadapalli&cpsw0 {
29*86e7de8bSSiddharth Vadapalli	status = "okay";
30*86e7de8bSSiddharth Vadapalli};
31*86e7de8bSSiddharth Vadapalli
32*86e7de8bSSiddharth Vadapalli&cpsw0_port1 {
33*86e7de8bSSiddharth Vadapalli	status = "okay";
34*86e7de8bSSiddharth Vadapalli	phy-handle = <&cpsw9g_phy0>;
35*86e7de8bSSiddharth Vadapalli	phy-mode = "qsgmii";
36*86e7de8bSSiddharth Vadapalli	mac-address = [00 00 00 00 00 00];
37*86e7de8bSSiddharth Vadapalli	phys = <&cpsw0_phy_gmii_sel 1>;
38*86e7de8bSSiddharth Vadapalli};
39*86e7de8bSSiddharth Vadapalli
40*86e7de8bSSiddharth Vadapalli&cpsw0_port2 {
41*86e7de8bSSiddharth Vadapalli	status = "okay";
42*86e7de8bSSiddharth Vadapalli	phy-handle = <&cpsw9g_phy1>;
43*86e7de8bSSiddharth Vadapalli	phy-mode = "qsgmii";
44*86e7de8bSSiddharth Vadapalli	mac-address = [00 00 00 00 00 00];
45*86e7de8bSSiddharth Vadapalli	phys = <&cpsw0_phy_gmii_sel 2>;
46*86e7de8bSSiddharth Vadapalli};
47*86e7de8bSSiddharth Vadapalli
48*86e7de8bSSiddharth Vadapalli&cpsw0_port3 {
49*86e7de8bSSiddharth Vadapalli	status = "okay";
50*86e7de8bSSiddharth Vadapalli	phy-handle = <&cpsw9g_phy2>;
51*86e7de8bSSiddharth Vadapalli	phy-mode = "qsgmii";
52*86e7de8bSSiddharth Vadapalli	mac-address = [00 00 00 00 00 00];
53*86e7de8bSSiddharth Vadapalli	phys = <&cpsw0_phy_gmii_sel 3>;
54*86e7de8bSSiddharth Vadapalli};
55*86e7de8bSSiddharth Vadapalli
56*86e7de8bSSiddharth Vadapalli&cpsw0_port4 {
57*86e7de8bSSiddharth Vadapalli	status = "okay";
58*86e7de8bSSiddharth Vadapalli	phy-handle = <&cpsw9g_phy3>;
59*86e7de8bSSiddharth Vadapalli	phy-mode = "qsgmii";
60*86e7de8bSSiddharth Vadapalli	mac-address = [00 00 00 00 00 00];
61*86e7de8bSSiddharth Vadapalli	phys = <&cpsw0_phy_gmii_sel 4>;
62*86e7de8bSSiddharth Vadapalli};
63*86e7de8bSSiddharth Vadapalli
64*86e7de8bSSiddharth Vadapalli&cpsw9g_mdio {
65*86e7de8bSSiddharth Vadapalli	status = "okay";
66*86e7de8bSSiddharth Vadapalli	pinctrl-names = "default";
67*86e7de8bSSiddharth Vadapalli	pinctrl-0 = <&mdio0_pins_default>;
68*86e7de8bSSiddharth Vadapalli	reset-gpios = <&exp2 17 GPIO_ACTIVE_LOW>;
69*86e7de8bSSiddharth Vadapalli	reset-post-delay-us = <120000>;
70*86e7de8bSSiddharth Vadapalli	#address-cells = <1>;
71*86e7de8bSSiddharth Vadapalli	#size-cells = <0>;
72*86e7de8bSSiddharth Vadapalli
73*86e7de8bSSiddharth Vadapalli	cpsw9g_phy0: ethernet-phy@17 {
74*86e7de8bSSiddharth Vadapalli		reg = <17>;
75*86e7de8bSSiddharth Vadapalli	};
76*86e7de8bSSiddharth Vadapalli	cpsw9g_phy1: ethernet-phy@16 {
77*86e7de8bSSiddharth Vadapalli		reg = <16>;
78*86e7de8bSSiddharth Vadapalli	};
79*86e7de8bSSiddharth Vadapalli	cpsw9g_phy2: ethernet-phy@18 {
80*86e7de8bSSiddharth Vadapalli		reg = <18>;
81*86e7de8bSSiddharth Vadapalli	};
82*86e7de8bSSiddharth Vadapalli	cpsw9g_phy3: ethernet-phy@19 {
83*86e7de8bSSiddharth Vadapalli		reg = <19>;
84*86e7de8bSSiddharth Vadapalli	};
85*86e7de8bSSiddharth Vadapalli};
86*86e7de8bSSiddharth Vadapalli
87*86e7de8bSSiddharth Vadapalli&exp2 {
88*86e7de8bSSiddharth Vadapalli	qsgmii-line-hog {
89*86e7de8bSSiddharth Vadapalli		gpio-hog;
90*86e7de8bSSiddharth Vadapalli		gpios = <16 GPIO_ACTIVE_HIGH>;
91*86e7de8bSSiddharth Vadapalli		output-low;
92*86e7de8bSSiddharth Vadapalli		line-name = "qsgmii-pwrdn-line";
93*86e7de8bSSiddharth Vadapalli	};
94*86e7de8bSSiddharth Vadapalli};
95*86e7de8bSSiddharth Vadapalli
96*86e7de8bSSiddharth Vadapalli&main_pmx0 {
97*86e7de8bSSiddharth Vadapalli	mdio0_pins_default: mdio0-pins-default {
98*86e7de8bSSiddharth Vadapalli		pinctrl-single,pins = <
99*86e7de8bSSiddharth Vadapalli			J721E_IOPAD(0x1bc, PIN_OUTPUT, 0) /* (V24) MDIO0_MDC */
100*86e7de8bSSiddharth Vadapalli			J721E_IOPAD(0x1b8, PIN_INPUT, 0) /* (V26) MDIO0_MDIO */
101*86e7de8bSSiddharth Vadapalli		>;
102*86e7de8bSSiddharth Vadapalli	};
103*86e7de8bSSiddharth Vadapalli};
104*86e7de8bSSiddharth Vadapalli
105*86e7de8bSSiddharth Vadapalli&serdes_ln_ctrl {
106*86e7de8bSSiddharth Vadapalli	idle-states = <J721E_SERDES0_LANE0_PCIE0_LANE0>, <J721E_SERDES0_LANE1_QSGMII_LANE2>,
107*86e7de8bSSiddharth Vadapalli		      <J721E_SERDES1_LANE0_PCIE1_LANE0>, <J721E_SERDES1_LANE1_PCIE1_LANE1>,
108*86e7de8bSSiddharth Vadapalli		      <J721E_SERDES2_LANE0_PCIE2_LANE0>, <J721E_SERDES2_LANE1_PCIE2_LANE1>,
109*86e7de8bSSiddharth Vadapalli		      <J721E_SERDES3_LANE0_USB3_0_SWAP>, <J721E_SERDES3_LANE1_USB3_0>,
110*86e7de8bSSiddharth Vadapalli		      <J721E_SERDES4_LANE0_EDP_LANE0>, <J721E_SERDES4_LANE1_EDP_LANE1>,
111*86e7de8bSSiddharth Vadapalli		      <J721E_SERDES4_LANE2_EDP_LANE2>, <J721E_SERDES4_LANE3_EDP_LANE3>;
112*86e7de8bSSiddharth Vadapalli};
113*86e7de8bSSiddharth Vadapalli
114*86e7de8bSSiddharth Vadapalli&serdes_wiz0 {
115*86e7de8bSSiddharth Vadapalli	status = "okay";
116*86e7de8bSSiddharth Vadapalli};
117*86e7de8bSSiddharth Vadapalli
118*86e7de8bSSiddharth Vadapalli&serdes0 {
119*86e7de8bSSiddharth Vadapalli	status = "okay";
120*86e7de8bSSiddharth Vadapalli
121*86e7de8bSSiddharth Vadapalli	assigned-clocks = <&serdes0 CDNS_SIERRA_PLL_CMNLC>, <&serdes0 CDNS_SIERRA_PLL_CMNLC1>;
122*86e7de8bSSiddharth Vadapalli	assigned-clock-parents = <&wiz0_pll1_refclk>, <&wiz0_pll1_refclk>;
123*86e7de8bSSiddharth Vadapalli	#address-cells = <1>;
124*86e7de8bSSiddharth Vadapalli	#size-cells = <0>;
125*86e7de8bSSiddharth Vadapalli
126*86e7de8bSSiddharth Vadapalli	serdes0_qsgmii_link: phy@1 {
127*86e7de8bSSiddharth Vadapalli		reg = <1>;
128*86e7de8bSSiddharth Vadapalli		cdns,num-lanes = <1>;
129*86e7de8bSSiddharth Vadapalli		#phy-cells = <0>;
130*86e7de8bSSiddharth Vadapalli		cdns,phy-type = <PHY_TYPE_QSGMII>;
131*86e7de8bSSiddharth Vadapalli		resets = <&serdes_wiz0 2>;
132*86e7de8bSSiddharth Vadapalli	};
133*86e7de8bSSiddharth Vadapalli};
134