Lines Matching refs:fbd
11 static void fbnic_init_readrq(struct fbnic_dev *fbd, unsigned int offset, in fbnic_init_readrq() argument
14 u32 val = rd32(fbd, offset); in fbnic_init_readrq()
24 wr32(fbd, offset, val); in fbnic_init_readrq()
27 static void fbnic_init_mps(struct fbnic_dev *fbd, unsigned int offset, in fbnic_init_mps() argument
30 u32 val = rd32(fbd, offset); in fbnic_init_mps()
38 wr32(fbd, offset, val); in fbnic_init_mps()
41 static void fbnic_mac_init_axi(struct fbnic_dev *fbd) in fbnic_mac_init_axi() argument
52 readrq = ilog2(fbd->readrq) - 6; in fbnic_mac_init_axi()
57 mps = ilog2(fbd->mps) - 6; in fbnic_mac_init_axi()
64 fbnic_init_readrq(fbd, FBNIC_QM_TNI_TDF_CTL, cls, readrq); in fbnic_mac_init_axi()
65 fbnic_init_mps(fbd, FBNIC_QM_TNI_TCM_CTL, cls, mps); in fbnic_mac_init_axi()
72 wr32(fbd, FBNIC_QM_TNI_TDE_CTL, in fbnic_mac_init_axi()
79 fbnic_init_readrq(fbd, FBNIC_QM_RNI_RBP_CTL, cls, readrq); in fbnic_mac_init_axi()
80 fbnic_init_mps(fbd, FBNIC_QM_RNI_RDE_CTL, cls, mps); in fbnic_mac_init_axi()
81 fbnic_init_mps(fbd, FBNIC_QM_RNI_RCM_CTL, cls, mps); in fbnic_mac_init_axi()
84 wr32(fbd, FBNIC_PUL_OB_TLP_HDR_AW_CFG, in fbnic_mac_init_axi()
86 wr32(fbd, FBNIC_PUL_OB_TLP_HDR_AR_CFG, in fbnic_mac_init_axi()
90 static void fbnic_mac_init_qm(struct fbnic_dev *fbd) in fbnic_mac_init_qm() argument
95 wr32(fbd, FBNIC_QM_TQS_CTL0, in fbnic_mac_init_qm()
102 wr32(fbd, FBNIC_QM_TQS_EDT_TS_RANGE, INT_MAX); in fbnic_mac_init_qm()
109 wr32(fbd, FBNIC_QM_TQS_MTU_CTL0, FBNIC_MAX_JUMBO_FRAME_SIZE + 1); in fbnic_mac_init_qm()
110 wr32(fbd, FBNIC_QM_TQS_MTU_CTL1, in fbnic_mac_init_qm()
120 wr32(fbd, FBNIC_QM_TCQ_CTL0, in fbnic_mac_init_qm()
129 wr32(fbd, FBNIC_QM_RCQ_CTL0, in fbnic_mac_init_qm()
136 wr32(fbd, FBNIC_FAB_AXI4_AR_SPACER_2_CFG, in fbnic_mac_init_qm()
176 static void fbnic_mac_init_rxb(struct fbnic_dev *fbd) in fbnic_mac_init_rxb() argument
181 rx_enable = !!(rd32(fbd, FBNIC_RPC_RMI_CONFIG) & in fbnic_mac_init_rxb()
195 rd32(fbd, FBNIC_RXB_PBUF_CFG(i))); in fbnic_mac_init_rxb()
197 dev_warn(fbd->dev, in fbnic_mac_init_rxb()
203 wr32(fbd, FBNIC_RXB_CT_SIZE(i), in fbnic_mac_init_rxb()
211 wr32(fbd, FBNIC_RXB_PBUF_CFG(i), in fbnic_mac_init_rxb()
219 wr32(fbd, FBNIC_RXB_PBUF_CREDIT(i), in fbnic_mac_init_rxb()
228 wr32(fbd, FBNIC_RXB_PAUSE_THLD(i), in fbnic_mac_init_rxb()
235 wr32(fbd, FBNIC_RXB_DROP_THLD(i), in fbnic_mac_init_rxb()
247 wr32(fbd, FBNIC_RXB_ECN_THLD(i), in fbnic_mac_init_rxb()
262 wr32(fbd, FBNIC_RXB_PAUSE_DROP_CTRL, in fbnic_mac_init_rxb()
269 wr32(fbd, FBNIC_RXB_INTF_CREDIT, in fbnic_mac_init_rxb()
282 wr32(fbd, FBNIC_RXB_CLDR_PRIO_CFG(i), calendar_val); in fbnic_mac_init_rxb()
292 wr32(fbd, FBNIC_RXB_DWRR_RDE_WEIGHT0, in fbnic_mac_init_rxb()
295 wr32(fbd, FBNIC_RXB_DWRR_RDE_WEIGHT0_EXT, in fbnic_mac_init_rxb()
297 wr32(fbd, FBNIC_RXB_DWRR_RDE_WEIGHT1, in fbnic_mac_init_rxb()
299 wr32(fbd, FBNIC_RXB_DWRR_RDE_WEIGHT1_EXT, in fbnic_mac_init_rxb()
303 wr32(fbd, FBNIC_RXB_ENDIAN_FCS, 0x0aaaaaa0); in fbnic_mac_init_rxb()
306 static void fbnic_mac_init_txb(struct fbnic_dev *fbd) in fbnic_mac_init_txb() argument
310 wr32(fbd, FBNIC_TCE_TXB_CTRL, 0); in fbnic_mac_init_txb()
313 wr32(fbd, FBNIC_QM_TQS_CTL1, in fbnic_mac_init_txb()
318 wr32(fbd, FBNIC_TCE_TXB_TEI_Q0_CTRL, 0); in fbnic_mac_init_txb()
319 wr32(fbd, FBNIC_TCE_TXB_TEI_Q1_CTRL, 0); in fbnic_mac_init_txb()
320 wr32(fbd, FBNIC_TCE_TXB_MC_Q_CTRL, in fbnic_mac_init_txb()
323 wr32(fbd, FBNIC_TCE_TXB_RX_TEI_Q_CTRL, 0); in fbnic_mac_init_txb()
324 wr32(fbd, FBNIC_TCE_TXB_TX_BMC_Q_CTRL, in fbnic_mac_init_txb()
327 wr32(fbd, FBNIC_TCE_TXB_RX_BMC_Q_CTRL, in fbnic_mac_init_txb()
331 wr32(fbd, FBNIC_TCE_LSO_CTRL, in fbnic_mac_init_txb()
339 wr32(fbd, FBNIC_TCE_CSO_CTRL, 0); in fbnic_mac_init_txb()
341 wr32(fbd, FBNIC_TCE_BMC_MAX_PKTSZ, in fbnic_mac_init_txb()
346 wr32(fbd, FBNIC_TCE_MC_MAX_PKTSZ, in fbnic_mac_init_txb()
357 wr32(fbd, FBNIC_TCE_TXB_CLDR_SLOT_CFG(i), calendar_val); in fbnic_mac_init_txb()
361 wr32(fbd, FBNIC_TCE_TXB_ENQ_WRR_CTRL, in fbnic_mac_init_txb()
364 wr32(fbd, FBNIC_TCE_TXB_TEI_DWRR_CTRL, 0); in fbnic_mac_init_txb()
365 wr32(fbd, FBNIC_TCE_TXB_TEI_DWRR_CTRL_EXT, 0); in fbnic_mac_init_txb()
366 wr32(fbd, FBNIC_TCE_TXB_BMC_DWRR_CTRL, in fbnic_mac_init_txb()
369 wr32(fbd, FBNIC_TCE_TXB_BMC_DWRR_CTRL_EXT, 0); in fbnic_mac_init_txb()
370 wr32(fbd, FBNIC_TCE_TXB_NTWRK_DWRR_CTRL, in fbnic_mac_init_txb()
373 wr32(fbd, FBNIC_TCE_TXB_NTWRK_DWRR_CTRL_EXT, in fbnic_mac_init_txb()
377 wr32(fbd, FBNIC_TCE_SOP_PROT_CTRL, in fbnic_mac_init_txb()
391 wr32(fbd, FBNIC_TMI_SOP_PROT_CTRL, 8); in fbnic_mac_init_txb()
393 wrfl(fbd); in fbnic_mac_init_txb()
394 wr32(fbd, FBNIC_TCE_TXB_CTRL, FBNIC_TCE_TXB_CTRL_TCAM_ENABLE | in fbnic_mac_init_txb()
398 static void fbnic_mac_init_regs(struct fbnic_dev *fbd) in fbnic_mac_init_regs() argument
400 fbnic_mac_init_axi(fbd); in fbnic_mac_init_regs()
401 fbnic_mac_init_qm(fbd); in fbnic_mac_init_regs()
402 fbnic_mac_init_rxb(fbd); in fbnic_mac_init_regs()
403 fbnic_mac_init_txb(fbd); in fbnic_mac_init_regs()
406 static void __fbnic_mac_stat_rd64(struct fbnic_dev *fbd, bool reset, u32 reg, in __fbnic_mac_stat_rd64() argument
411 new_reg_value = fbnic_stat_rd64(fbd, reg, 1); in __fbnic_mac_stat_rd64()
418 #define fbnic_mac_stat_rd64(fbd, reset, __stat, __CSR) \ argument
419 __fbnic_mac_stat_rd64(fbd, reset, FBNIC_##__CSR##_L, &(__stat))
421 static void fbnic_mac_tx_pause_config(struct fbnic_dev *fbd, bool tx_pause) in fbnic_mac_tx_pause_config() argument
426 rxb_pause_ctrl = rd32(fbd, FBNIC_RXB_PAUSE_DROP_CTRL); in fbnic_mac_tx_pause_config()
432 wr32(fbd, FBNIC_RXB_PAUSE_DROP_CTRL, rxb_pause_ctrl); in fbnic_mac_tx_pause_config()
435 static int fbnic_pcs_get_link_event_asic(struct fbnic_dev *fbd) in fbnic_pcs_get_link_event_asic() argument
437 u32 pcs_intr_mask = rd32(fbd, FBNIC_SIG_PCS_INTR_STS); in fbnic_pcs_get_link_event_asic()
446 static u32 __fbnic_mac_cmd_config_asic(struct fbnic_dev *fbd, in __fbnic_mac_cmd_config_asic() argument
452 struct fbnic_net *fbn = netdev_priv(fbd->netdev); in __fbnic_mac_cmd_config_asic()
467 static bool fbnic_mac_get_pcs_link_status(struct fbnic_dev *fbd) in fbnic_mac_get_pcs_link_status() argument
469 struct fbnic_net *fbn = netdev_priv(fbd->netdev); in fbnic_mac_get_pcs_link_status()
472 pcs_status = rd32(fbd, FBNIC_SIG_PCS_OUT0); in fbnic_mac_get_pcs_link_status()
514 rd32(fbd, FBNIC_SIG_PCS_OUT1)); in fbnic_mac_get_pcs_link_status()
522 static bool fbnic_pcs_get_link_asic(struct fbnic_dev *fbd) in fbnic_pcs_get_link_asic() argument
529 wr32(fbd, FBNIC_SIG_PCS_OUT0, FBNIC_SIG_PCS_OUT0_LINK | in fbnic_pcs_get_link_asic()
532 wr32(fbd, FBNIC_SIG_PCS_OUT1, FBNIC_SIG_PCS_OUT1_FCFEC_LOCK); in fbnic_pcs_get_link_asic()
533 wrfl(fbd); in fbnic_pcs_get_link_asic()
536 wr32(fbd, FBNIC_SIG_PCS_INTR_STS, in fbnic_pcs_get_link_asic()
539 link = fbnic_mac_get_pcs_link_status(fbd); in fbnic_pcs_get_link_asic()
542 wr32(fbd, FBNIC_SIG_PCS_INTR_MASK, in fbnic_pcs_get_link_asic()
544 wr32(fbd, FBNIC_INTR_MASK_CLEAR(0), 1u << FBNIC_PCS_MSIX_ENTRY); in fbnic_pcs_get_link_asic()
549 static void fbnic_pcs_get_fw_settings(struct fbnic_dev *fbd) in fbnic_pcs_get_fw_settings() argument
551 struct fbnic_net *fbn = netdev_priv(fbd->netdev); in fbnic_pcs_get_fw_settings()
557 switch (fbd->fw_cap.link_fec) { in fbnic_pcs_get_fw_settings()
576 switch (fbd->fw_cap.link_speed) { in fbnic_pcs_get_fw_settings()
599 static int fbnic_pcs_enable_asic(struct fbnic_dev *fbd) in fbnic_pcs_enable_asic() argument
602 wr32(fbd, FBNIC_SIG_PCS_INTR_MASK, ~0); in fbnic_pcs_enable_asic()
603 wr32(fbd, FBNIC_SIG_PCS_INTR_STS, ~0); in fbnic_pcs_enable_asic()
606 fbnic_pcs_get_fw_settings(fbd); in fbnic_pcs_enable_asic()
611 static void fbnic_pcs_disable_asic(struct fbnic_dev *fbd) in fbnic_pcs_disable_asic() argument
614 wr32(fbd, FBNIC_SIG_PCS_INTR_MASK, ~0); in fbnic_pcs_disable_asic()
615 wr32(fbd, FBNIC_SIG_PCS_INTR_STS, ~0); in fbnic_pcs_disable_asic()
618 static void fbnic_mac_link_down_asic(struct fbnic_dev *fbd) in fbnic_mac_link_down_asic() argument
622 cmd_cfg = __fbnic_mac_cmd_config_asic(fbd, false, false); in fbnic_mac_link_down_asic()
623 mac_ctrl = rd32(fbd, FBNIC_SIG_MAC_IN0); in fbnic_mac_link_down_asic()
630 wr32(fbd, FBNIC_SIG_MAC_IN0, mac_ctrl); in fbnic_mac_link_down_asic()
631 wr32(fbd, FBNIC_MAC_COMMAND_CONFIG, cmd_cfg); in fbnic_mac_link_down_asic()
634 static void fbnic_mac_link_up_asic(struct fbnic_dev *fbd, in fbnic_mac_link_up_asic() argument
639 fbnic_mac_tx_pause_config(fbd, tx_pause); in fbnic_mac_link_up_asic()
641 cmd_cfg = __fbnic_mac_cmd_config_asic(fbd, tx_pause, rx_pause); in fbnic_mac_link_up_asic()
642 mac_ctrl = rd32(fbd, FBNIC_SIG_MAC_IN0); in fbnic_mac_link_up_asic()
651 wr32(fbd, FBNIC_SIG_MAC_IN0, mac_ctrl); in fbnic_mac_link_up_asic()
652 wr32(fbd, FBNIC_MAC_COMMAND_CONFIG, cmd_cfg); in fbnic_mac_link_up_asic()
656 fbnic_mac_get_eth_mac_stats(struct fbnic_dev *fbd, bool reset, in fbnic_mac_get_eth_mac_stats() argument
659 fbnic_mac_stat_rd64(fbd, reset, mac_stats->OctetsReceivedOK, in fbnic_mac_get_eth_mac_stats()
661 fbnic_mac_stat_rd64(fbd, reset, mac_stats->AlignmentErrors, in fbnic_mac_get_eth_mac_stats()
663 fbnic_mac_stat_rd64(fbd, reset, mac_stats->FrameTooLongErrors, in fbnic_mac_get_eth_mac_stats()
665 fbnic_mac_stat_rd64(fbd, reset, mac_stats->FramesReceivedOK, in fbnic_mac_get_eth_mac_stats()
667 fbnic_mac_stat_rd64(fbd, reset, mac_stats->FrameCheckSequenceErrors, in fbnic_mac_get_eth_mac_stats()
669 fbnic_mac_stat_rd64(fbd, reset, in fbnic_mac_get_eth_mac_stats()
672 fbnic_mac_stat_rd64(fbd, reset, mac_stats->MulticastFramesReceivedOK, in fbnic_mac_get_eth_mac_stats()
674 fbnic_mac_stat_rd64(fbd, reset, mac_stats->BroadcastFramesReceivedOK, in fbnic_mac_get_eth_mac_stats()
676 fbnic_mac_stat_rd64(fbd, reset, mac_stats->OctetsTransmittedOK, in fbnic_mac_get_eth_mac_stats()
678 fbnic_mac_stat_rd64(fbd, reset, mac_stats->FramesTransmittedOK, in fbnic_mac_get_eth_mac_stats()
680 fbnic_mac_stat_rd64(fbd, reset, in fbnic_mac_get_eth_mac_stats()
683 fbnic_mac_stat_rd64(fbd, reset, mac_stats->MulticastFramesXmittedOK, in fbnic_mac_get_eth_mac_stats()
685 fbnic_mac_stat_rd64(fbd, reset, mac_stats->BroadcastFramesXmittedOK, in fbnic_mac_get_eth_mac_stats()
689 static int fbnic_mac_get_sensor_asic(struct fbnic_dev *fbd, int id, in fbnic_mac_get_sensor_asic() argument
715 err = fbnic_fw_xmit_tsene_read_msg(fbd, fw_cmpl); in fbnic_mac_get_sensor_asic()
717 dev_err(fbd->dev, in fbnic_mac_get_sensor_asic()
728 dev_err(fbd->dev, in fbnic_mac_get_sensor_asic()
734 err = fbnic_fw_xmit_tsene_read_msg(fbd, NULL); in fbnic_mac_get_sensor_asic()
736 dev_err(fbd->dev, in fbnic_mac_get_sensor_asic()
746 dev_err(fbd->dev, "%s: Firmware returned error %d\n", in fbnic_mac_get_sensor_asic()
753 fbnic_fw_clear_compl(fbd); in fbnic_mac_get_sensor_asic()
781 int fbnic_mac_init(struct fbnic_dev *fbd) in fbnic_mac_init() argument
783 fbd->mac = &fbnic_mac_asic; in fbnic_mac_init()
785 fbd->mac->init_regs(fbd); in fbnic_mac_init()