Lines Matching full:sparx5
2 /* Microchip Sparx5 Switch driver
77 static int sparx5_get_dev2g5_status(struct sparx5 *sparx5, in sparx5_get_dev2g5_status() argument
86 value = spx5_rd(sparx5, DEV2G5_PCS1G_STICKY(portno)); in sparx5_get_dev2g5_status()
89 spx5_wr(value, sparx5, DEV2G5_PCS1G_STICKY(portno)); in sparx5_get_dev2g5_status()
92 value = spx5_rd(sparx5, DEV2G5_PCS1G_LINK_STATUS(portno)); in sparx5_get_dev2g5_status()
104 value = spx5_rd(sparx5, DEV2G5_PCS1G_ANEG_STATUS(portno)); in sparx5_get_dev2g5_status()
112 value = spx5_rd(sparx5, DEV2G5_PCS1G_ANEG_CFG(portno)); in sparx5_get_dev2g5_status()
120 static int sparx5_get_sfi_status(struct sparx5 *sparx5, in sparx5_get_sfi_status() argument
136 inst = spx5_inst_get(sparx5, dev, tinst); in sparx5_get_sfi_status()
159 int sparx5_get_port_status(struct sparx5 *sparx5, in sparx5_get_port_status() argument
174 return sparx5_get_dev2g5_status(sparx5, port, status); in sparx5_get_port_status()
178 return sparx5_get_sfi_status(sparx5, port, status); in sparx5_get_port_status()
211 static int sparx5_port_verify_speed(struct sparx5 *sparx5, in sparx5_port_verify_speed() argument
263 static bool sparx5_dev_change(struct sparx5 *sparx5, in sparx5_dev_change() argument
271 static int sparx5_port_flush_poll(struct sparx5 *sparx5, u32 portno) in sparx5_port_flush_poll() argument
290 value = spx5_rd(sparx5, in sparx5_port_flush_poll()
304 dev_err(sparx5->dev, in sparx5_port_flush_poll()
315 static int sparx5_port_disable(struct sparx5 *sparx5, struct sparx5_port *port, bool high_spd_dev) in sparx5_port_disable() argument
321 void __iomem *devinst = spx5_inst_get(sparx5, dev, tinst); in sparx5_port_disable()
353 sparx5, in sparx5_port_disable()
359 sparx5, in sparx5_port_disable()
365 sparx5, in sparx5_port_disable()
381 sparx5, in sparx5_port_disable()
387 sparx5, in sparx5_port_disable()
391 err = sparx5_port_flush_poll(sparx5, port->portno); in sparx5_port_disable()
425 sparx5, in sparx5_port_disable()
430 void __iomem *pcsinst = spx5_inst_get(sparx5, pcs, tinst); in sparx5_port_disable()
442 sparx5, in sparx5_port_disable()
448 sparx5, in sparx5_port_disable()
456 static int sparx5_port_fifo_sz(struct sparx5 *sparx5, in sparx5_port_fifo_sz() argument
459 u32 sys_clk = sparx5_clk_period(sparx5->coreclock); in sparx5_port_fifo_sz()
515 static int sparx5_port_mux_set(struct sparx5 *sparx5, in sparx5_port_mux_set() argument
530 sparx5, in sparx5_port_mux_set()
541 sparx5, in sparx5_port_mux_set()
551 static int sparx5_port_max_tags_set(struct sparx5 *sparx5, in sparx5_port_max_tags_set() argument
562 void __iomem *inst = spx5_inst_get(sparx5, dev, tinst); in sparx5_port_max_tags_set()
574 sparx5, in sparx5_port_max_tags_set()
599 int sparx5_port_fwd_urg(struct sparx5 *sparx5, u32 speed) in sparx5_port_fwd_urg() argument
634 static int sparx5_port_fc_setup(struct sparx5 *sparx5, in sparx5_port_fc_setup() argument
648 sparx5, in sparx5_port_fc_setup()
654 sparx5, in sparx5_port_fc_setup()
660 sparx5, in sparx5_port_fc_setup()
666 sparx5, in sparx5_port_fc_setup()
680 int sparx5_serdes_set(struct sparx5 *sparx5, in sparx5_serdes_set() argument
726 static int sparx5_port_pcs_low_set(struct sparx5 *sparx5, in sparx5_port_pcs_low_set() argument
741 err = sparx5_serdes_set(sparx5, port, conf); in sparx5_port_pcs_low_set()
751 sparx5, in sparx5_port_pcs_low_set()
756 sparx5, in sparx5_port_pcs_low_set()
767 sparx5, in sparx5_port_pcs_low_set()
770 spx5_wr(0, sparx5, DEV2G5_PCS1G_ANEG_CFG(port->portno)); in sparx5_port_pcs_low_set()
780 sparx5, in sparx5_port_pcs_low_set()
786 static int sparx5_port_pcs_high_set(struct sparx5 *sparx5, in sparx5_port_pcs_high_set() argument
798 devinst = spx5_inst_get(sparx5, dev, pix); in sparx5_port_pcs_high_set()
799 pcsinst = spx5_inst_get(sparx5, pcs, pix); in sparx5_port_pcs_high_set()
802 err = sparx5_serdes_set(sparx5, port, conf); in sparx5_port_pcs_high_set()
809 sparx5, in sparx5_port_pcs_high_set()
843 static void sparx5_dev_switch(struct sparx5 *sparx5, int port, bool hsd) in sparx5_dev_switch() argument
850 sparx5, in sparx5_dev_switch()
855 sparx5, in sparx5_dev_switch()
860 sparx5, in sparx5_dev_switch()
866 static int sparx5_port_config_low_set(struct sparx5 *sparx5, in sparx5_port_config_low_set() argument
885 sparx5, in sparx5_port_config_low_set()
892 sparx5, in sparx5_port_config_low_set()
898 sparx5, in sparx5_port_config_low_set()
904 sparx5, in sparx5_port_config_low_set()
914 sparx5, in sparx5_port_config_low_set()
920 int sparx5_port_pcs_set(struct sparx5 *sparx5, in sparx5_port_pcs_set() argument
928 if (sparx5_dev_change(sparx5, port, conf)) { in sparx5_port_pcs_set()
930 sparx5_dev_switch(sparx5, port->portno, high_speed_dev); in sparx5_port_pcs_set()
933 err = sparx5_port_disable(sparx5, port, !high_speed_dev); in sparx5_port_pcs_set()
938 err = sparx5_port_disable(sparx5, port, high_speed_dev); in sparx5_port_pcs_set()
943 err = sparx5_port_pcs_high_set(sparx5, port, conf); in sparx5_port_pcs_set()
945 err = sparx5_port_pcs_low_set(sparx5, port, conf); in sparx5_port_pcs_set()
954 sparx5, in sparx5_port_pcs_set()
960 sparx5, in sparx5_port_pcs_set()
969 int sparx5_port_config(struct sparx5 *sparx5, in sparx5_port_config() argument
976 err = sparx5_port_verify_speed(sparx5, port, conf); in sparx5_port_config()
982 sparx5_port_config_low_set(sparx5, port, conf); in sparx5_port_config()
985 err = sparx5_port_fc_setup(sparx5, port, conf); in sparx5_port_config()
990 stop_wm = sparx5_port_fifo_sz(sparx5, port->portno, conf->speed); in sparx5_port_config()
993 sparx5, in sparx5_port_config()
997 urgency = sparx5_port_fwd_urg(sparx5, conf->speed); in sparx5_port_config()
1002 sparx5, in sparx5_port_config()
1012 int sparx5_port_init(struct sparx5 *sparx5, in sparx5_port_init() argument
1029 devinst = spx5_inst_get(sparx5, devhigh, pix); in sparx5_port_init()
1030 pcsinst = spx5_inst_get(sparx5, pcs, pix); in sparx5_port_init()
1033 err = sparx5_port_mux_set(sparx5, port, conf); in sparx5_port_init()
1038 err = sparx5_port_max_tags_set(sparx5, port); in sparx5_port_init()
1045 sparx5, in sparx5_port_init()
1052 sparx5, in sparx5_port_init()
1062 sparx5, in sparx5_port_init()
1067 sparx5, in sparx5_port_init()
1071 spx5_wr(PAUSE_DISCARD, sparx5, ANA_CL_CAPTURE_BPDU_CFG(port->portno)); in sparx5_port_init()
1075 err = sparx5_serdes_set(sparx5, port, conf); in sparx5_port_init()
1083 sparx5, in sparx5_port_init()
1086 sparx5_dev_switch(sparx5, port->portno, false); in sparx5_port_init()
1092 sparx5, in sparx5_port_init()
1099 sparx5, in sparx5_port_init()
1110 sparx5_dev_switch(sparx5, port->portno, true); in sparx5_port_init()
1130 sparx5, in sparx5_port_init()
1139 struct sparx5 *sparx5 = port->sparx5; in sparx5_port_enable() local
1144 sparx5, in sparx5_port_enable()