struct mt7530_priv *priv = ds->priv;
 
        if (phy_is_pseudo_fixed_link(phydev)) {
-               dev_dbg(priv->dev, "phy-mode for master device = %x\n",
-                       phydev->interface);
-
-               /* Setup TX circuit incluing relevant PAD and driving */
-               mt7530_pad_clk_setup(ds, phydev->interface);
-
-               /* Setup RX circuit, relevant PAD and driving on the host
-                * which must be placed after the setup on the device side is
-                * all finished.
-                */
-               mt7623_pad_clk_setup(ds);
+               if (priv->id == ID_MT7530) {
+                       dev_dbg(priv->dev, "phy-mode for master device = %x\n",
+                               phydev->interface);
+
+                       /* Setup TX circuit incluing relevant PAD and driving */
+                       mt7530_pad_clk_setup(ds, phydev->interface);
+
+                       /* Setup RX circuit, relevant PAD and driving on the
+                        * host which must be placed after the setup on the
+                        * device side is all finished.
+                        */
+                       mt7623_pad_clk_setup(ds);
+               }
        } else {
                u16 lcl_adv = 0, rmt_adv = 0;
                u8 flowctrl;
        /* Unknown unicast frame fordwarding to the cpu port */
        mt7530_set(priv, MT7530_MFC, UNU_FFP(BIT(port)));
 
+       /* Set CPU port number */
+       if (priv->id == ID_MT7621)
+               mt7530_rmw(priv, MT7530_MFC, CPU_MASK, CPU_EN | CPU_PORT(port));
+
        /* CPU port gets connected to all user ports of
         * the switch
         */
         * as two netdev instances.
         */
        dn = ds->ports[MT7530_CPU_PORT].master->dev.of_node->parent;
-       priv->ethernet = syscon_node_to_regmap(dn);
-       if (IS_ERR(priv->ethernet))
-               return PTR_ERR(priv->ethernet);
 
-       regulator_set_voltage(priv->core_pwr, 1000000, 1000000);
-       ret = regulator_enable(priv->core_pwr);
-       if (ret < 0) {
-               dev_err(priv->dev,
-                       "Failed to enable core power: %d\n", ret);
-               return ret;
-       }
+       if (priv->id == ID_MT7530) {
+               priv->ethernet = syscon_node_to_regmap(dn);
+               if (IS_ERR(priv->ethernet))
+                       return PTR_ERR(priv->ethernet);
+
+               regulator_set_voltage(priv->core_pwr, 1000000, 1000000);
+               ret = regulator_enable(priv->core_pwr);
+               if (ret < 0) {
+                       dev_err(priv->dev,
+                               "Failed to enable core power: %d\n", ret);
+                       return ret;
+               }
 
-       regulator_set_voltage(priv->io_pwr, 3300000, 3300000);
-       ret = regulator_enable(priv->io_pwr);
-       if (ret < 0) {
-               dev_err(priv->dev, "Failed to enable io pwr: %d\n",
-                       ret);
-               return ret;
+               regulator_set_voltage(priv->io_pwr, 3300000, 3300000);
+               ret = regulator_enable(priv->io_pwr);
+               if (ret < 0) {
+                       dev_err(priv->dev, "Failed to enable io pwr: %d\n",
+                               ret);
+                       return ret;
+               }
        }
 
        /* Reset whole chip through gpio pin or memory-mapped registers for
        .port_vlan_del          = mt7530_port_vlan_del,
 };
 
+static const struct of_device_id mt7530_of_match[] = {
+       { .compatible = "mediatek,mt7621", .data = (void *)ID_MT7621, },
+       { .compatible = "mediatek,mt7530", .data = (void *)ID_MT7530, },
+       { /* sentinel */ },
+};
+MODULE_DEVICE_TABLE(of, mt7530_of_match);
+
 static int
 mt7530_probe(struct mdio_device *mdiodev)
 {
                }
        }
 
-       priv->core_pwr = devm_regulator_get(&mdiodev->dev, "core");
-       if (IS_ERR(priv->core_pwr))
-               return PTR_ERR(priv->core_pwr);
+       /* Get the hardware identifier from the devicetree node.
+        * We will need it for some of the clock and regulator setup.
+        */
+       priv->id = (unsigned int)(unsigned long)
+               of_device_get_match_data(&mdiodev->dev);
 
-       priv->io_pwr = devm_regulator_get(&mdiodev->dev, "io");
-       if (IS_ERR(priv->io_pwr))
-               return PTR_ERR(priv->io_pwr);
+       if (priv->id == ID_MT7530) {
+               priv->core_pwr = devm_regulator_get(&mdiodev->dev, "core");
+               if (IS_ERR(priv->core_pwr))
+                       return PTR_ERR(priv->core_pwr);
+
+               priv->io_pwr = devm_regulator_get(&mdiodev->dev, "io");
+               if (IS_ERR(priv->io_pwr))
+                       return PTR_ERR(priv->io_pwr);
+       }
 
        /* Not MCM that indicates switch works as the remote standalone
         * integrated circuit so the GPIO pin would be used to complete
        mutex_destroy(&priv->reg_mutex);
 }
 
-static const struct of_device_id mt7530_of_match[] = {
-       { .compatible = "mediatek,mt7530" },
-       { /* sentinel */ },
-};
-MODULE_DEVICE_TABLE(of, mt7530_of_match);
-
 static struct mdio_driver mt7530_mdio_driver = {
        .probe  = mt7530_probe,
        .remove = mt7530_remove,