Lines Matching +full:eth +full:- +full:mac

1 /* SPDX-License-Identifier: GPL-2.0-only */
4 * Copyright (C) 2009-2016 John Crispin <[email protected]>
5 * Copyright (C) 2009-2016 Felix Fietkau <[email protected]>
6 * Copyright (C) 2013-2016 Michael Lee <[email protected]>
12 #include <linux/dma-mapping.h>
57 #define NEXT_DESP_IDX(X, Y) (((X) + 1) & ((Y) - 1))
62 #define MTK_PP_MAX_BUF_SIZE (PAGE_SIZE - MTK_PP_PAD)
136 /* Unicast Filter MAC Address Register - Low */
140 /* Unicast Filter MAC Address Register - High */
157 #define PSE_IQ_REV(x) (0x140 + (((x) - 1) << 2))
160 #define PSE_OQ_TH(x) (0x160 + (((x) - 1) << 2))
332 #define TX_DMA_PLEN0(x) (((x) & eth->soc->tx.dma_max_len) << eth->soc->tx.dma_len_offset)
333 #define TX_DMA_PLEN1(x) ((x) & eth->soc->tx.dma_max_len)
353 #define RX_DMA_PREP_PLEN0(x) (((x) & eth->soc->rx.dma_max_len) << eth->soc->rx.dma_len_offset)
354 #define RX_DMA_GET_PLEN0(x) (((x) >> eth->soc->rx.dma_len_offset) & eth->soc->rx.dma_max_len)
441 /* Mac control registers */
464 /* Mac status registers */
655 /* struct mtk_hw_stats - the structure that holds the traffic statistics.
686 /* PDMA descriptor can point at 1-2 segments. This enum allows us to
855 /* struct mtk_tx_buf - This struct holds the pointers to the memory pointed at
875 /* struct mtk_tx_ring - This struct holds info describing a TX ring
908 /* struct mtk_rx_ring - This struct holds info describing a RX ring
1017 /* 0: GDM1 -> GMAC1, 1: GDM1 -> ESW */
1020 /* 0: GMAC2 -> GEPHY, 1: GMAC0 -> GePHY */
1024 /* 0: U3 -> QPHY, 1: GMAC2 -> QPHY */
1028 /* 2: GMAC1 -> SGMII, 3: GMAC2 -> SGMII */
1033 /* 0: GMACx -> GEPHY, 1: GMACx -> SGMII where x is 1 or 2 */
1128 /* struct mtk_eth_data - This is the structure holding all differences
1186 /* struct mtk_eth - This is the main datasructure for holding the state
1198 * @mac: Each netdev is linked to a physical MAC
1205 * @sgmii_pcs: Pointers to mtk-pcs-lynxi phylink_pcs instances
1242 struct mtk_mac *mac[MTK_MAX_DEVS]; member
1299 /* struct mtk_mac - the structure that holds the info about the MACs of the
1301 * @id: The number of the MAC
1326 static inline bool mtk_is_netsys_v1(struct mtk_eth *eth) in mtk_is_netsys_v1() argument
1328 return eth->soc->version == 1; in mtk_is_netsys_v1()
1331 static inline bool mtk_is_netsys_v2_or_greater(struct mtk_eth *eth) in mtk_is_netsys_v2_or_greater() argument
1333 return eth->soc->version > 1; in mtk_is_netsys_v2_or_greater()
1336 static inline bool mtk_is_netsys_v3_or_greater(struct mtk_eth *eth) in mtk_is_netsys_v3_or_greater() argument
1338 return eth->soc->version > 2; in mtk_is_netsys_v3_or_greater()
1344 const struct mtk_soc_data *soc = ppe->eth->soc; in mtk_foe_get_entry()
1346 return ppe->foe_table + hash * soc->foe_entry_size; in mtk_foe_get_entry()
1349 static inline u32 mtk_get_ib1_ts_mask(struct mtk_eth *eth) in mtk_get_ib1_ts_mask() argument
1351 if (mtk_is_netsys_v2_or_greater(eth)) in mtk_get_ib1_ts_mask()
1357 static inline u32 mtk_get_ib1_ppoe_mask(struct mtk_eth *eth) in mtk_get_ib1_ppoe_mask() argument
1359 if (mtk_is_netsys_v2_or_greater(eth)) in mtk_get_ib1_ppoe_mask()
1365 static inline u32 mtk_get_ib1_vlan_tag_mask(struct mtk_eth *eth) in mtk_get_ib1_vlan_tag_mask() argument
1367 if (mtk_is_netsys_v2_or_greater(eth)) in mtk_get_ib1_vlan_tag_mask()
1373 static inline u32 mtk_get_ib1_vlan_layer_mask(struct mtk_eth *eth) in mtk_get_ib1_vlan_layer_mask() argument
1375 if (mtk_is_netsys_v2_or_greater(eth)) in mtk_get_ib1_vlan_layer_mask()
1381 static inline u32 mtk_prep_ib1_vlan_layer(struct mtk_eth *eth, u32 val) in mtk_prep_ib1_vlan_layer() argument
1383 if (mtk_is_netsys_v2_or_greater(eth)) in mtk_prep_ib1_vlan_layer()
1389 static inline u32 mtk_get_ib1_vlan_layer(struct mtk_eth *eth, u32 val) in mtk_get_ib1_vlan_layer() argument
1391 if (mtk_is_netsys_v2_or_greater(eth)) in mtk_get_ib1_vlan_layer()
1397 static inline u32 mtk_get_ib1_pkt_type_mask(struct mtk_eth *eth) in mtk_get_ib1_pkt_type_mask() argument
1399 if (mtk_is_netsys_v2_or_greater(eth)) in mtk_get_ib1_pkt_type_mask()
1405 static inline u32 mtk_get_ib1_pkt_type(struct mtk_eth *eth, u32 val) in mtk_get_ib1_pkt_type() argument
1407 if (mtk_is_netsys_v2_or_greater(eth)) in mtk_get_ib1_pkt_type()
1413 static inline u32 mtk_get_ib2_multicast_mask(struct mtk_eth *eth) in mtk_get_ib2_multicast_mask() argument
1415 if (mtk_is_netsys_v2_or_greater(eth)) in mtk_get_ib2_multicast_mask()
1422 void mtk_stats_update_mac(struct mtk_mac *mac);
1424 void mtk_w32(struct mtk_eth *eth, u32 val, unsigned reg);
1425 u32 mtk_r32(struct mtk_eth *eth, unsigned reg);
1426 u32 mtk_m32(struct mtk_eth *eth, u32 mask, u32 set, unsigned int reg);
1428 int mtk_gmac_sgmii_path_setup(struct mtk_eth *eth, int mac_id);
1429 int mtk_gmac_gephy_path_setup(struct mtk_eth *eth, int mac_id);
1430 int mtk_gmac_rgmii_path_setup(struct mtk_eth *eth, int mac_id);
1432 int mtk_eth_offload_init(struct mtk_eth *eth, u8 id);
1435 int mtk_flow_offload_cmd(struct mtk_eth *eth, struct flow_cls_offload *cls,
1437 void mtk_flow_offload_cleanup(struct mtk_eth *eth, struct list_head *list);
1438 void mtk_eth_set_dma_device(struct mtk_eth *eth, struct device *dma_dev);