AM64 as CPSW3G IP with 2 external ports. Add DT entries for the same
(based on kernel DT).

Disable second port as its by default set to ICSS usage on EVM.

Signed-off-by: Vignesh Raghavendra <vigne...@ti.com>
---
 arch/arm/dts/k3-am64-main.dtsi        | 74 +++++++++++++++++++++
 arch/arm/dts/k3-am64.dtsi             |  2 +
 arch/arm/dts/k3-am642-evm-u-boot.dtsi | 16 +++++
 arch/arm/dts/k3-am642-evm.dts         | 93 +++++++++++++++++++++++++++
 4 files changed, 185 insertions(+)

diff --git a/arch/arm/dts/k3-am64-main.dtsi b/arch/arm/dts/k3-am64-main.dtsi
index 4b6cd6cc90..a65011b396 100644
--- a/arch/arm/dts/k3-am64-main.dtsi
+++ b/arch/arm/dts/k3-am64-main.dtsi
@@ -178,6 +178,12 @@
                        compatible = "ti,am654-chipid";
                        reg = <0x00000014 0x4>;
                };
+
+               phy_gmii_sel: phy@4044 {
+                       compatible = "ti,am654-phy-gmii-sel";
+                       reg = <0x4044 0x8>;
+                       #phy-cells = <1>;
+               };
        };
 
        main_uart0: serial@2800000 {
@@ -403,6 +409,74 @@
                ti,clkbuf-sel = <0x7>;
        };
 
+       cpsw3g: ethernet@8000000 {
+               compatible = "ti,am642-cpsw-nuss";
+               #address-cells = <2>;
+               #size-cells = <2>;
+               reg = <0x0 0x8000000 0x0 0x200000>;
+               reg-names = "cpsw_nuss";
+               ranges = <0x0 0x0 0x0 0x8000000 0x0 0x200000>;
+               clocks = <&k3_clks 13 0>;
+               assigned-clocks = <&k3_clks 13 1>;
+               assigned-clock-parents = <&k3_clks 13 9>;
+               clock-names = "fck";
+               power-domains = <&k3_pds 13 TI_SCI_PD_EXCLUSIVE>;
+
+               dmas = <&main_pktdma 0xC500 15>,
+                      <&main_pktdma 0xC501 15>,
+                      <&main_pktdma 0xC502 15>,
+                      <&main_pktdma 0xC503 15>,
+                      <&main_pktdma 0xC504 15>,
+                      <&main_pktdma 0xC505 15>,
+                      <&main_pktdma 0xC506 15>,
+                      <&main_pktdma 0xC507 15>,
+                      <&main_pktdma 0x4500 15>;
+               dma-names = "tx0", "tx1", "tx2", "tx3", "tx4", "tx5", "tx6",
+                           "tx7", "rx";
+
+               ethernet-ports {
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+
+                       cpsw_port1: port@1 {
+                               reg = <1>;
+                               ti,mac-only;
+                               label = "port1";
+                               phys = <&phy_gmii_sel 1>;
+                               mac-address = [00 00 de ad be ef];
+                       };
+
+                       cpsw_port2: port@2 {
+                               reg = <2>;
+                               ti,mac-only;
+                               label = "port2";
+                               phys = <&phy_gmii_sel 2>;
+                               mac-address = [00 01 de ad be ef];
+                       };
+               };
+
+               cpsw3g_mdio: mdio@f00 {
+                       compatible = "ti,cpsw-mdio","ti,davinci_mdio";
+                       reg = <0x0 0xf00 0x0 0x100>;
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       clocks = <&k3_clks 13 0>;
+                       clock-names = "fck";
+                       bus_freq = <1000000>;
+               };
+
+               cpts@3d000 {
+                       compatible = "ti,j721e-cpts";
+                       reg = <0x0 0x3d000 0x0 0x400>;
+                       clocks = <&k3_clks 13 1>;
+                       clock-names = "cpts";
+                       interrupts-extended = <&gic500 GIC_SPI 102 
IRQ_TYPE_LEVEL_HIGH>;
+                       interrupt-names = "cpts";
+                       ti,cpts-ext-ts-inputs = <4>;
+                       ti,cpts-periodic-outputs = <2>;
+               };
+       };
+
        main_gpio0: gpio@600000 {
                compatible = "ti,j721e-gpio", "ti,keystone-gpio";
                reg = <0x00 0x00600000 0x00 0x100>;
diff --git a/arch/arm/dts/k3-am64.dtsi b/arch/arm/dts/k3-am64.dtsi
index fde63463ca..6b2d0803b4 100644
--- a/arch/arm/dts/k3-am64.dtsi
+++ b/arch/arm/dts/k3-am64.dtsi
@@ -30,6 +30,8 @@
                serial8 = &main_uart6;
                i2c0 = &main_i2c0;
                i2c1 = &main_i2c1;
+               ethernet0 = &cpsw_port1;
+               ethernet1 = &cpsw_port2;
        };
 
        chosen { };
diff --git a/arch/arm/dts/k3-am642-evm-u-boot.dtsi 
b/arch/arm/dts/k3-am642-evm-u-boot.dtsi
index 3bab736a18..5e0e41567f 100644
--- a/arch/arm/dts/k3-am642-evm-u-boot.dtsi
+++ b/arch/arm/dts/k3-am642-evm-u-boot.dtsi
@@ -81,3 +81,19 @@
 &sdhci1 {
        u-boot,dm-spl;
 };
+
+&cpsw3g {
+       reg = <0x0 0x8000000 0x0 0x200000>,
+             <0x0 0x43000200 0x0 0x8>;
+       reg-names = "cpsw_nuss", "mac_efuse";
+       /delete-property/ ranges;
+
+       cpsw-phy-sel@04044 {
+               compatible = "ti,am64-phy-gmii-sel";
+               reg = <0x0 0x43004044 0x0 0x8>;
+       };
+};
+
+&cpsw_port2 {
+       status = "disabled";
+};
diff --git a/arch/arm/dts/k3-am642-evm.dts b/arch/arm/dts/k3-am642-evm.dts
index 1f1787750f..dc3482bea4 100644
--- a/arch/arm/dts/k3-am642-evm.dts
+++ b/arch/arm/dts/k3-am642-evm.dts
@@ -6,6 +6,8 @@
 /dts-v1/;
 
 #include <dt-bindings/leds/common.h>
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/net/ti-dp83867.h>
 #include "k3-am642.dtsi"
 
 / {
@@ -101,6 +103,31 @@
                        default-state = "off";
                };
        };
+
+       mdio_mux: mux-controller {
+               compatible = "gpio-mux";
+               #mux-control-cells = <0>;
+
+               mux-gpios = <&exp1 12 GPIO_ACTIVE_HIGH>;
+       };
+
+       mdio-mux-1 {
+               compatible = "mdio-mux-multiplexer";
+               mux-controls = <&mdio_mux>;
+               mdio-parent-bus = <&cpsw3g_mdio>;
+               #address-cells = <1>;
+               #size-cells = <0>;
+
+               mdio@1 {
+                       reg = <0x1>;
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+
+                       cpsw3g_phy3: ethernet-phy@3 {
+                               reg = <3>;
+                       };
+               };
+       };
 };
 
 &main_pmx0 {
@@ -133,6 +160,47 @@
                        AM64X_IOPAD(0x026c, PIN_INPUT_PULLUP, 0) /* (B19) 
I2C1_SDA */
                >;
        };
+
+       mdio1_pins_default: mdio1-pins-default {
+               pinctrl-single,pins = <
+                       AM64X_IOPAD(0x01fc, PIN_OUTPUT, 4) /* (R2) 
PRG0_PRU1_GPO19.MDIO0_MDC */
+                       AM64X_IOPAD(0x01f8, PIN_INPUT, 4) /* (P5) 
PRG0_PRU1_GPO18.MDIO0_MDIO */
+               >;
+       };
+
+       rgmii1_pins_default: rgmii1-pins-default {
+               pinctrl-single,pins = <
+                       AM64X_IOPAD(0x01cc, PIN_INPUT, 4) /* (W5) 
PRG0_PRU1_GPO7.RGMII1_RD0 */
+                       AM64X_IOPAD(0x01d4, PIN_INPUT, 4) /* (Y5) 
PRG0_PRU1_GPO9.RGMII1_RD1 */
+                       AM64X_IOPAD(0x01d8, PIN_INPUT, 4) /* (V6) 
PRG0_PRU1_GPO10.RGMII1_RD2 */
+                       AM64X_IOPAD(0x01f4, PIN_INPUT, 4) /* (V5) 
PRG0_PRU1_GPO17.RGMII1_RD3 */
+                       AM64X_IOPAD(0x0188, PIN_INPUT, 4) /* (AA5) 
PRG0_PRU0_GPO10.RGMII1_RXC */
+                       AM64X_IOPAD(0x0184, PIN_INPUT, 4) /* (W6) 
PRG0_PRU0_GPO9.RGMII1_RX_CTL */
+                       AM64X_IOPAD(0x0124, PIN_OUTPUT, 4) /* (V15) 
PRG1_PRU1_GPO7.RGMII1_TD0 */
+                       AM64X_IOPAD(0x012c, PIN_OUTPUT, 4) /* (V14) 
PRG1_PRU1_GPO9.RGMII1_TD1 */
+                       AM64X_IOPAD(0x0130, PIN_OUTPUT, 4) /* (W14) 
PRG1_PRU1_GPO10.RGMII1_TD2 */
+                       AM64X_IOPAD(0x014c, PIN_OUTPUT, 4) /* (AA14) 
PRG1_PRU1_GPO17.RGMII1_TD3 */
+                       AM64X_IOPAD(0x00e0, PIN_OUTPUT, 4) /* (U14) 
PRG1_PRU0_GPO10.RGMII1_TXC */
+                       AM64X_IOPAD(0x00dc, PIN_OUTPUT, 4) /* (U15) 
PRG1_PRU0_GPO9.RGMII1_TX_CTL */
+               >;
+       };
+
+       rgmii2_pins_default: rgmii2-pins-default {
+               pinctrl-single,pins = <
+                       AM64X_IOPAD(0x0108, PIN_INPUT, 4) /* (W11) 
PRG1_PRU1_GPO0.RGMII2_RD0 */
+                       AM64X_IOPAD(0x010c, PIN_INPUT, 4) /* (V11) 
PRG1_PRU1_GPO1.RGMII2_RD1 */
+                       AM64X_IOPAD(0x0110, PIN_INPUT, 4) /* (AA12) 
PRG1_PRU1_GPO2.RGMII2_RD2 */
+                       AM64X_IOPAD(0x0114, PIN_INPUT, 4) /* (Y12) 
PRG1_PRU1_GPO3.RGMII2_RD3 */
+                       AM64X_IOPAD(0x0120, PIN_INPUT, 4) /* (U11) 
PRG1_PRU1_GPO6.RGMII2_RXC */
+                       AM64X_IOPAD(0x0118, PIN_INPUT, 4) /* (W12) 
PRG1_PRU1_GPO4.RGMII2_RX_CTL */
+                       AM64X_IOPAD(0x0134, PIN_OUTPUT, 4) /* (AA10) 
PRG1_PRU1_GPO11.RGMII2_TD0 */
+                       AM64X_IOPAD(0x0138, PIN_OUTPUT, 4) /* (V10) 
PRG1_PRU1_GPO12.RGMII2_TD1 */
+                       AM64X_IOPAD(0x013c, PIN_OUTPUT, 4) /* (U10) 
PRG1_PRU1_GPO13.RGMII2_TD2 */
+                       AM64X_IOPAD(0x0140, PIN_OUTPUT, 4) /* (AA11) 
PRG1_PRU1_GPO14.RGMII2_TD3 */
+                       AM64X_IOPAD(0x0148, PIN_OUTPUT, 4) /* (Y10) 
PRG1_PRU1_GPO16.RGMII2_TXC */
+                       AM64X_IOPAD(0x0144, PIN_OUTPUT, 4) /* (Y11) 
PRG1_PRU1_GPO15.RGMII2_TX_CTL */
+               >;
+       };
 };
 
 &main_uart0 {
@@ -227,6 +295,31 @@
        status = "disabled";
 };
 
+&cpsw3g {
+       pinctrl-names = "default";
+       pinctrl-0 = <&mdio1_pins_default
+                    &rgmii1_pins_default
+                    &rgmii2_pins_default>;
+};
+
+&cpsw_port1 {
+       phy-mode = "rgmii-rxid";
+       phy-handle = <&cpsw3g_phy0>;
+};
+
+&cpsw_port2 {
+       phy-mode = "rgmii-rxid";
+       phy-handle = <&cpsw3g_phy3>;
+};
+
+&cpsw3g_mdio {
+       cpsw3g_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>;
+       };
+};
+
 &sdhci0 {
        /* emmc */
        bus-width = <8>;
-- 
2.31.1

Reply via email to