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,12 +34,32 @@
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 */
50
-#define DMA_TX_SIZE 512
51
-#define DMA_RX_SIZE 512
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
51
+#if IS_ENABLED(CONFIG_STMMAC_UIO)
52
+#define DMA_DEFAULT_TX_SIZE 1024
53
+#else
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
62
+#endif
5263 #define STMMAC_GET_ENTRY(x, size) ((x + 1) & (size - 1))
5364
5465 #undef FRAME_FILTER_DEBUG
....@@ -85,6 +96,7 @@
8596 unsigned long rx_missed_cntr;
8697 unsigned long rx_overflow_cntr;
8798 unsigned long rx_vlan;
99
+ unsigned long rx_split_hdr_pkt_n;
88100 /* Tx/Rx IRQ error info */
89101 unsigned long tx_undeflow_irq;
90102 unsigned long tx_process_stopped_irq;
....@@ -256,12 +268,14 @@
256268
257269 /* Max/Min RI Watchdog Timer count value */
258270 #define MAX_DMA_RIWT 0xff
259
-#define MIN_DMA_RIWT 0x20
271
+#define MIN_DMA_RIWT 0x10
272
+#define DEF_DMA_RIWT 0xa0
260273 /* Tx coalesce parameters */
261274 #define STMMAC_COAL_TX_TIMER 1000
262275 #define STMMAC_MAX_COAL_TX_TICK 100000
263276 #define STMMAC_TX_MAX_FRAMES 256
264
-#define STMMAC_TX_FRAMES 1
277
+#define STMMAC_TX_FRAMES 25
278
+#define STMMAC_RX_FRAMES 0
265279
266280 /* Packets types */
267281 enum packets_types {
....@@ -335,6 +349,7 @@
335349 /* 802.3az - Energy-Efficient Ethernet (EEE) */
336350 unsigned int eee;
337351 unsigned int av;
352
+ unsigned int hash_tb_sz;
338353 unsigned int tsoen;
339354 /* TX and RX csum */
340355 unsigned int tx_coe;
....@@ -361,6 +376,20 @@
361376 unsigned int frpsel;
362377 unsigned int frpbs;
363378 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;
364393 };
365394
366395 /* RX Buffer size must be multiple of 4/8/16 bytes */
....@@ -387,6 +416,16 @@
387416
388417 #define JUMBO_LEN 9000
389418
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
+
390429 extern const struct stmmac_desc_ops enh_desc_ops;
391430 extern const struct stmmac_desc_ops ndesc_ops;
392431
....@@ -401,8 +440,18 @@
401440 u32 speed100;
402441 u32 speed1000;
403442 u32 speed2500;
404
- u32 speed10000;
405443 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;
406455 };
407456
408457 struct mii_regs {
....@@ -423,16 +472,24 @@
423472 const struct stmmac_mode_ops *mode;
424473 const struct stmmac_hwtimestamp *ptp;
425474 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;
426478 struct mii_regs mii; /* MII register Addresses */
427479 struct mac_link link;
428480 void __iomem *pcsr; /* vpointer to device CSRs */
429
- int multicast_filter_bins;
430
- int unicast_filter_entries;
431
- int mcast_bits_log2;
481
+ unsigned int multicast_filter_bins;
482
+ unsigned int unicast_filter_entries;
483
+ unsigned int mcast_bits_log2;
432484 unsigned int rx_csum;
433485 unsigned int pcs;
434486 unsigned int pmt;
435487 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;
436493 };
437494
438495 struct stmmac_rx_routing {
....@@ -444,6 +501,7 @@
444501 int dwmac1000_setup(struct stmmac_priv *priv);
445502 int dwmac4_setup(struct stmmac_priv *priv);
446503 int dwxgmac2_setup(struct stmmac_priv *priv);
504
+int dwxlgmac2_setup(struct stmmac_priv *priv);
447505
448506 void stmmac_set_mac_addr(void __iomem *ioaddr, u8 addr[6],
449507 unsigned int high, unsigned int low);