📄 ucc_geth.h
字号:
/* * Copyright (C) Freescale Semicondutor, Inc. 2006. All rights reserved. * * Author: Shlomi Gridish <gridish@freescale.com> * * Description: * Internal header file for UCC Gigabit Ethernet unit routines. * * Changelog: * Jun 28, 2006 Li Yang <LeoLi@freescale.com> * - Rearrange code and style fixes * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the * Free Software Foundation; either version 2 of the License, or (at your * option) any later version. */#ifndef __UCC_GETH_H__#define __UCC_GETH_H__#include <linux/kernel.h>#include <linux/list.h>#include <linux/fsl_devices.h>#include <asm/immap_qe.h>#include <asm/qe.h>#include <asm/ucc.h>#include <asm/ucc_fast.h>#include "ucc_geth_mii.h"#define DRV_DESC "QE UCC Gigabit Ethernet Controller"#define DRV_NAME "ucc_geth"#define DRV_VERSION "1.1"#define NUM_TX_QUEUES 8#define NUM_RX_QUEUES 8#define NUM_BDS_IN_PREFETCHED_BDS 4#define TX_IP_OFFSET_ENTRY_MAX 8#define NUM_OF_PADDRS 4#define ENET_INIT_PARAM_MAX_ENTRIES_RX 9#define ENET_INIT_PARAM_MAX_ENTRIES_TX 8struct ucc_geth { struct ucc_fast uccf; u8 res0[0x100 - sizeof(struct ucc_fast)]; u32 maccfg1; /* mac configuration reg. 1 */ u32 maccfg2; /* mac configuration reg. 2 */ u32 ipgifg; /* interframe gap reg. */ u32 hafdup; /* half-duplex reg. */ u8 res1[0x10]; u8 miimng[0x18]; /* MII management structure moved to _mii.h */ u32 ifctl; /* interface control reg */ u32 ifstat; /* interface statux reg */ u32 macstnaddr1; /* mac station address part 1 reg */ u32 macstnaddr2; /* mac station address part 2 reg */ u8 res2[0x8]; u32 uempr; /* UCC Ethernet Mac parameter reg */ u32 utbipar; /* UCC tbi address reg */ u16 uescr; /* UCC Ethernet statistics control reg */ u8 res3[0x180 - 0x15A]; u32 tx64; /* Total number of frames (including bad frames) transmitted that were exactly of the minimal length (64 for un tagged, 68 for tagged, or with length exactly equal to the parameter MINLength */ u32 tx127; /* Total number of frames (including bad frames) transmitted that were between MINLength (Including FCS length==4) and 127 octets */ u32 tx255; /* Total number of frames (including bad frames) transmitted that were between 128 (Including FCS length==4) and 255 octets */ u32 rx64; /* Total number of frames received including bad frames that were exactly of the mninimal length (64 bytes) */ u32 rx127; /* Total number of frames (including bad frames) received that were between MINLength (Including FCS length==4) and 127 octets */ u32 rx255; /* Total number of frames (including bad frames) received that were between 128 (Including FCS length==4) and 255 octets */ u32 txok; /* Total number of octets residing in frames that where involved in succesfull transmission */ u16 txcf; /* Total number of PAUSE control frames transmitted by this MAC */ u8 res4[0x2]; u32 tmca; /* Total number of frames that were transmitted succesfully with the group address bit set that are not broadcast frames */ u32 tbca; /* Total number of frames transmitted succesfully that had destination address field equal to the broadcast address */ u32 rxfok; /* Total number of frames received OK */ u32 rxbok; /* Total number of octets received OK */ u32 rbyt; /* Total number of octets received including octets in bad frames. Must be implemented in HW because it includes octets in frames that never even reach the UCC */ u32 rmca; /* Total number of frames that were received succesfully with the group address bit set that are not broadcast frames */ u32 rbca; /* Total number of frames received succesfully that had destination address equal to the broadcast address */ u32 scar; /* Statistics carry register */ u32 scam; /* Statistics caryy mask register */ u8 res5[0x200 - 0x1c4];} __attribute__ ((packed));/* UCC GETH TEMODR Register */#define TEMODER_TX_RMON_STATISTICS_ENABLE 0x0100 /* enable Tx statistics */#define TEMODER_SCHEDULER_ENABLE 0x2000 /* enable scheduler */#define TEMODER_IP_CHECKSUM_GENERATE 0x0400 /* generate IPv4 checksums */#define TEMODER_PERFORMANCE_OPTIMIZATION_MODE1 0x0200 /* enable performance optimization enhancement (mode1) */#define TEMODER_RMON_STATISTICS 0x0100 /* enable tx statistics */#define TEMODER_NUM_OF_QUEUES_SHIFT (15-15) /* Number of queues << shift *//* UCC GETH TEMODR Register */#define REMODER_RX_RMON_STATISTICS_ENABLE 0x00001000 /* enable Rx statistics */#define REMODER_RX_EXTENDED_FEATURES 0x80000000 /* enable extended features */#define REMODER_VLAN_OPERATION_TAGGED_SHIFT (31-9 ) /* vlan operation tagged << shift */#define REMODER_VLAN_OPERATION_NON_TAGGED_SHIFT (31-10) /* vlan operation non tagged << shift */#define REMODER_RX_QOS_MODE_SHIFT (31-15) /* rx QoS mode << shift */#define REMODER_RMON_STATISTICS 0x00001000 /* enable rx statistics */#define REMODER_RX_EXTENDED_FILTERING 0x00000800 /* extended filtering vs. mpc82xx-like filtering */#define REMODER_NUM_OF_QUEUES_SHIFT (31-23) /* Number of queues << shift */#define REMODER_DYNAMIC_MAX_FRAME_LENGTH 0x00000008 /* enable dynamic max frame length */#define REMODER_DYNAMIC_MIN_FRAME_LENGTH 0x00000004 /* enable dynamic min frame length */#define REMODER_IP_CHECKSUM_CHECK 0x00000002 /* check IPv4 checksums */#define REMODER_IP_ADDRESS_ALIGNMENT 0x00000001 /* align ip address to 4-byte boundary *//* UCC GETH Event Register */#define UCCE_MPD 0x80000000 /* Magic packet detection */#define UCCE_SCAR 0x40000000#define UCCE_GRA 0x20000000 /* Tx graceful stop complete */#define UCCE_CBPR 0x10000000#define UCCE_BSY 0x08000000#define UCCE_RXC 0x04000000#define UCCE_TXC 0x02000000#define UCCE_TXE 0x01000000#define UCCE_TXB7 0x00800000#define UCCE_TXB6 0x00400000#define UCCE_TXB5 0x00200000#define UCCE_TXB4 0x00100000#define UCCE_TXB3 0x00080000#define UCCE_TXB2 0x00040000#define UCCE_TXB1 0x00020000#define UCCE_TXB0 0x00010000#define UCCE_RXB7 0x00008000#define UCCE_RXB6 0x00004000#define UCCE_RXB5 0x00002000#define UCCE_RXB4 0x00001000#define UCCE_RXB3 0x00000800#define UCCE_RXB2 0x00000400#define UCCE_RXB1 0x00000200#define UCCE_RXB0 0x00000100#define UCCE_RXF7 0x00000080#define UCCE_RXF6 0x00000040#define UCCE_RXF5 0x00000020#define UCCE_RXF4 0x00000010#define UCCE_RXF3 0x00000008#define UCCE_RXF2 0x00000004#define UCCE_RXF1 0x00000002#define UCCE_RXF0 0x00000001#define UCCE_RXBF_SINGLE_MASK (UCCE_RXF0)#define UCCE_TXBF_SINGLE_MASK (UCCE_TXB0)#define UCCE_TXB (UCCE_TXB7 | UCCE_TXB6 | UCCE_TXB5 | UCCE_TXB4 |\ UCCE_TXB3 | UCCE_TXB2 | UCCE_TXB1 | UCCE_TXB0)#define UCCE_RXB (UCCE_RXB7 | UCCE_RXB6 | UCCE_RXB5 | UCCE_RXB4 |\ UCCE_RXB3 | UCCE_RXB2 | UCCE_RXB1 | UCCE_RXB0)#define UCCE_RXF (UCCE_RXF7 | UCCE_RXF6 | UCCE_RXF5 | UCCE_RXF4 |\ UCCE_RXF3 | UCCE_RXF2 | UCCE_RXF1 | UCCE_RXF0)#define UCCE_OTHER (UCCE_SCAR | UCCE_GRA | UCCE_CBPR | UCCE_BSY |\ UCCE_RXC | UCCE_TXC | UCCE_TXE)#define UCCE_RX_EVENTS (UCCE_RXF | UCCE_BSY)#define UCCE_TX_EVENTS (UCCE_TXB | UCCE_TXE)/* UCC GETH UPSMR (Protocol Specific Mode Register) */#define UPSMR_ECM 0x04000000 /* Enable CAM Miss or Enable Filtering Miss */#define UPSMR_HSE 0x02000000 /* Hardware Statistics Enable */#define UPSMR_PRO 0x00400000 /* Promiscuous*/#define UPSMR_CAP 0x00200000 /* CAM polarity */#define UPSMR_RSH 0x00100000 /* Receive Short Frames */#define UPSMR_RPM 0x00080000 /* Reduced Pin Mode interfaces */#define UPSMR_R10M 0x00040000 /* RGMII/RMII 10 Mode */#define UPSMR_RLPB 0x00020000 /* RMII Loopback Mode */#define UPSMR_TBIM 0x00010000 /* Ten-bit Interface Mode */#define UPSMR_RMM 0x00001000 /* RMII/RGMII Mode */#define UPSMR_CAM 0x00000400 /* CAM Address Matching */#define UPSMR_BRO 0x00000200 /* Broadcast Address */#define UPSMR_RES1 0x00002000 /* Reserved feild - must be 1 *//* UCC GETH MACCFG1 (MAC Configuration 1 Register) */#define MACCFG1_FLOW_RX 0x00000020 /* Flow Control Rx */#define MACCFG1_FLOW_TX 0x00000010 /* Flow Control Tx */#define MACCFG1_ENABLE_SYNCHED_RX 0x00000008 /* Rx Enable synchronized to Rx stream */#define MACCFG1_ENABLE_RX 0x00000004 /* Enable Rx */#define MACCFG1_ENABLE_SYNCHED_TX 0x00000002 /* Tx Enable synchronized to Tx stream */#define MACCFG1_ENABLE_TX 0x00000001 /* Enable Tx *//* UCC GETH MACCFG2 (MAC Configuration 2 Register) */#define MACCFG2_PREL_SHIFT (31 - 19) /* Preamble Length << shift */#define MACCFG2_PREL_MASK 0x0000f000 /* Preamble Length mask */#define MACCFG2_SRP 0x00000080 /* Soft Receive Preamble */#define MACCFG2_STP 0x00000040 /* Soft Transmit Preamble */#define MACCFG2_RESERVED_1 0x00000020 /* Reserved - must be set to 1 */#define MACCFG2_LC 0x00000010 /* Length Check */#define MACCFG2_MPE 0x00000008 /* Magic packet detect */#define MACCFG2_FDX 0x00000001 /* Full Duplex */#define MACCFG2_FDX_MASK 0x00000001 /* Full Duplex mask */#define MACCFG2_PAD_CRC 0x00000004#define MACCFG2_CRC_EN 0x00000002#define MACCFG2_PAD_AND_CRC_MODE_NONE 0x00000000 /* Neither Padding short frames nor CRC */#define MACCFG2_PAD_AND_CRC_MODE_CRC_ONLY 0x00000002 /* Append CRC only */#define MACCFG2_PAD_AND_CRC_MODE_PAD_AND_CRC 0x00000004#define MACCFG2_INTERFACE_MODE_NIBBLE 0x00000100 /* nibble mode (MII/RMII/RGMII 10/100bps) */#define MACCFG2_INTERFACE_MODE_BYTE 0x00000200 /* byte mode (GMII/TBI/RTB/RGMII 1000bps ) */#define MACCFG2_INTERFACE_MODE_MASK 0x00000300 /* mask covering all relevant bits *//* UCC GETH IPGIFG (Inter-frame Gap / Inter-Frame Gap Register) */#define IPGIFG_NON_BACK_TO_BACK_IFG_PART1_SHIFT (31 - 7) /* Non back-to-back inter frame gap part 1. << shift */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -