Lines Matching +full:vsc9953 +full:- +full:switch

1 // SPDX-License-Identifier: GPL-2.0+
3 * Copyright 2014 - 2015 Freescale Semiconductor, Inc.
5 * Driver for the Vitesse VSC9953 L2 Switch
15 #include <vsc9953.h>
76 out_le32(&phyregs->miimcmd, (0x1 << 31) | ((port_addr & 0x1f) << 25) | in vsc9953_mdio_write()
81 while ((in_le32(&phyregs->miimstatus) & 0x8) && --timeout) in vsc9953_mdio_write()
94 while ((in_le32(&phyregs->miimstatus) & MIIMIND_OPR_PEND) && --timeout) in vsc9953_mdio_read()
104 out_le32(&phyregs->miimcmd, (0x1 << 31) | ((port_addr & 0x1f) << 25) | in vsc9953_mdio_read()
110 while ((in_le32(&phyregs->miimstatus) & 0x8) && --timeout) in vsc9953_mdio_read()
116 value = in_le32(&phyregs->miimdata); in vsc9953_mdio_read()
126 struct vsc9953_port_info *l2sw_port = dev->priv; in init_phy()
130 if (!l2sw_port->bus) in init_phy()
132 phydev = phy_connect(l2sw_port->bus, l2sw_port->phyaddr, dev, in init_phy()
133 l2sw_port->enet_if); in init_phy()
136 return -1; in init_phy()
139 phydev->supported &= SUPPORTED_10baseT_Half | in init_phy()
144 phydev->advertising = phydev->supported; in init_phy()
146 l2sw_port->phydev = phydev; in init_phy()
165 return -ENOMEM; in vsc9953_port_init()
167 sprintf(dev->name, "SW@PORT%d", port_no); in vsc9953_port_init()
168 dev->priv = &vsc9953_l2sw.port[port_no]; in vsc9953_port_init()
169 dev->init = NULL; in vsc9953_port_init()
170 dev->halt = NULL; in vsc9953_port_init()
171 dev->send = NULL; in vsc9953_port_init()
172 dev->recv = NULL; in vsc9953_port_init()
176 return -ENODEV; in vsc9953_port_init()
191 while (((in_le32(&l2ana_reg->ana_tables.vlan_access) & in vsc9953_vlan_table_poll_idle()
192 VSC9953_VLAN_CMD_MASK) != VSC9953_VLAN_CMD_IDLE) && --timeout) in vsc9953_vlan_table_poll_idle()
195 return timeout ? 0 : -EBUSY; in vsc9953_vlan_table_poll_idle()
213 val = in_le32(&l2ana_reg->ana_tables.vlan_tidx); in vsc9953_vlan_table_membership_set()
215 out_le32(&l2ana_reg->ana_tables.vlan_tidx, val); in vsc9953_vlan_table_membership_set()
217 clrsetbits_le32(&l2ana_reg->ana_tables.vlan_access, in vsc9953_vlan_table_membership_set()
225 val = in_le32(&l2ana_reg->ana_tables.vlan_tidx); in vsc9953_vlan_table_membership_set()
227 out_le32(&l2ana_reg->ana_tables.vlan_tidx, val); in vsc9953_vlan_table_membership_set()
229 val = in_le32(&l2ana_reg->ana_tables.vlan_access); in vsc9953_vlan_table_membership_set()
242 out_le32(&l2ana_reg->ana_tables.vlan_access, val); in vsc9953_vlan_table_membership_set()
269 val = in_le32(&l2ana_reg->ana_tables.vlan_tidx); in vsc9953_vlan_membership_show()
272 out_le32(&l2ana_reg->ana_tables.vlan_tidx, val); in vsc9953_vlan_membership_show()
274 clrsetbits_le32(&l2ana_reg->ana_tables.vlan_access, in vsc9953_vlan_membership_show()
282 val = in_le32(&l2ana_reg->ana_tables.vlan_access); in vsc9953_vlan_membership_show()
307 val = in_le32(&l2ana_reg->ana_tables.vlan_tidx); in vsc9953_vlan_table_membership_all_set()
308 out_le32(&l2ana_reg->ana_tables.vlan_tidx, in vsc9953_vlan_table_membership_all_set()
311 clrsetbits_le32(&l2ana_reg->ana_tables.vlan_access, in vsc9953_vlan_table_membership_all_set()
319 val = in_le32(&l2ana_reg->ana_tables.vlan_tidx); in vsc9953_vlan_table_membership_all_set()
320 out_le32(&l2ana_reg->ana_tables.vlan_tidx, in vsc9953_vlan_table_membership_all_set()
323 clrsetbits_le32(&l2ana_reg->ana_tables.vlan_access, in vsc9953_vlan_table_membership_all_set()
330 /* Get PVID of a VSC9953 port */
339 return -1; in vsc9953_port_vlan_pvid_get()
346 val = in_le32(&l2ana_reg->port[port_nr].vlan_cfg); in vsc9953_port_vlan_pvid_get()
353 /* Set PVID for a VSC9953 port */
372 val = in_le32(&l2ana_reg->port[port_no].vlan_cfg); in vsc9953_port_vlan_pvid_set()
374 out_le32(&l2ana_reg->port[port_no].vlan_cfg, val); in vsc9953_port_vlan_pvid_set()
377 val = in_le32(&l2rew_reg->port[port_no].port_vlan_cfg); in vsc9953_port_vlan_pvid_set()
380 out_le32(&l2rew_reg->port[port_no].port_vlan_cfg, val); in vsc9953_port_vlan_pvid_set()
391 /* Enable/disable vlan aware of a VSC9953 port */
406 setbits_le32(&l2ana_reg->port[port_no].vlan_cfg, in vsc9953_port_vlan_aware_set()
409 clrbits_le32(&l2ana_reg->port[port_no].vlan_cfg, in vsc9953_port_vlan_aware_set()
413 /* Set all VSC9953 ports' vlan aware */
422 /* Enable/disable vlan pop count of a VSC9953 port */
442 val = in_le32(&l2ana_reg->port[port_no].vlan_cfg); in vsc9953_port_vlan_popcnt_set()
445 out_le32(&l2ana_reg->port[port_no].vlan_cfg, val); in vsc9953_port_vlan_popcnt_set()
448 /* Set all VSC9953 ports' pop count */
466 setbits_le32(&l2ana_reg->ana.adv_learn, VSC9953_VLAN_CHK); in vsc9953_vlan_ingr_fltr_learn_drop()
468 clrbits_le32(&l2ana_reg->ana.adv_learn, VSC9953_VLAN_CHK); in vsc9953_vlan_ingr_fltr_learn_drop()
485 switch (ac) { in vsc9953_aggr_code_set()
487 clrsetbits_le32(&l2ana_reg->common.aggr_cfg, in vsc9953_aggr_code_set()
496 clrsetbits_le32(&l2ana_reg->common.aggr_cfg, VSC9953_AC_RND_ENA, in vsc9953_aggr_code_set()
506 rc = -EINVAL; in vsc9953_aggr_code_set()
512 /* Egress untag modes of a VSC9953 port */
521 /* Get egress tagging configuration for a VSC9953 port */
531 return -1; in vsc9953_port_vlan_egr_untag_get()
537 val = in_le32(&l2rew_reg->port[port_no].port_tag_cfg); in vsc9953_port_vlan_egr_untag_get()
539 switch (val & VSC9953_TAG_CFG_MASK) { in vsc9953_port_vlan_egr_untag_get()
555 return -1; in vsc9953_port_vlan_egr_untag_get()
559 /* Show egress tagging configuration for a VSC9953 port */
565 printf("%7d\t%17s\n", port_no, "-"); in vsc9953_port_vlan_egr_untag_show()
570 switch (mode) { in vsc9953_port_vlan_egr_untag_show()
584 printf("%17s\n", "-"); in vsc9953_port_vlan_egr_untag_show()
603 switch (mode) { in vsc9953_port_vlan_egr_untag_set()
605 clrsetbits_le32(&l2rew_reg->port[port_no].port_tag_cfg, in vsc9953_port_vlan_egr_untag_set()
609 clrsetbits_le32(&l2rew_reg->port[port_no].port_tag_cfg, in vsc9953_port_vlan_egr_untag_set()
614 clrsetbits_le32(&l2rew_reg->port[port_no].port_tag_cfg, in vsc9953_port_vlan_egr_untag_set()
619 clrsetbits_le32(&l2rew_reg->port[port_no].port_tag_cfg, in vsc9953_port_vlan_egr_untag_set()
645 return -EINVAL; in vsc9953_autoage_time_set()
647 autoage = bitfield_replace_by_mask(in_le32(&l2ana_reg->ana.auto_age), in vsc9953_autoage_time_set()
650 out_le32(&l2ana_reg->ana.auto_age, autoage); in vsc9953_autoage_time_set()
657 /* Enable/disable status of a VSC9953 port */
670 setbits_le32(&l2qsys_reg->sys.switch_port_mode[port_no], in vsc9953_port_status_set()
673 clrbits_le32(&l2qsys_reg->sys.switch_port_mode[port_no], in vsc9953_port_status_set()
677 /* Start autonegotiation for a VSC9953 PHY */
683 if (vsc9953_l2sw.port[port_no].phydev->drv->startup( in vsc9953_phy_autoneg()
688 /* Print a VSC9953 port's configuration */
701 val = in_le32(&l2qsys_reg->sys.switch_port_mode[port_no]); in vsc9953_port_config_show()
712 link = vsc9953_l2sw.port[port_no].phydev->link; in vsc9953_port_config_show()
713 speed = vsc9953_l2sw.port[port_no].phydev->speed; in vsc9953_port_config_show()
714 duplex = vsc9953_l2sw.port[port_no].phydev->duplex; in vsc9953_port_config_show()
716 link = -1; in vsc9953_port_config_show()
717 speed = -1; in vsc9953_port_config_show()
718 duplex = -1; in vsc9953_port_config_show()
726 switch (speed) { in vsc9953_port_config_show()
743 printf("%8s ", "-"); in vsc9953_port_config_show()
749 /* Show VSC9953 ports' statistics */
765 printf("Statistics for L2 Switch port %d:\n", port_no); in vsc9953_port_statistics_show()
768 out_le32(&l2sys_reg->sys.stat_cfg, port_no); in vsc9953_port_statistics_show()
770 #define VSC9953_STATS_PRINTF "%-15s %10u" in vsc9953_port_statistics_show()
773 rx_val = in_le32(&l2sys_reg->stat.rx_cntrs.c_rx_short) + in vsc9953_port_statistics_show()
774 in_le32(&l2sys_reg->stat.rx_cntrs.c_rx_frag) + in vsc9953_port_statistics_show()
775 in_le32(&l2sys_reg->stat.rx_cntrs.c_rx_jabber) + in vsc9953_port_statistics_show()
776 in_le32(&l2sys_reg->stat.rx_cntrs.c_rx_long) + in vsc9953_port_statistics_show()
777 in_le32(&l2sys_reg->stat.rx_cntrs.c_rx_sz_64) + in vsc9953_port_statistics_show()
778 in_le32(&l2sys_reg->stat.rx_cntrs.c_rx_sz_65_127) + in vsc9953_port_statistics_show()
779 in_le32(&l2sys_reg->stat.rx_cntrs.c_rx_sz_128_255) + in vsc9953_port_statistics_show()
780 in_le32(&l2sys_reg->stat.rx_cntrs.c_rx_sz_256_511) + in vsc9953_port_statistics_show()
781 in_le32(&l2sys_reg->stat.rx_cntrs.c_rx_sz_512_1023) + in vsc9953_port_statistics_show()
782 in_le32(&l2sys_reg->stat.rx_cntrs.c_rx_sz_1024_1526) + in vsc9953_port_statistics_show()
783 in_le32(&l2sys_reg->stat.rx_cntrs.c_rx_sz_jumbo); in vsc9953_port_statistics_show()
784 tx_val = in_le32(&l2sys_reg->stat.tx_cntrs.c_tx_sz_64) + in vsc9953_port_statistics_show()
785 in_le32(&l2sys_reg->stat.tx_cntrs.c_tx_sz_65_127) + in vsc9953_port_statistics_show()
786 in_le32(&l2sys_reg->stat.tx_cntrs.c_tx_sz_128_255) + in vsc9953_port_statistics_show()
787 in_le32(&l2sys_reg->stat.tx_cntrs.c_tx_sz_256_511) + in vsc9953_port_statistics_show()
788 in_le32(&l2sys_reg->stat.tx_cntrs.c_tx_sz_512_1023) + in vsc9953_port_statistics_show()
789 in_le32(&l2sys_reg->stat.tx_cntrs.c_tx_sz_1024_1526) + in vsc9953_port_statistics_show()
790 in_le32(&l2sys_reg->stat.tx_cntrs.c_tx_sz_jumbo); in vsc9953_port_statistics_show()
795 rx_val = in_le32(&l2sys_reg->stat.rx_cntrs.c_rx_oct); in vsc9953_port_statistics_show()
796 tx_val = in_le32(&l2sys_reg->stat.tx_cntrs.c_tx_oct); in vsc9953_port_statistics_show()
801 rx_val = in_le32(&l2sys_reg->stat.rx_cntrs.c_rx_yellow_prio_0) + in vsc9953_port_statistics_show()
802 in_le32(&l2sys_reg->stat.rx_cntrs.c_rx_yellow_prio_1) + in vsc9953_port_statistics_show()
803 in_le32(&l2sys_reg->stat.rx_cntrs.c_rx_yellow_prio_2) + in vsc9953_port_statistics_show()
804 in_le32(&l2sys_reg->stat.rx_cntrs.c_rx_yellow_prio_3) + in vsc9953_port_statistics_show()
805 in_le32(&l2sys_reg->stat.rx_cntrs.c_rx_yellow_prio_4) + in vsc9953_port_statistics_show()
806 in_le32(&l2sys_reg->stat.rx_cntrs.c_rx_yellow_prio_5) + in vsc9953_port_statistics_show()
807 in_le32(&l2sys_reg->stat.rx_cntrs.c_rx_yellow_prio_6) + in vsc9953_port_statistics_show()
808 in_le32(&l2sys_reg->stat.rx_cntrs.c_rx_yellow_prio_7) + in vsc9953_port_statistics_show()
809 in_le32(&l2sys_reg->stat.rx_cntrs.c_rx_green_prio_0) + in vsc9953_port_statistics_show()
810 in_le32(&l2sys_reg->stat.rx_cntrs.c_rx_green_prio_1) + in vsc9953_port_statistics_show()
811 in_le32(&l2sys_reg->stat.rx_cntrs.c_rx_green_prio_2) + in vsc9953_port_statistics_show()
812 in_le32(&l2sys_reg->stat.rx_cntrs.c_rx_green_prio_3) + in vsc9953_port_statistics_show()
813 in_le32(&l2sys_reg->stat.rx_cntrs.c_rx_green_prio_4) + in vsc9953_port_statistics_show()
814 in_le32(&l2sys_reg->stat.rx_cntrs.c_rx_green_prio_5) + in vsc9953_port_statistics_show()
815 in_le32(&l2sys_reg->stat.rx_cntrs.c_rx_green_prio_6) + in vsc9953_port_statistics_show()
816 in_le32(&l2sys_reg->stat.rx_cntrs.c_rx_green_prio_7); in vsc9953_port_statistics_show()
817 tx_val = in_le32(&l2sys_reg->stat.tx_cntrs.c_tx_sz_64) + in vsc9953_port_statistics_show()
818 in_le32(&l2sys_reg->stat.tx_cntrs.c_tx_sz_65_127) + in vsc9953_port_statistics_show()
819 in_le32(&l2sys_reg->stat.tx_cntrs.c_tx_sz_128_255) + in vsc9953_port_statistics_show()
820 in_le32(&l2sys_reg->stat.tx_cntrs.c_tx_sz_256_511) + in vsc9953_port_statistics_show()
821 in_le32(&l2sys_reg->stat.tx_cntrs.c_tx_sz_512_1023) + in vsc9953_port_statistics_show()
822 in_le32(&l2sys_reg->stat.tx_cntrs.c_tx_sz_1024_1526) + in vsc9953_port_statistics_show()
823 in_le32(&l2sys_reg->stat.tx_cntrs.c_tx_sz_jumbo); in vsc9953_port_statistics_show()
828 rx_val = in_le32(&l2sys_reg->stat.rx_cntrs.c_rx_uc); in vsc9953_port_statistics_show()
829 tx_val = in_le32(&l2sys_reg->stat.tx_cntrs.c_tx_uc); in vsc9953_port_statistics_show()
834 rx_val = in_le32(&l2sys_reg->stat.rx_cntrs.c_rx_bc); in vsc9953_port_statistics_show()
835 tx_val = in_le32(&l2sys_reg->stat.tx_cntrs.c_tx_bc); in vsc9953_port_statistics_show()
840 rx_val = in_le32(&l2sys_reg->stat.rx_cntrs.c_rx_sz_64); in vsc9953_port_statistics_show()
841 tx_val = in_le32(&l2sys_reg->stat.tx_cntrs.c_tx_sz_64); in vsc9953_port_statistics_show()
846 rx_val = in_le32(&l2sys_reg->stat.rx_cntrs.c_rx_sz_65_127); in vsc9953_port_statistics_show()
847 tx_val = in_le32(&l2sys_reg->stat.tx_cntrs.c_tx_sz_65_127); in vsc9953_port_statistics_show()
849 "Rx 65B-127B:", rx_val, "Tx 65B-127B:", tx_val); in vsc9953_port_statistics_show()
852 rx_val = in_le32(&l2sys_reg->stat.rx_cntrs.c_rx_sz_128_255); in vsc9953_port_statistics_show()
853 tx_val = in_le32(&l2sys_reg->stat.tx_cntrs.c_tx_sz_128_255); in vsc9953_port_statistics_show()
855 "Rx 128B-255B:", rx_val, "Tx 128B-255B:", tx_val); in vsc9953_port_statistics_show()
858 rx_val = in_le32(&l2sys_reg->stat.rx_cntrs.c_rx_sz_256_511); in vsc9953_port_statistics_show()
859 tx_val = in_le32(&l2sys_reg->stat.tx_cntrs.c_tx_sz_256_511); in vsc9953_port_statistics_show()
861 "Rx 256B-511B:", rx_val, "Tx 256B-511B:", tx_val); in vsc9953_port_statistics_show()
864 rx_val = in_le32(&l2sys_reg->stat.rx_cntrs.c_rx_sz_512_1023); in vsc9953_port_statistics_show()
865 tx_val = in_le32(&l2sys_reg->stat.tx_cntrs.c_tx_sz_512_1023); in vsc9953_port_statistics_show()
867 "Rx 512B-1023B:", rx_val, "Tx 512B-1023B:", tx_val); in vsc9953_port_statistics_show()
870 rx_val = in_le32(&l2sys_reg->stat.rx_cntrs.c_rx_sz_1024_1526); in vsc9953_port_statistics_show()
871 tx_val = in_le32(&l2sys_reg->stat.tx_cntrs.c_tx_sz_1024_1526); in vsc9953_port_statistics_show()
873 "Rx 1024B-1526B:", rx_val, "Tx 1024B-1526B:", tx_val); in vsc9953_port_statistics_show()
876 rx_val = in_le32(&l2sys_reg->stat.rx_cntrs.c_rx_sz_jumbo); in vsc9953_port_statistics_show()
877 tx_val = in_le32(&l2sys_reg->stat.tx_cntrs.c_tx_sz_jumbo); in vsc9953_port_statistics_show()
882 rx_val = in_le32(&l2sys_reg->stat.rx_cntrs.c_rx_cat_drop) + in vsc9953_port_statistics_show()
883 in_le32(&l2sys_reg->stat.drop_cntrs.c_dr_tail) + in vsc9953_port_statistics_show()
884 in_le32(&l2sys_reg->stat.drop_cntrs.c_dr_yellow_prio_0) + in vsc9953_port_statistics_show()
885 in_le32(&l2sys_reg->stat.drop_cntrs.c_dr_yellow_prio_1) + in vsc9953_port_statistics_show()
886 in_le32(&l2sys_reg->stat.drop_cntrs.c_dr_yellow_prio_2) + in vsc9953_port_statistics_show()
887 in_le32(&l2sys_reg->stat.drop_cntrs.c_dr_yellow_prio_3) + in vsc9953_port_statistics_show()
888 in_le32(&l2sys_reg->stat.drop_cntrs.c_dr_yellow_prio_4) + in vsc9953_port_statistics_show()
889 in_le32(&l2sys_reg->stat.drop_cntrs.c_dr_yellow_prio_5) + in vsc9953_port_statistics_show()
890 in_le32(&l2sys_reg->stat.drop_cntrs.c_dr_yellow_prio_6) + in vsc9953_port_statistics_show()
891 in_le32(&l2sys_reg->stat.drop_cntrs.c_dr_yellow_prio_7) + in vsc9953_port_statistics_show()
892 in_le32(&l2sys_reg->stat.drop_cntrs.c_dr_green_prio_0) + in vsc9953_port_statistics_show()
893 in_le32(&l2sys_reg->stat.drop_cntrs.c_dr_green_prio_1) + in vsc9953_port_statistics_show()
894 in_le32(&l2sys_reg->stat.drop_cntrs.c_dr_green_prio_2) + in vsc9953_port_statistics_show()
895 in_le32(&l2sys_reg->stat.drop_cntrs.c_dr_green_prio_3) + in vsc9953_port_statistics_show()
896 in_le32(&l2sys_reg->stat.drop_cntrs.c_dr_green_prio_4) + in vsc9953_port_statistics_show()
897 in_le32(&l2sys_reg->stat.drop_cntrs.c_dr_green_prio_5) + in vsc9953_port_statistics_show()
898 in_le32(&l2sys_reg->stat.drop_cntrs.c_dr_green_prio_6) + in vsc9953_port_statistics_show()
899 in_le32(&l2sys_reg->stat.drop_cntrs.c_dr_green_prio_7); in vsc9953_port_statistics_show()
900 tx_val = in_le32(&l2sys_reg->stat.tx_cntrs.c_tx_drop) + in vsc9953_port_statistics_show()
901 in_le32(&l2sys_reg->stat.tx_cntrs.c_tx_aged); in vsc9953_port_statistics_show()
909 rx_val = in_le32(&l2sys_reg->stat.rx_cntrs.c_rx_crc); in vsc9953_port_statistics_show()
910 tx_val = in_le32(&l2sys_reg->stat.tx_cntrs.c_tx_col); in vsc9953_port_statistics_show()
918 rx_val = in_le32(&l2sys_reg->stat.rx_cntrs.c_rx_short); in vsc9953_port_statistics_show()
919 tx_val = in_le32(&l2sys_reg->stat.tx_cntrs.c_tx_aged); in vsc9953_port_statistics_show()
924 rx_val = in_le32(&l2sys_reg->stat.rx_cntrs.c_rx_long); in vsc9953_port_statistics_show()
928 rx_val = in_le32(&l2sys_reg->stat.rx_cntrs.c_rx_frag); in vsc9953_port_statistics_show()
932 rx_val = in_le32(&l2sys_reg->stat.rx_cntrs.c_rx_jabber); in vsc9953_port_statistics_show()
939 rx_val = in_le32(&l2sys_reg->stat.rx_cntrs.c_rx_cat_drop) + in vsc9953_port_statistics_show()
940 in_le32(&l2sys_reg->stat.drop_cntrs.c_dr_local); in vsc9953_port_statistics_show()
946 /* Clear statistics for a VSC9953 port */
961 out_le32(&l2sys_reg->sys.stat_cfg, port_no | in vsc9953_port_statistics_clear()
971 /* Set learning configuration for a VSC9953 port */
985 switch (mode) { in vsc9953_port_learn_mode_set()
987 clrbits_le32(&l2ana_reg->port[port_no].port_cfg, in vsc9953_port_learn_mode_set()
994 clrsetbits_le32(&l2ana_reg->port[port_no].port_cfg, in vsc9953_port_learn_mode_set()
1005 /* Get learning configuration for a VSC9953 port */
1014 return -1; in vsc9953_port_learn_mode_get()
1021 val = in_le32(&l2ana_reg->port[port_no].port_cfg); in vsc9953_port_learn_mode_get()
1042 while (((in_le32(&l2ana_reg->ana_tables.mac_access) & in vsc9953_mac_table_poll_idle()
1044 VSC9953_MAC_CMD_IDLE) && --timeout) in vsc9953_mac_table_poll_idle()
1047 return timeout ? 0 : -EBUSY; in vsc9953_mac_table_poll_idle()
1069 switch (cmd) { in vsc9953_mac_table_cmd()
1071 clrsetbits_le32(&l2ana_reg->ana_tables.mac_access, in vsc9953_mac_table_cmd()
1076 clrsetbits_le32(&l2ana_reg->ana_tables.mac_access, in vsc9953_mac_table_cmd()
1081 clrsetbits_le32(&l2ana_reg->ana_tables.mac_access, in vsc9953_mac_table_cmd()
1088 clrsetbits_le32(&l2ana_reg->ana_tables.mac_access, in vsc9953_mac_table_cmd()
1096 clrsetbits_le32(&l2ana_reg->ana_tables.mac_access, in vsc9953_mac_table_cmd()
1102 clrsetbits_le32(&l2ana_reg->ana_tables.mac_access, in vsc9953_mac_table_cmd()
1108 clrsetbits_le32(&l2ana_reg->ana_tables.mac_access, in vsc9953_mac_table_cmd()
1119 return -1; in vsc9953_mac_table_cmd()
1156 val = in_le32(&l2ana_reg->ana.anag_efil); in vsc9953_mac_table_show()
1165 out_le32(&l2ana_reg->ana.anag_efil, val); in vsc9953_mac_table_show()
1168 clrbits_le32(&l2ana_reg->ana_tables.mach_data, in vsc9953_mac_table_show()
1170 out_le32(&l2ana_reg->ana_tables.macl_data, 0); in vsc9953_mac_table_show()
1180 val = in_le32(&l2ana_reg->ana_tables.mac_access); in vsc9953_mac_table_show()
1186 switch (val & VSC9953_MAC_ENTRYTYPE_MASK) { in vsc9953_mac_table_show()
1206 val = in_le32(&l2ana_reg->ana_tables.mach_data); in vsc9953_mac_table_show()
1209 macl = in_le32(&l2ana_reg->ana_tables.macl_data); in vsc9953_mac_table_show()
1231 clrbits_le32(&l2ana_reg->ana.anag_efil, VSC9953_AGE_PORT_EN | in vsc9953_mac_table_show()
1245 val = in_le32(&l2ana_reg->ana_tables.mach_data); in vsc9953_mac_table_add()
1248 out_le32(&l2ana_reg->ana_tables.mach_data, val); in vsc9953_mac_table_add()
1250 out_le32(&l2ana_reg->ana_tables.macl_data, in vsc9953_mac_table_add()
1255 val = in_le32(&l2ana_reg->ana_tables.mac_access); in vsc9953_mac_table_add()
1257 out_le32(&l2ana_reg->ana_tables.mac_access, val); in vsc9953_mac_table_add()
1260 return -1; in vsc9953_mac_table_add()
1263 val = in_le32(&l2ana_reg->ana_tables.mach_data); in vsc9953_mac_table_add()
1266 out_le32(&l2ana_reg->ana_tables.mach_data, val); in vsc9953_mac_table_add()
1268 out_le32(&l2ana_reg->ana_tables.macl_data, in vsc9953_mac_table_add()
1273 return -1; in vsc9953_mac_table_add()
1275 val = in_le32(&l2ana_reg->ana_tables.mac_access); in vsc9953_mac_table_add()
1280 return -1; in vsc9953_mac_table_add()
1295 val = in_le32(&l2ana_reg->ana_tables.mach_data); in vsc9953_mac_table_del()
1298 out_le32(&l2ana_reg->ana_tables.mach_data, val); in vsc9953_mac_table_del()
1300 out_le32(&l2ana_reg->ana_tables.macl_data, in vsc9953_mac_table_del()
1306 return -1; in vsc9953_mac_table_del()
1309 if (!(in_le32(&l2ana_reg->ana_tables.mac_access) & in vsc9953_mac_table_del()
1314 return -1; in vsc9953_mac_table_del()
1318 val = in_le32(&l2ana_reg->ana_tables.mach_data); in vsc9953_mac_table_del()
1321 out_le32(&l2ana_reg->ana_tables.mach_data, val); in vsc9953_mac_table_del()
1323 out_le32(&l2ana_reg->ana_tables.macl_data, (mac[2] << 24) | in vsc9953_mac_table_del()
1327 return -1; in vsc9953_mac_table_del()
1330 val = in_le32(&l2ana_reg->ana_tables.mach_data); in vsc9953_mac_table_del()
1333 out_le32(&l2ana_reg->ana_tables.mach_data, val); in vsc9953_mac_table_del()
1335 out_le32(&l2ana_reg->ana_tables.macl_data, (mac[2] << 24) | in vsc9953_mac_table_del()
1340 return -1; in vsc9953_mac_table_del()
1342 if (in_le32(&l2ana_reg->ana_tables.mac_access) & in vsc9953_mac_table_del()
1345 return -1; in vsc9953_mac_table_del()
1364 val = in_le32(&l2ana_reg->ana.anag_efil); in vsc9953_mac_table_age()
1387 out_le32(&l2ana_reg->ana.anag_efil, val); in vsc9953_mac_table_age()
1393 clrbits_le32(&l2ana_reg->ana.anag_efil, VSC9953_AGE_PORT_EN | in vsc9953_mac_table_age()
1420 /* Set egress tag mode for a VSC9953 port */
1429 switch (mode) { in vsc9953_port_vlan_egress_tag_set()
1431 clrbits_le32(&l2rew_reg->port[port_no].port_tag_cfg, in vsc9953_port_vlan_egress_tag_set()
1435 setbits_le32(&l2rew_reg->port[port_no].port_tag_cfg, in vsc9953_port_vlan_egress_tag_set()
1443 /* Get egress tag mode for a VSC9953 port */
1453 val = in_le32(&l2rew_reg->port[port_no].port_tag_cfg); in vsc9953_port_vlan_egress_tag_get()
1460 /* VSC9953 VLAN learning modes */
1466 /* Set VLAN learning mode for VSC9953 */
1474 switch (lrn_mode) { in vsc9953_vlan_learning_set()
1476 setbits_le32(&l2ana_reg->ana.agen_ctrl, VSC9953_FID_MASK_ALL); in vsc9953_vlan_learning_set()
1479 clrbits_le32(&l2ana_reg->ana.agen_ctrl, VSC9953_FID_MASK_ALL); in vsc9953_vlan_learning_set()
1486 /* Get VLAN learning mode for VSC9953 */
1495 val = in_le32(&l2ana_reg->ana.agen_ctrl); in vsc9953_vlan_learning_get()
1503 return -EINVAL; in vsc9953_vlan_learning_get()
1509 /* Enable/disable VLAN ingress filtering on a VSC9953 port */
1518 setbits_le32(&l2ana_reg->ana.vlan_mask, 1 << port_no); in vsc9953_port_ingress_filtering_set()
1520 clrbits_le32(&l2ana_reg->ana.vlan_mask, 1 << port_no); in vsc9953_port_ingress_filtering_set()
1523 /* Return VLAN ingress filtering on a VSC9953 port */
1532 val = in_le32(&l2ana_reg->ana.vlan_mask); in vsc9953_port_ingress_filtering_get()
1543 return -EINVAL; in vsc9953_port_aggr_grp_get()
1548 val = in_le32(&l2ana_reg->port[port_no].port_cfg); in vsc9953_port_aggr_grp_get()
1584 * we do not support for now Layer-2 multicast entries in vsc9953_update_dest_members_masks()
1588 clrsetbits_le32(&l2ana_reg->port_id_tbl.port_grp_id[i], in vsc9953_update_dest_members_masks()
1594 pgid = in_le32(&l2ana_reg->port_id_tbl.port_grp_id[i]); in vsc9953_update_dest_members_masks()
1600 out_le32(&l2ana_reg->port_id_tbl.port_grp_id[i], pgid); in vsc9953_update_dest_members_masks()
1618 pgid = in_le32(&l2ana_reg->port_id_tbl.port_grp_id[index]); in vsc9953_update_source_members_masks()
1622 out_le32(&l2ana_reg->port_id_tbl.port_grp_id[index], in vsc9953_update_source_members_masks()
1632 out_le32(&l2ana_reg->port_id_tbl.port_grp_id[index], pgid); in vsc9953_update_source_members_masks()
1669 pgid = in_le32(&l2ana_reg->port_id_tbl.port_grp_id[i]); in vsc9953_update_aggr_members_masks()
1679 out_le32(&l2ana_reg->port_id_tbl.port_grp_id[i], pgid); in vsc9953_update_aggr_members_masks()
1723 return -EINVAL; in vsc9953_port_aggr_grp_set()
1746 val = in_le32(&l2ana_reg->port[port_no].port_cfg); in vsc9953_port_aggr_grp_set()
1749 out_le32(&l2ana_reg->port[port_no].port_cfg, val); in vsc9953_port_aggr_grp_set()
1760 if (parsed_cmd->cmd_to_keywords[parsed_cmd->cmd_keywords_nr - 1] == in vsc9953_port_status_key_func()
1763 else if (parsed_cmd->cmd_to_keywords[parsed_cmd->cmd_keywords_nr - 1] == in vsc9953_port_status_key_func()
1769 if (parsed_cmd->port != ETHSW_CMD_PORT_ALL) { in vsc9953_port_status_key_func()
1770 if (!VSC9953_PORT_CHECK(parsed_cmd->port)) { in vsc9953_port_status_key_func()
1771 printf("Invalid port number: %d\n", parsed_cmd->port); in vsc9953_port_status_key_func()
1774 vsc9953_port_status_set(parsed_cmd->port, enabled); in vsc9953_port_status_key_func()
1787 if (parsed_cmd->port != ETHSW_CMD_PORT_ALL) { in vsc9953_port_config_key_func()
1788 if (!VSC9953_PORT_CHECK(parsed_cmd->port)) { in vsc9953_port_config_key_func()
1789 printf("Invalid port number: %d\n", parsed_cmd->port); in vsc9953_port_config_key_func()
1792 vsc9953_phy_autoneg(parsed_cmd->port); in vsc9953_port_config_key_func()
1796 vsc9953_port_config_show(parsed_cmd->port); in vsc9953_port_config_key_func()
1814 if (parsed_cmd->port != ETHSW_CMD_PORT_ALL) { in vsc9953_port_stats_key_func()
1815 if (!VSC9953_PORT_CHECK(parsed_cmd->port)) { in vsc9953_port_stats_key_func()
1816 printf("Invalid port number: %d\n", parsed_cmd->port); in vsc9953_port_stats_key_func()
1819 vsc9953_port_statistics_show(parsed_cmd->port); in vsc9953_port_stats_key_func()
1833 if (parsed_cmd->port != ETHSW_CMD_PORT_ALL) { in vsc9953_port_stats_clear_key_func()
1834 if (!VSC9953_PORT_CHECK(parsed_cmd->port)) { in vsc9953_port_stats_clear_key_func()
1835 printf("Invalid port number: %d\n", parsed_cmd->port); in vsc9953_port_stats_clear_key_func()
1838 vsc9953_port_statistics_clear(parsed_cmd->port); in vsc9953_port_stats_clear_key_func()
1852 if (parsed_cmd->port != ETHSW_CMD_PORT_ALL) { in vsc9953_learn_show_key_func()
1853 if (!VSC9953_PORT_CHECK(parsed_cmd->port)) { in vsc9953_learn_show_key_func()
1854 printf("Invalid port number: %d\n", parsed_cmd->port); in vsc9953_learn_show_key_func()
1857 if (vsc9953_port_learn_mode_get(parsed_cmd->port, &mode)) in vsc9953_learn_show_key_func()
1860 switch (mode) { in vsc9953_learn_show_key_func()
1862 printf("%7d %11s\n", parsed_cmd->port, "disable"); in vsc9953_learn_show_key_func()
1865 printf("%7d %11s\n", parsed_cmd->port, "auto"); in vsc9953_learn_show_key_func()
1868 printf("%7d %11s\n", parsed_cmd->port, "-"); in vsc9953_learn_show_key_func()
1875 switch (mode) { in vsc9953_learn_show_key_func()
1883 printf("%7d %11s\n", i, "-"); in vsc9953_learn_show_key_func()
1897 if (parsed_cmd->cmd_to_keywords[parsed_cmd->cmd_keywords_nr - 1] == in vsc9953_learn_set_key_func()
1900 else if (parsed_cmd->cmd_to_keywords[parsed_cmd->cmd_keywords_nr - 1] == in vsc9953_learn_set_key_func()
1906 if (parsed_cmd->port != ETHSW_CMD_PORT_ALL) { in vsc9953_learn_set_key_func()
1907 if (!VSC9953_PORT_CHECK(parsed_cmd->port)) { in vsc9953_learn_set_key_func()
1908 printf("Invalid port number: %d\n", parsed_cmd->port); in vsc9953_learn_set_key_func()
1911 vsc9953_port_learn_mode_set(parsed_cmd->port, mode); in vsc9953_learn_set_key_func()
1922 if (parsed_cmd->port != ETHSW_CMD_PORT_ALL && in vsc9953_fdb_show_key_func()
1923 !VSC9953_PORT_CHECK(parsed_cmd->port)) { in vsc9953_fdb_show_key_func()
1924 printf("Invalid port number: %d\n", parsed_cmd->port); in vsc9953_fdb_show_key_func()
1928 if (parsed_cmd->vid != ETHSW_CMD_VLAN_ALL && in vsc9953_fdb_show_key_func()
1929 !VSC9953_VLAN_CHECK(parsed_cmd->vid)) { in vsc9953_fdb_show_key_func()
1930 printf("Invalid VID number: %d\n", parsed_cmd->vid); in vsc9953_fdb_show_key_func()
1934 vsc9953_mac_table_show(parsed_cmd->port, parsed_cmd->vid); in vsc9953_fdb_show_key_func()
1941 if (parsed_cmd->port != ETHSW_CMD_PORT_ALL && in vsc9953_fdb_flush_key_func()
1942 !VSC9953_PORT_CHECK(parsed_cmd->port)) { in vsc9953_fdb_flush_key_func()
1943 printf("Invalid port number: %d\n", parsed_cmd->port); in vsc9953_fdb_flush_key_func()
1947 if (parsed_cmd->vid != ETHSW_CMD_VLAN_ALL && in vsc9953_fdb_flush_key_func()
1948 !VSC9953_VLAN_CHECK(parsed_cmd->vid)) { in vsc9953_fdb_flush_key_func()
1949 printf("Invalid VID number: %d\n", parsed_cmd->vid); in vsc9953_fdb_flush_key_func()
1953 vsc9953_mac_table_flush(parsed_cmd->port, parsed_cmd->vid); in vsc9953_fdb_flush_key_func()
1963 if (parsed_cmd->port == ETHSW_CMD_PORT_ALL) { in vsc9953_fdb_entry_add_key_func()
1968 if (!VSC9953_PORT_CHECK(parsed_cmd->port)) { in vsc9953_fdb_entry_add_key_func()
1969 printf("Invalid port number: %d\n", parsed_cmd->port); in vsc9953_fdb_entry_add_key_func()
1974 vid = (parsed_cmd->vid == ETHSW_CMD_VLAN_ALL ? 1 : parsed_cmd->vid); in vsc9953_fdb_entry_add_key_func()
1981 if (vsc9953_mac_table_add(parsed_cmd->port, parsed_cmd->ethaddr, vid)) in vsc9953_fdb_entry_add_key_func()
1992 vid = (parsed_cmd->vid == ETHSW_CMD_VLAN_ALL ? 1 : parsed_cmd->vid); in vsc9953_fdb_entry_del_key_func()
1999 if (vsc9953_mac_table_del(parsed_cmd->ethaddr, vid)) in vsc9953_fdb_entry_del_key_func()
2010 if (parsed_cmd->port != ETHSW_CMD_PORT_ALL) { in vsc9953_pvid_show_key_func()
2011 if (!VSC9953_PORT_CHECK(parsed_cmd->port)) { in vsc9953_pvid_show_key_func()
2012 printf("Invalid port number: %d\n", parsed_cmd->port); in vsc9953_pvid_show_key_func()
2016 if (vsc9953_port_vlan_pvid_get(parsed_cmd->port, &pvid)) in vsc9953_pvid_show_key_func()
2019 printf("%7d %7d\n", parsed_cmd->port, pvid); in vsc9953_pvid_show_key_func()
2034 /* PVID number should be set in parsed_cmd->vid */ in vsc9953_pvid_set_key_func()
2035 if (parsed_cmd->vid == ETHSW_CMD_VLAN_ALL) { in vsc9953_pvid_set_key_func()
2040 if (!VSC9953_VLAN_CHECK(parsed_cmd->vid)) { in vsc9953_pvid_set_key_func()
2041 printf("Invalid VID number: %d\n", parsed_cmd->vid); in vsc9953_pvid_set_key_func()
2045 if (parsed_cmd->port != ETHSW_CMD_PORT_ALL) { in vsc9953_pvid_set_key_func()
2046 if (!VSC9953_PORT_CHECK(parsed_cmd->port)) { in vsc9953_pvid_set_key_func()
2047 printf("Invalid port number: %d\n", parsed_cmd->port); in vsc9953_pvid_set_key_func()
2050 vsc9953_port_vlan_pvid_set(parsed_cmd->port, parsed_cmd->vid); in vsc9953_pvid_set_key_func()
2052 vsc9953_port_all_vlan_pvid_set(parsed_cmd->vid); in vsc9953_pvid_set_key_func()
2062 if (parsed_cmd->port != ETHSW_CMD_PORT_ALL) { in vsc9953_vlan_show_key_func()
2063 if (!VSC9953_PORT_CHECK(parsed_cmd->port)) { in vsc9953_vlan_show_key_func()
2064 printf("Invalid port number: %d\n", parsed_cmd->port); in vsc9953_vlan_show_key_func()
2067 vsc9953_vlan_membership_show(parsed_cmd->port); in vsc9953_vlan_show_key_func()
2081 /* VLAN should be set in parsed_cmd->vid */ in vsc9953_vlan_set_key_func()
2082 if (parsed_cmd->vid == ETHSW_CMD_VLAN_ALL) { in vsc9953_vlan_set_key_func()
2087 if (!VSC9953_VLAN_CHECK(parsed_cmd->vid)) { in vsc9953_vlan_set_key_func()
2088 printf("Invalid VID number: %d\n", parsed_cmd->vid); in vsc9953_vlan_set_key_func()
2093 if (parsed_cmd->cmd_to_keywords[parsed_cmd->cmd_keywords_nr - 2] == in vsc9953_vlan_set_key_func()
2096 else if (parsed_cmd->cmd_to_keywords[parsed_cmd->cmd_keywords_nr - 2] == in vsc9953_vlan_set_key_func()
2102 if (parsed_cmd->port != ETHSW_CMD_PORT_ALL) { in vsc9953_vlan_set_key_func()
2103 if (!VSC9953_PORT_CHECK(parsed_cmd->port)) { in vsc9953_vlan_set_key_func()
2104 printf("Invalid port number: %d\n", parsed_cmd->port); in vsc9953_vlan_set_key_func()
2107 vsc9953_vlan_table_membership_set(parsed_cmd->vid, in vsc9953_vlan_set_key_func()
2108 parsed_cmd->port, add); in vsc9953_vlan_set_key_func()
2111 vsc9953_vlan_table_membership_set(parsed_cmd->vid, i, in vsc9953_vlan_set_key_func()
2123 if (parsed_cmd->port != ETHSW_CMD_PORT_ALL) { in vsc9953_port_untag_show_key_func()
2124 if (!VSC9953_PORT_CHECK(parsed_cmd->port)) { in vsc9953_port_untag_show_key_func()
2125 printf("Invalid port number: %d\n", parsed_cmd->port); in vsc9953_port_untag_show_key_func()
2128 vsc9953_port_vlan_egr_untag_show(parsed_cmd->port); in vsc9953_port_untag_show_key_func()
2143 if (parsed_cmd->cmd_to_keywords[parsed_cmd->cmd_keywords_nr - 1] == in vsc9953_port_untag_set_key_func()
2146 else if (parsed_cmd->cmd_to_keywords[parsed_cmd->cmd_keywords_nr - 1] == in vsc9953_port_untag_set_key_func()
2149 else if (parsed_cmd->cmd_to_keywords[parsed_cmd->cmd_keywords_nr - 1] == in vsc9953_port_untag_set_key_func()
2155 if (parsed_cmd->port != ETHSW_CMD_PORT_ALL) { in vsc9953_port_untag_set_key_func()
2156 if (!VSC9953_PORT_CHECK(parsed_cmd->port)) { in vsc9953_port_untag_set_key_func()
2157 printf("Invalid port number: %d\n", parsed_cmd->port); in vsc9953_port_untag_set_key_func()
2160 vsc9953_port_vlan_egr_untag_set(parsed_cmd->port, mode); in vsc9953_port_untag_set_key_func()
2175 if (parsed_cmd->port != ETHSW_CMD_PORT_ALL) { in vsc9953_egr_vlan_tag_show_key_func()
2176 if (!VSC9953_PORT_CHECK(parsed_cmd->port)) { in vsc9953_egr_vlan_tag_show_key_func()
2177 printf("Invalid port number: %d\n", parsed_cmd->port); in vsc9953_egr_vlan_tag_show_key_func()
2180 vsc9953_port_vlan_egress_tag_get(parsed_cmd->port, &mode); in vsc9953_egr_vlan_tag_show_key_func()
2182 printf("%7d\t", parsed_cmd->port); in vsc9953_egr_vlan_tag_show_key_func()
2183 switch (mode) { in vsc9953_egr_vlan_tag_show_key_func()
2191 printf("%12s\n", "-"); in vsc9953_egr_vlan_tag_show_key_func()
2197 switch (mode) { in vsc9953_egr_vlan_tag_show_key_func()
2205 printf("%7d\t%12s\n", i, "-"); in vsc9953_egr_vlan_tag_show_key_func()
2220 if (parsed_cmd->cmd_to_keywords[parsed_cmd->cmd_keywords_nr - 1] == in vsc9953_egr_vlan_tag_set_key_func()
2223 else if (parsed_cmd->cmd_to_keywords[parsed_cmd->cmd_keywords_nr - 1] == in vsc9953_egr_vlan_tag_set_key_func()
2229 if (parsed_cmd->port != ETHSW_CMD_PORT_ALL) { in vsc9953_egr_vlan_tag_set_key_func()
2230 if (!VSC9953_PORT_CHECK(parsed_cmd->port)) { in vsc9953_egr_vlan_tag_set_key_func()
2231 printf("Invalid port number: %d\n", parsed_cmd->port); in vsc9953_egr_vlan_tag_set_key_func()
2234 vsc9953_port_vlan_egress_tag_set(parsed_cmd->port, mode); in vsc9953_egr_vlan_tag_set_key_func()
2253 switch (mode) { in vsc9953_vlan_learn_show_key_func()
2273 if (parsed_cmd->cmd_to_keywords[parsed_cmd->cmd_keywords_nr - 1] == in vsc9953_vlan_learn_set_key_func()
2276 else if (parsed_cmd->cmd_to_keywords[parsed_cmd->cmd_keywords_nr - 1] == in vsc9953_vlan_learn_set_key_func()
2293 if (parsed_cmd->port != ETHSW_CMD_PORT_ALL) { in vsc9953_ingr_fltr_show_key_func()
2294 if (!VSC9953_PORT_CHECK(parsed_cmd->port)) { in vsc9953_ingr_fltr_show_key_func()
2295 printf("Invalid port number: %d\n", parsed_cmd->port); in vsc9953_ingr_fltr_show_key_func()
2298 enabled = vsc9953_port_ingress_filtering_get(parsed_cmd->port); in vsc9953_ingr_fltr_show_key_func()
2299 printf("%7d\t%18s\n", parsed_cmd->port, enabled ? "enable" : in vsc9953_ingr_fltr_show_key_func()
2304 printf("%7d\t%18s\n", parsed_cmd->port, enabled ? in vsc9953_ingr_fltr_show_key_func()
2321 if (parsed_cmd->cmd_to_keywords[parsed_cmd->cmd_keywords_nr - 1] == in vsc9953_ingr_fltr_set_key_func()
2324 else if (parsed_cmd->cmd_to_keywords[parsed_cmd->cmd_keywords_nr - 1] == in vsc9953_ingr_fltr_set_key_func()
2330 if (parsed_cmd->port != ETHSW_CMD_PORT_ALL) { in vsc9953_ingr_fltr_set_key_func()
2331 if (!VSC9953_PORT_CHECK(parsed_cmd->port)) { in vsc9953_ingr_fltr_set_key_func()
2332 printf("Invalid port number: %d\n", parsed_cmd->port); in vsc9953_ingr_fltr_set_key_func()
2335 vsc9953_port_ingress_filtering_set(parsed_cmd->port, enable); in vsc9953_ingr_fltr_set_key_func()
2349 if (parsed_cmd->port != ETHSW_CMD_PORT_ALL) { in vsc9953_port_aggr_show_key_func()
2350 if (!VSC9953_PORT_CHECK(parsed_cmd->port)) { in vsc9953_port_aggr_show_key_func()
2351 printf("Invalid port number: %d\n", parsed_cmd->port); in vsc9953_port_aggr_show_key_func()
2355 if (vsc9953_port_aggr_grp_get(parsed_cmd->port, &aggr_grp)) in vsc9953_port_aggr_show_key_func()
2358 printf("%7d %10d\n", parsed_cmd->port, aggr_grp); in vsc9953_port_aggr_show_key_func()
2375 /* Aggregation group number should be set in parsed_cmd->aggr_grp */ in vsc9953_port_aggr_set_key_func()
2376 if (parsed_cmd->aggr_grp == ETHSW_CMD_AGGR_GRP_NONE) { in vsc9953_port_aggr_set_key_func()
2381 if (!VSC9953_PORT_CHECK(parsed_cmd->aggr_grp)) { in vsc9953_port_aggr_set_key_func()
2383 parsed_cmd->aggr_grp); in vsc9953_port_aggr_set_key_func()
2387 if (parsed_cmd->port != ETHSW_CMD_PORT_ALL) { in vsc9953_port_aggr_set_key_func()
2388 if (!VSC9953_PORT_CHECK(parsed_cmd->port)) { in vsc9953_port_aggr_set_key_func()
2389 printf("Invalid port number: %d\n", parsed_cmd->port); in vsc9953_port_aggr_set_key_func()
2392 if (vsc9953_port_aggr_grp_set(parsed_cmd->port, in vsc9953_port_aggr_set_key_func()
2393 parsed_cmd->aggr_grp)) { in vsc9953_port_aggr_set_key_func()
2395 parsed_cmd->port, parsed_cmd->aggr_grp); in vsc9953_port_aggr_set_key_func()
2400 parsed_cmd->aggr_grp)) { in vsc9953_port_aggr_set_key_func()
2402 i, parsed_cmd->aggr_grp); in vsc9953_port_aggr_set_key_func()
2411 .ethsw_name = "L2 Switch VSC9953",
2443 - HW learning enabled on all ports; (HW default)
2444 - All ports are in VLAN 1;
2445 - All ports are VLAN aware;
2446 - All ports have POP_COUNT 1;
2447 - All ports have PVID 1;
2448 - All ports have TPID 0x8100; (HW default)
2449 - All ports tag frames classified to all VLANs that are not PVID;
2456 debug("VSC9953: failed to set AGE time to %d\n", in vsc9953_default_configuration()
2468 debug("VSC9953: failed to set default aggregation code mode\n"); in vsc9953_default_configuration()
2544 debug("VSC9953:%d invalid TCAM_SEL_ENTRY\n", in vsc9953_vcap_init()
2556 debug("VSC9953:%d invalid TCAM_SEL_ACTION | TCAM_SEL_COUNTER\n", in vsc9953_vcap_init()
2566 debug("VSC9953:%d invalid TCAM_SEL_ENTRY\n", in vsc9953_vcap_init()
2578 debug("VSC9953:%d invalid TCAM_SEL_ACTION | TCAM_SEL_COUNTER\n", in vsc9953_vcap_init()
2588 debug("VSC9953:%d invalid selection: TCAM_SEL_ENTRY\n", in vsc9953_vcap_init()
2600 debug("VSC9953:%d invalid TCAM_SEL_ACTION | TCAM_SEL_COUNTER\n", in vsc9953_vcap_init()
2631 out_le32(&l2dev_gcb->chip_regs.soft_rst, in vsc9953_init()
2634 while ((in_le32(&l2dev_gcb->chip_regs.soft_rst) & in vsc9953_init()
2635 VSC9953_SOFT_SWC_RST_ENA) && --timeout) in vsc9953_init()
2636 udelay(1); /* busy wait for vsc9953 soft reset */ in vsc9953_init()
2638 debug("Timeout waiting for VSC9953 to reset\n"); in vsc9953_init()
2640 out_le32(&l2sys_reg->sys.reset_cfg, VSC9953_MEM_ENABLE | in vsc9953_init()
2644 while ((in_le32(&l2sys_reg->sys.reset_cfg) & in vsc9953_init()
2645 VSC9953_MEM_INIT) && --timeout) in vsc9953_init()
2646 udelay(1); /* busy wait for vsc9953 memory init */ in vsc9953_init()
2648 debug("Timeout waiting for VSC9953 memory to initialize\n"); in vsc9953_init()
2650 out_le32(&l2sys_reg->sys.reset_cfg, (in_le32(&l2sys_reg->sys.reset_cfg) in vsc9953_init()
2653 /* VSC9953 Setting to be done once only */ in vsc9953_init()
2654 out_le32(&l2qsys_reg->sys.ext_cpu_cfg, 0x00000b00); in vsc9953_init()
2663 /* Enable VSC9953 GMII Ports Port ID 0 - 7 */ in vsc9953_init()
2665 out_le32(&l2ana_reg->pfc[i].pfc_cfg, in vsc9953_init()
2667 out_le32(&l2sys_reg->pause_cfg.mac_fc_cfg[i], in vsc9953_init()
2670 out_le32(&l2ana_reg->pfc[i].pfc_cfg, in vsc9953_init()
2672 out_le32(&l2sys_reg->pause_cfg.mac_fc_cfg[i], in vsc9953_init()
2680 out_le32(&l2dev_gmii_reg->port_mode.clock_cfg, in vsc9953_init()
2682 out_le32(&l2dev_gmii_reg->mac_cfg_status.mac_ena_cfg, in vsc9953_init()
2684 out_le32(&l2dev_gmii_reg->mac_cfg_status.mac_mode_cfg, in vsc9953_init()
2686 out_le32(&l2dev_gmii_reg->mac_cfg_status.mac_ifg_cfg, in vsc9953_init()
2690 out_le32(&l2dev_gmii_reg->mac_cfg_status.mac_hdx_cfg, hdx_cfg); in vsc9953_init()
2691 out_le32(&l2sys_reg->sys.front_port_mode[i], in vsc9953_init()
2693 setbits_le32(&l2qsys_reg->sys.switch_port_mode[i], in vsc9953_init()
2695 out_le32(&l2dev_gmii_reg->mac_cfg_status.mac_maxlen_cfg, in vsc9953_init()
2697 out_le32(&l2sys_reg->pause_cfg.pause_cfg[i], in vsc9953_init()
2713 vsc9953_mdio_write(&l2dev_gcb->mii_mng[0], phy_addr, in vsc9953_init()
2717 vsc9953_mdio_write(&l2dev_gcb->mii_mng[0], phy_addr, in vsc9953_init()
2722 vsc9953_mdio_write(&l2dev_gcb->mii_mng[0], phy_addr, in vsc9953_init()
2724 vsc9953_mdio_write(&l2dev_gcb->mii_mng[0], phy_addr, in vsc9953_init()
2727 vsc9953_mdio_write(&l2dev_gcb->mii_mng[0], phy_addr, in vsc9953_init()
2732 while ((vsc9953_mdio_read(&l2dev_gcb->mii_mng[0], in vsc9953_init()
2733 phy_addr, 0x01) & 0x0020) && --timeout) in vsc9953_init()
2748 printf("VSC9953 L2 switch initialized\n"); in vsc9953_init()