mirror of
https://github.com/hanwckf/immortalwrt-mt798x.git
synced 2025-01-07 01:53:34 +08:00
[Description]
Fix DMA init timeout in network-restart stress test : 1. Turn on the gmac forwarding when mkt_open is only halfway initialized or start deinit in mtk_close without forbid forwarding in gmac, this can lead to unknown exceptions. 2. Update the init/deinit order in mtk_open/mtk_close. 3. Move the configure of gdm from mtk_mac_config to mtk_hw_init, avoid asynchronous operations on gdm config. 4. Update related patches. [Release-log] N/A Change-Id: I80f594948b0c0ddc7eb34bb47e78e2ff74229f6a Reviewed-on: https://gerrit.mediatek.inc/c/openwrt/feeds/mtk_openwrt_feeds/+/6728789
This commit is contained in:
parent
6dfac66b1d
commit
830fabf704
@ -345,7 +345,8 @@ void mtk_prepare_reset_fe(struct mtk_eth *eth)
|
|||||||
mtk_w32(eth, val & ~(MAC_MCR_RX_EN), MTK_MAC_MCR(1));
|
mtk_w32(eth, val & ~(MAC_MCR_RX_EN), MTK_MAC_MCR(1));
|
||||||
|
|
||||||
/* Enable GDM drop */
|
/* Enable GDM drop */
|
||||||
mtk_gdm_config(eth, MTK_GDMA_DROP_ALL);
|
for (i = 0; i < MTK_MAC_COUNT; i++)
|
||||||
|
mtk_gdm_config(eth, i, MTK_GDMA_DROP_ALL);
|
||||||
|
|
||||||
/* Disable ADMA Rx */
|
/* Disable ADMA Rx */
|
||||||
val = mtk_r32(eth, MTK_PDMA_GLO_CFG);
|
val = mtk_r32(eth, MTK_PDMA_GLO_CFG);
|
||||||
|
@ -2611,29 +2611,27 @@ static int mtk_start_dma(struct mtk_eth *eth)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void mtk_gdm_config(struct mtk_eth *eth, u32 config)
|
void mtk_gdm_config(struct mtk_eth *eth, u32 id, u32 config)
|
||||||
{
|
{
|
||||||
int i;
|
u32 val;
|
||||||
|
|
||||||
if (MTK_HAS_CAPS(eth->soc->caps, MTK_SOC_MT7628))
|
if (MTK_HAS_CAPS(eth->soc->caps, MTK_SOC_MT7628))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (i = 0; i < MTK_MAC_COUNT; i++) {
|
val = mtk_r32(eth, MTK_GDMA_FWD_CFG(id));
|
||||||
u32 val = mtk_r32(eth, MTK_GDMA_FWD_CFG(i));
|
|
||||||
|
|
||||||
/* default setup the forward port to send frame to PDMA */
|
/* default setup the forward port to send frame to PDMA */
|
||||||
val &= ~0xffff;
|
val &= ~0xffff;
|
||||||
|
|
||||||
/* Enable RX checksum */
|
/* Enable RX checksum */
|
||||||
val |= MTK_GDMA_ICS_EN | MTK_GDMA_TCS_EN | MTK_GDMA_UCS_EN;
|
val |= MTK_GDMA_ICS_EN | MTK_GDMA_TCS_EN | MTK_GDMA_UCS_EN;
|
||||||
|
|
||||||
val |= config;
|
val |= config;
|
||||||
|
|
||||||
if (eth->netdev[i] && netdev_uses_dsa(eth->netdev[i]))
|
if (eth->netdev[id] && netdev_uses_dsa(eth->netdev[id]))
|
||||||
val |= MTK_GDMA_SPECIAL_TAG;
|
val |= MTK_GDMA_SPECIAL_TAG;
|
||||||
|
|
||||||
mtk_w32(eth, val, MTK_GDMA_FWD_CFG(i));
|
mtk_w32(eth, val, MTK_GDMA_FWD_CFG(id));
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int mtk_open(struct net_device *dev)
|
static int mtk_open(struct net_device *dev)
|
||||||
@ -2657,7 +2655,6 @@ static int mtk_open(struct net_device *dev)
|
|||||||
if (err)
|
if (err)
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
mtk_gdm_config(eth, MTK_GDMA_TO_PDMA);
|
|
||||||
|
|
||||||
/* Indicates CDM to parse the MTK special tag from CPU */
|
/* Indicates CDM to parse the MTK special tag from CPU */
|
||||||
if (netdev_uses_dsa(dev)) {
|
if (netdev_uses_dsa(dev)) {
|
||||||
@ -2691,6 +2688,9 @@ static int mtk_open(struct net_device *dev)
|
|||||||
if (!phy_node && eth->sgmii->regmap[mac->id]) {
|
if (!phy_node && eth->sgmii->regmap[mac->id]) {
|
||||||
regmap_write(eth->sgmii->regmap[mac->id], SGMSYS_QPHY_PWR_STATE_CTRL, 0);
|
regmap_write(eth->sgmii->regmap[mac->id], SGMSYS_QPHY_PWR_STATE_CTRL, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mtk_gdm_config(eth, mac->id, MTK_GDMA_TO_PDMA);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2725,6 +2725,7 @@ static int mtk_stop(struct net_device *dev)
|
|||||||
u32 val = 0;
|
u32 val = 0;
|
||||||
struct device_node *phy_node;
|
struct device_node *phy_node;
|
||||||
|
|
||||||
|
mtk_gdm_config(eth, mac->id, MTK_GDMA_DROP_ALL);
|
||||||
netif_tx_disable(dev);
|
netif_tx_disable(dev);
|
||||||
|
|
||||||
phy_node = of_parse_phandle(mac->of_node, "phy-handle", 0);
|
phy_node = of_parse_phandle(mac->of_node, "phy-handle", 0);
|
||||||
@ -2750,7 +2751,6 @@ static int mtk_stop(struct net_device *dev)
|
|||||||
if (!refcount_dec_and_test(ð->dma_refcnt))
|
if (!refcount_dec_and_test(ð->dma_refcnt))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
mtk_gdm_config(eth, MTK_GDMA_DROP_ALL);
|
|
||||||
|
|
||||||
mtk_tx_irq_disable(eth, MTK_TX_DONE_INT);
|
mtk_tx_irq_disable(eth, MTK_TX_DONE_INT);
|
||||||
mtk_rx_irq_disable(eth, MTK_RX_DONE_INT(0));
|
mtk_rx_irq_disable(eth, MTK_RX_DONE_INT(0));
|
||||||
|
@ -1316,7 +1316,7 @@ void mtk_sgmii_restart_an(struct mtk_eth *eth, int mac_id);
|
|||||||
int mtk_gmac_sgmii_path_setup(struct mtk_eth *eth, int mac_id);
|
int mtk_gmac_sgmii_path_setup(struct mtk_eth *eth, int mac_id);
|
||||||
int mtk_gmac_gephy_path_setup(struct mtk_eth *eth, int mac_id);
|
int mtk_gmac_gephy_path_setup(struct mtk_eth *eth, int mac_id);
|
||||||
int mtk_gmac_rgmii_path_setup(struct mtk_eth *eth, int mac_id);
|
int mtk_gmac_rgmii_path_setup(struct mtk_eth *eth, int mac_id);
|
||||||
void mtk_gdm_config(struct mtk_eth *eth, u32 config);
|
void mtk_gdm_config(struct mtk_eth *eth, u32 id, u32 config);
|
||||||
void ethsys_reset(struct mtk_eth *eth, u32 reset_bits);
|
void ethsys_reset(struct mtk_eth *eth, u32 reset_bits);
|
||||||
|
|
||||||
#endif /* MTK_ETH_H */
|
#endif /* MTK_ETH_H */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user