From: Michael Pratt Date: Wed, 31 Mar 2021 20:09:37 +0000 (-0400) Subject: ramips: mt7620: simplify DTS properties for GMAC X-Git-Tag: v22.03.0-rc1~2283 X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=953bfe2eb3b7236a72fa41ab2204fdaa9fd09f65;p=openwrt%2Fopenwrt.git ramips: mt7620: simplify DTS properties for GMAC There are only 2 options in the driver for the function of mt7620 internal switch port 4: EPHY mode (RJ-45, internal PHY) GMAC mode (RGMII, external PHY) Let the DTS property be boolean instead of string where EPHY mode is the default. Fix how the properties are written for all DTS that use them, and add missing nodes where applicable, and remove useless nodes, and minor DTS formatting. Signed-off-by: Michael Pratt --- diff --git a/target/linux/ramips/dts/mt7620a_alfa-network_ac1200rm.dts b/target/linux/ramips/dts/mt7620a_alfa-network_ac1200rm.dts index 27b6896cec..752a940cd8 100644 --- a/target/linux/ramips/dts/mt7620a_alfa-network_ac1200rm.dts +++ b/target/linux/ramips/dts/mt7620a_alfa-network_ac1200rm.dts @@ -72,10 +72,6 @@ status = "okay"; }; -&gsw { - mediatek,port4 = "ephy"; -}; - &ohci { status = "okay"; }; diff --git a/target/linux/ramips/dts/mt7620a_alfa-network_r36m-e4g.dts b/target/linux/ramips/dts/mt7620a_alfa-network_r36m-e4g.dts index 58386a9ac7..0991ae8447 100644 --- a/target/linux/ramips/dts/mt7620a_alfa-network_r36m-e4g.dts +++ b/target/linux/ramips/dts/mt7620a_alfa-network_r36m-e4g.dts @@ -141,10 +141,6 @@ status = "okay"; }; -&gsw { - mediatek,port4 = "ephy"; -}; - &i2c { status = "okay"; }; diff --git a/target/linux/ramips/dts/mt7620a_alfa-network_tube-e4g.dts b/target/linux/ramips/dts/mt7620a_alfa-network_tube-e4g.dts index 30a0201c39..ca58d780f4 100644 --- a/target/linux/ramips/dts/mt7620a_alfa-network_tube-e4g.dts +++ b/target/linux/ramips/dts/mt7620a_alfa-network_tube-e4g.dts @@ -114,10 +114,6 @@ status = "okay"; }; -&gsw { - mediatek,port4 = "ephy"; -}; - &ohci { status = "okay"; }; diff --git a/target/linux/ramips/dts/mt7620a_asus_rp-n53.dts b/target/linux/ramips/dts/mt7620a_asus_rp-n53.dts index 3cb9142c38..4c72c64272 100644 --- a/target/linux/ramips/dts/mt7620a_asus_rp-n53.dts +++ b/target/linux/ramips/dts/mt7620a_asus_rp-n53.dts @@ -153,8 +153,7 @@ }; }; -&gsw { - mediatek,port4 = "ephy"; +ðernet { pinctrl-names = "default"; pinctrl-0 = <&ephy_pins>; }; diff --git a/target/linux/ramips/dts/mt7620a_buffalo_whr-1166d.dts b/target/linux/ramips/dts/mt7620a_buffalo_whr-1166d.dts index 196bbde726..93a09f99c3 100644 --- a/target/linux/ramips/dts/mt7620a_buffalo_whr-1166d.dts +++ b/target/linux/ramips/dts/mt7620a_buffalo_whr-1166d.dts @@ -157,10 +157,6 @@ }; }; -&gsw { - mediatek,port4 = "ephy"; -}; - &wmac { ralink,mtd-eeprom = <&factory 0x0>; }; diff --git a/target/linux/ramips/dts/mt7620a_buffalo_whr-300hp2.dts b/target/linux/ramips/dts/mt7620a_buffalo_whr-300hp2.dts index ed2e03d6cf..95152bc41a 100644 --- a/target/linux/ramips/dts/mt7620a_buffalo_whr-300hp2.dts +++ b/target/linux/ramips/dts/mt7620a_buffalo_whr-300hp2.dts @@ -144,10 +144,6 @@ mediatek,portmap = "llllw"; }; -&gsw { - mediatek,port4 = "ephy"; -}; - &wmac { ralink,mtd-eeprom = <&factory 0x0>; pinctrl-names = "default"; diff --git a/target/linux/ramips/dts/mt7620a_buffalo_whr-600d.dts b/target/linux/ramips/dts/mt7620a_buffalo_whr-600d.dts index b799a98e56..226967763b 100644 --- a/target/linux/ramips/dts/mt7620a_buffalo_whr-600d.dts +++ b/target/linux/ramips/dts/mt7620a_buffalo_whr-600d.dts @@ -144,10 +144,6 @@ mediatek,portmap = "llllw"; }; -&gsw { - mediatek,port4 = "ephy"; -}; - &wmac { ralink,mtd-eeprom = <&factory 0x0>; }; diff --git a/target/linux/ramips/dts/mt7620a_cameo_810.dtsi b/target/linux/ramips/dts/mt7620a_cameo_810.dtsi index c3f3267d38..70407449db 100644 --- a/target/linux/ramips/dts/mt7620a_cameo_810.dtsi +++ b/target/linux/ramips/dts/mt7620a_cameo_810.dtsi @@ -132,10 +132,6 @@ mediatek,portmap = "llllw"; }; -&gsw { - mediatek,port4 = "ephy"; -}; - &gpio2 { status = "okay"; }; diff --git a/target/linux/ramips/dts/mt7620a_dlink_dch-m225.dts b/target/linux/ramips/dts/mt7620a_dlink_dch-m225.dts index 63667da281..0c9f56875e 100644 --- a/target/linux/ramips/dts/mt7620a_dlink_dch-m225.dts +++ b/target/linux/ramips/dts/mt7620a_dlink_dch-m225.dts @@ -171,10 +171,6 @@ mtd-mac-address = <&factory 0x4>; }; -&gsw { - ralink,port4 = "ephy"; -}; - &wmac { ralink,mtd-eeprom = <&factory 0x0>; pinctrl-names = "default"; diff --git a/target/linux/ramips/dts/mt7620a_dlink_dir-510l.dts b/target/linux/ramips/dts/mt7620a_dlink_dir-510l.dts index f4db67648a..774d90c79d 100644 --- a/target/linux/ramips/dts/mt7620a_dlink_dir-510l.dts +++ b/target/linux/ramips/dts/mt7620a_dlink_dir-510l.dts @@ -120,10 +120,6 @@ }; }; -&gsw { - mediatek,port4 = "ephy"; -}; - &state_default { default { groups = "i2c", "uartf"; diff --git a/target/linux/ramips/dts/mt7620a_dlink_dwr-118-a1.dts b/target/linux/ramips/dts/mt7620a_dlink_dwr-118-a1.dts index bacebee8e1..71b532fc34 100644 --- a/target/linux/ramips/dts/mt7620a_dlink_dwr-118-a1.dts +++ b/target/linux/ramips/dts/mt7620a_dlink_dwr-118-a1.dts @@ -185,5 +185,5 @@ }; &gsw { - mediatek,port4 = "gmac"; + mediatek,port4-gmac; }; diff --git a/target/linux/ramips/dts/mt7620a_dlink_dwr-118-a2.dts b/target/linux/ramips/dts/mt7620a_dlink_dwr-118-a2.dts index 0b124e67de..9ea28706aa 100644 --- a/target/linux/ramips/dts/mt7620a_dlink_dwr-118-a2.dts +++ b/target/linux/ramips/dts/mt7620a_dlink_dwr-118-a2.dts @@ -173,6 +173,6 @@ }; &gsw { - mediatek,port4 = "gmac"; + mediatek,port4-gmac; mediatek,ephy-base-address = /bits/ 16 < 2 >; }; diff --git a/target/linux/ramips/dts/mt7620a_dovado_tiny-ac.dts b/target/linux/ramips/dts/mt7620a_dovado_tiny-ac.dts index 9450596f1b..068f75bd96 100644 --- a/target/linux/ramips/dts/mt7620a_dovado_tiny-ac.dts +++ b/target/linux/ramips/dts/mt7620a_dovado_tiny-ac.dts @@ -135,7 +135,7 @@ }; &gsw { - mediatek,port4 = "gmac"; + mediatek,port4-gmac; }; &pcie { diff --git a/target/linux/ramips/dts/mt7620a_edimax_br-6478ac-v2.dts b/target/linux/ramips/dts/mt7620a_edimax_br-6478ac-v2.dts index e7af34aa8e..2337c0f9d3 100644 --- a/target/linux/ramips/dts/mt7620a_edimax_br-6478ac-v2.dts +++ b/target/linux/ramips/dts/mt7620a_edimax_br-6478ac-v2.dts @@ -177,10 +177,6 @@ }; }; -&gsw { - mediatek,port4 = "gmac"; -}; - &wmac { ralink,mtd-eeprom = <&factory 0x0>; }; diff --git a/target/linux/ramips/dts/mt7620a_edimax_ew-7478apc.dts b/target/linux/ramips/dts/mt7620a_edimax_ew-7478apc.dts index 77d214e888..09763db388 100644 --- a/target/linux/ramips/dts/mt7620a_edimax_ew-7478apc.dts +++ b/target/linux/ramips/dts/mt7620a_edimax_ew-7478apc.dts @@ -169,10 +169,6 @@ }; }; -&gsw { - mediatek,port4 = "gmac"; -}; - &wmac { ralink,mtd-eeprom = <&factory 0x0>; }; diff --git a/target/linux/ramips/dts/mt7620a_edimax_ew-747x.dtsi b/target/linux/ramips/dts/mt7620a_edimax_ew-747x.dtsi index d17cc090c2..07b03f5c06 100644 --- a/target/linux/ramips/dts/mt7620a_edimax_ew-747x.dtsi +++ b/target/linux/ramips/dts/mt7620a_edimax_ew-747x.dtsi @@ -201,10 +201,6 @@ }; }; -&gsw { - mediatek,port5 = "gmac"; -}; - &wmac { ralink,mtd-eeprom = <&factory 0x0>; }; diff --git a/target/linux/ramips/dts/mt7620a_engenius_esr600.dts b/target/linux/ramips/dts/mt7620a_engenius_esr600.dts index b8fe2f8cdb..35d0b3dbec 100644 --- a/target/linux/ramips/dts/mt7620a_engenius_esr600.dts +++ b/target/linux/ramips/dts/mt7620a_engenius_esr600.dts @@ -155,7 +155,7 @@ 0x7c 0x0000007e /* PORT0 STATUS */ 0x0c 0x05600000 /* PORT6 PAD MODE CTRL */ 0x94 0x0000007e /* PORT6 STATUS */ - >; + >; }; }; }; diff --git a/target/linux/ramips/dts/mt7620a_fon_fon2601.dts b/target/linux/ramips/dts/mt7620a_fon_fon2601.dts index ee61c6e59e..b47d63be85 100644 --- a/target/linux/ramips/dts/mt7620a_fon_fon2601.dts +++ b/target/linux/ramips/dts/mt7620a_fon_fon2601.dts @@ -136,7 +136,7 @@ }; &gsw { - mediatek,port4 = "gmac"; + mediatek,port4-gmac; }; &wmac { diff --git a/target/linux/ramips/dts/mt7620a_head-weblink_hdrm200.dts b/target/linux/ramips/dts/mt7620a_head-weblink_hdrm200.dts index a0ebe4fff5..487f6aaf6e 100644 --- a/target/linux/ramips/dts/mt7620a_head-weblink_hdrm200.dts +++ b/target/linux/ramips/dts/mt7620a_head-weblink_hdrm200.dts @@ -149,6 +149,10 @@ }; }; +&gsw { + mediatek,port4-gmac; +}; + &wmac { ralink,mtd-eeprom = <&factory 0x0>; }; diff --git a/target/linux/ramips/dts/mt7620a_lenovo_newifi-y1s.dts b/target/linux/ramips/dts/mt7620a_lenovo_newifi-y1s.dts index a07683ed4a..0997d8a00e 100644 --- a/target/linux/ramips/dts/mt7620a_lenovo_newifi-y1s.dts +++ b/target/linux/ramips/dts/mt7620a_lenovo_newifi-y1s.dts @@ -111,5 +111,5 @@ }; &gsw { - mediatek,port4 = "gmac"; + mediatek,port4-gmac; }; diff --git a/target/linux/ramips/dts/mt7620a_linksys_e1700.dts b/target/linux/ramips/dts/mt7620a_linksys_e1700.dts index 2619a4653a..2672d54f36 100644 --- a/target/linux/ramips/dts/mt7620a_linksys_e1700.dts +++ b/target/linux/ramips/dts/mt7620a_linksys_e1700.dts @@ -144,10 +144,6 @@ }; }; -&gsw { - mediatek,port4 = "gmac"; -}; - &wmac { ralink,mtd-eeprom = <&factory 0x0>; }; diff --git a/target/linux/ramips/dts/mt7620a_ohyeah_oy-0001.dts b/target/linux/ramips/dts/mt7620a_ohyeah_oy-0001.dts index 07f606fce4..7dabbed9ba 100644 --- a/target/linux/ramips/dts/mt7620a_ohyeah_oy-0001.dts +++ b/target/linux/ramips/dts/mt7620a_ohyeah_oy-0001.dts @@ -103,10 +103,6 @@ mediatek,portmap = "llllw"; }; -&gsw { - mediatek,port4 = "ephy"; -}; - &wmac { ralink,mtd-eeprom = <&factory 0x0>; }; diff --git a/target/linux/ramips/dts/mt7620a_planex_cs-qr10.dts b/target/linux/ramips/dts/mt7620a_planex_cs-qr10.dts index aa7ddb0a25..3edc41ac0d 100644 --- a/target/linux/ramips/dts/mt7620a_planex_cs-qr10.dts +++ b/target/linux/ramips/dts/mt7620a_planex_cs-qr10.dts @@ -122,10 +122,6 @@ mediatek,portmap = "llllw"; }; -&gsw { - ralink,port4 = "ephy"; -}; - &sdhci { status = "okay"; }; diff --git a/target/linux/ramips/dts/mt7620a_planex_db-wrt01.dts b/target/linux/ramips/dts/mt7620a_planex_db-wrt01.dts index eb373e9aa2..8f8f173de3 100644 --- a/target/linux/ramips/dts/mt7620a_planex_db-wrt01.dts +++ b/target/linux/ramips/dts/mt7620a_planex_db-wrt01.dts @@ -94,10 +94,6 @@ mediatek,portmap = "llllw"; }; -&gsw { - mediatek,port4 = "ephy"; -}; - &wmac { ralink,mtd-eeprom = <&factory 0x0>; }; diff --git a/target/linux/ramips/dts/mt7620a_planex_mzk-750dhp.dts b/target/linux/ramips/dts/mt7620a_planex_mzk-750dhp.dts index df9c9689c3..e1c5568ed8 100644 --- a/target/linux/ramips/dts/mt7620a_planex_mzk-750dhp.dts +++ b/target/linux/ramips/dts/mt7620a_planex_mzk-750dhp.dts @@ -114,10 +114,6 @@ mediatek,portmap = "llllw"; }; -&gsw { - mediatek,port4 = "ephy"; -}; - &wmac { ralink,mtd-eeprom = <&factory 0x0>; }; diff --git a/target/linux/ramips/dts/mt7620a_ralink_mt7620a-evb.dts b/target/linux/ramips/dts/mt7620a_ralink_mt7620a-evb.dts index 7743df06fb..4c5baf1e50 100644 --- a/target/linux/ramips/dts/mt7620a_ralink_mt7620a-evb.dts +++ b/target/linux/ramips/dts/mt7620a_ralink_mt7620a-evb.dts @@ -105,7 +105,7 @@ }; &gsw { - mediatek,port4 = "gmac"; + mediatek,port4-gmac; }; &sdhci { diff --git a/target/linux/ramips/dts/mt7620a_ralink_mt7620a-mt7530-evb.dts b/target/linux/ramips/dts/mt7620a_ralink_mt7620a-mt7530-evb.dts index 4a09755967..b76ab2aa59 100644 --- a/target/linux/ramips/dts/mt7620a_ralink_mt7620a-mt7530-evb.dts +++ b/target/linux/ramips/dts/mt7620a_ralink_mt7620a-mt7530-evb.dts @@ -99,10 +99,6 @@ }; }; -&gsw { - mediatek,port4 = "gmac"; -}; - &pcie { status = "okay"; }; diff --git a/target/linux/ramips/dts/mt7620a_ralink_mt7620a-mt7610e-evb.dts b/target/linux/ramips/dts/mt7620a_ralink_mt7620a-mt7610e-evb.dts index ae0d364d3e..b7a71c3e25 100644 --- a/target/linux/ramips/dts/mt7620a_ralink_mt7620a-mt7610e-evb.dts +++ b/target/linux/ramips/dts/mt7620a_ralink_mt7620a-mt7610e-evb.dts @@ -71,10 +71,6 @@ mediatek,portmap = "llllw"; }; -&gsw { - mediatek,port4 = "ephy"; -}; - &sdhci { status = "okay"; }; diff --git a/target/linux/ramips/dts/mt7620a_ralink_mt7620a-v22sg-evb.dts b/target/linux/ramips/dts/mt7620a_ralink_mt7620a-v22sg-evb.dts index bee4ba7fd3..6e8eff50bc 100644 --- a/target/linux/ramips/dts/mt7620a_ralink_mt7620a-v22sg-evb.dts +++ b/target/linux/ramips/dts/mt7620a_ralink_mt7620a-v22sg-evb.dts @@ -99,7 +99,7 @@ }; &gsw { - mediatek,port4 = "gmac"; + mediatek,port4-gmac; }; &pcie { diff --git a/target/linux/ramips/dts/mt7620a_sercomm_na930.dts b/target/linux/ramips/dts/mt7620a_sercomm_na930.dts index 4a91c07ecd..329ecc5ea8 100644 --- a/target/linux/ramips/dts/mt7620a_sercomm_na930.dts +++ b/target/linux/ramips/dts/mt7620a_sercomm_na930.dts @@ -166,7 +166,7 @@ }; &gsw { - mediatek,port4 = "gmac"; + mediatek,port4-gmac; }; &ehci { diff --git a/target/linux/ramips/dts/mt7620a_tplink_archer-mr200.dts b/target/linux/ramips/dts/mt7620a_tplink_archer-mr200.dts index ae92dc85e6..4212a70dc3 100644 --- a/target/linux/ramips/dts/mt7620a_tplink_archer-mr200.dts +++ b/target/linux/ramips/dts/mt7620a_tplink_archer-mr200.dts @@ -178,10 +178,6 @@ status = "okay"; }; -&gsw { - mediatek,port4 = "ephy"; -}; - &wmac { ralink,mtd-eeprom = <&radio 0x0>; }; diff --git a/target/linux/ramips/dts/mt7620a_tplink_archer.dtsi b/target/linux/ramips/dts/mt7620a_tplink_archer.dtsi index 670bad615d..d2fb891433 100644 --- a/target/linux/ramips/dts/mt7620a_tplink_archer.dtsi +++ b/target/linux/ramips/dts/mt7620a_tplink_archer.dtsi @@ -105,10 +105,6 @@ status = "okay"; }; -&gsw { - mediatek,port4 = "ephy"; -}; - &wmac { ralink,mtd-eeprom = <&radio 0x0>; }; diff --git a/target/linux/ramips/dts/mt7620a_tplink_re210-v1.dts b/target/linux/ramips/dts/mt7620a_tplink_re210-v1.dts index 41e56fbe36..247b5752ef 100644 --- a/target/linux/ramips/dts/mt7620a_tplink_re210-v1.dts +++ b/target/linux/ramips/dts/mt7620a_tplink_re210-v1.dts @@ -61,7 +61,7 @@ }; &gsw { - mediatek,port4 = "gmac"; + mediatek,port4-gmac; }; ðernet { diff --git a/target/linux/ramips/dts/mt7620a_wavlink_wl-wn579x3.dts b/target/linux/ramips/dts/mt7620a_wavlink_wl-wn579x3.dts index 679d9c2150..55ab939d15 100644 --- a/target/linux/ramips/dts/mt7620a_wavlink_wl-wn579x3.dts +++ b/target/linux/ramips/dts/mt7620a_wavlink_wl-wn579x3.dts @@ -195,7 +195,7 @@ }; &gsw { - mediatek,port4 = "gmac"; + mediatek,port4-gmac; }; &wmac { diff --git a/target/linux/ramips/dts/mt7620a_yukai_bocco.dts b/target/linux/ramips/dts/mt7620a_yukai_bocco.dts index 9c99a6582e..347c246e2e 100644 --- a/target/linux/ramips/dts/mt7620a_yukai_bocco.dts +++ b/target/linux/ramips/dts/mt7620a_yukai_bocco.dts @@ -141,10 +141,6 @@ mediatek,portmap = "llllw"; }; -&gsw { - ralink,port4 = "ephy"; -}; - &wmac { ralink,mtd-eeprom = <&factory 0x0>; }; diff --git a/target/linux/ramips/dts/mt7620a_zte_q7.dts b/target/linux/ramips/dts/mt7620a_zte_q7.dts index 1ec3ba2e33..550f750c5a 100644 --- a/target/linux/ramips/dts/mt7620a_zte_q7.dts +++ b/target/linux/ramips/dts/mt7620a_zte_q7.dts @@ -111,7 +111,3 @@ &ohci { status = "okay"; }; - -&gsw { - mediatek,port4 = "ephy"; -}; diff --git a/target/linux/ramips/dts/mt7620a_zyxel_keenetic-viva.dts b/target/linux/ramips/dts/mt7620a_zyxel_keenetic-viva.dts index 8c07de4845..506b828ec8 100644 --- a/target/linux/ramips/dts/mt7620a_zyxel_keenetic-viva.dts +++ b/target/linux/ramips/dts/mt7620a_zyxel_keenetic-viva.dts @@ -157,7 +157,7 @@ }; &gsw { - mediatek,port4 = "gmac"; + mediatek,port4-gmac; }; &wmac { diff --git a/target/linux/ramips/dts/mt7620n.dtsi b/target/linux/ramips/dts/mt7620n.dtsi index 2fac091898..d225cb25d8 100644 --- a/target/linux/ramips/dts/mt7620n.dtsi +++ b/target/linux/ramips/dts/mt7620n.dtsi @@ -347,7 +347,6 @@ interrupt-parent = <&intc>; interrupts = <17>; - mediatek,port4 = "ephy"; }; ehci: ehci@101c0000 { diff --git a/target/linux/ramips/files/drivers/net/ethernet/ralink/gsw_mt7620.c b/target/linux/ramips/files/drivers/net/ethernet/ralink/gsw_mt7620.c index 0b09814cc8..798dc919bc 100644 --- a/target/linux/ramips/files/drivers/net/ethernet/ralink/gsw_mt7620.c +++ b/target/linux/ramips/files/drivers/net/ethernet/ralink/gsw_mt7620.c @@ -40,7 +40,7 @@ static irqreturn_t gsw_interrupt_mt7620(int irq, void *_priv) struct fe_priv *priv = (struct fe_priv *)_priv; struct mt7620_gsw *gsw = (struct mt7620_gsw *)priv->soc->swpriv; u32 status; - int i, max = (gsw->port4 == PORT4_EPHY) ? (4) : (3); + int i, max = (gsw->port4_ephy) ? (4) : (3); status = mtk_switch_r32(gsw, GSW_REG_ISR); if (status & PORT_IRQ_ST_CHG) @@ -202,8 +202,8 @@ static void mt7620_hw_init(struct mt7620_gsw *gsw, int mdio_mode) mtk_switch_w32(gsw, 0x7f7f7fe0, 0x0010); /* setup port 4 */ - if (gsw->port4 == PORT4_EPHY) { - u32 val = rt_sysc_r32(SYSC_REG_CFG1); + if (gsw->port4_ephy) { + val = rt_sysc_r32(SYSC_REG_CFG1); val |= 3 << 14; rt_sysc_w32(val, SYSC_REG_CFG1); @@ -255,7 +255,6 @@ int mtk_gsw_init(struct fe_priv *priv) static int mt7620_gsw_probe(struct platform_device *pdev) { struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - const char *port4 = NULL; struct mt7620_gsw *gsw; struct device_node *np = pdev->dev.of_node; u16 val; @@ -270,13 +269,7 @@ static int mt7620_gsw_probe(struct platform_device *pdev) gsw->dev = &pdev->dev; - of_property_read_string(np, "mediatek,port4", &port4); - if (port4 && !strcmp(port4, "ephy")) - gsw->port4 = PORT4_EPHY; - else if (port4 && !strcmp(port4, "gmac")) - gsw->port4 = PORT4_EXT; - else - gsw->port4 = PORT4_EPHY; + gsw->port4_ephy = !of_property_read_bool(np, "mediatek,port4-gmac"); if (of_property_read_u16(np, "mediatek,ephy-base-address", &val) == 0) gsw->ephy_base = val; diff --git a/target/linux/ramips/files/drivers/net/ethernet/ralink/gsw_mt7620.h b/target/linux/ramips/files/drivers/net/ethernet/ralink/gsw_mt7620.h index f10946a173..91a0399976 100644 --- a/target/linux/ramips/files/drivers/net/ethernet/ralink/gsw_mt7620.h +++ b/target/linux/ramips/files/drivers/net/ethernet/ralink/gsw_mt7620.h @@ -88,16 +88,11 @@ enum { GSW_ATTR_PORT_UNTAG, }; -enum { - PORT4_EPHY = 0, - PORT4_EXT, -}; - struct mt7620_gsw { struct device *dev; void __iomem *base; int irq; - int port4; + bool port4_ephy; unsigned long int autopoll; u16 ephy_base; }; diff --git a/target/linux/ramips/files/drivers/net/ethernet/ralink/soc_mt7620.c b/target/linux/ramips/files/drivers/net/ethernet/ralink/soc_mt7620.c index 7317bc30aa..085058eb11 100644 --- a/target/linux/ramips/files/drivers/net/ethernet/ralink/soc_mt7620.c +++ b/target/linux/ramips/files/drivers/net/ethernet/ralink/soc_mt7620.c @@ -141,7 +141,7 @@ static void mt7620_port_init(struct fe_priv *priv, struct device_node *np) u32 val, mask = 0; u32 val_delay = 0; u32 mask_delay = GSW_REG_GPCx_TXDELAY | GSW_REG_GPCx_RXDELAY; - int min = (gsw->port4 == PORT4_EPHY) ? (5) : (4); + int min = (gsw->port4_ephy) ? (5) : (4); if (!_id || (be32_to_cpu(*_id) < min) || (be32_to_cpu(*_id) > 5)) { if (_id)