.. | .. |
---|
1 | | -/* |
---|
2 | | - * aQuantia Corporation Network Driver |
---|
3 | | - * Copyright (C) 2014-2017 aQuantia Corporation. All rights reserved |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
---|
| 2 | +/* Atlantic Network Driver |
---|
4 | 3 | * |
---|
5 | | - * This program is free software; you can redistribute it and/or modify it |
---|
6 | | - * under the terms and conditions of the GNU General Public License, |
---|
7 | | - * version 2, as published by the Free Software Foundation. |
---|
| 4 | + * Copyright (C) 2014-2019 aQuantia Corporation |
---|
| 5 | + * Copyright (C) 2019-2020 Marvell International Ltd. |
---|
8 | 6 | */ |
---|
9 | 7 | |
---|
10 | 8 | /* File hw_atl_llh.c: Definitions of bitfield and register access functions for |
---|
.. | .. |
---|
14 | 12 | #include "hw_atl_llh.h" |
---|
15 | 13 | #include "hw_atl_llh_internal.h" |
---|
16 | 14 | #include "../aq_hw_utils.h" |
---|
| 15 | + |
---|
| 16 | +void hw_atl_ts_reset_set(struct aq_hw_s *aq_hw, u32 val) |
---|
| 17 | +{ |
---|
| 18 | + aq_hw_write_reg_bit(aq_hw, HW_ATL_TS_RESET_ADR, |
---|
| 19 | + HW_ATL_TS_RESET_MSK, |
---|
| 20 | + HW_ATL_TS_RESET_SHIFT, |
---|
| 21 | + val); |
---|
| 22 | +} |
---|
| 23 | + |
---|
| 24 | +void hw_atl_ts_power_down_set(struct aq_hw_s *aq_hw, u32 val) |
---|
| 25 | +{ |
---|
| 26 | + aq_hw_write_reg_bit(aq_hw, HW_ATL_TS_POWER_DOWN_ADR, |
---|
| 27 | + HW_ATL_TS_POWER_DOWN_MSK, |
---|
| 28 | + HW_ATL_TS_POWER_DOWN_SHIFT, |
---|
| 29 | + val); |
---|
| 30 | +} |
---|
| 31 | + |
---|
| 32 | +u32 hw_atl_ts_power_down_get(struct aq_hw_s *aq_hw) |
---|
| 33 | +{ |
---|
| 34 | + return aq_hw_read_reg_bit(aq_hw, HW_ATL_TS_POWER_DOWN_ADR, |
---|
| 35 | + HW_ATL_TS_POWER_DOWN_MSK, |
---|
| 36 | + HW_ATL_TS_POWER_DOWN_SHIFT); |
---|
| 37 | +} |
---|
| 38 | + |
---|
| 39 | +u32 hw_atl_ts_ready_get(struct aq_hw_s *aq_hw) |
---|
| 40 | +{ |
---|
| 41 | + return aq_hw_read_reg_bit(aq_hw, HW_ATL_TS_READY_ADR, |
---|
| 42 | + HW_ATL_TS_READY_MSK, |
---|
| 43 | + HW_ATL_TS_READY_SHIFT); |
---|
| 44 | +} |
---|
| 45 | + |
---|
| 46 | +u32 hw_atl_ts_ready_latch_high_get(struct aq_hw_s *aq_hw) |
---|
| 47 | +{ |
---|
| 48 | + return aq_hw_read_reg_bit(aq_hw, HW_ATL_TS_READY_LATCH_HIGH_ADR, |
---|
| 49 | + HW_ATL_TS_READY_LATCH_HIGH_MSK, |
---|
| 50 | + HW_ATL_TS_READY_LATCH_HIGH_SHIFT); |
---|
| 51 | +} |
---|
| 52 | + |
---|
| 53 | +u32 hw_atl_ts_data_get(struct aq_hw_s *aq_hw) |
---|
| 54 | +{ |
---|
| 55 | + return aq_hw_read_reg_bit(aq_hw, HW_ATL_TS_DATA_OUT_ADR, |
---|
| 56 | + HW_ATL_TS_DATA_OUT_MSK, |
---|
| 57 | + HW_ATL_TS_DATA_OUT_SHIFT); |
---|
| 58 | +} |
---|
17 | 59 | |
---|
18 | 60 | /* global */ |
---|
19 | 61 | void hw_atl_reg_glb_cpu_sem_set(struct aq_hw_s *aq_hw, u32 glb_cpu_sem, |
---|
.. | .. |
---|
49 | 91 | HW_ATL_GLB_SOFT_RES_SHIFT); |
---|
50 | 92 | } |
---|
51 | 93 | |
---|
52 | | -u32 hw_atl_reg_rx_dma_stat_counter7get(struct aq_hw_s *aq_hw) |
---|
53 | | -{ |
---|
54 | | - return aq_hw_read_reg(aq_hw, HW_ATL_RX_DMA_STAT_COUNTER7_ADR); |
---|
55 | | -} |
---|
56 | | - |
---|
57 | 94 | u32 hw_atl_reg_glb_mif_id_get(struct aq_hw_s *aq_hw) |
---|
58 | 95 | { |
---|
59 | 96 | return aq_hw_read_reg(aq_hw, HW_ATL_GLB_MIF_ID_ADR); |
---|
.. | .. |
---|
65 | 102 | return aq_hw_read_reg(aq_hw, HW_ATL_RPB_RX_DMA_DROP_PKT_CNT_ADR); |
---|
66 | 103 | } |
---|
67 | 104 | |
---|
68 | | -u32 hw_atl_stats_rx_dma_good_octet_counterlsw_get(struct aq_hw_s *aq_hw) |
---|
| 105 | +u64 hw_atl_stats_rx_dma_good_octet_counter_get(struct aq_hw_s *aq_hw) |
---|
69 | 106 | { |
---|
70 | | - return aq_hw_read_reg(aq_hw, HW_ATL_STATS_RX_DMA_GOOD_OCTET_COUNTERLSW); |
---|
| 107 | + return aq_hw_read_reg64(aq_hw, HW_ATL_STATS_RX_DMA_GOOD_OCTET_COUNTERLSW); |
---|
71 | 108 | } |
---|
72 | 109 | |
---|
73 | | -u32 hw_atl_stats_rx_dma_good_pkt_counterlsw_get(struct aq_hw_s *aq_hw) |
---|
| 110 | +u64 hw_atl_stats_rx_dma_good_pkt_counter_get(struct aq_hw_s *aq_hw) |
---|
74 | 111 | { |
---|
75 | | - return aq_hw_read_reg(aq_hw, HW_ATL_STATS_RX_DMA_GOOD_PKT_COUNTERLSW); |
---|
| 112 | + return aq_hw_read_reg64(aq_hw, HW_ATL_STATS_RX_DMA_GOOD_PKT_COUNTERLSW); |
---|
76 | 113 | } |
---|
77 | 114 | |
---|
78 | | -u32 hw_atl_stats_tx_dma_good_octet_counterlsw_get(struct aq_hw_s *aq_hw) |
---|
| 115 | +u64 hw_atl_stats_tx_dma_good_octet_counter_get(struct aq_hw_s *aq_hw) |
---|
79 | 116 | { |
---|
80 | | - return aq_hw_read_reg(aq_hw, HW_ATL_STATS_TX_DMA_GOOD_OCTET_COUNTERLSW); |
---|
| 117 | + return aq_hw_read_reg64(aq_hw, HW_ATL_STATS_TX_DMA_GOOD_OCTET_COUNTERLSW); |
---|
81 | 118 | } |
---|
82 | 119 | |
---|
83 | | -u32 hw_atl_stats_tx_dma_good_pkt_counterlsw_get(struct aq_hw_s *aq_hw) |
---|
| 120 | +u64 hw_atl_stats_tx_dma_good_pkt_counter_get(struct aq_hw_s *aq_hw) |
---|
84 | 121 | { |
---|
85 | | - return aq_hw_read_reg(aq_hw, HW_ATL_STATS_TX_DMA_GOOD_PKT_COUNTERLSW); |
---|
86 | | -} |
---|
87 | | - |
---|
88 | | -u32 hw_atl_stats_rx_dma_good_octet_countermsw_get(struct aq_hw_s *aq_hw) |
---|
89 | | -{ |
---|
90 | | - return aq_hw_read_reg(aq_hw, HW_ATL_STATS_RX_DMA_GOOD_OCTET_COUNTERMSW); |
---|
91 | | -} |
---|
92 | | - |
---|
93 | | -u32 hw_atl_stats_rx_dma_good_pkt_countermsw_get(struct aq_hw_s *aq_hw) |
---|
94 | | -{ |
---|
95 | | - return aq_hw_read_reg(aq_hw, HW_ATL_STATS_RX_DMA_GOOD_PKT_COUNTERMSW); |
---|
96 | | -} |
---|
97 | | - |
---|
98 | | -u32 hw_atl_stats_tx_dma_good_octet_countermsw_get(struct aq_hw_s *aq_hw) |
---|
99 | | -{ |
---|
100 | | - return aq_hw_read_reg(aq_hw, HW_ATL_STATS_TX_DMA_GOOD_OCTET_COUNTERMSW); |
---|
101 | | -} |
---|
102 | | - |
---|
103 | | -u32 hw_atl_stats_tx_dma_good_pkt_countermsw_get(struct aq_hw_s *aq_hw) |
---|
104 | | -{ |
---|
105 | | - return aq_hw_read_reg(aq_hw, HW_ATL_STATS_TX_DMA_GOOD_PKT_COUNTERMSW); |
---|
| 122 | + return aq_hw_read_reg64(aq_hw, HW_ATL_STATS_TX_DMA_GOOD_PKT_COUNTERLSW); |
---|
106 | 123 | } |
---|
107 | 124 | |
---|
108 | 125 | /* interrupt */ |
---|
.. | .. |
---|
313 | 330 | { |
---|
314 | 331 | aq_hw_write_reg_bit(aq_hw, HW_ATL_ITR_RES_ADR, HW_ATL_ITR_RES_MSK, |
---|
315 | 332 | HW_ATL_ITR_RES_SHIFT, res_irq); |
---|
| 333 | +} |
---|
| 334 | + |
---|
| 335 | +/* set RSC interrupt */ |
---|
| 336 | +void hw_atl_itr_rsc_en_set(struct aq_hw_s *aq_hw, u32 enable) |
---|
| 337 | +{ |
---|
| 338 | + aq_hw_write_reg(aq_hw, HW_ATL_ITR_RSC_EN_ADR, enable); |
---|
| 339 | +} |
---|
| 340 | + |
---|
| 341 | +/* set RSC delay */ |
---|
| 342 | +void hw_atl_itr_rsc_delay_set(struct aq_hw_s *aq_hw, u32 delay) |
---|
| 343 | +{ |
---|
| 344 | + aq_hw_write_reg_bit(aq_hw, HW_ATL_ITR_RSC_DELAY_ADR, |
---|
| 345 | + HW_ATL_ITR_RSC_DELAY_MSK, |
---|
| 346 | + HW_ATL_ITR_RSC_DELAY_SHIFT, |
---|
| 347 | + delay); |
---|
316 | 348 | } |
---|
317 | 349 | |
---|
318 | 350 | /* rdm */ |
---|
.. | .. |
---|
576 | 608 | HW_ATL_RPB_DMA_SYS_LBK_SHIFT, dma_sys_lbk); |
---|
577 | 609 | } |
---|
578 | 610 | |
---|
| 611 | +void hw_atl_rpb_dma_net_lbk_set(struct aq_hw_s *aq_hw, u32 dma_net_lbk) |
---|
| 612 | +{ |
---|
| 613 | + aq_hw_write_reg_bit(aq_hw, HW_ATL_RPB_DMA_NET_LBK_ADR, |
---|
| 614 | + HW_ATL_RPB_DMA_NET_LBK_MSK, |
---|
| 615 | + HW_ATL_RPB_DMA_NET_LBK_SHIFT, dma_net_lbk); |
---|
| 616 | +} |
---|
| 617 | + |
---|
579 | 618 | void hw_atl_rpb_rpf_rx_traf_class_mode_set(struct aq_hw_s *aq_hw, |
---|
580 | 619 | u32 rx_traf_class_mode) |
---|
581 | 620 | { |
---|
.. | .. |
---|
583 | 622 | HW_ATL_RPB_RPF_RX_TC_MODE_MSK, |
---|
584 | 623 | HW_ATL_RPB_RPF_RX_TC_MODE_SHIFT, |
---|
585 | 624 | rx_traf_class_mode); |
---|
| 625 | +} |
---|
| 626 | + |
---|
| 627 | +u32 hw_atl_rpb_rpf_rx_traf_class_mode_get(struct aq_hw_s *aq_hw) |
---|
| 628 | +{ |
---|
| 629 | + return aq_hw_read_reg_bit(aq_hw, HW_ATL_RPB_RPF_RX_TC_MODE_ADR, |
---|
| 630 | + HW_ATL_RPB_RPF_RX_TC_MODE_MSK, |
---|
| 631 | + HW_ATL_RPB_RPF_RX_TC_MODE_SHIFT); |
---|
586 | 632 | } |
---|
587 | 633 | |
---|
588 | 634 | void hw_atl_rpb_rx_buff_en_set(struct aq_hw_s *aq_hw, u32 rx_buff_en) |
---|
.. | .. |
---|
619 | 665 | HW_ATL_RPB_RX_FC_MODE_SHIFT, rx_flow_ctl_mode); |
---|
620 | 666 | } |
---|
621 | 667 | |
---|
622 | | -void hw_atl_rdm_rx_dma_desc_cache_init_set(struct aq_hw_s *aq_hw, u32 init) |
---|
| 668 | +void hw_atl_rdm_rx_dma_desc_cache_init_tgl(struct aq_hw_s *aq_hw) |
---|
623 | 669 | { |
---|
| 670 | + u32 val; |
---|
| 671 | + |
---|
| 672 | + val = aq_hw_read_reg_bit(aq_hw, HW_ATL_RDM_RX_DMA_DESC_CACHE_INIT_ADR, |
---|
| 673 | + HW_ATL_RDM_RX_DMA_DESC_CACHE_INIT_MSK, |
---|
| 674 | + HW_ATL_RDM_RX_DMA_DESC_CACHE_INIT_SHIFT); |
---|
| 675 | + |
---|
624 | 676 | aq_hw_write_reg_bit(aq_hw, HW_ATL_RDM_RX_DMA_DESC_CACHE_INIT_ADR, |
---|
625 | 677 | HW_ATL_RDM_RX_DMA_DESC_CACHE_INIT_MSK, |
---|
626 | 678 | HW_ATL_RDM_RX_DMA_DESC_CACHE_INIT_SHIFT, |
---|
627 | | - init); |
---|
| 679 | + val ^ 1); |
---|
| 680 | +} |
---|
| 681 | + |
---|
| 682 | +u32 hw_atl_rdm_rx_dma_desc_cache_init_done_get(struct aq_hw_s *aq_hw) |
---|
| 683 | +{ |
---|
| 684 | + return aq_hw_read_reg_bit(aq_hw, RDM_RX_DMA_DESC_CACHE_INIT_DONE_ADR, |
---|
| 685 | + RDM_RX_DMA_DESC_CACHE_INIT_DONE_MSK, |
---|
| 686 | + RDM_RX_DMA_DESC_CACHE_INIT_DONE_SHIFT); |
---|
628 | 687 | } |
---|
629 | 688 | |
---|
630 | 689 | void hw_atl_rpb_rx_pkt_buff_size_per_tc_set(struct aq_hw_s *aq_hw, |
---|
.. | .. |
---|
636 | 695 | rx_pkt_buff_size_per_tc); |
---|
637 | 696 | } |
---|
638 | 697 | |
---|
639 | | -void hw_atl_rpb_rx_xoff_en_per_tc_set(struct aq_hw_s *aq_hw, u32 rx_xoff_en_per_tc, |
---|
640 | | - u32 buffer) |
---|
| 698 | +void hw_atl_rpb_rx_xoff_en_per_tc_set(struct aq_hw_s *aq_hw, |
---|
| 699 | + u32 rx_xoff_en_per_tc, u32 buffer) |
---|
641 | 700 | { |
---|
642 | 701 | aq_hw_write_reg_bit(aq_hw, HW_ATL_RPB_RXBXOFF_EN_ADR(buffer), |
---|
643 | 702 | HW_ATL_RPB_RXBXOFF_EN_MSK, |
---|
.. | .. |
---|
677 | 736 | aq_hw_write_reg_bit(aq_hw, HW_ATL_RPFL2MC_ENF_ADR(filter), |
---|
678 | 737 | HW_ATL_RPFL2MC_ENF_MSK, |
---|
679 | 738 | HW_ATL_RPFL2MC_ENF_SHIFT, l2multicast_flr_en); |
---|
| 739 | +} |
---|
| 740 | + |
---|
| 741 | +u32 hw_atl_rpfl2promiscuous_mode_en_get(struct aq_hw_s *aq_hw) |
---|
| 742 | +{ |
---|
| 743 | + return aq_hw_read_reg_bit(aq_hw, HW_ATL_RPFL2PROMIS_MODE_ADR, |
---|
| 744 | + HW_ATL_RPFL2PROMIS_MODE_MSK, |
---|
| 745 | + HW_ATL_RPFL2PROMIS_MODE_SHIFT); |
---|
680 | 746 | } |
---|
681 | 747 | |
---|
682 | 748 | void hw_atl_rpfl2promiscuous_mode_en_set(struct aq_hw_s *aq_hw, |
---|
.. | .. |
---|
733 | 799 | } |
---|
734 | 800 | |
---|
735 | 801 | void hw_atl_rpf_rpb_user_priority_tc_map_set(struct aq_hw_s *aq_hw, |
---|
736 | | - u32 user_priority_tc_map, u32 tc) |
---|
| 802 | + u32 user_priority, u32 tc) |
---|
737 | 803 | { |
---|
738 | 804 | /* register address for bitfield rx_tc_up{t}[2:0] */ |
---|
739 | 805 | static u32 rpf_rpb_rx_tc_upt_adr[8] = { |
---|
.. | .. |
---|
752 | 818 | 0U, 4U, 8U, 12U, 16U, 20U, 24U, 28U |
---|
753 | 819 | }; |
---|
754 | 820 | |
---|
755 | | - aq_hw_write_reg_bit(aq_hw, rpf_rpb_rx_tc_upt_adr[tc], |
---|
756 | | - rpf_rpb_rx_tc_upt_msk[tc], |
---|
757 | | - rpf_rpb_rx_tc_upt_shft[tc], |
---|
758 | | - user_priority_tc_map); |
---|
| 821 | + aq_hw_write_reg_bit(aq_hw, rpf_rpb_rx_tc_upt_adr[user_priority], |
---|
| 822 | + rpf_rpb_rx_tc_upt_msk[user_priority], |
---|
| 823 | + rpf_rpb_rx_tc_upt_shft[user_priority], tc); |
---|
759 | 824 | } |
---|
760 | 825 | |
---|
761 | 826 | void hw_atl_rpf_rss_key_addr_set(struct aq_hw_s *aq_hw, u32 rss_key_addr) |
---|
.. | .. |
---|
853 | 918 | vlan_prom_mode_en); |
---|
854 | 919 | } |
---|
855 | 920 | |
---|
| 921 | +u32 hw_atl_rpf_vlan_prom_mode_en_get(struct aq_hw_s *aq_hw) |
---|
| 922 | +{ |
---|
| 923 | + return aq_hw_read_reg_bit(aq_hw, HW_ATL_RPF_VL_PROMIS_MODE_ADR, |
---|
| 924 | + HW_ATL_RPF_VL_PROMIS_MODE_MSK, |
---|
| 925 | + HW_ATL_RPF_VL_PROMIS_MODE_SHIFT); |
---|
| 926 | +} |
---|
| 927 | + |
---|
856 | 928 | void hw_atl_rpf_vlan_accept_untagged_packets_set(struct aq_hw_s *aq_hw, |
---|
857 | 929 | u32 vlan_acc_untagged_packets) |
---|
858 | 930 | { |
---|
.. | .. |
---|
897 | 969 | HW_ATL_RPF_VL_ID_F_SHIFT, |
---|
898 | 970 | vlan_id_flr); |
---|
899 | 971 | } |
---|
| 972 | + |
---|
| 973 | +void hw_atl_rpf_vlan_rxq_en_flr_set(struct aq_hw_s *aq_hw, u32 vlan_rxq_en, |
---|
| 974 | + u32 filter) |
---|
| 975 | +{ |
---|
| 976 | + aq_hw_write_reg_bit(aq_hw, HW_ATL_RPF_VL_RXQ_EN_F_ADR(filter), |
---|
| 977 | + HW_ATL_RPF_VL_RXQ_EN_F_MSK, |
---|
| 978 | + HW_ATL_RPF_VL_RXQ_EN_F_SHIFT, |
---|
| 979 | + vlan_rxq_en); |
---|
| 980 | +} |
---|
| 981 | + |
---|
| 982 | +void hw_atl_rpf_vlan_rxq_flr_set(struct aq_hw_s *aq_hw, u32 vlan_rxq, |
---|
| 983 | + u32 filter) |
---|
| 984 | +{ |
---|
| 985 | + aq_hw_write_reg_bit(aq_hw, HW_ATL_RPF_VL_RXQ_F_ADR(filter), |
---|
| 986 | + HW_ATL_RPF_VL_RXQ_F_MSK, |
---|
| 987 | + HW_ATL_RPF_VL_RXQ_F_SHIFT, |
---|
| 988 | + vlan_rxq); |
---|
| 989 | +}; |
---|
900 | 990 | |
---|
901 | 991 | void hw_atl_rpf_etht_flr_en_set(struct aq_hw_s *aq_hw, u32 etht_flr_en, |
---|
902 | 992 | u32 filter) |
---|
.. | .. |
---|
965 | 1055 | HW_ATL_RPF_ET_VALF_SHIFT, etht_flr); |
---|
966 | 1056 | } |
---|
967 | 1057 | |
---|
| 1058 | +void hw_atl_rpf_l4_spd_set(struct aq_hw_s *aq_hw, u32 val, u32 filter) |
---|
| 1059 | +{ |
---|
| 1060 | + aq_hw_write_reg_bit(aq_hw, HW_ATL_RPF_L4_SPD_ADR(filter), |
---|
| 1061 | + HW_ATL_RPF_L4_SPD_MSK, |
---|
| 1062 | + HW_ATL_RPF_L4_SPD_SHIFT, val); |
---|
| 1063 | +} |
---|
| 1064 | + |
---|
| 1065 | +void hw_atl_rpf_l4_dpd_set(struct aq_hw_s *aq_hw, u32 val, u32 filter) |
---|
| 1066 | +{ |
---|
| 1067 | + aq_hw_write_reg_bit(aq_hw, HW_ATL_RPF_L4_DPD_ADR(filter), |
---|
| 1068 | + HW_ATL_RPF_L4_DPD_MSK, |
---|
| 1069 | + HW_ATL_RPF_L4_DPD_SHIFT, val); |
---|
| 1070 | +} |
---|
| 1071 | + |
---|
968 | 1072 | /* RPO: rx packet offload */ |
---|
969 | 1073 | void hw_atl_rpo_ipv4header_crc_offload_en_set(struct aq_hw_s *aq_hw, |
---|
970 | 1074 | u32 ipv4header_crc_offload_en) |
---|
.. | .. |
---|
983 | 1087 | HW_ATL_RPO_DESCDVL_STRIP_MSK, |
---|
984 | 1088 | HW_ATL_RPO_DESCDVL_STRIP_SHIFT, |
---|
985 | 1089 | rx_desc_vlan_stripping); |
---|
| 1090 | +} |
---|
| 1091 | + |
---|
| 1092 | +void hw_atl_rpo_outer_vlan_tag_mode_set(void *context, |
---|
| 1093 | + u32 outervlantagmode) |
---|
| 1094 | +{ |
---|
| 1095 | + aq_hw_write_reg_bit(context, HW_ATL_RPO_OUTER_VL_INS_MODE_ADR, |
---|
| 1096 | + HW_ATL_RPO_OUTER_VL_INS_MODE_MSK, |
---|
| 1097 | + HW_ATL_RPO_OUTER_VL_INS_MODE_SHIFT, |
---|
| 1098 | + outervlantagmode); |
---|
| 1099 | +} |
---|
| 1100 | + |
---|
| 1101 | +u32 hw_atl_rpo_outer_vlan_tag_mode_get(void *context) |
---|
| 1102 | +{ |
---|
| 1103 | + return aq_hw_read_reg_bit(context, HW_ATL_RPO_OUTER_VL_INS_MODE_ADR, |
---|
| 1104 | + HW_ATL_RPO_OUTER_VL_INS_MODE_MSK, |
---|
| 1105 | + HW_ATL_RPO_OUTER_VL_INS_MODE_SHIFT); |
---|
986 | 1106 | } |
---|
987 | 1107 | |
---|
988 | 1108 | void hw_atl_rpo_tcp_udp_crc_offload_en_set(struct aq_hw_s *aq_hw, |
---|
.. | .. |
---|
1242 | 1362 | HW_ATL_TPB_TX_BUF_EN_SHIFT, tx_buff_en); |
---|
1243 | 1363 | } |
---|
1244 | 1364 | |
---|
| 1365 | +u32 hw_atl_tpb_tps_tx_tc_mode_get(struct aq_hw_s *aq_hw) |
---|
| 1366 | +{ |
---|
| 1367 | + return aq_hw_read_reg_bit(aq_hw, HW_ATL_TPB_TX_TC_MODE_ADDR, |
---|
| 1368 | + HW_ATL_TPB_TX_TC_MODE_MSK, |
---|
| 1369 | + HW_ATL_TPB_TX_TC_MODE_SHIFT); |
---|
| 1370 | +} |
---|
| 1371 | + |
---|
| 1372 | +void hw_atl_tpb_tps_tx_tc_mode_set(struct aq_hw_s *aq_hw, |
---|
| 1373 | + u32 tx_traf_class_mode) |
---|
| 1374 | +{ |
---|
| 1375 | + aq_hw_write_reg_bit(aq_hw, HW_ATL_TPB_TX_TC_MODE_ADDR, |
---|
| 1376 | + HW_ATL_TPB_TX_TC_MODE_MSK, |
---|
| 1377 | + HW_ATL_TPB_TX_TC_MODE_SHIFT, |
---|
| 1378 | + tx_traf_class_mode); |
---|
| 1379 | +} |
---|
| 1380 | + |
---|
1245 | 1381 | void hw_atl_tpb_tx_buff_hi_threshold_per_tc_set(struct aq_hw_s *aq_hw, |
---|
1246 | 1382 | u32 tx_buff_hi_threshold_per_tc, |
---|
1247 | 1383 | u32 buffer) |
---|
.. | .. |
---|
1270 | 1406 | tx_dma_sys_lbk_en); |
---|
1271 | 1407 | } |
---|
1272 | 1408 | |
---|
| 1409 | +void hw_atl_tpb_tx_dma_net_lbk_en_set(struct aq_hw_s *aq_hw, |
---|
| 1410 | + u32 tx_dma_net_lbk_en) |
---|
| 1411 | +{ |
---|
| 1412 | + aq_hw_write_reg_bit(aq_hw, HW_ATL_TPB_DMA_NET_LBK_ADR, |
---|
| 1413 | + HW_ATL_TPB_DMA_NET_LBK_MSK, |
---|
| 1414 | + HW_ATL_TPB_DMA_NET_LBK_SHIFT, |
---|
| 1415 | + tx_dma_net_lbk_en); |
---|
| 1416 | +} |
---|
| 1417 | + |
---|
| 1418 | +void hw_atl_tpb_tx_tx_clk_gate_en_set(struct aq_hw_s *aq_hw, |
---|
| 1419 | + u32 tx_clk_gate_en) |
---|
| 1420 | +{ |
---|
| 1421 | + aq_hw_write_reg_bit(aq_hw, HW_ATL_TPB_TX_CLK_GATE_EN_ADR, |
---|
| 1422 | + HW_ATL_TPB_TX_CLK_GATE_EN_MSK, |
---|
| 1423 | + HW_ATL_TPB_TX_CLK_GATE_EN_SHIFT, |
---|
| 1424 | + tx_clk_gate_en); |
---|
| 1425 | +} |
---|
| 1426 | + |
---|
1273 | 1427 | void hw_atl_tpb_tx_pkt_buff_size_per_tc_set(struct aq_hw_s *aq_hw, |
---|
| 1428 | + |
---|
1274 | 1429 | u32 tx_pkt_buff_size_per_tc, u32 buffer) |
---|
1275 | 1430 | { |
---|
1276 | 1431 | aq_hw_write_reg_bit(aq_hw, HW_ATL_TPB_TXBBUF_SIZE_ADR(buffer), |
---|
.. | .. |
---|
1353 | 1508 | } |
---|
1354 | 1509 | |
---|
1355 | 1510 | void hw_atl_tps_tx_pkt_shed_desc_tc_max_credit_set(struct aq_hw_s *aq_hw, |
---|
1356 | | - u32 max_credit, |
---|
1357 | | - u32 tc) |
---|
| 1511 | + const u32 tc, |
---|
| 1512 | + const u32 max_credit) |
---|
1358 | 1513 | { |
---|
1359 | 1514 | aq_hw_write_reg_bit(aq_hw, HW_ATL_TPS_DESC_TCTCREDIT_MAX_ADR(tc), |
---|
1360 | 1515 | HW_ATL_TPS_DESC_TCTCREDIT_MAX_MSK, |
---|
.. | .. |
---|
1363 | 1518 | } |
---|
1364 | 1519 | |
---|
1365 | 1520 | void hw_atl_tps_tx_pkt_shed_desc_tc_weight_set(struct aq_hw_s *aq_hw, |
---|
1366 | | - u32 tx_pkt_shed_desc_tc_weight, |
---|
1367 | | - u32 tc) |
---|
| 1521 | + const u32 tc, |
---|
| 1522 | + const u32 weight) |
---|
1368 | 1523 | { |
---|
1369 | 1524 | aq_hw_write_reg_bit(aq_hw, HW_ATL_TPS_DESC_TCTWEIGHT_ADR(tc), |
---|
1370 | 1525 | HW_ATL_TPS_DESC_TCTWEIGHT_MSK, |
---|
1371 | 1526 | HW_ATL_TPS_DESC_TCTWEIGHT_SHIFT, |
---|
1372 | | - tx_pkt_shed_desc_tc_weight); |
---|
| 1527 | + weight); |
---|
1373 | 1528 | } |
---|
1374 | 1529 | |
---|
1375 | 1530 | void hw_atl_tps_tx_pkt_shed_desc_vm_arb_mode_set(struct aq_hw_s *aq_hw, |
---|
.. | .. |
---|
1382 | 1537 | } |
---|
1383 | 1538 | |
---|
1384 | 1539 | void hw_atl_tps_tx_pkt_shed_tc_data_max_credit_set(struct aq_hw_s *aq_hw, |
---|
1385 | | - u32 max_credit, |
---|
1386 | | - u32 tc) |
---|
| 1540 | + const u32 tc, |
---|
| 1541 | + const u32 max_credit) |
---|
1387 | 1542 | { |
---|
1388 | 1543 | aq_hw_write_reg_bit(aq_hw, HW_ATL_TPS_DATA_TCTCREDIT_MAX_ADR(tc), |
---|
1389 | 1544 | HW_ATL_TPS_DATA_TCTCREDIT_MAX_MSK, |
---|
.. | .. |
---|
1392 | 1547 | } |
---|
1393 | 1548 | |
---|
1394 | 1549 | void hw_atl_tps_tx_pkt_shed_tc_data_weight_set(struct aq_hw_s *aq_hw, |
---|
1395 | | - u32 tx_pkt_shed_tc_data_weight, |
---|
1396 | | - u32 tc) |
---|
| 1550 | + const u32 tc, |
---|
| 1551 | + const u32 weight) |
---|
1397 | 1552 | { |
---|
1398 | 1553 | aq_hw_write_reg_bit(aq_hw, HW_ATL_TPS_DATA_TCTWEIGHT_ADR(tc), |
---|
1399 | 1554 | HW_ATL_TPS_DATA_TCTWEIGHT_MSK, |
---|
1400 | 1555 | HW_ATL_TPS_DATA_TCTWEIGHT_SHIFT, |
---|
1401 | | - tx_pkt_shed_tc_data_weight); |
---|
| 1556 | + weight); |
---|
| 1557 | +} |
---|
| 1558 | + |
---|
| 1559 | +void hw_atl_tps_tx_desc_rate_mode_set(struct aq_hw_s *aq_hw, |
---|
| 1560 | + const u32 rate_mode) |
---|
| 1561 | +{ |
---|
| 1562 | + aq_hw_write_reg_bit(aq_hw, HW_ATL_TPS_TX_DESC_RATE_MODE_ADR, |
---|
| 1563 | + HW_ATL_TPS_TX_DESC_RATE_MODE_MSK, |
---|
| 1564 | + HW_ATL_TPS_TX_DESC_RATE_MODE_SHIFT, |
---|
| 1565 | + rate_mode); |
---|
| 1566 | +} |
---|
| 1567 | + |
---|
| 1568 | +void hw_atl_tps_tx_desc_rate_en_set(struct aq_hw_s *aq_hw, const u32 desc, |
---|
| 1569 | + const u32 enable) |
---|
| 1570 | +{ |
---|
| 1571 | + aq_hw_write_reg_bit(aq_hw, HW_ATL_TPS_DESC_RATE_EN_ADR(desc), |
---|
| 1572 | + HW_ATL_TPS_DESC_RATE_EN_MSK, |
---|
| 1573 | + HW_ATL_TPS_DESC_RATE_EN_SHIFT, |
---|
| 1574 | + enable); |
---|
| 1575 | +} |
---|
| 1576 | + |
---|
| 1577 | +void hw_atl_tps_tx_desc_rate_x_set(struct aq_hw_s *aq_hw, const u32 desc, |
---|
| 1578 | + const u32 rate_int) |
---|
| 1579 | +{ |
---|
| 1580 | + aq_hw_write_reg_bit(aq_hw, HW_ATL_TPS_DESC_RATE_X_ADR(desc), |
---|
| 1581 | + HW_ATL_TPS_DESC_RATE_X_MSK, |
---|
| 1582 | + HW_ATL_TPS_DESC_RATE_X_SHIFT, |
---|
| 1583 | + rate_int); |
---|
| 1584 | +} |
---|
| 1585 | + |
---|
| 1586 | +void hw_atl_tps_tx_desc_rate_y_set(struct aq_hw_s *aq_hw, const u32 desc, |
---|
| 1587 | + const u32 rate_frac) |
---|
| 1588 | +{ |
---|
| 1589 | + aq_hw_write_reg_bit(aq_hw, HW_ATL_TPS_DESC_RATE_Y_ADR(desc), |
---|
| 1590 | + HW_ATL_TPS_DESC_RATE_Y_MSK, |
---|
| 1591 | + HW_ATL_TPS_DESC_RATE_Y_SHIFT, |
---|
| 1592 | + rate_frac); |
---|
1402 | 1593 | } |
---|
1403 | 1594 | |
---|
1404 | 1595 | /* tx */ |
---|
.. | .. |
---|
1469 | 1660 | glb_cpu_scratch_scp); |
---|
1470 | 1661 | } |
---|
1471 | 1662 | |
---|
| 1663 | +void hw_atl_pcs_ptp_clock_read_enable(struct aq_hw_s *aq_hw, |
---|
| 1664 | + u32 ptp_clock_read_enable) |
---|
| 1665 | +{ |
---|
| 1666 | + aq_hw_write_reg_bit(aq_hw, HW_ATL_PCS_PTP_CLOCK_READ_ENABLE_ADR, |
---|
| 1667 | + HW_ATL_PCS_PTP_CLOCK_READ_ENABLE_MSK, |
---|
| 1668 | + HW_ATL_PCS_PTP_CLOCK_READ_ENABLE_SHIFT, |
---|
| 1669 | + ptp_clock_read_enable); |
---|
| 1670 | +} |
---|
| 1671 | + |
---|
| 1672 | +u32 hw_atl_pcs_ptp_clock_get(struct aq_hw_s *aq_hw, u32 index) |
---|
| 1673 | +{ |
---|
| 1674 | + return aq_hw_read_reg(aq_hw, HW_ATL_PCS_PTP_TS_VAL_ADDR(index)); |
---|
| 1675 | +} |
---|
| 1676 | + |
---|
1472 | 1677 | void hw_atl_mcp_up_force_intr_set(struct aq_hw_s *aq_hw, u32 up_force_intr) |
---|
1473 | 1678 | { |
---|
1474 | 1679 | aq_hw_write_reg_bit(aq_hw, HW_ATL_MCP_UP_FORCE_INTERRUPT_ADR, |
---|
.. | .. |
---|
1476 | 1681 | HW_ATL_MCP_UP_FORCE_INTERRUPT_SHIFT, |
---|
1477 | 1682 | up_force_intr); |
---|
1478 | 1683 | } |
---|
| 1684 | + |
---|
| 1685 | +void hw_atl_rpfl3l4_ipv4_dest_addr_clear(struct aq_hw_s *aq_hw, u8 location) |
---|
| 1686 | +{ |
---|
| 1687 | + aq_hw_write_reg(aq_hw, HW_ATL_RPF_L3_DSTA_ADR(location), 0U); |
---|
| 1688 | +} |
---|
| 1689 | + |
---|
| 1690 | +void hw_atl_rpfl3l4_ipv4_src_addr_clear(struct aq_hw_s *aq_hw, u8 location) |
---|
| 1691 | +{ |
---|
| 1692 | + aq_hw_write_reg(aq_hw, HW_ATL_RPF_L3_SRCA_ADR(location), 0U); |
---|
| 1693 | +} |
---|
| 1694 | + |
---|
| 1695 | +void hw_atl_rpfl3l4_cmd_clear(struct aq_hw_s *aq_hw, u8 location) |
---|
| 1696 | +{ |
---|
| 1697 | + aq_hw_write_reg(aq_hw, HW_ATL_RPF_L3_REG_CTRL_ADR(location), 0U); |
---|
| 1698 | +} |
---|
| 1699 | + |
---|
| 1700 | +void hw_atl_rpfl3l4_ipv6_dest_addr_clear(struct aq_hw_s *aq_hw, u8 location) |
---|
| 1701 | +{ |
---|
| 1702 | + int i; |
---|
| 1703 | + |
---|
| 1704 | + for (i = 0; i < 4; ++i) |
---|
| 1705 | + aq_hw_write_reg(aq_hw, |
---|
| 1706 | + HW_ATL_RPF_L3_DSTA_ADR(location + i), |
---|
| 1707 | + 0U); |
---|
| 1708 | +} |
---|
| 1709 | + |
---|
| 1710 | +void hw_atl_rpfl3l4_ipv6_src_addr_clear(struct aq_hw_s *aq_hw, u8 location) |
---|
| 1711 | +{ |
---|
| 1712 | + int i; |
---|
| 1713 | + |
---|
| 1714 | + for (i = 0; i < 4; ++i) |
---|
| 1715 | + aq_hw_write_reg(aq_hw, |
---|
| 1716 | + HW_ATL_RPF_L3_SRCA_ADR(location + i), |
---|
| 1717 | + 0U); |
---|
| 1718 | +} |
---|
| 1719 | + |
---|
| 1720 | +void hw_atl_rpfl3l4_ipv4_dest_addr_set(struct aq_hw_s *aq_hw, u8 location, |
---|
| 1721 | + u32 ipv4_dest) |
---|
| 1722 | +{ |
---|
| 1723 | + aq_hw_write_reg(aq_hw, HW_ATL_RPF_L3_DSTA_ADR(location), |
---|
| 1724 | + ipv4_dest); |
---|
| 1725 | +} |
---|
| 1726 | + |
---|
| 1727 | +void hw_atl_rpfl3l4_ipv4_src_addr_set(struct aq_hw_s *aq_hw, u8 location, |
---|
| 1728 | + u32 ipv4_src) |
---|
| 1729 | +{ |
---|
| 1730 | + aq_hw_write_reg(aq_hw, |
---|
| 1731 | + HW_ATL_RPF_L3_SRCA_ADR(location), |
---|
| 1732 | + ipv4_src); |
---|
| 1733 | +} |
---|
| 1734 | + |
---|
| 1735 | +void hw_atl_rpfl3l4_cmd_set(struct aq_hw_s *aq_hw, u8 location, u32 cmd) |
---|
| 1736 | +{ |
---|
| 1737 | + aq_hw_write_reg(aq_hw, HW_ATL_RPF_L3_REG_CTRL_ADR(location), cmd); |
---|
| 1738 | +} |
---|
| 1739 | + |
---|
| 1740 | +void hw_atl_rpfl3l4_ipv6_src_addr_set(struct aq_hw_s *aq_hw, u8 location, |
---|
| 1741 | + u32 *ipv6_src) |
---|
| 1742 | +{ |
---|
| 1743 | + int i; |
---|
| 1744 | + |
---|
| 1745 | + for (i = 0; i < 4; ++i) |
---|
| 1746 | + aq_hw_write_reg(aq_hw, |
---|
| 1747 | + HW_ATL_RPF_L3_SRCA_ADR(location + i), |
---|
| 1748 | + ipv6_src[3 - i]); |
---|
| 1749 | +} |
---|
| 1750 | + |
---|
| 1751 | +void hw_atl_rpfl3l4_ipv6_dest_addr_set(struct aq_hw_s *aq_hw, u8 location, |
---|
| 1752 | + u32 *ipv6_dest) |
---|
| 1753 | +{ |
---|
| 1754 | + int i; |
---|
| 1755 | + |
---|
| 1756 | + for (i = 0; i < 4; ++i) |
---|
| 1757 | + aq_hw_write_reg(aq_hw, |
---|
| 1758 | + HW_ATL_RPF_L3_DSTA_ADR(location + i), |
---|
| 1759 | + ipv6_dest[3 - i]); |
---|
| 1760 | +} |
---|
| 1761 | + |
---|
| 1762 | +u32 hw_atl_sem_ram_get(struct aq_hw_s *self) |
---|
| 1763 | +{ |
---|
| 1764 | + return hw_atl_reg_glb_cpu_sem_get(self, HW_ATL_FW_SM_RAM); |
---|
| 1765 | +} |
---|
| 1766 | + |
---|
| 1767 | +u32 hw_atl_sem_mdio_get(struct aq_hw_s *self) |
---|
| 1768 | +{ |
---|
| 1769 | + return hw_atl_reg_glb_cpu_sem_get(self, HW_ATL_FW_SM_MDIO); |
---|
| 1770 | +} |
---|
| 1771 | + |
---|
| 1772 | +u32 hw_atl_sem_reset1_get(struct aq_hw_s *self) |
---|
| 1773 | +{ |
---|
| 1774 | + return hw_atl_reg_glb_cpu_sem_get(self, HW_ATL_FW_SM_RESET1); |
---|
| 1775 | +} |
---|
| 1776 | + |
---|
| 1777 | +u32 hw_atl_sem_reset2_get(struct aq_hw_s *self) |
---|
| 1778 | +{ |
---|
| 1779 | + return hw_atl_reg_glb_cpu_sem_get(self, HW_ATL_FW_SM_RESET2); |
---|
| 1780 | +} |
---|
| 1781 | + |
---|
| 1782 | +u32 hw_atl_scrpad_get(struct aq_hw_s *aq_hw, u32 scratch_scp) |
---|
| 1783 | +{ |
---|
| 1784 | + return aq_hw_read_reg(aq_hw, |
---|
| 1785 | + HW_ATL_GLB_CPU_SCRATCH_SCP_ADR(scratch_scp)); |
---|
| 1786 | +} |
---|
| 1787 | + |
---|
| 1788 | +u32 hw_atl_scrpad12_get(struct aq_hw_s *self) |
---|
| 1789 | +{ |
---|
| 1790 | + return hw_atl_scrpad_get(self, 0xB); |
---|
| 1791 | +} |
---|
| 1792 | + |
---|
| 1793 | +u32 hw_atl_scrpad25_get(struct aq_hw_s *self) |
---|
| 1794 | +{ |
---|
| 1795 | + return hw_atl_scrpad_get(self, 0x18); |
---|
| 1796 | +} |
---|
| 1797 | + |
---|
| 1798 | +void hw_atl_glb_mdio_iface1_set(struct aq_hw_s *aq_hw, u32 value) |
---|
| 1799 | +{ |
---|
| 1800 | + aq_hw_write_reg(aq_hw, HW_ATL_GLB_MDIO_IFACE_N_ADR(1), value); |
---|
| 1801 | +} |
---|
| 1802 | + |
---|
| 1803 | +u32 hw_atl_glb_mdio_iface1_get(struct aq_hw_s *aq_hw) |
---|
| 1804 | +{ |
---|
| 1805 | + return aq_hw_read_reg(aq_hw, HW_ATL_GLB_MDIO_IFACE_N_ADR(1)); |
---|
| 1806 | +} |
---|
| 1807 | + |
---|
| 1808 | +void hw_atl_glb_mdio_iface2_set(struct aq_hw_s *aq_hw, u32 value) |
---|
| 1809 | +{ |
---|
| 1810 | + aq_hw_write_reg(aq_hw, HW_ATL_GLB_MDIO_IFACE_N_ADR(2), value); |
---|
| 1811 | +} |
---|
| 1812 | + |
---|
| 1813 | +u32 hw_atl_glb_mdio_iface2_get(struct aq_hw_s *aq_hw) |
---|
| 1814 | +{ |
---|
| 1815 | + return aq_hw_read_reg(aq_hw, HW_ATL_GLB_MDIO_IFACE_N_ADR(2)); |
---|
| 1816 | +} |
---|
| 1817 | + |
---|
| 1818 | +void hw_atl_glb_mdio_iface3_set(struct aq_hw_s *aq_hw, u32 value) |
---|
| 1819 | +{ |
---|
| 1820 | + aq_hw_write_reg(aq_hw, HW_ATL_GLB_MDIO_IFACE_N_ADR(3), value); |
---|
| 1821 | +} |
---|
| 1822 | + |
---|
| 1823 | +u32 hw_atl_glb_mdio_iface3_get(struct aq_hw_s *aq_hw) |
---|
| 1824 | +{ |
---|
| 1825 | + return aq_hw_read_reg(aq_hw, HW_ATL_GLB_MDIO_IFACE_N_ADR(3)); |
---|
| 1826 | +} |
---|
| 1827 | + |
---|
| 1828 | +void hw_atl_glb_mdio_iface4_set(struct aq_hw_s *aq_hw, u32 value) |
---|
| 1829 | +{ |
---|
| 1830 | + aq_hw_write_reg(aq_hw, HW_ATL_GLB_MDIO_IFACE_N_ADR(4), value); |
---|
| 1831 | +} |
---|
| 1832 | + |
---|
| 1833 | +u32 hw_atl_glb_mdio_iface4_get(struct aq_hw_s *aq_hw) |
---|
| 1834 | +{ |
---|
| 1835 | + return aq_hw_read_reg(aq_hw, HW_ATL_GLB_MDIO_IFACE_N_ADR(4)); |
---|
| 1836 | +} |
---|
| 1837 | + |
---|
| 1838 | +void hw_atl_glb_mdio_iface5_set(struct aq_hw_s *aq_hw, u32 value) |
---|
| 1839 | +{ |
---|
| 1840 | + aq_hw_write_reg(aq_hw, HW_ATL_GLB_MDIO_IFACE_N_ADR(5), value); |
---|
| 1841 | +} |
---|
| 1842 | + |
---|
| 1843 | +u32 hw_atl_glb_mdio_iface5_get(struct aq_hw_s *aq_hw) |
---|
| 1844 | +{ |
---|
| 1845 | + return aq_hw_read_reg(aq_hw, HW_ATL_GLB_MDIO_IFACE_N_ADR(5)); |
---|
| 1846 | +} |
---|
| 1847 | + |
---|
| 1848 | +u32 hw_atl_mdio_busy_get(struct aq_hw_s *aq_hw) |
---|
| 1849 | +{ |
---|
| 1850 | + return aq_hw_read_reg_bit(aq_hw, HW_ATL_MDIO_BUSY_ADR, |
---|
| 1851 | + HW_ATL_MDIO_BUSY_MSK, |
---|
| 1852 | + HW_ATL_MDIO_BUSY_SHIFT); |
---|
| 1853 | +} |
---|