162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-or-later */
262306a36Sopenharmony_ci/*
362306a36Sopenharmony_ci * Copyright (C) Freescale Semicondutor, Inc. 2006-2009. All rights reserved.
462306a36Sopenharmony_ci *
562306a36Sopenharmony_ci * Author: Shlomi Gridish <gridish@freescale.com>
662306a36Sopenharmony_ci *
762306a36Sopenharmony_ci * Description:
862306a36Sopenharmony_ci * Internal header file for UCC Gigabit Ethernet unit routines.
962306a36Sopenharmony_ci *
1062306a36Sopenharmony_ci * Changelog:
1162306a36Sopenharmony_ci * Jun 28, 2006 Li Yang <LeoLi@freescale.com>
1262306a36Sopenharmony_ci * - Rearrange code and style fixes
1362306a36Sopenharmony_ci */
1462306a36Sopenharmony_ci#ifndef __UCC_GETH_H__
1562306a36Sopenharmony_ci#define __UCC_GETH_H__
1662306a36Sopenharmony_ci
1762306a36Sopenharmony_ci#include <linux/kernel.h>
1862306a36Sopenharmony_ci#include <linux/list.h>
1962306a36Sopenharmony_ci#include <linux/if_ether.h>
2062306a36Sopenharmony_ci
2162306a36Sopenharmony_ci#include <soc/fsl/qe/immap_qe.h>
2262306a36Sopenharmony_ci#include <soc/fsl/qe/qe.h>
2362306a36Sopenharmony_ci
2462306a36Sopenharmony_ci#include <soc/fsl/qe/ucc.h>
2562306a36Sopenharmony_ci#include <soc/fsl/qe/ucc_fast.h>
2662306a36Sopenharmony_ci
2762306a36Sopenharmony_ci#define DRV_DESC "QE UCC Gigabit Ethernet Controller"
2862306a36Sopenharmony_ci#define DRV_NAME "ucc_geth"
2962306a36Sopenharmony_ci
3062306a36Sopenharmony_ci#define NUM_TX_QUEUES                   8
3162306a36Sopenharmony_ci#define NUM_RX_QUEUES                   8
3262306a36Sopenharmony_ci#define NUM_BDS_IN_PREFETCHED_BDS       4
3362306a36Sopenharmony_ci#define TX_IP_OFFSET_ENTRY_MAX          8
3462306a36Sopenharmony_ci#define NUM_OF_PADDRS                   4
3562306a36Sopenharmony_ci#define ENET_INIT_PARAM_MAX_ENTRIES_RX  9
3662306a36Sopenharmony_ci#define ENET_INIT_PARAM_MAX_ENTRIES_TX  8
3762306a36Sopenharmony_ci
3862306a36Sopenharmony_cistruct ucc_geth {
3962306a36Sopenharmony_ci	struct ucc_fast uccf;
4062306a36Sopenharmony_ci	u8 res0[0x100 - sizeof(struct ucc_fast)];
4162306a36Sopenharmony_ci
4262306a36Sopenharmony_ci	u32 maccfg1;		/* mac configuration reg. 1 */
4362306a36Sopenharmony_ci	u32 maccfg2;		/* mac configuration reg. 2 */
4462306a36Sopenharmony_ci	u32 ipgifg;		/* interframe gap reg.  */
4562306a36Sopenharmony_ci	u32 hafdup;		/* half-duplex reg.  */
4662306a36Sopenharmony_ci	u8 res1[0x10];
4762306a36Sopenharmony_ci	u8 miimng[0x18];	/* MII management structure moved to _mii.h */
4862306a36Sopenharmony_ci	u32 ifctl;		/* interface control reg */
4962306a36Sopenharmony_ci	u32 ifstat;		/* interface statux reg */
5062306a36Sopenharmony_ci	u32 macstnaddr1;	/* mac station address part 1 reg */
5162306a36Sopenharmony_ci	u32 macstnaddr2;	/* mac station address part 2 reg */
5262306a36Sopenharmony_ci	u8 res2[0x8];
5362306a36Sopenharmony_ci	u32 uempr;		/* UCC Ethernet Mac parameter reg */
5462306a36Sopenharmony_ci	u32 utbipar;		/* UCC tbi address reg */
5562306a36Sopenharmony_ci	u16 uescr;		/* UCC Ethernet statistics control reg */
5662306a36Sopenharmony_ci	u8 res3[0x180 - 0x15A];
5762306a36Sopenharmony_ci	u32 tx64;		/* Total number of frames (including bad
5862306a36Sopenharmony_ci				   frames) transmitted that were exactly of the
5962306a36Sopenharmony_ci				   minimal length (64 for un tagged, 68 for
6062306a36Sopenharmony_ci				   tagged, or with length exactly equal to the
6162306a36Sopenharmony_ci				   parameter MINLength */
6262306a36Sopenharmony_ci	u32 tx127;		/* Total number of frames (including bad
6362306a36Sopenharmony_ci				   frames) transmitted that were between
6462306a36Sopenharmony_ci				   MINLength (Including FCS length==4) and 127
6562306a36Sopenharmony_ci				   octets */
6662306a36Sopenharmony_ci	u32 tx255;		/* Total number of frames (including bad
6762306a36Sopenharmony_ci				   frames) transmitted that were between 128
6862306a36Sopenharmony_ci				   (Including FCS length==4) and 255 octets */
6962306a36Sopenharmony_ci	u32 rx64;		/* Total number of frames received including
7062306a36Sopenharmony_ci				   bad frames that were exactly of the mninimal
7162306a36Sopenharmony_ci				   length (64 bytes) */
7262306a36Sopenharmony_ci	u32 rx127;		/* Total number of frames (including bad
7362306a36Sopenharmony_ci				   frames) received that were between MINLength
7462306a36Sopenharmony_ci				   (Including FCS length==4) and 127 octets */
7562306a36Sopenharmony_ci	u32 rx255;		/* Total number of frames (including bad
7662306a36Sopenharmony_ci				   frames) received that were between 128
7762306a36Sopenharmony_ci				   (Including FCS length==4) and 255 octets */
7862306a36Sopenharmony_ci	u32 txok;		/* Total number of octets residing in frames
7962306a36Sopenharmony_ci				   that where involved in successful
8062306a36Sopenharmony_ci				   transmission */
8162306a36Sopenharmony_ci	u16 txcf;		/* Total number of PAUSE control frames
8262306a36Sopenharmony_ci				   transmitted by this MAC */
8362306a36Sopenharmony_ci	u8 res4[0x2];
8462306a36Sopenharmony_ci	u32 tmca;		/* Total number of frames that were transmitted
8562306a36Sopenharmony_ci				   successfully with the group address bit set
8662306a36Sopenharmony_ci				   that are not broadcast frames */
8762306a36Sopenharmony_ci	u32 tbca;		/* Total number of frames transmitted
8862306a36Sopenharmony_ci				   successfully that had destination address
8962306a36Sopenharmony_ci				   field equal to the broadcast address */
9062306a36Sopenharmony_ci	u32 rxfok;		/* Total number of frames received OK */
9162306a36Sopenharmony_ci	u32 rxbok;		/* Total number of octets received OK */
9262306a36Sopenharmony_ci	u32 rbyt;		/* Total number of octets received including
9362306a36Sopenharmony_ci				   octets in bad frames. Must be implemented in
9462306a36Sopenharmony_ci				   HW because it includes octets in frames that
9562306a36Sopenharmony_ci				   never even reach the UCC */
9662306a36Sopenharmony_ci	u32 rmca;		/* Total number of frames that were received
9762306a36Sopenharmony_ci				   successfully with the group address bit set
9862306a36Sopenharmony_ci				   that are not broadcast frames */
9962306a36Sopenharmony_ci	u32 rbca;		/* Total number of frames received successfully
10062306a36Sopenharmony_ci				   that had destination address equal to the
10162306a36Sopenharmony_ci				   broadcast address */
10262306a36Sopenharmony_ci	u32 scar;		/* Statistics carry register */
10362306a36Sopenharmony_ci	u32 scam;		/* Statistics caryy mask register */
10462306a36Sopenharmony_ci	u8 res5[0x200 - 0x1c4];
10562306a36Sopenharmony_ci} __packed;
10662306a36Sopenharmony_ci
10762306a36Sopenharmony_ci/* UCC GETH TEMODR Register */
10862306a36Sopenharmony_ci#define TEMODER_TX_RMON_STATISTICS_ENABLE       0x0100	/* enable Tx statistics
10962306a36Sopenharmony_ci							 */
11062306a36Sopenharmony_ci#define TEMODER_SCHEDULER_ENABLE                0x2000	/* enable scheduler */
11162306a36Sopenharmony_ci#define TEMODER_IP_CHECKSUM_GENERATE            0x0400	/* generate IPv4
11262306a36Sopenharmony_ci							   checksums */
11362306a36Sopenharmony_ci#define TEMODER_PERFORMANCE_OPTIMIZATION_MODE1  0x0200	/* enable performance
11462306a36Sopenharmony_ci							   optimization
11562306a36Sopenharmony_ci							   enhancement (mode1) */
11662306a36Sopenharmony_ci#define TEMODER_RMON_STATISTICS                 0x0100	/* enable tx statistics
11762306a36Sopenharmony_ci							 */
11862306a36Sopenharmony_ci#define TEMODER_NUM_OF_QUEUES_SHIFT             (15-15)	/* Number of queues <<
11962306a36Sopenharmony_ci							   shift */
12062306a36Sopenharmony_ci
12162306a36Sopenharmony_ci/* UCC GETH TEMODR Register */
12262306a36Sopenharmony_ci#define REMODER_RX_RMON_STATISTICS_ENABLE       0x00001000	/* enable Rx
12362306a36Sopenharmony_ci								   statistics */
12462306a36Sopenharmony_ci#define REMODER_RX_EXTENDED_FEATURES            0x80000000	/* enable
12562306a36Sopenharmony_ci								   extended
12662306a36Sopenharmony_ci								   features */
12762306a36Sopenharmony_ci#define REMODER_VLAN_OPERATION_TAGGED_SHIFT     (31-9 )	/* vlan operation
12862306a36Sopenharmony_ci							   tagged << shift */
12962306a36Sopenharmony_ci#define REMODER_VLAN_OPERATION_NON_TAGGED_SHIFT (31-10)	/* vlan operation non
13062306a36Sopenharmony_ci							   tagged << shift */
13162306a36Sopenharmony_ci#define REMODER_RX_QOS_MODE_SHIFT               (31-15)	/* rx QoS mode << shift
13262306a36Sopenharmony_ci							 */
13362306a36Sopenharmony_ci#define REMODER_RMON_STATISTICS                 0x00001000	/* enable rx
13462306a36Sopenharmony_ci								   statistics */
13562306a36Sopenharmony_ci#define REMODER_RX_EXTENDED_FILTERING           0x00000800	/* extended
13662306a36Sopenharmony_ci								   filtering
13762306a36Sopenharmony_ci								   vs.
13862306a36Sopenharmony_ci								   mpc82xx-like
13962306a36Sopenharmony_ci								   filtering */
14062306a36Sopenharmony_ci#define REMODER_NUM_OF_QUEUES_SHIFT             (31-23)	/* Number of queues <<
14162306a36Sopenharmony_ci							   shift */
14262306a36Sopenharmony_ci#define REMODER_DYNAMIC_MAX_FRAME_LENGTH        0x00000008	/* enable
14362306a36Sopenharmony_ci								   dynamic max
14462306a36Sopenharmony_ci								   frame length
14562306a36Sopenharmony_ci								 */
14662306a36Sopenharmony_ci#define REMODER_DYNAMIC_MIN_FRAME_LENGTH        0x00000004	/* enable
14762306a36Sopenharmony_ci								   dynamic min
14862306a36Sopenharmony_ci								   frame length
14962306a36Sopenharmony_ci								 */
15062306a36Sopenharmony_ci#define REMODER_IP_CHECKSUM_CHECK               0x00000002	/* check IPv4
15162306a36Sopenharmony_ci								   checksums */
15262306a36Sopenharmony_ci#define REMODER_IP_ADDRESS_ALIGNMENT            0x00000001	/* align ip
15362306a36Sopenharmony_ci								   address to
15462306a36Sopenharmony_ci								   4-byte
15562306a36Sopenharmony_ci								   boundary */
15662306a36Sopenharmony_ci
15762306a36Sopenharmony_ci/* UCC GETH Event Register */
15862306a36Sopenharmony_ci#define UCCE_TXB   (UCC_GETH_UCCE_TXB7 | UCC_GETH_UCCE_TXB6 | \
15962306a36Sopenharmony_ci		    UCC_GETH_UCCE_TXB5 | UCC_GETH_UCCE_TXB4 | \
16062306a36Sopenharmony_ci		    UCC_GETH_UCCE_TXB3 | UCC_GETH_UCCE_TXB2 | \
16162306a36Sopenharmony_ci		    UCC_GETH_UCCE_TXB1 | UCC_GETH_UCCE_TXB0)
16262306a36Sopenharmony_ci
16362306a36Sopenharmony_ci#define UCCE_RXB   (UCC_GETH_UCCE_RXB7 | UCC_GETH_UCCE_RXB6 | \
16462306a36Sopenharmony_ci		    UCC_GETH_UCCE_RXB5 | UCC_GETH_UCCE_RXB4 | \
16562306a36Sopenharmony_ci		    UCC_GETH_UCCE_RXB3 | UCC_GETH_UCCE_RXB2 | \
16662306a36Sopenharmony_ci		    UCC_GETH_UCCE_RXB1 | UCC_GETH_UCCE_RXB0)
16762306a36Sopenharmony_ci
16862306a36Sopenharmony_ci#define UCCE_RXF   (UCC_GETH_UCCE_RXF7 | UCC_GETH_UCCE_RXF6 | \
16962306a36Sopenharmony_ci		    UCC_GETH_UCCE_RXF5 | UCC_GETH_UCCE_RXF4 | \
17062306a36Sopenharmony_ci		    UCC_GETH_UCCE_RXF3 | UCC_GETH_UCCE_RXF2 | \
17162306a36Sopenharmony_ci		    UCC_GETH_UCCE_RXF1 | UCC_GETH_UCCE_RXF0)
17262306a36Sopenharmony_ci
17362306a36Sopenharmony_ci#define UCCE_OTHER (UCC_GETH_UCCE_SCAR | UCC_GETH_UCCE_GRA | \
17462306a36Sopenharmony_ci		    UCC_GETH_UCCE_CBPR | UCC_GETH_UCCE_BSY | \
17562306a36Sopenharmony_ci		    UCC_GETH_UCCE_RXC  | UCC_GETH_UCCE_TXC | UCC_GETH_UCCE_TXE)
17662306a36Sopenharmony_ci
17762306a36Sopenharmony_ci#define UCCE_RX_EVENTS  (UCCE_RXF | UCC_GETH_UCCE_BSY)
17862306a36Sopenharmony_ci#define UCCE_TX_EVENTS	(UCCE_TXB | UCC_GETH_UCCE_TXE)
17962306a36Sopenharmony_ci
18062306a36Sopenharmony_ci/* TBI defines */
18162306a36Sopenharmony_ci#define	ENET_TBI_MII_CR		0x00	/* Control */
18262306a36Sopenharmony_ci#define	ENET_TBI_MII_SR		0x01	/* Status */
18362306a36Sopenharmony_ci#define	ENET_TBI_MII_ANA	0x04	/* AN advertisement */
18462306a36Sopenharmony_ci#define	ENET_TBI_MII_ANLPBPA	0x05	/* AN link partner base page ability */
18562306a36Sopenharmony_ci#define	ENET_TBI_MII_ANEX	0x06	/* AN expansion */
18662306a36Sopenharmony_ci#define	ENET_TBI_MII_ANNPT	0x07	/* AN next page transmit */
18762306a36Sopenharmony_ci#define	ENET_TBI_MII_ANLPANP	0x08	/* AN link partner ability next page */
18862306a36Sopenharmony_ci#define	ENET_TBI_MII_EXST	0x0F	/* Extended status */
18962306a36Sopenharmony_ci#define	ENET_TBI_MII_JD		0x10	/* Jitter diagnostics */
19062306a36Sopenharmony_ci#define	ENET_TBI_MII_TBICON	0x11	/* TBI control */
19162306a36Sopenharmony_ci
19262306a36Sopenharmony_ci/* TBI MDIO register bit fields*/
19362306a36Sopenharmony_ci#define TBISR_LSTATUS          0x0004
19462306a36Sopenharmony_ci#define TBICON_CLK_SELECT       0x0020
19562306a36Sopenharmony_ci#define TBIANA_ASYMMETRIC_PAUSE 0x0100
19662306a36Sopenharmony_ci#define TBIANA_SYMMETRIC_PAUSE  0x0080
19762306a36Sopenharmony_ci#define TBIANA_HALF_DUPLEX      0x0040
19862306a36Sopenharmony_ci#define TBIANA_FULL_DUPLEX      0x0020
19962306a36Sopenharmony_ci#define TBICR_PHY_RESET         0x8000
20062306a36Sopenharmony_ci#define TBICR_ANEG_ENABLE       0x1000
20162306a36Sopenharmony_ci#define TBICR_RESTART_ANEG      0x0200
20262306a36Sopenharmony_ci#define TBICR_FULL_DUPLEX       0x0100
20362306a36Sopenharmony_ci#define TBICR_SPEED1_SET        0x0040
20462306a36Sopenharmony_ci
20562306a36Sopenharmony_ci#define TBIANA_SETTINGS ( \
20662306a36Sopenharmony_ci		TBIANA_ASYMMETRIC_PAUSE \
20762306a36Sopenharmony_ci		| TBIANA_SYMMETRIC_PAUSE \
20862306a36Sopenharmony_ci		| TBIANA_FULL_DUPLEX \
20962306a36Sopenharmony_ci		)
21062306a36Sopenharmony_ci#define TBICR_SETTINGS ( \
21162306a36Sopenharmony_ci		TBICR_PHY_RESET \
21262306a36Sopenharmony_ci		| TBICR_ANEG_ENABLE \
21362306a36Sopenharmony_ci		| TBICR_FULL_DUPLEX \
21462306a36Sopenharmony_ci		| TBICR_SPEED1_SET \
21562306a36Sopenharmony_ci		)
21662306a36Sopenharmony_ci
21762306a36Sopenharmony_ci/* UCC GETH MACCFG1 (MAC Configuration 1 Register) */
21862306a36Sopenharmony_ci#define MACCFG1_FLOW_RX                         0x00000020	/* Flow Control
21962306a36Sopenharmony_ci								   Rx */
22062306a36Sopenharmony_ci#define MACCFG1_FLOW_TX                         0x00000010	/* Flow Control
22162306a36Sopenharmony_ci								   Tx */
22262306a36Sopenharmony_ci#define MACCFG1_ENABLE_SYNCHED_RX               0x00000008	/* Rx Enable
22362306a36Sopenharmony_ci								   synchronized
22462306a36Sopenharmony_ci								   to Rx stream
22562306a36Sopenharmony_ci								 */
22662306a36Sopenharmony_ci#define MACCFG1_ENABLE_RX                       0x00000004	/* Enable Rx */
22762306a36Sopenharmony_ci#define MACCFG1_ENABLE_SYNCHED_TX               0x00000002	/* Tx Enable
22862306a36Sopenharmony_ci								   synchronized
22962306a36Sopenharmony_ci								   to Tx stream
23062306a36Sopenharmony_ci								 */
23162306a36Sopenharmony_ci#define MACCFG1_ENABLE_TX                       0x00000001	/* Enable Tx */
23262306a36Sopenharmony_ci
23362306a36Sopenharmony_ci/* UCC GETH MACCFG2 (MAC Configuration 2 Register) */
23462306a36Sopenharmony_ci#define MACCFG2_PREL_SHIFT                      (31 - 19)	/* Preamble
23562306a36Sopenharmony_ci								   Length <<
23662306a36Sopenharmony_ci								   shift */
23762306a36Sopenharmony_ci#define MACCFG2_PREL_MASK                       0x0000f000	/* Preamble
23862306a36Sopenharmony_ci								   Length mask */
23962306a36Sopenharmony_ci#define MACCFG2_SRP                             0x00000080	/* Soft Receive
24062306a36Sopenharmony_ci								   Preamble */
24162306a36Sopenharmony_ci#define MACCFG2_STP                             0x00000040	/* Soft
24262306a36Sopenharmony_ci								   Transmit
24362306a36Sopenharmony_ci								   Preamble */
24462306a36Sopenharmony_ci#define MACCFG2_RESERVED_1                      0x00000020	/* Reserved -
24562306a36Sopenharmony_ci								   must be set
24662306a36Sopenharmony_ci								   to 1 */
24762306a36Sopenharmony_ci#define MACCFG2_LC                              0x00000010	/* Length Check
24862306a36Sopenharmony_ci								 */
24962306a36Sopenharmony_ci#define MACCFG2_MPE                             0x00000008	/* Magic packet
25062306a36Sopenharmony_ci								   detect */
25162306a36Sopenharmony_ci#define MACCFG2_FDX                             0x00000001	/* Full Duplex */
25262306a36Sopenharmony_ci#define MACCFG2_FDX_MASK                        0x00000001	/* Full Duplex
25362306a36Sopenharmony_ci								   mask */
25462306a36Sopenharmony_ci#define MACCFG2_PAD_CRC                         0x00000004
25562306a36Sopenharmony_ci#define MACCFG2_CRC_EN                          0x00000002
25662306a36Sopenharmony_ci#define MACCFG2_PAD_AND_CRC_MODE_NONE           0x00000000	/* Neither
25762306a36Sopenharmony_ci								   Padding
25862306a36Sopenharmony_ci								   short frames
25962306a36Sopenharmony_ci								   nor CRC */
26062306a36Sopenharmony_ci#define MACCFG2_PAD_AND_CRC_MODE_CRC_ONLY       0x00000002	/* Append CRC
26162306a36Sopenharmony_ci								   only */
26262306a36Sopenharmony_ci#define MACCFG2_PAD_AND_CRC_MODE_PAD_AND_CRC    0x00000004
26362306a36Sopenharmony_ci#define MACCFG2_INTERFACE_MODE_NIBBLE           0x00000100	/* nibble mode
26462306a36Sopenharmony_ci								   (MII/RMII/RGMII
26562306a36Sopenharmony_ci								   10/100bps) */
26662306a36Sopenharmony_ci#define MACCFG2_INTERFACE_MODE_BYTE             0x00000200	/* byte mode
26762306a36Sopenharmony_ci								   (GMII/TBI/RTB/RGMII
26862306a36Sopenharmony_ci								   1000bps ) */
26962306a36Sopenharmony_ci#define MACCFG2_INTERFACE_MODE_MASK             0x00000300	/* mask
27062306a36Sopenharmony_ci								   covering all
27162306a36Sopenharmony_ci								   relevant
27262306a36Sopenharmony_ci								   bits */
27362306a36Sopenharmony_ci
27462306a36Sopenharmony_ci/* UCC GETH IPGIFG (Inter-frame Gap / Inter-Frame Gap Register) */
27562306a36Sopenharmony_ci#define IPGIFG_NON_BACK_TO_BACK_IFG_PART1_SHIFT (31 -  7)	/* Non
27662306a36Sopenharmony_ci								   back-to-back
27762306a36Sopenharmony_ci								   inter frame
27862306a36Sopenharmony_ci								   gap part 1.
27962306a36Sopenharmony_ci								   << shift */
28062306a36Sopenharmony_ci#define IPGIFG_NON_BACK_TO_BACK_IFG_PART2_SHIFT (31 - 15)	/* Non
28162306a36Sopenharmony_ci								   back-to-back
28262306a36Sopenharmony_ci								   inter frame
28362306a36Sopenharmony_ci								   gap part 2.
28462306a36Sopenharmony_ci								   << shift */
28562306a36Sopenharmony_ci#define IPGIFG_MINIMUM_IFG_ENFORCEMENT_SHIFT    (31 - 23)	/* Mimimum IFG
28662306a36Sopenharmony_ci								   Enforcement
28762306a36Sopenharmony_ci								   << shift */
28862306a36Sopenharmony_ci#define IPGIFG_BACK_TO_BACK_IFG_SHIFT           (31 - 31)	/* back-to-back
28962306a36Sopenharmony_ci								   inter frame
29062306a36Sopenharmony_ci								   gap << shift
29162306a36Sopenharmony_ci								 */
29262306a36Sopenharmony_ci#define IPGIFG_NON_BACK_TO_BACK_IFG_PART1_MAX   127	/* Non back-to-back
29362306a36Sopenharmony_ci							   inter frame gap part
29462306a36Sopenharmony_ci							   1. max val */
29562306a36Sopenharmony_ci#define IPGIFG_NON_BACK_TO_BACK_IFG_PART2_MAX   127	/* Non back-to-back
29662306a36Sopenharmony_ci							   inter frame gap part
29762306a36Sopenharmony_ci							   2. max val */
29862306a36Sopenharmony_ci#define IPGIFG_MINIMUM_IFG_ENFORCEMENT_MAX      255	/* Mimimum IFG
29962306a36Sopenharmony_ci							   Enforcement max val */
30062306a36Sopenharmony_ci#define IPGIFG_BACK_TO_BACK_IFG_MAX             127	/* back-to-back inter
30162306a36Sopenharmony_ci							   frame gap max val */
30262306a36Sopenharmony_ci#define IPGIFG_NBTB_CS_IPG_MASK                 0x7F000000
30362306a36Sopenharmony_ci#define IPGIFG_NBTB_IPG_MASK                    0x007F0000
30462306a36Sopenharmony_ci#define IPGIFG_MIN_IFG_MASK                     0x0000FF00
30562306a36Sopenharmony_ci#define IPGIFG_BTB_IPG_MASK                     0x0000007F
30662306a36Sopenharmony_ci
30762306a36Sopenharmony_ci/* UCC GETH HAFDUP (Half Duplex Register) */
30862306a36Sopenharmony_ci#define HALFDUP_ALT_BEB_TRUNCATION_SHIFT        (31 - 11)	/* Alternate
30962306a36Sopenharmony_ci								   Binary
31062306a36Sopenharmony_ci								   Exponential
31162306a36Sopenharmony_ci								   Backoff
31262306a36Sopenharmony_ci								   Truncation
31362306a36Sopenharmony_ci								   << shift */
31462306a36Sopenharmony_ci#define HALFDUP_ALT_BEB_TRUNCATION_MAX          0xf	/* Alternate Binary
31562306a36Sopenharmony_ci							   Exponential Backoff
31662306a36Sopenharmony_ci							   Truncation max val */
31762306a36Sopenharmony_ci#define HALFDUP_ALT_BEB                         0x00080000	/* Alternate
31862306a36Sopenharmony_ci								   Binary
31962306a36Sopenharmony_ci								   Exponential
32062306a36Sopenharmony_ci								   Backoff */
32162306a36Sopenharmony_ci#define HALFDUP_BACK_PRESSURE_NO_BACKOFF        0x00040000	/* Back
32262306a36Sopenharmony_ci								   pressure no
32362306a36Sopenharmony_ci								   backoff */
32462306a36Sopenharmony_ci#define HALFDUP_NO_BACKOFF                      0x00020000	/* No Backoff */
32562306a36Sopenharmony_ci#define HALFDUP_EXCESSIVE_DEFER                 0x00010000	/* Excessive
32662306a36Sopenharmony_ci								   Defer */
32762306a36Sopenharmony_ci#define HALFDUP_MAX_RETRANSMISSION_SHIFT        (31 - 19)	/* Maximum
32862306a36Sopenharmony_ci								   Retransmission
32962306a36Sopenharmony_ci								   << shift */
33062306a36Sopenharmony_ci#define HALFDUP_MAX_RETRANSMISSION_MAX          0xf	/* Maximum
33162306a36Sopenharmony_ci							   Retransmission max
33262306a36Sopenharmony_ci							   val */
33362306a36Sopenharmony_ci#define HALFDUP_COLLISION_WINDOW_SHIFT          (31 - 31)	/* Collision
33462306a36Sopenharmony_ci								   Window <<
33562306a36Sopenharmony_ci								   shift */
33662306a36Sopenharmony_ci#define HALFDUP_COLLISION_WINDOW_MAX            0x3f	/* Collision Window max
33762306a36Sopenharmony_ci							   val */
33862306a36Sopenharmony_ci#define HALFDUP_ALT_BEB_TR_MASK                 0x00F00000
33962306a36Sopenharmony_ci#define HALFDUP_RETRANS_MASK                    0x0000F000
34062306a36Sopenharmony_ci#define HALFDUP_COL_WINDOW_MASK                 0x0000003F
34162306a36Sopenharmony_ci
34262306a36Sopenharmony_ci/* UCC GETH UCCS (Ethernet Status Register) */
34362306a36Sopenharmony_ci#define UCCS_BPR                                0x02	/* Back pressure (in
34462306a36Sopenharmony_ci							   half duplex mode) */
34562306a36Sopenharmony_ci#define UCCS_PAU                                0x02	/* Pause state (in full
34662306a36Sopenharmony_ci							   duplex mode) */
34762306a36Sopenharmony_ci#define UCCS_MPD                                0x01	/* Magic Packet
34862306a36Sopenharmony_ci							   Detected */
34962306a36Sopenharmony_ci
35062306a36Sopenharmony_ci/* UCC GETH IFSTAT (Interface Status Register) */
35162306a36Sopenharmony_ci#define IFSTAT_EXCESS_DEFER                     0x00000200	/* Excessive
35262306a36Sopenharmony_ci								   transmission
35362306a36Sopenharmony_ci								   defer */
35462306a36Sopenharmony_ci
35562306a36Sopenharmony_ci/* UCC GETH MACSTNADDR1 (Station Address Part 1 Register) */
35662306a36Sopenharmony_ci#define MACSTNADDR1_OCTET_6_SHIFT               (31 -  7)	/* Station
35762306a36Sopenharmony_ci								   address 6th
35862306a36Sopenharmony_ci								   octet <<
35962306a36Sopenharmony_ci								   shift */
36062306a36Sopenharmony_ci#define MACSTNADDR1_OCTET_5_SHIFT               (31 - 15)	/* Station
36162306a36Sopenharmony_ci								   address 5th
36262306a36Sopenharmony_ci								   octet <<
36362306a36Sopenharmony_ci								   shift */
36462306a36Sopenharmony_ci#define MACSTNADDR1_OCTET_4_SHIFT               (31 - 23)	/* Station
36562306a36Sopenharmony_ci								   address 4th
36662306a36Sopenharmony_ci								   octet <<
36762306a36Sopenharmony_ci								   shift */
36862306a36Sopenharmony_ci#define MACSTNADDR1_OCTET_3_SHIFT               (31 - 31)	/* Station
36962306a36Sopenharmony_ci								   address 3rd
37062306a36Sopenharmony_ci								   octet <<
37162306a36Sopenharmony_ci								   shift */
37262306a36Sopenharmony_ci
37362306a36Sopenharmony_ci/* UCC GETH MACSTNADDR2 (Station Address Part 2 Register) */
37462306a36Sopenharmony_ci#define MACSTNADDR2_OCTET_2_SHIFT               (31 -  7)	/* Station
37562306a36Sopenharmony_ci								   address 2nd
37662306a36Sopenharmony_ci								   octet <<
37762306a36Sopenharmony_ci								   shift */
37862306a36Sopenharmony_ci#define MACSTNADDR2_OCTET_1_SHIFT               (31 - 15)	/* Station
37962306a36Sopenharmony_ci								   address 1st
38062306a36Sopenharmony_ci								   octet <<
38162306a36Sopenharmony_ci								   shift */
38262306a36Sopenharmony_ci
38362306a36Sopenharmony_ci/* UCC GETH UEMPR (Ethernet Mac Parameter Register) */
38462306a36Sopenharmony_ci#define UEMPR_PAUSE_TIME_VALUE_SHIFT            (31 - 15)	/* Pause time
38562306a36Sopenharmony_ci								   value <<
38662306a36Sopenharmony_ci								   shift */
38762306a36Sopenharmony_ci#define UEMPR_EXTENDED_PAUSE_TIME_VALUE_SHIFT   (31 - 31)	/* Extended
38862306a36Sopenharmony_ci								   pause time
38962306a36Sopenharmony_ci								   value <<
39062306a36Sopenharmony_ci								   shift */
39162306a36Sopenharmony_ci
39262306a36Sopenharmony_ci/* UCC GETH UTBIPAR (Ten Bit Interface Physical Address Register) */
39362306a36Sopenharmony_ci#define UTBIPAR_PHY_ADDRESS_SHIFT               (31 - 31)	/* Phy address
39462306a36Sopenharmony_ci								   << shift */
39562306a36Sopenharmony_ci#define UTBIPAR_PHY_ADDRESS_MASK                0x0000001f	/* Phy address
39662306a36Sopenharmony_ci								   mask */
39762306a36Sopenharmony_ci
39862306a36Sopenharmony_ci/* UCC GETH UESCR (Ethernet Statistics Control Register) */
39962306a36Sopenharmony_ci#define UESCR_AUTOZ                             0x8000	/* Automatically zero
40062306a36Sopenharmony_ci							   addressed
40162306a36Sopenharmony_ci							   statistical counter
40262306a36Sopenharmony_ci							   values */
40362306a36Sopenharmony_ci#define UESCR_CLRCNT                            0x4000	/* Clear all statistics
40462306a36Sopenharmony_ci							   counters */
40562306a36Sopenharmony_ci#define UESCR_MAXCOV_SHIFT                      (15 -  7)	/* Max
40662306a36Sopenharmony_ci								   Coalescing
40762306a36Sopenharmony_ci								   Value <<
40862306a36Sopenharmony_ci								   shift */
40962306a36Sopenharmony_ci#define UESCR_SCOV_SHIFT                        (15 - 15)	/* Status
41062306a36Sopenharmony_ci								   Coalescing
41162306a36Sopenharmony_ci								   Value <<
41262306a36Sopenharmony_ci								   shift */
41362306a36Sopenharmony_ci
41462306a36Sopenharmony_ci/* UCC GETH UDSR (Data Synchronization Register) */
41562306a36Sopenharmony_ci#define UDSR_MAGIC                              0x067E
41662306a36Sopenharmony_ci
41762306a36Sopenharmony_cistruct ucc_geth_thread_data_tx {
41862306a36Sopenharmony_ci	u8 res0[104];
41962306a36Sopenharmony_ci} __packed;
42062306a36Sopenharmony_ci
42162306a36Sopenharmony_cistruct ucc_geth_thread_data_rx {
42262306a36Sopenharmony_ci	u8 res0[40];
42362306a36Sopenharmony_ci} __packed;
42462306a36Sopenharmony_ci
42562306a36Sopenharmony_ci/* Send Queue Queue-Descriptor */
42662306a36Sopenharmony_cistruct ucc_geth_send_queue_qd {
42762306a36Sopenharmony_ci	u32 bd_ring_base;	/* pointer to BD ring base address */
42862306a36Sopenharmony_ci	u8 res0[0x8];
42962306a36Sopenharmony_ci	u32 last_bd_completed_address;/* initialize to last entry in BD ring */
43062306a36Sopenharmony_ci	u8 res1[0x30];
43162306a36Sopenharmony_ci} __packed;
43262306a36Sopenharmony_ci
43362306a36Sopenharmony_cistruct ucc_geth_send_queue_mem_region {
43462306a36Sopenharmony_ci	struct ucc_geth_send_queue_qd sqqd[NUM_TX_QUEUES];
43562306a36Sopenharmony_ci} __packed;
43662306a36Sopenharmony_ci
43762306a36Sopenharmony_cistruct ucc_geth_thread_tx_pram {
43862306a36Sopenharmony_ci	u8 res0[64];
43962306a36Sopenharmony_ci} __packed;
44062306a36Sopenharmony_ci
44162306a36Sopenharmony_cistruct ucc_geth_thread_rx_pram {
44262306a36Sopenharmony_ci	u8 res0[128];
44362306a36Sopenharmony_ci} __packed;
44462306a36Sopenharmony_ci
44562306a36Sopenharmony_ci#define THREAD_RX_PRAM_ADDITIONAL_FOR_EXTENDED_FILTERING        64
44662306a36Sopenharmony_ci#define THREAD_RX_PRAM_ADDITIONAL_FOR_EXTENDED_FILTERING_8      64
44762306a36Sopenharmony_ci#define THREAD_RX_PRAM_ADDITIONAL_FOR_EXTENDED_FILTERING_16     96
44862306a36Sopenharmony_ci
44962306a36Sopenharmony_cistruct ucc_geth_scheduler {
45062306a36Sopenharmony_ci	u16 cpucount0;		/* CPU packet counter */
45162306a36Sopenharmony_ci	u16 cpucount1;		/* CPU packet counter */
45262306a36Sopenharmony_ci	u16 cecount0;		/* QE packet counter */
45362306a36Sopenharmony_ci	u16 cecount1;		/* QE packet counter */
45462306a36Sopenharmony_ci	u16 cpucount2;		/* CPU packet counter */
45562306a36Sopenharmony_ci	u16 cpucount3;		/* CPU packet counter */
45662306a36Sopenharmony_ci	u16 cecount2;		/* QE packet counter */
45762306a36Sopenharmony_ci	u16 cecount3;		/* QE packet counter */
45862306a36Sopenharmony_ci	u16 cpucount4;		/* CPU packet counter */
45962306a36Sopenharmony_ci	u16 cpucount5;		/* CPU packet counter */
46062306a36Sopenharmony_ci	u16 cecount4;		/* QE packet counter */
46162306a36Sopenharmony_ci	u16 cecount5;		/* QE packet counter */
46262306a36Sopenharmony_ci	u16 cpucount6;		/* CPU packet counter */
46362306a36Sopenharmony_ci	u16 cpucount7;		/* CPU packet counter */
46462306a36Sopenharmony_ci	u16 cecount6;		/* QE packet counter */
46562306a36Sopenharmony_ci	u16 cecount7;		/* QE packet counter */
46662306a36Sopenharmony_ci	u32 weightstatus[NUM_TX_QUEUES];	/* accumulated weight factor */
46762306a36Sopenharmony_ci	u32 rtsrshadow;		/* temporary variable handled by QE */
46862306a36Sopenharmony_ci	u32 time;		/* temporary variable handled by QE */
46962306a36Sopenharmony_ci	u32 ttl;		/* temporary variable handled by QE */
47062306a36Sopenharmony_ci	u32 mblinterval;	/* max burst length interval */
47162306a36Sopenharmony_ci	u16 nortsrbytetime;	/* normalized value of byte time in tsr units */
47262306a36Sopenharmony_ci	u8 fracsiz;		/* radix 2 log value of denom. of
47362306a36Sopenharmony_ci				   NorTSRByteTime */
47462306a36Sopenharmony_ci	u8 res0[1];
47562306a36Sopenharmony_ci	u8 strictpriorityq;	/* Strict Priority Mask register */
47662306a36Sopenharmony_ci	u8 txasap;		/* Transmit ASAP register */
47762306a36Sopenharmony_ci	u8 extrabw;		/* Extra BandWidth register */
47862306a36Sopenharmony_ci	u8 oldwfqmask;		/* temporary variable handled by QE */
47962306a36Sopenharmony_ci	u8 weightfactor[NUM_TX_QUEUES];
48062306a36Sopenharmony_ci				      /**< weight factor for queues   */
48162306a36Sopenharmony_ci	u32 minw;		/* temporary variable handled by QE */
48262306a36Sopenharmony_ci	u8 res1[0x70 - 0x64];
48362306a36Sopenharmony_ci} __packed;
48462306a36Sopenharmony_ci
48562306a36Sopenharmony_cistruct ucc_geth_tx_firmware_statistics_pram {
48662306a36Sopenharmony_ci	u32 sicoltx;		/* single collision */
48762306a36Sopenharmony_ci	u32 mulcoltx;		/* multiple collision */
48862306a36Sopenharmony_ci	u32 latecoltxfr;	/* late collision */
48962306a36Sopenharmony_ci	u32 frabortduecol;	/* frames aborted due to transmit collision */
49062306a36Sopenharmony_ci	u32 frlostinmactxer;	/* frames lost due to internal MAC error
49162306a36Sopenharmony_ci				   transmission that are not counted on any
49262306a36Sopenharmony_ci				   other counter */
49362306a36Sopenharmony_ci	u32 carriersenseertx;	/* carrier sense error */
49462306a36Sopenharmony_ci	u32 frtxok;		/* frames transmitted OK */
49562306a36Sopenharmony_ci	u32 txfrexcessivedefer;	/* frames with defferal time greater than
49662306a36Sopenharmony_ci				   specified threshold */
49762306a36Sopenharmony_ci	u32 txpkts256;		/* total packets (including bad) between 256
49862306a36Sopenharmony_ci				   and 511 octets */
49962306a36Sopenharmony_ci	u32 txpkts512;		/* total packets (including bad) between 512
50062306a36Sopenharmony_ci				   and 1023 octets */
50162306a36Sopenharmony_ci	u32 txpkts1024;		/* total packets (including bad) between 1024
50262306a36Sopenharmony_ci				   and 1518 octets */
50362306a36Sopenharmony_ci	u32 txpktsjumbo;	/* total packets (including bad) between 1024
50462306a36Sopenharmony_ci				   and MAXLength octets */
50562306a36Sopenharmony_ci} __packed;
50662306a36Sopenharmony_ci
50762306a36Sopenharmony_cistruct ucc_geth_rx_firmware_statistics_pram {
50862306a36Sopenharmony_ci	u32 frrxfcser;		/* frames with crc error */
50962306a36Sopenharmony_ci	u32 fraligner;		/* frames with alignment error */
51062306a36Sopenharmony_ci	u32 inrangelenrxer;	/* in range length error */
51162306a36Sopenharmony_ci	u32 outrangelenrxer;	/* out of range length error */
51262306a36Sopenharmony_ci	u32 frtoolong;		/* frame too long */
51362306a36Sopenharmony_ci	u32 runt;		/* runt */
51462306a36Sopenharmony_ci	u32 verylongevent;	/* very long event */
51562306a36Sopenharmony_ci	u32 symbolerror;	/* symbol error */
51662306a36Sopenharmony_ci	u32 dropbsy;		/* drop because of BD not ready */
51762306a36Sopenharmony_ci	u8 res0[0x8];
51862306a36Sopenharmony_ci	u32 mismatchdrop;	/* drop because of MAC filtering (e.g. address
51962306a36Sopenharmony_ci				   or type mismatch) */
52062306a36Sopenharmony_ci	u32 underpkts;		/* total frames less than 64 octets */
52162306a36Sopenharmony_ci	u32 pkts256;		/* total frames (including bad) between 256 and
52262306a36Sopenharmony_ci				   511 octets */
52362306a36Sopenharmony_ci	u32 pkts512;		/* total frames (including bad) between 512 and
52462306a36Sopenharmony_ci				   1023 octets */
52562306a36Sopenharmony_ci	u32 pkts1024;		/* total frames (including bad) between 1024
52662306a36Sopenharmony_ci				   and 1518 octets */
52762306a36Sopenharmony_ci	u32 pktsjumbo;		/* total frames (including bad) between 1024
52862306a36Sopenharmony_ci				   and MAXLength octets */
52962306a36Sopenharmony_ci	u32 frlossinmacer;	/* frames lost because of internal MAC error
53062306a36Sopenharmony_ci				   that is not counted in any other counter */
53162306a36Sopenharmony_ci	u32 pausefr;		/* pause frames */
53262306a36Sopenharmony_ci	u8 res1[0x4];
53362306a36Sopenharmony_ci	u32 removevlan;		/* total frames that had their VLAN tag removed
53462306a36Sopenharmony_ci				 */
53562306a36Sopenharmony_ci	u32 replacevlan;	/* total frames that had their VLAN tag
53662306a36Sopenharmony_ci				   replaced */
53762306a36Sopenharmony_ci	u32 insertvlan;		/* total frames that had their VLAN tag
53862306a36Sopenharmony_ci				   inserted */
53962306a36Sopenharmony_ci} __packed;
54062306a36Sopenharmony_ci
54162306a36Sopenharmony_cistruct ucc_geth_rx_interrupt_coalescing_entry {
54262306a36Sopenharmony_ci	u32 interruptcoalescingmaxvalue;	/* interrupt coalescing max
54362306a36Sopenharmony_ci						   value */
54462306a36Sopenharmony_ci	u32 interruptcoalescingcounter;	/* interrupt coalescing counter,
54562306a36Sopenharmony_ci					   initialize to
54662306a36Sopenharmony_ci					   interruptcoalescingmaxvalue */
54762306a36Sopenharmony_ci} __packed;
54862306a36Sopenharmony_ci
54962306a36Sopenharmony_cistruct ucc_geth_rx_interrupt_coalescing_table {
55062306a36Sopenharmony_ci	struct ucc_geth_rx_interrupt_coalescing_entry coalescingentry[NUM_RX_QUEUES];
55162306a36Sopenharmony_ci				       /**< interrupt coalescing entry */
55262306a36Sopenharmony_ci} __packed;
55362306a36Sopenharmony_ci
55462306a36Sopenharmony_cistruct ucc_geth_rx_prefetched_bds {
55562306a36Sopenharmony_ci	struct qe_bd bd[NUM_BDS_IN_PREFETCHED_BDS];	/* prefetched bd */
55662306a36Sopenharmony_ci} __packed;
55762306a36Sopenharmony_ci
55862306a36Sopenharmony_cistruct ucc_geth_rx_bd_queues_entry {
55962306a36Sopenharmony_ci	u32 bdbaseptr;		/* BD base pointer */
56062306a36Sopenharmony_ci	u32 bdptr;		/* BD pointer */
56162306a36Sopenharmony_ci	u32 externalbdbaseptr;	/* external BD base pointer */
56262306a36Sopenharmony_ci	u32 externalbdptr;	/* external BD pointer */
56362306a36Sopenharmony_ci} __packed;
56462306a36Sopenharmony_ci
56562306a36Sopenharmony_cistruct ucc_geth_tx_global_pram {
56662306a36Sopenharmony_ci	u16 temoder;
56762306a36Sopenharmony_ci	u8 res0[0x38 - 0x02];
56862306a36Sopenharmony_ci	u32 sqptr;		/* a base pointer to send queue memory region */
56962306a36Sopenharmony_ci	u32 schedulerbasepointer;	/* a base pointer to scheduler memory
57062306a36Sopenharmony_ci					   region */
57162306a36Sopenharmony_ci	u32 txrmonbaseptr;	/* base pointer to Tx RMON statistics counter */
57262306a36Sopenharmony_ci	u32 tstate;		/* tx internal state. High byte contains
57362306a36Sopenharmony_ci				   function code */
57462306a36Sopenharmony_ci	u8 iphoffset[TX_IP_OFFSET_ENTRY_MAX];
57562306a36Sopenharmony_ci	u32 vtagtable[0x8];	/* 8 4-byte VLAN tags */
57662306a36Sopenharmony_ci	u32 tqptr;		/* a base pointer to the Tx Queues Memory
57762306a36Sopenharmony_ci				   Region */
57862306a36Sopenharmony_ci	u8 res2[0x78 - 0x74];
57962306a36Sopenharmony_ci	u64 snums_en;
58062306a36Sopenharmony_ci	u32 l2l3baseptr;	/* top byte consists of a few other bit fields */
58162306a36Sopenharmony_ci
58262306a36Sopenharmony_ci	u16 mtu[8];
58362306a36Sopenharmony_ci	u8 res3[0xa8 - 0x94];
58462306a36Sopenharmony_ci	u32 wrrtablebase;	/* top byte is reserved */
58562306a36Sopenharmony_ci	u8 res4[0xc0 - 0xac];
58662306a36Sopenharmony_ci} __packed;
58762306a36Sopenharmony_ci
58862306a36Sopenharmony_ci/* structure representing Extended Filtering Global Parameters in PRAM */
58962306a36Sopenharmony_cistruct ucc_geth_exf_global_pram {
59062306a36Sopenharmony_ci	u32 l2pcdptr;		/* individual address filter, high */
59162306a36Sopenharmony_ci	u8 res0[0x10 - 0x04];
59262306a36Sopenharmony_ci} __packed;
59362306a36Sopenharmony_ci
59462306a36Sopenharmony_cistruct ucc_geth_rx_global_pram {
59562306a36Sopenharmony_ci	u32 remoder;		/* ethernet mode reg. */
59662306a36Sopenharmony_ci	u32 rqptr;		/* base pointer to the Rx Queues Memory Region*/
59762306a36Sopenharmony_ci	u32 res0[0x1];
59862306a36Sopenharmony_ci	u8 res1[0x20 - 0xC];
59962306a36Sopenharmony_ci	u16 typeorlen;		/* cutoff point less than which, type/len field
60062306a36Sopenharmony_ci				   is considered length */
60162306a36Sopenharmony_ci	u8 res2[0x1];
60262306a36Sopenharmony_ci	u8 rxgstpack;		/* acknowledgement on GRACEFUL STOP RX command*/
60362306a36Sopenharmony_ci	u32 rxrmonbaseptr;	/* base pointer to Rx RMON statistics counter */
60462306a36Sopenharmony_ci	u8 res3[0x30 - 0x28];
60562306a36Sopenharmony_ci	u32 intcoalescingptr;	/* Interrupt coalescing table pointer */
60662306a36Sopenharmony_ci	u8 res4[0x36 - 0x34];
60762306a36Sopenharmony_ci	u8 rstate;		/* rx internal state. High byte contains
60862306a36Sopenharmony_ci				   function code */
60962306a36Sopenharmony_ci	u8 res5[0x46 - 0x37];
61062306a36Sopenharmony_ci	u16 mrblr;		/* max receive buffer length reg. */
61162306a36Sopenharmony_ci	u32 rbdqptr;		/* base pointer to RxBD parameter table
61262306a36Sopenharmony_ci				   description */
61362306a36Sopenharmony_ci	u16 mflr;		/* max frame length reg. */
61462306a36Sopenharmony_ci	u16 minflr;		/* min frame length reg. */
61562306a36Sopenharmony_ci	u16 maxd1;		/* max dma1 length reg. */
61662306a36Sopenharmony_ci	u16 maxd2;		/* max dma2 length reg. */
61762306a36Sopenharmony_ci	u32 ecamptr;		/* external CAM address */
61862306a36Sopenharmony_ci	u32 l2qt;		/* VLAN priority mapping table. */
61962306a36Sopenharmony_ci	u32 l3qt[0x8];		/* IP priority mapping table. */
62062306a36Sopenharmony_ci	u16 vlantype;		/* vlan type */
62162306a36Sopenharmony_ci	u16 vlantci;		/* default vlan tci */
62262306a36Sopenharmony_ci	u8 addressfiltering[64];	/* address filtering data structure */
62362306a36Sopenharmony_ci	u32 exfGlobalParam;	/* base address for extended filtering global
62462306a36Sopenharmony_ci				   parameters */
62562306a36Sopenharmony_ci	u8 res6[0x100 - 0xC4];	/* Initialize to zero */
62662306a36Sopenharmony_ci} __packed;
62762306a36Sopenharmony_ci
62862306a36Sopenharmony_ci#define GRACEFUL_STOP_ACKNOWLEDGE_RX            0x01
62962306a36Sopenharmony_ci
63062306a36Sopenharmony_ci/* structure representing InitEnet command */
63162306a36Sopenharmony_cistruct ucc_geth_init_pram {
63262306a36Sopenharmony_ci	u8 resinit1;
63362306a36Sopenharmony_ci	u8 resinit2;
63462306a36Sopenharmony_ci	u8 resinit3;
63562306a36Sopenharmony_ci	u8 resinit4;
63662306a36Sopenharmony_ci	u16 resinit5;
63762306a36Sopenharmony_ci	u8 res1[0x1];
63862306a36Sopenharmony_ci	u8 largestexternallookupkeysize;
63962306a36Sopenharmony_ci	u32 rgftgfrxglobal;
64062306a36Sopenharmony_ci	u32 rxthread[ENET_INIT_PARAM_MAX_ENTRIES_RX];	/* rx threads */
64162306a36Sopenharmony_ci	u8 res2[0x38 - 0x30];
64262306a36Sopenharmony_ci	u32 txglobal;		/* tx global */
64362306a36Sopenharmony_ci	u32 txthread[ENET_INIT_PARAM_MAX_ENTRIES_TX];	/* tx threads */
64462306a36Sopenharmony_ci	u8 res3[0x1];
64562306a36Sopenharmony_ci} __packed;
64662306a36Sopenharmony_ci
64762306a36Sopenharmony_ci#define ENET_INIT_PARAM_RGF_SHIFT               (32 - 4)
64862306a36Sopenharmony_ci#define ENET_INIT_PARAM_TGF_SHIFT               (32 - 8)
64962306a36Sopenharmony_ci
65062306a36Sopenharmony_ci#define ENET_INIT_PARAM_RISC_MASK               0x0000003f
65162306a36Sopenharmony_ci#define ENET_INIT_PARAM_PTR_MASK                0x00ffffc0
65262306a36Sopenharmony_ci#define ENET_INIT_PARAM_SNUM_MASK               0xff000000
65362306a36Sopenharmony_ci#define ENET_INIT_PARAM_SNUM_SHIFT              24
65462306a36Sopenharmony_ci
65562306a36Sopenharmony_ci#define ENET_INIT_PARAM_MAGIC_RES_INIT1         0x06
65662306a36Sopenharmony_ci#define ENET_INIT_PARAM_MAGIC_RES_INIT2         0x30
65762306a36Sopenharmony_ci#define ENET_INIT_PARAM_MAGIC_RES_INIT3         0xff
65862306a36Sopenharmony_ci#define ENET_INIT_PARAM_MAGIC_RES_INIT4         0x00
65962306a36Sopenharmony_ci#define ENET_INIT_PARAM_MAGIC_RES_INIT5         0x0400
66062306a36Sopenharmony_ci
66162306a36Sopenharmony_ci/* structure representing 82xx Address Filtering Enet Address in PRAM */
66262306a36Sopenharmony_cistruct ucc_geth_82xx_enet_address {
66362306a36Sopenharmony_ci	u8 res1[0x2];
66462306a36Sopenharmony_ci	u16 h;			/* address (MSB) */
66562306a36Sopenharmony_ci	u16 m;			/* address */
66662306a36Sopenharmony_ci	u16 l;			/* address (LSB) */
66762306a36Sopenharmony_ci} __packed;
66862306a36Sopenharmony_ci
66962306a36Sopenharmony_ci/* structure representing 82xx Address Filtering PRAM */
67062306a36Sopenharmony_cistruct ucc_geth_82xx_address_filtering_pram {
67162306a36Sopenharmony_ci	u32 iaddr_h;		/* individual address filter, high */
67262306a36Sopenharmony_ci	u32 iaddr_l;		/* individual address filter, low */
67362306a36Sopenharmony_ci	u32 gaddr_h;		/* group address filter, high */
67462306a36Sopenharmony_ci	u32 gaddr_l;		/* group address filter, low */
67562306a36Sopenharmony_ci	struct ucc_geth_82xx_enet_address __iomem taddr;
67662306a36Sopenharmony_ci	struct ucc_geth_82xx_enet_address __iomem paddr[NUM_OF_PADDRS];
67762306a36Sopenharmony_ci	u8 res0[0x40 - 0x38];
67862306a36Sopenharmony_ci} __packed;
67962306a36Sopenharmony_ci
68062306a36Sopenharmony_ci/* GETH Tx firmware statistics structure, used when calling
68162306a36Sopenharmony_ci   UCC_GETH_GetStatistics. */
68262306a36Sopenharmony_cistruct ucc_geth_tx_firmware_statistics {
68362306a36Sopenharmony_ci	u32 sicoltx;		/* single collision */
68462306a36Sopenharmony_ci	u32 mulcoltx;		/* multiple collision */
68562306a36Sopenharmony_ci	u32 latecoltxfr;	/* late collision */
68662306a36Sopenharmony_ci	u32 frabortduecol;	/* frames aborted due to transmit collision */
68762306a36Sopenharmony_ci	u32 frlostinmactxer;	/* frames lost due to internal MAC error
68862306a36Sopenharmony_ci				   transmission that are not counted on any
68962306a36Sopenharmony_ci				   other counter */
69062306a36Sopenharmony_ci	u32 carriersenseertx;	/* carrier sense error */
69162306a36Sopenharmony_ci	u32 frtxok;		/* frames transmitted OK */
69262306a36Sopenharmony_ci	u32 txfrexcessivedefer;	/* frames with defferal time greater than
69362306a36Sopenharmony_ci				   specified threshold */
69462306a36Sopenharmony_ci	u32 txpkts256;		/* total packets (including bad) between 256
69562306a36Sopenharmony_ci				   and 511 octets */
69662306a36Sopenharmony_ci	u32 txpkts512;		/* total packets (including bad) between 512
69762306a36Sopenharmony_ci				   and 1023 octets */
69862306a36Sopenharmony_ci	u32 txpkts1024;		/* total packets (including bad) between 1024
69962306a36Sopenharmony_ci				   and 1518 octets */
70062306a36Sopenharmony_ci	u32 txpktsjumbo;	/* total packets (including bad) between 1024
70162306a36Sopenharmony_ci				   and MAXLength octets */
70262306a36Sopenharmony_ci} __packed;
70362306a36Sopenharmony_ci
70462306a36Sopenharmony_ci/* GETH Rx firmware statistics structure, used when calling
70562306a36Sopenharmony_ci   UCC_GETH_GetStatistics. */
70662306a36Sopenharmony_cistruct ucc_geth_rx_firmware_statistics {
70762306a36Sopenharmony_ci	u32 frrxfcser;		/* frames with crc error */
70862306a36Sopenharmony_ci	u32 fraligner;		/* frames with alignment error */
70962306a36Sopenharmony_ci	u32 inrangelenrxer;	/* in range length error */
71062306a36Sopenharmony_ci	u32 outrangelenrxer;	/* out of range length error */
71162306a36Sopenharmony_ci	u32 frtoolong;		/* frame too long */
71262306a36Sopenharmony_ci	u32 runt;		/* runt */
71362306a36Sopenharmony_ci	u32 verylongevent;	/* very long event */
71462306a36Sopenharmony_ci	u32 symbolerror;	/* symbol error */
71562306a36Sopenharmony_ci	u32 dropbsy;		/* drop because of BD not ready */
71662306a36Sopenharmony_ci	u8 res0[0x8];
71762306a36Sopenharmony_ci	u32 mismatchdrop;	/* drop because of MAC filtering (e.g. address
71862306a36Sopenharmony_ci				   or type mismatch) */
71962306a36Sopenharmony_ci	u32 underpkts;		/* total frames less than 64 octets */
72062306a36Sopenharmony_ci	u32 pkts256;		/* total frames (including bad) between 256 and
72162306a36Sopenharmony_ci				   511 octets */
72262306a36Sopenharmony_ci	u32 pkts512;		/* total frames (including bad) between 512 and
72362306a36Sopenharmony_ci				   1023 octets */
72462306a36Sopenharmony_ci	u32 pkts1024;		/* total frames (including bad) between 1024
72562306a36Sopenharmony_ci				   and 1518 octets */
72662306a36Sopenharmony_ci	u32 pktsjumbo;		/* total frames (including bad) between 1024
72762306a36Sopenharmony_ci				   and MAXLength octets */
72862306a36Sopenharmony_ci	u32 frlossinmacer;	/* frames lost because of internal MAC error
72962306a36Sopenharmony_ci				   that is not counted in any other counter */
73062306a36Sopenharmony_ci	u32 pausefr;		/* pause frames */
73162306a36Sopenharmony_ci	u8 res1[0x4];
73262306a36Sopenharmony_ci	u32 removevlan;		/* total frames that had their VLAN tag removed
73362306a36Sopenharmony_ci				 */
73462306a36Sopenharmony_ci	u32 replacevlan;	/* total frames that had their VLAN tag
73562306a36Sopenharmony_ci				   replaced */
73662306a36Sopenharmony_ci	u32 insertvlan;		/* total frames that had their VLAN tag
73762306a36Sopenharmony_ci				   inserted */
73862306a36Sopenharmony_ci} __packed;
73962306a36Sopenharmony_ci
74062306a36Sopenharmony_ci/* GETH hardware statistics structure, used when calling
74162306a36Sopenharmony_ci   UCC_GETH_GetStatistics. */
74262306a36Sopenharmony_cistruct ucc_geth_hardware_statistics {
74362306a36Sopenharmony_ci	u32 tx64;		/* Total number of frames (including bad
74462306a36Sopenharmony_ci				   frames) transmitted that were exactly of the
74562306a36Sopenharmony_ci				   minimal length (64 for un tagged, 68 for
74662306a36Sopenharmony_ci				   tagged, or with length exactly equal to the
74762306a36Sopenharmony_ci				   parameter MINLength */
74862306a36Sopenharmony_ci	u32 tx127;		/* Total number of frames (including bad
74962306a36Sopenharmony_ci				   frames) transmitted that were between
75062306a36Sopenharmony_ci				   MINLength (Including FCS length==4) and 127
75162306a36Sopenharmony_ci				   octets */
75262306a36Sopenharmony_ci	u32 tx255;		/* Total number of frames (including bad
75362306a36Sopenharmony_ci				   frames) transmitted that were between 128
75462306a36Sopenharmony_ci				   (Including FCS length==4) and 255 octets */
75562306a36Sopenharmony_ci	u32 rx64;		/* Total number of frames received including
75662306a36Sopenharmony_ci				   bad frames that were exactly of the mninimal
75762306a36Sopenharmony_ci				   length (64 bytes) */
75862306a36Sopenharmony_ci	u32 rx127;		/* Total number of frames (including bad
75962306a36Sopenharmony_ci				   frames) received that were between MINLength
76062306a36Sopenharmony_ci				   (Including FCS length==4) and 127 octets */
76162306a36Sopenharmony_ci	u32 rx255;		/* Total number of frames (including bad
76262306a36Sopenharmony_ci				   frames) received that were between 128
76362306a36Sopenharmony_ci				   (Including FCS length==4) and 255 octets */
76462306a36Sopenharmony_ci	u32 txok;		/* Total number of octets residing in frames
76562306a36Sopenharmony_ci				   that where involved in successful
76662306a36Sopenharmony_ci				   transmission */
76762306a36Sopenharmony_ci	u16 txcf;		/* Total number of PAUSE control frames
76862306a36Sopenharmony_ci				   transmitted by this MAC */
76962306a36Sopenharmony_ci	u32 tmca;		/* Total number of frames that were transmitted
77062306a36Sopenharmony_ci				   successfully with the group address bit set
77162306a36Sopenharmony_ci				   that are not broadcast frames */
77262306a36Sopenharmony_ci	u32 tbca;		/* Total number of frames transmitted
77362306a36Sopenharmony_ci				   successfully that had destination address
77462306a36Sopenharmony_ci				   field equal to the broadcast address */
77562306a36Sopenharmony_ci	u32 rxfok;		/* Total number of frames received OK */
77662306a36Sopenharmony_ci	u32 rxbok;		/* Total number of octets received OK */
77762306a36Sopenharmony_ci	u32 rbyt;		/* Total number of octets received including
77862306a36Sopenharmony_ci				   octets in bad frames. Must be implemented in
77962306a36Sopenharmony_ci				   HW because it includes octets in frames that
78062306a36Sopenharmony_ci				   never even reach the UCC */
78162306a36Sopenharmony_ci	u32 rmca;		/* Total number of frames that were received
78262306a36Sopenharmony_ci				   successfully with the group address bit set
78362306a36Sopenharmony_ci				   that are not broadcast frames */
78462306a36Sopenharmony_ci	u32 rbca;		/* Total number of frames received successfully
78562306a36Sopenharmony_ci				   that had destination address equal to the
78662306a36Sopenharmony_ci				   broadcast address */
78762306a36Sopenharmony_ci} __packed;
78862306a36Sopenharmony_ci
78962306a36Sopenharmony_ci/* UCC GETH Tx errors returned via TxConf callback */
79062306a36Sopenharmony_ci#define TX_ERRORS_DEF      0x0200
79162306a36Sopenharmony_ci#define TX_ERRORS_EXDEF    0x0100
79262306a36Sopenharmony_ci#define TX_ERRORS_LC       0x0080
79362306a36Sopenharmony_ci#define TX_ERRORS_RL       0x0040
79462306a36Sopenharmony_ci#define TX_ERRORS_RC_MASK  0x003C
79562306a36Sopenharmony_ci#define TX_ERRORS_RC_SHIFT 2
79662306a36Sopenharmony_ci#define TX_ERRORS_UN       0x0002
79762306a36Sopenharmony_ci#define TX_ERRORS_CSL      0x0001
79862306a36Sopenharmony_ci
79962306a36Sopenharmony_ci/* UCC GETH Rx errors returned via RxStore callback */
80062306a36Sopenharmony_ci#define RX_ERRORS_CMR      0x0200
80162306a36Sopenharmony_ci#define RX_ERRORS_M        0x0100
80262306a36Sopenharmony_ci#define RX_ERRORS_BC       0x0080
80362306a36Sopenharmony_ci#define RX_ERRORS_MC       0x0040
80462306a36Sopenharmony_ci
80562306a36Sopenharmony_ci/* Transmit BD. These are in addition to values defined in uccf. */
80662306a36Sopenharmony_ci#define T_VID      0x003c0000	/* insert VLAN id index mask. */
80762306a36Sopenharmony_ci#define T_DEF      (((u32) TX_ERRORS_DEF     ) << 16)
80862306a36Sopenharmony_ci#define T_EXDEF    (((u32) TX_ERRORS_EXDEF   ) << 16)
80962306a36Sopenharmony_ci#define T_LC       (((u32) TX_ERRORS_LC      ) << 16)
81062306a36Sopenharmony_ci#define T_RL       (((u32) TX_ERRORS_RL      ) << 16)
81162306a36Sopenharmony_ci#define T_RC_MASK  (((u32) TX_ERRORS_RC_MASK ) << 16)
81262306a36Sopenharmony_ci#define T_UN       (((u32) TX_ERRORS_UN      ) << 16)
81362306a36Sopenharmony_ci#define T_CSL      (((u32) TX_ERRORS_CSL     ) << 16)
81462306a36Sopenharmony_ci#define T_ERRORS_REPORT  (T_DEF | T_EXDEF | T_LC | T_RL | T_RC_MASK \
81562306a36Sopenharmony_ci		| T_UN | T_CSL)	/* transmit errors to report */
81662306a36Sopenharmony_ci
81762306a36Sopenharmony_ci/* Receive BD. These are in addition to values defined in uccf. */
81862306a36Sopenharmony_ci#define R_LG    0x00200000	/* Frame length violation.  */
81962306a36Sopenharmony_ci#define R_NO    0x00100000	/* Non-octet aligned frame.  */
82062306a36Sopenharmony_ci#define R_SH    0x00080000	/* Short frame.  */
82162306a36Sopenharmony_ci#define R_CR    0x00040000	/* CRC error.  */
82262306a36Sopenharmony_ci#define R_OV    0x00020000	/* Overrun.  */
82362306a36Sopenharmony_ci#define R_IPCH  0x00010000	/* IP checksum check failed. */
82462306a36Sopenharmony_ci#define R_CMR   (((u32) RX_ERRORS_CMR  ) << 16)
82562306a36Sopenharmony_ci#define R_M     (((u32) RX_ERRORS_M    ) << 16)
82662306a36Sopenharmony_ci#define R_BC    (((u32) RX_ERRORS_BC   ) << 16)
82762306a36Sopenharmony_ci#define R_MC    (((u32) RX_ERRORS_MC   ) << 16)
82862306a36Sopenharmony_ci#define R_ERRORS_REPORT (R_CMR | R_M | R_BC | R_MC)	/* receive errors to
82962306a36Sopenharmony_ci							   report */
83062306a36Sopenharmony_ci#define R_ERRORS_FATAL  (R_LG  | R_NO | R_SH | R_CR | \
83162306a36Sopenharmony_ci		R_OV | R_IPCH)	/* receive errors to discard */
83262306a36Sopenharmony_ci
83362306a36Sopenharmony_ci/* Alignments */
83462306a36Sopenharmony_ci#define UCC_GETH_RX_GLOBAL_PRAM_ALIGNMENT	256
83562306a36Sopenharmony_ci#define UCC_GETH_TX_GLOBAL_PRAM_ALIGNMENT       128
83662306a36Sopenharmony_ci#define UCC_GETH_THREAD_RX_PRAM_ALIGNMENT       128
83762306a36Sopenharmony_ci#define UCC_GETH_THREAD_TX_PRAM_ALIGNMENT       64
83862306a36Sopenharmony_ci#define UCC_GETH_THREAD_DATA_ALIGNMENT          256	/* spec gives values
83962306a36Sopenharmony_ci							   based on num of
84062306a36Sopenharmony_ci							   threads, but always
84162306a36Sopenharmony_ci							   using the maximum is
84262306a36Sopenharmony_ci							   easier */
84362306a36Sopenharmony_ci#define UCC_GETH_SEND_QUEUE_QUEUE_DESCRIPTOR_ALIGNMENT	32
84462306a36Sopenharmony_ci#define UCC_GETH_SCHEDULER_ALIGNMENT		8	/* This is a guess */
84562306a36Sopenharmony_ci#define UCC_GETH_TX_STATISTICS_ALIGNMENT	4	/* This is a guess */
84662306a36Sopenharmony_ci#define UCC_GETH_RX_STATISTICS_ALIGNMENT	4	/* This is a guess */
84762306a36Sopenharmony_ci#define UCC_GETH_RX_INTERRUPT_COALESCING_ALIGNMENT	64
84862306a36Sopenharmony_ci#define UCC_GETH_RX_BD_QUEUES_ALIGNMENT		8	/* This is a guess */
84962306a36Sopenharmony_ci#define UCC_GETH_RX_PREFETCHED_BDS_ALIGNMENT	128	/* This is a guess */
85062306a36Sopenharmony_ci#define UCC_GETH_RX_EXTENDED_FILTERING_GLOBAL_PARAMETERS_ALIGNMENT 8	/* This
85162306a36Sopenharmony_ci									   is a
85262306a36Sopenharmony_ci									   guess
85362306a36Sopenharmony_ci									 */
85462306a36Sopenharmony_ci#define UCC_GETH_RX_BD_RING_ALIGNMENT		32
85562306a36Sopenharmony_ci#define UCC_GETH_TX_BD_RING_ALIGNMENT		32
85662306a36Sopenharmony_ci#define UCC_GETH_MRBLR_ALIGNMENT		128
85762306a36Sopenharmony_ci#define UCC_GETH_RX_BD_RING_SIZE_ALIGNMENT	4
85862306a36Sopenharmony_ci#define UCC_GETH_TX_BD_RING_SIZE_MEMORY_ALIGNMENT	32
85962306a36Sopenharmony_ci#define UCC_GETH_RX_DATA_BUF_ALIGNMENT		64
86062306a36Sopenharmony_ci
86162306a36Sopenharmony_ci#define UCC_GETH_TAD_EF                         0x80
86262306a36Sopenharmony_ci#define UCC_GETH_TAD_V                          0x40
86362306a36Sopenharmony_ci#define UCC_GETH_TAD_REJ                        0x20
86462306a36Sopenharmony_ci#define UCC_GETH_TAD_VTAG_OP_RIGHT_SHIFT        2
86562306a36Sopenharmony_ci#define UCC_GETH_TAD_VTAG_OP_SHIFT              6
86662306a36Sopenharmony_ci#define UCC_GETH_TAD_V_NON_VTAG_OP              0x20
86762306a36Sopenharmony_ci#define UCC_GETH_TAD_RQOS_SHIFT                 0
86862306a36Sopenharmony_ci#define UCC_GETH_TAD_V_PRIORITY_SHIFT           5
86962306a36Sopenharmony_ci#define UCC_GETH_TAD_CFI                        0x10
87062306a36Sopenharmony_ci
87162306a36Sopenharmony_ci#define UCC_GETH_VLAN_PRIORITY_MAX              8
87262306a36Sopenharmony_ci#define UCC_GETH_IP_PRIORITY_MAX                64
87362306a36Sopenharmony_ci#define UCC_GETH_TX_VTAG_TABLE_ENTRY_MAX        8
87462306a36Sopenharmony_ci#define UCC_GETH_RX_BD_RING_SIZE_MIN            8
87562306a36Sopenharmony_ci#define UCC_GETH_TX_BD_RING_SIZE_MIN            2
87662306a36Sopenharmony_ci#define UCC_GETH_BD_RING_SIZE_MAX		0xffff
87762306a36Sopenharmony_ci
87862306a36Sopenharmony_ci#define UCC_GETH_SIZE_OF_BD                     QE_SIZEOF_BD
87962306a36Sopenharmony_ci
88062306a36Sopenharmony_ci/* Driver definitions */
88162306a36Sopenharmony_ci#define TX_BD_RING_LEN                          0x10
88262306a36Sopenharmony_ci#define RX_BD_RING_LEN                          0x20
88362306a36Sopenharmony_ci
88462306a36Sopenharmony_ci#define TX_RING_MOD_MASK(size)                  (size-1)
88562306a36Sopenharmony_ci#define RX_RING_MOD_MASK(size)                  (size-1)
88662306a36Sopenharmony_ci
88762306a36Sopenharmony_ci#define ENET_GROUP_ADDR                         0x01	/* Group address mask
88862306a36Sopenharmony_ci							   for ethernet
88962306a36Sopenharmony_ci							   addresses */
89062306a36Sopenharmony_ci
89162306a36Sopenharmony_ci#define TX_TIMEOUT                              (1*HZ)
89262306a36Sopenharmony_ci#define PHY_INIT_TIMEOUT                        100000
89362306a36Sopenharmony_ci#define PHY_CHANGE_TIME                         2
89462306a36Sopenharmony_ci
89562306a36Sopenharmony_ci/* Fast Ethernet (10/100 Mbps) */
89662306a36Sopenharmony_ci#define UCC_GETH_URFS_INIT                      512	/* Rx virtual FIFO size
89762306a36Sopenharmony_ci							 */
89862306a36Sopenharmony_ci#define UCC_GETH_URFET_INIT                     256	/* 1/2 urfs */
89962306a36Sopenharmony_ci#define UCC_GETH_URFSET_INIT                    384	/* 3/4 urfs */
90062306a36Sopenharmony_ci#define UCC_GETH_UTFS_INIT                      512	/* Tx virtual FIFO size
90162306a36Sopenharmony_ci							 */
90262306a36Sopenharmony_ci#define UCC_GETH_UTFET_INIT                     256	/* 1/2 utfs */
90362306a36Sopenharmony_ci#define UCC_GETH_UTFTT_INIT                     256	/* 1/2 utfs
90462306a36Sopenharmony_ci							   due to errata */
90562306a36Sopenharmony_ci/* Gigabit Ethernet (1000 Mbps) */
90662306a36Sopenharmony_ci#define UCC_GETH_URFS_GIGA_INIT                 4096/*2048*/	/* Rx virtual
90762306a36Sopenharmony_ci								   FIFO size */
90862306a36Sopenharmony_ci#define UCC_GETH_URFET_GIGA_INIT                2048/*1024*/	/* 1/2 urfs */
90962306a36Sopenharmony_ci#define UCC_GETH_URFSET_GIGA_INIT               3072/*1536*/	/* 3/4 urfs */
91062306a36Sopenharmony_ci#define UCC_GETH_UTFS_GIGA_INIT                 4096/*2048*/	/* Tx virtual
91162306a36Sopenharmony_ci								   FIFO size */
91262306a36Sopenharmony_ci#define UCC_GETH_UTFET_GIGA_INIT                2048/*1024*/	/* 1/2 utfs */
91362306a36Sopenharmony_ci#define UCC_GETH_UTFTT_GIGA_INIT                4096/*0x40*/	/* Tx virtual
91462306a36Sopenharmony_ci								   FIFO size */
91562306a36Sopenharmony_ci
91662306a36Sopenharmony_ci#define UCC_GETH_REMODER_INIT                   0	/* bits that must be
91762306a36Sopenharmony_ci							   set */
91862306a36Sopenharmony_ci#define UCC_GETH_TEMODER_INIT                   0xC000	/* bits that must */
91962306a36Sopenharmony_ci
92062306a36Sopenharmony_ci/* Initial value for UPSMR */
92162306a36Sopenharmony_ci#define UCC_GETH_UPSMR_INIT                     UCC_GETH_UPSMR_RES1
92262306a36Sopenharmony_ci
92362306a36Sopenharmony_ci#define UCC_GETH_MACCFG1_INIT                   0
92462306a36Sopenharmony_ci#define UCC_GETH_MACCFG2_INIT                   (MACCFG2_RESERVED_1)
92562306a36Sopenharmony_ci
92662306a36Sopenharmony_ci/* Ethernet Address Type. */
92762306a36Sopenharmony_cienum enet_addr_type {
92862306a36Sopenharmony_ci	ENET_ADDR_TYPE_INDIVIDUAL,
92962306a36Sopenharmony_ci	ENET_ADDR_TYPE_GROUP,
93062306a36Sopenharmony_ci	ENET_ADDR_TYPE_BROADCAST
93162306a36Sopenharmony_ci};
93262306a36Sopenharmony_ci
93362306a36Sopenharmony_ci/* UCC GETH 82xx Ethernet Address Recognition Location */
93462306a36Sopenharmony_cienum ucc_geth_enet_address_recognition_location {
93562306a36Sopenharmony_ci	UCC_GETH_ENET_ADDRESS_RECOGNITION_LOCATION_STATION_ADDRESS,/* station
93662306a36Sopenharmony_ci								      address */
93762306a36Sopenharmony_ci	UCC_GETH_ENET_ADDRESS_RECOGNITION_LOCATION_PADDR_FIRST,	/* additional
93862306a36Sopenharmony_ci								   station
93962306a36Sopenharmony_ci								   address
94062306a36Sopenharmony_ci								   paddr1 */
94162306a36Sopenharmony_ci	UCC_GETH_ENET_ADDRESS_RECOGNITION_LOCATION_PADDR2,	/* additional
94262306a36Sopenharmony_ci								   station
94362306a36Sopenharmony_ci								   address
94462306a36Sopenharmony_ci								   paddr2 */
94562306a36Sopenharmony_ci	UCC_GETH_ENET_ADDRESS_RECOGNITION_LOCATION_PADDR3,	/* additional
94662306a36Sopenharmony_ci								   station
94762306a36Sopenharmony_ci								   address
94862306a36Sopenharmony_ci								   paddr3 */
94962306a36Sopenharmony_ci	UCC_GETH_ENET_ADDRESS_RECOGNITION_LOCATION_PADDR_LAST,	/* additional
95062306a36Sopenharmony_ci								   station
95162306a36Sopenharmony_ci								   address
95262306a36Sopenharmony_ci								   paddr4 */
95362306a36Sopenharmony_ci	UCC_GETH_ENET_ADDRESS_RECOGNITION_LOCATION_GROUP_HASH,	/* group hash */
95462306a36Sopenharmony_ci	UCC_GETH_ENET_ADDRESS_RECOGNITION_LOCATION_INDIVIDUAL_HASH /* individual
95562306a36Sopenharmony_ci								      hash */
95662306a36Sopenharmony_ci};
95762306a36Sopenharmony_ci
95862306a36Sopenharmony_ci/* UCC GETH vlan operation tagged */
95962306a36Sopenharmony_cienum ucc_geth_vlan_operation_tagged {
96062306a36Sopenharmony_ci	UCC_GETH_VLAN_OPERATION_TAGGED_NOP = 0x0,	/* Tagged - nop */
96162306a36Sopenharmony_ci	UCC_GETH_VLAN_OPERATION_TAGGED_REPLACE_VID_PORTION_OF_Q_TAG
96262306a36Sopenharmony_ci		= 0x1,	/* Tagged - replace vid portion of q tag */
96362306a36Sopenharmony_ci	UCC_GETH_VLAN_OPERATION_TAGGED_IF_VID0_REPLACE_VID_WITH_DEFAULT_VALUE
96462306a36Sopenharmony_ci		= 0x2,	/* Tagged - if vid0 replace vid with default value  */
96562306a36Sopenharmony_ci	UCC_GETH_VLAN_OPERATION_TAGGED_EXTRACT_Q_TAG_FROM_FRAME
96662306a36Sopenharmony_ci		= 0x3	/* Tagged - extract q tag from frame */
96762306a36Sopenharmony_ci};
96862306a36Sopenharmony_ci
96962306a36Sopenharmony_ci/* UCC GETH vlan operation non-tagged */
97062306a36Sopenharmony_cienum ucc_geth_vlan_operation_non_tagged {
97162306a36Sopenharmony_ci	UCC_GETH_VLAN_OPERATION_NON_TAGGED_NOP = 0x0,	/* Non tagged - nop */
97262306a36Sopenharmony_ci	UCC_GETH_VLAN_OPERATION_NON_TAGGED_Q_TAG_INSERT = 0x1	/* Non tagged -
97362306a36Sopenharmony_ci								   q tag insert
97462306a36Sopenharmony_ci								 */
97562306a36Sopenharmony_ci};
97662306a36Sopenharmony_ci
97762306a36Sopenharmony_ci/* UCC GETH Rx Quality of Service Mode */
97862306a36Sopenharmony_cienum ucc_geth_qos_mode {
97962306a36Sopenharmony_ci	UCC_GETH_QOS_MODE_DEFAULT = 0x0,	/* default queue */
98062306a36Sopenharmony_ci	UCC_GETH_QOS_MODE_QUEUE_NUM_FROM_L2_CRITERIA = 0x1,	/* queue
98162306a36Sopenharmony_ci								   determined
98262306a36Sopenharmony_ci								   by L2
98362306a36Sopenharmony_ci								   criteria */
98462306a36Sopenharmony_ci	UCC_GETH_QOS_MODE_QUEUE_NUM_FROM_L3_CRITERIA = 0x2	/* queue
98562306a36Sopenharmony_ci								   determined
98662306a36Sopenharmony_ci								   by L3
98762306a36Sopenharmony_ci								   criteria */
98862306a36Sopenharmony_ci};
98962306a36Sopenharmony_ci
99062306a36Sopenharmony_ci/* UCC GETH Statistics Gathering Mode - These are bit flags, 'or' them together
99162306a36Sopenharmony_ci   for combined functionality */
99262306a36Sopenharmony_cienum ucc_geth_statistics_gathering_mode {
99362306a36Sopenharmony_ci	UCC_GETH_STATISTICS_GATHERING_MODE_NONE = 0x00000000,	/* No
99462306a36Sopenharmony_ci								   statistics
99562306a36Sopenharmony_ci								   gathering */
99662306a36Sopenharmony_ci	UCC_GETH_STATISTICS_GATHERING_MODE_HARDWARE = 0x00000001,/* Enable
99762306a36Sopenharmony_ci								    hardware
99862306a36Sopenharmony_ci								    statistics
99962306a36Sopenharmony_ci								    gathering
100062306a36Sopenharmony_ci								  */
100162306a36Sopenharmony_ci	UCC_GETH_STATISTICS_GATHERING_MODE_FIRMWARE_TX = 0x00000004,/*Enable
100262306a36Sopenharmony_ci								      firmware
100362306a36Sopenharmony_ci								      tx
100462306a36Sopenharmony_ci								      statistics
100562306a36Sopenharmony_ci								      gathering
100662306a36Sopenharmony_ci								     */
100762306a36Sopenharmony_ci	UCC_GETH_STATISTICS_GATHERING_MODE_FIRMWARE_RX = 0x00000008/* Enable
100862306a36Sopenharmony_ci								      firmware
100962306a36Sopenharmony_ci								      rx
101062306a36Sopenharmony_ci								      statistics
101162306a36Sopenharmony_ci								      gathering
101262306a36Sopenharmony_ci								    */
101362306a36Sopenharmony_ci};
101462306a36Sopenharmony_ci
101562306a36Sopenharmony_ci/* UCC GETH Pad and CRC Mode - Note, Padding without CRC is not possible */
101662306a36Sopenharmony_cienum ucc_geth_maccfg2_pad_and_crc_mode {
101762306a36Sopenharmony_ci	UCC_GETH_PAD_AND_CRC_MODE_NONE
101862306a36Sopenharmony_ci		= MACCFG2_PAD_AND_CRC_MODE_NONE,	/* Neither Padding
101962306a36Sopenharmony_ci							   short frames
102062306a36Sopenharmony_ci							   nor CRC */
102162306a36Sopenharmony_ci	UCC_GETH_PAD_AND_CRC_MODE_CRC_ONLY
102262306a36Sopenharmony_ci		= MACCFG2_PAD_AND_CRC_MODE_CRC_ONLY,	/* Append
102362306a36Sopenharmony_ci							   CRC only */
102462306a36Sopenharmony_ci	UCC_GETH_PAD_AND_CRC_MODE_PAD_AND_CRC =
102562306a36Sopenharmony_ci	    MACCFG2_PAD_AND_CRC_MODE_PAD_AND_CRC
102662306a36Sopenharmony_ci};
102762306a36Sopenharmony_ci
102862306a36Sopenharmony_ci/* UCC GETH upsmr Flow Control Mode */
102962306a36Sopenharmony_cienum ucc_geth_flow_control_mode {
103062306a36Sopenharmony_ci	UPSMR_AUTOMATIC_FLOW_CONTROL_MODE_NONE = 0x00000000,	/* No automatic
103162306a36Sopenharmony_ci								   flow control
103262306a36Sopenharmony_ci								 */
103362306a36Sopenharmony_ci	UPSMR_AUTOMATIC_FLOW_CONTROL_MODE_PAUSE_WHEN_EMERGENCY
103462306a36Sopenharmony_ci		= 0x00004000	/* Send pause frame when RxFIFO reaches its
103562306a36Sopenharmony_ci				   emergency threshold */
103662306a36Sopenharmony_ci};
103762306a36Sopenharmony_ci
103862306a36Sopenharmony_ci/* UCC GETH number of threads */
103962306a36Sopenharmony_cienum ucc_geth_num_of_threads {
104062306a36Sopenharmony_ci	UCC_GETH_NUM_OF_THREADS_1 = 0x1,	/* 1 */
104162306a36Sopenharmony_ci	UCC_GETH_NUM_OF_THREADS_2 = 0x2,	/* 2 */
104262306a36Sopenharmony_ci	UCC_GETH_NUM_OF_THREADS_4 = 0x0,	/* 4 */
104362306a36Sopenharmony_ci	UCC_GETH_NUM_OF_THREADS_6 = 0x3,	/* 6 */
104462306a36Sopenharmony_ci	UCC_GETH_NUM_OF_THREADS_8 = 0x4	/* 8 */
104562306a36Sopenharmony_ci};
104662306a36Sopenharmony_ci
104762306a36Sopenharmony_ci/* UCC GETH number of station addresses */
104862306a36Sopenharmony_cienum ucc_geth_num_of_station_addresses {
104962306a36Sopenharmony_ci	UCC_GETH_NUM_OF_STATION_ADDRESSES_1,	/* 1 */
105062306a36Sopenharmony_ci	UCC_GETH_NUM_OF_STATION_ADDRESSES_5	/* 5 */
105162306a36Sopenharmony_ci};
105262306a36Sopenharmony_ci
105362306a36Sopenharmony_ci/* UCC GETH 82xx Ethernet Address Container */
105462306a36Sopenharmony_cistruct enet_addr_container {
105562306a36Sopenharmony_ci	u8 address[ETH_ALEN];	/* ethernet address */
105662306a36Sopenharmony_ci	enum ucc_geth_enet_address_recognition_location location;	/* location in
105762306a36Sopenharmony_ci								   82xx address
105862306a36Sopenharmony_ci								   recognition
105962306a36Sopenharmony_ci								   hardware */
106062306a36Sopenharmony_ci	struct list_head node;
106162306a36Sopenharmony_ci};
106262306a36Sopenharmony_ci
106362306a36Sopenharmony_ci#define ENET_ADDR_CONT_ENTRY(ptr) list_entry(ptr, struct enet_addr_container, node)
106462306a36Sopenharmony_ci
106562306a36Sopenharmony_ci/* UCC GETH Termination Action Descriptor (TAD) structure. */
106662306a36Sopenharmony_cistruct ucc_geth_tad_params {
106762306a36Sopenharmony_ci	int rx_non_dynamic_extended_features_mode;
106862306a36Sopenharmony_ci	int reject_frame;
106962306a36Sopenharmony_ci	enum ucc_geth_vlan_operation_tagged vtag_op;
107062306a36Sopenharmony_ci	enum ucc_geth_vlan_operation_non_tagged vnontag_op;
107162306a36Sopenharmony_ci	enum ucc_geth_qos_mode rqos;
107262306a36Sopenharmony_ci	u8 vpri;
107362306a36Sopenharmony_ci	u16 vid;
107462306a36Sopenharmony_ci};
107562306a36Sopenharmony_ci
107662306a36Sopenharmony_ci/* GETH protocol initialization structure */
107762306a36Sopenharmony_cistruct ucc_geth_info {
107862306a36Sopenharmony_ci	struct ucc_fast_info uf_info;
107962306a36Sopenharmony_ci	int ipCheckSumCheck;
108062306a36Sopenharmony_ci	int ipCheckSumGenerate;
108162306a36Sopenharmony_ci	int rxExtendedFiltering;
108262306a36Sopenharmony_ci	u32 extendedFilteringChainPointer;
108362306a36Sopenharmony_ci	u16 typeorlen;
108462306a36Sopenharmony_ci	int dynamicMaxFrameLength;
108562306a36Sopenharmony_ci	int dynamicMinFrameLength;
108662306a36Sopenharmony_ci	u8 nonBackToBackIfgPart1;
108762306a36Sopenharmony_ci	u8 nonBackToBackIfgPart2;
108862306a36Sopenharmony_ci	u8 miminumInterFrameGapEnforcement;
108962306a36Sopenharmony_ci	u8 backToBackInterFrameGap;
109062306a36Sopenharmony_ci	int ipAddressAlignment;
109162306a36Sopenharmony_ci	int lengthCheckRx;
109262306a36Sopenharmony_ci	u32 mblinterval;
109362306a36Sopenharmony_ci	u16 nortsrbytetime;
109462306a36Sopenharmony_ci	u8 fracsiz;
109562306a36Sopenharmony_ci	u8 strictpriorityq;
109662306a36Sopenharmony_ci	u8 txasap;
109762306a36Sopenharmony_ci	u8 extrabw;
109862306a36Sopenharmony_ci	int miiPreambleSupress;
109962306a36Sopenharmony_ci	u8 altBebTruncation;
110062306a36Sopenharmony_ci	int altBeb;
110162306a36Sopenharmony_ci	int backPressureNoBackoff;
110262306a36Sopenharmony_ci	int noBackoff;
110362306a36Sopenharmony_ci	int excessDefer;
110462306a36Sopenharmony_ci	u8 maxRetransmission;
110562306a36Sopenharmony_ci	u8 collisionWindow;
110662306a36Sopenharmony_ci	int pro;
110762306a36Sopenharmony_ci	int cap;
110862306a36Sopenharmony_ci	int rsh;
110962306a36Sopenharmony_ci	int rlpb;
111062306a36Sopenharmony_ci	int cam;
111162306a36Sopenharmony_ci	int bro;
111262306a36Sopenharmony_ci	int ecm;
111362306a36Sopenharmony_ci	int receiveFlowControl;
111462306a36Sopenharmony_ci	int transmitFlowControl;
111562306a36Sopenharmony_ci	u8 maxGroupAddrInHash;
111662306a36Sopenharmony_ci	u8 maxIndAddrInHash;
111762306a36Sopenharmony_ci	u8 prel;
111862306a36Sopenharmony_ci	u16 maxFrameLength;
111962306a36Sopenharmony_ci	u16 minFrameLength;
112062306a36Sopenharmony_ci	u16 maxD1Length;
112162306a36Sopenharmony_ci	u16 maxD2Length;
112262306a36Sopenharmony_ci	u16 vlantype;
112362306a36Sopenharmony_ci	u16 vlantci;
112462306a36Sopenharmony_ci	u32 ecamptr;
112562306a36Sopenharmony_ci	u32 eventRegMask;
112662306a36Sopenharmony_ci	u16 pausePeriod;
112762306a36Sopenharmony_ci	u16 extensionField;
112862306a36Sopenharmony_ci	struct device_node *phy_node;
112962306a36Sopenharmony_ci	struct device_node *tbi_node;
113062306a36Sopenharmony_ci	u8 weightfactor[NUM_TX_QUEUES];
113162306a36Sopenharmony_ci	u8 interruptcoalescingmaxvalue[NUM_RX_QUEUES];
113262306a36Sopenharmony_ci	u8 l2qt[UCC_GETH_VLAN_PRIORITY_MAX];
113362306a36Sopenharmony_ci	u8 l3qt[UCC_GETH_IP_PRIORITY_MAX];
113462306a36Sopenharmony_ci	u32 vtagtable[UCC_GETH_TX_VTAG_TABLE_ENTRY_MAX];
113562306a36Sopenharmony_ci	u8 iphoffset[TX_IP_OFFSET_ENTRY_MAX];
113662306a36Sopenharmony_ci	u16 bdRingLenTx[NUM_TX_QUEUES];
113762306a36Sopenharmony_ci	u16 bdRingLenRx[NUM_RX_QUEUES];
113862306a36Sopenharmony_ci	enum ucc_geth_num_of_station_addresses numStationAddresses;
113962306a36Sopenharmony_ci	enum qe_fltr_largest_external_tbl_lookup_key_size
114062306a36Sopenharmony_ci	    largestexternallookupkeysize;
114162306a36Sopenharmony_ci	enum ucc_geth_statistics_gathering_mode statisticsMode;
114262306a36Sopenharmony_ci	enum ucc_geth_vlan_operation_tagged vlanOperationTagged;
114362306a36Sopenharmony_ci	enum ucc_geth_vlan_operation_non_tagged vlanOperationNonTagged;
114462306a36Sopenharmony_ci	enum ucc_geth_qos_mode rxQoSMode;
114562306a36Sopenharmony_ci	enum ucc_geth_flow_control_mode aufc;
114662306a36Sopenharmony_ci	enum ucc_geth_maccfg2_pad_and_crc_mode padAndCrc;
114762306a36Sopenharmony_ci	enum ucc_geth_num_of_threads numThreadsTx;
114862306a36Sopenharmony_ci	enum ucc_geth_num_of_threads numThreadsRx;
114962306a36Sopenharmony_ci	unsigned int riscTx;
115062306a36Sopenharmony_ci	unsigned int riscRx;
115162306a36Sopenharmony_ci};
115262306a36Sopenharmony_ci
115362306a36Sopenharmony_ci/* structure representing UCC GETH */
115462306a36Sopenharmony_cistruct ucc_geth_private {
115562306a36Sopenharmony_ci	struct ucc_geth_info *ug_info;
115662306a36Sopenharmony_ci	struct ucc_fast_private *uccf;
115762306a36Sopenharmony_ci	struct device *dev;
115862306a36Sopenharmony_ci	struct net_device *ndev;
115962306a36Sopenharmony_ci	struct napi_struct napi;
116062306a36Sopenharmony_ci	struct work_struct timeout_work;
116162306a36Sopenharmony_ci	struct ucc_geth __iomem *ug_regs;
116262306a36Sopenharmony_ci	struct ucc_geth_init_pram *p_init_enet_param_shadow;
116362306a36Sopenharmony_ci	struct ucc_geth_exf_global_pram __iomem *p_exf_glbl_param;
116462306a36Sopenharmony_ci	u32 exf_glbl_param_offset;
116562306a36Sopenharmony_ci	struct ucc_geth_rx_global_pram __iomem *p_rx_glbl_pram;
116662306a36Sopenharmony_ci	struct ucc_geth_tx_global_pram __iomem *p_tx_glbl_pram;
116762306a36Sopenharmony_ci	struct ucc_geth_send_queue_mem_region __iomem *p_send_q_mem_reg;
116862306a36Sopenharmony_ci	u32 send_q_mem_reg_offset;
116962306a36Sopenharmony_ci	struct ucc_geth_thread_data_tx __iomem *p_thread_data_tx;
117062306a36Sopenharmony_ci	u32 thread_dat_tx_offset;
117162306a36Sopenharmony_ci	struct ucc_geth_thread_data_rx __iomem *p_thread_data_rx;
117262306a36Sopenharmony_ci	u32 thread_dat_rx_offset;
117362306a36Sopenharmony_ci	struct ucc_geth_scheduler __iomem *p_scheduler;
117462306a36Sopenharmony_ci	u32 scheduler_offset;
117562306a36Sopenharmony_ci	struct ucc_geth_tx_firmware_statistics_pram __iomem *p_tx_fw_statistics_pram;
117662306a36Sopenharmony_ci	u32 tx_fw_statistics_pram_offset;
117762306a36Sopenharmony_ci	struct ucc_geth_rx_firmware_statistics_pram __iomem *p_rx_fw_statistics_pram;
117862306a36Sopenharmony_ci	u32 rx_fw_statistics_pram_offset;
117962306a36Sopenharmony_ci	struct ucc_geth_rx_interrupt_coalescing_table __iomem *p_rx_irq_coalescing_tbl;
118062306a36Sopenharmony_ci	u32 rx_irq_coalescing_tbl_offset;
118162306a36Sopenharmony_ci	struct ucc_geth_rx_bd_queues_entry __iomem *p_rx_bd_qs_tbl;
118262306a36Sopenharmony_ci	u32 rx_bd_qs_tbl_offset;
118362306a36Sopenharmony_ci	u8 __iomem *p_tx_bd_ring[NUM_TX_QUEUES];
118462306a36Sopenharmony_ci	u8 __iomem *p_rx_bd_ring[NUM_RX_QUEUES];
118562306a36Sopenharmony_ci	u8 __iomem *confBd[NUM_TX_QUEUES];
118662306a36Sopenharmony_ci	u8 __iomem *txBd[NUM_TX_QUEUES];
118762306a36Sopenharmony_ci	u8 __iomem *rxBd[NUM_RX_QUEUES];
118862306a36Sopenharmony_ci	int badFrame[NUM_RX_QUEUES];
118962306a36Sopenharmony_ci	u16 cpucount[NUM_TX_QUEUES];
119062306a36Sopenharmony_ci	u16 __iomem *p_cpucount[NUM_TX_QUEUES];
119162306a36Sopenharmony_ci	int indAddrRegUsed[NUM_OF_PADDRS];
119262306a36Sopenharmony_ci	u8 paddr[NUM_OF_PADDRS][ETH_ALEN];	/* ethernet address */
119362306a36Sopenharmony_ci	u8 numGroupAddrInHash;
119462306a36Sopenharmony_ci	u8 numIndAddrInHash;
119562306a36Sopenharmony_ci	u8 numIndAddrInReg;
119662306a36Sopenharmony_ci	int rx_extended_features;
119762306a36Sopenharmony_ci	int rx_non_dynamic_extended_features;
119862306a36Sopenharmony_ci	struct list_head conf_skbs;
119962306a36Sopenharmony_ci	struct list_head group_hash_q;
120062306a36Sopenharmony_ci	struct list_head ind_hash_q;
120162306a36Sopenharmony_ci	u32 saved_uccm;
120262306a36Sopenharmony_ci	spinlock_t lock;
120362306a36Sopenharmony_ci	/* pointers to arrays of skbuffs for tx and rx */
120462306a36Sopenharmony_ci	struct sk_buff **tx_skbuff[NUM_TX_QUEUES];
120562306a36Sopenharmony_ci	struct sk_buff **rx_skbuff[NUM_RX_QUEUES];
120662306a36Sopenharmony_ci	/* indices pointing to the next free sbk in skb arrays */
120762306a36Sopenharmony_ci	u16 skb_curtx[NUM_TX_QUEUES];
120862306a36Sopenharmony_ci	u16 skb_currx[NUM_RX_QUEUES];
120962306a36Sopenharmony_ci	/* index of the first skb which hasn't been transmitted yet. */
121062306a36Sopenharmony_ci	u16 skb_dirtytx[NUM_TX_QUEUES];
121162306a36Sopenharmony_ci
121262306a36Sopenharmony_ci	struct ugeth_mii_info *mii_info;
121362306a36Sopenharmony_ci	struct phy_device *phydev;
121462306a36Sopenharmony_ci	phy_interface_t phy_interface;
121562306a36Sopenharmony_ci	int max_speed;
121662306a36Sopenharmony_ci	uint32_t msg_enable;
121762306a36Sopenharmony_ci	int oldspeed;
121862306a36Sopenharmony_ci	int oldduplex;
121962306a36Sopenharmony_ci	int oldlink;
122062306a36Sopenharmony_ci	int wol_en;
122162306a36Sopenharmony_ci
122262306a36Sopenharmony_ci	struct device_node *node;
122362306a36Sopenharmony_ci};
122462306a36Sopenharmony_ci
122562306a36Sopenharmony_civoid uec_set_ethtool_ops(struct net_device *netdev);
122662306a36Sopenharmony_ciint init_flow_control_params(u32 automatic_flow_control_mode,
122762306a36Sopenharmony_ci		int rx_flow_control_enable, int tx_flow_control_enable,
122862306a36Sopenharmony_ci		u16 pause_period, u16 extension_field,
122962306a36Sopenharmony_ci		u32 __iomem *upsmr_register, u32 __iomem *uempr_register,
123062306a36Sopenharmony_ci		u32 __iomem *maccfg1_register);
123162306a36Sopenharmony_ci
123262306a36Sopenharmony_ci
123362306a36Sopenharmony_ci#endif				/* __UCC_GETH_H__ */
1234