162306a36Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0
262306a36Sopenharmony_ci/**
362306a36Sopenharmony_ci * DT Overlay for CPSW9G in RGMII mode using J7 GESI EXP BRD board with
462306a36Sopenharmony_ci * J721E board.
562306a36Sopenharmony_ci *
662306a36Sopenharmony_ci * GESI Board Product Link: https://www.ti.com/tool/J7EXPCXEVM
762306a36Sopenharmony_ci *
862306a36Sopenharmony_ci * Copyright (C) 2023 Texas Instruments Incorporated - https://www.ti.com/
962306a36Sopenharmony_ci */
1062306a36Sopenharmony_ci
1162306a36Sopenharmony_ci/dts-v1/;
1262306a36Sopenharmony_ci/plugin/;
1362306a36Sopenharmony_ci
1462306a36Sopenharmony_ci#include <dt-bindings/gpio/gpio.h>
1562306a36Sopenharmony_ci#include <dt-bindings/net/ti-dp83867.h>
1662306a36Sopenharmony_ci
1762306a36Sopenharmony_ci#include "k3-pinctrl.h"
1862306a36Sopenharmony_ci
1962306a36Sopenharmony_ci&{/} {
2062306a36Sopenharmony_ci	aliases {
2162306a36Sopenharmony_ci		ethernet1 = "/bus@100000/ethernet@c000000/ethernet-ports/port@1";
2262306a36Sopenharmony_ci		ethernet2 = "/bus@100000/ethernet@c000000/ethernet-ports/port@2";
2362306a36Sopenharmony_ci		ethernet3 = "/bus@100000/ethernet@c000000/ethernet-ports/port@3";
2462306a36Sopenharmony_ci		ethernet4 = "/bus@100000/ethernet@c000000/ethernet-ports/port@4";
2562306a36Sopenharmony_ci	};
2662306a36Sopenharmony_ci};
2762306a36Sopenharmony_ci
2862306a36Sopenharmony_ci&cpsw0 {
2962306a36Sopenharmony_ci	status = "okay";
3062306a36Sopenharmony_ci	pinctrl-names = "default";
3162306a36Sopenharmony_ci	pinctrl-0 = <&rgmii1_default_pins
3262306a36Sopenharmony_ci		     &rgmii2_default_pins
3362306a36Sopenharmony_ci		     &rgmii3_default_pins
3462306a36Sopenharmony_ci		     &rgmii4_default_pins>;
3562306a36Sopenharmony_ci};
3662306a36Sopenharmony_ci
3762306a36Sopenharmony_ci&cpsw0_port1 {
3862306a36Sopenharmony_ci	status = "okay";
3962306a36Sopenharmony_ci	phy-handle = <&cpsw9g_phy12>;
4062306a36Sopenharmony_ci	phy-mode = "rgmii-rxid";
4162306a36Sopenharmony_ci	mac-address = [00 00 00 00 00 00];
4262306a36Sopenharmony_ci	phys = <&cpsw0_phy_gmii_sel 1>;
4362306a36Sopenharmony_ci};
4462306a36Sopenharmony_ci
4562306a36Sopenharmony_ci&cpsw0_port2 {
4662306a36Sopenharmony_ci	status = "okay";
4762306a36Sopenharmony_ci	phy-handle = <&cpsw9g_phy15>;
4862306a36Sopenharmony_ci	phy-mode = "rgmii-rxid";
4962306a36Sopenharmony_ci	mac-address = [00 00 00 00 00 00];
5062306a36Sopenharmony_ci	phys = <&cpsw0_phy_gmii_sel 2>;
5162306a36Sopenharmony_ci};
5262306a36Sopenharmony_ci
5362306a36Sopenharmony_ci&cpsw0_port3 {
5462306a36Sopenharmony_ci	status = "okay";
5562306a36Sopenharmony_ci	phy-handle = <&cpsw9g_phy0>;
5662306a36Sopenharmony_ci	phy-mode = "rgmii-rxid";
5762306a36Sopenharmony_ci	mac-address = [00 00 00 00 00 00];
5862306a36Sopenharmony_ci	phys = <&cpsw0_phy_gmii_sel 3>;
5962306a36Sopenharmony_ci};
6062306a36Sopenharmony_ci
6162306a36Sopenharmony_ci&cpsw0_port4 {
6262306a36Sopenharmony_ci	status = "okay";
6362306a36Sopenharmony_ci	phy-handle = <&cpsw9g_phy3>;
6462306a36Sopenharmony_ci	phy-mode = "rgmii-rxid";
6562306a36Sopenharmony_ci	mac-address = [00 00 00 00 00 00];
6662306a36Sopenharmony_ci	phys = <&cpsw0_phy_gmii_sel 4>;
6762306a36Sopenharmony_ci};
6862306a36Sopenharmony_ci
6962306a36Sopenharmony_ci&cpsw9g_mdio {
7062306a36Sopenharmony_ci	status = "okay";
7162306a36Sopenharmony_ci	pinctrl-names = "default";
7262306a36Sopenharmony_ci	pinctrl-0 = <&mdio0_default_pins>;
7362306a36Sopenharmony_ci	bus_freq = <1000000>;
7462306a36Sopenharmony_ci	#address-cells = <1>;
7562306a36Sopenharmony_ci	#size-cells = <0>;
7662306a36Sopenharmony_ci
7762306a36Sopenharmony_ci	cpsw9g_phy0: ethernet-phy@0 {
7862306a36Sopenharmony_ci		reg = <0>;
7962306a36Sopenharmony_ci		ti,rx-internal-delay = <DP83867_RGMIIDCTL_2_00_NS>;
8062306a36Sopenharmony_ci		ti,fifo-depth = <DP83867_PHYCR_FIFO_DEPTH_4_B_NIB>;
8162306a36Sopenharmony_ci		ti,min-output-impedance;
8262306a36Sopenharmony_ci	};
8362306a36Sopenharmony_ci	cpsw9g_phy3: ethernet-phy@3 {
8462306a36Sopenharmony_ci		reg = <3>;
8562306a36Sopenharmony_ci		ti,rx-internal-delay = <DP83867_RGMIIDCTL_2_00_NS>;
8662306a36Sopenharmony_ci		ti,fifo-depth = <DP83867_PHYCR_FIFO_DEPTH_4_B_NIB>;
8762306a36Sopenharmony_ci		ti,min-output-impedance;
8862306a36Sopenharmony_ci	};
8962306a36Sopenharmony_ci	cpsw9g_phy12: ethernet-phy@12 {
9062306a36Sopenharmony_ci		reg = <12>;
9162306a36Sopenharmony_ci		ti,rx-internal-delay = <DP83867_RGMIIDCTL_2_00_NS>;
9262306a36Sopenharmony_ci		ti,fifo-depth = <DP83867_PHYCR_FIFO_DEPTH_4_B_NIB>;
9362306a36Sopenharmony_ci		ti,min-output-impedance;
9462306a36Sopenharmony_ci	};
9562306a36Sopenharmony_ci	cpsw9g_phy15: ethernet-phy@15 {
9662306a36Sopenharmony_ci		reg = <15>;
9762306a36Sopenharmony_ci		ti,rx-internal-delay = <DP83867_RGMIIDCTL_2_00_NS>;
9862306a36Sopenharmony_ci		ti,fifo-depth = <DP83867_PHYCR_FIFO_DEPTH_4_B_NIB>;
9962306a36Sopenharmony_ci		ti,min-output-impedance;
10062306a36Sopenharmony_ci	};
10162306a36Sopenharmony_ci};
10262306a36Sopenharmony_ci
10362306a36Sopenharmony_ci&exp1 {
10462306a36Sopenharmony_ci	p15-hog {
10562306a36Sopenharmony_ci		/* P15 - EXP_MUX2 */
10662306a36Sopenharmony_ci		gpio-hog;
10762306a36Sopenharmony_ci		gpios = <13 GPIO_ACTIVE_HIGH>;
10862306a36Sopenharmony_ci		output-high;
10962306a36Sopenharmony_ci		line-name = "EXP_MUX2";
11062306a36Sopenharmony_ci	};
11162306a36Sopenharmony_ci
11262306a36Sopenharmony_ci	p16-hog {
11362306a36Sopenharmony_ci		/* P16 - EXP_MUX3 */
11462306a36Sopenharmony_ci		gpio-hog;
11562306a36Sopenharmony_ci		gpios = <14 GPIO_ACTIVE_HIGH>;
11662306a36Sopenharmony_ci		output-high;
11762306a36Sopenharmony_ci		line-name = "EXP_MUX3";
11862306a36Sopenharmony_ci	};
11962306a36Sopenharmony_ci};
12062306a36Sopenharmony_ci
12162306a36Sopenharmony_ci&main_pmx0 {
12262306a36Sopenharmony_ci	mdio0_default_pins: mdio0-default-pins {
12362306a36Sopenharmony_ci		pinctrl-single,pins = <
12462306a36Sopenharmony_ci			J721E_IOPAD(0x1bc, PIN_OUTPUT, 0) /* (V24) MDIO0_MDC */
12562306a36Sopenharmony_ci			J721E_IOPAD(0x1b8, PIN_INPUT, 0) /* (V26) MDIO0_MDIO */
12662306a36Sopenharmony_ci		>;
12762306a36Sopenharmony_ci	};
12862306a36Sopenharmony_ci
12962306a36Sopenharmony_ci	rgmii1_default_pins: rgmii1-default-pins {
13062306a36Sopenharmony_ci		pinctrl-single,pins = <
13162306a36Sopenharmony_ci			J721E_IOPAD(0x4, PIN_INPUT, 4) /* (AC23) PRG1_PRU0_GPO0.RGMII1_RD0 */
13262306a36Sopenharmony_ci			J721E_IOPAD(0x8, PIN_INPUT, 4) /* (AG22) PRG1_PRU0_GPO1.RGMII1_RD1 */
13362306a36Sopenharmony_ci			J721E_IOPAD(0xc, PIN_INPUT, 4) /* (AF22) PRG1_PRU0_GPO2.RGMII1_RD2 */
13462306a36Sopenharmony_ci			J721E_IOPAD(0x10, PIN_INPUT, 4) /* (AJ23) PRG1_PRU0_GPO3.RGMII1_RD3 */
13562306a36Sopenharmony_ci			J721E_IOPAD(0x1c, PIN_INPUT, 4) /* (AD22) PRG1_PRU0_GPO6.RGMII1_RXC */
13662306a36Sopenharmony_ci			J721E_IOPAD(0x14, PIN_INPUT, 4) /* (AH23) PRG1_PRU0_GPO4.RGMII1_RX_CTL */
13762306a36Sopenharmony_ci			J721E_IOPAD(0x30, PIN_OUTPUT, 4) /* (AF24) PRG1_PRU0_GPO11.RGMII1_TD0 */
13862306a36Sopenharmony_ci			J721E_IOPAD(0x34, PIN_OUTPUT, 4) /* (AJ24) PRG1_PRU0_GPO12.RGMII1_TD1 */
13962306a36Sopenharmony_ci			J721E_IOPAD(0x38, PIN_OUTPUT, 4) /* (AG24) PRG1_PRU0_GPO13.RGMII1_TD2 */
14062306a36Sopenharmony_ci			J721E_IOPAD(0x3c, PIN_OUTPUT, 4) /* (AD24) PRG1_PRU0_GPO14.RGMII1_TD3 */
14162306a36Sopenharmony_ci			J721E_IOPAD(0x44, PIN_OUTPUT, 4) /* (AE24) PRG1_PRU0_GPO16.RGMII1_TXC */
14262306a36Sopenharmony_ci			J721E_IOPAD(0x40, PIN_OUTPUT, 4) /* (AC24) PRG1_PRU0_GPO15.RGMII1_TX_CTL */
14362306a36Sopenharmony_ci		>;
14462306a36Sopenharmony_ci	};
14562306a36Sopenharmony_ci
14662306a36Sopenharmony_ci	rgmii2_default_pins: rgmii2-default-pins {
14762306a36Sopenharmony_ci		pinctrl-single,pins = <
14862306a36Sopenharmony_ci			J721E_IOPAD(0x58, PIN_INPUT, 4) /* (AE22) PRG1_PRU1_GPO0.RGMII2_RD0 */
14962306a36Sopenharmony_ci			J721E_IOPAD(0x5c, PIN_INPUT, 4) /* (AG23) PRG1_PRU1_GPO1.RGMII2_RD1 */
15062306a36Sopenharmony_ci			J721E_IOPAD(0x60, PIN_INPUT, 4) /* (AF23) PRG1_PRU1_GPO2.RGMII2_RD2 */
15162306a36Sopenharmony_ci			J721E_IOPAD(0x64, PIN_INPUT, 4) /* (AD23) PRG1_PRU1_GPO3.RGMII2_RD3 */
15262306a36Sopenharmony_ci			J721E_IOPAD(0x70, PIN_INPUT, 4) /* (AE23) PRG1_PRU1_GPO6.RGMII2_RXC */
15362306a36Sopenharmony_ci			J721E_IOPAD(0x68, PIN_INPUT, 4) /* (AH24) PRG1_PRU1_GPO4.RGMII2_RX_CTL */
15462306a36Sopenharmony_ci			J721E_IOPAD(0x84, PIN_OUTPUT, 4) /* (AJ25) PRG1_PRU1_GPO11.RGMII2_TD0 */
15562306a36Sopenharmony_ci			J721E_IOPAD(0x88, PIN_OUTPUT, 4) /* (AH25) PRG1_PRU1_GPO12.RGMII2_TD1 */
15662306a36Sopenharmony_ci			J721E_IOPAD(0x8c, PIN_OUTPUT, 4) /* (AG25) PRG1_PRU1_GPO13.RGMII2_TD2 */
15762306a36Sopenharmony_ci			J721E_IOPAD(0x90, PIN_OUTPUT, 4) /* (AH26) PRG1_PRU1_GPO14.RGMII2_TD3 */
15862306a36Sopenharmony_ci			J721E_IOPAD(0x98, PIN_OUTPUT, 4) /* (AJ26) PRG1_PRU1_GPO16.RGMII2_TXC */
15962306a36Sopenharmony_ci			J721E_IOPAD(0x94, PIN_OUTPUT, 4) /* (AJ27) PRG1_PRU1_GPO15.RGMII2_TX_CTL */
16062306a36Sopenharmony_ci		>;
16162306a36Sopenharmony_ci	};
16262306a36Sopenharmony_ci
16362306a36Sopenharmony_ci	rgmii3_default_pins: rgmii3-default-pins {
16462306a36Sopenharmony_ci		pinctrl-single,pins = <
16562306a36Sopenharmony_ci			J721E_IOPAD(0xb0, PIN_INPUT, 4) /* (AF28) PRG0_PRU0_GPO0.RGMII3_RD0 */
16662306a36Sopenharmony_ci			J721E_IOPAD(0xb4, PIN_INPUT, 4) /* (AE28) PRG0_PRU0_GPO1.RGMII3_RD1 */
16762306a36Sopenharmony_ci			J721E_IOPAD(0xb8, PIN_INPUT, 4) /* (AE27) PRG0_PRU0_GPO2.RGMII3_RD2 */
16862306a36Sopenharmony_ci			J721E_IOPAD(0xbc, PIN_INPUT, 4) /* (AD26) PRG0_PRU0_GPO3.RGMII3_RD3 */
16962306a36Sopenharmony_ci			J721E_IOPAD(0xc8, PIN_INPUT, 4) /* (AE26) PRG0_PRU0_GPO6.RGMII3_RXC */
17062306a36Sopenharmony_ci			J721E_IOPAD(0xc0, PIN_INPUT, 4) /* (AD25) PRG0_PRU0_GPO4.RGMII3_RX_CTL */
17162306a36Sopenharmony_ci			J721E_IOPAD(0xdc, PIN_OUTPUT, 4) /* (AJ28) PRG0_PRU0_GPO11.RGMII3_TD0 */
17262306a36Sopenharmony_ci			J721E_IOPAD(0xe0, PIN_OUTPUT, 4) /* (AH27) PRG0_PRU0_GPO12.RGMII3_TD1 */
17362306a36Sopenharmony_ci			J721E_IOPAD(0xe4, PIN_OUTPUT, 4) /* (AH29) PRG0_PRU0_GPO13.RGMII3_TD2 */
17462306a36Sopenharmony_ci			J721E_IOPAD(0xe8, PIN_OUTPUT, 4) /* (AG28) PRG0_PRU0_GPO14.RGMII3_TD3 */
17562306a36Sopenharmony_ci			J721E_IOPAD(0xf0, PIN_OUTPUT, 4) /* (AH28) PRG0_PRU0_GPO16.RGMII3_TXC */
17662306a36Sopenharmony_ci			J721E_IOPAD(0xec, PIN_OUTPUT, 4) /* (AG27) PRG0_PRU0_GPO15.RGMII3_TX_CTL */
17762306a36Sopenharmony_ci		>;
17862306a36Sopenharmony_ci	};
17962306a36Sopenharmony_ci
18062306a36Sopenharmony_ci	rgmii4_default_pins: rgmii4-default-pins {
18162306a36Sopenharmony_ci		pinctrl-single,pins = <
18262306a36Sopenharmony_ci			J721E_IOPAD(0x100, PIN_INPUT, 4) /* (AE29) PRG0_PRU1_GPO0.RGMII4_RD0 */
18362306a36Sopenharmony_ci			J721E_IOPAD(0x104, PIN_INPUT, 4) /* (AD28) PRG0_PRU1_GPO1.RGMII4_RD1 */
18462306a36Sopenharmony_ci			J721E_IOPAD(0x108, PIN_INPUT, 4) /* (AD27) PRG0_PRU1_GPO2.RGMII4_RD2 */
18562306a36Sopenharmony_ci			J721E_IOPAD(0x10c, PIN_INPUT, 4) /* (AC25) PRG0_PRU1_GPO3.RGMII4_RD3 */
18662306a36Sopenharmony_ci			J721E_IOPAD(0x118, PIN_INPUT, 4) /* (AC26) PRG0_PRU1_GPO6.RGMII4_RXC */
18762306a36Sopenharmony_ci			J721E_IOPAD(0x110, PIN_INPUT, 4) /* (AD29) PRG0_PRU1_GPO4.RGMII4_RX_CTL */
18862306a36Sopenharmony_ci			J721E_IOPAD(0x12c, PIN_OUTPUT, 4) /* (AG26) PRG0_PRU1_GPO11.RGMII4_TD0 */
18962306a36Sopenharmony_ci			J721E_IOPAD(0x130, PIN_OUTPUT, 4) /* (AF27) PRG0_PRU1_GPO12.RGMII4_TD1 */
19062306a36Sopenharmony_ci			J721E_IOPAD(0x134, PIN_OUTPUT, 4) /* (AF26) PRG0_PRU1_GPO13.RGMII4_TD2 */
19162306a36Sopenharmony_ci			J721E_IOPAD(0x138, PIN_OUTPUT, 4) /* (AE25) PRG0_PRU1_GPO14.RGMII4_TD3 */
19262306a36Sopenharmony_ci			J721E_IOPAD(0x140, PIN_OUTPUT, 4) /* (AG29) PRG0_PRU1_GPO16.RGMII4_TXC */
19362306a36Sopenharmony_ci			J721E_IOPAD(0x13c, PIN_OUTPUT, 4) /* (AF29) PRG0_PRU1_GPO15.RGMII4_TX_CTL */
19462306a36Sopenharmony_ci		>;
19562306a36Sopenharmony_ci	};
19662306a36Sopenharmony_ci};
197