Skip to content

Commit df7116b

Browse files
bcchen28411frank-w
authored andcommitted
net: ethernet: mtk_eth_soc: revise hardware configuration for mt7987
Change hardware configuration for the MT7987. - Enable PSE drop mechanism when the WDMA Rx ring full - Enable PSE no-drop mechanism for packets from the WDMA Tx Signed-off-by: Bo-Cun Chen <bc-bocun.chen@mediatek.com>
1 parent e69d41f commit df7116b

1 file changed

Lines changed: 33 additions & 20 deletions

File tree

drivers/net/ethernet/mediatek/mtk_eth_soc.c

Lines changed: 33 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4666,27 +4666,40 @@ static int mtk_hw_init(struct mtk_eth *eth, bool reset)
46664666
mtk_w32(eth, PSE_DUMMY_WORK_GDM(1) | PSE_DUMMY_WORK_GDM(2) |
46674667
PSE_DUMMY_WORK_GDM(3) | DUMMY_PAGE_THR, PSE_DUMY_REQ);
46684668

4669-
/* PSE free buffer drop threshold */
4670-
mtk_w32(eth, 0x00600009, PSE_IQ_REV(8));
4671-
4672-
/* PSE should not drop port8, port9 and port13 packets from
4673-
* WDMA Tx
4674-
*/
4675-
mtk_w32(eth, 0x00002300, PSE_DROP_CFG);
4676-
4677-
/* PSE should drop packets to port8, port9 and port13 on WDMA Rx
4678-
* ring full
4679-
*/
4680-
mtk_w32(eth, 0x00002300, PSE_PPE_DROP(0));
4681-
mtk_w32(eth, 0x00002300, PSE_PPE_DROP(1));
4682-
mtk_w32(eth, 0x00002300, PSE_PPE_DROP(2));
4683-
4684-
/* GDM and CDM Threshold */
4685-
mtk_w32(eth, 0x08000707, MTK_CDMW0_THRES);
4686-
mtk_w32(eth, 0x00000077, MTK_CDMW1_THRES);
4669+
if (eth->soc->caps == MT7988_CAPS) {
4670+
/* PSE free buffer drop threshold */
4671+
mtk_w32(eth, 0x00600009, PSE_IQ_REV(8));
4672+
4673+
/* PSE should not drop port8, port9 and port13 packets
4674+
* from WDMA Tx
4675+
*/
4676+
mtk_w32(eth, 0x00002300, PSE_DROP_CFG);
4677+
4678+
/* PSE should drop packets to port8, port9 and port13
4679+
* on WDMA Rx ring full
4680+
*/
4681+
mtk_w32(eth, 0x00002300, PSE_PPE_DROP(0));
4682+
mtk_w32(eth, 0x00002300, PSE_PPE_DROP(1));
4683+
mtk_w32(eth, 0x00002300, PSE_PPE_DROP(2));
4684+
4685+
/* GDM and CDM Threshold */
4686+
mtk_w32(eth, 0x08000707, MTK_CDMW0_THRES);
4687+
mtk_w32(eth, 0x00000077, MTK_CDMW1_THRES);
4688+
} else if (eth->soc->caps == MT7987_CAPS) {
4689+
/* PSE should not drop port8 packets from WDMA Tx */
4690+
mtk_w32(eth, 0x00000100, PSE_DROP_CFG);
4691+
4692+
/* PSE should drop packets to port8 on WDMA Rx ring
4693+
* full
4694+
*/
4695+
mtk_w32(eth, 0x00000100, PSE_PPE_DROP(0));
4696+
mtk_w32(eth, 0x00000100, PSE_PPE_DROP(1));
4697+
}
46874698

4688-
/* Disable GDM1 RX CRC stripping */
4689-
mtk_m32(eth, MTK_GDMA_STRP_CRC, 0, MTK_GDMA_FWD_CFG(0));
4699+
if (MTK_HAS_CAPS(eth->soc->caps, MTK_ESW)) {
4700+
/* Disable GDM1 RX CRC stripping */
4701+
mtk_m32(eth, MTK_GDMA_STRP_CRC, 0, MTK_GDMA_FWD_CFG(0));
4702+
}
46904703

46914704
/* PSE GDM3 MIB counter has incorrect hw default values,
46924705
* so the driver ought to read clear the values beforehand

0 commit comments

Comments
 (0)