hc
2024-05-10 37f49e37ab4cb5d0bc4c60eb5c6d4dd57db767bb
kernel/drivers/net/ethernet/stmicro/stmmac/common.h
....@@ -1,19 +1,9 @@
1
+/* SPDX-License-Identifier: GPL-2.0-only */
12 /*******************************************************************************
23 STMMAC Common Header File
34
45 Copyright (C) 2007-2009 STMicroelectronics Ltd
56
6
- This program is free software; you can redistribute it and/or modify it
7
- under the terms and conditions of the GNU General Public License,
8
- version 2, as published by the Free Software Foundation.
9
-
10
- This program is distributed in the hope it will be useful, but WITHOUT
11
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13
- more details.
14
-
15
- The full GNU General Public License is included in this distribution in
16
- the file called "COPYING".
177
188 Author: Giuseppe Cavallaro <peppe.cavallaro@st.com>
199 *******************************************************************************/
....@@ -25,6 +15,7 @@
2515 #include <linux/netdevice.h>
2616 #include <linux/stmmac.h>
2717 #include <linux/phy.h>
18
+#include <linux/pcs/pcs-xpcs.h>
2819 #include <linux/module.h>
2920 #if IS_ENABLED(CONFIG_VLAN_8021Q)
3021 #define STMMAC_VLAN_TAG_USED
....@@ -43,16 +34,31 @@
4334 #define DWMAC_CORE_5_00 0x50
4435 #define DWMAC_CORE_5_10 0x51
4536 #define DWXGMAC_CORE_2_10 0x21
37
+#define DWXLGMAC_CORE_2_00 0x20
38
+
39
+/* Device ID */
40
+#define DWXGMAC_ID 0x76
41
+#define DWXLGMAC_ID 0x27
4642
4743 #define STMMAC_CHAN0 0 /* Always supported and default for all chips */
4844
49
-/* These need to be power of two, and >= 4 */
45
+/* TX and RX Descriptor Length, these need to be power of two.
46
+ * TX descriptor length less than 64 may cause transmit queue timed out error.
47
+ * RX descriptor length less than 64 may cause inconsistent Rx chain error.
48
+ */
49
+#define DMA_MIN_TX_SIZE 64
50
+#define DMA_MAX_TX_SIZE 1024
5051 #if IS_ENABLED(CONFIG_STMMAC_UIO)
51
-#define DMA_TX_SIZE 1024
52
-#define DMA_RX_SIZE 1024
52
+#define DMA_DEFAULT_TX_SIZE 1024
5353 #else
54
-#define DMA_TX_SIZE 512
55
-#define DMA_RX_SIZE 512
54
+#define DMA_DEFAULT_TX_SIZE 512
55
+#endif
56
+#define DMA_MIN_RX_SIZE 64
57
+#define DMA_MAX_RX_SIZE 1024
58
+#if IS_ENABLED(CONFIG_STMMAC_UIO)
59
+#define DMA_DEFAULT_RX_SIZE 1024
60
+#else
61
+#define DMA_DEFAULT_RX_SIZE 512
5662 #endif
5763 #define STMMAC_GET_ENTRY(x, size) ((x + 1) & (size - 1))
5864
....@@ -90,6 +96,7 @@
9096 unsigned long rx_missed_cntr;
9197 unsigned long rx_overflow_cntr;
9298 unsigned long rx_vlan;
99
+ unsigned long rx_split_hdr_pkt_n;
93100 /* Tx/Rx IRQ error info */
94101 unsigned long tx_undeflow_irq;
95102 unsigned long tx_process_stopped_irq;
....@@ -261,12 +268,14 @@
261268
262269 /* Max/Min RI Watchdog Timer count value */
263270 #define MAX_DMA_RIWT 0xff
264
-#define MIN_DMA_RIWT 0x20
271
+#define MIN_DMA_RIWT 0x10
272
+#define DEF_DMA_RIWT 0xa0
265273 /* Tx coalesce parameters */
266274 #define STMMAC_COAL_TX_TIMER 1000
267275 #define STMMAC_MAX_COAL_TX_TICK 100000
268276 #define STMMAC_TX_MAX_FRAMES 256
269277 #define STMMAC_TX_FRAMES 25
278
+#define STMMAC_RX_FRAMES 0
270279
271280 /* Packets types */
272281 enum packets_types {
....@@ -340,6 +349,7 @@
340349 /* 802.3az - Energy-Efficient Ethernet (EEE) */
341350 unsigned int eee;
342351 unsigned int av;
352
+ unsigned int hash_tb_sz;
343353 unsigned int tsoen;
344354 /* TX and RX csum */
345355 unsigned int tx_coe;
....@@ -366,6 +376,20 @@
366376 unsigned int frpsel;
367377 unsigned int frpbs;
368378 unsigned int frpes;
379
+ unsigned int addr64;
380
+ unsigned int rssen;
381
+ unsigned int vlhash;
382
+ unsigned int sphen;
383
+ unsigned int vlins;
384
+ unsigned int dvlan;
385
+ unsigned int l3l4fnum;
386
+ unsigned int arpoffsel;
387
+ /* TSN Features */
388
+ unsigned int estwid;
389
+ unsigned int estdep;
390
+ unsigned int estsel;
391
+ unsigned int fpesel;
392
+ unsigned int tbssel;
369393 };
370394
371395 /* RX Buffer size must be multiple of 4/8/16 bytes */
....@@ -392,6 +416,16 @@
392416
393417 #define JUMBO_LEN 9000
394418
419
+/* Receive Side Scaling */
420
+#define STMMAC_RSS_HASH_KEY_SIZE 40
421
+#define STMMAC_RSS_MAX_TABLE_SIZE 256
422
+
423
+/* VLAN */
424
+#define STMMAC_VLAN_NONE 0x0
425
+#define STMMAC_VLAN_REMOVE 0x1
426
+#define STMMAC_VLAN_INSERT 0x2
427
+#define STMMAC_VLAN_REPLACE 0x3
428
+
395429 extern const struct stmmac_desc_ops enh_desc_ops;
396430 extern const struct stmmac_desc_ops ndesc_ops;
397431
....@@ -406,8 +440,18 @@
406440 u32 speed100;
407441 u32 speed1000;
408442 u32 speed2500;
409
- u32 speed10000;
410443 u32 duplex;
444
+ struct {
445
+ u32 speed2500;
446
+ u32 speed5000;
447
+ u32 speed10000;
448
+ } xgmii;
449
+ struct {
450
+ u32 speed25000;
451
+ u32 speed40000;
452
+ u32 speed50000;
453
+ u32 speed100000;
454
+ } xlgmii;
411455 };
412456
413457 struct mii_regs {
....@@ -428,16 +472,24 @@
428472 const struct stmmac_mode_ops *mode;
429473 const struct stmmac_hwtimestamp *ptp;
430474 const struct stmmac_tc_ops *tc;
475
+ const struct stmmac_mmc_ops *mmc;
476
+ const struct mdio_xpcs_ops *xpcs;
477
+ struct mdio_xpcs_args xpcs_args;
431478 struct mii_regs mii; /* MII register Addresses */
432479 struct mac_link link;
433480 void __iomem *pcsr; /* vpointer to device CSRs */
434
- int multicast_filter_bins;
435
- int unicast_filter_entries;
436
- int mcast_bits_log2;
481
+ unsigned int multicast_filter_bins;
482
+ unsigned int unicast_filter_entries;
483
+ unsigned int mcast_bits_log2;
437484 unsigned int rx_csum;
438485 unsigned int pcs;
439486 unsigned int pmt;
440487 unsigned int ps;
488
+ unsigned int xlgmac;
489
+ unsigned int num_vlan;
490
+ u32 vlan_filter[32];
491
+ bool vlan_fail_q_en;
492
+ u8 vlan_fail_q;
441493 };
442494
443495 struct stmmac_rx_routing {
....@@ -449,6 +501,7 @@
449501 int dwmac1000_setup(struct stmmac_priv *priv);
450502 int dwmac4_setup(struct stmmac_priv *priv);
451503 int dwxgmac2_setup(struct stmmac_priv *priv);
504
+int dwxlgmac2_setup(struct stmmac_priv *priv);
452505
453506 void stmmac_set_mac_addr(void __iomem *ioaddr, u8 addr[6],
454507 unsigned int high, unsigned int low);