@@ -4328,27 +4328,40 @@ static int mtk_hw_init(struct mtk_eth *eth, bool reset)
43284328 mtk_w32 (eth , PSE_DUMMY_WORK_GDM (1 ) | PSE_DUMMY_WORK_GDM (2 ) |
43294329 PSE_DUMMY_WORK_GDM (3 ) | DUMMY_PAGE_THR , PSE_DUMY_REQ );
43304330
4331- /* PSE free buffer drop threshold */
4332- mtk_w32 (eth , 0x00600009 , PSE_IQ_REV (8 ));
4333-
4334- /* PSE should not drop port8, port9 and port13 packets from
4335- * WDMA Tx
4336- */
4337- mtk_w32 (eth , 0x00002300 , PSE_DROP_CFG );
4338-
4339- /* PSE should drop packets to port8, port9 and port13 on WDMA Rx
4340- * ring full
4341- */
4342- mtk_w32 (eth , 0x00002300 , PSE_PPE_DROP (0 ));
4343- mtk_w32 (eth , 0x00002300 , PSE_PPE_DROP (1 ));
4344- mtk_w32 (eth , 0x00002300 , PSE_PPE_DROP (2 ));
4345-
4346- /* GDM and CDM Threshold */
4347- mtk_w32 (eth , 0x08000707 , MTK_CDMW0_THRES );
4348- mtk_w32 (eth , 0x00000077 , MTK_CDMW1_THRES );
4331+ if (eth -> soc -> caps == MT7988_CAPS ) {
4332+ /* PSE free buffer drop threshold */
4333+ mtk_w32 (eth , 0x00600009 , PSE_IQ_REV (8 ));
4334+
4335+ /* PSE should not drop port8, port9 and port13 packets
4336+ * from WDMA Tx
4337+ */
4338+ mtk_w32 (eth , 0x00002300 , PSE_DROP_CFG );
4339+
4340+ /* PSE should drop packets to port8, port9 and port13
4341+ * on WDMA Rx ring full
4342+ */
4343+ mtk_w32 (eth , 0x00002300 , PSE_PPE_DROP (0 ));
4344+ mtk_w32 (eth , 0x00002300 , PSE_PPE_DROP (1 ));
4345+ mtk_w32 (eth , 0x00002300 , PSE_PPE_DROP (2 ));
4346+
4347+ /* GDM and CDM Threshold */
4348+ mtk_w32 (eth , 0x08000707 , MTK_CDMW0_THRES );
4349+ mtk_w32 (eth , 0x00000077 , MTK_CDMW1_THRES );
4350+ } else if (eth -> soc -> caps == MT7987_CAPS ) {
4351+ /* PSE should not drop port8 packets from WDMA Tx */
4352+ mtk_w32 (eth , 0x00000100 , PSE_DROP_CFG );
4353+
4354+ /* PSE should drop packets to port8 on WDMA Rx ring
4355+ * full
4356+ */
4357+ mtk_w32 (eth , 0x00000100 , PSE_PPE_DROP (0 ));
4358+ mtk_w32 (eth , 0x00000100 , PSE_PPE_DROP (1 ));
4359+ }
43494360
4350- /* Disable GDM1 RX CRC stripping */
4351- mtk_m32 (eth , MTK_GDMA_STRP_CRC , 0 , MTK_GDMA_FWD_CFG (0 ));
4361+ if (MTK_HAS_CAPS (eth -> soc -> caps , MTK_ESW )) {
4362+ /* Disable GDM1 RX CRC stripping */
4363+ mtk_m32 (eth , MTK_GDMA_STRP_CRC , 0 , MTK_GDMA_FWD_CFG (0 ));
4364+ }
43524365
43534366 /* PSE GDM3 MIB counter has incorrect hw default values,
43544367 * so the driver ought to read clear the values beforehand
0 commit comments