forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-05-10 9999e48639b3cecb08ffb37358bcba3b48161b29
kernel/drivers/net/ethernet/broadcom/genet/bcmgenet.h
....@@ -1,9 +1,6 @@
1
+/* SPDX-License-Identifier: GPL-2.0-only */
12 /*
2
- * Copyright (c) 2014-2017 Broadcom
3
- *
4
- * This program is free software; you can redistribute it and/or modify
5
- * it under the terms of the GNU General Public License version 2 as
6
- * published by the Free Software Foundation.
3
+ * Copyright (c) 2014-2020 Broadcom
74 */
85
96 #ifndef __BCMGENET_H__
....@@ -16,7 +13,8 @@
1613 #include <linux/mii.h>
1714 #include <linux/if_vlan.h>
1815 #include <linux/phy.h>
19
-#include <linux/net_dim.h>
16
+#include <linux/dim.h>
17
+#include <linux/ethtool.h>
2018
2119 /* total number of Buffer Descriptors, same for Rx/Tx */
2220 #define TOTAL_DESC 256
....@@ -34,6 +32,7 @@
3432 #define DMA_MAX_BURST_LENGTH 0x10
3533
3634 /* misc. configuration */
35
+#define MAX_NUM_OF_FS_RULES 16
3736 #define CLEAR_ALL_HFB 0xFF
3837 #define DMA_FC_THRESH_HI (TOTAL_DESC >> 4)
3938 #define DMA_FC_THRESH_LO 5
....@@ -147,6 +146,8 @@
147146 u32 alloc_rx_buff_failed;
148147 u32 rx_dma_failed;
149148 u32 tx_dma_failed;
149
+ u32 tx_realloc_tsb;
150
+ u32 tx_realloc_tsb_failed;
150151 };
151152
152153 #define UMAC_HD_BKP_CTRL 0x004
....@@ -254,6 +255,7 @@
254255 #define RBUF_CHK_CTRL 0x14
255256 #define RBUF_RXCHK_EN (1 << 0)
256257 #define RBUF_SKIP_FCS (1 << 4)
258
+#define RBUF_L3_PARSE_DIS (1 << 5)
257259
258260 #define RBUF_ENERGY_CTRL 0x9c
259261 #define RBUF_EEE_EN (1 << 0)
....@@ -273,6 +275,7 @@
273275 #define RBUF_FLTR_LEN_SHIFT 8
274276
275277 #define TBUF_CTRL 0x00
278
+#define TBUF_64B_EN (1 << 0)
276279 #define TBUF_BP_MC 0x0C
277280 #define TBUF_ENERGY_CTRL 0x14
278281 #define TBUF_EEE_EN (1 << 0)
....@@ -309,6 +312,8 @@
309312 #define UMAC_IRQ_HFB_SM (1 << 10)
310313 #define UMAC_IRQ_HFB_MM (1 << 11)
311314 #define UMAC_IRQ_MPD_R (1 << 12)
315
+#define UMAC_IRQ_WAKE_EVENT (UMAC_IRQ_HFB_SM | UMAC_IRQ_HFB_MM | \
316
+ UMAC_IRQ_MPD_R)
312317 #define UMAC_IRQ_RXDMA_MBDONE (1 << 13)
313318 #define UMAC_IRQ_RXDMA_PDONE (1 << 14)
314319 #define UMAC_IRQ_RXDMA_BDONE (1 << 15)
....@@ -582,7 +587,7 @@
582587 u16 event_ctr;
583588 unsigned long packets;
584589 unsigned long bytes;
585
- struct net_dim dim;
590
+ struct dim dim;
586591 };
587592
588593 struct bcmgenet_rx_ring {
....@@ -607,6 +612,18 @@
607612 struct bcmgenet_priv *priv;
608613 };
609614
615
+enum bcmgenet_rxnfc_state {
616
+ BCMGENET_RXNFC_STATE_UNUSED = 0,
617
+ BCMGENET_RXNFC_STATE_DISABLED,
618
+ BCMGENET_RXNFC_STATE_ENABLED
619
+};
620
+
621
+struct bcmgenet_rxnfc_rule {
622
+ struct list_head list;
623
+ struct ethtool_rx_flow_spec fs;
624
+ enum bcmgenet_rxnfc_state state;
625
+};
626
+
610627 /* device context */
611628 struct bcmgenet_priv {
612629 void __iomem *base;
....@@ -625,6 +642,8 @@
625642 struct enet_cb *rx_cbs;
626643 unsigned int num_rx_bds;
627644 unsigned int rx_buf_len;
645
+ struct bcmgenet_rxnfc_rule rxnfc_rules[MAX_NUM_OF_FS_RULES];
646
+ struct list_head rxnfc_list;
628647
629648 struct bcmgenet_rx_ring rx_rings[DESC_INDEX + 1];
630649
....@@ -662,11 +681,9 @@
662681 unsigned int irq0_stat;
663682
664683 /* HW descriptors/checksum variables */
665
- bool desc_64b_en;
666
- bool desc_rxchk_en;
667684 bool crc_fwd_en;
668685
669
- unsigned int dma_rx_chk_bit;
686
+ u32 dma_max_burst_length;
670687
671688 u32 msg_enable;
672689
....@@ -677,6 +694,8 @@
677694 /* WOL */
678695 struct clk *clk_wol;
679696 u32 wolopts;
697
+ u8 sopass[SOPASS_MAX];
698
+ bool wol_active;
680699
681700 struct bcmgenet_mib_counters mib;
682701