14fa9c49fSThomas Gleixner /* SPDX-License-Identifier: GPL-2.0-only */ 27ac6653aSJeff Kirsher /******************************************************************************* 37ac6653aSJeff Kirsher STMMAC Common Header File 47ac6653aSJeff Kirsher 57ac6653aSJeff Kirsher Copyright (C) 2007-2009 STMicroelectronics Ltd 67ac6653aSJeff Kirsher 77ac6653aSJeff Kirsher 87ac6653aSJeff Kirsher Author: Giuseppe Cavallaro <peppe.cavallaro@st.com> 97ac6653aSJeff Kirsher *******************************************************************************/ 107ac6653aSJeff Kirsher 11bd4242dfSRayagond Kokatanur #ifndef __COMMON_H__ 12bd4242dfSRayagond Kokatanur #define __COMMON_H__ 13bd4242dfSRayagond Kokatanur 14bfab27a1SGiuseppe CAVALLARO #include <linux/etherdevice.h> 157ac6653aSJeff Kirsher #include <linux/netdevice.h> 16afea0365SGiuseppe Cavallaro #include <linux/stmmac.h> 17bfab27a1SGiuseppe CAVALLARO #include <linux/phy.h> 182fa4e4b7SAndrew Lunn #include <linux/pcs/pcs-xpcs.h> 19bfab27a1SGiuseppe CAVALLARO #include <linux/module.h> 2012c70f30SJavier Martinez Canillas #if IS_ENABLED(CONFIG_VLAN_8021Q) 217ac6653aSJeff Kirsher #define STMMAC_VLAN_TAG_USED 227ac6653aSJeff Kirsher #include <linux/if_vlan.h> 237ac6653aSJeff Kirsher #endif 247ac6653aSJeff Kirsher 257ac6653aSJeff Kirsher #include "descs.h" 2642de047dSJose Abreu #include "hwif.h" 271c901a46SGiuseppe CAVALLARO #include "mmc.h" 287ac6653aSJeff Kirsher 2962a2ab93SGiuseppe CAVALLARO /* Synopsys Core versions */ 3062a2ab93SGiuseppe CAVALLARO #define DWMAC_CORE_3_40 0x34 3162a2ab93SGiuseppe CAVALLARO #define DWMAC_CORE_3_50 0x35 3248863ce5SAlexandre TORGUE #define DWMAC_CORE_4_00 0x40 335f0456b4SJose Abreu #define DWMAC_CORE_4_10 0x41 348bf993a5SJose Abreu #define DWMAC_CORE_5_00 0x50 358bf993a5SJose Abreu #define DWMAC_CORE_5_10 0x51 3696874c61SMohammad Athari Bin Ismail #define DWMAC_CORE_5_20 0x52 3748ae5554SJose Abreu #define DWXGMAC_CORE_2_10 0x21 3810857e67SRohan G Thomas #define DWXGMAC_CORE_2_20 0x22 394a4ccde0SJose Abreu #define DWXLGMAC_CORE_2_00 0x20 404a4ccde0SJose Abreu 414a4ccde0SJose Abreu /* Device ID */ 424a4ccde0SJose Abreu #define DWXGMAC_ID 0x76 434a4ccde0SJose Abreu #define DWXLGMAC_ID 0x27 4448ae5554SJose Abreu 4548863ce5SAlexandre TORGUE #define STMMAC_CHAN0 0 /* Always supported and default for all chips */ 4662a2ab93SGiuseppe CAVALLARO 47aa042f60SSong, Yoong Siang /* TX and RX Descriptor Length, these need to be power of two. 48aa042f60SSong, Yoong Siang * TX descriptor length less than 64 may cause transmit queue timed out error. 49aa042f60SSong, Yoong Siang * RX descriptor length less than 64 may cause inconsistent Rx chain error. 50aa042f60SSong, Yoong Siang */ 51aa042f60SSong, Yoong Siang #define DMA_MIN_TX_SIZE 64 52aa042f60SSong, Yoong Siang #define DMA_MAX_TX_SIZE 1024 53aa042f60SSong, Yoong Siang #define DMA_DEFAULT_TX_SIZE 512 54aa042f60SSong, Yoong Siang #define DMA_MIN_RX_SIZE 64 55aa042f60SSong, Yoong Siang #define DMA_MAX_RX_SIZE 1024 56aa042f60SSong, Yoong Siang #define DMA_DEFAULT_RX_SIZE 512 57e3ad57c9SGiuseppe Cavallaro #define STMMAC_GET_ENTRY(x, size) ((x + 1) & (size - 1)) 58e3ad57c9SGiuseppe Cavallaro 597ac6653aSJeff Kirsher #undef FRAME_FILTER_DEBUG 607ac6653aSJeff Kirsher /* #define FRAME_FILTER_DEBUG */ 617ac6653aSJeff Kirsher 629680b2abSPetr Tesarik struct stmmac_q_tx_stats { 639680b2abSPetr Tesarik u64_stats_t tx_bytes; 649680b2abSPetr Tesarik u64_stats_t tx_set_ic_bit; 659680b2abSPetr Tesarik u64_stats_t tx_tso_frames; 669680b2abSPetr Tesarik u64_stats_t tx_tso_nfrags; 679680b2abSPetr Tesarik }; 689680b2abSPetr Tesarik 699680b2abSPetr Tesarik struct stmmac_napi_tx_stats { 709680b2abSPetr Tesarik u64_stats_t tx_packets; 719680b2abSPetr Tesarik u64_stats_t tx_pkt_n; 729680b2abSPetr Tesarik u64_stats_t poll; 739680b2abSPetr Tesarik u64_stats_t tx_clean; 749680b2abSPetr Tesarik u64_stats_t tx_set_ic_bit; 759680b2abSPetr Tesarik }; 769680b2abSPetr Tesarik 7768e9c5deSVijayakannan Ayyathurai struct stmmac_txq_stats { 789680b2abSPetr Tesarik /* Updates protected by tx queue lock. */ 799680b2abSPetr Tesarik struct u64_stats_sync q_syncp; 809680b2abSPetr Tesarik struct stmmac_q_tx_stats q; 819680b2abSPetr Tesarik 829680b2abSPetr Tesarik /* Updates protected by NAPI poll logic. */ 839680b2abSPetr Tesarik struct u64_stats_sync napi_syncp; 849680b2abSPetr Tesarik struct stmmac_napi_tx_stats napi; 858070274bSJisheng Zhang } ____cacheline_aligned_in_smp; 8668e9c5deSVijayakannan Ayyathurai 879680b2abSPetr Tesarik struct stmmac_napi_rx_stats { 889680b2abSPetr Tesarik u64_stats_t rx_bytes; 899680b2abSPetr Tesarik u64_stats_t rx_packets; 909680b2abSPetr Tesarik u64_stats_t rx_pkt_n; 919680b2abSPetr Tesarik u64_stats_t poll; 929680b2abSPetr Tesarik }; 939680b2abSPetr Tesarik 9468e9c5deSVijayakannan Ayyathurai struct stmmac_rxq_stats { 959680b2abSPetr Tesarik /* Updates protected by NAPI poll logic. */ 969680b2abSPetr Tesarik struct u64_stats_sync napi_syncp; 979680b2abSPetr Tesarik struct stmmac_napi_rx_stats napi; 988070274bSJisheng Zhang } ____cacheline_aligned_in_smp; 9968e9c5deSVijayakannan Ayyathurai 1009680b2abSPetr Tesarik /* Updates on each CPU protected by not allowing nested irqs. */ 1019680b2abSPetr Tesarik struct stmmac_pcpu_stats { 1029680b2abSPetr Tesarik struct u64_stats_sync syncp; 1039680b2abSPetr Tesarik u64_stats_t rx_normal_irq_n[MTL_MAX_TX_QUEUES]; 1049680b2abSPetr Tesarik u64_stats_t tx_normal_irq_n[MTL_MAX_RX_QUEUES]; 1059680b2abSPetr Tesarik }; 1069680b2abSPetr Tesarik 107915c199fSGiuseppe CAVALLARO /* Extra statistic and debug information exposed by ethtool */ 1087ac6653aSJeff Kirsher struct stmmac_extra_stats { 1097ac6653aSJeff Kirsher /* Transmit errors */ 1107ac6653aSJeff Kirsher unsigned long tx_underflow ____cacheline_aligned; 1117ac6653aSJeff Kirsher unsigned long tx_carrier; 1127ac6653aSJeff Kirsher unsigned long tx_losscarrier; 1133c20f72fSGiuseppe CAVALLARO unsigned long vlan_tag; 1147ac6653aSJeff Kirsher unsigned long tx_deferred; 1157ac6653aSJeff Kirsher unsigned long tx_vlan; 1167ac6653aSJeff Kirsher unsigned long tx_jabber; 1177ac6653aSJeff Kirsher unsigned long tx_frame_flushed; 1187ac6653aSJeff Kirsher unsigned long tx_payload_error; 1197ac6653aSJeff Kirsher unsigned long tx_ip_header_error; 120133466c3SJisheng Zhang unsigned long tx_collision; 1217ac6653aSJeff Kirsher /* Receive errors */ 1227ac6653aSJeff Kirsher unsigned long rx_desc; 1233c20f72fSGiuseppe CAVALLARO unsigned long sa_filter_fail; 1243c20f72fSGiuseppe CAVALLARO unsigned long overflow_error; 1253c20f72fSGiuseppe CAVALLARO unsigned long ipc_csum_error; 1267ac6653aSJeff Kirsher unsigned long rx_collision; 127e0a76606SLABBE Corentin unsigned long rx_crc_errors; 1281cc5a735SGiuseppe CAVALLARO unsigned long dribbling_bit; 1297ac6653aSJeff Kirsher unsigned long rx_length; 1307ac6653aSJeff Kirsher unsigned long rx_mii; 1317ac6653aSJeff Kirsher unsigned long rx_multicast; 1327ac6653aSJeff Kirsher unsigned long rx_gmac_overflow; 1337ac6653aSJeff Kirsher unsigned long rx_watchdog; 1347ac6653aSJeff Kirsher unsigned long da_rx_filter_fail; 1357ac6653aSJeff Kirsher unsigned long sa_rx_filter_fail; 1367ac6653aSJeff Kirsher unsigned long rx_missed_cntr; 1377ac6653aSJeff Kirsher unsigned long rx_overflow_cntr; 1387ac6653aSJeff Kirsher unsigned long rx_vlan; 139b5418e13SJose Abreu unsigned long rx_split_hdr_pkt_n; 14062a2ab93SGiuseppe CAVALLARO /* Tx/Rx IRQ error info */ 1417ac6653aSJeff Kirsher unsigned long tx_undeflow_irq; 1427ac6653aSJeff Kirsher unsigned long tx_process_stopped_irq; 1437ac6653aSJeff Kirsher unsigned long tx_jabber_irq; 1447ac6653aSJeff Kirsher unsigned long rx_overflow_irq; 1457ac6653aSJeff Kirsher unsigned long rx_buf_unav_irq; 1467ac6653aSJeff Kirsher unsigned long rx_process_stopped_irq; 1477ac6653aSJeff Kirsher unsigned long rx_watchdog_irq; 1487ac6653aSJeff Kirsher unsigned long tx_early_irq; 1497ac6653aSJeff Kirsher unsigned long fatal_bus_error_irq; 15062a2ab93SGiuseppe CAVALLARO /* Tx/Rx IRQ Events */ 15162a2ab93SGiuseppe CAVALLARO unsigned long rx_early_irq; 1527ac6653aSJeff Kirsher unsigned long threshold; 15362a2ab93SGiuseppe CAVALLARO unsigned long irq_receive_pmt_irq_n; 15462a2ab93SGiuseppe CAVALLARO /* MMC info */ 155d765955dSGiuseppe CAVALLARO unsigned long mmc_tx_irq_n; 156d765955dSGiuseppe CAVALLARO unsigned long mmc_rx_irq_n; 157d765955dSGiuseppe CAVALLARO unsigned long mmc_rx_csum_offload_irq_n; 158d765955dSGiuseppe CAVALLARO /* EEE */ 159d765955dSGiuseppe CAVALLARO unsigned long irq_tx_path_in_lpi_mode_n; 160d765955dSGiuseppe CAVALLARO unsigned long irq_tx_path_exit_lpi_mode_n; 161d765955dSGiuseppe CAVALLARO unsigned long irq_rx_path_in_lpi_mode_n; 162d765955dSGiuseppe CAVALLARO unsigned long irq_rx_path_exit_lpi_mode_n; 163d765955dSGiuseppe CAVALLARO unsigned long phy_eee_wakeup_error_n; 164c24602efSGiuseppe CAVALLARO /* Extended RDES status */ 165c24602efSGiuseppe CAVALLARO unsigned long ip_hdr_err; 166c24602efSGiuseppe CAVALLARO unsigned long ip_payload_err; 167c24602efSGiuseppe CAVALLARO unsigned long ip_csum_bypassed; 168c24602efSGiuseppe CAVALLARO unsigned long ipv4_pkt_rcvd; 169c24602efSGiuseppe CAVALLARO unsigned long ipv6_pkt_rcvd; 170ee112c12SGiuseppe CAVALLARO unsigned long no_ptp_rx_msg_type_ext; 171ee112c12SGiuseppe CAVALLARO unsigned long ptp_rx_msg_type_sync; 172ee112c12SGiuseppe CAVALLARO unsigned long ptp_rx_msg_type_follow_up; 173ee112c12SGiuseppe CAVALLARO unsigned long ptp_rx_msg_type_delay_req; 174ee112c12SGiuseppe CAVALLARO unsigned long ptp_rx_msg_type_delay_resp; 175ee112c12SGiuseppe CAVALLARO unsigned long ptp_rx_msg_type_pdelay_req; 176ee112c12SGiuseppe CAVALLARO unsigned long ptp_rx_msg_type_pdelay_resp; 177ee112c12SGiuseppe CAVALLARO unsigned long ptp_rx_msg_type_pdelay_follow_up; 178ee112c12SGiuseppe CAVALLARO unsigned long ptp_rx_msg_type_announce; 179ee112c12SGiuseppe CAVALLARO unsigned long ptp_rx_msg_type_management; 180ee112c12SGiuseppe CAVALLARO unsigned long ptp_rx_msg_pkt_reserved_type; 181c24602efSGiuseppe CAVALLARO unsigned long ptp_frame_type; 182c24602efSGiuseppe CAVALLARO unsigned long ptp_ver; 183c24602efSGiuseppe CAVALLARO unsigned long timestamp_dropped; 184c24602efSGiuseppe CAVALLARO unsigned long av_pkt_rcvd; 185c24602efSGiuseppe CAVALLARO unsigned long av_tagged_pkt_rcvd; 186c24602efSGiuseppe CAVALLARO unsigned long vlan_tag_priority_val; 187c24602efSGiuseppe CAVALLARO unsigned long l3_filter_match; 188c24602efSGiuseppe CAVALLARO unsigned long l4_filter_match; 189c24602efSGiuseppe CAVALLARO unsigned long l3_l4_filter_no_match; 1900982a0f6SGiuseppe CAVALLARO /* PCS */ 1910982a0f6SGiuseppe CAVALLARO unsigned long irq_pcs_ane_n; 1920982a0f6SGiuseppe CAVALLARO unsigned long irq_pcs_link_n; 1930982a0f6SGiuseppe CAVALLARO unsigned long irq_rgmii_n; 194e58bb43fSGiuseppe CAVALLARO unsigned long pcs_link; 195e58bb43fSGiuseppe CAVALLARO unsigned long pcs_duplex; 196e58bb43fSGiuseppe CAVALLARO unsigned long pcs_speed; 1972f7a791cSGiuseppe CAVALLARO /* debug register */ 1982f7a791cSGiuseppe CAVALLARO unsigned long mtl_tx_status_fifo_full; 1992f7a791cSGiuseppe CAVALLARO unsigned long mtl_tx_fifo_not_empty; 2002f7a791cSGiuseppe CAVALLARO unsigned long mmtl_fifo_ctrl; 2012f7a791cSGiuseppe CAVALLARO unsigned long mtl_tx_fifo_read_ctrl_write; 2022f7a791cSGiuseppe CAVALLARO unsigned long mtl_tx_fifo_read_ctrl_wait; 2032f7a791cSGiuseppe CAVALLARO unsigned long mtl_tx_fifo_read_ctrl_read; 2042f7a791cSGiuseppe CAVALLARO unsigned long mtl_tx_fifo_read_ctrl_idle; 2052f7a791cSGiuseppe CAVALLARO unsigned long mac_tx_in_pause; 2062f7a791cSGiuseppe CAVALLARO unsigned long mac_tx_frame_ctrl_xfer; 2072f7a791cSGiuseppe CAVALLARO unsigned long mac_tx_frame_ctrl_idle; 2082f7a791cSGiuseppe CAVALLARO unsigned long mac_tx_frame_ctrl_wait; 2092f7a791cSGiuseppe CAVALLARO unsigned long mac_tx_frame_ctrl_pause; 2102f7a791cSGiuseppe CAVALLARO unsigned long mac_gmii_tx_proto_engine; 2112f7a791cSGiuseppe CAVALLARO unsigned long mtl_rx_fifo_fill_level_full; 2122f7a791cSGiuseppe CAVALLARO unsigned long mtl_rx_fifo_fill_above_thresh; 2132f7a791cSGiuseppe CAVALLARO unsigned long mtl_rx_fifo_fill_below_thresh; 2142f7a791cSGiuseppe CAVALLARO unsigned long mtl_rx_fifo_fill_level_empty; 2152f7a791cSGiuseppe CAVALLARO unsigned long mtl_rx_fifo_read_ctrl_flush; 2162f7a791cSGiuseppe CAVALLARO unsigned long mtl_rx_fifo_read_ctrl_read_data; 2172f7a791cSGiuseppe CAVALLARO unsigned long mtl_rx_fifo_read_ctrl_status; 2182f7a791cSGiuseppe CAVALLARO unsigned long mtl_rx_fifo_read_ctrl_idle; 2192f7a791cSGiuseppe CAVALLARO unsigned long mtl_rx_fifo_ctrl_active; 2202f7a791cSGiuseppe CAVALLARO unsigned long mac_rx_frame_ctrl_fifo; 2212f7a791cSGiuseppe CAVALLARO unsigned long mac_gmii_rx_proto_engine; 2229f298959SOng Boon Leong /* EST */ 2239f298959SOng Boon Leong unsigned long mtl_est_cgce; 2249f298959SOng Boon Leong unsigned long mtl_est_hlbs; 2259f298959SOng Boon Leong unsigned long mtl_est_hlbf; 2269f298959SOng Boon Leong unsigned long mtl_est_btre; 2279f298959SOng Boon Leong unsigned long mtl_est_btrlm; 2288070274bSJisheng Zhang /* per queue statistics */ 2298070274bSJisheng Zhang struct stmmac_txq_stats txq_stats[MTL_MAX_TX_QUEUES]; 2308070274bSJisheng Zhang struct stmmac_rxq_stats rxq_stats[MTL_MAX_RX_QUEUES]; 2319680b2abSPetr Tesarik struct stmmac_pcpu_stats __percpu *pcpu_stats; 232133466c3SJisheng Zhang unsigned long rx_dropped; 233133466c3SJisheng Zhang unsigned long rx_errors; 234133466c3SJisheng Zhang unsigned long tx_dropped; 235133466c3SJisheng Zhang unsigned long tx_errors; 2367ac6653aSJeff Kirsher }; 2377ac6653aSJeff Kirsher 2388bf993a5SJose Abreu /* Safety Feature statistics exposed by ethtool */ 2398bf993a5SJose Abreu struct stmmac_safety_stats { 2408bf993a5SJose Abreu unsigned long mac_errors[32]; 2418bf993a5SJose Abreu unsigned long mtl_errors[32]; 2428bf993a5SJose Abreu unsigned long dma_errors[32]; 2437e0ff501SFurong Xu unsigned long dma_dpp_errors[32]; 2448bf993a5SJose Abreu }; 2458bf993a5SJose Abreu 2468bf993a5SJose Abreu /* Number of fields in Safety Stats */ 2478bf993a5SJose Abreu #define STMMAC_SAFETY_FEAT_SIZE \ 2488bf993a5SJose Abreu (sizeof(struct stmmac_safety_stats) / sizeof(unsigned long)) 2498bf993a5SJose Abreu 250cd7201f4SGiuseppe CAVALLARO /* CSR Frequency Access Defines*/ 251cd7201f4SGiuseppe CAVALLARO #define CSR_F_35M 35000000 252cd7201f4SGiuseppe CAVALLARO #define CSR_F_60M 60000000 253cd7201f4SGiuseppe CAVALLARO #define CSR_F_100M 100000000 254cd7201f4SGiuseppe CAVALLARO #define CSR_F_150M 150000000 255cd7201f4SGiuseppe CAVALLARO #define CSR_F_250M 250000000 256cd7201f4SGiuseppe CAVALLARO #define CSR_F_300M 300000000 257cd7201f4SGiuseppe CAVALLARO 258cd7201f4SGiuseppe CAVALLARO #define MAC_CSR_H_FRQ_MASK 0x20 259cd7201f4SGiuseppe CAVALLARO 2607ac6653aSJeff Kirsher #define HASH_TABLE_SIZE 64 261f88203a2SVince Bridgers #define PAUSE_TIME 0xffff 2627ac6653aSJeff Kirsher 2637ac6653aSJeff Kirsher /* Flow Control defines */ 2647ac6653aSJeff Kirsher #define FLOW_OFF 0 2657ac6653aSJeff Kirsher #define FLOW_RX 1 2667ac6653aSJeff Kirsher #define FLOW_TX 2 2677ac6653aSJeff Kirsher #define FLOW_AUTO (FLOW_TX | FLOW_RX) 2687ac6653aSJeff Kirsher 269e58bb43fSGiuseppe CAVALLARO /* PCS defines */ 270e58bb43fSGiuseppe CAVALLARO #define STMMAC_PCS_RGMII (1 << 0) 271e58bb43fSGiuseppe CAVALLARO #define STMMAC_PCS_SGMII (1 << 1) 272e58bb43fSGiuseppe CAVALLARO #define STMMAC_PCS_TBI (1 << 2) 273e58bb43fSGiuseppe CAVALLARO #define STMMAC_PCS_RTBI (1 << 3) 274e58bb43fSGiuseppe CAVALLARO 2757ac6653aSJeff Kirsher #define SF_DMA_MODE 1 /* DMA STORE-AND-FORWARD Operation Mode */ 2767ac6653aSJeff Kirsher 277d638dcb5SAndrew Halaney /* DMA HW feature register fields */ 2781db123fbSRayagond Kokatanur #define DMA_HW_FEAT_MIISEL 0x00000001 /* 10/100 Mbps Support */ 2791db123fbSRayagond Kokatanur #define DMA_HW_FEAT_GMIISEL 0x00000002 /* 1000 Mbps Support */ 2801db123fbSRayagond Kokatanur #define DMA_HW_FEAT_HDSEL 0x00000004 /* Half-Duplex Support */ 2811db123fbSRayagond Kokatanur #define DMA_HW_FEAT_EXTHASHEN 0x00000008 /* Expanded DA Hash Filter */ 2821db123fbSRayagond Kokatanur #define DMA_HW_FEAT_HASHSEL 0x00000010 /* HASH Filter */ 283ceb69499SGiuseppe CAVALLARO #define DMA_HW_FEAT_ADDMAC 0x00000020 /* Multiple MAC Addr Reg */ 2841db123fbSRayagond Kokatanur #define DMA_HW_FEAT_PCSSEL 0x00000040 /* PCS registers */ 2851db123fbSRayagond Kokatanur #define DMA_HW_FEAT_L3L4FLTREN 0x00000080 /* Layer 3 & Layer 4 Feature */ 2861db123fbSRayagond Kokatanur #define DMA_HW_FEAT_SMASEL 0x00000100 /* SMA(MDIO) Interface */ 2871db123fbSRayagond Kokatanur #define DMA_HW_FEAT_RWKSEL 0x00000200 /* PMT Remote Wakeup */ 2881db123fbSRayagond Kokatanur #define DMA_HW_FEAT_MGKSEL 0x00000400 /* PMT Magic Packet */ 2891db123fbSRayagond Kokatanur #define DMA_HW_FEAT_MMCSEL 0x00000800 /* RMON Module */ 290ceb69499SGiuseppe CAVALLARO #define DMA_HW_FEAT_TSVER1SEL 0x00001000 /* Only IEEE 1588-2002 */ 291ceb69499SGiuseppe CAVALLARO #define DMA_HW_FEAT_TSVER2SEL 0x00002000 /* IEEE 1588-2008 PTPv2 */ 2921db123fbSRayagond Kokatanur #define DMA_HW_FEAT_EEESEL 0x00004000 /* Energy Efficient Ethernet */ 2931db123fbSRayagond Kokatanur #define DMA_HW_FEAT_AVSEL 0x00008000 /* AV Feature */ 2941db123fbSRayagond Kokatanur #define DMA_HW_FEAT_TXCOESEL 0x00010000 /* Checksum Offload in Tx */ 295ceb69499SGiuseppe CAVALLARO #define DMA_HW_FEAT_RXTYP1COE 0x00020000 /* IP COE (Type 1) in Rx */ 296ceb69499SGiuseppe CAVALLARO #define DMA_HW_FEAT_RXTYP2COE 0x00040000 /* IP COE (Type 2) in Rx */ 2971db123fbSRayagond Kokatanur #define DMA_HW_FEAT_RXFIFOSIZE 0x00080000 /* Rx FIFO > 2048 Bytes */ 298ceb69499SGiuseppe CAVALLARO #define DMA_HW_FEAT_RXCHCNT 0x00300000 /* No. additional Rx Channels */ 299ceb69499SGiuseppe CAVALLARO #define DMA_HW_FEAT_TXCHCNT 0x00c00000 /* No. additional Tx Channels */ 300ceb69499SGiuseppe CAVALLARO #define DMA_HW_FEAT_ENHDESSEL 0x01000000 /* Alternate Descriptor */ 301ceb69499SGiuseppe CAVALLARO /* Timestamping with Internal System Time */ 302ceb69499SGiuseppe CAVALLARO #define DMA_HW_FEAT_INTTSEN 0x02000000 3031db123fbSRayagond Kokatanur #define DMA_HW_FEAT_FLEXIPPSEN 0x04000000 /* Flexible PPS Output */ 304ceb69499SGiuseppe CAVALLARO #define DMA_HW_FEAT_SAVLANINS 0x08000000 /* Source Addr or VLAN */ 305ceb69499SGiuseppe CAVALLARO #define DMA_HW_FEAT_ACTPHYIF 0x70000000 /* Active/selected PHY iface */ 3060f1f88a8SGiuseppe CAVALLARO #define DEFAULT_DMA_PBL 8 3071db123fbSRayagond Kokatanur 3088532f613SOng Boon Leong /* MSI defines */ 3098532f613SOng Boon Leong #define STMMAC_MSI_VEC_MAX 32 3108532f613SOng Boon Leong 31170523e63SGiuseppe CAVALLARO /* PCS status and mask defines */ 31270523e63SGiuseppe CAVALLARO #define PCS_ANE_IRQ BIT(2) /* PCS Auto-Negotiation */ 31370523e63SGiuseppe CAVALLARO #define PCS_LINK_IRQ BIT(1) /* PCS Link */ 31470523e63SGiuseppe CAVALLARO #define PCS_RGSMIIIS_IRQ BIT(0) /* RGMII or SMII Interrupt */ 31570523e63SGiuseppe CAVALLARO 31662a2ab93SGiuseppe CAVALLARO /* Max/Min RI Watchdog Timer count value */ 31762a2ab93SGiuseppe CAVALLARO #define MAX_DMA_RIWT 0xff 31801d1689dSJose Abreu #define MIN_DMA_RIWT 0x10 3194e4337ccSJose Abreu #define DEF_DMA_RIWT 0xa0 3209125cdd1SGiuseppe CAVALLARO /* Tx coalesce parameters */ 3218fce3331SJose Abreu #define STMMAC_COAL_TX_TIMER 1000 3229125cdd1SGiuseppe CAVALLARO #define STMMAC_MAX_COAL_TX_TICK 100000 3239125cdd1SGiuseppe CAVALLARO #define STMMAC_TX_MAX_FRAMES 256 324da202451SJose Abreu #define STMMAC_TX_FRAMES 25 325da202451SJose Abreu #define STMMAC_RX_FRAMES 0 3269125cdd1SGiuseppe CAVALLARO 327abe80fdcSJoao Pinto /* Packets types */ 328abe80fdcSJoao Pinto enum packets_types { 329abe80fdcSJoao Pinto PACKET_AVCPQ = 0x1, /* AV Untagged Control packets */ 330abe80fdcSJoao Pinto PACKET_PTPQ = 0x2, /* PTP Packets */ 331abe80fdcSJoao Pinto PACKET_DCBCPQ = 0x3, /* DCB Control Packets */ 332abe80fdcSJoao Pinto PACKET_UPQ = 0x4, /* Untagged Packets */ 333abe80fdcSJoao Pinto PACKET_MCBCQ = 0x5, /* Multicast & Broadcast Packets */ 334abe80fdcSJoao Pinto }; 335abe80fdcSJoao Pinto 336ceb69499SGiuseppe CAVALLARO /* Rx IPC status */ 337ceb69499SGiuseppe CAVALLARO enum rx_frame_status { 338c1fa3212SFabrice Gasnier good_frame = 0x0, 339c1fa3212SFabrice Gasnier discard_frame = 0x1, 340c1fa3212SFabrice Gasnier csum_none = 0x2, 341c1fa3212SFabrice Gasnier llc_snap = 0x4, 342c1fa3212SFabrice Gasnier dma_own = 0x8, 343753a7109SAlexandre TORGUE rx_not_ls = 0x10, 3447ac6653aSJeff Kirsher }; 3457ac6653aSJeff Kirsher 346c363b658SFabrice Gasnier /* Tx status */ 347c363b658SFabrice Gasnier enum tx_frame_status { 348c363b658SFabrice Gasnier tx_done = 0x0, 349c363b658SFabrice Gasnier tx_not_ls = 0x1, 350c363b658SFabrice Gasnier tx_err = 0x2, 351c363b658SFabrice Gasnier tx_dma_own = 0x4, 3523a6c12a0SXiaoliang Yang tx_err_bump_tc = 0x8, 353c363b658SFabrice Gasnier }; 354c363b658SFabrice Gasnier 3559125cdd1SGiuseppe CAVALLARO enum dma_irq_status { 3569125cdd1SGiuseppe CAVALLARO tx_hard_error = 0x1, 3579125cdd1SGiuseppe CAVALLARO tx_hard_error_bump_tc = 0x2, 3589125cdd1SGiuseppe CAVALLARO handle_rx = 0x4, 3599125cdd1SGiuseppe CAVALLARO handle_tx = 0x8, 3607ac6653aSJeff Kirsher }; 3617ac6653aSJeff Kirsher 3627e1c520cSOng Boon Leong enum dma_irq_dir { 3637e1c520cSOng Boon Leong DMA_DIR_RX = 0x1, 3647e1c520cSOng Boon Leong DMA_DIR_TX = 0x2, 3657e1c520cSOng Boon Leong DMA_DIR_RXTX = 0x3, 3667e1c520cSOng Boon Leong }; 3677e1c520cSOng Boon Leong 3688532f613SOng Boon Leong enum request_irq_err { 3698532f613SOng Boon Leong REQ_IRQ_ERR_ALL, 3708532f613SOng Boon Leong REQ_IRQ_ERR_TX, 3718532f613SOng Boon Leong REQ_IRQ_ERR_RX, 3728532f613SOng Boon Leong REQ_IRQ_ERR_SFTY_UE, 3738532f613SOng Boon Leong REQ_IRQ_ERR_SFTY_CE, 3748532f613SOng Boon Leong REQ_IRQ_ERR_LPI, 3758532f613SOng Boon Leong REQ_IRQ_ERR_WOL, 3768532f613SOng Boon Leong REQ_IRQ_ERR_MAC, 3778532f613SOng Boon Leong REQ_IRQ_ERR_NO, 3788532f613SOng Boon Leong }; 3798532f613SOng Boon Leong 380915c199fSGiuseppe CAVALLARO /* EEE and LPI defines */ 381162fb1d6Snandini sharma #define CORE_IRQ_TX_PATH_IN_LPI_MODE (1 << 0) 382162fb1d6Snandini sharma #define CORE_IRQ_TX_PATH_EXIT_LPI_MODE (1 << 1) 383162fb1d6Snandini sharma #define CORE_IRQ_RX_PATH_IN_LPI_MODE (1 << 2) 384162fb1d6Snandini sharma #define CORE_IRQ_RX_PATH_EXIT_LPI_MODE (1 << 3) 3850982a0f6SGiuseppe CAVALLARO 3865a558611SOng Boon Leong /* FPE defines */ 3875a558611SOng Boon Leong #define FPE_EVENT_UNKNOWN 0 3885a558611SOng Boon Leong #define FPE_EVENT_TRSP BIT(0) 3895a558611SOng Boon Leong #define FPE_EVENT_TVER BIT(1) 3905a558611SOng Boon Leong #define FPE_EVENT_RRSP BIT(2) 3915a558611SOng Boon Leong #define FPE_EVENT_RVER BIT(3) 3925a558611SOng Boon Leong 39348863ce5SAlexandre TORGUE #define CORE_IRQ_MTL_RX_OVERFLOW BIT(8) 394d765955dSGiuseppe CAVALLARO 395915c199fSGiuseppe CAVALLARO /* Physical Coding Sublayer */ 396e58bb43fSGiuseppe CAVALLARO struct rgmii_adv { 397e58bb43fSGiuseppe CAVALLARO unsigned int pause; 398e58bb43fSGiuseppe CAVALLARO unsigned int duplex; 399e58bb43fSGiuseppe CAVALLARO unsigned int lp_pause; 400e58bb43fSGiuseppe CAVALLARO unsigned int lp_duplex; 401e58bb43fSGiuseppe CAVALLARO }; 402e58bb43fSGiuseppe CAVALLARO 403e58bb43fSGiuseppe CAVALLARO #define STMMAC_PCS_PAUSE 1 404e58bb43fSGiuseppe CAVALLARO #define STMMAC_PCS_ASYM_PAUSE 2 405e58bb43fSGiuseppe CAVALLARO 406e7434821SGiuseppe CAVALLARO /* DMA HW capabilities */ 407e7434821SGiuseppe CAVALLARO struct dma_features { 408e7434821SGiuseppe CAVALLARO unsigned int mbps_10_100; 409e7434821SGiuseppe CAVALLARO unsigned int mbps_1000; 410e7434821SGiuseppe CAVALLARO unsigned int half_duplex; 411e7434821SGiuseppe CAVALLARO unsigned int hash_filter; 412e7434821SGiuseppe CAVALLARO unsigned int multi_addr; 413e7434821SGiuseppe CAVALLARO unsigned int pcs; 414e7434821SGiuseppe CAVALLARO unsigned int sma_mdio; 415e7434821SGiuseppe CAVALLARO unsigned int pmt_remote_wake_up; 416e7434821SGiuseppe CAVALLARO unsigned int pmt_magic_frame; 417e7434821SGiuseppe CAVALLARO unsigned int rmon; 418e7434821SGiuseppe CAVALLARO /* IEEE 1588-2002 */ 419e7434821SGiuseppe CAVALLARO unsigned int time_stamp; 420e7434821SGiuseppe CAVALLARO /* IEEE 1588-2008 */ 421e7434821SGiuseppe CAVALLARO unsigned int atime_stamp; 422e7434821SGiuseppe CAVALLARO /* 802.3az - Energy-Efficient Ethernet (EEE) */ 423e7434821SGiuseppe CAVALLARO unsigned int eee; 424e7434821SGiuseppe CAVALLARO unsigned int av; 425b8ef7020SBiao Huang unsigned int hash_tb_sz; 42648863ce5SAlexandre TORGUE unsigned int tsoen; 427e7434821SGiuseppe CAVALLARO /* TX and RX csum */ 428e7434821SGiuseppe CAVALLARO unsigned int tx_coe; 42948863ce5SAlexandre TORGUE unsigned int rx_coe; 430e7434821SGiuseppe CAVALLARO unsigned int rx_coe_type1; 431e7434821SGiuseppe CAVALLARO unsigned int rx_coe_type2; 432e7434821SGiuseppe CAVALLARO unsigned int rxfifo_over_2048; 433e7434821SGiuseppe CAVALLARO /* TX and RX number of channels */ 434e7434821SGiuseppe CAVALLARO unsigned int number_rx_channel; 435e7434821SGiuseppe CAVALLARO unsigned int number_tx_channel; 4369eb12474Sjpinto /* TX and RX number of queues */ 4379eb12474Sjpinto unsigned int number_rx_queues; 4389eb12474Sjpinto unsigned int number_tx_queues; 4399a8a02c9SJose Abreu /* PPS output */ 4409a8a02c9SJose Abreu unsigned int pps_out_num; 441669a5556SFurong Xu /* Number of Traffic Classes */ 442669a5556SFurong Xu unsigned int numtc; 443669a5556SFurong Xu /* DCB Feature Enable */ 444669a5556SFurong Xu unsigned int dcben; 445669a5556SFurong Xu /* IEEE 1588 High Word Register Enable */ 446669a5556SFurong Xu unsigned int advthword; 447669a5556SFurong Xu /* PTP Offload Enable */ 448669a5556SFurong Xu unsigned int ptoen; 449669a5556SFurong Xu /* One-Step Timestamping Enable */ 450669a5556SFurong Xu unsigned int osten; 451669a5556SFurong Xu /* Priority-Based Flow Control Enable */ 452669a5556SFurong Xu unsigned int pfcen; 453e7434821SGiuseppe CAVALLARO /* Alternate (enhanced) DESC mode */ 454e7434821SGiuseppe CAVALLARO unsigned int enh_desc; 45511fbf811SThierry Reding /* TX and RX FIFO sizes */ 45611fbf811SThierry Reding unsigned int tx_fifo_size; 45711fbf811SThierry Reding unsigned int rx_fifo_size; 4588bf993a5SJose Abreu /* Automotive Safety Package */ 4598bf993a5SJose Abreu unsigned int asp; 4604dbbe8ddSJose Abreu /* RX Parser */ 4614dbbe8ddSJose Abreu unsigned int frpsel; 4624dbbe8ddSJose Abreu unsigned int frpbs; 4634dbbe8ddSJose Abreu unsigned int frpes; 464a993db88SJose Abreu unsigned int addr64; 465070246e4SJochen Henneberg unsigned int host_dma_width; 46676067459SJose Abreu unsigned int rssen; 4673cd1cfcbSJose Abreu unsigned int vlhash; 46867afd6d1SJose Abreu unsigned int sphen; 46930d93227SJose Abreu unsigned int vlins; 47030d93227SJose Abreu unsigned int dvlan; 471425eabddSJose Abreu unsigned int l3l4fnum; 4725904a980SJose Abreu unsigned int arpoffsel; 473669a5556SFurong Xu /* One Step for PTP over UDP/IP Feature Enable */ 474669a5556SFurong Xu unsigned int pou_ost_en; 475669a5556SFurong Xu /* Tx Timestamp FIFO Depth */ 476669a5556SFurong Xu unsigned int ttsfd; 477669a5556SFurong Xu /* Queue/Channel-Based VLAN tag insertion on Tx */ 478669a5556SFurong Xu unsigned int cbtisel; 479669a5556SFurong Xu /* Supported Parallel Instruction Processor Engines */ 480669a5556SFurong Xu unsigned int frppipe_num; 481669a5556SFurong Xu /* Number of Extended VLAN Tag Filters */ 482669a5556SFurong Xu unsigned int nrvf_num; 483504723afSJose Abreu /* TSN Features */ 484504723afSJose Abreu unsigned int estwid; 485504723afSJose Abreu unsigned int estdep; 486504723afSJose Abreu unsigned int estsel; 4871ac14241SJose Abreu unsigned int fpesel; 488430b383cSJose Abreu unsigned int tbssel; 489669a5556SFurong Xu /* Number of DMA channels enabled for TBS */ 490669a5556SFurong Xu unsigned int tbs_ch_num; 491669a5556SFurong Xu /* Per-Stream Filtering Enable */ 492669a5556SFurong Xu unsigned int sgfsel; 493341f67e4STan Tee Min /* Numbers of Auxiliary Snapshot Inputs */ 494341f67e4STan Tee Min unsigned int aux_snapshot_n; 49558c1e0baSFurong Xu /* Timestamp System Time Source */ 49658c1e0baSFurong Xu unsigned int tssrc; 497669a5556SFurong Xu /* Enhanced DMA Enable */ 498669a5556SFurong Xu unsigned int edma; 499669a5556SFurong Xu /* Different Descriptor Cache Enable */ 500669a5556SFurong Xu unsigned int ediffc; 501669a5556SFurong Xu /* VxLAN/NVGRE Enable */ 502669a5556SFurong Xu unsigned int vxn; 503669a5556SFurong Xu /* Debug Memory Interface Enable */ 504669a5556SFurong Xu unsigned int dbgmem; 505669a5556SFurong Xu /* Number of Policing Counters */ 506669a5556SFurong Xu unsigned int pcsel; 507e7434821SGiuseppe CAVALLARO }; 508e7434821SGiuseppe CAVALLARO 50986051317SJose Abreu /* RX Buffer size must be multiple of 4/8/16 bytes */ 51086051317SJose Abreu #define BUF_SIZE_16KiB 16368 5118137b6efSThor Thayer #define BUF_SIZE_8KiB 8188 5127ac6653aSJeff Kirsher #define BUF_SIZE_4KiB 4096 5137ac6653aSJeff Kirsher #define BUF_SIZE_2KiB 2048 5147ac6653aSJeff Kirsher 5157ac6653aSJeff Kirsher /* Power Down and WOL */ 5167ac6653aSJeff Kirsher #define PMT_NOT_SUPPORTED 0 5177ac6653aSJeff Kirsher #define PMT_SUPPORTED 1 5187ac6653aSJeff Kirsher 5197ac6653aSJeff Kirsher /* Common MAC defines */ 5207ac6653aSJeff Kirsher #define MAC_CTRL_REG 0x00000000 /* MAC Control */ 5217ac6653aSJeff Kirsher #define MAC_ENABLE_TX 0x00000008 /* Transmitter Enable */ 52228089222SLABBE Corentin #define MAC_ENABLE_RX 0x00000004 /* Receiver Enable */ 5237ac6653aSJeff Kirsher 524d765955dSGiuseppe CAVALLARO /* Default LPI timers */ 525f5351ef7SGiuseppe CAVALLARO #define STMMAC_DEFAULT_LIT_LS 0x3E8 526438a62b1Snandini sharma #define STMMAC_DEFAULT_TWT_LS 0x1E 527be1c7eaeSVineetha G. Jaya Kumaran #define STMMAC_ET_MAX 0xFFFFF 528d765955dSGiuseppe CAVALLARO 5294a7d666aSGiuseppe CAVALLARO #define STMMAC_CHAIN_MODE 0x1 5304a7d666aSGiuseppe CAVALLARO #define STMMAC_RING_MODE 0x2 5314a7d666aSGiuseppe CAVALLARO 5322618abb7SVince Bridgers #define JUMBO_LEN 9000 5332618abb7SVince Bridgers 53476067459SJose Abreu /* Receive Side Scaling */ 53576067459SJose Abreu #define STMMAC_RSS_HASH_KEY_SIZE 40 53676067459SJose Abreu #define STMMAC_RSS_MAX_TABLE_SIZE 256 53776067459SJose Abreu 53830d93227SJose Abreu /* VLAN */ 53930d93227SJose Abreu #define STMMAC_VLAN_NONE 0x0 54030d93227SJose Abreu #define STMMAC_VLAN_REMOVE 0x1 54130d93227SJose Abreu #define STMMAC_VLAN_INSERT 0x2 54230d93227SJose Abreu #define STMMAC_VLAN_REPLACE 0x3 54330d93227SJose Abreu 544915af656SAndy Shevchenko extern const struct stmmac_desc_ops enh_desc_ops; 545915af656SAndy Shevchenko extern const struct stmmac_desc_ops ndesc_ops; 546915af656SAndy Shevchenko 5477ed24bbeSVince Bridgers struct mac_device_info; 5487ed24bbeSVince Bridgers 549915af656SAndy Shevchenko extern const struct stmmac_hwtimestamp stmmac_ptp; 55048863ce5SAlexandre TORGUE extern const struct stmmac_mode_ops dwmac4_ring_mode_ops; 551915af656SAndy Shevchenko 5527ac6653aSJeff Kirsher struct mac_link { 553*93d565ebSSerge Semin u32 caps; 554ca84dfb9SLABBE Corentin u32 speed_mask; 555ca84dfb9SLABBE Corentin u32 speed10; 556ca84dfb9SLABBE Corentin u32 speed100; 557ca84dfb9SLABBE Corentin u32 speed1000; 5582142754fSJose Abreu u32 speed2500; 559ca84dfb9SLABBE Corentin u32 duplex; 5605b0d7d7dSJose Abreu struct { 5615b0d7d7dSJose Abreu u32 speed2500; 5625b0d7d7dSJose Abreu u32 speed5000; 5635b0d7d7dSJose Abreu u32 speed10000; 5645b0d7d7dSJose Abreu } xgmii; 5658a880936SJose Abreu struct { 5668a880936SJose Abreu u32 speed25000; 5678a880936SJose Abreu u32 speed40000; 5688a880936SJose Abreu u32 speed50000; 5698a880936SJose Abreu u32 speed100000; 5708a880936SJose Abreu } xlgmii; 5717ac6653aSJeff Kirsher }; 5727ac6653aSJeff Kirsher 5737ac6653aSJeff Kirsher struct mii_regs { 5747ac6653aSJeff Kirsher unsigned int addr; /* MII Address */ 5757ac6653aSJeff Kirsher unsigned int data; /* MII Data */ 576b91dce4cSLABBE Corentin unsigned int addr_shift; /* MII address shift */ 577b91dce4cSLABBE Corentin unsigned int reg_shift; /* MII reg shift */ 578b91dce4cSLABBE Corentin unsigned int addr_mask; /* MII address mask */ 579b91dce4cSLABBE Corentin unsigned int reg_mask; /* MII reg mask */ 580b91dce4cSLABBE Corentin unsigned int clk_csr_shift; 581b91dce4cSLABBE Corentin unsigned int clk_csr_mask; 5827ac6653aSJeff Kirsher }; 5837ac6653aSJeff Kirsher 5847ac6653aSJeff Kirsher struct mac_device_info { 5857ac6653aSJeff Kirsher const struct stmmac_ops *mac; 5867ac6653aSJeff Kirsher const struct stmmac_desc_ops *desc; 5877ac6653aSJeff Kirsher const struct stmmac_dma_ops *dma; 58829896a67SGiuseppe CAVALLARO const struct stmmac_mode_ops *mode; 589891434b1SRayagond Kokatanur const struct stmmac_hwtimestamp *ptp; 5904dbbe8ddSJose Abreu const struct stmmac_tc_ops *tc; 5913b1dd2c5SJose Abreu const struct stmmac_mmc_ops *mmc; 5925673ef86SVladimir Oltean struct dw_xpcs *xpcs; 5935d1f3fe7SMaxime Chevallier struct phylink_pcs *lynx_pcs; /* Lynx external PCS */ 5947ac6653aSJeff Kirsher struct mii_regs mii; /* MII register Addresses */ 5957ac6653aSJeff Kirsher struct mac_link link; 5967ed24bbeSVince Bridgers void __iomem *pcsr; /* vpointer to device CSRs */ 597b8ef7020SBiao Huang unsigned int multicast_filter_bins; 598b8ef7020SBiao Huang unsigned int unicast_filter_entries; 599b8ef7020SBiao Huang unsigned int mcast_bits_log2; 600d2afb5bdSGiuseppe CAVALLARO unsigned int rx_csum; 6013fe5cadbSGiuseppe CAVALLARO unsigned int pcs; 6023fe5cadbSGiuseppe CAVALLARO unsigned int pmt; 60302e57b9dSGiuseppe CAVALLARO unsigned int ps; 6044a4ccde0SJose Abreu unsigned int xlgmac; 605ed64639bSWong Vee Khee unsigned int num_vlan; 606ed64639bSWong Vee Khee u32 vlan_filter[32]; 607e0f9956aSChuah, Kim Tatt bool vlan_fail_q_en; 608e0f9956aSChuah, Kim Tatt u8 vlan_fail_q; 6097ac6653aSJeff Kirsher }; 6107ac6653aSJeff Kirsher 611abe80fdcSJoao Pinto struct stmmac_rx_routing { 612abe80fdcSJoao Pinto u32 reg_mask; 613abe80fdcSJoao Pinto u32 reg_shift; 614abe80fdcSJoao Pinto }; 615abe80fdcSJoao Pinto 6165f0456b4SJose Abreu int dwmac100_setup(struct stmmac_priv *priv); 6175f0456b4SJose Abreu int dwmac1000_setup(struct stmmac_priv *priv); 6185f0456b4SJose Abreu int dwmac4_setup(struct stmmac_priv *priv); 6192142754fSJose Abreu int dwxgmac2_setup(struct stmmac_priv *priv); 6204a4ccde0SJose Abreu int dwxlgmac2_setup(struct stmmac_priv *priv); 6217ac6653aSJeff Kirsher 62276660757SJakub Kicinski void stmmac_set_mac_addr(void __iomem *ioaddr, const u8 addr[6], 6237ac6653aSJeff Kirsher unsigned int high, unsigned int low); 624d6cc64efSJoe Perches void stmmac_get_mac_addr(void __iomem *ioaddr, unsigned char *addr, 6257ac6653aSJeff Kirsher unsigned int high, unsigned int low); 626d6cc64efSJoe Perches void stmmac_set_mac(void __iomem *ioaddr, bool enable); 627bfab27a1SGiuseppe CAVALLARO 62876660757SJakub Kicinski void stmmac_dwmac4_set_mac_addr(void __iomem *ioaddr, const u8 addr[6], 629477286b5SAlexandre TORGUE unsigned int high, unsigned int low); 630477286b5SAlexandre TORGUE void stmmac_dwmac4_get_mac_addr(void __iomem *ioaddr, unsigned char *addr, 631477286b5SAlexandre TORGUE unsigned int high, unsigned int low); 632477286b5SAlexandre TORGUE void stmmac_dwmac4_set_mac(void __iomem *ioaddr, bool enable); 633477286b5SAlexandre TORGUE 634d6cc64efSJoe Perches void dwmac_dma_flush_tx_fifo(void __iomem *ioaddr); 63570523e63SGiuseppe CAVALLARO 63629896a67SGiuseppe CAVALLARO extern const struct stmmac_mode_ops ring_mode_ops; 63729896a67SGiuseppe CAVALLARO extern const struct stmmac_mode_ops chain_mode_ops; 638f748be53SAlexandre TORGUE extern const struct stmmac_desc_ops dwmac4_desc_ops; 639bd4242dfSRayagond Kokatanur 640bd4242dfSRayagond Kokatanur #endif /* __COMMON_H__ */ 641