ramips: mt7620: simplify DTS properties for GMAC
authorMichael Pratt <mcpratt@pm.me>
Wed, 31 Mar 2021 20:09:37 +0000 (16:09 -0400)
committerChuanhong Guo <gch981213@gmail.com>
Wed, 23 Jun 2021 06:22:18 +0000 (14:22 +0800)
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 <mcpratt@pm.me>
41 files changed:
target/linux/ramips/dts/mt7620a_alfa-network_ac1200rm.dts
target/linux/ramips/dts/mt7620a_alfa-network_r36m-e4g.dts
target/linux/ramips/dts/mt7620a_alfa-network_tube-e4g.dts
target/linux/ramips/dts/mt7620a_asus_rp-n53.dts
target/linux/ramips/dts/mt7620a_buffalo_whr-1166d.dts
target/linux/ramips/dts/mt7620a_buffalo_whr-300hp2.dts
target/linux/ramips/dts/mt7620a_buffalo_whr-600d.dts
target/linux/ramips/dts/mt7620a_cameo_810.dtsi
target/linux/ramips/dts/mt7620a_dlink_dch-m225.dts
target/linux/ramips/dts/mt7620a_dlink_dir-510l.dts
target/linux/ramips/dts/mt7620a_dlink_dwr-118-a1.dts
target/linux/ramips/dts/mt7620a_dlink_dwr-118-a2.dts
target/linux/ramips/dts/mt7620a_dovado_tiny-ac.dts
target/linux/ramips/dts/mt7620a_edimax_br-6478ac-v2.dts
target/linux/ramips/dts/mt7620a_edimax_ew-7478apc.dts
target/linux/ramips/dts/mt7620a_edimax_ew-747x.dtsi
target/linux/ramips/dts/mt7620a_engenius_esr600.dts
target/linux/ramips/dts/mt7620a_fon_fon2601.dts
target/linux/ramips/dts/mt7620a_head-weblink_hdrm200.dts
target/linux/ramips/dts/mt7620a_lenovo_newifi-y1s.dts
target/linux/ramips/dts/mt7620a_linksys_e1700.dts
target/linux/ramips/dts/mt7620a_ohyeah_oy-0001.dts
target/linux/ramips/dts/mt7620a_planex_cs-qr10.dts
target/linux/ramips/dts/mt7620a_planex_db-wrt01.dts
target/linux/ramips/dts/mt7620a_planex_mzk-750dhp.dts
target/linux/ramips/dts/mt7620a_ralink_mt7620a-evb.dts
target/linux/ramips/dts/mt7620a_ralink_mt7620a-mt7530-evb.dts
target/linux/ramips/dts/mt7620a_ralink_mt7620a-mt7610e-evb.dts
target/linux/ramips/dts/mt7620a_ralink_mt7620a-v22sg-evb.dts
target/linux/ramips/dts/mt7620a_sercomm_na930.dts
target/linux/ramips/dts/mt7620a_tplink_archer-mr200.dts
target/linux/ramips/dts/mt7620a_tplink_archer.dtsi
target/linux/ramips/dts/mt7620a_tplink_re210-v1.dts
target/linux/ramips/dts/mt7620a_wavlink_wl-wn579x3.dts
target/linux/ramips/dts/mt7620a_yukai_bocco.dts
target/linux/ramips/dts/mt7620a_zte_q7.dts
target/linux/ramips/dts/mt7620a_zyxel_keenetic-viva.dts
target/linux/ramips/dts/mt7620n.dtsi
target/linux/ramips/files/drivers/net/ethernet/ralink/gsw_mt7620.c
target/linux/ramips/files/drivers/net/ethernet/ralink/gsw_mt7620.h
target/linux/ramips/files/drivers/net/ethernet/ralink/soc_mt7620.c

index 27b6896cec1082de997115ad1d90fadb60261432..752a940cd8688bcb316973989f843d075c93c81a 100644 (file)
        status = "okay";
 };
 
-&gsw {
-       mediatek,port4 = "ephy";
-};
-
 &ohci {
        status = "okay";
 };
index 58386a9ac7f48839eea2678232f62a4f40ced809..0991ae844751e744353e3d8525e2f637e3553f40 100644 (file)
        status = "okay";
 };
 
-&gsw {
-       mediatek,port4 = "ephy";
-};
-
 &i2c {
        status = "okay";
 };
index 30a0201c395867019a00b358e03bf85c0deb849c..ca58d780f41144b3b2807f329979ebff49c5664b 100644 (file)
        status = "okay";
 };
 
-&gsw {
-       mediatek,port4 = "ephy";
-};
-
 &ohci {
        status = "okay";
 };
index 3cb9142c387c3b879e6894051d79fdd0f704e931..4c72c642724b00988e3a0ed250fe7cdd18f6e316 100644 (file)
        };
 };
 
-&gsw {
-       mediatek,port4 = "ephy";
+&ethernet {
        pinctrl-names = "default";
        pinctrl-0 = <&ephy_pins>;
 };
index 196bbde7261e128989dc608b6be2a4d3a40b29c6..93a09f99c3e1ed259bddce8f03e378d45a1e47a9 100644 (file)
        };
 };
 
-&gsw {
-       mediatek,port4 = "ephy";
-};
-
 &wmac {
        ralink,mtd-eeprom = <&factory 0x0>;
 };
index ed2e03d6cfa008f3fef842dd12b2e81c944a1d43..95152bc41a2565a57d9a2f9a8f9a9932c2586c43 100644 (file)
        mediatek,portmap = "llllw";
 };
 
-&gsw {
-       mediatek,port4 = "ephy";
-};
-
 &wmac {
        ralink,mtd-eeprom = <&factory 0x0>;
        pinctrl-names = "default";
index b799a98e56edcb65ed2e9717f2228e9ac14fb2e0..226967763bcc61e2e1b1d003340ee786b02b1f9b 100644 (file)
        mediatek,portmap = "llllw";
 };
 
-&gsw {
-       mediatek,port4 = "ephy";
-};
-
 &wmac {
        ralink,mtd-eeprom = <&factory 0x0>;
 };
index c3f3267d382f21c04b38b02a6f66c83731135f33..70407449db667a9d930b7b900f88205cec9c56e7 100644 (file)
        mediatek,portmap = "llllw";
 };
 
-&gsw {
-       mediatek,port4 = "ephy";
-};
-
 &gpio2 {
        status = "okay";
 };
index 63667da28199f7cddc93e97622b6f97de80bae2d..0c9f56875ecf455bec0c0c8e0274b51ad7083d78 100644 (file)
        mtd-mac-address = <&factory 0x4>;
 };
 
-&gsw {
-       ralink,port4 = "ephy";
-};
-
 &wmac {
        ralink,mtd-eeprom = <&factory 0x0>;
        pinctrl-names = "default";
index f4db67648a57e7e3c8baec8f3ad15871d77b7220..774d90c79d41fb0692281a8b82160500abb6201f 100644 (file)
        };
 };
 
-&gsw {
-       mediatek,port4 = "ephy";
-};
-
 &state_default {
        default {
                groups = "i2c", "uartf";
index bacebee8e1f33e5897f5da4c0638607dd050ae20..71b532fc3456aa4804ecaabf7e60c6d69de2ebd1 100644 (file)
 };
 
 &gsw {
-       mediatek,port4 = "gmac";
+       mediatek,port4-gmac;
 };
index 0b124e67deaecac178768793bd6c4d0cc602d7ed..9ea28706aa1909ea8e534af74f99a6ee48e5e433 100644 (file)
 };
 
 &gsw {
-       mediatek,port4 = "gmac";
+       mediatek,port4-gmac;
        mediatek,ephy-base-address = /bits/ 16 < 2 >;
 };
index 9450596f1b0d85a8ffd6084cb0b6276d421c6e2f..068f75bd96045e0a48584d47600562b18a21b7da 100644 (file)
 };
 
 &gsw {
-       mediatek,port4 = "gmac";
+       mediatek,port4-gmac;
 };
 
 &pcie {
index e7af34aa8eb018832f5a7e8ac6b85686cdac1a02..2337c0f9d360513d177af74ab212970dd900f45f 100644 (file)
        };
 };
 
-&gsw {
-       mediatek,port4 = "gmac";
-};
-
 &wmac {
        ralink,mtd-eeprom = <&factory 0x0>;
 };
index 77d214e888c1b3c30ec22fc9e14ed26335953c97..09763db388c13c2ac3f4b2dc3b7eeca8d6b73758 100644 (file)
        };
 };
 
-&gsw {
-       mediatek,port4 = "gmac";
-};
-
 &wmac {
        ralink,mtd-eeprom = <&factory 0x0>;
 };
index d17cc090c2d2b170b5883edc7b5e8357273ab597..07b03f5c066b2d8283b427db0e479f6492d335eb 100644 (file)
        };
 };
 
-&gsw {
-       mediatek,port5 = "gmac";
-};
-
 &wmac {
        ralink,mtd-eeprom = <&factory 0x0>;
 };
index b8fe2f8cdbf33dd07e76911c4e1e445222112d6d..35d0b3dbeca161de43e947a97fa4febb830515e8 100644 (file)
                                0x7c 0x0000007e /* PORT0 STATUS */
                                0x0c 0x05600000 /* PORT6 PAD MODE CTRL */
                                0x94 0x0000007e /* PORT6 STATUS */
-                               >;
+                       >;
                };
        };
 };
index ee61c6e59e99c74b642f6f81a8daa588e800fbf5..b47d63be85823be6463489d43e8244a3a6f5bfaa 100644 (file)
 };
 
 &gsw {
-       mediatek,port4 = "gmac";
+       mediatek,port4-gmac;
 };
 
 &wmac {
index a0ebe4fff5d7e6de4eb04b5a8994e642115a2257..487f6aaf6ebafb0e389ae6ad549a5498918b64c0 100644 (file)
        };
 };
 
+&gsw {
+       mediatek,port4-gmac;
+};
+
 &wmac {
        ralink,mtd-eeprom = <&factory 0x0>;
 };
index a07683ed4abe31c5998192f1a551da86112ba4b0..0997d8a00ec823389d32f25021b015617f93bcdc 100644 (file)
 };
 
 &gsw {
-       mediatek,port4 = "gmac";
+       mediatek,port4-gmac;
 };
index 2619a4653a5255a35b5bc5dda60a931121864b82..2672d54f360e4564061e3629929f2740d9c3338d 100644 (file)
        };
 };
 
-&gsw {
-       mediatek,port4 = "gmac";
-};
-
 &wmac {
        ralink,mtd-eeprom = <&factory 0x0>;
 };
index 07f606fce45ce75011946c84052dab99d72e3d5a..7dabbed9ba46048d922e980d703a61778d5539de 100644 (file)
        mediatek,portmap = "llllw";
 };
 
-&gsw {
-       mediatek,port4 = "ephy";
-};
-
 &wmac {
        ralink,mtd-eeprom = <&factory 0x0>;
 };
index aa7ddb0a2520aff3849b5a3b0caf0937f29e458b..3edc41ac0d9df4129a504a6ae582359e4754470b 100644 (file)
        mediatek,portmap = "llllw";
 };
 
-&gsw {
-       ralink,port4 = "ephy";
-};
-
 &sdhci {
        status = "okay";
 };
index eb373e9aa2470941254547231afdd4a26cc8bded..8f8f173de3f0ce116c34ea0b7ec93328db557ac8 100644 (file)
        mediatek,portmap = "llllw";
 };
 
-&gsw {
-       mediatek,port4 = "ephy";
-};
-
 &wmac {
        ralink,mtd-eeprom = <&factory 0x0>;
 };
index df9c9689c34e4b098559bfabdc3b54baec660324..e1c5568ed8273bfccfb7a2c694519f1dad28338c 100644 (file)
        mediatek,portmap = "llllw";
 };
 
-&gsw {
-       mediatek,port4 = "ephy";
-};
-
 &wmac {
        ralink,mtd-eeprom = <&factory 0x0>;
 };
index 7743df06fb49b067ecaa2b3c728ccd8f449a21fd..4c5baf1e5080837cb8a7d71542210b73c0636d9b 100644 (file)
 };
 
 &gsw {
-       mediatek,port4 = "gmac";
+       mediatek,port4-gmac;
 };
 
 &sdhci {
index 4a09755967c8d889d402a4dcdb0b00ffd6d359c4..b76ab2aa595a87014f454e76594cbcd1e42557b6 100644 (file)
        };
 };
 
-&gsw {
-       mediatek,port4 = "gmac";
-};
-
 &pcie {
        status = "okay";
 };
index ae0d364d3e3e9f7a409995891b35157b292d693a..b7a71c3e25ad101d5bbcb53fa7a97d3c770e4ed9 100644 (file)
        mediatek,portmap = "llllw";
 };
 
-&gsw {
-       mediatek,port4 = "ephy";
-};
-
 &sdhci {
        status = "okay";
 };
index bee4ba7fd38d9dea0f70a8379d0b59e9f59315a0..6e8eff50bcf0b543df9f09bfec587f4bdaab7bb1 100644 (file)
@@ -99,7 +99,7 @@
 };
 
 &gsw {
-       mediatek,port4 = "gmac";
+       mediatek,port4-gmac;
 };
 
 &pcie {
index 4a91c07ecd58ce7ea044bd5e8f955a505738c9ab..329ecc5ea8a8b631be1aaf2853ac4100b67ef222 100644 (file)
 };
 
 &gsw {
-       mediatek,port4 = "gmac";
+       mediatek,port4-gmac;
 };
 
 &ehci {
index ae92dc85e656eccd9a8a482091b16ab9c574cf8b..4212a70dc34aaeea0079f1e08aca430bd42bd2ee 100644 (file)
        status = "okay";
 };
 
-&gsw {
-       mediatek,port4 = "ephy";
-};
-
 &wmac {
        ralink,mtd-eeprom = <&radio 0x0>;
 };
index 670bad615d0701138aa02f992016332209ce393b..d2fb891433c192789a4ba820f2cb49362298ff04 100644 (file)
        status = "okay";
 };
 
-&gsw {
-       mediatek,port4 = "ephy";
-};
-
 &wmac {
        ralink,mtd-eeprom = <&radio 0x0>;
 };
index 41e56fbe3664323278e5955e48085cd077d5ee78..247b5752ef1283010f1d39a59d9cd7be0240b7a9 100644 (file)
@@ -61,7 +61,7 @@
 };
 
 &gsw {
-       mediatek,port4 = "gmac";
+       mediatek,port4-gmac;
 };
 
 &ethernet {
index 679d9c2150807133ae180ab419bbde8e0c1a7e67..55ab939d157b2581388f6c6277a3eb633fa264bd 100644 (file)
 };
 
 &gsw {
-       mediatek,port4 = "gmac";
+       mediatek,port4-gmac;
 };
 
 &wmac {
index 9c99a6582ef4bb6e8e9eb4f48536357fbd07088b..347c246e2e19c3eb82f346f9451b453bba7f3114 100644 (file)
        mediatek,portmap = "llllw";
 };
 
-&gsw {
-       ralink,port4 = "ephy";
-};
-
 &wmac {
        ralink,mtd-eeprom = <&factory 0x0>;
 };
index 1ec3ba2e3330db1baea30a853029b031f87d7d6a..550f750c5a418f3108406e8f2cab51d004cee112 100644 (file)
 &ohci {
        status = "okay";
 };
-
-&gsw {
-       mediatek,port4 = "ephy";
-};
index 8c07de48456a2d3be647f8271504008923e2cab0..506b828ec834c029238c37454a4c66c73a1444a8 100644 (file)
 };
 
 &gsw {
-       mediatek,port4 = "gmac";
+       mediatek,port4-gmac;
 };
 
 &wmac {
index 2fac091898d99bdd679a65969ef0c0ccfdf02222..d225cb25d898e70602e7f9f1d54931158b403f24 100644 (file)
 
                interrupt-parent = <&intc>;
                interrupts = <17>;
-               mediatek,port4 = "ephy";
        };
 
        ehci: ehci@101c0000 {
index 0b09814cc8a2d202fc9cf8332e720c6760cfa8cb..798dc919bc07198fdf20282908f04261ea4596ba 100644 (file)
@@ -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;
index f10946a1738811f24eb34b86077f4684cf67b051..91a0399976da4a4fdab8afc6e68dba0bec62ca27 100644 (file)
@@ -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;
 };
index 7317bc30aa7e27363db8c46dfdada2c3bfdd9af1..085058eb116fe84106c6150c73209712a0570c0f 100644 (file)
@@ -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)