Lines Matching full:ds
384 mt7530_pad_clk_setup(struct dsa_switch *ds, phy_interface_t interface) in mt7530_pad_clk_setup() argument
386 struct mt7530_priv *priv = ds->priv; in mt7530_pad_clk_setup()
503 mt7531_pad_setup(struct dsa_switch *ds, phy_interface_t interface) in mt7531_pad_setup() argument
505 struct mt7530_priv *priv = ds->priv; in mt7531_pad_setup()
596 mt7530_mib_reset(struct dsa_switch *ds) in mt7530_mib_reset() argument
598 struct mt7530_priv *priv = ds->priv; in mt7530_mib_reset()
604 static int mt7530_phy_read(struct dsa_switch *ds, int port, int regnum) in mt7530_phy_read() argument
606 struct mt7530_priv *priv = ds->priv; in mt7530_phy_read()
611 static int mt7530_phy_write(struct dsa_switch *ds, int port, int regnum, in mt7530_phy_write() argument
614 struct mt7530_priv *priv = ds->priv; in mt7530_phy_write()
793 mt7531_ind_phy_read(struct dsa_switch *ds, int port, int regnum) in mt7531_ind_phy_read() argument
795 struct mt7530_priv *priv = ds->priv; in mt7531_ind_phy_read()
811 mt7531_ind_phy_write(struct dsa_switch *ds, int port, int regnum, in mt7531_ind_phy_write() argument
814 struct mt7530_priv *priv = ds->priv; in mt7531_ind_phy_write()
831 mt7530_get_strings(struct dsa_switch *ds, int port, u32 stringset, in mt7530_get_strings() argument
845 mt7530_get_ethtool_stats(struct dsa_switch *ds, int port, in mt7530_get_ethtool_stats() argument
848 struct mt7530_priv *priv = ds->priv; in mt7530_get_ethtool_stats()
866 mt7530_get_sset_count(struct dsa_switch *ds, int port, int sset) in mt7530_get_sset_count() argument
874 static void mt7530_setup_port5(struct dsa_switch *ds, phy_interface_t interface) in mt7530_setup_port5() argument
876 struct mt7530_priv *priv = ds->priv; in mt7530_setup_port5()
907 dev_err(ds->dev, "Unsupported p5_intf_sel %d\n", in mt7530_setup_port5()
920 if (!dsa_is_dsa_port(priv->ds, 5) && in mt7530_setup_port5()
936 dev_dbg(ds->dev, "Setup P5, HWTRAP=0x%x, intf_sel=%s, phy-mode=%s\n", in mt7530_setup_port5()
946 mt753x_cpu_port_enable(struct dsa_switch *ds, int port) in mt753x_cpu_port_enable() argument
948 struct mt7530_priv *priv = ds->priv; in mt753x_cpu_port_enable()
953 ret = priv->info->cpu_port_config(ds, port); in mt753x_cpu_port_enable()
973 PCR_MATRIX(dsa_user_ports(priv->ds))); in mt753x_cpu_port_enable()
979 mt7530_port_enable(struct dsa_switch *ds, int port, in mt7530_port_enable() argument
982 struct mt7530_priv *priv = ds->priv; in mt7530_port_enable()
1002 mt7530_port_disable(struct dsa_switch *ds, int port) in mt7530_port_disable() argument
1004 struct mt7530_priv *priv = ds->priv; in mt7530_port_disable()
1020 mt7530_stp_state_set(struct dsa_switch *ds, int port, u8 state) in mt7530_stp_state_set() argument
1022 struct mt7530_priv *priv = ds->priv; in mt7530_stp_state_set()
1048 mt7530_port_bridge_join(struct dsa_switch *ds, int port, in mt7530_port_bridge_join() argument
1051 struct mt7530_priv *priv = ds->priv; in mt7530_port_bridge_join()
1062 if (dsa_is_user_port(ds, i) && i != port) { in mt7530_port_bridge_join()
1063 if (dsa_to_port(ds, i)->bridge_dev != bridge) in mt7530_port_bridge_join()
1086 mt7530_port_set_vlan_unaware(struct dsa_switch *ds, int port) in mt7530_port_set_vlan_unaware() argument
1088 struct mt7530_priv *priv = ds->priv; in mt7530_port_set_vlan_unaware()
1103 if (dsa_is_user_port(ds, i) && in mt7530_port_set_vlan_unaware()
1104 dsa_port_is_vlan_filtering(dsa_to_port(ds, i))) { in mt7530_port_set_vlan_unaware()
1115 PCR_MATRIX(dsa_user_ports(priv->ds))); in mt7530_port_set_vlan_unaware()
1122 mt7530_port_set_vlan_aware(struct dsa_switch *ds, int port) in mt7530_port_set_vlan_aware() argument
1124 struct mt7530_priv *priv = ds->priv; in mt7530_port_set_vlan_aware()
1130 if (dsa_is_cpu_port(ds, port)) in mt7530_port_set_vlan_aware()
1146 mt7530_port_bridge_leave(struct dsa_switch *ds, int port, in mt7530_port_bridge_leave() argument
1149 struct mt7530_priv *priv = ds->priv; in mt7530_port_bridge_leave()
1159 if (dsa_is_user_port(ds, i) && i != port) { in mt7530_port_bridge_leave()
1160 if (dsa_to_port(ds, i)->bridge_dev != bridge) in mt7530_port_bridge_leave()
1181 mt7530_port_fdb_add(struct dsa_switch *ds, int port, in mt7530_port_fdb_add() argument
1184 struct mt7530_priv *priv = ds->priv; in mt7530_port_fdb_add()
1197 mt7530_port_fdb_del(struct dsa_switch *ds, int port, in mt7530_port_fdb_del() argument
1200 struct mt7530_priv *priv = ds->priv; in mt7530_port_fdb_del()
1213 mt7530_port_fdb_dump(struct dsa_switch *ds, int port, in mt7530_port_fdb_dump() argument
1216 struct mt7530_priv *priv = ds->priv; in mt7530_port_fdb_dump()
1275 mt7530_port_vlan_filtering(struct dsa_switch *ds, int port, in mt7530_port_vlan_filtering() argument
1288 mt7530_port_set_vlan_aware(ds, port); in mt7530_port_vlan_filtering()
1289 mt7530_port_set_vlan_aware(ds, MT7530_CPU_PORT); in mt7530_port_vlan_filtering()
1291 mt7530_port_set_vlan_unaware(ds, port); in mt7530_port_vlan_filtering()
1298 mt7530_port_vlan_prepare(struct dsa_switch *ds, int port, in mt7530_port_vlan_prepare() argument
1394 mt7530_port_vlan_add(struct dsa_switch *ds, int port, in mt7530_port_vlan_add() argument
1400 struct mt7530_priv *priv = ds->priv; in mt7530_port_vlan_add()
1421 mt7530_port_vlan_del(struct dsa_switch *ds, int port, in mt7530_port_vlan_del() argument
1425 struct mt7530_priv *priv = ds->priv; in mt7530_port_vlan_del()
1463 static int mt753x_port_mirror_add(struct dsa_switch *ds, int port, in mt753x_port_mirror_add() argument
1467 struct mt7530_priv *priv = ds->priv; in mt753x_port_mirror_add()
1501 static void mt753x_port_mirror_del(struct dsa_switch *ds, int port, in mt753x_port_mirror_del() argument
1504 struct mt7530_priv *priv = ds->priv; in mt753x_port_mirror_del()
1525 mtk_get_tag_protocol(struct dsa_switch *ds, int port, in mtk_get_tag_protocol() argument
1528 struct mt7530_priv *priv = ds->priv; in mtk_get_tag_protocol()
1540 mt7530_setup(struct dsa_switch *ds) in mt7530_setup() argument
1542 struct mt7530_priv *priv = ds->priv; in mt7530_setup()
1555 dn = dsa_to_port(ds, MT7530_CPU_PORT)->master->dev.of_node->parent; in mt7530_setup()
1556 ds->configure_vlan_while_not_filtering = true; in mt7530_setup()
1619 mt7530_mib_reset(ds); in mt7530_setup()
1626 if (dsa_is_cpu_port(ds, i)) { in mt7530_setup()
1627 ret = mt753x_cpu_port_enable(ds, i); in mt7530_setup()
1631 mt7530_port_disable(ds, i); in mt7530_setup()
1642 if (!dsa_is_unused_port(ds, 5)) { in mt7530_setup()
1644 ret = of_get_phy_mode(dsa_to_port(ds, 5)->dn, &interface); in mt7530_setup()
1668 id = of_mdio_parse_addr(ds->dev, phy_node); in mt7530_setup()
1680 mt7530_setup_port5(ds, interface); in mt7530_setup()
1691 mt7531_setup(struct dsa_switch *ds) in mt7531_setup() argument
1693 struct mt7530_priv *priv = ds->priv; in mt7531_setup()
1736 /* Let ds->slave_mii_bus be able to access external phy. */ in mt7531_setup()
1744 dev_dbg(ds->dev, "P5 support %s interface\n", in mt7531_setup()
1773 mt7530_mib_reset(ds); in mt7531_setup()
1782 if (dsa_is_cpu_port(ds, i)) { in mt7531_setup()
1783 ret = mt753x_cpu_port_enable(ds, i); in mt7531_setup()
1787 mt7530_port_disable(ds, i); in mt7531_setup()
1794 ds->configure_vlan_while_not_filtering = true; in mt7531_setup()
1805 mt7530_phy_mode_supported(struct dsa_switch *ds, int port, in mt7530_phy_mode_supported() argument
1808 struct mt7530_priv *priv = ds->priv; in mt7530_phy_mode_supported()
1841 mt7531_phy_mode_supported(struct dsa_switch *ds, int port, in mt7531_phy_mode_supported() argument
1844 struct mt7530_priv *priv = ds->priv; in mt7531_phy_mode_supported()
1870 mt753x_phy_mode_supported(struct dsa_switch *ds, int port, in mt753x_phy_mode_supported() argument
1873 struct mt7530_priv *priv = ds->priv; in mt753x_phy_mode_supported()
1875 return priv->info->phy_mode_supported(ds, port, state); in mt753x_phy_mode_supported()
1879 mt753x_pad_setup(struct dsa_switch *ds, const struct phylink_link_state *state) in mt753x_pad_setup() argument
1881 struct mt7530_priv *priv = ds->priv; in mt753x_pad_setup()
1883 return priv->info->pad_setup(ds, state->interface); in mt753x_pad_setup()
1887 mt7530_mac_config(struct dsa_switch *ds, int port, unsigned int mode, in mt7530_mac_config() argument
1890 struct mt7530_priv *priv = ds->priv; in mt7530_mac_config()
1896 mt7530_setup_port5(priv->ds, interface); in mt7530_mac_config()
1967 mt7531_sgmii_link_up_force(struct dsa_switch *ds, int port, in mt7531_sgmii_link_up_force() argument
1971 struct mt7530_priv *priv = ds->priv; in mt7531_sgmii_link_up_force()
2072 static void mt7531_sgmii_restart_an(struct dsa_switch *ds, int port) in mt7531_sgmii_restart_an() argument
2074 struct mt7530_priv *priv = ds->priv; in mt7531_sgmii_restart_an()
2086 mt7531_mac_config(struct dsa_switch *ds, int port, unsigned int mode, in mt7531_mac_config() argument
2089 struct mt7530_priv *priv = ds->priv; in mt7531_mac_config()
2103 dp = dsa_to_port(ds, port); in mt7531_mac_config()
2123 mt753x_mac_config(struct dsa_switch *ds, int port, unsigned int mode, in mt753x_mac_config() argument
2126 struct mt7530_priv *priv = ds->priv; in mt753x_mac_config()
2128 return priv->info->mac_port_config(ds, port, mode, state->interface); in mt753x_mac_config()
2132 mt753x_phylink_mac_config(struct dsa_switch *ds, int port, unsigned int mode, in mt753x_phylink_mac_config() argument
2135 struct mt7530_priv *priv = ds->priv; in mt753x_phylink_mac_config()
2138 if (!mt753x_phy_mode_supported(ds, port, state)) in mt753x_phylink_mac_config()
2150 if (mt753x_mac_config(ds, port, mode, state) < 0) in mt753x_phylink_mac_config()
2160 mt753x_pad_setup(ds, state); in mt753x_phylink_mac_config()
2162 if (mt753x_mac_config(ds, port, mode, state) < 0) in mt753x_phylink_mac_config()
2169 dev_err(ds->dev, "%s: unsupported %s port: %i\n", in mt753x_phylink_mac_config()
2176 dev_err(ds->dev, "%s: in-band negotiation unsupported\n", in mt753x_phylink_mac_config()
2188 if (port == 5 && dsa_is_user_port(ds, 5)) in mt753x_phylink_mac_config()
2196 mt753x_phylink_mac_an_restart(struct dsa_switch *ds, int port) in mt753x_phylink_mac_an_restart() argument
2198 struct mt7530_priv *priv = ds->priv; in mt753x_phylink_mac_an_restart()
2203 priv->info->mac_pcs_an_restart(ds, port); in mt753x_phylink_mac_an_restart()
2206 static void mt753x_phylink_mac_link_down(struct dsa_switch *ds, int port, in mt753x_phylink_mac_link_down() argument
2210 struct mt7530_priv *priv = ds->priv; in mt753x_phylink_mac_link_down()
2215 static void mt753x_mac_pcs_link_up(struct dsa_switch *ds, int port, in mt753x_mac_pcs_link_up() argument
2219 struct mt7530_priv *priv = ds->priv; in mt753x_mac_pcs_link_up()
2224 priv->info->mac_pcs_link_up(ds, port, mode, interface, speed, duplex); in mt753x_mac_pcs_link_up()
2227 static void mt753x_phylink_mac_link_up(struct dsa_switch *ds, int port, in mt753x_phylink_mac_link_up() argument
2234 struct mt7530_priv *priv = ds->priv; in mt753x_phylink_mac_link_up()
2237 mt753x_mac_pcs_link_up(ds, port, mode, interface, speed, duplex); in mt753x_phylink_mac_link_up()
2270 mt7531_cpu_port_config(struct dsa_switch *ds, int port) in mt7531_cpu_port_config() argument
2272 struct mt7530_priv *priv = ds->priv; in mt7531_cpu_port_config()
2289 mt7531_pad_setup(ds, interface); in mt7531_cpu_port_config()
2302 ret = mt7531_mac_config(ds, port, MLO_AN_FIXED, interface); in mt7531_cpu_port_config()
2307 mt753x_phylink_mac_link_up(ds, port, MLO_AN_FIXED, interface, NULL, in mt7531_cpu_port_config()
2314 mt7530_mac_port_validate(struct dsa_switch *ds, int port, in mt7530_mac_port_validate() argument
2321 static void mt7531_mac_port_validate(struct dsa_switch *ds, int port, in mt7531_mac_port_validate() argument
2324 struct mt7530_priv *priv = ds->priv; in mt7531_mac_port_validate()
2330 mt753x_phylink_validate(struct dsa_switch *ds, int port, in mt753x_phylink_validate() argument
2335 struct mt7530_priv *priv = ds->priv; in mt753x_phylink_validate()
2338 !mt753x_phy_mode_supported(ds, port, state)) { in mt753x_phylink_validate()
2358 priv->info->mac_port_validate(ds, port, mask); in mt753x_phylink_validate()
2373 mt7530_phylink_mac_link_state(struct dsa_switch *ds, int port, in mt7530_phylink_mac_link_state() argument
2376 struct mt7530_priv *priv = ds->priv; in mt7530_phylink_mac_link_state()
2452 mt7531_phylink_mac_link_state(struct dsa_switch *ds, int port, in mt7531_phylink_mac_link_state() argument
2455 struct mt7530_priv *priv = ds->priv; in mt7531_phylink_mac_link_state()
2464 mt753x_phylink_mac_link_state(struct dsa_switch *ds, int port, in mt753x_phylink_mac_link_state() argument
2467 struct mt7530_priv *priv = ds->priv; in mt753x_phylink_mac_link_state()
2469 return priv->info->mac_port_get_state(ds, port, state); in mt753x_phylink_mac_link_state()
2473 mt753x_setup(struct dsa_switch *ds) in mt753x_setup() argument
2475 struct mt7530_priv *priv = ds->priv; in mt753x_setup()
2477 return priv->info->sw_setup(ds); in mt753x_setup()
2481 mt753x_phy_read(struct dsa_switch *ds, int port, int regnum) in mt753x_phy_read() argument
2483 struct mt7530_priv *priv = ds->priv; in mt753x_phy_read()
2485 return priv->info->phy_read(ds, port, regnum); in mt753x_phy_read()
2489 mt753x_phy_write(struct dsa_switch *ds, int port, int regnum, u16 val) in mt753x_phy_write() argument
2491 struct mt7530_priv *priv = ds->priv; in mt753x_phy_write()
2493 return priv->info->phy_write(ds, port, regnum, val); in mt753x_phy_write()
2585 priv->ds = devm_kzalloc(&mdiodev->dev, sizeof(*priv->ds), GFP_KERNEL); in mt7530_probe()
2586 if (!priv->ds) in mt7530_probe()
2589 priv->ds->dev = &mdiodev->dev; in mt7530_probe()
2590 priv->ds->num_ports = MT7530_NUM_PORTS; in mt7530_probe()
2651 priv->ds->priv = priv; in mt7530_probe()
2652 priv->ds->ops = &mt7530_switch_ops; in mt7530_probe()
2656 return dsa_register_switch(priv->ds); in mt7530_probe()
2675 dsa_unregister_switch(priv->ds); in mt7530_remove()