2020-09-10 22:26:36

by Grygorii Strashko

[permalink] [raw]
Subject: [PATCH next 0/3] ARM: dts: am437x: switch to new cpsw switch drv

Hi Tony,

Since Kernel v5.5 commits:
111cf1ab4da3 ("net: ethernet: ti: introduce cpsw switchdev based driver part 2 - switch")
ed3525eda4c4 ("net: ethernet: ti: introduce cpsw switchdev based driver part 1 - dual-emac")
the new CPSW driver with switchdev support has been introduced and one
am571x-idk board was converted to use it. And since that time (Nov 2019) no
significant issues were reported for the new CPSW driver.

Therefore it's time to switch all am437x boards to use new cpsw switch
driver. Those boards have 1 or 2 Ext. ports wired and configured in dual_mac mode
by default. The dual_mac mode has been preserved the same way between
legacy and new driver, and one port devices works the same as 1 dual_mac port,
so it's safe to switch drivers.

Grygorii Strashko (3):
ARM: dts: am437x-l4: add dt node for new cpsw switchdev driver
ARM: dts: am437x: switch to new cpsw switch drv
ARM: dts: am437x-l4: drop legacy cpsw dt node

arch/arm/boot/dts/am4372.dtsi | 4 +-
arch/arm/boot/dts/am437x-cm-t43.dts | 14 +++--
arch/arm/boot/dts/am437x-gp-evm.dts | 13 +++--
arch/arm/boot/dts/am437x-idk-evm.dts | 13 +++--
arch/arm/boot/dts/am437x-l4.dtsi | 77 +++++++++++++++-------------
arch/arm/boot/dts/am437x-sk-evm.dts | 14 +++--
arch/arm/boot/dts/am43x-epos-evm.dts | 13 +++--
7 files changed, 78 insertions(+), 70 deletions(-)

--
2.17.1


2020-09-10 22:26:55

by Grygorii Strashko

[permalink] [raw]
Subject: [PATCH next 1/3] ARM: dts: am437x-l4: add dt node for new cpsw switchdev driver

Add DT node for the new cpsw switchdev based driver.

Signed-off-by: Grygorii Strashko <[email protected]>
---
arch/arm/boot/dts/am437x-l4.dtsi | 54 ++++++++++++++++++++++++++++++++
1 file changed, 54 insertions(+)

diff --git a/arch/arm/boot/dts/am437x-l4.dtsi b/arch/arm/boot/dts/am437x-l4.dtsi
index 3d393fe252c6..e702e9576115 100644
--- a/arch/arm/boot/dts/am437x-l4.dtsi
+++ b/arch/arm/boot/dts/am437x-l4.dtsi
@@ -571,6 +571,60 @@
phys = <&phy_gmii_sel 2 0>;
};
};
+
+ mac_sw: switch@0 {
+ compatible = "ti,am4372-cpsw","ti,cpsw-switch";
+ reg = <0x0 0x4000>;
+ ranges = <0 0 0x4000>;
+ clocks = <&cpsw_125mhz_gclk>, <&dpll_clksel_mac_clk>;
+ clock-names = "fck", "50mclk";
+ assigned-clocks = <&dpll_clksel_mac_clk>;
+ assigned-clock-rates = <50000000>;
+ #address-cells = <1>;
+ #size-cells = <1>;
+ syscon = <&scm_conf>;
+ status = "disabled";
+
+ interrupts = <GIC_SPI 40 IRQ_TYPE_LEVEL_HIGH
+ GIC_SPI 41 IRQ_TYPE_LEVEL_HIGH
+ GIC_SPI 42 IRQ_TYPE_LEVEL_HIGH
+ GIC_SPI 43 IRQ_TYPE_LEVEL_HIGH>;
+ interrupt-names = "rx_thresh", "rx", "tx", "misc";
+
+ ethernet-ports {
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ cpsw_port1: port@1 {
+ reg = <1>;
+ label = "port1";
+ mac-address = [ 00 00 00 00 00 00 ];
+ phys = <&phy_gmii_sel 1 0>;
+ };
+
+ cpsw_port2: port@2 {
+ reg = <2>;
+ label = "port2";
+ mac-address = [ 00 00 00 00 00 00 ];
+ phys = <&phy_gmii_sel 2 0>;
+ };
+ };
+
+ davinci_mdio_sw: mdio@1000 {
+ compatible = "ti,am4372-mdio", "ti,cpsw-mdio","ti,davinci_mdio";
+ clocks = <&cpsw_125mhz_gclk>;
+ clock-names = "fck";
+ #address-cells = <1>;
+ #size-cells = <0>;
+ bus_freq = <1000000>;
+ reg = <0x1000 0x100>;
+ };
+
+ cpts {
+ clocks = <&cpsw_cpts_rft_clk>;
+ clock-names = "cpts";
+ };
+ };
};

target-module@200000 { /* 0x4a200000, ap 7 02.0 */
--
2.17.1

2020-09-10 22:28:00

by Grygorii Strashko

[permalink] [raw]
Subject: [PATCH next 3/3] ARM: dts: am437x-l4: drop legacy cpsw dt node

All am437x boards have been converted to use new driver, so drop legacy
cpsw dt node.

Signed-off-by: Grygorii Strashko <[email protected]>
---
arch/arm/boot/dts/am437x-l4.dtsi | 51 --------------------------------
1 file changed, 51 deletions(-)

diff --git a/arch/arm/boot/dts/am437x-l4.dtsi b/arch/arm/boot/dts/am437x-l4.dtsi
index e702e9576115..d82a6eeaf1b3 100644
--- a/arch/arm/boot/dts/am437x-l4.dtsi
+++ b/arch/arm/boot/dts/am437x-l4.dtsi
@@ -521,57 +521,6 @@
#size-cells = <1>;
ranges = <0x0 0x100000 0x8000>;

- mac: ethernet@0 {
- compatible = "ti,am4372-cpsw","ti,cpsw";
- reg = <0x0 0x800
- 0x1200 0x100>;
- interrupts = <GIC_SPI 40 IRQ_TYPE_LEVEL_HIGH
- GIC_SPI 41 IRQ_TYPE_LEVEL_HIGH
- GIC_SPI 42 IRQ_TYPE_LEVEL_HIGH
- GIC_SPI 43 IRQ_TYPE_LEVEL_HIGH>;
- #address-cells = <1>;
- #size-cells = <1>;
- clocks = <&cpsw_125mhz_gclk>, <&cpsw_cpts_rft_clk>,
- <&dpll_clksel_mac_clk>;
- clock-names = "fck", "cpts", "50mclk";
- assigned-clocks = <&dpll_clksel_mac_clk>;
- assigned-clock-rates = <50000000>;
- status = "disabled";
- cpdma_channels = <8>;
- ale_entries = <1024>;
- bd_ram_size = <0x2000>;
- mac_control = <0x20>;
- slaves = <2>;
- active_slave = <0>;
- cpts_clock_mult = <0x80000000>;
- cpts_clock_shift = <29>;
- ranges = <0 0 0x8000>;
- syscon = <&scm_conf>;
-
- davinci_mdio: mdio@1000 {
- compatible = "ti,am4372-mdio","ti,cpsw-mdio","ti,davinci_mdio";
- reg = <0x1000 0x100>;
- clocks = <&cpsw_125mhz_clkctrl AM4_CPSW_125MHZ_CPGMAC0_CLKCTRL 0>;
- clock-names = "fck";
- #address-cells = <1>;
- #size-cells = <0>;
- bus_freq = <1000000>;
- status = "disabled";
- };
-
- cpsw_emac0: slave@200 {
- /* Filled in by U-Boot */
- mac-address = [ 00 00 00 00 00 00 ];
- phys = <&phy_gmii_sel 1 0>;
- };
-
- cpsw_emac1: slave@300 {
- /* Filled in by U-Boot */
- mac-address = [ 00 00 00 00 00 00 ];
- phys = <&phy_gmii_sel 2 0>;
- };
- };
-
mac_sw: switch@0 {
compatible = "ti,am4372-cpsw","ti,cpsw-switch";
reg = <0x0 0x4000>;
--
2.17.1

2020-09-10 22:29:27

by Grygorii Strashko

[permalink] [raw]
Subject: [PATCH next 2/3] ARM: dts: am437x: switch to new cpsw switch drv

The dual_mac mode has been preserved the same way between legacy and new
driver, and one port devices works the same as 1 dual_mac port - it's safe
to switch drivers.
So, Switch all am437x boards to use new cpsw switch driver. Those boards
have or 2 Ext. port wired and configured in dual_mac mode by default, or
only 1 Ext. port.

Signed-off-by: Grygorii Strashko <[email protected]>
---
arch/arm/boot/dts/am4372.dtsi | 4 ++--
arch/arm/boot/dts/am437x-cm-t43.dts | 14 ++++++--------
arch/arm/boot/dts/am437x-gp-evm.dts | 13 ++++++++-----
arch/arm/boot/dts/am437x-idk-evm.dts | 13 ++++++++-----
arch/arm/boot/dts/am437x-sk-evm.dts | 14 ++++++--------
arch/arm/boot/dts/am43x-epos-evm.dts | 13 ++++++++-----
6 files changed, 38 insertions(+), 33 deletions(-)

diff --git a/arch/arm/boot/dts/am4372.dtsi b/arch/arm/boot/dts/am4372.dtsi
index 14314046256c..38a7dd64f8df 100644
--- a/arch/arm/boot/dts/am4372.dtsi
+++ b/arch/arm/boot/dts/am4372.dtsi
@@ -35,8 +35,8 @@
serial3 = &uart3;
serial4 = &uart4;
serial5 = &uart5;
- ethernet0 = &cpsw_emac0;
- ethernet1 = &cpsw_emac1;
+ ethernet0 = &cpsw_port1;
+ ethernet1 = &cpsw_port2;
spi0 = &qspi;
};

diff --git a/arch/arm/boot/dts/am437x-cm-t43.dts b/arch/arm/boot/dts/am437x-cm-t43.dts
index a6b4fca8626a..a83f46ed0c9a 100644
--- a/arch/arm/boot/dts/am437x-cm-t43.dts
+++ b/arch/arm/boot/dts/am437x-cm-t43.dts
@@ -325,17 +325,15 @@
};
};

-&mac {
+&mac_sw {
pinctrl-names = "default";
pinctrl-0 = <&cpsw_default>;
- dual_emac = <1>;
status = "okay";
};

-&davinci_mdio {
+&davinci_mdio_sw {
pinctrl-names = "default";
pinctrl-0 = <&davinci_mdio_default>;
- status = "okay";

ethphy0: ethernet-phy@0 {
reg = <0>;
@@ -346,16 +344,16 @@
};
};

-&cpsw_emac0 {
+&cpsw_port1 {
phy-handle = <&ethphy0>;
phy-mode = "rgmii-txid";
- dual_emac_res_vlan = <1>;
+ ti,dual-emac-pvid = <1>;
};

-&cpsw_emac1 {
+&cpsw_port2 {
phy-handle = <&ethphy1>;
phy-mode = "rgmii-txid";
- dual_emac_res_vlan = <2>;
+ ti,dual-emac-pvid = <2>;
};

&dwc3_1 {
diff --git a/arch/arm/boot/dts/am437x-gp-evm.dts b/arch/arm/boot/dts/am437x-gp-evm.dts
index b28e5c8cd02a..e4a1d7d87b1e 100644
--- a/arch/arm/boot/dts/am437x-gp-evm.dts
+++ b/arch/arm/boot/dts/am437x-gp-evm.dts
@@ -906,28 +906,31 @@
status = "okay";
};

-&mac {
- slaves = <1>;
+&mac_sw {
pinctrl-names = "default", "sleep";
pinctrl-0 = <&cpsw_default>;
pinctrl-1 = <&cpsw_sleep>;
status = "okay";
};

-&davinci_mdio {
+&davinci_mdio_sw {
pinctrl-names = "default", "sleep";
pinctrl-0 = <&davinci_mdio_default>;
pinctrl-1 = <&davinci_mdio_sleep>;
- status = "okay";

ethphy0: ethernet-phy@0 {
reg = <0>;
};
};

-&cpsw_emac0 {
+&cpsw_port1 {
phy-handle = <&ethphy0>;
phy-mode = "rgmii-rxid";
+ ti,dual-emac-pvid = <1>;
+};
+
+&cpsw_port2 {
+ status = "disabled";
};

&elm {
diff --git a/arch/arm/boot/dts/am437x-idk-evm.dts b/arch/arm/boot/dts/am437x-idk-evm.dts
index 8b986c45f09d..2dc525512266 100644
--- a/arch/arm/boot/dts/am437x-idk-evm.dts
+++ b/arch/arm/boot/dts/am437x-idk-evm.dts
@@ -483,28 +483,31 @@
};
};

-&mac {
- slaves = <1>;
+&mac_sw {
pinctrl-names = "default", "sleep";
pinctrl-0 = <&cpsw_default>;
pinctrl-1 = <&cpsw_sleep>;
status = "okay";
};

-&davinci_mdio {
+&davinci_mdio_sw {
pinctrl-names = "default", "sleep";
pinctrl-0 = <&davinci_mdio_default>;
pinctrl-1 = <&davinci_mdio_sleep>;
- status = "okay";

ethphy0: ethernet-phy@0 {
reg = <0>;
};
};

-&cpsw_emac0 {
+&cpsw_port1 {
phy-handle = <&ethphy0>;
phy-mode = "rgmii-rxid";
+ ti,dual-emac-pvid = <1>;
+};
+
+&cpsw_port2 {
+ status = "disabled";
};

&rtc {
diff --git a/arch/arm/boot/dts/am437x-sk-evm.dts b/arch/arm/boot/dts/am437x-sk-evm.dts
index 5fffdce853b1..496ed34f7755 100644
--- a/arch/arm/boot/dts/am437x-sk-evm.dts
+++ b/arch/arm/boot/dts/am437x-sk-evm.dts
@@ -792,19 +792,17 @@
};
};

-&mac {
+&mac_sw {
pinctrl-names = "default", "sleep";
pinctrl-0 = <&cpsw_default>;
pinctrl-1 = <&cpsw_sleep>;
- dual_emac = <1>;
status = "okay";
};

-&davinci_mdio {
+&davinci_mdio_sw {
pinctrl-names = "default", "sleep";
pinctrl-0 = <&davinci_mdio_default>;
pinctrl-1 = <&davinci_mdio_sleep>;
- status = "okay";

ethphy0: ethernet-phy@4 {
reg = <4>;
@@ -815,16 +813,16 @@
};
};

-&cpsw_emac0 {
+&cpsw_port1 {
phy-handle = <&ethphy0>;
phy-mode = "rgmii-rxid";
- dual_emac_res_vlan = <1>;
+ ti,dual-emac-pvid = <1>;
};

-&cpsw_emac1 {
+&cpsw_port2 {
phy-handle = <&ethphy1>;
phy-mode = "rgmii-rxid";
- dual_emac_res_vlan = <2>;
+ ti,dual-emac-pvid = <2>;
};

&elm {
diff --git a/arch/arm/boot/dts/am43x-epos-evm.dts b/arch/arm/boot/dts/am43x-epos-evm.dts
index de4fc78498a0..a242282466e5 100644
--- a/arch/arm/boot/dts/am43x-epos-evm.dts
+++ b/arch/arm/boot/dts/am43x-epos-evm.dts
@@ -550,29 +550,32 @@
cd-gpios = <&gpio0 6 GPIO_ACTIVE_LOW>;
};

-&mac {
+&mac_sw {
pinctrl-names = "default", "sleep";
pinctrl-0 = <&cpsw_default>;
pinctrl-1 = <&cpsw_sleep>;
status = "okay";
- slaves = <1>;
};

-&davinci_mdio {
+&davinci_mdio_sw {
pinctrl-names = "default", "sleep";
pinctrl-0 = <&davinci_mdio_default>;
pinctrl-1 = <&davinci_mdio_sleep>;
- status = "okay";

ethphy0: ethernet-phy@16 {
reg = <16>;
};
};

-&cpsw_emac0 {
+&cpsw_port1 {
phy-handle = <&ethphy0>;
phy-mode = "rmii";
phys = <&phy_gmii_sel 1 1>;
+ ti,dual-emac-pvid = <1>;
+};
+
+&cpsw_port2 {
+ status = "disabled";
};

&i2c0 {
--
2.17.1

2020-09-25 11:34:57

by Tony Lindgren

[permalink] [raw]
Subject: Re: [PATCH next 0/3] ARM: dts: am437x: switch to new cpsw switch drv

* Grygorii Strashko <[email protected]> [200911 01:25]:
> Hi Tony,
>
> Since Kernel v5.5 commits:
> 111cf1ab4da3 ("net: ethernet: ti: introduce cpsw switchdev based driver part 2 - switch")
> ed3525eda4c4 ("net: ethernet: ti: introduce cpsw switchdev based driver part 1 - dual-emac")
> the new CPSW driver with switchdev support has been introduced and one
> am571x-idk board was converted to use it. And since that time (Nov 2019) no
> significant issues were reported for the new CPSW driver.
>
> Therefore it's time to switch all am437x boards to use new cpsw switch
> driver. Those boards have 1 or 2 Ext. ports wired and configured in dual_mac mode
> by default. The dual_mac mode has been preserved the same way between
> legacy and new driver, and one port devices works the same as 1 dual_mac port,
> so it's safe to switch drivers.

Thanks applying into omap-for-v5.10/dt.

Tony