Commit a008e2a8 authored by Lorenzo Bianconi's avatar Lorenzo Bianconi Committed by Jakub Kicinski

net: ethernet: mtk_eth_soc: add version in mtk_soc_data

Introduce version field in mtk_soc_data data structure in order to
make mtk_eth driver easier to maintain for chipset configuration
codebase. Get rid of MTK_NETSYS_V2 bit in chip capabilities.
This is a preliminary patch to introduce support for MT7988 SoC.
Signed-off-by: default avatarLorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: default avatarDaniel Golle <daniel@makrotopia.org>
Link: https://lore.kernel.org/r/e52fae302ca135436e5cdd26d38d87be2da63055.1690246066.git.daniel@makrotopia.orgSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent c94a9aab
...@@ -593,7 +593,7 @@ static void mtk_set_queue_speed(struct mtk_eth *eth, unsigned int idx, ...@@ -593,7 +593,7 @@ static void mtk_set_queue_speed(struct mtk_eth *eth, unsigned int idx,
FIELD_PREP(MTK_QTX_SCH_MIN_RATE_MAN, 1) | FIELD_PREP(MTK_QTX_SCH_MIN_RATE_MAN, 1) |
FIELD_PREP(MTK_QTX_SCH_MIN_RATE_EXP, 4) | FIELD_PREP(MTK_QTX_SCH_MIN_RATE_EXP, 4) |
MTK_QTX_SCH_LEAKY_BUCKET_SIZE; MTK_QTX_SCH_LEAKY_BUCKET_SIZE;
if (!MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V2)) if (mtk_is_netsys_v1(eth))
val |= MTK_QTX_SCH_LEAKY_BUCKET_EN; val |= MTK_QTX_SCH_LEAKY_BUCKET_EN;
if (IS_ENABLED(CONFIG_SOC_MT7621)) { if (IS_ENABLED(CONFIG_SOC_MT7621)) {
...@@ -970,7 +970,7 @@ static bool mtk_rx_get_desc(struct mtk_eth *eth, struct mtk_rx_dma_v2 *rxd, ...@@ -970,7 +970,7 @@ static bool mtk_rx_get_desc(struct mtk_eth *eth, struct mtk_rx_dma_v2 *rxd,
rxd->rxd1 = READ_ONCE(dma_rxd->rxd1); rxd->rxd1 = READ_ONCE(dma_rxd->rxd1);
rxd->rxd3 = READ_ONCE(dma_rxd->rxd3); rxd->rxd3 = READ_ONCE(dma_rxd->rxd3);
rxd->rxd4 = READ_ONCE(dma_rxd->rxd4); rxd->rxd4 = READ_ONCE(dma_rxd->rxd4);
if (MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V2)) { if (mtk_is_netsys_v2_or_greater(eth)) {
rxd->rxd5 = READ_ONCE(dma_rxd->rxd5); rxd->rxd5 = READ_ONCE(dma_rxd->rxd5);
rxd->rxd6 = READ_ONCE(dma_rxd->rxd6); rxd->rxd6 = READ_ONCE(dma_rxd->rxd6);
} }
...@@ -1028,7 +1028,7 @@ static int mtk_init_fq_dma(struct mtk_eth *eth) ...@@ -1028,7 +1028,7 @@ static int mtk_init_fq_dma(struct mtk_eth *eth)
txd->txd3 = TX_DMA_PLEN0(MTK_QDMA_PAGE_SIZE); txd->txd3 = TX_DMA_PLEN0(MTK_QDMA_PAGE_SIZE);
txd->txd4 = 0; txd->txd4 = 0;
if (MTK_HAS_CAPS(soc->caps, MTK_NETSYS_V2)) { if (mtk_is_netsys_v2_or_greater(eth)) {
txd->txd5 = 0; txd->txd5 = 0;
txd->txd6 = 0; txd->txd6 = 0;
txd->txd7 = 0; txd->txd7 = 0;
...@@ -1219,7 +1219,7 @@ static void mtk_tx_set_dma_desc(struct net_device *dev, void *txd, ...@@ -1219,7 +1219,7 @@ static void mtk_tx_set_dma_desc(struct net_device *dev, void *txd,
struct mtk_mac *mac = netdev_priv(dev); struct mtk_mac *mac = netdev_priv(dev);
struct mtk_eth *eth = mac->hw; struct mtk_eth *eth = mac->hw;
if (MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V2)) if (mtk_is_netsys_v2_or_greater(eth))
mtk_tx_set_dma_desc_v2(dev, txd, info); mtk_tx_set_dma_desc_v2(dev, txd, info);
else else
mtk_tx_set_dma_desc_v1(dev, txd, info); mtk_tx_set_dma_desc_v1(dev, txd, info);
...@@ -1526,7 +1526,7 @@ static void mtk_update_rx_cpu_idx(struct mtk_eth *eth) ...@@ -1526,7 +1526,7 @@ static void mtk_update_rx_cpu_idx(struct mtk_eth *eth)
static bool mtk_page_pool_enabled(struct mtk_eth *eth) static bool mtk_page_pool_enabled(struct mtk_eth *eth)
{ {
return MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V2); return eth->soc->version == 2;
} }
static struct page_pool *mtk_create_page_pool(struct mtk_eth *eth, static struct page_pool *mtk_create_page_pool(struct mtk_eth *eth,
...@@ -1868,7 +1868,7 @@ static int mtk_poll_rx(struct napi_struct *napi, int budget, ...@@ -1868,7 +1868,7 @@ static int mtk_poll_rx(struct napi_struct *napi, int budget,
break; break;
/* find out which mac the packet come from. values start at 1 */ /* find out which mac the packet come from. values start at 1 */
if (MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V2)) if (mtk_is_netsys_v2_or_greater(eth))
mac = RX_DMA_GET_SPORT_V2(trxd.rxd5) - 1; mac = RX_DMA_GET_SPORT_V2(trxd.rxd5) - 1;
else if (!MTK_HAS_CAPS(eth->soc->caps, MTK_SOC_MT7628) && else if (!MTK_HAS_CAPS(eth->soc->caps, MTK_SOC_MT7628) &&
!(trxd.rxd4 & RX_DMA_SPECIAL_TAG)) !(trxd.rxd4 & RX_DMA_SPECIAL_TAG))
...@@ -1964,7 +1964,7 @@ static int mtk_poll_rx(struct napi_struct *napi, int budget, ...@@ -1964,7 +1964,7 @@ static int mtk_poll_rx(struct napi_struct *napi, int budget,
skb->dev = netdev; skb->dev = netdev;
bytes += skb->len; bytes += skb->len;
if (MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V2)) { if (mtk_is_netsys_v2_or_greater(eth)) {
reason = FIELD_GET(MTK_RXD5_PPE_CPU_REASON, trxd.rxd5); reason = FIELD_GET(MTK_RXD5_PPE_CPU_REASON, trxd.rxd5);
hash = trxd.rxd5 & MTK_RXD5_FOE_ENTRY; hash = trxd.rxd5 & MTK_RXD5_FOE_ENTRY;
if (hash != MTK_RXD5_FOE_ENTRY) if (hash != MTK_RXD5_FOE_ENTRY)
...@@ -1989,8 +1989,8 @@ static int mtk_poll_rx(struct napi_struct *napi, int budget, ...@@ -1989,8 +1989,8 @@ static int mtk_poll_rx(struct napi_struct *napi, int budget,
/* When using VLAN untagging in combination with DSA, the /* When using VLAN untagging in combination with DSA, the
* hardware treats the MTK special tag as a VLAN and untags it. * hardware treats the MTK special tag as a VLAN and untags it.
*/ */
if (!MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V2) && if (mtk_is_netsys_v1(eth) && (trxd.rxd2 & RX_DMA_VTAG) &&
(trxd.rxd2 & RX_DMA_VTAG) && netdev_uses_dsa(netdev)) { netdev_uses_dsa(netdev)) {
unsigned int port = RX_DMA_VPID(trxd.rxd3) & GENMASK(2, 0); unsigned int port = RX_DMA_VPID(trxd.rxd3) & GENMASK(2, 0);
if (port < ARRAY_SIZE(eth->dsa_meta) && if (port < ARRAY_SIZE(eth->dsa_meta) &&
...@@ -2300,7 +2300,7 @@ static int mtk_tx_alloc(struct mtk_eth *eth) ...@@ -2300,7 +2300,7 @@ static int mtk_tx_alloc(struct mtk_eth *eth)
txd->txd2 = next_ptr; txd->txd2 = next_ptr;
txd->txd3 = TX_DMA_LS0 | TX_DMA_OWNER_CPU; txd->txd3 = TX_DMA_LS0 | TX_DMA_OWNER_CPU;
txd->txd4 = 0; txd->txd4 = 0;
if (MTK_HAS_CAPS(soc->caps, MTK_NETSYS_V2)) { if (mtk_is_netsys_v2_or_greater(eth)) {
txd->txd5 = 0; txd->txd5 = 0;
txd->txd6 = 0; txd->txd6 = 0;
txd->txd7 = 0; txd->txd7 = 0;
...@@ -2353,14 +2353,14 @@ static int mtk_tx_alloc(struct mtk_eth *eth) ...@@ -2353,14 +2353,14 @@ static int mtk_tx_alloc(struct mtk_eth *eth)
FIELD_PREP(MTK_QTX_SCH_MIN_RATE_MAN, 1) | FIELD_PREP(MTK_QTX_SCH_MIN_RATE_MAN, 1) |
FIELD_PREP(MTK_QTX_SCH_MIN_RATE_EXP, 4) | FIELD_PREP(MTK_QTX_SCH_MIN_RATE_EXP, 4) |
MTK_QTX_SCH_LEAKY_BUCKET_SIZE; MTK_QTX_SCH_LEAKY_BUCKET_SIZE;
if (!MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V2)) if (mtk_is_netsys_v1(eth))
val |= MTK_QTX_SCH_LEAKY_BUCKET_EN; val |= MTK_QTX_SCH_LEAKY_BUCKET_EN;
mtk_w32(eth, val, soc->reg_map->qdma.qtx_sch + ofs); mtk_w32(eth, val, soc->reg_map->qdma.qtx_sch + ofs);
ofs += MTK_QTX_OFFSET; ofs += MTK_QTX_OFFSET;
} }
val = MTK_QDMA_TX_SCH_MAX_WFQ | (MTK_QDMA_TX_SCH_MAX_WFQ << 16); val = MTK_QDMA_TX_SCH_MAX_WFQ | (MTK_QDMA_TX_SCH_MAX_WFQ << 16);
mtk_w32(eth, val, soc->reg_map->qdma.tx_sch_rate); mtk_w32(eth, val, soc->reg_map->qdma.tx_sch_rate);
if (MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V2)) if (mtk_is_netsys_v2_or_greater(eth))
mtk_w32(eth, val, soc->reg_map->qdma.tx_sch_rate + 4); mtk_w32(eth, val, soc->reg_map->qdma.tx_sch_rate + 4);
} else { } else {
mtk_w32(eth, ring->phys_pdma, MT7628_TX_BASE_PTR0); mtk_w32(eth, ring->phys_pdma, MT7628_TX_BASE_PTR0);
...@@ -2489,7 +2489,7 @@ static int mtk_rx_alloc(struct mtk_eth *eth, int ring_no, int rx_flag) ...@@ -2489,7 +2489,7 @@ static int mtk_rx_alloc(struct mtk_eth *eth, int ring_no, int rx_flag)
rxd->rxd3 = 0; rxd->rxd3 = 0;
rxd->rxd4 = 0; rxd->rxd4 = 0;
if (MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V2)) { if (mtk_is_netsys_v2_or_greater(eth)) {
rxd->rxd5 = 0; rxd->rxd5 = 0;
rxd->rxd6 = 0; rxd->rxd6 = 0;
rxd->rxd7 = 0; rxd->rxd7 = 0;
...@@ -3037,7 +3037,7 @@ static int mtk_start_dma(struct mtk_eth *eth) ...@@ -3037,7 +3037,7 @@ static int mtk_start_dma(struct mtk_eth *eth)
MTK_TX_BT_32DWORDS | MTK_NDP_CO_PRO | MTK_TX_BT_32DWORDS | MTK_NDP_CO_PRO |
MTK_RX_2B_OFFSET | MTK_TX_WB_DDONE; MTK_RX_2B_OFFSET | MTK_TX_WB_DDONE;
if (MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V2)) if (mtk_is_netsys_v2_or_greater(eth))
val |= MTK_MUTLI_CNT | MTK_RESV_BUF | val |= MTK_MUTLI_CNT | MTK_RESV_BUF |
MTK_WCOMP_EN | MTK_DMAD_WR_WDONE | MTK_WCOMP_EN | MTK_DMAD_WR_WDONE |
MTK_CHK_DDONE_EN | MTK_LEAKY_BUCKET_EN; MTK_CHK_DDONE_EN | MTK_LEAKY_BUCKET_EN;
...@@ -3183,7 +3183,7 @@ static int mtk_open(struct net_device *dev) ...@@ -3183,7 +3183,7 @@ static int mtk_open(struct net_device *dev)
phylink_start(mac->phylink); phylink_start(mac->phylink);
netif_tx_start_all_queues(dev); netif_tx_start_all_queues(dev);
if (MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V2)) if (mtk_is_netsys_v2_or_greater(eth))
return 0; return 0;
if (mtk_uses_dsa(dev) && !eth->prog) { if (mtk_uses_dsa(dev) && !eth->prog) {
...@@ -3449,7 +3449,7 @@ static void mtk_hw_reset(struct mtk_eth *eth) ...@@ -3449,7 +3449,7 @@ static void mtk_hw_reset(struct mtk_eth *eth)
{ {
u32 val; u32 val;
if (MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V2)) { if (mtk_is_netsys_v2_or_greater(eth)) {
regmap_write(eth->ethsys, ETHSYS_FE_RST_CHK_IDLE_EN, 0); regmap_write(eth->ethsys, ETHSYS_FE_RST_CHK_IDLE_EN, 0);
val = RSTCTRL_PPE0_V2; val = RSTCTRL_PPE0_V2;
} else { } else {
...@@ -3461,7 +3461,7 @@ static void mtk_hw_reset(struct mtk_eth *eth) ...@@ -3461,7 +3461,7 @@ static void mtk_hw_reset(struct mtk_eth *eth)
ethsys_reset(eth, RSTCTRL_ETH | RSTCTRL_FE | val); ethsys_reset(eth, RSTCTRL_ETH | RSTCTRL_FE | val);
if (MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V2)) if (mtk_is_netsys_v2_or_greater(eth))
regmap_write(eth->ethsys, ETHSYS_FE_RST_CHK_IDLE_EN, regmap_write(eth->ethsys, ETHSYS_FE_RST_CHK_IDLE_EN,
0x3ffffff); 0x3ffffff);
} }
...@@ -3487,7 +3487,7 @@ static void mtk_hw_warm_reset(struct mtk_eth *eth) ...@@ -3487,7 +3487,7 @@ static void mtk_hw_warm_reset(struct mtk_eth *eth)
return; return;
} }
if (MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V2)) if (mtk_is_netsys_v2_or_greater(eth))
rst_mask = RSTCTRL_ETH | RSTCTRL_PPE0_V2; rst_mask = RSTCTRL_ETH | RSTCTRL_PPE0_V2;
else else
rst_mask = RSTCTRL_ETH | RSTCTRL_PPE0; rst_mask = RSTCTRL_ETH | RSTCTRL_PPE0;
...@@ -3657,7 +3657,7 @@ static int mtk_hw_init(struct mtk_eth *eth, bool reset) ...@@ -3657,7 +3657,7 @@ static int mtk_hw_init(struct mtk_eth *eth, bool reset)
else else
mtk_hw_reset(eth); mtk_hw_reset(eth);
if (MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V2)) { if (mtk_is_netsys_v2_or_greater(eth)) {
/* Set FE to PDMAv2 if necessary */ /* Set FE to PDMAv2 if necessary */
val = mtk_r32(eth, MTK_FE_GLO_MISC); val = mtk_r32(eth, MTK_FE_GLO_MISC);
mtk_w32(eth, val | BIT(4), MTK_FE_GLO_MISC); mtk_w32(eth, val | BIT(4), MTK_FE_GLO_MISC);
...@@ -3694,7 +3694,7 @@ static int mtk_hw_init(struct mtk_eth *eth, bool reset) ...@@ -3694,7 +3694,7 @@ static int mtk_hw_init(struct mtk_eth *eth, bool reset)
*/ */
val = mtk_r32(eth, MTK_CDMQ_IG_CTRL); val = mtk_r32(eth, MTK_CDMQ_IG_CTRL);
mtk_w32(eth, val | MTK_CDMQ_STAG_EN, MTK_CDMQ_IG_CTRL); mtk_w32(eth, val | MTK_CDMQ_STAG_EN, MTK_CDMQ_IG_CTRL);
if (!MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V2)) { if (mtk_is_netsys_v1(eth)) {
val = mtk_r32(eth, MTK_CDMP_IG_CTRL); val = mtk_r32(eth, MTK_CDMP_IG_CTRL);
mtk_w32(eth, val | MTK_CDMP_STAG_EN, MTK_CDMP_IG_CTRL); mtk_w32(eth, val | MTK_CDMP_STAG_EN, MTK_CDMP_IG_CTRL);
...@@ -3716,7 +3716,7 @@ static int mtk_hw_init(struct mtk_eth *eth, bool reset) ...@@ -3716,7 +3716,7 @@ static int mtk_hw_init(struct mtk_eth *eth, bool reset)
mtk_w32(eth, eth->soc->txrx.rx_irq_done_mask, reg_map->qdma.int_grp + 4); mtk_w32(eth, eth->soc->txrx.rx_irq_done_mask, reg_map->qdma.int_grp + 4);
mtk_w32(eth, 0x21021000, MTK_FE_INT_GRP); mtk_w32(eth, 0x21021000, MTK_FE_INT_GRP);
if (MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V2)) { if (mtk_is_netsys_v2_or_greater(eth)) {
/* PSE should not drop port8 and port9 packets from WDMA Tx */ /* PSE should not drop port8 and port9 packets from WDMA Tx */
mtk_w32(eth, 0x00000300, PSE_DROP_CFG); mtk_w32(eth, 0x00000300, PSE_DROP_CFG);
...@@ -4521,7 +4521,7 @@ static int mtk_probe(struct platform_device *pdev) ...@@ -4521,7 +4521,7 @@ static int mtk_probe(struct platform_device *pdev)
} }
} }
if (MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V2)) { if (mtk_is_netsys_v2_or_greater(eth)) {
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (!res) { if (!res) {
err = -EINVAL; err = -EINVAL;
...@@ -4629,9 +4629,8 @@ static int mtk_probe(struct platform_device *pdev) ...@@ -4629,9 +4629,8 @@ static int mtk_probe(struct platform_device *pdev)
} }
if (eth->soc->offload_version) { if (eth->soc->offload_version) {
u32 num_ppe; u32 num_ppe = mtk_is_netsys_v2_or_greater(eth) ? 2 : 1;
num_ppe = MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V2) ? 2 : 1;
num_ppe = min_t(u32, ARRAY_SIZE(eth->ppe), num_ppe); num_ppe = min_t(u32, ARRAY_SIZE(eth->ppe), num_ppe);
for (i = 0; i < num_ppe; i++) { for (i = 0; i < num_ppe; i++) {
u32 ppe_addr = eth->soc->reg_map->ppe_base + i * 0x400; u32 ppe_addr = eth->soc->reg_map->ppe_base + i * 0x400;
...@@ -4723,6 +4722,7 @@ static const struct mtk_soc_data mt2701_data = { ...@@ -4723,6 +4722,7 @@ static const struct mtk_soc_data mt2701_data = {
.hw_features = MTK_HW_FEATURES, .hw_features = MTK_HW_FEATURES,
.required_clks = MT7623_CLKS_BITMAP, .required_clks = MT7623_CLKS_BITMAP,
.required_pctl = true, .required_pctl = true,
.version = 1,
.txrx = { .txrx = {
.txd_size = sizeof(struct mtk_tx_dma), .txd_size = sizeof(struct mtk_tx_dma),
.rxd_size = sizeof(struct mtk_rx_dma), .rxd_size = sizeof(struct mtk_rx_dma),
...@@ -4739,6 +4739,7 @@ static const struct mtk_soc_data mt7621_data = { ...@@ -4739,6 +4739,7 @@ static const struct mtk_soc_data mt7621_data = {
.hw_features = MTK_HW_FEATURES, .hw_features = MTK_HW_FEATURES,
.required_clks = MT7621_CLKS_BITMAP, .required_clks = MT7621_CLKS_BITMAP,
.required_pctl = false, .required_pctl = false,
.version = 1,
.offload_version = 1, .offload_version = 1,
.hash_offset = 2, .hash_offset = 2,
.foe_entry_size = MTK_FOE_ENTRY_V1_SIZE, .foe_entry_size = MTK_FOE_ENTRY_V1_SIZE,
...@@ -4759,6 +4760,7 @@ static const struct mtk_soc_data mt7622_data = { ...@@ -4759,6 +4760,7 @@ static const struct mtk_soc_data mt7622_data = {
.hw_features = MTK_HW_FEATURES, .hw_features = MTK_HW_FEATURES,
.required_clks = MT7622_CLKS_BITMAP, .required_clks = MT7622_CLKS_BITMAP,
.required_pctl = false, .required_pctl = false,
.version = 1,
.offload_version = 2, .offload_version = 2,
.hash_offset = 2, .hash_offset = 2,
.has_accounting = true, .has_accounting = true,
...@@ -4779,6 +4781,7 @@ static const struct mtk_soc_data mt7623_data = { ...@@ -4779,6 +4781,7 @@ static const struct mtk_soc_data mt7623_data = {
.hw_features = MTK_HW_FEATURES, .hw_features = MTK_HW_FEATURES,
.required_clks = MT7623_CLKS_BITMAP, .required_clks = MT7623_CLKS_BITMAP,
.required_pctl = true, .required_pctl = true,
.version = 1,
.offload_version = 1, .offload_version = 1,
.hash_offset = 2, .hash_offset = 2,
.foe_entry_size = MTK_FOE_ENTRY_V1_SIZE, .foe_entry_size = MTK_FOE_ENTRY_V1_SIZE,
...@@ -4801,6 +4804,7 @@ static const struct mtk_soc_data mt7629_data = { ...@@ -4801,6 +4804,7 @@ static const struct mtk_soc_data mt7629_data = {
.required_clks = MT7629_CLKS_BITMAP, .required_clks = MT7629_CLKS_BITMAP,
.required_pctl = false, .required_pctl = false,
.has_accounting = true, .has_accounting = true,
.version = 1,
.txrx = { .txrx = {
.txd_size = sizeof(struct mtk_tx_dma), .txd_size = sizeof(struct mtk_tx_dma),
.rxd_size = sizeof(struct mtk_rx_dma), .rxd_size = sizeof(struct mtk_rx_dma),
...@@ -4818,6 +4822,7 @@ static const struct mtk_soc_data mt7981_data = { ...@@ -4818,6 +4822,7 @@ static const struct mtk_soc_data mt7981_data = {
.hw_features = MTK_HW_FEATURES, .hw_features = MTK_HW_FEATURES,
.required_clks = MT7981_CLKS_BITMAP, .required_clks = MT7981_CLKS_BITMAP,
.required_pctl = false, .required_pctl = false,
.version = 2,
.offload_version = 2, .offload_version = 2,
.hash_offset = 4, .hash_offset = 4,
.has_accounting = true, .has_accounting = true,
...@@ -4839,6 +4844,7 @@ static const struct mtk_soc_data mt7986_data = { ...@@ -4839,6 +4844,7 @@ static const struct mtk_soc_data mt7986_data = {
.hw_features = MTK_HW_FEATURES, .hw_features = MTK_HW_FEATURES,
.required_clks = MT7986_CLKS_BITMAP, .required_clks = MT7986_CLKS_BITMAP,
.required_pctl = false, .required_pctl = false,
.version = 2,
.offload_version = 2, .offload_version = 2,
.hash_offset = 4, .hash_offset = 4,
.has_accounting = true, .has_accounting = true,
...@@ -4859,6 +4865,7 @@ static const struct mtk_soc_data rt5350_data = { ...@@ -4859,6 +4865,7 @@ static const struct mtk_soc_data rt5350_data = {
.hw_features = MTK_HW_FEATURES_MT7628, .hw_features = MTK_HW_FEATURES_MT7628,
.required_clks = MT7628_CLKS_BITMAP, .required_clks = MT7628_CLKS_BITMAP,
.required_pctl = false, .required_pctl = false,
.version = 1,
.txrx = { .txrx = {
.txd_size = sizeof(struct mtk_tx_dma), .txd_size = sizeof(struct mtk_tx_dma),
.rxd_size = sizeof(struct mtk_rx_dma), .rxd_size = sizeof(struct mtk_rx_dma),
......
...@@ -820,7 +820,6 @@ enum mkt_eth_capabilities { ...@@ -820,7 +820,6 @@ enum mkt_eth_capabilities {
MTK_SHARED_INT_BIT, MTK_SHARED_INT_BIT,
MTK_TRGMII_MT7621_CLK_BIT, MTK_TRGMII_MT7621_CLK_BIT,
MTK_QDMA_BIT, MTK_QDMA_BIT,
MTK_NETSYS_V2_BIT,
MTK_SOC_MT7628_BIT, MTK_SOC_MT7628_BIT,
MTK_RSTCTRL_PPE1_BIT, MTK_RSTCTRL_PPE1_BIT,
MTK_U3_COPHY_V2_BIT, MTK_U3_COPHY_V2_BIT,
...@@ -855,7 +854,6 @@ enum mkt_eth_capabilities { ...@@ -855,7 +854,6 @@ enum mkt_eth_capabilities {
#define MTK_SHARED_INT BIT(MTK_SHARED_INT_BIT) #define MTK_SHARED_INT BIT(MTK_SHARED_INT_BIT)
#define MTK_TRGMII_MT7621_CLK BIT(MTK_TRGMII_MT7621_CLK_BIT) #define MTK_TRGMII_MT7621_CLK BIT(MTK_TRGMII_MT7621_CLK_BIT)
#define MTK_QDMA BIT(MTK_QDMA_BIT) #define MTK_QDMA BIT(MTK_QDMA_BIT)
#define MTK_NETSYS_V2 BIT(MTK_NETSYS_V2_BIT)
#define MTK_SOC_MT7628 BIT(MTK_SOC_MT7628_BIT) #define MTK_SOC_MT7628 BIT(MTK_SOC_MT7628_BIT)
#define MTK_RSTCTRL_PPE1 BIT(MTK_RSTCTRL_PPE1_BIT) #define MTK_RSTCTRL_PPE1 BIT(MTK_RSTCTRL_PPE1_BIT)
#define MTK_U3_COPHY_V2 BIT(MTK_U3_COPHY_V2_BIT) #define MTK_U3_COPHY_V2 BIT(MTK_U3_COPHY_V2_BIT)
...@@ -934,11 +932,11 @@ enum mkt_eth_capabilities { ...@@ -934,11 +932,11 @@ enum mkt_eth_capabilities {
#define MT7981_CAPS (MTK_GMAC1_SGMII | MTK_GMAC2_SGMII | MTK_GMAC2_GEPHY | \ #define MT7981_CAPS (MTK_GMAC1_SGMII | MTK_GMAC2_SGMII | MTK_GMAC2_GEPHY | \
MTK_MUX_GMAC12_TO_GEPHY_SGMII | MTK_QDMA | \ MTK_MUX_GMAC12_TO_GEPHY_SGMII | MTK_QDMA | \
MTK_MUX_U3_GMAC2_TO_QPHY | MTK_U3_COPHY_V2 | \ MTK_MUX_U3_GMAC2_TO_QPHY | MTK_U3_COPHY_V2 | \
MTK_NETSYS_V2 | MTK_RSTCTRL_PPE1) MTK_RSTCTRL_PPE1)
#define MT7986_CAPS (MTK_GMAC1_SGMII | MTK_GMAC2_SGMII | \ #define MT7986_CAPS (MTK_GMAC1_SGMII | MTK_GMAC2_SGMII | \
MTK_MUX_GMAC12_TO_GEPHY_SGMII | MTK_QDMA | \ MTK_MUX_GMAC12_TO_GEPHY_SGMII | MTK_QDMA | \
MTK_NETSYS_V2 | MTK_RSTCTRL_PPE1) MTK_RSTCTRL_PPE1)
struct mtk_tx_dma_desc_info { struct mtk_tx_dma_desc_info {
dma_addr_t addr; dma_addr_t addr;
...@@ -1009,6 +1007,7 @@ struct mtk_reg_map { ...@@ -1009,6 +1007,7 @@ struct mtk_reg_map {
* @required_pctl A bool value to show whether the SoC requires * @required_pctl A bool value to show whether the SoC requires
* the extra setup for those pins used by GMAC. * the extra setup for those pins used by GMAC.
* @hash_offset Flow table hash offset. * @hash_offset Flow table hash offset.
* @version SoC version.
* @foe_entry_size Foe table entry size. * @foe_entry_size Foe table entry size.
* @has_accounting Bool indicating support for accounting of * @has_accounting Bool indicating support for accounting of
* offloaded flows. * offloaded flows.
...@@ -1027,6 +1026,7 @@ struct mtk_soc_data { ...@@ -1027,6 +1026,7 @@ struct mtk_soc_data {
bool required_pctl; bool required_pctl;
u8 offload_version; u8 offload_version;
u8 hash_offset; u8 hash_offset;
u8 version;
u16 foe_entry_size; u16 foe_entry_size;
netdev_features_t hw_features; netdev_features_t hw_features;
bool has_accounting; bool has_accounting;
...@@ -1183,6 +1183,16 @@ struct mtk_mac { ...@@ -1183,6 +1183,16 @@ struct mtk_mac {
/* the struct describing the SoC. these are declared in the soc_xyz.c files */ /* the struct describing the SoC. these are declared in the soc_xyz.c files */
extern const struct of_device_id of_mtk_match[]; extern const struct of_device_id of_mtk_match[];
static inline bool mtk_is_netsys_v1(struct mtk_eth *eth)
{
return eth->soc->version == 1;
}
static inline bool mtk_is_netsys_v2_or_greater(struct mtk_eth *eth)
{
return eth->soc->version > 1;
}
static inline struct mtk_foe_entry * static inline struct mtk_foe_entry *
mtk_foe_get_entry(struct mtk_ppe *ppe, u16 hash) mtk_foe_get_entry(struct mtk_ppe *ppe, u16 hash)
{ {
...@@ -1193,7 +1203,7 @@ mtk_foe_get_entry(struct mtk_ppe *ppe, u16 hash) ...@@ -1193,7 +1203,7 @@ mtk_foe_get_entry(struct mtk_ppe *ppe, u16 hash)
static inline u32 mtk_get_ib1_ts_mask(struct mtk_eth *eth) static inline u32 mtk_get_ib1_ts_mask(struct mtk_eth *eth)
{ {
if (MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V2)) if (mtk_is_netsys_v2_or_greater(eth))
return MTK_FOE_IB1_BIND_TIMESTAMP_V2; return MTK_FOE_IB1_BIND_TIMESTAMP_V2;
return MTK_FOE_IB1_BIND_TIMESTAMP; return MTK_FOE_IB1_BIND_TIMESTAMP;
...@@ -1201,7 +1211,7 @@ static inline u32 mtk_get_ib1_ts_mask(struct mtk_eth *eth) ...@@ -1201,7 +1211,7 @@ static inline u32 mtk_get_ib1_ts_mask(struct mtk_eth *eth)
static inline u32 mtk_get_ib1_ppoe_mask(struct mtk_eth *eth) static inline u32 mtk_get_ib1_ppoe_mask(struct mtk_eth *eth)
{ {
if (MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V2)) if (mtk_is_netsys_v2_or_greater(eth))
return MTK_FOE_IB1_BIND_PPPOE_V2; return MTK_FOE_IB1_BIND_PPPOE_V2;
return MTK_FOE_IB1_BIND_PPPOE; return MTK_FOE_IB1_BIND_PPPOE;
...@@ -1209,7 +1219,7 @@ static inline u32 mtk_get_ib1_ppoe_mask(struct mtk_eth *eth) ...@@ -1209,7 +1219,7 @@ static inline u32 mtk_get_ib1_ppoe_mask(struct mtk_eth *eth)
static inline u32 mtk_get_ib1_vlan_tag_mask(struct mtk_eth *eth) static inline u32 mtk_get_ib1_vlan_tag_mask(struct mtk_eth *eth)
{ {
if (MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V2)) if (mtk_is_netsys_v2_or_greater(eth))
return MTK_FOE_IB1_BIND_VLAN_TAG_V2; return MTK_FOE_IB1_BIND_VLAN_TAG_V2;
return MTK_FOE_IB1_BIND_VLAN_TAG; return MTK_FOE_IB1_BIND_VLAN_TAG;
...@@ -1217,7 +1227,7 @@ static inline u32 mtk_get_ib1_vlan_tag_mask(struct mtk_eth *eth) ...@@ -1217,7 +1227,7 @@ static inline u32 mtk_get_ib1_vlan_tag_mask(struct mtk_eth *eth)
static inline u32 mtk_get_ib1_vlan_layer_mask(struct mtk_eth *eth) static inline u32 mtk_get_ib1_vlan_layer_mask(struct mtk_eth *eth)
{ {
if (MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V2)) if (mtk_is_netsys_v2_or_greater(eth))
return MTK_FOE_IB1_BIND_VLAN_LAYER_V2; return MTK_FOE_IB1_BIND_VLAN_LAYER_V2;
return MTK_FOE_IB1_BIND_VLAN_LAYER; return MTK_FOE_IB1_BIND_VLAN_LAYER;
...@@ -1225,7 +1235,7 @@ static inline u32 mtk_get_ib1_vlan_layer_mask(struct mtk_eth *eth) ...@@ -1225,7 +1235,7 @@ static inline u32 mtk_get_ib1_vlan_layer_mask(struct mtk_eth *eth)
static inline u32 mtk_prep_ib1_vlan_layer(struct mtk_eth *eth, u32 val) static inline u32 mtk_prep_ib1_vlan_layer(struct mtk_eth *eth, u32 val)
{ {
if (MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V2)) if (mtk_is_netsys_v2_or_greater(eth))
return FIELD_PREP(MTK_FOE_IB1_BIND_VLAN_LAYER_V2, val); return FIELD_PREP(MTK_FOE_IB1_BIND_VLAN_LAYER_V2, val);
return FIELD_PREP(MTK_FOE_IB1_BIND_VLAN_LAYER, val); return FIELD_PREP(MTK_FOE_IB1_BIND_VLAN_LAYER, val);
...@@ -1233,7 +1243,7 @@ static inline u32 mtk_prep_ib1_vlan_layer(struct mtk_eth *eth, u32 val) ...@@ -1233,7 +1243,7 @@ static inline u32 mtk_prep_ib1_vlan_layer(struct mtk_eth *eth, u32 val)
static inline u32 mtk_get_ib1_vlan_layer(struct mtk_eth *eth, u32 val) static inline u32 mtk_get_ib1_vlan_layer(struct mtk_eth *eth, u32 val)
{ {
if (MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V2)) if (mtk_is_netsys_v2_or_greater(eth))
return FIELD_GET(MTK_FOE_IB1_BIND_VLAN_LAYER_V2, val); return FIELD_GET(MTK_FOE_IB1_BIND_VLAN_LAYER_V2, val);
return FIELD_GET(MTK_FOE_IB1_BIND_VLAN_LAYER, val); return FIELD_GET(MTK_FOE_IB1_BIND_VLAN_LAYER, val);
...@@ -1241,7 +1251,7 @@ static inline u32 mtk_get_ib1_vlan_layer(struct mtk_eth *eth, u32 val) ...@@ -1241,7 +1251,7 @@ static inline u32 mtk_get_ib1_vlan_layer(struct mtk_eth *eth, u32 val)
static inline u32 mtk_get_ib1_pkt_type_mask(struct mtk_eth *eth) static inline u32 mtk_get_ib1_pkt_type_mask(struct mtk_eth *eth)
{ {
if (MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V2)) if (mtk_is_netsys_v2_or_greater(eth))
return MTK_FOE_IB1_PACKET_TYPE_V2; return MTK_FOE_IB1_PACKET_TYPE_V2;
return MTK_FOE_IB1_PACKET_TYPE; return MTK_FOE_IB1_PACKET_TYPE;
...@@ -1249,7 +1259,7 @@ static inline u32 mtk_get_ib1_pkt_type_mask(struct mtk_eth *eth) ...@@ -1249,7 +1259,7 @@ static inline u32 mtk_get_ib1_pkt_type_mask(struct mtk_eth *eth)
static inline u32 mtk_get_ib1_pkt_type(struct mtk_eth *eth, u32 val) static inline u32 mtk_get_ib1_pkt_type(struct mtk_eth *eth, u32 val)
{ {
if (MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V2)) if (mtk_is_netsys_v2_or_greater(eth))
return FIELD_GET(MTK_FOE_IB1_PACKET_TYPE_V2, val); return FIELD_GET(MTK_FOE_IB1_PACKET_TYPE_V2, val);
return FIELD_GET(MTK_FOE_IB1_PACKET_TYPE, val); return FIELD_GET(MTK_FOE_IB1_PACKET_TYPE, val);
...@@ -1257,7 +1267,7 @@ static inline u32 mtk_get_ib1_pkt_type(struct mtk_eth *eth, u32 val) ...@@ -1257,7 +1267,7 @@ static inline u32 mtk_get_ib1_pkt_type(struct mtk_eth *eth, u32 val)
static inline u32 mtk_get_ib2_multicast_mask(struct mtk_eth *eth) static inline u32 mtk_get_ib2_multicast_mask(struct mtk_eth *eth)
{ {
if (MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V2)) if (mtk_is_netsys_v2_or_greater(eth))
return MTK_FOE_IB2_MULTICAST_V2; return MTK_FOE_IB2_MULTICAST_V2;
return MTK_FOE_IB2_MULTICAST; return MTK_FOE_IB2_MULTICAST;
......
...@@ -208,7 +208,7 @@ int mtk_foe_entry_prepare(struct mtk_eth *eth, struct mtk_foe_entry *entry, ...@@ -208,7 +208,7 @@ int mtk_foe_entry_prepare(struct mtk_eth *eth, struct mtk_foe_entry *entry,
memset(entry, 0, sizeof(*entry)); memset(entry, 0, sizeof(*entry));
if (MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V2)) { if (mtk_is_netsys_v2_or_greater(eth)) {
val = FIELD_PREP(MTK_FOE_IB1_STATE, MTK_FOE_STATE_BIND) | val = FIELD_PREP(MTK_FOE_IB1_STATE, MTK_FOE_STATE_BIND) |
FIELD_PREP(MTK_FOE_IB1_PACKET_TYPE_V2, type) | FIELD_PREP(MTK_FOE_IB1_PACKET_TYPE_V2, type) |
FIELD_PREP(MTK_FOE_IB1_UDP, l4proto == IPPROTO_UDP) | FIELD_PREP(MTK_FOE_IB1_UDP, l4proto == IPPROTO_UDP) |
...@@ -272,7 +272,7 @@ int mtk_foe_entry_set_pse_port(struct mtk_eth *eth, ...@@ -272,7 +272,7 @@ int mtk_foe_entry_set_pse_port(struct mtk_eth *eth,
u32 *ib2 = mtk_foe_entry_ib2(eth, entry); u32 *ib2 = mtk_foe_entry_ib2(eth, entry);
u32 val = *ib2; u32 val = *ib2;
if (MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V2)) { if (mtk_is_netsys_v2_or_greater(eth)) {
val &= ~MTK_FOE_IB2_DEST_PORT_V2; val &= ~MTK_FOE_IB2_DEST_PORT_V2;
val |= FIELD_PREP(MTK_FOE_IB2_DEST_PORT_V2, port); val |= FIELD_PREP(MTK_FOE_IB2_DEST_PORT_V2, port);
} else { } else {
...@@ -423,7 +423,7 @@ int mtk_foe_entry_set_wdma(struct mtk_eth *eth, struct mtk_foe_entry *entry, ...@@ -423,7 +423,7 @@ int mtk_foe_entry_set_wdma(struct mtk_eth *eth, struct mtk_foe_entry *entry,
struct mtk_foe_mac_info *l2 = mtk_foe_entry_l2(eth, entry); struct mtk_foe_mac_info *l2 = mtk_foe_entry_l2(eth, entry);
u32 *ib2 = mtk_foe_entry_ib2(eth, entry); u32 *ib2 = mtk_foe_entry_ib2(eth, entry);
if (MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V2)) { if (mtk_is_netsys_v2_or_greater(eth)) {
*ib2 &= ~MTK_FOE_IB2_PORT_MG_V2; *ib2 &= ~MTK_FOE_IB2_PORT_MG_V2;
*ib2 |= FIELD_PREP(MTK_FOE_IB2_RX_IDX, txq) | *ib2 |= FIELD_PREP(MTK_FOE_IB2_RX_IDX, txq) |
MTK_FOE_IB2_WDMA_WINFO_V2; MTK_FOE_IB2_WDMA_WINFO_V2;
...@@ -447,7 +447,7 @@ int mtk_foe_entry_set_queue(struct mtk_eth *eth, struct mtk_foe_entry *entry, ...@@ -447,7 +447,7 @@ int mtk_foe_entry_set_queue(struct mtk_eth *eth, struct mtk_foe_entry *entry,
{ {
u32 *ib2 = mtk_foe_entry_ib2(eth, entry); u32 *ib2 = mtk_foe_entry_ib2(eth, entry);
if (MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V2)) { if (mtk_is_netsys_v2_or_greater(eth)) {
*ib2 &= ~MTK_FOE_IB2_QID_V2; *ib2 &= ~MTK_FOE_IB2_QID_V2;
*ib2 |= FIELD_PREP(MTK_FOE_IB2_QID_V2, queue); *ib2 |= FIELD_PREP(MTK_FOE_IB2_QID_V2, queue);
*ib2 |= MTK_FOE_IB2_PSE_QOS_V2; *ib2 |= MTK_FOE_IB2_PSE_QOS_V2;
...@@ -603,7 +603,7 @@ __mtk_foe_entry_commit(struct mtk_ppe *ppe, struct mtk_foe_entry *entry, ...@@ -603,7 +603,7 @@ __mtk_foe_entry_commit(struct mtk_ppe *ppe, struct mtk_foe_entry *entry,
struct mtk_foe_entry *hwe; struct mtk_foe_entry *hwe;
u32 val; u32 val;
if (MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V2)) { if (mtk_is_netsys_v2_or_greater(eth)) {
entry->ib1 &= ~MTK_FOE_IB1_BIND_TIMESTAMP_V2; entry->ib1 &= ~MTK_FOE_IB1_BIND_TIMESTAMP_V2;
entry->ib1 |= FIELD_PREP(MTK_FOE_IB1_BIND_TIMESTAMP_V2, entry->ib1 |= FIELD_PREP(MTK_FOE_IB1_BIND_TIMESTAMP_V2,
timestamp); timestamp);
...@@ -619,7 +619,7 @@ __mtk_foe_entry_commit(struct mtk_ppe *ppe, struct mtk_foe_entry *entry, ...@@ -619,7 +619,7 @@ __mtk_foe_entry_commit(struct mtk_ppe *ppe, struct mtk_foe_entry *entry,
hwe->ib1 = entry->ib1; hwe->ib1 = entry->ib1;
if (ppe->accounting) { if (ppe->accounting) {
if (MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V2)) if (mtk_is_netsys_v2_or_greater(eth))
val = MTK_FOE_IB2_MIB_CNT_V2; val = MTK_FOE_IB2_MIB_CNT_V2;
else else
val = MTK_FOE_IB2_MIB_CNT; val = MTK_FOE_IB2_MIB_CNT;
...@@ -979,7 +979,7 @@ void mtk_ppe_start(struct mtk_ppe *ppe) ...@@ -979,7 +979,7 @@ void mtk_ppe_start(struct mtk_ppe *ppe)
MTK_PPE_SCAN_MODE_KEEPALIVE_AGE) | MTK_PPE_SCAN_MODE_KEEPALIVE_AGE) |
FIELD_PREP(MTK_PPE_TB_CFG_ENTRY_NUM, FIELD_PREP(MTK_PPE_TB_CFG_ENTRY_NUM,
MTK_PPE_ENTRIES_SHIFT); MTK_PPE_ENTRIES_SHIFT);
if (MTK_HAS_CAPS(ppe->eth->soc->caps, MTK_NETSYS_V2)) if (mtk_is_netsys_v2_or_greater(ppe->eth))
val |= MTK_PPE_TB_CFG_INFO_SEL; val |= MTK_PPE_TB_CFG_INFO_SEL;
ppe_w32(ppe, MTK_PPE_TB_CFG, val); ppe_w32(ppe, MTK_PPE_TB_CFG, val);
...@@ -995,7 +995,7 @@ void mtk_ppe_start(struct mtk_ppe *ppe) ...@@ -995,7 +995,7 @@ void mtk_ppe_start(struct mtk_ppe *ppe)
MTK_PPE_FLOW_CFG_IP4_NAPT | MTK_PPE_FLOW_CFG_IP4_NAPT |
MTK_PPE_FLOW_CFG_IP4_DSLITE | MTK_PPE_FLOW_CFG_IP4_DSLITE |
MTK_PPE_FLOW_CFG_IP4_NAT_FRAG; MTK_PPE_FLOW_CFG_IP4_NAT_FRAG;
if (MTK_HAS_CAPS(ppe->eth->soc->caps, MTK_NETSYS_V2)) if (mtk_is_netsys_v2_or_greater(ppe->eth))
val |= MTK_PPE_MD_TOAP_BYP_CRSN0 | val |= MTK_PPE_MD_TOAP_BYP_CRSN0 |
MTK_PPE_MD_TOAP_BYP_CRSN1 | MTK_PPE_MD_TOAP_BYP_CRSN1 |
MTK_PPE_MD_TOAP_BYP_CRSN2 | MTK_PPE_MD_TOAP_BYP_CRSN2 |
...@@ -1037,7 +1037,7 @@ void mtk_ppe_start(struct mtk_ppe *ppe) ...@@ -1037,7 +1037,7 @@ void mtk_ppe_start(struct mtk_ppe *ppe)
ppe_w32(ppe, MTK_PPE_DEFAULT_CPU_PORT, 0); ppe_w32(ppe, MTK_PPE_DEFAULT_CPU_PORT, 0);
if (MTK_HAS_CAPS(ppe->eth->soc->caps, MTK_NETSYS_V2)) { if (mtk_is_netsys_v2_or_greater(ppe->eth)) {
ppe_w32(ppe, MTK_PPE_DEFAULT_CPU_PORT1, 0xcb777); ppe_w32(ppe, MTK_PPE_DEFAULT_CPU_PORT1, 0xcb777);
ppe_w32(ppe, MTK_PPE_SBW_CTRL, 0x7f); ppe_w32(ppe, MTK_PPE_SBW_CTRL, 0x7f);
} }
......
...@@ -193,7 +193,7 @@ mtk_flow_set_output_device(struct mtk_eth *eth, struct mtk_foe_entry *foe, ...@@ -193,7 +193,7 @@ mtk_flow_set_output_device(struct mtk_eth *eth, struct mtk_foe_entry *foe,
if (mtk_flow_get_wdma_info(dev, dest_mac, &info) == 0) { if (mtk_flow_get_wdma_info(dev, dest_mac, &info) == 0) {
mtk_foe_entry_set_wdma(eth, foe, info.wdma_idx, info.queue, mtk_foe_entry_set_wdma(eth, foe, info.wdma_idx, info.queue,
info.bss, info.wcid); info.bss, info.wcid);
if (MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V2)) { if (mtk_is_netsys_v2_or_greater(eth)) {
switch (info.wdma_idx) { switch (info.wdma_idx) {
case 0: case 0:
pse_port = 8; pse_port = 8;
......
...@@ -1091,7 +1091,7 @@ mtk_wed_rx_reset(struct mtk_wed_device *dev) ...@@ -1091,7 +1091,7 @@ mtk_wed_rx_reset(struct mtk_wed_device *dev)
} else { } else {
struct mtk_eth *eth = dev->hw->eth; struct mtk_eth *eth = dev->hw->eth;
if (MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V2)) if (mtk_is_netsys_v2_or_greater(eth))
wed_set(dev, MTK_WED_RESET_IDX, wed_set(dev, MTK_WED_RESET_IDX,
MTK_WED_RESET_IDX_RX_V2); MTK_WED_RESET_IDX_RX_V2);
else else
...@@ -1907,7 +1907,7 @@ void mtk_wed_add_hw(struct device_node *np, struct mtk_eth *eth, ...@@ -1907,7 +1907,7 @@ void mtk_wed_add_hw(struct device_node *np, struct mtk_eth *eth,
hw->wdma = wdma; hw->wdma = wdma;
hw->index = index; hw->index = index;
hw->irq = irq; hw->irq = irq;
hw->version = MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V2) ? 2 : 1; hw->version = mtk_is_netsys_v1(eth) ? 1 : 2;
if (hw->version == 1) { if (hw->version == 1) {
hw->mirror = syscon_regmap_lookup_by_phandle(eth_np, hw->mirror = syscon_regmap_lookup_by_phandle(eth_np,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment