diff options
Diffstat (limited to 'target/linux/realtek/files/include/asm-mips')
9 files changed, 5908 insertions, 0 deletions
diff --git a/target/linux/realtek/files/include/asm-mips/rtl865x/asicRegs.h b/target/linux/realtek/files/include/asm-mips/rtl865x/asicRegs.h new file mode 100644 index 000000000..7d222604f --- /dev/null +++ b/target/linux/realtek/files/include/asm-mips/rtl865x/asicRegs.h @@ -0,0 +1,40 @@ +/* +* ---------------------------------------------------------------- +* Copyright c Realtek Semiconductor Corporation, 2002 +* All rights reserved. +* +* $Header: /home1/sub1/tmp/cvs2svn/skylark/skylark/skylark/linux-2.6.x/include/asm-mips/rtl865x/asicRegs.h,v 1.1 2007-12-07 05:52:22 alva_zhang Exp $ +* +* Abstract: ASIC specific definitions -- common part. +* +* $Author: alva_zhang $ +* +* ----------------------------------------------------------------- +* The following definitions are shared by 865xB/865xC series IC. +* ----------------------------------------------------------------- +*/ + +#include "rtl_types.h" + +/********************************************************************* + ** ** + ** Common Parts -- Add Common Definitions Here ! ** + ** ** + *********************************************************************/ +#define UNCACHED_ADDRESS(x) ((void *)(0x20000000 | (uint32)x )) +#define CACHED_ADDRESS(x) ((void*)(~0x20000000 & (uint32)x )) +#define PHYSICAL_ADDRESS(x) (((uint32)x) & 0x1fffffff) +#define KSEG0_ADDRESS(x) ((void*)(PHYSICAL_ADDRESS(x) | 0x80000000)) +#define KSEG1_ADDRESS(x) ((void*)(PHYSICAL_ADDRESS(x) | 0xA0000000)) + + +/********************************************************************* + ** ** + ** IC-Dependent Part --Add in the Specific Definitions in its file ** + ** ** + *********************************************************************/ +#ifdef CONFIG_RTL865XC +#include "rtl865xc_asicregs.h" +#else +#include "rtl865xb_asicregs.h" +#endif diff --git a/target/linux/realtek/files/include/asm-mips/rtl865x/interrupt.h b/target/linux/realtek/files/include/asm-mips/rtl865x/interrupt.h new file mode 100644 index 000000000..904035889 --- /dev/null +++ b/target/linux/realtek/files/include/asm-mips/rtl865x/interrupt.h @@ -0,0 +1,41 @@ +#include <linux/autoconf.h> + +#ifdef CONFIG_RTL865XC + +#define CPU_CLOCK_RATE 16000000 /* CPU clock @ 14 MHz */ +#define ICU_GPIO 0 +#define ICU_TMR 9 +#define ICU_UART0 5 +#define ICU_UART1 4 +//#define ICU_PCMCIA 0 +#define ICU_PCI 3 +#ifdef CONFIG_DEFAULTS_KERNEL_2_6 +#define ICU_NIC 15 +#else +#define ICU_NIC 2 +#endif +#define ICU_PCM 6 +#define ICU_USB 7// +//#define ICU_EXT 0// +//#define ICU_LBCT 0// + +#else + +#define CPU_CLOCK_RATE 96000000 /* CPU clock @ 14 MHz */ +#define ICU_TMR 0 +#define ICU_USB 1 +#define ICU_PCMCIA 2 +#define ICU_UART0 4 +#define ICU_UART1 3 +#define ICU_PCI 5 +#define ICU_NIC 6 +#define ICU_GPIO 7 +#define ICU_EXT 8 +#define ICU_LBCT 10 +#define ICU_CRYPTO 11 +#define ICU_AUTH 12 +#define ICU_PCM 13 +#define ICU_PDE 14 +#define ICU_PCIBTO 15 + +#endif diff --git a/target/linux/realtek/files/include/asm-mips/rtl865x/pci.h b/target/linux/realtek/files/include/asm-mips/rtl865x/pci.h new file mode 100644 index 000000000..4ae6380f3 --- /dev/null +++ b/target/linux/realtek/files/include/asm-mips/rtl865x/pci.h @@ -0,0 +1,77 @@ +#ifndef PCI_H +#define PCI_H + + + +struct pci_slot_baseaddr_s { + u32 slotNum; + u32 addr; +}; + +#ifdef CONFIG_RTL865XC + +#define PCI_SLOT0_CONFIG_BASE 0xB8B40000 +#define PCI_SLOT1_CONFIG_BASE 0xB8B80000 +#define PCI_SLOT2_CONFIG_BASE 0xB8B10000 +#define PCI_SLOT3_CONFIG_BASE 0xB8B20000 + +#define PCI_SLOT_MEM_BASE0 0xB9000000 +#define PCI_SLOT_IO_BASE0 0xB8C00000 +#define PCI_MEM_SPACE_SIZE0 0x01000000 +#define PCI_IO_SPACE_SIZE0 0x00200000 + +#define PCI_SLOT_MEM_BASE1 0xBA000000 +#define PCI_SLOT_IO_BASE1 0xB8E00000 +#define PCI_MEM_SPACE_SIZE1 0x01000000 +#define PCI_IO_SPACE_SIZE1 0x00200000 + + +#else + +#define PCI_SLOT0_CONFIG_BASE 0xBBD40000 +#define PCI_SLOT1_CONFIG_BASE 0xBBD80000 +#define PCI_SLOT2_CONFIG_BASE 0xBBD10000 +#define PCI_SLOT3_CONFIG_BASE 0xBBD20000 + +#define PCI_SLOT_MEM_BASE 0xBBF00000 +#define PCI_SLOT_IO_BASE 0xBBE00000 +#define PCI_MEM_SPACE_SIZE 0x00100000 +#define PCI_IO_SPACE_SIZE 0x00100000 +#endif + + +//PCI configuration space +#define PCI_CONFIG_VENDER_DEV 0x0000 +#define PCI_CONFIG_COMMAND 0x0004 +#define PCI_CONFIG_STATUS 0x0006 +#define PCI_CONFIG_CLASS_REVISION 0x0008 +#define PCI_CONFIG_CACHE 0x000c +#define PCI_CONFIG_LATENCY 0x000d +#define PCI_CONFIG_HEADER_TYPE 0x000e +#define PCI_CONFIG_BASE0 0x0010 +#define PCI_CONFIG_BASE1 0x0014 +#define PCI_CONFIG_BASE2 0x0018 +#define PCI_CONFIG_BASE3 0x001c +#define PCI_CONFIG_BASE4 0x0020 +#define PCI_CONFIG_BASE5 0x0024 +#define PCI_CONFIG_SUBSYSTEMVENDOR 0x002c +#define PCI_CONFIG_INT_LINE 0x003c +#define PCI_CONFIG_INT_PIN 0x003d +#define PCI_CONFIG_MAXLAN 0x003f +#define PCI_CONFIG_MINGNT 0x003e + +//PCI command register flag +#define CMD_FAST_BACK_TO_BACK (1<<9) +#define CMD_SERR (1<<8) +#define CMD_STEP_CONTROL (1<<7) +#define CMD_PARITY_ERROR_RESPONSE (1<<6) +#define CMD_VGA_PALLETE_SNOOP (1<<5) +#define CMD_WRITE_AND_INVALIDATE (1<<4) +#define CMD_SPECIAL_CYCLE (1<<3) +#define CMD_BUS_MASTER (1<<2) +#define CMD_MEM_SPACE (1<<1) +#define CMD_IO_SPACE (1<<0) + +int rtl_pci_assign_resource(void); + +#endif diff --git a/target/linux/realtek/files/include/asm-mips/rtl865x/platform.h b/target/linux/realtek/files/include/asm-mips/rtl865x/platform.h new file mode 100644 index 000000000..2063b5b13 --- /dev/null +++ b/target/linux/realtek/files/include/asm-mips/rtl865x/platform.h @@ -0,0 +1,388 @@ +#ifndef _PLATFORM_H
+#define _PLATFORM_H
+
+
+/*
+ * =============
+ * Utilty Macros
+ * =============
+ */
+#define REG8(reg) (*(volatile unsigned char *)((unsigned int)reg))
+#define REG16(reg) (*(volatile unsigned short *)((unsigned int)reg))
+#define REG32(reg) (*(volatile unsigned int *)((unsigned int)reg))
+
+#define WRITE_MEM32(addr, val) (*(volatile unsigned int *) (addr)) = (val)
+#define READ_MEM32(addr) (*(volatile unsigned int *) (addr))
+#define WRITE_MEM16(addr, val) (*(volatile unsigned short *) (addr)) = (val)
+#define READ_MEM16(addr) (*(volatile unsigned short *) (addr))
+#define WRITE_MEM8(addr, val) (*(volatile unsigned char *) (addr)) = (val)
+#define READ_MEM8(addr) (*(volatile unsigned char *) (addr))
+
+#define PADDR(addr) ((addr) & 0x1FFFFFFF)
+
+/*
+ * ====================================
+ * Platform Configurable Common Options
+ * ====================================
+ */
+
+#define PROM_DEBUG 0
+
+#define MHZ 200
+#define SYSCLK MHZ * 1000 * 1000
+
+#define BAUDRATE 38400 /* ex. 19200 or 38400 or 57600 or 115200 */
+ /* For Early Debug */
+
+/*
+ * Interrupt IRQ Assignments
+ */
+#define PCIB0TMO_IRQ 0
+#define PCIB1TMO_IRQ 1
+#define LBCTMOm0_IRQ 2
+#define LBCTMOm1_IRQ 3
+#define LBCTMOs_IRQ 4
+#define TC0_IRQ 8
+#define TC1_IRQ 9
+#define USB_IRQ 10
+#define UART0_IRQ 12
+#define UART1_IRQ 13
+#define PCI_IRQ 14
+#define SWCORE_IRQ 15
+#define GPIO_ABCD_IRQ 16
+#define GPIO_EFGH_IRQ 17
+#define HCI_IRQ 18
+#define PCM_IRQ 19
+#define CRYPTO_IRQ 20
+#define GDMA_IRQ 23
+#define PCIE2_IRQ 22
+#define PCIE_IRQ 21 // shall be 22
+
+/*
+ * Interrupt Routing Selection
+ */
+#define PTM_RS 2
+#define LBCTMOs2_RS 2
+#define LBCTMOs1_RS 2
+#define PKT_RS 2
+#define SPI_RS 2
+#define NIC100_RS 2
+#define SAR_RS 2
+#define DMT_RS 2
+#define PCIE2_RS 4
+#define PCIE_RS 5
+#define GDMA_RS 2
+#define SECURITY_RS 2
+#define PCM_RS 2
+#define NFBI_RS 2
+#define GPIO_EFGH_RS 2
+#define GPIO_ABCD_RS 5
+#define SW_RS 6
+#define PCI_RS 5
+#define UART1_RS 2
+#define UART0_RS 3
+#define USB_D_RS 2
+#define USB_H_RS 4
+#define TC1_RS 2
+#define TC0_RS 7
+#define LBCTMOm2_RS 2
+#define LBCTMOm1_RS 2
+#define SPEED_RS 2
+#define LBCTMOs0_RS 2
+#define LBCTMOm0_RS 2
+#define OCPTMO_RS 2
+#define PCIB0TO_RS 2
+#define NONE 2
+#define PCIB0TMO_RS 2
+#define PCIB1TMO_RS 2
+#define LBCTMOs_RS 2
+
+
+#define HCI_RS 2
+#define CRYPTO_RS 2
+
+
+#define DIVISOR 1000
+
+#if DIVISOR > (1 << 16)
+#error "Exceed the Maximum Value of DivFactor"
+#endif
+
+/*
+ * ==========================
+ * Platform Register Settings
+ * ==========================
+ */
+
+/*
+ * CPU
+ */
+#define IMEM_BASE 0x00C00000
+#define IMEM_TOP 0x00C03FFF
+
+#define DMEM_BASE 0x00C04000
+#define DMEM_TOP 0x00C05FFF
+
+/*
+ * Memory Controller
+ */
+#define MC_MCR 0xB8001000
+ #define MC_MCR_VAL 0x92A28000
+
+#define MC_MTCR0 0xB8001004
+ #define MC_MTCR0_VAL 0x12120000
+
+#define MC_MTCR1 0xB8001008
+ #define MC_MTCR1_VAL 0x00000FEB
+
+#define MC_PFCR 0xB8001010
+ #define MC_PFCR_VAL 0x00000101
+
+
+#define MC_BASE 0xB8001000
+#define NCR (MC_BASE + 0x100)
+#define NSR (MC_BASE + 0x104)
+#define NCAR (MC_BASE + 0x108)
+#define NADDR (MC_BASE + 0x10C)
+#define NDR (MC_BASE + 0x110)
+
+#define SFCR (MC_BASE + 0x200)
+#define SFDR (MC_BASE + 0x204)
+
+/*
+ * UART
+ */
+#define UART0_BASE 0xB8002000
+#define UART0_RBR (UART0_BASE + 0x000)
+#define UART0_THR (UART0_BASE + 0x000)
+#define UART0_DLL (UART0_BASE + 0x000)
+#define UART0_IER (UART0_BASE + 0x004)
+#define UART0_DLM (UART0_BASE + 0x004)
+#define UART0_IIR (UART0_BASE + 0x008)
+#define UART0_FCR (UART0_BASE + 0x008)
+#define UART0_LCR (UART0_BASE + 0x00C)
+#define UART0_MCR (UART0_BASE + 0x010)
+#define UART0_LSR (UART0_BASE + 0x014)
+
+#define UART1_BASE 0xB8002100
+#define UART1_RBR (UART1_BASE + 0x000)
+#define UART1_THR (UART1_BASE + 0x000)
+#define UART1_DLL (UART1_BASE + 0x000)
+#define UART1_IER (UART1_BASE + 0x004)
+#define UART1_DLM (UART1_BASE + 0x004)
+#define UART1_IIR (UART1_BASE + 0x008)
+#define UART1_FCR (UART1_BASE + 0x008)
+ #define FCR_EN 0x01
+ #define FCR_RXRST 0x02
+ #define RXRST 0x02
+ #define FCR_TXRST 0x04
+ #define TXRST 0x04
+ #define FCR_DMA 0x08
+ #define FCR_RTRG 0xC0
+ #define CHAR_TRIGGER_01 0x00
+ #define CHAR_TRIGGER_04 0x40
+ #define CHAR_TRIGGER_08 0x80
+ #define CHAR_TRIGGER_14 0xC0
+#define UART1_LCR (UART1_BASE + 0x00C)
+ #define LCR_WLN 0x03
+ #define CHAR_LEN_5 0x00
+ #define CHAR_LEN_6 0x01
+ #define CHAR_LEN_7 0x02
+ #define CHAR_LEN_8 0x03
+ #define LCR_STB 0x04
+ #define ONE_STOP 0x00
+ #define TWO_STOP 0x04
+ #define LCR_PEN 0x08
+ #define PARITY_ENABLE 0x01
+ #define PARITY_DISABLE 0x00
+ #define LCR_EPS 0x30
+ #define PARITY_ODD 0x00
+ #define PARITY_EVEN 0x10
+ #define PARITY_MARK 0x20
+ #define PARITY_SPACE 0x30
+ #define LCR_BRK 0x40
+ #define LCR_DLAB 0x80
+ #define DLAB 0x80
+#define UART1_MCR (UART1_BASE + 0x010)
+#define UART1_LSR (UART1_BASE + 0x014)
+ #define LSR_DR 0x01
+ #define RxCHAR_AVAIL 0x01
+ #define LSR_OE 0x02
+ #define LSR_PE 0x04
+ #define LSR_FE 0x08
+ #define LSR_BI 0x10
+ #define LSR_THRE 0x20
+ #define TxCHAR_AVAIL 0x00
+ #define TxCHAR_EMPTY 0x20
+ #define LSR_TEMT 0x40
+ #define LSR_RFE 0x80
+
+
+/*
+ * Interrupt Controller
+ */
+#define GIMR 0xB8003000
+ #define GDMA_IE (1 << 23)
+ #define PCIE2_IE (1 << 22)
+ #define PCIE_IE (1 << 21) // shall be 22
+ #define CRYPTO_IE (1 << 20)
+ #define PCM_IE (1 << 19)
+ #define HCI_IE (1 << 18)
+ #define GPIO_EFGH_IE (1 << 17)
+ #define GPIO_ABCD_IE (1 << 16)
+ #define SW_IE (1 << 15)
+ #define PCI_IE (1 << 14)
+ #define UART1_IE (1 << 13)
+ #define UART0_IE (1 << 12)
+ #define USB_H_IE (1 << 10)
+ #define TC1_IE (1 << 9)
+ #define TC0_IE (1 << 8)
+ #define LBCTMOs_IE (1 << 4)
+ #define LBCTMOm1_IE (1 << 3)
+ #define LBCTMOm0_IE (1 << 2)
+ #define PCIB1TO_IE (1 << 1)
+ #define PCIB0TO_IE (1 << 0)
+
+#define GISR 0xB8003004
+ #define GDMA_IP (1 << 23)
+ #define PCIE2_IP (1 << 22)
+ #define PCIE_IP (1 << 21) // shall be 22
+ #define CRYPTO_IP (1 << 20)
+ #define PCM_IP (1 << 19)
+ #define HCI_IP (1 << 18)
+ #define GPIO_EFGH_IP (1 << 17)
+ #define GPIO_ABCD_IP (1 << 16)
+ #define SW_IP (1 << 15)
+ #define PCI_IP (1 << 14)
+ #define UART1_IP (1 << 13)
+ #define UART0_IP (1 << 12)
+ #define USB_H_IP (1 << 10)
+ #define TC1_IP (1 << 9)
+ #define TC0_IP (1 << 8)
+ #define LBCTMOs_IP (1 << 4)
+ #define LBCTMOm1_IP (1 << 3)
+ #define LBCTMOm0_IP (1 << 2)
+ #define PCIB1TO_IP (1 << 1)
+ #define PCIB0TO_IP (1 << 0)
+
+#define IRR0 0xB8003008
+#define IRR0_SETTING ((LBCTMOm2_RS << 28) | \
+ (LBCTMOm1_RS << 24) | \
+ (SPEED_RS << 20) | \
+ (LBCTMOs0_RS << 16) | \
+ (LBCTMOm0_RS << 12) | \
+ (OCPTMO_RS << 8) | \
+ (NONE << 4) | \
+ (PCIB0TO_RS << 0) \
+ )
+
+#define IRR1 0xB800300C
+#define IRR1_SETTING ((SW_RS << 28) | \
+ (PCIE_RS << 24) | \
+ (UART1_RS << 20) | \
+ (UART0_RS << 16) | \
+ (USB_D_RS << 12) | \
+ (USB_H_RS << 8) | \
+ (TC1_RS << 4) | \
+ (TC0_RS << 0) \
+ )
+
+#define IRR2 0xB8003010
+#define IRR2_SETTING ((GDMA_RS << 28) | \
+ (PCIE2_RS << 24) | \
+ (PCIE_RS << 20) | \
+ (SECURITY_RS << 16) | \
+ (PCM_RS << 12) | \
+ (NFBI_RS << 8) | \
+ (GPIO_EFGH_RS << 4) | \
+ (GPIO_ABCD_RS << 0) \
+ )
+
+#define IRR3 0xB8003014
+#define IRR3_SETTING ((PTM_RS << 28) | \
+ (LBCTMOs2_RS << 24) | \
+ (LBCTMOs1_RS << 20) | \
+ (PKT_RS << 16) | \
+ (SPI_RS << 12) | \
+ (NIC100_RS << 8) | \
+ (SAR_RS << 4) | \
+ (DMT_RS << 0) \
+ )
+/*
+ * Timer/Counter
+ */
+#define TC_BASE 0xB8003100
+#define TC0DATA (TC_BASE + 0x00)
+#define TC1DATA (TC_BASE + 0x04)
+ #define TCD_OFFSET 8
+#define TC0CNT (TC_BASE + 0x08)
+#define TC1CNT (TC_BASE + 0x0C)
+#define TCCNR (TC_BASE + 0x10)
+ #define TC0EN (1 << 31)
+ #define TC0MODE_TIMER (1 << 30)
+ #define TC1EN (1 << 29)
+ #define TC1MODE_TIMER (1 << 28)
+#define TCIR (TC_BASE + 0x14)
+ #define TC0IE (1 << 31)
+ #define TC1IE (1 << 30)
+ #define TC0IP (1 << 29)
+ #define TC1IP (1 << 28)
+#define CDBR (TC_BASE + 0x18)
+ #define DIVF_OFFSET 16
+#define WDTCNR (TC_BASE + 0x1C)
+
+/*
+ * HCI
+ */
+#define HCI_BASE 0xB8007000
+#define HCI_GCR (HCI_BASE + 0x00)
+#define HCI_TRFFDR (HCI_BASE + 0x04)
+#define HCI_TRFFAR (HCI_BASE + 0x08)
+#define HCI_FFCR_CS(i) (HCI_BASE + 0x0C + ((i) << 2))
+#define HCI_IER_CS(i) (HCI_BASE + 0x1C + ((i) << 2))
+#define HCI_LSR_CS(i) (HCI_BASE + 0x2C + ((i) << 2))
+#define HCI_CR_CS(i) (HCI_BASE + 0x3C + ((i) << 2))
+#define HCI_TR_CS(i) (HCI_BASE + 0x4C + ((i) << 2))
+/*
+ * PCIE Host Controller
+ */
+#define PCIE0_H_CFG 0xB8B00000
+#define PCIE0_H_EXT 0xB8B01000
+#define PCIE0_H_MDIO (PCIE0_H_EXT + 0x00)
+#define PCIE0_H_INTSTR (PCIE0_H_EXT + 0x04)
+#define PCIE0_H_PWRCR (PCIE0_H_EXT + 0x08)
+#define PCIE0_H_IPCFG (PCIE0_H_EXT + 0x0C)
+#define PCIE0_H_MISC (PCIE0_H_EXT + 0x10)
+#define PCIE0_D_CFG0 0xB8B10000
+#define PCIE0_D_CFG1 0xB8B11000
+#define PCIE0_D_MSG 0xB8B12000
+
+#define PCIE1_H_CFG 0xB8B20000
+#define PCIE1_H_EXT 0xB8B21000
+#define PCIE1_H_MDIO (PCIE1_H_EXT + 0x00)
+#define PCIE1_H_INTSTR (PCIE1_H_EXT + 0x04)
+#define PCIE1_H_PWRCR (PCIE1_H_EXT + 0x08)
+#define PCIE1_H_IPCFG (PCIE1_H_EXT + 0x0C)
+#define PCIE1_H_MISC (PCIE1_H_EXT + 0x10)
+#define PCIE1_D_CFG0 0xB8B30000
+#define PCIE1_D_CFG1 0xB8B31000
+#define PCIE1_D_MSG 0xB8B32000
+
+#define PCIE0_D_IO 0xB8C00000
+#define PCIE1_D_IO 0xB8E00000
+#define PCIE0_D_MEM 0xB9000000
+#define PCIE1_D_MEM 0xBA000000
+#define GPIO_BASE 0Xb8003500
+#define PABCD_CNR ( GPIO_BASE + 0x00 )
+#define PABCD_DIR ( GPIO_BASE + 0x08 )
+#define PABCD_DAT ( GPIO_BASE + 0x0C )
+#define PABCD_ISR ( GPIO_BASE + 0x10 )
+#define PAB_IMR ( GPIO_BASE + 0x14 )
+#define PCD_IMR ( GPIO_BASE + 0x18 )
+#define PEFGH_CNR ( GPIO_BASE + 0x1C )
+#define PEFGH_DIR ( GPIO_BASE + 0x24 )
+#define PEFGH_DAT ( GPIO_BASE + 0x28 )
+#define PEFGH_ISR ( GPIO_BASE + 0x2C )
+#define PEF_IMR ( GPIO_BASE + 0x30 )
+#define PGH_IMR ( GPIO_BASE + 0x34 )
+#endif /* _PLATFORM_H */
diff --git a/target/linux/realtek/files/include/asm-mips/rtl865x/re865x.h b/target/linux/realtek/files/include/asm-mips/rtl865x/re865x.h new file mode 100644 index 000000000..e8effa7bb --- /dev/null +++ b/target/linux/realtek/files/include/asm-mips/rtl865x/re865x.h @@ -0,0 +1,716 @@ +/* + * Copyright c Realtek Semiconductor Corporation, 2003 + * All rights reserved. + * + * $Header: /home1/sub1/tmp/cvs2svn/skylark/skylark/skylark/linux-2.6.x/include/asm-mips/rtl865x/re865x.h,v 1.1 2007-12-07 05:52:23 alva_zhang Exp $ + * + * $Author: alva_zhang $ + * + * Abstract: + * + * re865x.h -- ioctl symbol definitions + * + * $Log: not supported by cvs2svn $ + * Revision 1.1.1.1 2007/08/06 10:04:57 root + * Initial import source to CVS + * + * Revision 1.76 2007/04/23 13:05:40 bo_zhao + * +: add new qos support + * + * Revision 1.75 2007/04/04 03:44:39 alva_zhang + * +: support rtl865xC MIB Couter function + * + * Revision 1.74 2007/04/04 02:29:03 bo_zhao + * *: update MNQueue + * + * Revision 1.73 2007/03/28 03:04:56 bo_zhao + * :Add 865xC MNQueue + * + * Revision 1.72 2007/03/12 05:40:34 darcy_lu + * +: add macro definition for get l2 table + * + * Revision 1.71 2007/03/06 06:56:06 chihhsing + * +: add new IOCTRL for port-base VLAN tagged/untagged + * + * Revision 1.70 2007/03/05 06:07:18 qjj_qin + * *:865xc igmp snooping support + * + * Revision 1.69 2007/02/14 09:23:21 qjj_qin + * *:macro for igmp snooping + * + * Revision 1.68 2007/02/13 07:37:44 qjj_qin + * +:igmp proxy to snooping + * + * Revision 1.67 2007/01/08 01:57:27 hyking_liu + * +: add tag RTL8651_IOCTL_SETMULTIPPPOESESSIONSTATUS for idle time out + * + * Revision 1.66 2006/12/28 02:45:07 hyking_liu + * +: add tag SETNAPTTCPUDPPORTRANGE + * + * Revision 1.65 2006/12/05 05:56:59 qjj_qin + * *:add SDK API to specify detail multicast upstream + * + * Revision 1.64 2006/11/28 02:53:47 hyking_liu + * +: Add Micro for ioctl_setvlanPromiscuous + * + * Revision 1.63 2006/11/13 06:36:25 qjj_qin + * +:igmp proxy for multi-port wan port + * + * Revision 1.62 2006/10/25 07:11:58 qy_wang + * +:add an IOCTRL function to get extension device name & vid + * + * Revision 1.61 2006/08/16 08:33:31 cw_du + * +:Add #define RTL8651_IOCTL_ENABLE_UNNUMBERNAPTPROC 2797. + * + * Revision 1.60 2006/08/15 05:38:56 hyking_liu + * +: Add FLUSHGENERICDMZFILTER for flush dmzfilter. + * + * Revision 1.59 2006/08/14 05:25:44 hyking_liu + * *: Modify for DMZ ipFilter API + * + * Revision 1.58 2006/08/08 08:56:29 hyking_liu + * +: add define of IOCTL_ADDGENERICDMZHOST + * + * Revision 1.57 2006/08/07 07:20:52 jiucai_wang + * +:add RTL8651_IOCTL_MANUALKEYFLAGSEND for ipsec manual key mode + * + * Revision 1.56 2006/08/02 02:20:45 hyking_liu + * +: Add the define of RTL8651_IOCTL_ADDDMZHOSTEXT used in re_core.c + * + * Revision 1.55 2006/05/30 02:13:06 jiucai_wang + * +:add the micro declaration for reinit route list(line 2795) + * + * Revision 1.54 2006/05/24 09:45:45 jiucai_wang + * +:add some micro definition(line:541-546) + * + * Revision 1.53 2006/04/13 05:54:58 chenyl + * +: KERNELPROC for kernel procdure testing + * + * Revision 1.52 2006/03/16 03:12:37 yjlou + * +: Support various NAT Cone Type: + * Naive, Symmetric, Restricted, Port-Restricted, and Full Cone. + * + * Revision 1.51 2006/01/27 07:10:48 shliu + * *: add definition of RTL8651_IOCTL_SETURLFORWARDLOGGING + * + * Revision 1.50 2006/01/26 16:04:49 shliu + * *: define RTL8651_IOCTL_FLUSHURLFILTERRULE + * + * Revision 1.49 2006/01/25 14:53:07 yjlou + * *: fixed the bug of pbnat(Protocol-Base NAT): auto enable when any entry is enabled. + * + * Revision 1.48 2006/01/24 13:52:52 shliu + * *: add ioctl definition RTL8651_IOCTL_SETURLDEFAULTACTION + * + * Revision 1.47 2006/01/23 02:05:40 shliu + * *: add RTL8651_IOCTL_URLUNKNOWNTYPECASESENSITIVE + * + * Revision 1.46 2006/01/23 01:57:15 shliu + * *: add RTL8651_IOCTL_ADDGENERICURLFILTERRULE & RTL8651_IOCTL_DELGENERICURLFILTERRULE + * + * Revision 1.45 2005/12/12 03:25:00 tony + * +: New Feature: support trusted user in url filter. + * + * Revision 1.44 2005/12/02 15:41:11 chenyl + * *: circular buffer write protection by kernel mutex lock / unlock + * + * Revision 1.43 2005/12/02 10:04:46 chenyl + * +: capture Log buffer's snapshot to user space memory under mutex lock/unlock protection. + * *: shliu's new circ_msg write mechanism. + * + * Revision 1.42 2005/11/21 12:40:55 chenyl + * *: always turn OFF interrupts when R/W flash + * + * Revision 1.41 2005/10/26 12:54:40 shliu + * *: add RTL8651_IOCTL_REPROBE + * + * Revision 1.40 2005/10/26 04:57:45 shliu + * *: new API for deletion of proto stack action table entry + * + * Revision 1.39 2005/09/25 17:02:11 shliu + * *: add definitions for mac filter APIs + * + * Revision 1.38 2005/09/09 06:11:05 shliu + * *: add an API of add generic proto stack action + * + * Revision 1.37 2005/09/07 09:54:21 chenyl + * +: set pure-sw forwarding via http-daemon + * + * Revision 1.36 2005/08/04 06:50:15 shliu + * *: add getChipVersion system call + * + * Revision 1.35 2005/08/03 07:35:07 rupert + * +: Add IOCTL for rtl8651a_addAclRuleExt and rtl8651a_delAclRuleExt + * + * Revision 1.34 2005/07/29 09:44:00 chenyl + * +: dns module in ROMEDRV + * +: domain blocking (SDK + RomeDrv) + * + * Revision 1.33 2005/06/07 14:44:50 shliu + * *: add rtl8651_addDriverNaptMapping() API. + * + * Revision 1.32 2005/06/01 07:10:22 tony + * *:add a addarp ioctl + * + * Revision 1.31 2005/05/04 02:42:00 shliu + * *: define reinit ROMEDRV for ioctl case + * + * Revision 1.30 2005/01/18 13:33:37 ghhuang + * *: Replace Diffserv API + * + * Revision 1.29 2005/01/18 08:50:22 ghhuang + * +: Diffserv (DSCP) remarking support + * + * Revision 1.28 2005/01/11 03:22:55 ghhuang + * *:MNQ bug fix - Correct ACL undeletion + * + * Revision 1.27 2005/01/03 02:52:22 tony + * +: add API: rtl8651_queryUpnpMapTimeAge + * + * Revision 1.26 2004/12/22 08:41:49 tony + * *: support for alg qos + * + * Revision 1.25 2004/12/02 03:08:37 yjlou + * +: support IPX/Netbios Passthru function + * + * Revision 1.24 2004/11/01 08:22:21 tony + * *: support for rtl8651_addProtoStackServerPortRange + * + * Revision 1.23 2004/10/21 11:48:39 chenyl + * +: web-based icmp/l4 protocol DMZ forwarding + * + * Revision 1.22 2004/10/11 05:20:27 yjlou + * +: add RTL8651_IOCTL_ENABLE_DROP_UNKNOWN_PPPOE_DROP + * + * Revision 1.21 2004/10/05 09:20:42 chenyl + * +: web page to turn ON/OFF ip-multicast system + * + * Revision 1.20 2004/10/01 08:37:32 yjlou + * +: RTL8651_IOCTL_ENABLE_PPPOE_PASSTHRU and RTL8651_IOCTL_ENABLE_IPV6_PASSTHRU + * + * Revision 1.19 2004/09/23 08:29:33 tony + * new features: when wan port's link is changed, the DHCPC will auto renew. + * + * Revision 1.18 2004/09/15 14:52:19 chenyl + * *: enable multicast upload cache + * *: modify PPTP's default MTU + * + * Revision 1.17 2004/09/03 03:00:09 chhuang + * +: add new feature: pseudo VLAN + * + * Revision 1.16 2004/09/02 06:15:38 chenyl + * *: multicast : + * - when turning-on ip-multicast, periodic query will be sent immediately + * +: tbldrv + * - add options when run addNaptConnection + * - PURE_SW: pure software entry + * - DONT_CHECK_INTIP: ignore internal IP checking + * - TO_PROTOCOL_STACK: this napt packet must be trapped to protocol stack + * +: forwarding engine: + * - protocol stack TCP/UDP flow cache + * - napt redirect register/unregister/query + * + * Revision 1.15 2004/08/20 12:29:17 cfliu + * +: Add loose UDP ctrl item + * + * Revision 1.14 2004/08/18 05:39:59 chenyl + * +: napt special option web-based setting + * + * Revision 1.13 2004/07/27 10:48:52 cfliu + * *: Fix all compile warnings + * + * Revision 1.12 2004/07/27 03:06:16 chenyl + * +: Add DoS ignore type setting ioctl items + * + * Revision 1.11 2004/07/19 02:12:26 chhuang + * *: modify M-N-1 queue + * + * Revision 1.10 2004/07/14 13:55:59 chenyl + * +: web page for MN queue + * + * Revision 1.9 2004/07/12 04:25:36 chenyl + * *: extend existing port scan mechanism + * + * Revision 1.8 2004/07/08 10:58:40 tony + * +: add new ioctl api. + * + * Revision 1.7 2004/07/06 07:22:13 chhuang + * +: add rate limit + * + * Revision 1.6 2004/06/29 07:37:13 chenyl + * +: igmp-proxy filter + * + * Revision 1.5 2004/06/21 03:49:17 chhuang + * +: define RTL8651_IOCTL_NETMTU + * + * Revision 1.4 2004/06/16 04:43:11 tony + * *: support reboot and get loader version for MMU. + * + * Revision 1.3 2004/06/14 09:05:40 rupert + * *: serial definition + * + * Revision 1.58 2004/06/11 11:07:17 cfliu + * +: Add Cable meter and Interface counter webpage + * + * Revision 1.57 2004/05/31 14:41:04 jzchen + * Add Counter setting IO control definition + * + * Revision 1.56 2004/05/28 06:11:51 yjlou + * +: add IOCTL for rtl8651_addProtocolBasedNAT() and rtl8651_delProtocolBasedNAT() + * + * Revision 1.55 2004/05/27 05:14:18 cfliu + * Remove INIT_HARDWARE + * + * Revision 1.54 2004/05/20 08:45:49 chhuang + * add Web Page for QoS + * + * Revision 1.53 2004/05/19 08:49:22 orlando + * add RTL8651_IOCTL_DIAG_LED + * + * Revision 1.52 2004/05/17 07:22:16 tony + * fix pppoe silent timeout bug and make PPTP/L2TP support silent timeout. + * + * Revision 1.51 2004/05/14 10:18:15 orlando + * add RTL8651_IOCTL_DIAG_LED + * + * Revision 1.50 2004/05/12 07:20:15 chenyl + * +: source ip blocking + * *: modify dos mechanism + * + * Revision 1.49 2004/05/10 05:53:45 chhuang + * add new IOCTL: RTL8651_IOCTL_ADDURLFILTER + * + * Revision 1.48 2004/05/05 08:27:07 tony + * new features: add remote management spec + * + * Revision 1.47 2004/04/29 05:47:52 chhuang + * add new ioctl for rtl8651_addNaptMappingExt() + * + * Revision 1.46 2004/04/27 07:05:02 chenyl + * +: ioctl number: RTL8651_IOCTL_SETDEFAULTIGMPUPSTREAM + * + * Revision 1.45 2004/04/19 13:45:18 tony + * add resetPptpProprity and resetL2tpProprity IOCTL. + * + * Revision 1.44 2004/04/14 02:45:50 tony + * add ioctl RTL8651_IOCTL_SETLOOPBACKPORTPHY + * + * Revision 1.43 2004/04/13 08:15:53 tony + * fix bug: make PPTP/L2TP run stably. + * + * Revision 1.42 2004/04/09 02:26:12 tony + * remove rtl8651_specifyNetworkIntfLinkLayerType_1 IOCTL. + * + * Revision 1.41 2004/04/08 13:18:12 tony + * add PPTP/L2TP routine for MII lookback port. + * + * Revision 1.40 2004/04/08 12:25:42 cfliu + * Add del ACL ioctl() + * + * Revision 1.39 2004/02/24 05:12:33 cfliu + * Add symbols required for WLAN HW acceleration code + * + * Revision 1.38 2004/02/10 13:00:34 orlando + * add lanType field in pppoeCfg_t + * + * Revision 1.37 2004/02/09 09:18:00 tony + * add function: user is able to add protocol stack Server used TCP ports by + * rtl8651_addProtoStackServerUsedTcpPort(incoming_src_port); and flush the + * table by rtl8651_flushProtoStackServerUsedTcpPort(); + * + * Revision 1.36 2004/02/04 06:24:19 rupert + * Add UDP IOCTL + * + * Revision 1.35 2004/01/29 09:38:02 tony + * add case RTL8651_IOCTL_ADDNAPTSERVERPORTRANGE ,RTL8651_IOCTL_DELNAPTSERVERPORTRANGE + * + * Revision 1.34 2004/01/29 02:03:34 orlando + * correct duplicate conflicts + * + * Revision 1.33 2004/01/27 02:03:04 tony + * add RTL8651_IOCTL_FLUSHNAPTSERVERPORTBYEXTIP + * + * Revision 1.32 2004/01/12 12:32:23 orlando + * add RTL8651_IOCTL_SETPPPOEDEFAULTDIALSESSIONID + * + * Revision 1.31 2003/12/12 02:40:44 tony + * add rtl8651_setMtu() function. + * + * Revision 1.30 2003/12/10 03:08:58 tony + * make logging function support time zone in kernel space. + * + * Revision 1.29 2003/12/08 13:53:25 orlando + * add RTL8651_IOCTL_ENABLELOGGING + * + * Revision 1.28 2003/12/04 10:39:02 hiwu + * add RTL8651_ADDNAPTUPNPPORTMAPPING + * add RTL8651_DELNAPTUPNPPORTMAPPING + * + * Revision 1.27 2003/12/03 14:29:07 cfliu + * comment out old debug commands when CLE is enabled. + * + * Revision 1.26 2003/12/02 10:24:47 tony + * Add Routine: support DoS is able to set threshold by user(Webs GUI). + * + * Revision 1.25 2003/12/01 12:35:52 tony + * make ALG is able to be configured by users(Web GUI). + * + * Revision 1.24 2003/11/28 01:38:17 rupert + * add PPPOEUP_CFG PPPOEDOWN_CFG BATCH IOCTL + * + * Revision 1.23 2003/11/21 01:56:47 tony + * add function: user is able to add protocol stack used UDP ports by + * rtl8651_addProtoStackUsedUdpPort(incoming_src_port); + * + * Revision 1.22 2003/11/18 13:28:28 rupert + * add ioctl for dial demand and timeout + * + * Revision 1.21 2003/11/18 09:04:47 tony + * add routine: support mtu configure by user in pppoe. + * + * Revision 1.20 2003/11/06 12:15:56 rupert + * add delete policy route ioctl + * + * Revision 1.19 2003/10/30 10:20:49 orlando + * add definitions for command "addflow" + * + * Revision 1.18 2003/10/28 09:58:35 rupert + * add policy route + * + * Revision 1.17 2003/10/28 08:32:36 orlando + * add RTL8651_IOCOL_ENABLENAPTAUTOADD + * + * Revision 1.16 2003/10/24 13:37:42 orlando + * add debug command "dhs","dftcp","dficmp" + * + * Revision 1.15 2003/10/24 10:25:58 tony + * add DoS attack interactive webpage, + * FwdEngine is able to get WAN status by rtl8651_wanStatus(0:disconnect,1:connect) + * + * Revision 1.14 2003/10/20 10:13:08 orlando + * add define for debug command "dl2","dgidx","dfwd" + * + * Revision 1.13 2003/10/20 04:52:11 orlando + * add _RTL_LOGGING related stuff + * + * Revision 1.12 2003/10/09 13:23:44 tony + * TRIGGER_PORT: add function rtl8651_flushTriggerPortRules,rtl8651_addTriggerPortRule + * + * Revision 1.11 2003/10/01 09:43:12 orlando + * add RTL8651_IOCTL_SETPPPOESESSIONHANGUP + * + * Revision 1.10 2003/10/01 06:17:57 orlando + * add cvs file header + * + */ + + +#ifndef _LINUX_IF_RE865X_H +#define _LINUX_IF_RE865X_H + +#include <linux/types.h> +#include <linux/config.h> +#define RE865X_VERSION 1 + +#define GET_VERSION 0 +#define ADD_VLAN 2 +#define DEL_VLAN 3 +#define ADD_IF 5 +#define SET_VLAN_IP 6 +#define SET_NET_PARA 7 +#define ADD_GW 8 +#define GET_IF 9 +#define CON_IFF 10 +#define GET_MAC 11 +#define SET_EXT_INTERFACE 12 +#define GET_VLAN_STAT 13 +#define DEL_VLAN_IP 14 +#define SET_VLAN_TYPE 15 +#define GET_IP 16 +#define SET_VLAN_PPPOE_PARA 17 +#define SET_DNS_GW 18 +#define GET_PPPOE_STATUS 19 +#define DEL_PPPOE 20 +#define SET_PPPOE_STATUS 21 +#define SET_PPPOE_IP 22 +#define SET_PPPD_IDLE_TIME 23 +#define GET_PPPD_IDLE_TIME 24 + +#define RTL8651_FLUSHACLRULE 50 +#define RTL8651_SETDEFAULTACL 51 +#define RTL8651_ADDACL 52 +#define RTL8651_ADDNAPTSERVERPORTMAPPING 53 +#define RTL8651_DELNAPTSERVERPORTMAPPING 54 +#define SET_SOFTPPPD_IDLE_TIME 55 +#define ADD_SIGNAL_RECEIVE_PROCESS 56 +#define ADD_DEMAND_ROUTE 57 +#define PPPOEDOWN_CFG 58 +#define PPPOEUP_CFG 59 +#define RTL8651_ADDNAPTUPNPPORTMAPPING 60 +#define RTL8651_DELNAPTUPNPPORTMAPPING 61 +#define RTL8651_DELACL 62 +#define RTL8651_IOCTL_DIAG_LED 63 + + +/* start new naming conventions 2003/09/16 */ +#define RTL8651_IOCTL_SETPPPOESESSIONPROPERTY 2000 +#define RTL8651_IOCTL_RESETPPPOESESSIONPROPERTY 2001 +#define RTL8651_IOCTL_BINDPPPOESESSION 2002 +#define RTL8651_IOCTL_ADDPPPOESESSION 2003 +#define RTL8651_IOCTL_DELPPPOESESSION 2004 +#define RTL8651_IOCTL_ADDIPINTF 2005 +#define RTL8651_IOCTL_DELIPINTF 2006 +#define RTL8651_IOCTL_ADDNAPTMAPPING 2007 +#define RTL8651_IOCTL_DELNAPTMAPPING 2008 +#define RTL8651_IOCTL_ADDEXTNETWORKINTERFACE 2009 +#define RTL8651_IOCTL_ADDROUTE 2010 +#define RTL8651_IOCTL_DELROUTE 2011 +#define RTL8651_IOCTL_ADDNATMAPPING 2014 +#define RTL8651_IOCTL_DELNATMAPPING 2015 +#define RTL8651_IOCTL_ADDNATMAPPING 2014 +#define RTL8651_IOCTL_DELNATMAPPING 2015 +#define RTL8651_IOCTL_ADDNETWORKINTF 2016 +#define RTL8651_IOCTL_DELNETWORKINTF 2017 +#define RTL8651_IOCTL_SPECIFYNETWORKINTFLINKLAYERTYPE 2018 +#define RTL8651_IOCTL_SETASICNAPTAUTOADDDELETE 2019 +#define RTL8651_IOCTL_ADDIPUNNUMBERED 2020 +#define RTL8651_IOCTL_DELIPUNNUMBERED 2021 +#define RTL8651_IOCTL_SETLANSIDEEXTERNALIPINTERFACE 2022 +#define RTL8651_IOCTL_ADDDMZHOST 2023 +#define RTL8651_IOCTL_DELDMZHOST 2024 +#define RTL8651_IOCTL_ADDURLFILTERSTRING 2025 +#define RTL8651_IOCTL_DELURLFILTERSTRING 2026 +#define RTL8651_IOCTL_SETPPPOESESSIONHANGUP 2027 +#define RTL8651_IOCTL_FLUSHTRIGGERPORTRULES 2028 +#define RTL8651_IOCTL_ADDTRIGGERPORTRULE 2029 +#define RTL8651_IOCTL_INSTALLLOGGINGFUNCTION 2030 +#define RTL8651_IOCTL_SETWANSTATUS 2031 +#define RTL8651_IOCTL_SETDOSSTATUS 2032 +#define RTL8651_IOCTL_ENABLENAPTAUTOADD 2033 +#define RTL8651_IOCTL_ADDNAPTCONNECTION 2034 +#define RTL8651_IOCTL_ADDPOLICYROUTE 2035 +#define RTL8651_IOCTL_FLUSHPOLICYROUTE 2036 +#define RTL8651_IOCTL_SETPPPOEMTU 2037 +#define RTL8651_IOCTL_ADDDEMANDROUTE 2038 +#define RTL8651_IOCTL_FLUSHDEMANDROUTE 2039 +#define RTL8651_IOCTL_FLUSHPROTOSTACKUSEDUDPPORTS 2040 +#define RTL8651_IOCTL_ADDPROTOSTACKUSEDUDPPORT 2041 +#define RTL8651_IOCTL_SETALGSTATUS 2042 +#define RTL8651_IOCTL_SETDOSTHRESHOLD 2043 +#define RTL8651_IOCTL_ENABLELOGGING 2044 +#define RTL8651_IOCTL_SETTIMEZONE 2045 +#define RTL8651_IOCTL_SETMTU 2046 +#define RTL8651_IOCTL_SETPPPOEDEFAULTDIALSESSIONID 2047 +#define RTL8651_IOCTL_FLUSHNAPTSERVERPORTBYEXTIP 2048 +#define RTL8651_IOCTL_ADDNAPTSERVERPORTRANGE 2049 +#define RTL8651_IOCTL_DELNAPTSERVERPORTRANGE 2050 +#define RTL8651_IOCTL_SETUDPSIZETHRESH 2051 +#define RTL8651_IOCTL_FLUSHPROTOSTACKSERVERUSEDTCPPORTS 2052 +#define RTL8651_IOCTL_ADDPROTOSTACKSERVERUSEDTCPPORT 2053 +#define RTL8651_IOCTL_SETLOOPBACKPORT 2054 +#define RTL8651_IOCTL_ADDSESSION 2055 +#define RTL8651_IOCTL_DELSESSION 2056 +#define RTL8651_IOCTL_BINDSESSION 2057 +#define RTL8651_IOCTL_SETPPTPPROPERTY 2059 +#define RTL8651_IOCTL_SETL2TPPROPERTY 2060 +#define RTL8651_IOCTL_SETLOOPBACKPORTPHY 2061 +#define RTL8651_IOCTL_SETDEFAULTIGMPUPSTREAM 2062 +#define RTL8651_IOCTL_RESETPPTPPROPERTY 2063 +#define RTL8651_IOCTL_RESETL2TPPROPERTY 2064 +#define RTL8651_IOCTL_ADDNAPTMAPPINGEXT 2065 +#define RTL8651_IOCTL_FLUSHPROTOSTACKACTIONS 2066 +#define RTL8651_IOCTL_ADDPROTOSTACKACTIONS 2067 +#define RTL8651_IOCTL_DELURLFILTER 2068 +#define RTL8651_IOCTL_ADDURLFILTER 2069 +#define RTL8651_IOCTL_SETPERSRCDOSTHRESHOLD 2070 +#define RTL8651_IOCTL_SETSOUCEIPBLOCKTIMEOUT 2071 +#define RTL8651_IOCTL_FREEBLOCKEDSOURCEIP 2072 +#define RTL8651_IOCTL_ENABLESOURCEIPBLOCK 2073 +#define RTL8651_IOCTL_ADDGENERICDMZHOST 2074 +#define RTL8651_IOCTL_ADDGENERICDMZFILTER 2075 +#define RTL8651_IOCTL_DELGENERICDMZFILTER 2076 +#define RTL8651_IOCTL_FLUSHGENERICDMZFILTER 2077 + +#define RTL8651_IOCTL_FLUSHABQOS 2704 +#define RTL8651_IOCTL_ADDPOLICYBASEDQOS 2705 +#define RTL8651_IOCTL_DELPOLICYBASEDQOS 27051 +#define RTL8651_IOCTL_SETFLOWCTRL 2706 +#define RTL8651_IOCTL_SETPRIORITYQUEUE 2707 +#define RTL8651_IOCTL_SETBANDWIDTHCTRL 2708 +#define RTL8651_IOCTL_ADDPBNAT 2709 +#define RTL8651_IOCTL_DELPBNAT 2710 +#define RTL8651_IOCTL_CFGCONTER 2711 +#define RTL8651_IOCTL_GETLINKSTATUS 2712 +#define RTL8651_IOCTL_GETCOUNTER 2713 +#define RTL8651_IOCTL_GETLDVER 2714 +#define RTL8651_IOCTL_REBOOT 2715 +#define RTL8651_IOCTL_SETNETMTU 2716 +#define RTL8651_IOCTL_ADDMULTICASTFILTER 2717 +#define RTL8651_IOCTL_DELMULITCASTFILTER 2718 +#define RTL8651_IOCTL_ADDRATELIMITGROUP 2719 +#define RTL8651_IOCTL_ADDRATELIMIT 2720 +#define RTL8651_IOCTL_FLUSHRATELIMITGROUP 2721 +#define RTL8651_IOCTL_REMOVENETWORKINTFLINKLAYERTYPE 2722 +#define RTL8651_IOCTL_DELEXTNETWORKINTERFACE 2723 +#define RTL8651_IOCTL_SETDOSSCANTRACKINGPARA 2724 +#define RTL8651_IOCTL_SETMNQUEUEUPSTREAMBW 2725 +#define RTL8651_IOCTL_ADDUNLIMITEDQUEUE 2726 +#define RTL8651_IOCTL_ADDLIMITEDQUEUE 2727 +#define RTL8651_IOCTL_ADDDOSIGNORETYPE 2728 +#define RTL8651_IOCTL_DELDOSIGNORETYPE 2729 +#define RTL8651_IOCTL_WEAKNAPTCTL 2730 +#define RTL8651_IOCTL_LOOSEUDPCTL 2731 +#define RTL8651_IOCTL_TCPNAPTSTATICPORTMAPPINGCTL 2732 +#define RTL8651_IOCTL_UDPNAPTSTATICPORTMAPPINGCTL 2733 +#define RTL8651_IOCTL_NAPTREDIRECT_REGISTER_RULE 2734 +#define RTL8651_IOCTL_NAPTREDIRECT_UNREGISTER_RULE 2735 +#define RTL8651_IOCTL_NAPTREDIRECT_QUERY_FLOW 2736 +#define RTL8651_IOCTL_ADDSUBVLAN 2737 +#define RTL8651_IOCTL_DELSUBVLAN 2738 +#define RTL8651_IOCTL_ADDEXTMCASTPORT 2739 +#define RTL8651_IOCTL_DELEXTMCASTPORT 2740 +#define RTL8651_IOCTL_SET_DHCPC_PID 2741 +#define RTL8651_IOCTL_ENABLE_PPPOE_PASSTHRU 2742 +#define RTL8651_IOCTL_ENABLE_IPV6_PASSTHRU 2743 +#define RTL8651_IOCTL_ENABLE_IPMULTICAST 2744 +#define RTL8651_IOCTL_ENABLE_DROP_UNKNOWN_PPPOE_DROP 2745 +#define RTL8651_IOCTL_SETDMZHOSTL4FWD 2746 +#define RTL8651_IOCTL_SETDMZHOSTICMPFWD 2747 +#define RTL8651_IOCTL_ADDPROTOSTACKSERVERPORTRANGE 2748 +#define RTL8651_IOCTL_ENABLE_IPX_PASSTHRU 2749 +#define RTL8651_IOCTL_ENABLE_NETBIOS_PASSTHRU 2750 +#define RTL8651_IOCTL_RTL8651_SETALGQOSQUEUEID 2751 +#define RTL8651_IOCTL_DELRATELIMITGROUP 2752 +#define RTL8651_IOCTL_GETMNQUEUEENTRY 2753 +#define RTL8651_IOCTL_DELRATELIMITRULE 2754 +#define RTL8651_IOCTL_QUERYUPNPMAPTIMEAGE 2755 +#define RTL8651_IOCTL_DELFLOWFROMMNQUEUE 2756 +#define RTL8651_IOCTL_SETDSCPTOMNQUEUE 2757 +#define RTL8651_IOCTL_TBLDRVREINIT 2758 +#define RTL8651_IOCTL_FWDENGREINIT 2759 +#define RTL8651_IOCTL_FWDENGDROPPKTCASE 2760 +#define RTL8651_IOCTL_ADDARP 2761 +#define RTL8651_IOCTL_ADDDRIVERNAPTMAPPING 2762 +#define RTL8651_IOCTL_ADDDOMAINBLOCKINGENTRY 2763 +#define RTL8651_IOCTL_FLUSHDOMAINBLOCKINGENTRY 2764 +#define RTL8651_IOCTL_ADDACLEXT 2765 +#define RTL8651_IOCTL_DELACLEXT 2766 +#define RTL8651_IOCTL_GETCHIPVERSION 2767 +#define RTL8651_IOCTL_L34PURESOFTWAREPROCESS 2768 +#define RTL8651_IOCTL_ADDGENERICPROTOSTACKACTIONS 2769 +#define RTL8651_IOCTL_ADDMACACCESSCONTROL 2770 +#define RTL8651_IOCTL_ENABLEMACACCESSCONTROL 2771 +#define RTL8651_IOCTL_DELGENERICPROTOSTACKACTIONS 2772 +#define RTL8651_IOCTL_DELPROTOSTACKACTIONS 2773 +#define RTL8651_IOCTL_DELPROTOSTACKSERVERPORTRANGE 2774 +#define RTL8651_IOCTL_REPROBE 2775 +#define RTL8651_IOCTL_KERNELMUTEXLOCK 2776 +#define RTL8651_IOCTL_KERNELMUTEXUNLOCK 2777 +#define RTL8651_IOCTL_KERNELGETLOG 2778 +#define RTL8651_IOCTL_KERNELCLRLOG 2779 +#define RTL8651_IOCTL_ADDURLFILTERTRUSTEDUSER 2780 +#define RTL8651_IOCTL_FLUSHURLFILTERTRUSTEDUSER 2781 +#define RTL8651_IOCTL_ADDGENERICURLFILTERRULE 2782 +#define RTL8651_IOCTL_DELGENERICURLFILTERRULE 2783 +#define RTL8651_IOCTL_URLUNKNOWNTYPECASESENSITIVE 2784 +#define RTL8651_IOCTL_SETURLDEFAULTACTION 2785 +#define RTL8651_IOCTL_ENABLEPBNAT 2786 +#define RTL8651_IOCTL_FLUSHURLFILTERRULE 2787 +#define RTL8651_IOCTL_SETURLFORWARDLOGGING 2788 +#define RTL8651_IOCTL_GETNATTYPE 2789 +#define RTL8651_IOCTL_SETNATTYPE 2790 +#define RTL8651_IOCTL_KERNELPROC 2791 +#define RTL8651_IOCTL_ADDDOMAINADVROUTEENTRY 2792 +#define RTL8651_IOCTL_CHANGESESSIONPROPERTY 2793 +#define RTL8651_IOCTL_DELPOLICYORDEAMANDROUTEBYSESSIONID 2794 +#define RTL8651_IOCTL_REINITROUTELIST 2795 +#define RTL8651_IOCTL_MANUALKEYFLAGSEND 2796 +#define RTL8651_IOCTL_ENABLE_UNNUMBERNAPTPROC 2797 +#define RTL8651_IOCTL_GETEXTDEVNAMEANDVID 2798 +#define RTL8651_IOCTL_SETMCASTDETAILUPSTREAM 2799 + +#define RTL8651_IOCTL_SETVLANPROMISCUOUS 2800 +#define RTL8651_IOCTL_SETNAPTTCPUDPPORTRANGE 2801 +#define RTL8651_IOCTL_SETMULTIPPPOESESSIONSTATUS 2802 + + +#if 1 +/*865xc igmp snooping,2007-03-05*/ +/*for igmp proxy to snooping, by qjj, 2006-11-28*/ +#define RTL8651_IOCTL_SETIPMULTICASTMODE 2803 +#define RTL8651_IOCTL_SETSTATICROUTER 2804 +#define RTL8651_IOCTL_REMOVESTATICROUTER 2805 +#endif +#define RTL8651_IOCTL_SETVLANPORTUNTAG 2807 +#define RTL8651_IOCTL_GETL2TABLE 2808 + +#define RTL8651_IOCTL_SETOUTPUTQUEUEWANPORT 2809 +#define RTL8651_IOCTL_SETOUTPUTQUEUEPARA 2810 +#define RTL8651_IOCTL_SETDEFAULTQUEUERATIO 2811 + +#ifdef CONFIG_RTL865XC +#define RTL8651_IOCTL_CLEARASICCOUNTER 2812 +#endif + +#ifdef CONFIG_RTL865XC +#define RTL8651_IOCTL_QOSINIT 2900 +#define RTL8651_IOCTL_QOSADDFLOW 2901 +#define RTL8651_IOCTL_QOSDELFLOW 2902 +#define RTL8651_IOCTL_QOSFLUSHFLOW 2903 +#define RTL8651_IOCTL_QOSSETREMARK 2904 +#endif + +enum PORT_BITS +{ + CPU_PORT = 1 << 6, + PORTMII = 1<<5, + PORT5 = 1 << 4, + PORT4 = 1 << 3, + PORT3 = 1 << 2, + PORT2 = 1 << 1, + PORT1 = 1 << 0, +}; +#define EXTERNAL_INTERFACE 1 +#define RTL8651_LL_VLAN 0x01 +#define RTL8651_LL_PPPOE 0x02 +#define LL_VLAN RTL8651_LL_VLAN +#define LL_PPPOE RTL8651_LL_PPPOE +#define LL_PPTP RTL8651_LL_PPTP +#define LL_L2TP RTL8651_LL_L2TP + +/* Debug Command */ +#ifndef CONFIG_RTL865X_CLE +#define DUMP_PPPOE 3000 +#define DUMP_VLAN 3001 +#define DUMP_L3 3002 +#define DUMP_TCP 3003 +#define DUMP_ICMP 3004 +#define DUMP_ALG 3005 +#define DUMP_IP 3006 +#define DUMP_PVID 3007 +#define DUMP_TRAP 3008 +#define DUMP_ARP 3009 +#define DUMP_ACL 3011 +#define DUMP_SEVERPORT 3012 +#define DUMP_GIDX 3013 +#define DUMP_FWD 3014 +#define DUMP_L2 3015 +#define DUMP_HS 3016 +#define DUMP_FTCP 3017 +#define DUMP_FICMP 3018 +#define ADDSTATICNAPTFLOW 3019 +#endif /*CONFIG_RTL865X_CLE*/ + +typedef struct +{ + unsigned char defaultSession; /* default pppoe session */ + unsigned short sessionId; /* pppoe session id */ + unsigned int silentTimeout; /* in seconds */ + unsigned char ipAddr[4]; /* ip address, for multiple pppoe only */ + unsigned char ipMask[4]; /* network mask, for multiple pppoe only */ + unsigned char gwAddr[4]; /* default gateway address, for multiple pppoe only */ + unsigned char svrMac[6]; /* pppoe server mac address */ + unsigned int lanType; +} pppoeCfg_t; + +#endif diff --git a/target/linux/realtek/files/include/asm-mips/rtl865x/rtl865xc_asicregs.h b/target/linux/realtek/files/include/asm-mips/rtl865x/rtl865xc_asicregs.h new file mode 100644 index 000000000..a2c33816c --- /dev/null +++ b/target/linux/realtek/files/include/asm-mips/rtl865x/rtl865xc_asicregs.h @@ -0,0 +1,3483 @@ + +/* +* ---------------------------------------------------------------- +* Copyright c Realtek Semiconductor Corporation, 2002 +* All rights reserved. +* +* $Header: /home1/sub1/tmp/cvs2svn/skylark/skylark/skylark/linux-2.6.x/drivers/net/re865x/AsicDriver/rtl865xc_asicregs.h,v 1.3 2008-02-28 11:06:35 alva_zhang Exp $ +* +* Abstract: ASIC specific definitions. +* +* $Author: alva_zhang $ +* +* --------------------------------------------------------------- +*/ +#ifndef _ASICREGS_H +#define _ASICREGS_H + +/* + * Just for check menuconfig .... + */ +#if defined(CONFIG_RTL_819X) +#else + #error You must choice either 865xB or 865xC in 'make menuconfig'. +#endif + +#undef SWTABLE_NO_HW + +/* Basic features +*/ +#ifdef CONFIG_RTL8196B +#define MAX_PORT_NUMBER 5 +#else +#define MAX_PORT_NUMBER 6 +#endif +#define PORT_NUM_MASK 7 +#define ALL_PORT_MASK 0x3F + +#define TABLE_ENTRY_DISTANCE (8 * sizeof(uint32)) +#define SWTABLE_BASE_OF_ALL_TABLES 0xbb000000 +#define table_access_addr_base(type) (SWTABLE_BASE_OF_ALL_TABLES + 0x10000 * (type)) + +/* Filtering Database features */ +#define RTL865XC_FID_BITMASK 0x3 + +/* Register access macro (REG*()). +*/ +#ifndef REG32 +#define REG32(reg) (*((volatile uint32 *)(reg))) +#endif +#ifndef REG16 +#define REG16(reg) (*((volatile uint16 *)(reg))) +#endif +#ifndef REG8 +#define REG8(reg) (*((volatile uint8 *)(reg))) +#endif + +/* Register access macro (READ_MEM32() and WRITE_MEM32()). */ +#if defined(RTL865X_MODEL_USER)||defined(RTL865X_TEST) +/* + * big_endian() is a macro to make endian consistence between 865x board and x86 PC. + * All the ASIC registers stored in memory will be stored at big-endian order. + * Therefore, we will see the same result when memory dump ASIC registers. + * + * big_endian32() and big_endian16() are like ntohs() and ntohl(). + * In order to reduce the complexity of include hirerachy, we don't use ntohs-related functions. + */ +#define big_endian32(x) ((((x)&0xff000000)>>24)|(((x)&0x00ff0000)>>8)|(((x)&0x0000ff00)<<8)|(((x)&0x000000ff)<<24)) +#define big_endian16(x) (((x)>>8)|(((x)&0x000000ff)<<8)) +#define big_endian(x) big_endian32(x) /* backward-compatible */ +#else +#define big_endian32(x) (x) +#define big_endian16(x) (x) +#define big_endian(x) big_endian32(x) /* backward-compatible */ +#endif + +#if defined(RTL865X_MODEL_USER)||defined(RTL865X_MODEL_KERNEL) +void WRITE_MEM32(uint32 reg, uint32 val); +void WRITE_MEM16(uint32 reg, uint32 val); +void WRITE_MEM8(uint32 reg, uint32 val); +uint32 READ_MEM32(uint32 reg); +uint32 READ_MEM16(uint32 reg); +uint32 READ_MEM8(uint32 reg); +void WRITE_VIR32(uint32 reg, uint32 val); +void WRITE_VIR16(uint32 reg, uint32 val); +void WRITE_VIR8(uint32 reg, uint32 val); +uint32 READ_VIR32(uint32 reg); +uint32 READ_VIR16(uint32 reg); +uint32 READ_VIR8(uint32 reg); +#else +/* Target Platform, RTL865X_TEST */ +#ifndef WRITE_MEM32 +#define WRITE_MEM32(reg,val) REG32(reg)=big_endian(val) +#endif + +#ifndef WRITE_MEM16 +#define WRITE_MEM16(reg,val) REG16(reg)=big_endian16(val) +#endif + +#ifndef WRITE_MEM8 +#define WRITE_MEM8(reg,val) REG8(reg)=(val) +#endif + +#ifndef READ_MEM32 +#define READ_MEM32(reg) big_endian(REG32(reg)) +#endif + +#ifndef READ_MEM16 +#define READ_MEM16(reg) big_endian16(REG16(reg)) +#endif + +#ifndef READ_MEM8 +#define READ_MEM8(reg) (REG8(reg)) +#endif +#endif + +#ifdef CONFIG_RTL8196C_REVISION_B +#define TOGGLE_BIT_IN_REG(reg, bit_shift) (WRITE_MEM32(reg, READ_MEM32(reg) ^ bit_shift)) +#define TOGGLE_BIT_IN_REG_TWICE(reg, bit_shift) \ + do{ \ + TOGGLE_BIT_IN_REG(reg, bit_shift); \ + TOGGLE_BIT_IN_REG(reg, bit_shift); \ + } while (0) +#else +#define TOGGLE_BIT_IN_REG_TWICE(reg, bit_shift) +#endif + + +#define RTL_R32(addr) (*(volatile unsigned long *)(addr)) +#define RTL_W32(addr, l) ((*(volatile unsigned long*)(addr)) = (l)) +#define RTL_R8(addr) (*(volatile unsigned char*)(addr)) +#define RTL_W8(addr, l) ((*(volatile unsigned char*)(addr)) = (l)) + +/* MACRO to update HW configuration */ +#define UPDATE_MEM32(reg, val, mask, offset) \ + do{ \ + WRITE_MEM32( (reg), \ + ((READ_MEM32(reg) & ~((mask) << (offset))) | (((val) & (mask)) << (offset))));\ + } while (0) + +/* MACRO to get value of HW configuration */ +#define GET_MEM32_VAL(reg, mask, offset) ((READ_MEM32(reg) >> (offset)) & (mask)) + +#define DIVISOR 1000 /* cfliu: change DIVISOR from 0xe to 4096 for watchdog */ + /* yjlou: change DIVISOR from 4096 to 100 for better resolution. */ + /* yjlou: change DIVISOR from 100 to 1000 for longer watchdog trigger. */ + /* cfliu: change DIVISOR back to 4000 to let printk happy. */ + +#define REAL_SWCORE_BASE 0xBB800000 +#define REAL_SYSTEM_BASE 0xB8000000 +#define REAL_HSB_BASE 0xBB806280 +#define REAL_HSA_BASE 0xBB806200 +#define REAL_SWTBL_BASE 0xBB000000 + +#if defined(RTL865X_TEST) || defined(RTL865X_MODEL_USER) || defined(RTL865X_MODEL_KERNEL) +#define VIRTUAL_SWCORE_REG_SIZE (1*64*1024) /* said, BB80_xxxx */ +#define VIRTUAL_SYSTEM_REG_SIZE (2*64*1024) /* said, B800_xxxx */ +#define VIRTUAL_SWCORE_TBL_SIZE (1*1024*1024+256*1024) /* said, BB00_xxxx */ +extern int8 *pVirtualSWReg; +extern int8 *pVirtualSysReg; +extern int8 *pVirtualHsb; +extern int8 *pVirtualHsa; +extern int8 *pVirtualSWTable; +#define SWCORE_BASE ((uint32)pVirtualSWReg) +#define SWCORE_SIZE VIRTUAL_SWCORE_REG_SIZE +#define SYSTEM_BASE ((uint32)pVirtualSysReg) +#define SYSTEM_SIZE (VIRTUAL_SYSTEM_REG_SIZE) +#define HSB_BASE ((uint32)pVirtualHsb) +#define HSB_SIZE 0x40 +#define HSA_BASE ((uint32)pVirtualHsa) +#define HSA_SIZE 0x40 +#else +#define SWCORE_BASE REAL_SWCORE_BASE +#define SYSTEM_BASE REAL_SYSTEM_BASE +#define HSB_BASE REAL_HSB_BASE +#define HSA_BASE REAL_HSA_BASE +#endif + +#ifdef CONFIG_RTL_8198 +#define PIN_MUX_SEL_2 (SYSTEM_BASE + 0x0044) +#endif + +#ifndef REVR +#define REVR (SYSTEM_BASE + 0x00000000) +#endif + +#ifndef RTL8196C_REVISION_A +#define RTL8196C_REVISION_A 0x80000001 +#endif + +#ifndef RTL8196C_REVISION_B +#define RTL8196C_REVISION_B 0x80000002 +#endif + +/* Table access and CPU interface control registers +*/ +#define TACI_BASE (SWCORE_BASE + 0x00004D00) +#define SWTACR (0x000 + TACI_BASE) /* Table Access Control */ +#define SWTASR (0x004 + TACI_BASE) /* Table Access Status */ +#define SWTAA (0x008 + TACI_BASE) /* Table Access Address */ +#define TCR0 (0x020 + TACI_BASE) /* Table Access Control 0 */ +#define TCR1 (0x024 + TACI_BASE) /* Table Access Control 1 */ +#define TCR2 (0x028 + TACI_BASE) /* Table Access Control 2 */ +#define TCR3 (0x02C + TACI_BASE) /* Table Access Control 3 */ +#define TCR4 (0x030 + TACI_BASE) /* Table Access Control 4 */ +#define TCR5 (0x034 + TACI_BASE) /* Table Access Control 5 */ +#define TCR6 (0x038 + TACI_BASE) /* Table Access Control 6 */ +#define TCR7 (0x03C + TACI_BASE) /* Table Access Control 7 */ +/* Table access control register field definitions +*/ +#define ACTION_MASK 1 +#define ACTION_DONE 0 +#define ACTION_START 1 +#define CMD_MASK (7 << 1) +#define CMD_ADD (1 << 1) +#define CMD_MODIFY (1 << 2) +#define CMD_FORCE (1 << 3) +#define STOP_TLU_READY (1<<19) +#define EN_STOP_TLU (1<<18) +/* Table access status register field definitions +*/ +#define TABSTS_MASK 1 +#define TABSTS_SUCCESS 0 +#define TABSTS_FAIL 1 +/* Vlan table access definitions +*/ +#define STP_DISABLE 0 +#define STP_BLOCK 1 +#define STP_LEARN 2 +#define STP_FORWARD 3 +/* Protocol trapping table access definitions +*/ +#define TYPE_TRAP_ETHERNET 0x00 +#define TYPE_TRAP_IP 0x02 +#define TYPE_TRAP_TCP 0x05 +#define TYPE_TRAP_UDP 0x06 +/* L3 Routing table access definitions +*/ +#define PROCESS_PPPOE 0x00 +#define PROCESS_DIRECT 0x01 +#define PROCESS_INDIRECT 0x02 +#define PROCESS_S_CPU 0x04 +#define PROCESS_NXT_HOP 0x05 +#define PROCESS_S_DROP 0x06 +#define PROCESS_N_DROP 0x07 +/* ACL table access definitions +*/ +#define RULE_ETHERNET 0 +#define RULE_IP 2 +#define RULE_IFSEL 3 +#define RULE_ICMP 4 +#define RULE_IGMP 5 +#define RULE_TCP 6 +#define RULE_UDP 7 +#define RULE_SRC_FILTER 8 +#define RULE_DST_FILTER 9 +#define ACTION_PERMIT 0 +#define ACTION_REDIRECT 1 +#define ACTION_S_DROP 2 +#define ACTION_S_CPU 3 +#define ACTION_N_DROP 4 +#define ACTION_N_CPU 5 +#define ACTION_CPU_FOR_LOGGING 5 +#define ACTION_MIRROR 6 +#define ACTION_PPPOE_REDIRECT 7 +#define ACTION_DEFAULT_REDIRECT 8 +#define ACTION_DEFAULT_MIRROR 9 +#define ACTION_DROP_RATE_PPS 10 +#define ACTION_LOG2CPU_RATE_PPS 11 +#define ACTION_DROP_RATE_BPS 12 +#define ACTION_LOG2CPU_RATE_BPS 13 + + + +/* MIB counter registers +*/ +#define MIB_COUNTER_BASE (SWCORE_BASE + 0x00001000) +#define MIB_CONTROL (0x00 + MIB_COUNTER_BASE) /*MIB control Register */ + +/* MIB counter registers +*/ +#define MIB_ADDROFFSETBYPORT 0x80 /* Address offset of the same counters of each port. Ex: P0's ifInOctets counter and P1's ifInOctets counter. */ +#define OFFSET_ETHERSTATSCPUEVENTPKT 0x84 +#define OFFSET_IFINOCTETS_P0 0x100 +#define OFFSET_IFINUCASTPKTS_P0 0x108 +#define OFFSET_ETHERSTATSOCTETS_P0 0x10C +#define OFFSET_ETHERSTATSUNDERSIZEPKTS_P0 0x114 +#define OFFSET_ETHERSTATSFRAGMEMTS_P0 0x118 +#define OFFSET_ETHERSTATSPKTS64OCTETS_P0 0x11C +#define OFFSET_ETHERSTATSPKTS65TO127OCTETS_P0 0x120 +#define OFFSET_ETHERSTATSPKTS128TO255OCTETS_P0 0x124 +#define OFFSET_ETHERSTATSPKTS256TO511OCTETS_P0 0x128 +#define OFFSET_ETHERSTATSPKTS512TO1023OCTETS_P0 0x12C +#define OFFSET_ETHERSTATSPKTS1024TO1518OCTETS_P0 0x130 +#define OFFSET_ETHERSTATSOVERSIZEPKTS_P0 0x134 +#define OFFSET_ETHERSTATSJABBERS_P0 0x138 +#define OFFSET_ETHERSTATSMULTICASTPKTS_P0 0x13C +#define OFFSET_ETHERSTATSBROADCASTPKTS_P0 0x140 +#define OFFSET_DOT1DTPPORTINDISCARDS_P0 0x144 +#define OFFSET_ETHERSTATSDROPEVENTS_P0 0x148 +#define OFFSET_DOT3STATSFCSERRORS_P0 0x14C +#define OFFSET_DOT3STATSSYMBOLERRORS_P0 0x150 +#define OFFSET_DOT3CONTROLINUNKNOWNOPCODES_P0 0x154 +#define OFFSET_DOT3INPAUSEFRAMES_P0 0x158 +#define OFFSET_IFOUTOCTETS_P0 0x800 +#define OFFSET_IFOUTUCASTPKTS_P0 0x808 +#define OFFSET_IFOUTMULTICASTPKTS_P0 0x80C +#define OFFSET_IFOUTBROADCASTPKTS_P0 0x810 +#define OFFSET_IFOUTDISCARDS 0x814 +#define OFFSET_DOT3STATSSINGLECOLLISIONFRAMES_P0 0x818 +#define OFFSET_DOT3STATSMULTIPLECOLLISIONFRAMES_P0 0x81C +#define OFFSET_DOT3STATSDEFERREDTRANSMISSIONS_P0 0x820 +#define OFFSET_DOT3STATSLATECOLLISIONS_P0 0x824 +#define OFFSET_DOT3STATSEXCESSIVECOLLISIONS_P0 0x828 +#define OFFSET_DOT3OUTPAUSEFRAMES_P0 0x82C +#define OFFSET_DOT1DBASEPORTDELAYEXCEEDEDDISCARDS_P0 0x830 +#define OFFSET_ETHERSTATSCOLLISIONS_P0 0x834 +/* MIB control register field definitions +*/ +#define ALL_COUNTER_RESTART_MASK 0x0007ffff /* SYS_COUNTER_RESTART | IN_COUNTER_RESTART_P8 | ... | OUT_COUNTER_RESTART_P0 */ +#define SYS_COUNTER_RESTART (1 << 18) +#define IN_COUNTER_RESTART_P8 (1 << 17) +#define OUT_COUNTER_RESTART_P8 (1 << 16) +#define IN_COUNTER_RESTART_P7 (1 << 15) +#define OUT_COUNTER_RESTART_P7 (1 << 14) +#define IN_COUNTER_RESTART_P6 (1 << 13) +#define OUT_COUNTER_RESTART_P6 (1 << 12) +#define IN_COUNTER_RESTART_P5 (1 << 11) +#define OUT_COUNTER_RESTART_P5 (1 << 10) +#define IN_COUNTER_RESTART_P4 (1 << 9) +#define OUT_COUNTER_RESTART_P4 (1 << 8) +#define IN_COUNTER_RESTART_P3 (1 << 7) +#define OUT_COUNTER_RESTART_P3 (1 << 6) +#define IN_COUNTER_RESTART_P2 (1 << 5) +#define OUT_COUNTER_RESTART_P2 (1 << 4) +#define IN_COUNTER_RESTART_P1 (1 << 3) +#define OUT_COUNTER_RESTART_P1 (1 << 2) +#define IN_COUNTER_RESTART_P0 (1 << 1) +#define OUT_COUNTER_RESTART_P0 (1 << 0) + +#define PORT_FOR_COUNTING_OFFSET 24 /*8650 offset while 8650B offset is 21*/ + +#define CPU_EVENTS (0x074 + MIB_COUNTER_BASE) +#define EXT_PORT_FOR_COUNTING_MASK 0x00E00000 +#define EXT_PORT_FOR_COUNTING_OFFSET 21 +#define RX_BYTES_1 (0x080 + MIB_COUNTER_BASE) +#define RX_PKTS_1 (0x084 + MIB_COUNTER_BASE) +#define DROP_EVENTS_1 (0x088 + MIB_COUNTER_BASE) +#define CPU_EVENTS_1 (0x08C + MIB_COUNTER_BASE) +#define RX_BYTES_2 (0x090 + MIB_COUNTER_BASE) +#define RX_PKTS_2 (0x094 + MIB_COUNTER_BASE) +#define DROP_EVENTS_2 (0x098 + MIB_COUNTER_BASE) +#define CPU_EVENTS_2 (0x09C + MIB_COUNTER_BASE) +#define TX_BYTES_1 (0x0A0 + MIB_COUNTER_BASE) +#define TX_PKTS_1 (0x0A4 + MIB_COUNTER_BASE) +#define TX_BYTES_2 (0x0A8 + MIB_COUNTER_BASE) +#define TX_PKTS_2 (0x0AC + MIB_COUNTER_BASE) + +/* Pre-fetch control register +*/ +#define PFBRst (1<<16) /* Pre-fetch buffer reset */ +#define DFC_OV (1<<15) /* DFC counter overflow flag */ +#define FPFHC_OV (1<<14) /* DPFHC counter overflow flag */ +#define CDFC (1<<13) /* Clear Data Fetch Counter */ +#define CDPFHC (1<<12) /* Clear Data Pre-Fetch Hit Counter */ +#define EnDFC (1<<11) /* Enable Data Fetch Counter */ +#define EnDPFHC (1<<10) /* Enable Data Pre-Fetch Hit Counter */ +#define EnSDPreFetch_D_MASK (0x00000300) /* Enable SDRAM pre-fetch function for Data : Mask */ +#define EnSDPreFetch_D_Disable (0x00000100) /* Enable SDRAM pre-fetch function for Data : disable */ +#define EnSDPreFetch_D_4W (0x00000200) /* Enable SDRAM pre-fetch function for Data : 4W */ +#define EnSDPreFetch_D_4W4W (0x00000300) /* Enable SDRAM pre-fetch function for Data : 4W+4W */ +#define EnSDPreFetch_D_OFFSET (8) /* Enable SDRAM pre-fetch function for Data : Offset */ +#define IFC_OV (1<<7) /* IFC counter overflow flag */ +#define IPFHC_OV (1<<6) /* IPFHC counter overflow flag */ +#define CIFC (1<<5) /* Clear Instruction Fetch Counter */ +#define CIPFHC (1<<4) /* Clear Instruction Pre-Fetch Hit Counter */ +#define EnIFC (1<<3) /* Enable Instruction Fetch Counter */ +#define EnIPFHC (1<<2) /* Enable Instruction Pre-Fetch Hit Counter */ +#define EnSDPreFetch_I_MASK (0x00000003) /* Enable SDRAM pre-fetch function for Instruction : Mask */ +#define EnSDPreFetch_I_OFFSET (0) /* Enable SDRAM pre-fetch function for Instruction : Offset */ +#define EnSDPreFetch_I_Disable (0x00000001) /* Enable SDRAM pre-fetch function for Instruction : disable */ +#define EnSDPreFetch_I_4W (0x00000002) /* Enable SDRAM pre-fetch function for Instruction : 4W */ +#define EnSDPreFetch_I_4W4W (0x00000003) /* Enable SDRAM pre-fetch function for Instruction : 4W+4W */ + + +/* PHY control registers +*/ +#define PHY_BASE (SWCORE_BASE + 0x00002000) +#define PORT0_PHY_CONTROL (0x000 + PHY_BASE) +#define PORT0_PHY_STATUS (0x004 + PHY_BASE) +#define PORT0_PHY_IDENTIFIER_1 (0x008 + PHY_BASE) +#define PORT0_PHY_IDENTIFIER_2 (0x00C + PHY_BASE) +#define PORT0_PHY_AUTONEGO_ADVERTISEMENT (0x010 + PHY_BASE) +#define PORT0_PHY_AUTONEGO_LINK_PARTNER_ABILITY (0x014 + PHY_BASE) +#define PORT1_PHY_CONTROL (0x020 + PHY_BASE) +#define PORT1_PHY_STATUS (0x024 + PHY_BASE) +#define PORT1_PHY_IDENTIFIER_1 (0x028 + PHY_BASE) +#define PORT1_PHY_IDENTIFIER_2 (0x02C + PHY_BASE) +#define PORT1_PHY_AUTONEGO_ADVERTISEMENT (0x030 + PHY_BASE) +#define PORT1_PHY_AUTONEGO_LINK_PARTNER_ABILITY (0x034 + PHY_BASE) +#define PORT2_PHY_CONTROL (0x040 + PHY_BASE) +#define PORT2_PHY_STATUS (0x044 + PHY_BASE) +#define PORT2_PHY_IDENTIFIER_1 (0x048 + PHY_BASE) +#define PORT2_PHY_IDENTIFIER_2 (0x04C + PHY_BASE) +#define PORT2_PHY_AUTONEGO_ADVERTISEMENT (0x050 + PHY_BASE) +#define PORT2_PHY_AUTONEGO_LINK_PARTNER_ABILITY (0x054 + PHY_BASE) +#define PORT3_PHY_CONTROL (0x060 + PHY_BASE) +#define PORT3_PHY_STATUS (0x064 + PHY_BASE) +#define PORT3_PHY_IDENTIFIER_1 (0x068 + PHY_BASE) +#define PORT3_PHY_IDENTIFIER_2 (0x06C + PHY_BASE) +#define PORT3_PHY_AUTONEGO_ADVERTISEMENT (0x070 + PHY_BASE) +#define PORT3_PHY_AUTONEGO_LINK_PARTNER_ABILITY (0x074 + PHY_BASE) +#define PORT4_PHY_CONTROL (0x080 + PHY_BASE) +#define PORT4_PHY_STATUS (0x084 + PHY_BASE) +#define PORT4_PHY_IDENTIFIER_1 (0x088 + PHY_BASE) +#define PORT4_PHY_IDENTIFIER_2 (0x08C + PHY_BASE) +#define PORT4_PHY_AUTONEGO_ADVERTISEMENT (0x090 + PHY_BASE) +#define PORT4_PHY_AUTONEGO_LINK_PARTNER_ABILITY (0x094 + PHY_BASE) +#define PORT5_PHY_CONTROL (0x0A0 + PHY_BASE) +#define PORT5_PHY_STATUS (0x0A4 + PHY_BASE) +#define PORT5_PHY_IDENTIFIER_1 (0x0A8 + PHY_BASE) +#define PORT5_PHY_IDENTIFIER_2 (0x0AC + PHY_BASE) +#define PORT5_PHY_AUTONEGO_ADVERTISEMENT (0x0B0 + PHY_BASE) +#define PORT5_PHY_AUTONEGO_LINK_PARTNER_ABILITY (0x0B4 + PHY_BASE) +#define PORT6_PHY_CONTROL (0x0C0 + PHY_BASE) +#define PORT6_PHY_STATUS (0x0C4 + PHY_BASE) +#define PORT6_PHY_IDENTIFIER_1 (0x0C8 + PHY_BASE) +#define PORT6_PHY_IDENTIFIER_2 (0x0CC + PHY_BASE) +#define PORT6_PHY_AUTONEGO_ADVERTISEMENT (0x0D0 + PHY_BASE) +#define PORT6_PHY_AUTONEGO_LINK_PARTNER_ABILITY (0x0D4 + PHY_BASE) +/* PHY control register field definitions +*/ +#define PHY_RESET (1 << 15) +#define ENABLE_LOOPBACK (1 << 14) +#define SPEED_SELECT_100M (1 << 13) +#define SPEED_SELECT_10M 0 +#define ENABLE_AUTONEGO (1 << 12) +#define POWER_DOWN (1 << 11) +#define ISOLATE_PHY (1 << 10) +#define RESTART_AUTONEGO (1 << 9) +#define SELECT_FULL_DUPLEX (1 << 8) +#define SELECT_HALF_DUPLEX 0 +#define SPEED_SELECT_1000M (1 << 6) +/* PHY status register field definitions +*/ +#define STS_CAPABLE_100BASE_T4 (1 << 15) +#define STS_CAPABLE_100BASE_TX_FD (1 << 14) +#define STS_CAPABLE_100BASE_TX_HD (1 << 13) +#define STS_CAPABLE_10BASE_TX_FD (1 << 12) +#define STS_CAPABLE_10BASE_TX_HD (1 << 11) +#define STS_MF_PREAMBLE_SUPPRESSION (1 << 6) +#define STS_AUTONEGO_COMPLETE (1 << 5) +#define STS_REMOTE_FAULT (1 << 4) +#define STS_CAPABLE_NWAY_AUTONEGO (1 << 3) +#define STS_LINK_ESTABLISHED (1 << 2) +#define STS_JABBER_DETECTED (1 << 1) +#define STS_CAPABLE_EXTENDED (1 << 0) +/* PHY identifier 1 +*/ +#define OUT_3_18_MASK (0xFFFF << 16) +#define OUT_3_18_OFFSET 16 +#define OUT_19_24_MASK (0x3F << 10) +#define OUT_19_24_OFFSET 10 +#define MODEL_NUMBER_MASK (0x3F << 4) +#define MODEL_NUMBER_OFFSET 4 +#define REVISION_NUMBER_MASK 0x0F +#define REVISION_NUMBER_OFFSET 0 +/* PHY auto-negotiation advertisement and +link partner ability registers field definitions +*/ +#define NEXT_PAGE_ENABLED (1 << 15) +#define ACKNOWLEDGE (1 << 14) +#define REMOTE_FAULT (1 << 13) +#define CAPABLE_PAUSE (1 << 10) +#define CAPABLE_100BASE_T4 (1 << 9) +#define CAPABLE_100BASE_TX_FD (1 << 8) +#define CAPABLE_100BASE_TX_HD (1 << 7) +#define CAPABLE_10BASE_TX_FD (1 << 6) +#define CAPABLE_10BASE_TX_HD (1 << 5) +#define SELECTOR_MASK 0x1F +#define SELECTOR_OFFSET 0 +#define CAP_100BASE_OFFSET 5 +#define CAP_100BASE_MASK (0x1F << CAP_100BASE_OFFSET) /* 10/100 capability mask */ +/* PHY 1000BASE-T control and 1000BASE-T Status +*/ +#define CAPABLE_1000BASE_TX_FD (1 << 9) +#define CAPABLE_1000BASE_TX_HD (1 << 8) +#define ADVCAP_1000BASE_OFFSET 8 +#define LPCAP_1000BASE_OFFSET 10 +#define ADVCAP_1000BASE_MASK (0x3 << ADVCAP_1000BASE_OFFSET) /* advertisement capability mask */ +#define LPCAP_1000BASE_MASK (0x3 << LPCAP_1000BASE_OFFSET) /* link partner status mask */ + +#define CPU_IFACE_BASE (SYSTEM_BASE+0x10000) /* 0xB8010000 */ +#define CPUICR (0x000 + CPU_IFACE_BASE) /* Interface control */ + +#define CPURPDCR0 (0x004 + CPU_IFACE_BASE) /* Rx pkthdr descriptor control 0 */ +#define CPURPDCR1 (0x008 + CPU_IFACE_BASE) /* Rx pkthdr descriptor control 1 */ +#define CPURPDCR2 (0x00c + CPU_IFACE_BASE) /* Rx pkthdr descriptor control 2 */ +#define CPURPDCR3 (0x010 + CPU_IFACE_BASE) /* Rx pkthdr descriptor control 3 */ +#define CPURPDCR4 (0x014 + CPU_IFACE_BASE) /* Rx pkthdr descriptor control 4 */ +#define CPURPDCR5 (0x018 + CPU_IFACE_BASE) /* Rx pkthdr descriptor control 5 */ +#define CPURPDCR(idx) (CPURPDCR0 + (idx << 2)) /* Rx pkthdr descriptor control with index */ + +#define CPURMDCR0 (0x01c + CPU_IFACE_BASE) /* Rx mbuf descriptor control */ +#define CPUTPDCR0 (0x020 + CPU_IFACE_BASE) /* Tx pkthdr descriptor control Low */ +#define CPUTPDCR1 (0x024 + CPU_IFACE_BASE) /* Tx pkthdr descriptor control High */ +#define CPUTPDCR(idx) (CPUTPDCR0 + (idx << 2)) /* Tx pkthdr descriptor control with index */ + +#define CPUIIMR (0x028 + CPU_IFACE_BASE) /* Interrupt mask control */ +#define CPUIISR (0x02c + CPU_IFACE_BASE) /* Interrupt status control */ +#define CPUQDM0 (0x030 + CPU_IFACE_BASE) /* Queue ID 0 and Descriptor Ring Mapping Register */ +#define CPUQDM1 (0x032 + CPU_IFACE_BASE) /* Queue ID 1 and Descriptor Ring Mapping Register */ +#define CPUQDM2 (0x034 + CPU_IFACE_BASE) /* Queue ID 2 and Descriptor Ring Mapping Register */ +#define CPUQDM3 (0x036 + CPU_IFACE_BASE) /* Queue ID 3 and Descriptor Ring Mapping Register */ +#define CPUQDM4 (0x038 + CPU_IFACE_BASE) /* Queue ID 4 and Descriptor Ring Mapping Register */ +#define CPUQDM5 (0x03a + CPU_IFACE_BASE) /* Queue ID 5 and Descriptor Ring Mapping Register */ + +#define DMA_CR1 (0x040 + CPU_IFACE_BASE) /* DMA Control Register 1 */ +#define DMA_CR2 (0x044 + CPU_IFACE_BASE) /* DMA Control Register 2 */ + + +/* CPUICR - CPU interface control register field definitions +*/ +#define TXCMD (1 << 31) /* Enable Tx */ +#define RXCMD (1 << 30) /* Enable Rx */ +#define BUSBURST_32WORDS 0 +#define BUSBURST_64WORDS (1 << 28) +#define BUSBURST_128WORDS (2 << 28) +#define BUSBURST_256WORDS (3 << 28) +#define MBUF_128BYTES 0 +#define MBUF_256BYTES (1 << 24) +#define MBUF_512BYTES (2 << 24) +#define MBUF_1024BYTES (3 << 24) +#define MBUF_2048BYTES (4 << 24) +#define TXFD (1 << 23) /* Notify Tx descriptor fetch */ +#define SOFTRST (1 << 22) /* Re-initialize all descriptors */ +#define STOPTX (1 << 21) /* Stop Tx */ +#define SWINTSET (1 << 20) /* Set software interrupt */ +#define LBMODE (1 << 19) /* Loopback mode */ +#define LB10MHZ (1 << 18) /* LB 10MHz */ +#define LB100MHZ (1 << 18) /* LB 100MHz */ +#define MITIGATION (1 << 17) /* Mitigation with timer1 */ +#define EXCLUDE_CRC (1 << 16) /* Exclude CRC from length */ +#define RX_SHIFT_OFFSET 0 + +/* + CPU interface descriptor field defintions +*/ +#define DESC_OWNED_BIT (1 << 0) +#define DESC_RISC_OWNED (0 << 0) +#define DESC_SWCORE_OWNED (1 << 0) + +#define DESC_WRAP (1 << 1) + +#define DESC_ENG_OWNED 1 + + +/* CPUIIMR - CPU interface interrupt mask register field definitions */ +#define LINK_CHANGE_IE (1 << 31) /* Link change interrupt enable */ + +#define RX_ERR_IE0 (1 << 25) /* Rx error interrupt enable for descriptor 0 */ +#define RX_ERR_IE1 (1 << 26) /* Rx error interrupt enable for descriptor 1 */ +#define RX_ERR_IE2 (1 << 27) /* Rx error interrupt enable for descriptor 2 */ +#define RX_ERR_IE3 (1 << 28) /* Rx error interrupt enable for descriptor 3 */ +#define RX_ERR_IE4 (1 << 29) /* Rx error interrupt enable for descriptor 4 */ +#define RX_ERR_IE5 (1 << 30) /* Rx error interrupt enable for descriptor 5 */ +#define RX_ERR_IE_ALL (0x3f<<25) /* Rx error interrupt enable for any descriptor */ + +#define TX_ERR_IE0 (1 << 23) /* Tx error interrupt pending for descriptor 0 */ +#define TX_ERR_IE1 (1 << 24) /* Tx error interrupt pending for descriptor 1 */ +#define TX_ERR_IE_ALL (0x3<<23) /* Tx error interrupt pending for any descriptor */ +#define TX_ERR_IE (1 << 29) /* Tx error interrupt enable */ + +#define PKTHDR_DESC_RUNOUT_IE0 (1 << 17) /* Run out pkthdr descriptor 0 interrupt enable */ +#define PKTHDR_DESC_RUNOUT_IE1 (1 << 18) /* Run out pkthdr descriptor 1 interrupt enable */ +#define PKTHDR_DESC_RUNOUT_IE2 (1 << 19) /* Run out pkthdr descriptor 2 interrupt enable */ +#define PKTHDR_DESC_RUNOUT_IE3 (1 << 20) /* Run out pkthdr descriptor 3 interrupt enable */ +#define PKTHDR_DESC_RUNOUT_IE4 (1 << 21) /* Run out pkthdr descriptor 4 interrupt enable */ +#define PKTHDR_DESC_RUNOUT_IE5 (1 << 22) /* Run out pkthdr descriptor 5 interrupt enable */ +#define PKTHDR_DESC_RUNOUT_IE_ALL (0x3f << 17) /* Run out anyone pkthdr descriptor interrupt pending */ + +#define MBUF_DESC_RUNOUT_IE_ALL (1 << 11) /* Run out anyone mbuf interrupt pending */ +#define MBUF_DESC_RUNOUT_IE0 (1 << 11) /* Run out mbuf descriptor 0 interrupt enable */ + +#define TX_DONE_IE0 (1 << 9) /* Tx Descript Ring 0 one packet done interrupt enable */ +#define TX_DONE_IE1 (1 << 10) /* Tx Descript Ring 1 one packet done interrupt enable */ +#define TX_DONE_IE_ALL (0x3 << 9) /* Any Tx Descript Ring one packet done interrupt enable */ + +#define RX_DONE_IE0 (1 << 3) /* Rx Descript Ring 0 one packet done interrupt enable */ +#define RX_DONE_IE1 (1 << 4) /* Rx Descript Ring 1 one packet done interrupt enable */ +#define RX_DONE_IE2 (1 << 5) /* Rx Descript Ring 2 one packet done interrupt enable */ +#define RX_DONE_IE3 (1 << 6) /* Rx Descript Ring 3 one packet done interrupt enable */ +#define RX_DONE_IE4 (1 << 7) /* Rx Descript Ring 4 one packet done interrupt enable */ +#define RX_DONE_IE5 (1 << 8) /* Rx Descript Ring 5 one packet done interrupt enable */ +#define RX_DONE_IE_ALL (0x3f << 3) /* Rx Descript Ring any one packet done interrupt enable */ + +#define TX_ALL_DONE_IE0 (1 << 1) /* Tx Descript Ring 0 all packets done interrupt enable */ +#define TX_ALL_DONE_IE1 (1 << 2) /* Tx Descript Ring 1 all packets done interrupt enable */ +#define TX_ALL_DONE_IE_ALL (0x3 << 1) /* Any Tx Descript Ring all packets done interrupt enable */ + +/* CPU interface interrupt status register field definitions */ +#define LINK_CHANGE_IP (1 << 31) /* Link change interrupt pending */ + +#define RX_ERR_IP0 (1 << 25) /* Rx error descriptor 0 interrupt pending */ +#define RX_ERR_IP1 (1 << 26) /* Rx error descriptor 1 interrupt pending */ +#define RX_ERR_IP2 (1 << 27) /* Rx error descriptor 2 interrupt pending */ +#define RX_ERR_IP3 (1 << 28) /* Rx error descriptor 3 interrupt pending */ +#define RX_ERR_IP4 (1 << 29) /* Rx error descriptor 4 interrupt pending */ +#define RX_ERR_IP5 (1 << 30) /* Rx error descriptor 5 interrupt pending */ +#define RX_ERR_IP_ALL (0x3f<<25) /* Rx error any descriptor interrupt pending */ +#define RX_ERR_IP(idx) (1 << (25+(idx))) /* Rx error descriptor [IDX] interrupt pending */ + +#define TX_ERR_IP0 (1 << 23) /* Tx error descriptor 0 interrupt pending */ +#define TX_ERR_IP1 (1 << 24) /* Tx error descriptor 1 interrupt pending */ +#define TX_ERR_IP_ALL (0x3<<23) /* Tx error any descriptor interrupt pending */ +#define TX_ERR_IP(idx) (1 << (23+(idx))) /* Tx error descriptor [IDX] interrupt pending */ + +#define PKTHDR_DESC_RUNOUT_IP0 (1 << 17) /* Run out pkthdr descriptor 0 interrupt pending */ +#define PKTHDR_DESC_RUNOUT_IP1 (1 << 18) /* Run out pkthdr descriptor 1 interrupt pending */ +#define PKTHDR_DESC_RUNOUT_IP2 (1 << 19) /* Run out pkthdr descriptor 2 interrupt pending */ +#define PKTHDR_DESC_RUNOUT_IP3 (1 << 20) /* Run out pkthdr descriptor 3 interrupt pending */ +#define PKTHDR_DESC_RUNOUT_IP4 (1 << 21) /* Run out pkthdr descriptor 4 interrupt pending */ +#define PKTHDR_DESC_RUNOUT_IP5 (1 << 22) /* Run out pkthdr descriptor 5 interrupt pending */ +#define PKTHDR_DESC_RUNOUT_IP_ALL (0x3f << 17) /* Run out anyone pkthdr descriptor interrupt pending */ +#define PKTHDR_DESC_RUNOUT_IP(idx) (1 << (17+(idx))) /* Run out pkthdr descriptor [IDX] interrupt pending */ + +#define MBUF_DESC_RUNOUT_IP_ALL (1 << 11) /* Run out anyone mbuf interrupt pending */ +#define MBUF_DESC_RUNOUT_IP0 (1 << 11) /* Run out mbuf descriptor 0 interrupt pending */ + +#define TX_DONE_IP0 (1 << 9) /* Tx one packet done interrupt for descriptor 0 pending */ +#define TX_DONE_IP1 (1 << 10) /* Tx one packet done interrupt for descriptor 1 pending */ +#define TX_DONE_IP_ALL (0x3 << 9) /* Tx one packet done interrupt for any descriptor pending */ +#define TX_DONE_IP(idx) (1 << (9+(idx))) /* Tx one packet done interrupt for descriptor [IDX] pending */ + +#define RX_DONE_IP0 (1 << 3) /* Rx one packet done 0 interrupt pending */ +#define RX_DONE_IP1 (1 << 4) /* Rx one packet done 1 interrupt pending */ +#define RX_DONE_IP2 (1 << 5) /* Rx one packet done 2 interrupt pending */ +#define RX_DONE_IP3 (1 << 6) /* Rx one packet done 3 interrupt pending */ +#define RX_DONE_IP4 (1 << 7) /* Rx one packet done 4 interrupt pending */ +#define RX_DONE_IP5 (1 << 8) /* Rx one packet done 5 interrupt pending */ +#define RX_DONE_IP_ALL (0x3f << 3) /* Rx one packet done anyone interrupt pending */ +#define RX_DONE_IP(idx) (1 << (3+(idx))) /* Rx one packet done [IDX] interrupt pending */ + +#define TX_ALL_DONE_IP0 (1 << 1) /* Tx all packets done interrupt 0 pending */ +#define TX_ALL_DONE_IP1 (1 << 2) /* Tx all packets done interrupt 1 pending */ +#define TX_ALL_DONE_IP_ALL (0x03 << 1) /* Tx all packets done any interrupt pending */ +#define TX_ALL_DONE_IP(idx) (1 << (1+(idx))) /* Tx all packets done interrupt [IDX] pending */ + +#define INTPENDING_NIC_MASK (RX_ERR_IP_ALL|TX_ERR_IP_ALL|RX_DONE_IP_ALL|PKTHDR_DESC_RUNOUT_IP_ALL) +#define INTPENDING_RUN_OUT (PKTHDR_DESC_RUNOUT_IP_ALL) + +/* CPUQDM0,CPUQDM1,CPUQDM2,CPUQDM3,CPUQDM4,CPUQDM5 - Queue ID 0~5 and Descriptor Ring Mapping Register */ +#define CPURxDesc_OFFSET 12 +#define CPURxDesc_MASK (7<<12) +#define Ext1RxDesc_OFFSET 8 +#define Ext1RxDesc_MASK (7<<8) +#define Ext2RxDesc_OFFSET 4 +#define Ext2RxDesc_MASK (7<<4) +#define Ext3RxDesc_OFFSET 0 +#define Ext3RxDesc_MASK (7<<0) +#define CPU_RX_DESC_SHIFT 12 +#define EXT1_RX_DESC_SHIFT 8 +#define EXT2_RX_DESC_SHIFT 4 +#define EXT3_RX_DESC_SHIFT 0 + + + + +/* Switch Core Control Registers +*/ +#define SWCORECNR (SWCORE_BASE + 0x00006000) + +#define MACMR (0x004 + SWCORECNR) /* MAC monitor */ +#define VLANTCR (0x008 + SWCORECNR) /* Vlan tag control */ +#define DSCR0 (0x00C + SWCORECNR) /* Qos by DS control */ +#define DSCR1 (0x010 + SWCORECNR) /* Qos by DS control */ +#define QOSCR (0x014 + SWCORECNR) /* Qos control */ +#if 0 /* phase out in 865xC */ +#define SWTMCR (0x01C + SWCORECNR) /* Switch table misc control */ +#endif + +#if 0 /* phase out in 865xC */ +/* SWTMCR - Switch table misc control */ +#define EN_BCAST (1<<30) /* Enable Broadcast Handling */ +#define MCAST_TO_CPU (1<<29) /* Enable Multicast Table */ +#define BRIDGE_PKT_TO_CPU (1<<27) /*802.1d packet to CPU*/ +#define MCAST_PORT_EXT_MODE_OFFSET 5 /* Multicast port mode offset */ +#define MCAST_PORT_EXT_MODE_MASK (0x3f << 5) /* Multicast port mode mask */ +#define WAN_ROUTE_MASK (3 << 3) +#define WAN_ROUTE_FORWARD (0 << 3) /* Route WAN packets */ +#define WAN_ROUTE_TO_CPU (1 << 3) /* Forward WAN packets to CPU */ +#define WAN_ROUTE_DROP (2 << 3) /* Drop WAN packets */ +#endif + +/* Descriptor Diagnostic Register */ +#define DESCDIAG_BASE (SWCORECNR + 0x0100) +#define GDSR0 (DESCDIAG_BASE + 0x000) /* Global Descriptor Status Register 0 */ +#define GDSR1 (DESCDIAG_BASE + 0x004) /* Global Descriptor Status Register 1 */ +#define PCSR0 (DESCDIAG_BASE + 0x008) /* Port Congestion Status Register 0 */ +#define PCSR1 (DESCDIAG_BASE + 0x00c) /* Port Congestion Status Register 1 */ +#define P0_DCR0 (DESCDIAG_BASE + 0x010) /* Port 0 Descriptor Counter Register 0 */ +#define P0_DCR1 (DESCDIAG_BASE + 0x014) /* Port 0 Descriptor Counter Register 1 */ +#define P0_DCR2 (DESCDIAG_BASE + 0x018) /* Port 0 Descriptor Counter Register 2 */ +#define P0_DCR3 (DESCDIAG_BASE + 0x01c) /* Port 0 Descriptor Counter Register 3 */ +#define P1_DCR0 (DESCDIAG_BASE + 0x020) /* Port 1 Descriptor Counter Register 0 */ +#define P1_DCR1 (DESCDIAG_BASE + 0x024) /* Port 1 Descriptor Counter Register 1 */ +#define P1_DCR2 (DESCDIAG_BASE + 0x028) /* Port 1 Descriptor Counter Register 2 */ +#define P1_DCR3 (DESCDIAG_BASE + 0x02c) /* Port 1 Descriptor Counter Register 3 */ +#define P2_DCR0 (DESCDIAG_BASE + 0x030) /* Port 2 Descriptor Counter Register 0 */ +#define P2_DCR1 (DESCDIAG_BASE + 0x034) /* Port 2 Descriptor Counter Register 1 */ +#define P2_DCR2 (DESCDIAG_BASE + 0x038) /* Port 2 Descriptor Counter Register 2 */ +#define P2_DCR3 (DESCDIAG_BASE + 0x03c) /* Port 2 Descriptor Counter Register 3 */ +#define P3_DCR0 (DESCDIAG_BASE + 0x040) /* Port 3 Descriptor Counter Register 0 */ +#define P3_DCR1 (DESCDIAG_BASE + 0x044) /* Port 3 Descriptor Counter Register 1 */ +#define P3_DCR2 (DESCDIAG_BASE + 0x048) /* Port 3 Descriptor Counter Register 2 */ +#define P3_DCR3 (DESCDIAG_BASE + 0x04c) /* Port 3 Descriptor Counter Register 3 */ +#define P4_DCR0 (DESCDIAG_BASE + 0x050) /* Port 4 Descriptor Counter Register 0 */ +#define P4_DCR1 (DESCDIAG_BASE + 0x054) /* Port 4 Descriptor Counter Register 1 */ +#define P4_DCR2 (DESCDIAG_BASE + 0x058) /* Port 4 Descriptor Counter Register 2 */ +#define P4_DCR3 (DESCDIAG_BASE + 0x05c) /* Port 4 Descriptor Counter Register 3 */ +#define P5_DCR0 (DESCDIAG_BASE + 0x060) /* Port 5 Descriptor Counter Register 0 */ +#define P5_DCR1 (DESCDIAG_BASE + 0x064) /* Port 5 Descriptor Counter Register 1 */ +#define P5_DCR2 (DESCDIAG_BASE + 0x068) /* Port 5 Descriptor Counter Register 2 */ +#define P5_DCR3 (DESCDIAG_BASE + 0x06c) /* Port 5 Descriptor Counter Register 3 */ +#define P6_DCR0 (DESCDIAG_BASE + 0x070) /* Port CPU Descriptor Counter Register 0 */ +#define P6_DCR1 (DESCDIAG_BASE + 0x074) /* Port CPU Descriptor Counter Register 1 */ +#define P6_DCR2 (DESCDIAG_BASE + 0x078) /* Port CPU Descriptor Counter Register 2 */ +#define P6_DCR3 (DESCDIAG_BASE + 0x07c) /* Port CPU Descriptor Counter Register 3 */ + +#define Pn_DSCR0(idx) (DESCDIAG_BASE + ((idx) * 0x10) + 0x010) +#define Pn_DSCR1(idx) (DESCDIAG_BASE + ((idx) * 0x10) + 0x014) +#define Pn_DSCR2(idx) (DESCDIAG_BASE + ((idx) * 0x10) + 0x018) +#define Pn_DSCR3(idx) (DESCDIAG_BASE + ((idx) * 0x10) + 0x01c) + +#define Pn_IQDesCnt_OFFSET (0) +#define Pn_IQDesCnt_MASK (0x3ff << Pn_IQDesCnt_OFFSET) + +#define Pn_OQDSCR_MASK (0x3ff)<<Pn_ODD_OQDSCR_OFFSET +#define Pn_ODD_OQDSCR_OFFSET (16) +#define Pn_EQDSCR_MASK (0x3ff)<<Pn_EVEN_OQDSCR_OFFSET +#define Pn_EVEN_OQDSCR_OFFSET (0) + +#define Pn_OQDSCR(port, queue) \ + ( \ + ((queue) == 0) || ((queue) == 1)? \ + ((queue & 0x01)?((READ_MEM32(Pn_DSCR0(port)) >> Pn_ODD_OQDSCR_OFFSET) & Pn_OQDSCR_MASK) : \ + ((READ_MEM32(Pn_DSCR0(port)) >> Pn_EVEN_OQDSCR_OFFSET) & Pn_OQDSCR_MASK)): \ + ((queue) == 2) || ((queue) == 3)? \ + ((queue & 0x01)?((READ_MEM32(Pn_DSCR1(port)) >> Pn_ODD_OQDSCR_OFFSET) & Pn_OQDSCR_MASK) : \ + ((READ_MEM32(Pn_DSCR1(port)) >> Pn_EVEN_OQDSCR_OFFSET) & Pn_OQDSCR_MASK)): \ + ((queue) == 4) || ((queue) == 5)? \ + ((queue & 0x01)?((READ_MEM32(Pn_DSCR2(port)) >> Pn_ODD_OQDSCR_OFFSET) & Pn_OQDSCR_MASK) : \ + ((READ_MEM32(Pn_DSCR2(port)) >> Pn_EVEN_OQDSCR_OFFSET) & Pn_OQDSCR_MASK)): \ + 0) + +#define Pn_IQDSCR(port) ((READ_MEM32(Pn_DSCR3(port)) & Pn_IQDesCnt_MASK) >> Pn_IQDesCnt_OFFSET) + +/* GDSR0 - Global Descriptor Status Register 0 */ +#define DSCRUNOUT (1<<27) /* Descriptor Run Out */ +#define TotalDscFctrl_Flag (1<<26) /* TotalDescriptor Flow Control event flag */ +#define USEDDSC_OFFSET 16 /* Total Used Descriptor */ +#define USEDDSC_MASK (0x3ff<<16) /* Total Used Descriptor */ +#define SharedBufFCON_Flag (1<<14) /* SharedBufFCON threshold triggerred flag */ +#define MaxUsedDsc_OFFSET 0 /* Max Used Descriptor Count History */ +#define MaxUsedDsc_MASK (0x3ff<<0) /* Max Used Descriptor Count History */ + +/* PCSR0 - Port Congestion Status Register 0 */ +#define P3OQCgst_OFFSET (24) +#define P3OQCgst_MASK (0x7f << P3OQCgst_OFFSET) +#define P2OQCgst_OFFSET (16) +#define P2OQCgst_MASK (0x7f << P2OQCgst_OFFSET) +#define P1OQCgst_OFFSET (8) +#define P1OQCgst_MASK (0x7f << P1OQCgst_OFFSET) +#define P0OQCgst_OFFSET (0) +#define P0OQCgst_MASK (0x7f << P0OQCgst_OFFSET) + +#define P3QQCgst(queue) (((READ_MEM32(PCSR0) & P3OQCgst_MASK) >> P3OQCgst_OFFSET) & (1 << (queue))) +#define P2QQCgst(queue) (((READ_MEM32(PCSR0) & P2OQCgst_MASK) >> P2OQCgst_OFFSET) & (1 << (queue))) +#define P1QQCgst(queue) (((READ_MEM32(PCSR0) & P1OQCgst_MASK) >> P1OQCgst_OFFSET) & (1 << (queue))) +#define P0QQCgst(queue) (((READ_MEM32(PCSR0) & P0OQCgst_MASK) >> P0OQCgst_OFFSET) & (1 << (queue))) + +/* PCSR1 - Port Congestion Status Register 1 */ +#define IQCgst_OFFSET (24) +#define IQCgst_MASK (0x7f << P3OQCgst_OFFSET) +#define P6OQCgst_OFFSET (16) +#define P6OQCgst_MASK (0x7f << P6OQCgst_OFFSET) +#define P5OQCgst_OFFSET (8) +#define P5OQCgst_MASK (0x7f << P5OQCgst_OFFSET) +#define P4OQCgst_OFFSET (0) +#define P4OQCgst_MASK (0x7f << P4OQCgst_OFFSET) + +#define IQCgst(port) (((READ_MEM32(PCSR1) & IQCgst_MASK) >> IQCgst_OFFSET) & (1 << (port))) +#define P6QQCgst(queue) (((READ_MEM32(PCSR1) & P6OQCgst_MASK) >> P6OQCgst_OFFSET) & (1 << (queue))) +#define P5QQCgst(queue) (((READ_MEM32(PCSR1) & P5OQCgst_MASK) >> P5OQCgst_OFFSET) & (1 << (queue))) +#define P4QQCgst(queue) (((READ_MEM32(PCSR1) & P4OQCgst_MASK) >> P4OQCgst_OFFSET) & (1 << (queue))) + + +#define TMCR (0x300 + SWCORECNR) /* Test mode control */ +#if 1 /* According David Lu 2006/02/10 */ +#define MIITM_TXR0 (0x400 + SWCORECNR) /* MAC Test Mode MII TX Interface Register */ +#define MIITM_TXR1 (0x404 + SWCORECNR) /* MAC Test Mode MII TX Interface Register */ +#define MIITM_RXR0 (0x408 + SWCORECNR) /* MAC Test Mode MII RX Interface Register */ +#define MIITM_RXR1 (0x40C + SWCORECNR) /* MAC Test Mode MII RX Interface Register */ +#define GMIITM_TXR0 (0x400 + SWCORECNR) /* MAC Test Mode MII TX Interface Register */ +#define GMIITM_TXR1 (0x404 + SWCORECNR) /* MAC Test Mode MII TX Interface Register */ +#define GMIITM_RXR0 (0x408 + SWCORECNR) /* MAC Test Mode MII RX Interface Register */ +#define GMIITM_RXR1 (0x40C + SWCORECNR) /* MAC Test Mode MII RX Interface Register */ +#else /* Before 2006/02/09 */ +#define MIITM_TXR (0x400 + SWCORECNR) /* MAC Test Mode MII TX Interface Register */ +#define MIITM_RXR (0x404 + SWCORECNR) /* MAC Test Mode MII RX Interface Register */ +#endif + + +#define EN_PHY_P4 (1 << 9) +#define EN_PHY_P3 (1 << 8) +#define EN_PHY_P2 (1 << 7) +#define EN_PHY_P1 (1 << 6) +#define EN_PHY_P0 (1 << 5) +#define EN_FX_P4 (1 << 4) +#define EN_FX_P3 (1 << 3) +#define EN_FX_P2 (1 << 2) +#define EN_FX_P1 (1 << 1) +#define EN_FX_P0 (1 << 0) + +#define GUEST_VLAN_BITMASK 0xFFF +#define MULTICAST_BROADCAST_BIT 0x1 +#define PCRP_SIZE 4 +#define STP_PortST 5 +#define STP_PortST_BITMASK 3 + + + +/* MAC monitor register field definitions +*/ +#define SYS_CLK_MASK (0x7 << 16) +#define SYS_CLK_100M (0 << 16) +#define SYS_CLK_90M (1 << 16) +#define SYS_CLK_85M (2 << 16) +#define SYS_CLK_96M (3 << 16) +#define SYS_CLK_80M (4 << 16) +#define SYS_CLK_75M (5 << 16) +#define SYS_CLK_70M (6 << 16) +#define SYS_CLK_50M (7 << 16) +/* VLAN tag control register field definitions +*/ +#define VLAN_TAG_ONLY (1 << 19) /* Only accept tagged packets */ +#define MII_ENFORCE_MODE (1 << 4) /* Enable MII port property set by force mode */ +/* Qos by DS control register +*/ +/* Qos control register +*/ +#define QWEIGHT_MASK (3 << 30) +#define QWEIGHT_ALWAYS_H (3 << 30) /* Weighted round robin of priority always high first */ +#define QWEIGHT_16TO1 (2 << 30) /* Weighted round robin of priority queue 16:1 */ +#define QWEIGHT_8O1 (1 << 30) /* Weighted round robin of priority queue 8:1 */ +#define QWEIGHT_4TO1 0 /* Weighted round robin of priority queue 4:1 */ +#define EN_FCA_AUTOOFF (1 << 29) /* Enable flow control auto off */ +#define DIS_DS_PRI (1 << 28) /* Disable DS priority */ +#define DIS_VLAN_PRI (1 << 27) /* Disable 802.1p priority */ +#define PORT5_H_PRI (1 << 26) /* Port 5 high priority */ +#define PORT4_H_PRI (1 << 25) /* Port 4 high priority */ +#define PORT3_H_PRI (1 << 24) /* Port 3 high priority */ +#define PORT2_H_PRI (1 << 23) /* Port 2 high priority */ +#define PORT1_H_PRI (1 << 22) /* Port 1 high priority */ +#define PORT0_H_PRI (1 << 21) /* Port 0 high priority */ +#define EN_QOS (1 << 20) /* Enable QoS */ +/* Switch core misc control register field definitions +*/ +#define DIS_P5_LOOPBACK (1 << 30) /* Disable port 5 loopback */ + +#define LINK_RGMII 0 /* RGMII mode */ +#define LINK_MII_MAC 1 /* GMII/MII MAC auto mode */ +#define LINK_MII_PHY 2 /* GMII/MII PHY auto mode */ +#define LINKMODE_OFFSET 23 /* Link type offset */ +#define P5_LINK_RGMII LINK_RGMII /* Port 5 RGMII mode */ +#define P5_LINK_MII_MAC LINK_MII_MAC /* Port 5 GMII/MII MAC auto mode */ +#define P5_LINK_MII_PHY LINK_MII_PHY /* Port 5 GMII/MII PHY auto mode */ +#define P5_LINK_OFFSET LINKMODE_OFFSET /* Port 5 link type offset */ +/*#define P4_USB_SEL (1 << 25) Select port USB interface */ +#define EN_P5_LINK_PHY (1 << 26) /* Enable port 5 PHY provides link status to MAC */ +#define EN_P4_LINK_PHY (1 << 25) /* Enable port 4 PHY provides link status to MAC */ +#define EN_P3_LINK_PHY (1 << 24) /* Enable port 3 PHY provides link status to MAC */ +#define EN_P2_LINK_PHY (1 << 23) /* Enable port 2 PHY provides link status to MAC */ +#define EN_P1_LINK_PHY (1 << 22) /* Enable port 1 PHY provides link status to MAC */ +#define EN_P0_LINK_PHY (1 << 21) /* Enable port 0 PHY provides link status to MAC */ + + + + +/*When enabled, the authorized node are allowed in one direction ("IN" direction) +to forward packet to the unauthorized node. Otherwise, it is not allowed. +0= BOTH direction. (control for the packets that "SA=" or "DA=" this MAC address.) +1= IN direction. (control for the packets that "SA=" this MAC address.) */ +#define EN_8021X_TOGVLAN ( DOT1X_PROCESS_GVLAN<<GVLAN_PROCESS_BITS) +#define EN_8021X_TOCPU ( DOT1X_PROCESS_TOCPU<<GVLAN_PROCESS_BITS) +#define EN_8021X_DROP ( DOT1X_PROCESS_DROP<<GVLAN_PROCESS_BITS) + + + + +#if 1 /* According David Lu 2006/02/10 */ +/* Test mode Tx MII-like register field definitions +*/ +#define P0TxEN (1<<24) /* Enable port 0 Mii Tx signal (1 - data valid) */ +#define P1TxEN (1<<25) /* Enable port 1 Mii Tx signal (1 - data valid) */ +#define P2TxEN (1<<26) /* Enable port 2 Mii Tx signal (1 - data valid) */ +#define P0TxEN_OFFSET (24) /* Enable port 0 Mii Tx */ +#define P1TxEN_OFFSET (25) /* Enable port 1 Mii Tx */ +#define P2TxEN_OFFSET (26) /* Enable port 2 Mii Tx */ +#define P0TXD_OFFSET (0) /* Port 0 TxD [7:0] */ +#define P1TXD_OFFSET (8) /* Port 1 TxD [7:0] */ +#define P2TXD_OFFSET (16) /* Port 2 TxD [7:0] */ + +#define P3TxEN (1<<24) /* Enable port 3 Mii Tx signal (1 - data valid) */ +#define P4TxEN (1<<25) /* Enable port 4 Mii Tx signal (1 - data valid) */ +#define P5TxEN (1<<26) /* Enable port 5 Mii Tx signal (1 - data valid) */ +#define P3TxEN_OFFSET (24) /* Enable port 3 Mii Tx */ +#define P4TxEN_OFFSET (25) /* Enable port 4 Mii Tx */ +#define P5TxEN_OFFSET (26) /* Enable port 5 Mii Tx */ +#define P3TXD_OFFSET (0) /* Port 3 TxD [7:0] */ +#define P4TXD_OFFSET (8) /* Port 4 TxD [7:0] */ +#define P5TXD_OFFSET (16) /* Port 5 TxD [7:0] */ +/* Test mode Rx MII-like register field definitions +*/ +#define P0RxEN (1<<24) /* Enable port 0 Mii Rx signal (1 - data valid) */ +#define P1RxEN (1<<25) /* Enable port 1 Mii Rx signal (1 - data valid) */ +#define P2RxEN (1<<26) /* Enable port 2 Mii Rx signal (1 - data valid) */ +#define P0RxEN_OFFSET (24) /* Enable port 0 Mii Rx */ +#define P1RxEN_OFFSET (25) /* Enable port 1 Mii Rx */ +#define P2RxEN_OFFSET (26) /* Enable port 2 Mii Rx */ +#define P0RXD_OFFSET (0) /* Port 0 RxD [7:0] */ +#define P1RXD_OFFSET (8) /* Port 1 RxD [7:0] */ +#define P2RXD_OFFSET (16) /* Port 2 RxD [7:0] */ + +#define P3RxEN (1<<24) /* Enable port 3 Mii Rx signal (1 - data valid) */ +#define P4RxEN (1<<25) /* Enable port 4 Mii Rx signal (1 - data valid) */ +#define P5RxEN (1<<26) /* Enable port 5 Mii Rx signal (1 - data valid) */ +#define P3RxEN_OFFSET (24) /* Enable port 3 Mii Rx */ +#define P4RxEN_OFFSET (25) /* Enable port 4 Mii Rx */ +#define P5RxEN_OFFSET (26) /* Enable port 5 Mii Rx */ +#define P3RXD_OFFSET (0) /* Port 3 RxD [7:0] */ +#define P4RXD_OFFSET (8) /* Port 4 RxD [7:0] */ +#define P5RXD_OFFSET (16) /* Port 5 RxD [7:0] */ +#else /* Before 2006/02/09 */ +/* Test mode Rx MII-like register field definitions +*/ +#define P5_RXDV (1 << 30) /* Enable port 0 MII RXDV signal */ +#define P4_RXDV (1 << 29) /* Enable port 1 MII RXDV signal */ +#define P3_RXDV (1 << 28) /* Enable port 2 MII RXDV signal */ +#define P2_RXDV (1 << 27) /* Enable port 3 MII RXDV signal */ +#define P1_RXDV (1 << 26) /* Enable port 4 MII RXDV signal */ +#define P0_RXDV (1 << 25) /* Enable port 5 MII RXDV signal */ +#define NIBBLE_MASK 0x0F /* Mask for a nibble */ +#define P5_RXD_OFFSET 20 /* Port 0 RXD MII signal */ +#define P4_RXD_OFFSET 16 /* Port 1 RXD MII signal */ +#define P3_RXD_OFFSET 12 /* Port 2 RXD MII signal */ +#define P2_RXD_OFFSET 8 /* Port 3 RXD MII signal */ +#define P1_RXD_OFFSET 4 /* Port 4 RXD MII signal */ +#define P0_RXD_OFFSET 0 /* Port 5 RXD MII signal */ +/* Test mode Tx MII-like register field definitions +*/ +#define P5_TXDV (1 << 30) /* Enable port 0 MII TXDV signal */ +#define P4_TXDV (1 << 29) /* Enable port 1 MII TXDV signal */ +#define P3_TXDV (1 << 28) /* Enable port 2 MII TXDV signal */ +#define P2_TXDV (1 << 27) /* Enable port 3 MII TXDV signal */ +#define P1_TXDV (1 << 26) /* Enable port 4 MII TXDV signal */ +#define P0_TXDV (1 << 25) /* Enable port 5 MII TXDV signal */ +#define P5_TXD_OFFSET 20 /* Port 0 TXD MII signal */ +#define P4_TXD_OFFSET 16 /* Port 1 TXD MII signal */ +#define P3_TXD_OFFSET 12 /* Port 2 TXD MII signal */ +#define P2_TXD_OFFSET 8 /* Port 3 TXD MII signal */ +#define P1_TXD_OFFSET 4 /* Port 4 TXD MII signal */ +#define P0_TXD_OFFSET 0 /* Port 5 TXD MII signal */ +#endif + +/* Test mode enable register +*/ +#define TX_TEST_PORT_OFFSET 26 /* Tx test mode enable port offset */ +#define RX_TEST_PORT_OFFSET 18 /* Rx test mode enable port offset */ +#define MiiTxPktRDY_OFFSET 10 /* Status flag of MII TX packet ready to send on port */ +#define HSABUSY (1 << 2) /* HSA process ready flag */ +#define ENHSBTESTMODE (1 << 1) /* Enable HSB Test Mode */ +#define HSB_RDY (1 << 0) /* HSB ready */ +/* Gateway MAC low register +*/ +#define GMACL_OFFSET 20 /* Gateway MAC[15:4] offset */ +#define GMACL_MASK (0xFFFFFFFF << 20) /* Gateway MAC[15:4] mask */ + + + + +#define SWMACCR_BASE (SWCORE_BASE+0x4000) +/* MAC control register field definitions */ +#define MACCR (0x000+SWMACCR_BASE) /* MAC Configuration Register */ +#define MDCIOCR (0x004+SWMACCR_BASE) /* MDC/MDIO Command */ +#define MDCIOSR (0x008+SWMACCR_BASE) /* MDC/MDIO Status */ +#define PMCR (0x00C+SWMACCR_BASE) /* Port Mirror Control Register */ +#define PPMAR (0x010+SWMACCR_BASE) /* Per port matching action */ +#define PATP0 (0x014+SWMACCR_BASE) /* Pattern for port 0 */ +#define PATP1 (0x018+SWMACCR_BASE) /* Pattern for port 1 */ +#define PATP2 (0x01C+SWMACCR_BASE) /* Pattern for port 2 */ +#define PATP3 (0x020+SWMACCR_BASE) /* Pattern for port 3 */ +#define PATP4 (0x024+SWMACCR_BASE) /* Pattern for port 4 */ +#define PATP5 (0x028+SWMACCR_BASE) /* Pattern for port 5 */ +#define MASKP0 (0x02C+SWMACCR_BASE) /* Mask for port 0 */ +#define MASKP1 (0x030+SWMACCR_BASE) /* Mask for port 1 */ +#define MASKP2 (0x034+SWMACCR_BASE) /* Mask for port 2 */ +#define MASKP3 (0x038+SWMACCR_BASE) /* Mask for port 3 */ +#define MASKP4 (0x03C+SWMACCR_BASE) /* Mask for port 4 */ +#define MASKP5 (0x040+SWMACCR_BASE) /* Mask for port 5 */ +#define BSCR (0x044+SWMACCR_BASE) /* Broadcast Storm Control Rate Configuration */ +#define CSCR (0x048+SWMACCR_BASE) /* Checksum Control Register */ +#define CCR (0x048+SWMACCR_BASE) /* Checksum Control Register */ +#define EPOCR (0x04C+SWMACCR_BASE) /* Embedded PHY Operation Control Register */ +#define EPIDR (0x050+SWMACCR_BASE) /* Embedded PHY ID Register */ + +/* MACCR - MAC control register field definitions */ +#define NORMAL_BACKOFF (1 << 28) /* Normal back off slot timer */ +#define BACKOFF_EXPONENTIAL_3 (1 << 27) /* Set back off exponential parameter 9 */ +#define DIS_BACKOFF_BIST (1 << 26) /* Disable back off BIST */ +#define IPG_SEL (1 << 25) /* Fixed IPG */ +#define INFINITE_PAUSE_FRAMES (1 << 24) /* Infinite pause frames */ +#define LONG_TXE (1 << 22) /* Back pressure, carrier based */ +#define DIS_MASK_CGST (1 << 21) +#define EN_48_DROP (1 << 20) + +/* MDCIOCR - MDC/MDIO Command */ +#define COMMAND_OFFSET 31 /* MDCMDIO Command */ +#define COMMAND_MASK (1<<31) /* 0:Read Access, 1:Write Access */ +#define COMMAND_READ (0<<31) /* 0:Read Access, 1:Write Access */ +#define COMMAND_WRITE (1<<31) /* 0:Read Access, 1:Write Access */ +#define PHYADD_OFFSET (24) /* PHY Address, said, PHY ID */ +#define PHYADD_MASK (0x1f<<24) /* PHY Address, said, PHY ID */ +#define REGADD_OFFSET (16) /* PHY Register */ +#define REGADD_MASK (0x1f<<16) /* PHY Register */ +#define WRDATA_OFFSET (0) /* Data to PHY register */ +#define WRDATA_MASK (0xffff<<0) /* Data to PHY register */ + +/* MDCIOSR - MDC/MDIO Status */ +#define MDC_STATUS (1<<31) /* 0: Process Done, 1: In progress */ +#define MDCIO_STATUS (1<<31) +#define RDATA_OFFSET (0) /* Read Data Result of PHY register */ +#define RDATA_MASK (0xffff<<0) /* Read Data Result of PHY register */ + +/* PMCR - Port mirror control register field definitions */ +#define MirrorPortMsk_OFFSET 18 /* Port receiving the mirrored traffic (single bit set to 1 is allowed) */ +#define MirrorPortMsk_MASK (0x1ff<<18) /* Port receiving the mirrored traffic (single bit set to 1 is allowed) */ +#define MirrorRxPrtMsk_OFFSET 9 /* Rx port to be mirrored (Source Mirroring, multiple ports allowed) */ +#define MirrorRxPrtMsk_MASK (0x1ff<<9) /* Rx port to be mirrored (Source Mirroring, multiple ports allowed) */ +#define MirrorTxPrtMsk_OFFSET 0 /* Tx port to be mirrored (Destination Mirroring, multiple ports allowed) */ +#define MirrorTxPrtMsk_MASK (0x1ff<<0) /* Tx port to be mirrored (Destination Mirroring, multiple ports allowed) */ + +/* PPMAR - Per port matching action register field definitions */ +#define EnPatternMatch_OFFSET 26 /* Enable pattern match port list */ +#define EnPatternMatch_MASK (0x3f<<26) /* Enable pattern match port list */ +#define EnPatternMatch_P0 (1<<26) /* Enable pattern match for port 0 */ +#define EnPatternMatch_P1 (1<<27) /* Enable pattern match for port 1 */ +#define EnPatternMatch_P2 (1<<28) /* Enable pattern match for port 2 */ +#define EnPatternMatch_P3 (1<<29) /* Enable pattern match for port 3 */ +#define EnPatternMatch_P4 (1<<30) /* Enable pattern match for port 4 */ +#define EnPatternMatch_P5 (1<<31) /* Enable pattern match for port 5 */ +#define MatchOpRx5_OFFSET 24 /* operation if matched on port 5 */ +#define MatchOpRx5_MASK (3<<24) /* operation if matched on port 5 */ +#define MatchOpRx5_DROP (0<<24) /* Drop if matched on port 5 */ +#define MatchOpRx5_MTCPU (1<<24) /* Mirror to CPU if matched on port 5 */ +#define MatchOpRx5_FTCPU (2<<24) /* Forward to CPU if matched on port 5 */ +#define MatchOpRx5_MTMP (3<<24) /* Mirror to Mirror Port if matched on port 5 */ +#define MatchOpRx4_OFFSET 22 /* operation if matched on port 4 */ +#define MatchOpRx4_MASK (3<<22) /* operation if matched on port 4 */ +#define MatchOpRx4_DROP (0<<22) /* Drop if matched on port 4 */ +#define MatchOpRx4_MTCPU (1<<22) /* Mirror to CPU if matched on port 4 */ +#define MatchOpRx4_FTCPU (2<<22) /* Forward to CPU if matched on port 4 */ +#define MatchOpRx4_MTMP (3<<22) /* Mirror to Mirror Port if matched on port 4 */ +#define MatchOpRx3_OFFSET 20 /* operation if matched on port 3 */ +#define MatchOpRx3_MASK (3<<20) /* operation if matched on port 3 */ +#define MatchOpRx3_DROP (0<<20) /* Drop if matched on port 3 */ +#define MatchOpRx3_MTCPU (1<<20) /* Mirror to CPU if matched on port 3 */ +#define MatchOpRx3_FTCPU (2<<20) /* Forward to CPU if matched on port 3 */ +#define MatchOpRx3_MTMP (3<<20) /* Mirror to Mirror Port if matched on port 3 */ +#define MatchOpRx2_OFFSET 18 /* operation if matched on port 2*/ +#define MatchOpRx2_MASK (3<<18) /* operation if matched on port 2 */ +#define MatchOpRx2_DROP (0<<18) /* Drop if matched on port 2 */ +#define MatchOpRx2_MTCPU (1<<18) /* Mirror to CPU if matched on port 25 */ +#define MatchOpRx2_FTCPU (2<<18) /* Forward to CPU if matched on port 2 */ +#define MatchOpRx2_MTMP (3<<18) /* Mirror to Mirror Port if matched on port 2 */ +#define MatchOpRx1_OFFSET 16 /* operation if matched on port 1 */ +#define MatchOpRx1_MASK (3<<16) /* operation if matched on port 1 */ +#define MatchOpRx1_DROP (0<<16) /* Drop if matched on port 1 */ +#define MatchOpRx1_MTCPU (1<<16) /* Mirror to CPU if matched on port 1 */ +#define MatchOpRx1_FTCPU (2<<16) /* Forward to CPU if matched on port 1 */ +#define MatchOpRx1_MTMP (3<<16) /* Mirror to Mirror Port if matched on port 1 */ +#define MatchOpRx0_OFFSET 14 /* operation if matched on port 0 */ +#define MatchOpRx0_MASK (3<<14) /* operation if matched on port 0 */ +#define MatchOpRx0_DROP (0<<14) /* Drop if matched on port 0 */ +#define MatchOpRx0_MTCPU (1<<14) /* Mirror to CPU if matched on port 0 */ +#define MatchOpRx0_FTCPU (2<<14) /* Forward to CPU if matched on port 0 */ +#define MatchOpRx0_MTMP (3<<14) /* Mirror to Mirror Port if matched on port 0 */ + +/* CSCR, CCR - Checksum Control Register */ +#define EnL4ChkCal (1<<5) /* Enable L4 Checksum Re-calculation */ +#define EnL3ChkCal (1<<4) /* Enable L3 Checksum Re-calculation */ +#if defined(CONFIG_RTL_8196C) || defined(CONFIG_RTL_8198) +#define AcceptL2Err (1<<3) /* CPU port L2 CRC Error Allow; 0: Not Allowed, 1: Allowed (default) */ +#endif +#define L4ChkSErrAllow (1<<2) /* L4 Checksum Error Allow */ +#define L3ChkSErrAllow (1<<1) /* L3 Checksum Error Allow */ +#define L2CRCErrAllow (1<<0) /* L2 CRC Error Allow */ + +/* EPOCR, EPIDR - Embedded PHY Operation Control Register */ +#define Port_embPhyID_MASK(port) ( 0x1f << ( port * 5 ) ) /* Embedded PHY ID MASK of port 'idx' */ +#define Port_embPhyID(id, port) ( id << ( port * 5 ) ) /* Embedded PHY ID setting of port 'idx' */ + +#define PCRAM_BASE (SWCORE_BASE+0x4100) +#define PITCR (0x000 + PCRAM_BASE) /* Port Interface Type Control Register */ +#define PCRP0 (0x004 + PCRAM_BASE) /* Port Configuration Register of Port 0 */ +#define PCRP1 (0x008 + PCRAM_BASE) /* Port Configuration Register of Port 1 */ +#define PCRP2 (0x00C + PCRAM_BASE) /* Port Configuration Register of Port 2 */ +#define PCRP3 (0x010 + PCRAM_BASE) /* Port Configuration Register of Port 3 */ +#define PCRP4 (0x014 + PCRAM_BASE) /* Port Configuration Register of Port 4 */ +#define PCRP5 (0x018 + PCRAM_BASE) /* Port Configuration Register of Port 5 */ +#define PCRP6 (0x01C + PCRAM_BASE) /* Port Configuration Register of Ext Port 0 */ +#define PCRP7 (0x020 + PCRAM_BASE) /* Port Configuration Register of Ext Port 1 */ +#define PCRP8 (0x024 + PCRAM_BASE) /* Port Configuration Register of Ext Port 2 */ +#define PSRP0 (0x028 + PCRAM_BASE) /* Port Status Register Port 0 */ +#define PSRP1 (0x02C + PCRAM_BASE) /* Port Status Register Port 1 */ +#define PSRP2 (0x030 + PCRAM_BASE) /* Port Status Register Port 2 */ +#define PSRP3 (0x034 + PCRAM_BASE) /* Port Status Register Port 3 */ +#define PSRP4 (0x038 + PCRAM_BASE) /* Port Status Register Port 4 */ +#define PSRP5 (0x03C + PCRAM_BASE) /* Port Status Register Port 5 */ +#define PSRP6 (0x040 + PCRAM_BASE) /* Port Status Register Port 6 */ +#define PSRP7 (0x044 + PCRAM_BASE) /* Port Status Register Port 7 */ +#define PSRP8 (0x048 + PCRAM_BASE) /* Port Status Register Port 8 */ +#define P0GMIICR (0x04C + PCRAM_BASE) /* Port-0 GMII Configuration Register */ +#define P5GMIICR (0x050 + PCRAM_BASE) /* Port-5 GMII Configuration Register */ + +/* PITCR - Port Interface Type Control Register */ +#define Port5_TypeCfg_GMII_MII_RGMII (0<<10) +#define Port4_TypeCfg_UTP (0<< 8) +#define Port4_TypeCfg_SerDes (1<< 8) +#define Port3_TypeCfg_UTP (0<< 6) +#define Port3_TypeCfg_SerDes (1<< 6) +#define Port2_TypeCfg_UTP (0<< 4) +#define Port2_TypeCfg_SerDes (1<< 4) +#define Port1_TypeCfg_UTP (0<< 2) +#define Port1_TypeCfg_SerDes (1<< 2) +#define Port0_TypeCfg_UTP (0<< 0) +#define Port0_TypeCfg_GMII_MII_RGMII (1<< 0) + +#if defined(CONFIG_RTL_8196C) || defined(CONFIG_RTL_8198) + +#define GIGA_P5_PHYID 0x16 +/* 0xBB804104 ~ 0xBB804124 */ +/* PCRP0,PCRP1,PCRP2,PCRP3,PCRP4,PCRP5,PCRP6,PCRP7,PCRP8 - Port Configuration Register */ +#define BYPASS_TCRC (1 << 31) /* Not recalculate CRC error */ +#define ExtPHYID_OFFSET (26) /* External PHY ID */ +#define ExtPHYID_MASK (0x1f<<26) /* External PHY ID */ +#define EnForceMode (1<<25) /* Enable Force Mode to set link/speed/duplix/flow status */ + + /* EnForceMode=0, PollLinkStatus: do not care + EnForceMode=1, PollLinkStatus=0 : ForceMode , disable Auto-Negotiation. It's noted that The mode should be setting for MAC-to-MAC connection. + PollLinkStatus=1: ForceMode with polling link status, disable Auto-Negotiation but polling phy's link status. + */ +#define PollLinkStatus (1<<24) +#define ForceLink (1<<23) /* 0-link down, 1-link up */ + + /* FrcAbi_AnAbi_sel[4:0]: bit 22 ~ 18 + If EnForceMode = 1, FrcAbi_AnAbi_sel is used to indicate the force mode operation. (For either MAC mode or PHY mode operation.) + FrcAbi_AnAbi_sel[0] = ForceDuplex1: force FULL duplex , 0: force HALF duplex + FrcAbi_AnAbi_sel[2:1] = ForceSpeed00: force 10Mbps 01: force 100Mbps ( default setting for port#5 NFBI-PHY-mode spec. ) + 10: force 1000Mbps 11: reserved. + FrcAbi_AnAbi_sel[4:3] = Reserved, useless. + If EnForceMode = 0, FrcAbi_AnAbi_sel is used to indicate Auto-Negotiation advertise ability. + FrcAbi_AnAbi_sel[0]: 10Mbps Half-duplexFrcAbi_AnAbi_sel[1]: 10Mbps Full-duplexFrcAbi_AnAbi_sel[2]: 100Mbps Half-duplex + FrcAbi_AnAbi_sel[3]: 100Mbps Full-duplexFrcAbi_AnAbi_sel[4]: 1000Mbps Full-duplex + */ +// !!! temp, 8198 has no these bits +#define IPMSTP_PortST_MASK (3<<21) /* Mask of IP Multicast Spanning Tree Protocol Port State Control */ +#define IPMSTP_PortST_OFFSET (21) /* Offset of IP Multicast Spanning Tree Protocol Port State Control */ +#define IPMSTP_PortST_DISABLE (0<<21) /* Disable State of IP Multicast Spanning Tree Protocol Port State Control */ +#define IPMSTP_PortST_BLOCKING (1<<21) /* Blocking State of IP Multicast Spanning Tree Protocol Port State Control */ +#define IPMSTP_PortST_LISTENING (1<<21) /* Listening State of IP Multicast Spanning Tree Protocol Port State Control */ +#define IPMSTP_PortST_LEARNING (2<<21) /* Learning State of IP Multicast Spanning Tree Protocol Port State Control */ +#define IPMSTP_PortST_FORWARDING (3<<21) /* Forwarding State of IP Multicast Spanning Tree Protocol Port State Control */ + +#define ForceSpeedMask (3<<19) /* Force speed Mask */ +#define ForceSpeed10M (0<<19) /* Force speed 10M */ +#define ForceSpeed100M (1<<19) /* Force speed 100M */ +#define ForceSpeed1000M (2<<19) /* Force speed 1G */ +#define ForceDuplex (1<<18) /* Force Duplex */ +#define AutoNegoSts_OFFSET (18) +#define AutoNegoSts_MASK (0x1f<<18) +/* bit 16, 17 + if EnForceMode = 1, PAUSE flow control ability Control . + [0]= enable TX pause ability + [1]= enable RX pause ability + if EnForceMode =0, PHY advertise pause operation ability : + [0]= PAUSE operation for full duplex links + [1]= Asymmetric PAUSE operation for full duplex links + */ +#define PauseFlowControl_MASK (3<<16) /* Mask for per-port 802.3 PAUSE flow control ability control */ +#define PauseFlowControlNway (0<<16) /* Follow the PHY N-way result */ +#define PauseFlowControlEtxDrx (1<<16) /* force: enable TX, disable RX */ +#define PauseFlowControlDtxErx (2<<16) /* force: disable TX, enable RX */ +#define PauseFlowControlEtxErx (3<<16) /* force: enable TX, enable RX */ + +#define MIIcfg_CRS (1<<15) /* MII interface Parameter setup */ +#define MIIcfg_COL (1<<14) /* MII interface Parameter setup */ +#define MIIcfg_RXER (1<<13) /* MII interface Parameter setup */ +#define GMIIcfg_CRS (1<<12) /* GMII interface Parameter setup */ +#define BCSC_Types_MASK (7<<9) /* Broadcast Storm Control packet type selection */ +//#define BCSC_ENUNKNOWNUNICAST (1<<11) /* Enable control for unknown unicast packet */ +#define BCSC_ENMULTICAST (1<<10) /* Enable control for multicast packet */ +#define BCSC_ENBROADCAST (1<<9) /* Enable control for broadcast packet */ +#define ENBCSC (1<<8) /* Enable broadcast storm control */ +#define EnLoopBack (1<<7) /* Enable MAC-PHY interface Mii Loopback */ +#define DisBKP (1<<6) /* Per-port Disable Backpressure function for Half duplex */ +#define STP_PortST_MASK (3<<4) /* Mask Spanning Tree Protocol Port State Control */ +#define STP_PortST_OFFSET (4) /* Offset */ +#define STP_PortST_DISABLE (0<<4) /* Disable State */ +#define STP_PortST_BLOCKING (1<<4) /* Blocking State */ +#define STP_PortST_LISTENING (1<<4) /* Listening State */ +#define STP_PortST_LEARNING (2<<4) /* Learning State */ +#define STP_PortST_FORWARDING (3<<4) /* Forwarding State */ +#define MacSwReset (1<<3) /* 0: reset state, 1: normal state */ +#define AcptMaxLen_OFFSET (1) /* Enable the max acceptable packet length supported */ +#define AcptMaxLen_MASK (3<<1) /* Enable the max acceptable packet length supported */ +#define AcptMaxLen_1536 (0<<1) /* 1536 Bytes (RTL865xB) */ +#define AcptMaxLen_1552 (1<<1) /* 1552 Bytes (RTL865xB) */ +#define AcptMaxLen_9K (2<<1) /* 9K(9216) Bytes */ +#define AcptMaxLen_16K (3<<1) /* 16370 bytes = 16K-2(cutoff)-4(vlan)-8(pppoe) */ +#define EnablePHYIf (1<<0) /* Enable PHY interface. */ + +/* 0xBB804150 P5GMIICR */ +#define Conf_done (1<<6) /*Port5 configuration is done to enable the frame reception and transmission. */ +#define P5txdely (1<<4) /*Port5 TX clock delay. */ + + +/* 0xBB804008 */ +/* MDCIOSR - MDC/MDIO Status */ +#define MDCIOSR_ReadError (1<<30) /* read only: MII management frame reading error */ + + +/* 0xBB804008 */ +/* GDSR0 - Global Descriptor Status Register 0 */ +#define HSA_OverRun (1<<28) /* HSA fifo is overflow */ + +#else +/* PCRP0,PCRP1,PCRP2,PCRP3,PCRP4,PCRP5,PCRP6,PCRP7,PCRP8 - Port Configuration Register */ +#define BYPASS_TCRC (1 << 29) /* Not recalculate CRC error */ +#define ExtPHYID_OFFSET (24) /* External PHY ID */ +#define ExtPHYID_MASK (0x1f<<24) /* External PHY ID */ +#define EnForceMode (1<<23) /* Enable Force Mode to set link/speed/duplix/flow status */ +#define ForceLink (1<<22) /* 0-link down, 1-link up */ +#define ForceSpeedMask (3<<20) /* Force speed Mask */ +#define ForceSpeed10M (0<<20) /* Force speed 10M */ +#define ForceSpeed100M (1<<20) /* Force speed 100M */ +#define ForceSpeed1000M (2<<20) /* Force speed 1G */ +#define ForceDuplex (1<<19) /* Force Duplex */ +#define MIIcfg_CRS (1<<18) /* MII interface Parameter setup */ +#define MIIcfg_COL (1<<17) /* MII interface Parameter setup */ +#define MIIcfg_RXER (1<<16) /* MII interface Parameter setup */ +#define GMIIcfg_CRS (1<<15) /* GMII interface Parameter setup */ +#define BCSC_Types_MASK (7<<12) /* Broadcast Storm Control packet type selection */ +#define BCSC_ENUNKNOWNUNICAST (1<<14) /* Enable control for unknown unicast packet */ +#define BCSC_ENMULTICAST (1<<13) /* Enable control for multicast packet */ +#define BCSC_ENBROADCAST (1<<12) /* Enable control for broadcast packet */ +#define ENBCSC (1<<11) /* Enable broadcast storm control */ +#define EnLoopBack (1<<10) /* Enable MAC-PHY interface Mii Loopback */ +#define PauseFlowControl_MASK (3<<8) /* Mask for per-port 802.3 PAUSE flow control ability control */ +#define PauseFlowControlNway (0<<8) /* Follow the PHY N-way result */ +#define PauseFlowControlEtxDrx (1<<8) /* force: enable TX, disable RX */ +#define PauseFlowControlDtxErx (2<<8) /* force: disable TX, enable RX */ +#define PauseFlowControlEtxErx (3<<8) /* force: enable TX, enable RX */ +#define DisBKP (1<<7) /* Per-port Disable Backpressure function for Half duplex */ +#define STP_PortST_MASK (3<<5) /* Mask Spanning Tree Protocol Port State Control */ +#define STP_PortST_OFFSET (5) /* Offset */ +#define STP_PortST_DISABLE (0<<5) /* Disable State */ +#define STP_PortST_BLOCKING (1<<5) /* Blocking State */ +#define STP_PortST_LISTENING (1<<5) /* Listening State */ +#define STP_PortST_LEARNING (2<<5) /* Learning State */ +#define STP_PortST_FORWARDING (3<<5) /* Forwarding State */ +#define IPMSTP_PortST_MASK (3<<3) /* Mask of IP Multicast Spanning Tree Protocol Port State Control */ +#define IPMSTP_PortST_OFFSET (3) /* Offset of IP Multicast Spanning Tree Protocol Port State Control */ +#define IPMSTP_PortST_DISABLE (0<<3) /* Disable State of IP Multicast Spanning Tree Protocol Port State Control */ +#define IPMSTP_PortST_BLOCKING (1<<3) /* Blocking State of IP Multicast Spanning Tree Protocol Port State Control */ +#define IPMSTP_PortST_LISTENING (1<<3) /* Listening State of IP Multicast Spanning Tree Protocol Port State Control */ +#define IPMSTP_PortST_LEARNING (2<<3) /* Learning State of IP Multicast Spanning Tree Protocol Port State Control */ +#define IPMSTP_PortST_FORWARDING (3<<3) /* Forwarding State of IP Multicast Spanning Tree Protocol Port State Control */ +#define AcptMaxLen_OFFSET (1) /* Enable the max acceptable packet length supported */ +#define AcptMaxLen_MASK (3<<1) /* Enable the max acceptable packet length supported */ +#define AcptMaxLen_1536 (0<<1) /* 1536 Bytes (RTL865xB) */ +#define AcptMaxLen_1552 (1<<1) /* 1552 Bytes (RTL865xB) */ +#define AcptMaxLen_9K (2<<1) /* 9K(9216) Bytes */ +#define AcptMaxLen_16K (3<<1) /* 16370 bytes = 16K-2(cutoff)-4(vlan)-8(pppoe) */ +#define EnablePHYIf (1<<0) /* Enable PHY interface. */ +#endif + +/* PSRP0,PSRP1,PSRP2,PSRP3,PSRP4,PSRP5,PSRP6,PSRP7,PSRP8 - Port Status Register Port 0~8 */ +#define LinkDownEventFlag (1<<8) /* Port Link Down Event detecting monitor flag */ +#define PortStatusNWayEnable (1<<7) /* N-Way Enable */ +#define PortStatusRXPAUSE (1<<6) /* Rx PAUSE */ +#define PortStatusTXPAUSE (1<<5) /* Tx PAUSE */ +#define PortStatusLinkUp (1<<4) /* Link Up */ +#define PortStatusDuplex (1<<3) /* Duplex */ +#define PortStatusLinkSpeed_MASK (3<<0) /* Link Speed */ +#define PortStatusLinkSpeed_OFFSET 0 +#define PortStatusLinkSpeed10M (0<<0) /* 10M */ +#define PortStatusLinkSpeed100M (1<<0) /* 100M */ +#define PortStatusLinkSpeed1000M (2<<0) /* 1000M */ +#define PortStatusLinkSpeedReserved (3<<0) /* Reserved Speed */ + +/* P0GMIICR Port-0 / Port-5 GMII Configuration Register */ +#define CFG_GMAC_MASK (3<<23) /* The register default reflect the HW power on strapping value of H/W pin. */ +#define CFG_GMAC_RGMII (0<<23) /* RGMII mode */ +#define CFG_GMAC_GMII_MII_MAC (1<<23) /* GMII/MII MAC mode */ +#define CFG_GMAC_GMII_MII_PHY (2<<23) /* GMII/MII PHY mode */ +#define CFG_GMAC_Reserved (3<<23) /* Reserved */ + +#define RGMII_RCOMP_MASK (3<<0) /* RGMII Input Timing compensation control */ +#define RGMII_RCOMP_0NS (0<<0) /* Rcomp 0.0 ns */ +#define RGMII_RCOMP_1DOT5NS (1<<0) /* Rcomp 1.5 ns */ +#define RGMII_RCOMP_2NS (2<<0) /* Rcomp 2.0 ns */ +#define RGMII_RCOMP_2DOT5NS (3<<0) /* Rcomp 3.0 ns */ +#define RGMII_TCOMP_MASK (7<<2) /* RGMII Output Timing compensation control */ +#define RGMII_TCOMP_0NS (0<<2) /* Tcomp 0.0 ns */ +#define RGMII_TCOMP_1DOT5NS (1<<2) /* Tcomp 1.5 ns */ +#define RGMII_TCOMP_2NS (2<<2) /* Tcomp 2.0 ns */ +#define RGMII_TCOMP_2DOT5NS (3<<2) /* Tcomp 2.5 ns */ +#define RGMII_TCOMP_3NS (4<<2) /* Tcomp 3.0 ns */ +#define RGMII_TCOMP_4NS (5<<2) /* Tcomp 4.0 ns */ +#define RGMII_TCOMP_6NS (6<<2) /* Tcomp 6.0 ns */ +#define RGMII_TCOMP_7NS (7<<2) /* Tcomp 7.0 ns */ + +#define EEECR (0x60+PCRAM_BASE) /* EEE ability Control Register ( 0xBB80_4160 ) */ +/* EEE ability Control Register ( 0xBB80_4160 ) */ +#define EN_P5_FRC_EEE (1 << 29) /* Enable Port 5 EEE force mode */ +#define FRC_P5_EEE_Giga (1 << 28) /* Force Port 5 EEE ability for 1000BASE-T. */ +#define FRC_P5_EEE_100 (1 << 27) /* Force Port 5 EEE ability for 100BASE-TX. */ +#define EN_P5_TX_EEE (1 << 26) /* Enable Port 5 MAC TX EEE ability */ +#define EN_P5_RX_EEE (1 << 25) /* Enable Port 5 MAC RX EEE ability */ +#define EN_P4_FRC_EEE (1 << 24) /* Enable Port 4 EEE force mode */ +#define FRC_P4_EEE_Giga (1 << 23) /* Force Port 4 EEE ability for 1000BASE-T. */ +#define FRC_P4_EEE_100 (1 << 22) /* Force Port 4 EEE ability for 100BASE-TX. */ +#define EN_P4_TX_EEE (1 << 21) /* Enable Port 4 MAC TX EEE ability */ +#define EN_P4_RX_EEE (1 << 20) /* Enable Port 4 MAC RX EEE ability */ +#define EN_P3_FRC_EEE (1 << 19) /* Enable Port 3 EEE force mode */ +#define FRC_P3_EEE_Giga (1 << 18) /* Force Port 3 EEE ability for 1000BASE-T. */ +#define FRC_P3_EEE_100 (1 << 17) /* Force Port 3 EEE ability for 100BASE-TX. */ +#define EN_P3_TX_EEE (1 << 16) /* Enable Port 3 MAC TX EEE ability */ +#define EN_P3_RX_EEE (1 << 15) /* Enable Port 3 MAC RX EEE ability */ +#define EN_P2_FRC_EEE (1 << 14) /* Enable Port 2 EEE force mode */ +#define FRC_P2_EEE_Giga (1 << 13) /* Force Port 2 EEE ability for 1000BASE-T */ +#define FRC_P2_EEE_100 (1 << 12) /* Force Port 2 EEE ability for 100BASE-TX. */ +#define EN_P2_TX_EEE (1 << 11) /* Enable Port 2 MAC TX EEE ability */ +#define EN_P2_RX_EEE (1 << 10) /* Enable Port 2 MAC RX EEE ability */ +#define EN_P1_FRC_EEE (1 << 9) /* Enable Port 1 EEE force mode */ +#define FRC_P1_EEE_Giga (1 << 8) /* Force Port 1 EEE ability for 1000BASE-T. */ +#define FRC_P1_EEE_100 (1 << 7) /* Force Port 1 EEE ability for 100BASE-TX. */ +#define EN_P1_TX_EEE (1 << 6) /* Enable Port 1 MAC TX EEE ability */ +#define EN_P1_RX_EEE (1 << 5) /* Enable Port 1 MAC RX EEE ability */ +#define EN_P0_FRC_EEE (1 << 4) /* Enable Port 0 EEE force mode */ +#define FRC_P0_EEE_Giga (1 << 3) /* Force Port 0 EEE ability for 1000BASE-T. */ +#define FRC_P0_EEE_100 (1 << 2) /* Force Port 0 EEE ability for 100BASE-TX. */ +#define EN_P0_TX_EEE (1 << 1) /* Enable Port 0 MAC TX EEE ability */ +#define EN_P0_RX_EEE (1 << 0) /* Enable Port 0 MAC RX EEE ability */ + + +#define SWMISC_BASE (0x4200+SWCORE_BASE) +/* Chip Version ID Register */ +#define CVIDR (0x00+SWMISC_BASE) /* Chip Version ID Register */ +#define SSIR (0x04+SWMISC_BASE) /* System Initial and Reset Registe*/ + +#if defined(CONFIG_RTL_8196C) || defined(CONFIG_RTL_8198) +#define CRMR (0x08+SWMISC_BASE) /* Chip Revision Management Register */ +#define BISTCR (0x0C+SWMISC_BASE) /* BIST control */ +#define BISTTSDR0 (0x38+SWMISC_BASE) /* BIST Test Status Diagnostic Register 0 */ +#define BISTTSDR1 (0x38+SWMISC_BASE) /* BIST Test Status Diagnostic Register 1 */ +#define BISTTSDR2 (0x3C+SWMISC_BASE) /* BIST Test Status Diagnostic Register 2 */ +#define BISTTSDR3 (0x40+SWMISC_BASE) /* BIST Test Status Diagnostic Register 3 */ +#define BISTTSDR4 (0x44+SWMISC_BASE) /* BIST Test Status Diagnostic Register 4 */ +#define BISTTSDR5 (0x48+SWMISC_BASE) /* BIST Test Status Diagnostic Register 5 */ +#define BISTTSDR6 (0x4C+SWMISC_BASE) /* BIST Test Status Diagnostic Register 6 */ +#define BISTTSDR7 (0x50+SWMISC_BASE) /* BIST Test Status Diagnostic Register 7 */ +#define BISTTSDR8 (0x54+SWMISC_BASE) /* BIST Test Status Diagnostic Register 8 */ +#define BISTTSDR9 (0x58+SWMISC_BASE) /* BIST Test Status Diagnostic Register 9 */ +#define BISTTSDR10 (0x5C+SWMISC_BASE) /* BIST Test Status Diagnostic Register 10 */ +#define BISTTSDR11 (0x60+SWMISC_BASE) /* BIST Test Status Diagnostic Register 11 */ +#else +#define BISTCR (0x08+SWMISC_BASE) /* BIST control */ +#define BISTTSDR0 (0x0C+SWMISC_BASE) /* BIST Test Status Diagnostic Register 0 */ +#define BISTTSDR1 (0x10+SWMISC_BASE) /* BIST Test Status Diagnostic Register 1 */ +#define BISTTSDR2 (0x14+SWMISC_BASE) /* BIST Test Status Diagnostic Register 2 */ +#define BISTTSDR3 (0x18+SWMISC_BASE) /* BIST Test Status Diagnostic Register 3 */ +#define BISTTSDR4 (0x1C+SWMISC_BASE) /* BIST Test Status Diagnostic Register 4 */ +#define BISTTSDR5 (0x20+SWMISC_BASE) /* BIST Test Status Diagnostic Register 5 */ +#define BISTTSDR6 (0x24+SWMISC_BASE) /* BIST Test Status Diagnostic Register 6 */ +#define BISTTSDR7 (0x28+SWMISC_BASE) /* BIST Test Status Diagnostic Register 7 */ +#define BISTTSDR8 (0x2C+SWMISC_BASE) /* BIST Test Status Diagnostic Register 8 */ +#define BISTTSDR9 (0x30+SWMISC_BASE) /* BIST Test Status Diagnostic Register 9 */ +#define BISTTSDR10 (0x34+SWMISC_BASE) /* BIST Test Status Diagnostic Register 10 */ +#define BISTTSDR11 (0x38+SWMISC_BASE) /* BIST Test Status Diagnostic Register 11 */ +#define CRMR (0x3C+SWMISC_BASE) /* Chip Revision Management Register */ +#endif +#define SIRR (SSIR) /* Alias Name */ + +/* SIRR, SSIR - System Initial and Reset Register*/ +#define SwitchFullRst (1 << 2) /* Reset all tables & queues */ +#define SwitchSemiRst (1 << 1) /* Reset queues */ +#define TRXRDY (1 << 0) /* Start normal TX and RX */ +#define FULL_RST SwitchFullRst /* Alias Name */ +#define SEMI_RST SwitchSemiRst /* Alias Name */ + +/* BISTCR - BIST control register field definitions */ +#define DisBIST (1<<31) /* (RO)1 if Disable all SRAM BIST. By default, all SRAM BIST are invoked after power-on reset completes. */ +#define dis_skip_fp (1<<30) /* Disable skipping fail pages. Only column repairs of the packet buffer take effect. */ +#define diag_mode (1<<29) /* Enter the diagnosis mode for the SRAM of packet buffer */ +#define diag_done (1<<28) /* The diagnosis mode for the packet buffer allows the user to perform diagnosis of the memory defects. */ +#define lat_fail_info (1<<27) /* Latch failure information for a specific testing condition. */ +#define bisting_MASK (0x000007ff)/* bisting[10]=NICTXRAM BIST ongoingbisting + [9]=NICRXRAM BIST ongoingbisting + [8]=V4KRAM BIST ongoingbisting + [7]=PBRAM BIST ongoingbisting + [6]=OQRAM BIST ongoingbisting + [5]=MIBRAM BIST ongoingbisting + [4]=L2/L4RAM BIST ongoingbisting + [3]=IQRAM BIST ongoingbisting + [2]=HTRAM BIST ongoingbisting + [1]=HSARAM BIST ongoingbisting + [0]=ACL/AMI/RLMRAM BIST ongoing */ +#define bisting_OFFSET 0 +#define BIST_READY_MASK bisting_MASK /* Alias Name */ +#define BIST_READY_PATTERN 0x00000000 + +/* BISTTSDR0 - IST Test Status Diagnostic Register 0 */ +#define BISTTSDR0_READY_MASK 0x03ffffff +#define BISTTSDR0_READY_PATTERN 0x00000000 + +/* Chip version ID register field definitions */ +#define RTL8650_CVID 0x86500000 + + +/**********************************************************************/ +#define ALE_BASE (0x4400+SWCORE_BASE) +#define TEACR (0x00+ALE_BASE) /* Table Entry Aging Control Register */ +#define TEATCR (0x04+ALE_BASE) /* Table entry aging time control */ +#define RMACR (0x08+ALE_BASE) /* Reserved Multicast Address Address Mapping */ +#define ALECR (0x0C+ALE_BASE) /* ALE Control Register */ +#define MSCR (0x10+ALE_BASE) /* Module Switch Control Register */ +#define TTLCR (0x0C+ALE_BASE) /* TTL control */ +#define L4TOCR (0x14+ALE_BASE) /* L4 Table Offset control */ +#define SWTCR0 (0x18+ALE_BASE) /* swtich table control register 0 */ +#define SWTCR1 (0x1C+ALE_BASE) /* swtich table control register 1 */ +#define PLITIMR (0x20+ALE_BASE) /* Port to LAN Interface Table Index Mapping Register */ +#define DACLRCR (0x24+ALE_BASE) /* default ACL rule control register */ +#define FFCR (0x28+ALE_BASE) /*Frame Forwarding Configuratoin Register */ +#define MGFCR_E0R0 (0x2C+ALE_BASE) /*L2 MAC Group Forwarding Control Register Entry_0 R0 */ +#define MGFCR_E0R1 (0x30+ALE_BASE) /*L2 MAC Group Forwarding Control Register Entry_1 R1 */ +#define MGFCR_E0R2 (0x34+ALE_BASE) /*L2 MAC Group Forwarding Control Register Entry_2 R2 */ +#define MGFCR_E1R0 (0x38+ALE_BASE) /*L2 MAC Group Forwarding Control Register Entry_0 R0 */ +#define MGFCR_E1R1 (0x3C+ALE_BASE) /*L2 MAC Group Forwarding Control Register Entry_1 R1 */ +#define MGFCR_E1R2 (0x40+ALE_BASE) /*L2 MAC Group Forwarding Control Register Entry_2 R2 */ +#define MGFCR_E2R0 (0x44+ALE_BASE) /*L2 MAC Group Forwarding Control Register Entry_0 R0 */ +#define MGFCR_E2R1 (0x48+ALE_BASE) /*L2 MAC Group Forwarding Control Register Entry_1 R1 */ +#define MGFCR_E2R2 (0x4C+ALE_BASE) /*L2 MAC Group Forwarding Control Register Entry_2 R2 */ +#define MGFCR_E3R0 (0x50+ALE_BASE) /*L2 MAC Group Forwarding Control Register Entry_0 R0 */ +#define MGFCR_E3R1 (0x54+ALE_BASE) /*L2 MAC Group Forwarding Control Register Entry_1 R1 */ +#define MGFCR_E3R2 (0x58+ALE_BASE) /*L2 MAC Group Forwarding Control Register Entry_2 R2 */ +#define OCR L4TOCR /* Alias Name */ + + +/* TEACR - Table Entry Aging Control Register */ +#define EnRateLimitTbAging (1<<6) /* Enable Rate Limit table hardware aging function. */ +#define EnL2FastAging (1<<5) /* Enable L2 Fast Aging Out */ +#define EnL2HashColOW (1<<4) /* Enable L2 Tablsh Hash Collision Over Write */ +#define IPMcastAgingDisable (1<<3) /* 0=Enable IP Multicast table aging. 1=disable */ +#define PPPoEAgingDisable (1<<2) /* 0=Enable PPPoE Table Aging. 1=disable */ +#define L4AgingDisable (1<<1) /* 0=Enable L4 Aging. 1=disable */ +#define L2AgingDisable (1<<0) /* 0=Enable L2 Aging. 1=disable */ + +/* TEATCR - Table entry aging time control */ +#define ICMPT_OFFSET 24 /* ICMP Timeout */ +#define ICMPT_MASK (0x3f<<24) /* ICMP TImeout */ +#define UDPT_OFFSET 18 /* UDP Timeout */ +#define UDPT_MASK (0x3f<<18) /* UDP Timeout */ +#define TCPLT_OFFSET 12 /* TCP Long Timeout */ +#define TCPLT_MASK (0x3f<<12) /* TCP Long Timeout */ +#define TCPMT_OFFSET 6 /* TCP Medium Timeout */ +#define TCPMT_MASK (0x3f<<6) /* TCP Medium Timeout */ +#define TCPST_OFFSET 0 /* TCP Short Timeout */ +#define TCPST_MASK (0x3f<<0) /* TCP Short Timeout */ + +/* RMACR - Reserved Multicast Address Address Mapping (01-80-c2-00-00-xx) */ +#define MADDR20_2F (1<< 8) /* GARP Reserved Address */ +#define MADDR00_10 (1<< 7) /* 802.1d Reservedd Address */ +#define MADDR21 (1<< 6) /* GVRP Address */ +#define MADDR20 (1<< 5) /* GMRP Address */ +#define MADDR10 (1<< 4) /* All LANs Bridge Management Group Address */ +#define MADDR0E (1<< 3) /* IEEE Std. 802.1AB Link Layer Discovery protocol multicast address */ +#define MADDR03 (1<< 2) /* IEEE Std 802.1X PAE address */ +#define MADDR02 (1<< 1) /* IEEE Std 802.3ad Slow Protocols-Multicast address */ +#define MADDR00 (1<< 0) /* BPDU (Bridge Group Address) */ + +/* ALECR */ +#define EN_PPPOE (1<<18) /* Enable PPPoE auto-encapsulation and auto-decapsulation */ +#define TTL_1Enable (1<<16) /* Enable TTL-1 operation for L3 routing */ +#define Fragment2CPU (1<<15) /* When ACL is enabled, enable all fragmented IP packet to be trapped to CPU (because L4 is needed) + When ACL is disabled, if this bit is set, L2 forwarding as before, L3 above operation will trapped to CPU. + When ACL is disabled, if this bit is not set, IP fragment packet will be forwarded as normal via L3 routing or NAT. */ +#define FRAG2CPU Fragment2CPU +#define MultiCastMTU_OFFSET (0) +#define MultiCastMTU_MASK (0x3fff) +#define MULTICAST_L2_MTU_MASK MultiCastMTU_MASK /* Alias Name */ +#define EN_TTL1 TTL_1Enable /* Alias Name */ + + +/* MSCR - Module Switch Control Register */ +#define DisChk_CFI (1<< 9) /* Disable Check CFI bit for L2 random packet testing purpose. */ +#define EnRRCP2CPU (1<< 7) /* Enable trap RRCP packet to CPU port for L2 testing purpose. RRCP: Realtek Remote Control Protocol (Proprietary) */ +#define NATTM (1<< 6) /* 0: Normal mode processing, 1: NAT Test Mode */ +#define Enable_ST (1<< 5) /* Enable Spanning Tree Protocol. 0: disable, 1: enable */ +#define Ingress_ACL (1<< 4) /* Enable Ingress ACL. 0: disable, 1: enable */ +#define Egress_ACL (1<< 3) /* Enable Egress ACL. 0: disable, 1: enable */ +#define Mode_OFFSET 0 /* Switch operation layer function mode */ +#define Mode_MASK (7<< 0) /* Switch operation layer function mode */ +#define Mode_enL2 (1<< 0) /* Enable L2 */ +#define Mode_enL3 (1<< 1) /* Enable L3 */ +#define Mode_enL4 (1<< 2) /* Enable L4 */ +#define EN_STP Enable_ST /* Alias Name */ +#define EN_IN_ACL Ingress_ACL /* Alias Name */ +#define EN_OUT_ACL Egress_ACL /* Alias Name */ +#define EN_L4 Mode_enL4 /* Alias Name */ +#define EN_L3 Mode_enL3 /* Alias Name */ +#define EN_L2 Mode_enL2 /* Alias Name */ + +/* SWTCR0 - swtich table control register */ +#define STOP_TLU_STA (1<<19) /* (RO) Table Lookup Stop Status. 1-STOP_TLU command execute is ready */ +#define STOP_TLU (1<<18) /* Stop Table Lookup Process 1-to stop */ +#define LIMDBC_OFFSET (16) /* LAN Interface Multilayer-Decision-Base Control */ +#define LIMDBC_MASK (3<<16) +#define LIMDBC_VLAN (0<<16) /* By VLAN base */ +#define LIMDBC_PORT (1<<16) /* By Port base */ +#define LIMDBC_MAC (2<<16) /* By MAC base */ +#define EnUkVIDtoCPU (1 << 15) /* Enable trap unknown tagged VID (VLAN table lookup miss) packet to CPU */ +#define NAPTF2CPU (1 << 14) /* Trap packets not in TCP/UDP/ICMP format and + destined to the interface required to do NAPT */ +#define MultiPortModeP_OFFSET (5) /* Multicast Port Mode : Internal (0) or External (1) */ +#define MultiPortModeP_MASK (0x1ff) /* {Ext3~Ext1,Port0~Port5} 0:Internal, 1:External */ +#define MCAST_PORT_EXT_MODE_OFFSET MultiPortModeP_OFFSET /* Alias Name */ +#define MCAST_PORT_EXT_MODE_MASK MultiPortModeP_MASK /* Alias Name */ +#define WANRouteMode_OFFSET (3) +#define WANRouteMode_MASK (3<<3) +#define WANRouteMode_Forward (0<<3) +#define WANRouteMode_ToCpu (1<<3) +#define WANRouteMode_Drop (2<<3) +#define WAN_ROUTE_MASK WANRouteMode_MASK +#define WAN_ROUTE_FORWARD WANRouteMode_Forward /* Route WAN packets */ +#define WAN_ROUTE_TO_CPU WANRouteMode_ToCpu /* Forward WAN packets to CPU */ +#define WAN_ROUTE_DROP WANRouteMode_Drop /* Drop WAN packets */ +#define EnNAPTAutoDelete (1<<2) +#define EnNAPTAutoLearn (1<<1) +#define EnNAPTRNotFoundDrop (1<<0) /* 0: Reverse NAPT entry not found to forward to CPU, 1: Reverse NAPT entry not found to drop */ +#define EN_NAPT_AUTO_DELETE EnNAPTAutoDelete /* Enable NAPT auto delete */ +#define EN_NAPT_AUTO_LEARN EnNAPTAutoLearn /* Enable NAPT auto learn */ +#define NAPTR_NOT_FOUND_DROP EnNAPTRNotFoundDrop /* Reverse NAPT not found to S_DROP */ + +/* SWTCR1 - swtich table control register */ +#define L4EnHash1 (1 << 13) /* Enhanced Hash1 */ +#define EnNAP8651B (1 << 12) /* Enable 51B mode */ +#define EN_RTL8650B EnNAP8651B /* Alias Name */ +#define ENFRAGTOACLPT (1 << 11) /* Enable fragment packet checked by ACL and protocol trapper */ +#define EN_FRAG_TO_ACLPT ENFRAGTOACLPT/* Alias Name */ +#define EnNATT2LOG (1 << 10) /* Enable trapping attack packets for logging */ +#define EN_ATTACK_TO_LOG EnNATT2LOG /* Alias Name */ +#define EnL4WayH (1 << 9) /* Enable 4-way hash on L4 TCP/UDP table */ +#define EN_TCPUDP_4WAY_HASH EnL4WayH /* Alias Name */ +#define SelCpuReason (1 << 8) /* Enable 51B CPU reason coding */ +#define EN_51B_CPU_REASON SelCpuReason/* Alias Name */ +#define EN_SPI6_WAN_SRVPRT (1 << 7) /* Enable SPI-6 between WAN and server port */ +#define EN_SPI5_WAN_NI (1 << 6) /* Enable SPI-5 between WAN and NI */ +#define EN_SPI4_WAN_DMZ (1 << 5) /* Enable SPI-4 between WAN and DMZ */ +#define EN_SPI3_DMZ_RLAN (1 << 4) /* Enable SPI-3 between DMZ and RLAN */ +#define EN_SPI2_DMZ_LAN (1 << 3) /* Enable SPI-2 between DMZ and LAN */ +#define EN_SPI1_WAN_RLAN (1 << 2) /* Enable SPI-1 between WAN and RLAN */ +#define EnSPIRDrp (1 << 1) /* Enable dropping packets not found by reverse SPI */ +#define EN_DROP_SPIR_NOT_FOUND EnSPIRDrp /* Alias Name */ +#define TrapSPIUnknown (1 << 0) /* Enable SPI trapping non-TCP/UDP/ICMP packets */ +#define EN_SPI_TRAP_UNKNOWN TrapSPIUnknown/* Alias Name */ +#if 0 /* no longer supported */ +#define EN_FRAG_PPPOE (1 << 20) /* Enable auto-fragment for PPPoE */ +#define EN_MCAST_TBL_AGING (1 << 19) /* Enable aging of IP multicast table */ +#define EN_PPPOE_TBL_AGING (1 << 18) /* Enable aging of PPPoE table */ +#endif + +/* PLITIMR - Port to LAN Interface Table Index Mapping Register */ +#define INTP0_OFFSET 0 /* Index for P0, pointing to Interface table */ +#define INTP0_MASK (7<<0) /* Index for P0, pointing to Interface table */ +#define INTP1_OFFSET 3 /* Index for P1, pointing to Interface table */ +#define INTP1_MASK (7<<3) /* Index for P1, pointing to Interface table */ +#define INTP2_OFFSET 6 /* Index for P2, pointing to Interface table */ +#define INTP2_MASK (7<<6) /* Index for P2, pointing to Interface table */ +#define INTP3_OFFSET 9 /* Index for P3, pointing to Interface table */ +#define INTP3_MASK (7<<9) /* Index for P3, pointing to Interface table */ +#define INTP4_OFFSET 12 /* Index for P4, pointing to Interface table */ +#define INTP4_MASK (7<<12) /* Index for P4, pointing to Interface table */ +#define INTP5_OFFSET 15 /* Index for P5, pointing to Interface table */ +#define INTP5_MASK (7<<15) /* Index for P5, pointing to Interface table */ +#define INTExtP0_OFFSET 18 /* Index for Ext0, pointing to Interface table */ +#define INTExtP0_MASK (7<<18) /* Index for Ext0, pointing to Interface table */ +#define INTExtP1_OFFSET 21 /* Index for Ext1, pointing to Interface table */ +#define INTExtP1_MASK (7<<21) /* Index for Ext1, pointing to Interface table */ +#define INTExtP2_OFFSET 24 /* Index for Ext2, pointing to Interface table */ +#define INTExtP2_MASK (7<<24) /* Index for Ext2, pointing to Interface table */ + +/* DACLRCR - Default ACL Rule Control Register */ +#define ACLI_STA_MASK (0x7f) +#define ACLI_EDA_OFFSET 7 +#define ACLI_EDA_MASK (0x7f<<ACLI_EDA_OFFSET) +#define ACLO_STA_OFFSET 14 +#define ACLO_STA_MASK (0x7f<<ACLO_STA_OFFSET) +#define ACLO_EDA_OFFSET 21 +#define ACLO_EDA_MASK (0x7f<<ACLO_EDA_OFFSET) + +/* FFCR - Frame Forwarding Configuration Register */ +#define IPMltCstCtrl_OFFSET (3) /* IP Multicast Forwarding Control */ +#define IPMltCstCtrl_MASK (3<<3) /* IP Multicast Forwarding Control */ +#define IPMltCstCtrl_Disable (0<<3) /* Disable IP Multicast table lookup (just follow L2 Multicast packet procedure) */ +#define IPMltCstCtrl_Enable (1<<3) /* Enable IP Multicast table lookup */ +#define IPMltCstCtrl_TrapToCpu (2<<3) /* Tral all IP Multicast packet to CPU port */ +#define EN_MCAST IPMltCstCtrl_Enable /* Alias Name for Enable Multicast Table */ +#define EnFlood2NonCgtPrt (1<<2) /* Enable Flooding to non-Congested Port Only */ +#define EnUnkUC2CPU (1<<1) /* Enable Unknown Unicast Packet Trap to CPU port */ +#define EnUnkMC2CPU (1<<0) /* Enable Unknown Multicast Packet Trap to CPU port */ +#define EN_UNUNICAST_TOCPU EnUnkUC2CPU /* Alias Name */ +#define EN_UNMCAST_TOCPU EnUnkMC2CPU /* Alias Name */ + + + +#define SBFCTR (0x4500+SWCORE_BASE) /* System Based Flow Control Threshold Register */ +#define SBFCR0 (0x000+SBFCTR) /* System Based Flow Control Register 0 */ +#define SBFCR1 (0x004+SBFCTR) /* System Based Flow Control Register 1 */ +#define SBFCR2 (0x008+SBFCTR) /* System Based Flow Control Register 2 */ +#define PBFCR0 (0x00C+SBFCTR) /* Port Based Flow Control Threshold Register */ +#define PBFCR1 (0x010+SBFCTR) /* Port Based Flow Control Threshold Register */ +#define PBFCR2 (0x014+SBFCTR) /* Port Based Flow Control Threshold Register */ +#define PBFCR3 (0x018+SBFCTR) /* Port Based Flow Control Threshold Register */ +#define PBFCR4 (0x01C+SBFCTR) /* Port Based Flow Control Threshold Register */ +#define PBFCR5 (0x020+SBFCTR) /* Port Based Flow Control Threshold Register */ +#define PBFCR6 (0x024+SBFCTR) /* Port Based Flow Control Threshold Register */ +#define QDBFCRP0G0 (0x028+SBFCTR) /* Queue-Descriptor=Based Flow Control Threshold for Port 0 Group 0 */ +#define QDBFCRP0G1 (0x02C+SBFCTR) /* Queue-Descriptor=Based Flow Control Threshold for Port 0 Group 1 */ +#define QDBFCRP0G2 (0x030+SBFCTR) /* Queue-Descriptor=Based Flow Control Threshold for Port 0 Group 2 */ +#define QDBFCRP1G0 (0x034+SBFCTR) /* Queue-Descriptor=Based Flow Control Threshold for Port 1 Group 0 */ +#define QDBFCRP1G1 (0x038+SBFCTR) /* Queue-Descriptor=Based Flow Control Threshold for Port 1 Group 1 */ +#define QDBFCRP1G2 (0x03C+SBFCTR) /* Queue-Descriptor=Based Flow Control Threshold for Port 1 Group 2 */ +#define QDBFCRP2G0 (0x040+SBFCTR) /* Queue-Descriptor=Based Flow Control Threshold for Port 2 Group 0 */ +#define QDBFCRP2G1 (0x044+SBFCTR) /* Queue-Descriptor=Based Flow Control Threshold for Port 2 Group 1 */ +#define QDBFCRP2G2 (0x048+SBFCTR) /* Queue-Descriptor=Based Flow Control Threshold for Port 2 Group 2 */ +#define QDBFCRP3G0 (0x04C+SBFCTR) /* Queue-Descriptor=Based Flow Control Threshold for Port 3 Group 0 */ +#define QDBFCRP3G1 (0x050+SBFCTR) /* Queue-Descriptor=Based Flow Control Threshold for Port 3 Group 1 */ +#define QDBFCRP3G2 (0x054+SBFCTR) /* Queue-Descriptor=Based Flow Control Threshold for Port 3 Group 2 */ +#define QDBFCRP4G0 (0x058+SBFCTR) /* Queue-Descriptor=Based Flow Control Threshold for Port 4 Group 0 */ +#define QDBFCRP4G1 (0x05C+SBFCTR) /* Queue-Descriptor=Based Flow Control Threshold for Port 4 Group 1 */ +#define QDBFCRP4G2 (0x060+SBFCTR) /* Queue-Descriptor=Based Flow Control Threshold for Port 4 Group 2 */ +#define QDBFCRP5G0 (0x064+SBFCTR) /* Queue-Descriptor=Based Flow Control Threshold for Port 5 Group 0 */ +#define QDBFCRP5G1 (0x068+SBFCTR) /* Queue-Descriptor=Based Flow Control Threshold for Port 5 Group 1 */ +#define QDBFCRP5G2 (0x06C+SBFCTR) /* Queue-Descriptor=Based Flow Control Threshold for Port 5 Group 2 */ +#define QDBFCRP6G0 (0x070+SBFCTR) /* Queue-Descriptor=Based Flow Control Threshold for Port 6 Group 0 */ +#define QDBFCRP6G1 (0x074+SBFCTR) /* Queue-Descriptor=Based Flow Control Threshold for Port 6 Group 1 */ +#define QDBFCRP6G2 (0x078+SBFCTR) /* Queue-Descriptor=Based Flow Control Threshold for Port 6 Group 2 */ +#define QPKTFCRP0G0 (0x07C+SBFCTR) /* Queue-Packet-Based Flow Control Register for Port 0 Group 0 */ +#define QPKTFCRP0G1 (0x080+SBFCTR) /* Queue-Packet-Based Flow Control Register for Port 0 Group 1 */ +#define QPKTFCRP0G2 (0x084+SBFCTR) /* Queue-Packet-Based Flow Control Register for Port 0 Group 2 */ +#define QPKTFCRP1G0 (0x088+SBFCTR) /* Queue-Packet-Based Flow Control Register for Port 1 Group 0 */ +#define QPKTFCRP1G1 (0x08C+SBFCTR) /* Queue-Packet-Based Flow Control Register for Port 1 Group 1 */ +#define QPKTFCRP1G2 (0x090+SBFCTR) /* Queue-Packet-Based Flow Control Register for Port 1 Group 2 */ +#define QPKTFCRP2G0 (0x094+SBFCTR) /* Queue-Packet-Based Flow Control Register for Port 2 Group 0 */ +#define QPKTFCRP2G1 (0x098+SBFCTR) /* Queue-Packet-Based Flow Control Register for Port 2 Group 1 */ +#define QPKTFCRP2G2 (0x09C+SBFCTR) /* Queue-Packet-Based Flow Control Register for Port 2 Group 2 */ +#define QPKTFCRP3G0 (0x0A0+SBFCTR) /* Queue-Packet-Based Flow Control Register for Port 3 Group 0 */ +#define QPKTFCRP3G1 (0x0A4+SBFCTR) /* Queue-Packet-Based Flow Control Register for Port 3 Group 1 */ +#define QPKTFCRP3G2 (0x0A8+SBFCTR) /* Queue-Packet-Based Flow Control Register for Port 3 Group 2 */ +#define QPKTFCRP4G0 (0x0AC+SBFCTR) /* Queue-Packet-Based Flow Control Register for Port 4 Group 0 */ +#define QPKTFCRP4G1 (0x0B0+SBFCTR) /* Queue-Packet-Based Flow Control Register for Port 4 Group 1 */ +#define QPKTFCRP4G2 (0x0B4+SBFCTR) /* Queue-Packet-Based Flow Control Register for Port 4 Group 2 */ +#define QPKTFCRP5G0 (0x0B8+SBFCTR) /* Queue-Packet-Based Flow Control Register for Port 5 Group 0 */ +#define QPKTFCRP5G1 (0x0BC+SBFCTR) /* Queue-Packet-Based Flow Control Register for Port 5 Group 1 */ +#define QPKTFCRP5G2 (0x0C0+SBFCTR) /* Queue-Packet-Based Flow Control Register for Port 5 Group 2 */ +#define FCCR0 (0x0d0+SBFCTR) /* Flow Control Configuration Register 0 */ +#define FCCR1 (0x0d4+SBFCTR) /* Flow Control Configuration Register 1 */ +#define PQPLGR (0x0d8+SBFCTR) /* Per Queue Physical Length Gap Register */ +#define QRR (0x0dc+SBFCTR) /* Queue Reset Register */ +#define IQFCTCR (0x0E0+SBFCTR) /* Input Queue Flow Control Threshold Configuration Register */ + +/* SBFCR0 */ +#define S_DSC_RUNOUT_OFFSET (0) /* Offset for Descriptor Run Out Threshold */ +#define S_DSC_RUNOUT_MASK (0x3FF<<0) /* Mask for Descriptor Run Out Threshold */ + +/* SBFCR1 */ +#define SDC_FCOFF_OFFSET (16) /* Offset for system flow control turn off threshold */ +#define SDC_FCOFF_MASK (0x1ff<<16) /* Mask for system flow control turn off threshold */ +#define SDC_FCON_OFFSET (0) /* Offset for system flow control turn on threshold */ +#define SDC_FCON_MASK (0x1ff<<0) /* Mask for system flow control turn on threshold */ + +#define S_DSC_FCOFF_OFFSET (16) /* Offset for system flow control turn off threshold */ +#define S_DSC_FCOFF_MASK (0x1ff<<16) /* Mask for system flow control turn off threshold */ +#define S_DSC_FCON_OFFSET (0) /* Offset for system flow control turn on threshold */ +#define S_DSC_FCON_MASK (0x1ff<<0) /* Mask for system flow control turn on threshold */ + + + +/* SBFCR2 */ +#define S_Max_SBuf_FCOFF_OFFSET (16) /* System max shared buffer flow control turn off threshold */ +#define S_Max_SBuf_FCOFF_MASK (0x1FF<<16) /* System max shared buffer flow control turn off threshold */ +#define S_Max_SBuf_FCON_OFFSET (0) /* System max shared buffer flow control turn on threshold */ +#define S_Max_SBuf_FCON_MASK (0x1FF<<0) /* System max shared buffer flow control turn on threshold */ + +/* PBFCR0~PBFCR6 - Port Based Flow Control Threshold Register */ +#define P_MaxDSC_FCOFF_OFFSET (16) /* Per-Port Max Used Descriptor Flow Control Turn Off Threshold */ +#define P_MaxDSC_FCOFF_MASK (0x1ff<<16) /* Per-Port Max Used Descriptor Flow Control Turn Off Threshold */ +#define P_MaxDSC_FCON_OFFSET (0) /* Per-Port Max Used Descriptor Flow Control Turn On Threshold */ +#define P_MaxDSC_FCON_MASK (0x1ff<<0) /* Per-Port Max Used Descriptor Flow Control Turn On Threshold */ + +/* QDBFCRP0G0,QDBFCRP0G1,QDBFCRP0G2 + * QDBFCRP1G0,QDBFCRP1G1,QDBFCRP1G2 + * QDBFCRP2G0,QDBFCRP2G1,QDBFCRP2G2 + * QDBFCRP3G0,QDBFCRP3G1,QDBFCRP3G2 + * QDBFCRP4G0,QDBFCRP4G1,QDBFCRP4G2 + * QDBFCRP5G0,QDBFCRP5G1,QDBFCRP5G2 + * - Queue-Descriptor=Based Flow Control Threshold for Port 0 Group 0 */ +#define QG_DSC_FCOFF_OFFSET (16) /* Queue Descriptor Based Flow Control Turn Off Threshold */ +#define QG_DSC_FCOFF_MASK (0x1f<<16) /* Queue Descriptor Based Flow Control Turn Off Threshold */ +#define QG_DSC_FCON_OFFSET (0) /* Queue Descriptor Based Flow Control Turn Off Threshold */ +#define QG_DSC_FCON_MASK (0x7f<<0) /* Queue Descriptor Based Flow Control Turn Off Threshold */ + +/* QPKTFCRP0G0,QPKTFCRP0G1,QPKTFCRP0G2 + * QPKTFCRP1G0,QPKTFCRP1G1,QPKTFCRP1G2 + * QPKTFCRP2G0,QPKTFCRP2G1,QPKTFCRP2G2 + * QPKTFCRP3G0,QPKTFCRP3G1,QPKTFCRP3G2 + * QPKTFCRP4G0,QPKTFCRP4G1,QPKTFCRP4G2 + * QPKTFCRP5G0,QPKTFCRP5G1,QPKTFCRP5G2 + - Queue-Packet-Based Flow Control Register for Port 0 Group 0 */ +#define QG_QLEN_FCOFF_OFFSET (16) /* Queue Packet Based Flow Control Turn Off Threshold */ +#define QG_QLEN_FCOFF_MASK (0x1f<<16) /* Queue Packet Based Flow Control Turn Off Threshold */ +#define QG_QLEN_FCON_OFFSET (0) /* Queue Packet Based Flow Control Turn Off Threshold */ +#define QG_QLEN_FCON_MASK (0x7f<<0) /* Queue Packet Based Flow Control Turn Off Threshold */ + + + +/* FCCR0 - Flow Control enable/disable for port3~port0 */ +/* FCCR1 - Flow Control enable/disable for port6~port4 */ +#define Q_P0_EN_FC_OFFSET (0) +#define Q_P0_EN_FC_MASK (0x3f<<0) +#define Q_P1_EN_FC_OFFSET (8) +#define Q_P1_EN_FC_MASK (0x3f<<8) +#define Q_P2_EN_FC_OFFSET (16) +#define Q_P2_EN_FC_MASK (0x3f<<16) +#define Q_P3_EN_FC_OFFSET (24) +#define Q_P3_EN_FC_MASK (0x3f<<24) +#define Q_P4_EN_FC_OFFSET (0) +#define Q_P4_EN_FC_MASK (0x3f<<0) +#define Q_P5_EN_FC_OFFSET (8) +#define Q_P5_EN_FC_MASK (0x3f<<8) +#define Q_P6_EN_FC_OFFSET (16) +#define Q_P6_EN_FC_MASK (0x3f<<16) + + + + +/* PQPLGR - Per-Queue Physical length Gap Register */ +#define QLEN_GAP_OFFSET (0) /* Per Queue physical length gap */ +#define QLEN_GAP_MASK (0xff<<0) /* Per Queue physical length gap */ + + +/* QRR - Queue Reset Register */ +#define QRST (1<<0) /* Queue Reset */ + +//#ifdef CONFIG_RTL865XC_BCUT +/* IQFCTCR - Input Queue Flow Control Threshold Configuration Register */ +#define IQ_DSC_FCON_OFFSET (8) /* Offset for input Queue Flow control turn OFF descriptor threshold */ +#define IQ_DSC_FCON_MASK (0xff<<8) /* Mask for input Queue Flow control turn OFF descriptor threshold */ +#define IQ_DSC_FCOFF_OFFSET (0) /* Offset for input Queue Flow control turn ON descriptor threshold */ +#define IQ_DSC_FCOFF_MASK (0xff<<0) /* Mask for input Queue Flow control turn ON descriptor threshold */ +//#endif + + +#ifdef CONFIG_RTK_VOIP_865xC_QOS +#define PSRP6_RW (SWCORE_BASE+0x4600) /*CPU Port Status : R/W */ +#endif + +/* QoS Function Control Register */ +#define OQNCR_BASE (SWCORE_BASE+0x4700) /* Output Queue Number Control Registers */ +#define QOSFCR (0x00 + OQNCR_BASE) /* QoS Function Control Register */ +#define IBCR0 (0x04 + OQNCR_BASE) /* Ingress Bandwidth Control Register 0 */ +#define IBCR1 (0x08 + OQNCR_BASE) /* Ingress Bandwidth Control Register 1 */ +#define IBCR2 (0x0C + OQNCR_BASE) /* Ingress Bandwidth Control Register 2 */ +#define PBPCR (0x14 + OQNCR_BASE) /* Port Based Priority Control Register Address Mapping */ +#define UPTCMCR0 (0x18 + OQNCR_BASE) /* User Priority to Traffic Class Mapping for 1 output queue */ +#define UPTCMCR1 (0x1c + OQNCR_BASE) /* User Priority to Traffic Class Mapping for 2 output queue */ +#define UPTCMCR2 (0x20 + OQNCR_BASE) /* User Priority to Traffic Class Mapping for 3 output queue */ +#define UPTCMCR3 (0x24 + OQNCR_BASE) /* User Priority to Traffic Class Mapping for 4 output queue */ +#define UPTCMCR4 (0x28 + OQNCR_BASE) /* User Priority to Traffic Class Mapping for 5 output queue */ +#define UPTCMCR5 (0x2c + OQNCR_BASE) /* User Priority to Traffic Class Mapping for 6 output queue */ +#define LPTM8021Q (0x30 + OQNCR_BASE) /*802.1Q priority to linear priority Transfer mapping.*/ +#define DSCPCR0 (0x34 + OQNCR_BASE) /*DSCP Priority Control Register Address Mapping. */ +#define DSCPCR1 (0x38 + OQNCR_BASE) /*DSCP Priority Control Register Address Mapping. */ +#define DSCPCR2 (0x3C + OQNCR_BASE) /*DSCP Priority Control Register Address Mapping. */ +#define DSCPCR3 (0x40 + OQNCR_BASE) /*DSCP Priority Control Register Address Mapping. */ +#define DSCPCR4 (0x44 + OQNCR_BASE) /*DSCP Priority Control Register Address Mapping. */ +#define DSCPCR5 (0x48 + OQNCR_BASE) /*DSCP Priority Control Register Address Mapping. */ +#define DSCPCR6 (0x4C + OQNCR_BASE) /*DSCP Priority Control Register Address Mapping. */ +#define QIDDPCR (0x50 + OQNCR_BASE) /*Queue ID Decision Priority Register Address Mapping*/ +#define QNUMCR (0x54 + OQNCR_BASE) /*Queue Number Control Register*/ +#define CPUQIDMCR0 (0x58 + OQNCR_BASE) /*CPU port QID Mapping Control Register (DP=include CPU)*/ +#define CPUQIDMCR1 (0x5C + OQNCR_BASE) /*CPU port QID Mapping Control Register (DP=EXT0)*/ +#define CPUQIDMCR2 (0x60 + OQNCR_BASE) /*CPU port QID Mapping Control Register (DP=EXT1)*/ +#define CPUQIDMCR3 (0x64 + OQNCR_BASE) /*CPU port QID Mapping Control Register (DP=EXT2)*/ +#define CPUQIDMCR4 (0x68 + OQNCR_BASE) /*CPU port QID Mapping Control Register (DP=multi-port of Ext port)*/ +#define RMCR1P (0x6C + OQNCR_BASE) /*802.1P Remarking Control Register 0*/ +#define DSCPRM0 (0x70 + OQNCR_BASE) /*DSCP Remarking Control Register 0*/ +#define DSCPRM1 (0x74 + OQNCR_BASE) /*DSCP Remarking Control Register 1*/ +#define RLRC (0x78 + OQNCR_BASE) /*Remarking Layer Rule Control*/ + + +/* QOSFCR - QoS Function Control Register */ +#define BC_withPIFG_OFFSET (0) /* Bandwidth Conrol Include/Exclude Preamble&IFG. 0:exclude; 1:include */ +#define BC_withPIFG_MASK (1<<0) /* Bandwidth Conrol Include/Exclude Preamble&IFG. 0:exclude; 1:include */ + +/* IBCR0/IBCR1/IBCR2 general */ +#define IBWC_ODDPORT_OFFSET (16) /* ODD-port Ingress Bandwidth Control Offset */ +#define IBWC_ODDPORT_MASK (0xFFFF<<16) /* ODD-port Ingress Bandwidth Control MASK */ +#define IBWC_EVENPORT_OFFSET (0) /* EVEN-port Ingress Bandwidth Control Offset */ +#define IBWC_EVENPORT_MASK (0xFFFF<<0) /* EVEN-port Ingress Bandwidth Control MASK */ + +/* IBCR0 - Ingress Bandwidth Control Register 0 */ +#define IBWC_P1_OFFSET (16) /* Port1 Ingress Bandwidth Control */ +#define IBWC_P1_MASK (0xffff<<16) /* Port1 Ingress Bandwidth Control */ +#define IBWC_P0_OFFSET ( 0) /* Port0 Ingress Bandwidth Control */ +#define IBWC_P0_MASK (0xffff<< 0) /* Port0 Ingress Bandwidth Control */ + +/* IBCR1 - Ingress Bandwidth Control Register 1 */ +#define IBWC_P3_OFFSET (16) /* Port3 Ingress Bandwidth Control */ +#define IBWC_P3_MASK (0xffff<<16) /* Port3 Ingress Bandwidth Control */ +#define IBWC_P2_OFFSET ( 0) /* Port2 Ingress Bandwidth Control */ +#define IBWC_P2_MASK (0xffff<< 0) /* Port2 Ingress Bandwidth Control */ + +/* IBCR2 - Ingress Bandwidth Control Register 2 */ +#define IBWC_P5_OFFSET (16) /* Port5 Ingress Bandwidth Control */ +#define IBWC_P5_MASK (0xffff<<16) /* Port5 Ingress Bandwidth Control */ +#define IBWC_P4_OFFSET ( 0) /* Port4 Ingress Bandwidth Control */ +#define IBWC_P4_MASK (0xffff<< 0) /* Port4 Ingress Bandwidth Control */ + +/* PBPCR - Port Based Priority Control Register */ +#define PBPRI_P8_OFFSET (24) /* Port Based Priority assign for port 8 */ +#define PBPRI_P8_MASK (0x7<<24) /* Port Based Priority assign for port 8 */ +#define PBPRI_P7_OFFSET (21) /* Port Based Priority assign for port 7 */ +#define PBPRI_P7_MASK (0x7<<21) /* Port Based Priority assign for port 7 */ +#define PBPRI_P6_OFFSET (18) /* Port Based Priority assign for port 6 */ +#define PBPRI_P6_MASK (0x7<<18) /* Port Based Priority assign for port 6 */ +#define PBPRI_P5_OFFSET (15) /* Port Based Priority assign for port 5 */ +#define PBPRI_P5_MASK (0x7<<15) /* Port Based Priority assign for port 5 */ +#define PBPRI_P4_OFFSET (12) /* Port Based Priority assign for port 4 */ +#define PBPRI_P4_MASK (0x7<<12) /* Port Based Priority assign for port 4 */ +#define PBPRI_P3_OFFSET (9) /* Port Based Priority assign for port 3 */ +#define PBPRI_P3_MASK (0x7<<9) /* Port Based Priority assign for port 3 */ +#define PBPRI_P2_OFFSET (6) /* Port Based Priority assign for port 2 */ +#define PBPRI_P2_MASK (0x7<<6) /* Port Based Priority assign for port 2 */ +#define PBPRI_P1_OFFSET (3) /* Port Based Priority assign for port 1 */ +#define PBPRI_P1_MASK (0x7<<3) /* Port Based Priority assign for port 1 */ +#define PBPRI_P0_OFFSET (0) /* Port Based Priority assign for port 0 */ +#define PBPRI_P0_MASK (0x7<<0) /* Port Based Priority assign for port 0 */ + + +/* QIDDPCR - Queue ID Decision Priority Register Address Mapping*/ +#define PBP_PRI_OFFSET 0 /*Output queue decision priority assign for Port Based Priority*/ +#define PBP_PRI_MASK (0xf<< 0) /*Output queue decision priority assign for Port Based Priority*/ +#define BP8021Q_PRI_OFFSET 4 /*Output queue decision priority assign for 1Q Based Priority*/ +#define BP8021Q_PRI_MASK (0xf<< 4) /*Output queue decision priority assign for 1Q Based Priority*/ +#define DSCP_PRI_OFFSET 8 /*Output queue decision priority assign for DSCP Based Priority*/ +#define DSCP_PRI_MASK (0xf<< 8) /*Output queue decision priority assign for DSCP Based Priority*/ +#define ACL_PRI_OFFSET 12 /*Output queue decision priority assign for ACL Based Priority*/ +#define ACL_PRI_MASK (0xf<<12) /*Output queue decision priority assign for ACL Based Priority*/ +#define NAPT_PRI_OFFSET 16 /*Output queue decision priority assign for NAPT Based Priority*/ +#define NAPT_PRI_MASK (0xf<<16) /*Output queue decision priority assign for NAPT Based Priority*/ + +/* LPTM8021Q - 802.1Q priority to linear priority Transfer mapping. */ +#define EN_8021Q2LTMPRI7 21 /* 8 level linear priority mapping for 802.1Q priority level 7 */ +#define EN_8021Q2LTMPRI7_MASK (0x7<<21) /* 8 level linear priority mapping for 802.1Q priority level 7 */ +#define EN_8021Q2LTMPRI6 18 /* 8 level linear priority mapping for 802.1Q priority level 6 */ +#define EN_8021Q2LTMPRI6_MASK (0x7<<18) /* 8 level linear priority mapping for 802.1Q priority level 6 */ +#define EN_8021Q2LTMPRI5 15 /* 8 level linear priority mapping for 802.1Q priority level 5 */ +#define EN_8021Q2LTMPRI5_MASK (0x7<<15) /* 8 level linear priority mapping for 802.1Q priority level 5 */ +#define EN_8021Q2LTMPRI4 12 /* 8 level linear priority mapping for 802.1Q priority level 4 */ +#define EN_8021Q2LTMPRI4_MASK (0x7<<12) /* 8 level linear priority mapping for 802.1Q priority level 4 */ +#define EN_8021Q2LTMPRI3 9 /* 8 level linear priority mapping for 802.1Q priority level 3 */ +#define EN_8021Q2LTMPRI3_MASK (0x7<<9) /* 8 level linear priority mapping for 802.1Q priority level 3 */ +#define EN_8021Q2LTMPRI2 6 /* 8 level linear priority mapping for 802.1Q priority level 2 */ +#define EN_8021Q2LTMPRI2_MASK (0x7<<6) /* 8 level linear priority mapping for 802.1Q priority level 2 */ +#define EN_8021Q2LTMPRI1 3 /* 8 level linear priority mapping for 802.1Q priority level 1 */ +#define EN_8021Q2LTMPRI1_MASK (0x7<<3) /* 8 level linear priority mapping for 802.1Q priority level 1 */ +#define EN_8021Q2LTMPRI0 0 /* 8 level linear priority mapping for 802.1Q priority level 0 */ +#define EN_8021Q2LTMPRI0_MASK (0x7<<0) /* 8 level linear priority mapping for 802.1Q priority level 0 */ + + +/* DSCPCR0 - DSCP Priority Control Register Address Mapping. */ +#define DSCP0_PRI 0 +#define DSCP1_PRI 3 +#define DSCP2_PRI 6 +#define DSCP3_PRI 9 +#define DSCP4_PRI 12 +#define DSCP5_PRI 15 +#define DSCP6_PRI 18 +#define DSCP7_PRI 21 +#define DSCP8_PRI 24 +#define DSCP9_PRI 27 +#define DSCP32_PRI 6 + + +/* QNUMCR - Queue Number Control Register*/ +#define P0QNum_OFFSET (0) +#define P0QNum_MASK (7<<0) /* Valid for 1~6 output queues */ +#define P0QNum_1 (1<<0) /* 1 Output Queue */ +#define P0QNum_2 (2<<0) /* 2 Output Queues */ +#define P0QNum_3 (3<<0) /* 3 Output Queues */ +#define P0QNum_4 (4<<0) /* 4 Output Queues */ +#define P0QNum_5 (5<<0) /* 5 Output Queues */ +#define P0QNum_6 (6<<0) /* 6 Output Queues */ +#define P1QNum_OFFSET (3) +#define P1QNum_MASK (7<<3) /* Valid for 1~6 output queues */ +#define P1QNum_1 (1<<3) /* 1 Output Queue */ +#define P1QNum_2 (2<<3) /* 2 Output Queues */ +#define P1QNum_3 (3<<3) /* 3 Output Queues */ +#define P1QNum_4 (4<<3) /* 4 Output Queues */ +#define P1QNum_5 (5<<3) /* 5 Output Queues */ +#define P1QNum_6 (6<<3) /* 6 Output Queues */ +#define P2QNum_OFFSET (6) +#define P2QNum_MASK (7<<6) /* Valid for 1~6 output queues */ +#define P2QNum_1 (1<<6) /* 1 Output Queue */ +#define P2QNum_2 (2<<6) /* 2 Output Queues */ +#define P2QNum_3 (3<<6) /* 3 Output Queues */ +#define P2QNum_4 (4<<6) /* 4 Output Queues */ +#define P2QNum_5 (5<<6) /* 5 Output Queues */ +#define P2QNum_6 (6<<6) /* 6 Output Queues */ +#define P3QNum_OFFSET (9) +#define P3QNum_MASK (7<<9) /* Valid for 1~6 output queues */ +#define P3QNum_1 (1<<9) /* 1 Output Queue */ +#define P3QNum_2 (2<<9) /* 2 Output Queues */ +#define P3QNum_3 (3<<9) /* 3 Output Queues */ +#define P3QNum_4 (4<<9) /* 4 Output Queues */ +#define P3QNum_5 (5<<9) /* 5 Output Queues */ +#define P3QNum_6 (6<<9) /* 6 Output Queues */ +#define P4QNum_OFFSET (12) +#define P4QNum_MASK (7<<12) /* Valid for 1~6 output queues */ +#define P4QNum_1 (1<<12) /* 1 Output Queue */ +#define P4QNum_2 (2<<12) /* 2 Output Queues */ +#define P4QNum_3 (3<<12) /* 3 Output Queues */ +#define P4QNum_4 (4<<12) /* 4 Output Queues */ +#define P4QNum_5 (5<<12) /* 5 Output Queues */ +#define P4QNum_6 (6<<12) /* 6 Output Queues */ +#define P5QNum_OFFSET (15) +#define P5QNum_MASK (7<<15) /* Valid for 1~6 output queues */ +#define P5QNum_1 (1<<15) /* 1 Output Queue */ +#define P5QNum_2 (2<<15) /* 2 Output Queues */ +#define P5QNum_3 (3<<15) /* 3 Output Queues */ +#define P5QNum_4 (4<<15) /* 4 Output Queues */ +#define P5QNum_5 (5<<15) /* 5 Output Queues */ +#define P5QNum_6 (6<<15) /* 6 Output Queues */ +#define P6QNum_OFFSET (18) /* CPU port */ +#define P6QNum_MASK (7<<18) /* Valid for 1~6 output queues */ +#define P6QNum_1 (1<<18) /* 1 Output Queue */ +#define P6QNum_2 (2<<18) /* 2 Output Queues */ +#define P6QNum_3 (3<<18) /* 3 Output Queues */ +#define P6QNum_4 (4<<18) /* 4 Output Queues */ +#define P6QNum_5 (5<<18) /* 5 Output Queues */ +#define P6QNum_6 (6<<18) /* 6 Output Queues */ + +/* CPUQIDMCR0 - CPU port QID Mapping Control Register (DP=include CPU) */ +#define CPUPri7QIDM_OFFSET 28 /* DP=include CPU, priority=7 */ +#define CPUPri7QIDM_MASK (7<<28) /* DP=include CPU, priority=7 */ +#define CPUPri6QIDM_OFFSET 24 /* DP=include CPU, priority=6 */ +#define CPUPri6QIDM_MASK (7<<24) /* DP=include CPU, priority=6 */ +#define CPUPri5QIDM_OFFSET 20 /* DP=include CPU, priority=5 */ +#define CPUPri5QIDM_MASK (7<<20) /* DP=include CPU, priority=5 */ +#define CPUPri4QIDM_OFFSET 16 /* DP=include CPU, priority=4 */ +#define CPUPri4QIDM_MASK (7<<16) /* DP=include CPU, priority=4 */ +#define CPUPri3QIDM_OFFSET 12 /* DP=include CPU, priority=3 */ +#define CPUPri3QIDM_MASK (7<<12) /* DP=include CPU, priority=3 */ +#define CPUPri2QIDM_OFFSET 8 /* DP=include CPU, priority=2 */ +#define CPUPri2QIDM_MASK (7<<8) /* DP=include CPU, priority=2 */ +#define CPUPri1QIDM_OFFSET 4 /* DP=include CPU, priority=1 */ +#define CPUPri1QIDM_MASK (7<<4) /* DP=include CPU, priority=1 */ +#define CPUPri0QIDM_OFFSET 0 /* DP=include CPU, priority=0 */ +#define CPUPri0QIDM_MASK (7<<0) /* DP=include CPU, priority=0 */ + +/* CPUQIDMCR1 - CPU port QID Mapping Control Register (DP=EXT0) */ +#define EXT0Pri7QIDM_OFFSET 28 /* DP=EXT0, priority=7 */ +#define EXT0Pri7QIDM_MASK (7<<28) /* DP=EXT0, priority=7 */ +#define EXT0Pri6QIDM_OFFSET 24 /* DP=EXT0, priority=6 */ +#define EXT0Pri6QIDM_MASK (7<<24) /* DP=EXT0, priority=6 */ +#define EXT0Pri5QIDM_OFFSET 20 /* DP=EXT0, priority=5 */ +#define EXT0Pri5QIDM_MASK (7<<20) /* DP=EXT0, priority=5 */ +#define EXT0Pri4QIDM_OFFSET 16 /* DP=EXT0, priority=4 */ +#define EXT0Pri4QIDM_MASK (7<<16) /* DP=EXT0, priority=4 */ +#define EXT0Pri3QIDM_OFFSET 12 /* DP=EXT0, priority=3 */ +#define EXT0Pri3QIDM_MASK (7<<12) /* DP=EXT0, priority=3 */ +#define EXT0Pri2QIDM_OFFSET 8 /* DP=EXT0, priority=2 */ +#define EXT0Pri2QIDM_MASK (7<<8) /* DP=EXT0, priority=2 */ +#define EXT0Pri1QIDM_OFFSET 4 /* DP=EXT0, priority=1 */ +#define EXT0Pri1QIDM_MASK (7<<4) /* DP=EXT0, priority=1 */ +#define EXT0Pri0QIDM_OFFSET 0 /* DP=EXT0, priority=0 */ +#define EXT0Pri0QIDM_MASK (7<<0) /* DP=EXT0, priority=0 */ + +/* CPUQIDMCR1 - CPU port QID Mapping Control Register (DP=EXT1) */ +#define EXT1Pri7QIDM_OFFSET 28 /* DP=EXT1, priority=7 */ +#define EXT1Pri7QIDM_MASK (7<<28) /* DP=EXT1, priority=7 */ +#define EXT1Pri6QIDM_OFFSET 24 /* DP=EXT1, priority=6 */ +#define EXT1Pri6QIDM_MASK (7<<24) /* DP=EXT1, priority=6 */ +#define EXT1Pri5QIDM_OFFSET 20 /* DP=EXT1, priority=5 */ +#define EXT1Pri5QIDM_MASK (7<<20) /* DP=EXT1, priority=5 */ +#define EXT1Pri4QIDM_OFFSET 16 /* DP=EXT1, priority=4 */ +#define EXT1Pri4QIDM_MASK (7<<16) /* DP=EXT1, priority=4 */ +#define EXT1Pri3QIDM_OFFSET 12 /* DP=EXT1, priority=3 */ +#define EXT1Pri3QIDM_MASK (7<<12) /* DP=EXT1, priority=3 */ +#define EXT1Pri2QIDM_OFFSET 8 /* DP=EXT1, priority=2 */ +#define EXT1Pri2QIDM_MASK (7<<8) /* DP=EXT1, priority=2 */ +#define EXT1Pri1QIDM_OFFSET 4 /* DP=EXT1, priority=1 */ +#define EXT1Pri1QIDM_MASK (7<<4) /* DP=EXT1, priority=1 */ +#define EXT1Pri0QIDM_OFFSET 0 /* DP=EXT1, priority=0 */ +#define EXT1Pri0QIDM_MASK (7<<0) /* DP=EXT1, priority=0 */ + +/* CPUQIDMCR1 - CPU port QID Mapping Control Register (DP=EXT2) */ +#define EXT2Pri7QIDM_OFFSET 28 /* DP=EXT2, priority=7 */ +#define EXT2Pri7QIDM_MASK (7<<28) /* DP=EXT2, priority=7 */ +#define EXT2Pri6QIDM_OFFSET 24 /* DP=EXT2, priority=6 */ +#define EXT2Pri6QIDM_MASK (7<<24) /* DP=EXT2, priority=6 */ +#define EXT2Pri5QIDM_OFFSET 20 /* DP=EXT2, priority=5 */ +#define EXT2Pri5QIDM_MASK (7<<20) /* DP=EXT2, priority=5 */ +#define EXT2Pri4QIDM_OFFSET 16 /* DP=EXT2, priority=4 */ +#define EXT2Pri4QIDM_MASK (7<<16) /* DP=EXT2, priority=4 */ +#define EXT2Pri3QIDM_OFFSET 12 /* DP=EXT2, priority=3 */ +#define EXT2Pri3QIDM_MASK (7<<12) /* DP=EXT2, priority=3 */ +#define EXT2Pri2QIDM_OFFSET 8 /* DP=EXT2, priority=2 */ +#define EXT2Pri2QIDM_MASK (7<<8) /* DP=EXT2, priority=2 */ +#define EXT2Pri1QIDM_OFFSET 4 /* DP=EXT2, priority=1 */ +#define EXT2Pri1QIDM_MASK (7<<4) /* DP=EXT2, priority=1 */ +#define EXT2Pri0QIDM_OFFSET 0 /* DP=EXT2, priority=0 */ +#define EXT2Pri0QIDM_MASK (7<<0) /* DP=EXT2, priority=0 */ + +/* CPUQIDMCR1 - CPU port QID Mapping Control Register (DP=MultiEXT) */ +#define MultiEXTPri7QIDM_OFFSET 28 /* DP=multi-port of Ext port, priority=7 */ +#define MultiEXTPri7QIDM_MASK (7<<28) /* DP=multi-port of Ext port, priority=7 */ +#define MultiEXTPri6QIDM_OFFSET 24 /* DP=multi-port of Ext port, priority=6 */ +#define MultiEXTPri6QIDM_MASK (7<<24) /* DP=multi-port of Ext port, priority=6 */ +#define MultiEXTPri5QIDM_OFFSET 20 /* DP=multi-port of Ext port, priority=5 */ +#define MultiEXTPri5QIDM_MASK (7<<20) /* DP=multi-port of Ext port, priority=5 */ +#define MultiEXTPri4QIDM_OFFSET 16 /* DP=multi-port of Ext port, priority=4 */ +#define MultiEXTPri4QIDM_MASK (7<<16) /* DP=multi-port of Ext port, priority=4 */ +#define MultiEXTPri3QIDM_OFFSET 12 /* DP=multi-port of Ext port, priority=3 */ +#define MultiEXTPri3QIDM_MASK (7<<12) /* DP=multi-port of Ext port, priority=3 */ +#define MultiEXTPri2QIDM_OFFSET 8 /* DP=multi-port of Ext port, priority=2 */ +#define MultiEXTPri2QIDM_MASK (7<<8) /* DP=multi-port of Ext port, priority=2 */ +#define MultiEXTPri1QIDM_OFFSET 4 /* DP=multi-port of Ext port, priority=1 */ +#define MultiEXTPri1QIDM_MASK (7<<4) /* DP=multi-port of Ext port, priority=1 */ +#define MultiEXTPri0QIDM_OFFSET 0 /* DP=multi-port of Ext port, priority=0 */ +#define MultiEXTPri0QIDM_MASK (7<<0) /* DP=multi-port of Ext port, priority=0 */ + +/* RMCR1P - 802.1P Remarking Control Register 0 */ +#define RM1P_EN_OFFSET (24) /* Enable 802.1p remarking for destination port[7:0] */ +#define RM1P_EN_MASK (0xff<<24) /* Enable 802.1p remarking for destination port */ +#define RM7_1P_OFFSET (21) /* New 3-bit priority for system parsed priority 7 */ +#define RM7_1P_MASK (0x7<<21) /* New 3-bit priority for system parsed priority 7 */ +#define RM6_1P_OFFSET (18) /* New 3-bit priority for system parsed priority 6 */ +#define RM6_1P_MASK (0x7<<18) /* New 3-bit priority for system parsed priority 6 */ +#define RM5_1P_OFFSET (15) /* New 3-bit priority for system parsed priority 5 */ +#define RM5_1P_MASK (0x7<<15) /* New 3-bit priority for system parsed priority 5 */ +#define RM4_1P_OFFSET (12) /* New 3-bit priority for system parsed priority 4 */ +#define RM4_1P_MASK (0x7<<12) /* New 3-bit priority for system parsed priority 4 */ +#define RM3_1P_OFFSET ( 9) /* New 3-bit priority for system parsed priority 3 */ +#define RM3_1P_MASK (0x7<< 9) /* New 3-bit priority for system parsed priority 3 */ +#define RM2_1P_OFFSET ( 6) /* New 3-bit priority for system parsed priority 2 */ +#define RM2_1P_MASK (0x7<< 6) /* New 3-bit priority for system parsed priority 2 */ +#define RM1_1P_OFFSET ( 3) /* New 3-bit priority for system parsed priority 1 */ +#define RM1_1P_MASK (0x7<< 3) /* New 3-bit priority for system parsed priority 1 */ +#define RM0_1P_OFFSET ( 0) /* New 3-bit priority for system parsed priority 0 */ +#define RM0_1P_MASK (0x7<< 0) /* New 3-bit priority for system parsed priority 0 */ + +/* DSCPRM0 - DSCP Remarking Control Register 0 */ +#define RM1P_EN_8_OFFSET (31) /* Enable 802.1p remarking for destination port[8] */ +#define RM1P_EN_8 (1<<31) /* Enable 802.1p remarking for destination port[8] */ +#define DSCPRM4_OFFSET (24) /* New 6-bit DSCP value for system parsed 3-bit priority 4 */ +#define DSCPRM4_MASK (0x3f<<24) /* New 6-bit DSCP value for system parsed 3-bit priority 4 */ +#define DSCPRM3_OFFSET (18) /* New 6-bit DSCP value for system parsed 3-bit priority 3 */ +#define DSCPRM3_MASK (0x3f<<18) /* New 6-bit DSCP value for system parsed 3-bit priority 3 */ +#define DSCPRM2_OFFSET (12) /* New 6-bit DSCP value for system parsed 3-bit priority 2 */ +#define DSCPRM2_MASK (0x3f<<12) /* New 6-bit DSCP value for system parsed 3-bit priority 2 */ +#define DSCPRM1_OFFSET ( 6) /* New 6-bit DSCP value for system parsed 3-bit priority 1 */ +#define DSCPRM1_MASK (0x3f<< 6) /* New 6-bit DSCP value for system parsed 3-bit priority 1 */ +#define DSCPRM0_OFFSET ( 0) /* New 6-bit DSCP value for system parsed 3-bit priority 0 */ +#define DSCPRM0_MASK (0x3f<< 0) /* New 6-bit DSCP value for system parsed 3-bit priority 0 */ + +/* DSCPRM1 - DSCP Remarking Control Register 1 */ +#define DSCPRM_EN_OFFSET (23) /* Enable DSCP Remark for destination output port[8:0] */ +#define DSCPRM_EN_MASK (0x1ff<<23) /* Enable DSCP Remark for destination output port */ +#define DSCPRM7_OFFSET (12) /* New 6-bit DSCP value for system parsed 3-bit priority 7 */ +#define DSCPRM7_MASK (0x3f<<12) /* New 6-bit DSCP value for system parsed 3-bit priority 7 */ +#define DSCPRM6_OFFSET ( 6) /* New 6-bit DSCP value for system parsed 3-bit priority 6 */ +#define DSCPRM6_MASK (0x3f<< 6) /* New 6-bit DSCP value for system parsed 3-bit priority 6 */ +#define DSCPRM5_OFFSET ( 0) /* New 6-bit DSCP value for system parsed 3-bit priority 5 */ +#define DSCPRM5_MASK (0x3f<< 0) /* New 6-bit DSCP value for system parsed 3-bit priority 5 */ + +/* RLRC - Remarking Layer Rule Control */ +#define RMLC_DSCP_L4 (1<<5) /* Applied on L4 Operation */ +#define RMLC_DSCP_L3 (1<<4) /* Applied on L3 Operation */ +#define RMLC_DSCP_L2 (1<<3) /* Applied on L2 Operation */ +#define RMLC_8021P_L4 (1<<2) /* Applied on L4 Operation */ +#define RMLC_8021P_L3 (1<<1) /* Applied on L3 Operation */ +#define RMLC_8021P_L2 (1<<0) /* Applied on L2 Operation */ + + +/* + * Packet Scheduling Control Register */ +#define PSCR (SWCORE_BASE + 0x4800) +#define P0Q0RGCR (0x000 + PSCR) /* Rate Guarantee Control Register of Port 0 Queue 0 */ +#define P0Q1RGCR (0x004 + PSCR) /* Rate Guarantee Control Register of Port 0 Queue 1 */ +#define P0Q2RGCR (0x008 + PSCR) /* Rate Guarantee Control Register of Port 0 Queue 2 */ +#define P0Q3RGCR (0x00C + PSCR) /* Rate Guarantee Control Register of Port 0 Queue 3 */ +#define P0Q4RGCR (0x010 + PSCR) /* Rate Guarantee Control Register of Port 0 Queue 4 */ +#define P0Q5RGCR (0x014 + PSCR) /* Rate Guarantee Control Register of Port 0 Queue 5 */ +#define P1Q0RGCR (0x018 + PSCR) /* Rate Guarantee Control Register of Port 1 Queue 0 */ +#define P1Q1RGCR (0x01C + PSCR) /* Rate Guarantee Control Register of Port 1 Queue 1 */ +#define P1Q2RGCR (0x020 + PSCR) /* Rate Guarantee Control Register of Port 1 Queue 2 */ +#define P1Q3RGCR (0x024 + PSCR) /* Rate Guarantee Control Register of Port 1 Queue 3 */ +#define P1Q4RGCR (0x028 + PSCR) /* Rate Guarantee Control Register of Port 1 Queue 4 */ +#define P1Q5RGCR (0x02C + PSCR) /* Rate Guarantee Control Register of Port 1 Queue 5 */ +#define P2Q0RGCR (0x030 + PSCR) /* Rate Guarantee Control Register of Port 2 Queue 0 */ +#define P2Q1RGCR (0x034 + PSCR) /* Rate Guarantee Control Register of Port 2 Queue 1 */ +#define P2Q2RGCR (0x038 + PSCR) /* Rate Guarantee Control Register of Port 2 Queue 2 */ +#define P2Q3RGCR (0x03C + PSCR) /* Rate Guarantee Control Register of Port 2 Queue 3 */ +#define P2Q4RGCR (0x040 + PSCR) /* Rate Guarantee Control Register of Port 2 Queue 4 */ +#define P2Q5RGCR (0x044 + PSCR) /* Rate Guarantee Control Register of Port 2 Queue 5 */ +#define P3Q0RGCR (0x048 + PSCR) /* Rate Guarantee Control Register of Port 3 Queue 0 */ +#define P3Q1RGCR (0x04C + PSCR) /* Rate Guarantee Control Register of Port 3 Queue 1 */ +#define P3Q2RGCR (0x050 + PSCR) /* Rate Guarantee Control Register of Port 3 Queue 2 */ +#define P3Q3RGCR (0x054 + PSCR) /* Rate Guarantee Control Register of Port 3 Queue 3 */ +#define P3Q4RGCR (0x058 + PSCR) /* Rate Guarantee Control Register of Port 3 Queue 4 */ +#define P3Q5RGCR (0x05C + PSCR) /* Rate Guarantee Control Register of Port 3 Queue 5 */ +#define P4Q0RGCR (0x060 + PSCR) /* Rate Guarantee Control Register of Port 4 Queue 0 */ +#define P4Q1RGCR (0x064 + PSCR) /* Rate Guarantee Control Register of Port 4 Queue 1 */ +#define P4Q2RGCR (0x068 + PSCR) /* Rate Guarantee Control Register of Port 4 Queue 2 */ +#define P4Q3RGCR (0x06C + PSCR) /* Rate Guarantee Control Register of Port 4 Queue 3 */ +#define P4Q4RGCR (0x070 + PSCR) /* Rate Guarantee Control Register of Port 4 Queue 4 */ +#define P4Q5RGCR (0x074 + PSCR) /* Rate Guarantee Control Register of Port 4 Queue 5 */ +#define P5Q0RGCR (0x078 + PSCR) /* Rate Guarantee Control Register of Port 5 Queue 0 */ +#define P5Q1RGCR (0x07C + PSCR) /* Rate Guarantee Control Register of Port 5 Queue 1 */ +#define P5Q2RGCR (0x080 + PSCR) /* Rate Guarantee Control Register of Port 5 Queue 2 */ +#define P5Q3RGCR (0x084 + PSCR) /* Rate Guarantee Control Register of Port 5 Queue 3 */ +#define P5Q4RGCR (0x088 + PSCR) /* Rate Guarantee Control Register of Port 5 Queue 4 */ +#define P5Q5RGCR (0x08C + PSCR) /* Rate Guarantee Control Register of Port 5 Queue 5 */ +#define P6Q0RGCR (0x090 + PSCR) /* Rate Guarantee Control Register of Port 6 Queue 0 */ +#define P6Q1RGCR (0x094 + PSCR) /* Rate Guarantee Control Register of Port 6 Queue 1 */ +#define P6Q2RGCR (0x098 + PSCR) /* Rate Guarantee Control Register of Port 6 Queue 2 */ +#define P6Q3RGCR (0x09C + PSCR) /* Rate Guarantee Control Register of Port 6 Queue 3 */ +#define P6Q4RGCR (0x0A0 + PSCR) /* Rate Guarantee Control Register of Port 6 Queue 4 */ +#define P6Q5RGCR (0x0A4 + PSCR) /* Rate Guarantee Control Register of Port 6 Queue 5 */ +#define WFQRCRP0 (0x0B0 + PSCR) /* Weighted Fair Queue Rate Control Register of Port 0 */ +#define WFQWCR0P0 (0x0B4 + PSCR) /* Weighted Fair Queue Weighting Control Register 0 of Port 0 */ +#define WFQWCR1P0 (0x0B8 + PSCR) /* Weighted Fair Queue Weighting Control Register 1 of Port 0 */ +#define WFQRCRP1 (0x0BC + PSCR) /* Weighted Fair Queue Rate Control Register of Port 1 */ +#define WFQWCR0P1 (0x0C0 + PSCR) /* Weighted Fair Queue Weighting Control Register 0 of Port 1 */ +#define WFQWCR1P1 (0x0C4 + PSCR) /* Weighted Fair Queue Weighting Control Register 1 of Port 1 */ +#define WFQRCRP2 (0x0C8 + PSCR) /* Weighted Fair Queue Rate Control Register of Port 2 */ +#define WFQWCR0P2 (0x0CC + PSCR) /* Weighted Fair Queue Weighting Control Register 0 of Port 2 */ +#define WFQWCR1P2 (0x0D0 + PSCR) /* Weighted Fair Queue Weighting Control Register 1 of Port 2 */ +#define WFQRCRP3 (0x0D4 + PSCR) /* Weighted Fair Queue Rate Control Register of Port 3 */ +#define WFQWCR0P3 (0x0D8 + PSCR) /* Weighted Fair Queue Weighting Control Register 0 of Port 3 */ +#define WFQWCR1P3 (0x0DC + PSCR) /* Weighted Fair Queue Weighting Control Register 1 of Port 3 */ +#define WFQRCRP4 (0x0E0 + PSCR) /* Weighted Fair Queue Rate Control Register of Port 4 */ +#define WFQWCR0P4 (0x0E4 + PSCR) /* Weighted Fair Queue Weighting Control Register 0 of Port 4 */ +#define WFQWCR1P4 (0x0E8 + PSCR) /* Weighted Fair Queue Weighting Control Register 1 of Port 4 */ +#define WFQRCRP5 (0x0EC + PSCR) /* Weighted Fair Queue Rate Control Register of Port 5 */ +#define WFQWCR0P5 (0x0F0 + PSCR) /* Weighted Fair Queue Weighting Control Register 0 of Port 5 */ +#define WFQWCR1P5 (0x0F4 + PSCR) /* Weighted Fair Queue Weighting Control Register 1 of Port 5 */ +#define WFQRCRP6 (0x0F8 + PSCR) /* Weighted Fair Queue Rate Control Register of Port 6 */ +#define WFQWCR0P6 (0x0FC + PSCR) /* Weighted Fair Queue Weighting Control Register 0 of Port 6 */ +#define WFQWCR1P6 (0x100 + PSCR) /* Weighted Fair Queue Weighting Control Register 1 of Port 6 */ +#define ELBPCR (0x104 + PSCR) /* Leaky Bucket Parameter Control Register */ +#define ELBTTCR (0x108 + PSCR) /* Leaky Bucket Token Threshold Control Register */ +#define ILBPCR1 (0x10C + PSCR) /* Ingress Leaky Bucket Parameter Control Register1 */ +#define ILBPCR2 (0x110 + PSCR) /* Ingress Leaky Bucket Parameter Control Register2 */ +#define ILB_CURRENT_TOKEN (0x114 + PSCR) /* The current token of the Leaky bucket 2Bytes per port(Port 0~Port5) */ + +/* P0Q0RGCG - Per-Queue Rate Guarantee Control Register */ +#define PPR_OFFSET (24) /* Peak Packet Rate, in times of APR CNT2 */ +#define PPR_MASK (7<<24) /* Peak Packet Rate, in times of APR CNT2 */ +#define L1_OFFSET (16) /* Bucket burst size of APR. unit: 1KB MAX */ +#define L1_MASK (0xff<<16) /* Bucket burst size of APR. unit: 1KB MAX */ +#define APR_OFFSET (0) /* Average Packet Rate, in times of 64Kbps CNT1 */ +#define APR_MASK (0x3FFF<<0) /* Average Packet Rate, in times of 64Kbps CNT1 */ + +/* WFQECR0P0 - Weighted Fair Queue Weighting Control Register 0 */ +#define SCHE3_WFQ (1<<31) /* Schedule Type for Queue 3: 1-WFQ ,0-Strict Priority */ +#define SCHE3_OFFSET (31) /* Schedule Type for Queue 3: 1-WFQ ,0-Strict Priority */ +#define SCHE3_MASK (1<<31) /* Schedule Type for Queue 3: 1-WFQ ,0-Strict Priority */ +#define WEIGHT3_OFFSET (24) /* Weight value assign of queue 3 for WFQ */ +#define WEIGHT3_MASK (0x7f<<24) /* Weight value assign of queue 3 for WFQ */ +#define SCHE2_WFQ (1<<23) /* Schedule Type for Queue 2: 1-WFQ ,0-Strict Priority */ +#define SCHE2_OFFSET (23) /* Schedule Type for Queue 2: 1-WFQ ,0-Strict Priority */ +#define SCHE2_MASK (1<<23) /* Schedule Type for Queue 2: 1-WFQ ,0-Strict Priority */ +#define WEIGHT2_OFFSET (16) /* Weight value assign of queue 2 for WFQ */ +#define WEIGHT2_MASK (0x7f<<16) /* Weight value assign of queue 2 for WFQ */ +#define SCHE1_WFQ (1<<15) /* Schedule Type for Queue 1: 1-WFQ ,0-Strict Priority */ +#define SCHE1_OFFSET (15) /* Schedule Type for Queue 1: 1-WFQ ,0-Strict Priority */ +#define SCHE1_MASK (1<<15) /* Schedule Type for Queue 1: 1-WFQ ,0-Strict Priority */ +#define WEIGHT1_OFFSET ( 8) /* Weight value assign of queue 1 for WFQ */ +#define WEIGHT1_MASK (0x7f<< 8) /* Weight value assign of queue 1 for WFQ */ +#define SCHE0_WFQ (1<<7) /* Schedule Type for Queue 0: 1-WFQ ,0-Strict Priority */ +#define SCHE0_OFFSET ( 7) /* Schedule Type for Queue 0: 1-WFQ ,0-Strict Priority */ +#define SCHE0_MASK (1<<7) /* Schedule Type for Queue 0: 1-WFQ ,0-Strict Priority */ +#define WEIGHT0_OFFSET ( 0) /* Weight value assign of queue 0 for WFQ */ +#define WEIGHT0_MASK (0x7f<< 0) /* Weight value assign of queue 0 for WFQ */ +/* WFQECR0P0 - Weighted Fair Queue Weighting Control Register 1 */ +#define SCHE5_WFQ (1<<15) /* Schedule Type for Queue 5: 1-WFQ ,0-Strict Priority */ +#define SCHE5_OFFSET (15) /* Schedule Type for Queue 5: 1-WFQ ,0-Strict Priority */ +#define SCHE5_MASK (1<<15) /* Schedule Type for Queue 5: 1-WFQ ,0-Strict Priority */ +#define WEIGHT5_OFFSET ( 8) /* Weight value assign of queue 5 for WFQ */ +#define WEIGHT5_MASK (0x7f<< 8) /* Weight value assign of queue 5 for WFQ */ +#define SCHE4_WFQ (1<< 7) /* Schedule Type for Queue 4: 1-WFQ ,0-Strict Priority */ +#define SCHE4_OFFSET ( 7) /* Schedule Type for Queue 4: 1-WFQ ,0-Strict Priority */ +#define SCHE4_MASK (1<< 7) /* Schedule Type for Queue 4: 1-WFQ ,0-Strict Priority */ +#define WEIGHT4_OFFSET ( 0) /* Weight value assign of queue 4 for WFQ */ +#define WEIGHT4_MASK (0x7f<< 0) /* Weight value assign of queue 4 for WFQ */ + +/* ELBPCR - Egress Leaky Bucket Parameter Control Register */ +#define Token_OFFSET (8) /* Token used for adding budget in each time slot. */ +#define Token_MASK (0xff<<8) /* Token used for adding budget in each time slot. */ +#define Tick_OFFSET (0) /* Tick used for time slot size unit */ +#define Tick_MASK (0xff<<0) /* Tick used for time slot size unit */ + +/* ELBTTCR - Egress Leaky Bucket Token Threshold Control Register */ +#define L2_OFFSET (0) /* leaky Bucket Token Hi-threshold register */ +#if 0/* conflict with flagDef.h */ +#define L2_MASK (0xffff<<0) /* leaky Bucket Token Hi-threshold register */ +#endif + +/* ILBPCR1 - Ingress Leaky Bucket Parameter Control Register 1 */ +#define UpperBound_OFFSET (16) /* Ingress BWC Parameter Upper bound Threshold (unit: 400bytes) */ +#define UpperBound_MASK (0xffff<<16) /* Ingress BWC Parameter Upper bound Threshold (unit: 400bytes) */ +#define LowerBound_OFFSET (0) /* Ingress BWC Parameter Lower Bound Threshold (unit: 400 bytes) */ +#define LowerBound_MASK (0xffff<<0) /* Ingress BWC Parameter Lower Bound Threshold (unit: 400 bytes) */ + +/* ILBPCR2 - Ingress Leaky Bucket Parameter Control Register 2 */ +#define ILB_feedToken_OFFSET (8) /* Token is used for adding budget in each time slot */ +#define ILB_feedToken_MASK (0xff<<8) /* Token is used for adding budget in each time slot */ +#define ILB_Tick_OFFSET (0) /* Tick is used for time slot size unit. */ +#define ILB_Tick_MASK (0xff<<0) /* Tick is used for time slot size unit. */ + + + + + + +#define VCR0 (0x00 +0x4A00+SWCORE_BASE) /* Vlan Control register*/ +#define VCR1 (0x04 +0x4A00+SWCORE_BASE) /* Vlan Control register*/ +#define PVCR0 (0x08 +0x4A00+SWCORE_BASE) /* port base control register*/ +#define PVCR1 (0x0C +0x4A00+SWCORE_BASE) /* port base control register*/ +#define PVCR2 (0x10 +0x4A00+SWCORE_BASE) /* port base control register*/ +#define PVCR3 (0x14 +0x4A00+SWCORE_BASE) /* port base control register*/ +#define PVCR4 (0x18 +0x4A00+SWCORE_BASE) /* port base control register*/ +#define PBVCR0 (0x1C +0x4A00+SWCORE_BASE) /* Protocol-Based VLAN Control Register 0 */ +#define PBVCR1 (0x20 +0x4A00+SWCORE_BASE) /* Protocol-Based VLAN Control Register 1 */ +#define PBVR0_0 (0x24 +0x4A00+SWCORE_BASE) /* Protocol-Based VLAN Rule 0 -- IPX */ +#define PBVR0_1 (0x28 +0x4A00+SWCORE_BASE) /* Protocol-Based VLAN Rule 0 -- IPX */ +#define PBVR0_2 (0x2C +0x4A00+SWCORE_BASE) /* Protocol-Based VLAN Rule 0 -- IPX */ +#define PBVR0_3 (0x30 +0x4A00+SWCORE_BASE) /* Protocol-Based VLAN Rule 0 -- IPX */ +#define PBVR0_4 (0x34 +0x4A00+SWCORE_BASE) /* Protocol-Based VLAN Rule 0 -- IPX */ +#define PBVR1_0 (0x38 +0x4A00+SWCORE_BASE) /* Protocol-Based VLAN Rule 1 NetBIOS */ +#define PBVR1_1 (0x3C +0x4A00+SWCORE_BASE) /* Protocol-Based VLAN Rule 1 NetBIOS */ +#define PBVR1_2 (0x40 +0x4A00+SWCORE_BASE) /* Protocol-Based VLAN Rule 1 NetBIOS */ +#define PBVR1_3 (0x44 +0x4A00+SWCORE_BASE) /* Protocol-Based VLAN Rule 1 NetBIOS */ +#define PBVR1_4 (0x48 +0x4A00+SWCORE_BASE) /* Protocol-Based VLAN Rule 1 NetBIOS */ +#define PBVR2_0 (0x4C +0x4A00+SWCORE_BASE) /* Protocol-Based VLAN Rule 2 PPPoE Control */ +#define PBVR2_1 (0x50 +0x4A00+SWCORE_BASE) /* Protocol-Based VLAN Rule 2 PPPoE Control */ +#define PBVR2_2 (0x54 +0x4A00+SWCORE_BASE) /* Protocol-Based VLAN Rule 2 PPPoE Control */ +#define PBVR2_3 (0x58 +0x4A00+SWCORE_BASE) /* Protocol-Based VLAN Rule 2 PPPoE Control */ +#define PBVR2_4 (0x5C +0x4A00+SWCORE_BASE) /* Protocol-Based VLAN Rule 2 PPPoE Control */ +#define PBVR3_0 (0x60 +0x4A00+SWCORE_BASE) /* Protocol-Based VLAN Rule 3 PPPoE session */ +#define PBVR3_1 (0x64 +0x4A00+SWCORE_BASE) /* Protocol-Based VLAN Rule 3 PPPoE session */ +#define PBVR3_2 (0x68 +0x4A00+SWCORE_BASE) /* Protocol-Based VLAN Rule 3 PPPoE session */ +#define PBVR3_3 (0x6C +0x4A00+SWCORE_BASE) /* Protocol-Based VLAN Rule 3 PPPoE session */ +#define PBVR3_4 (0x70 +0x4A00+SWCORE_BASE) /* Protocol-Based VLAN Rule 3 PPPoE session */ +#define PBVR4_0 (0x74 +0x4A00+SWCORE_BASE) /* Protocol-Based VLAN Rule 4 User-defined 1 */ +#define PBVR4_1 (0x78 +0x4A00+SWCORE_BASE) /* Protocol-Based VLAN Rule 4 User-defined 1 */ +#define PBVR4_2 (0x7C +0x4A00+SWCORE_BASE) /* Protocol-Based VLAN Rule 4 User-defined 1 */ +#define PBVR4_3 (0x80 +0x4A00+SWCORE_BASE) /* Protocol-Based VLAN Rule 4 User-defined 1 */ +#define PBVR4_4 (0x84 +0x4A00+SWCORE_BASE) /* Protocol-Based VLAN Rule 4 User-defined 1 */ +#define PBVR5_0 (0x88 +0x4A00+SWCORE_BASE) /* Protocol-Based VLAN Rule 4 User-defined 2 */ +#define PBVR5_1 (0x8C +0x4A00+SWCORE_BASE) /* Protocol-Based VLAN Rule 4 User-defined 2 */ +#define PBVR5_2 (0x90 +0x4A00+SWCORE_BASE) /* Protocol-Based VLAN Rule 4 User-defined 2 */ +#define PBVR5_3 (0x94 +0x4A00+SWCORE_BASE) /* Protocol-Based VLAN Rule 4 User-defined 2 */ +#define PBVR5_4 (0x98 +0x4A00+SWCORE_BASE) /* Protocol-Based VLAN Rule 4 User-defined 2 */ + +/* VCR0 - Vlan Control register */ +#define En1QtagVIDignore (1<<31) /* Enable 1Q vlan unware*/ +#define EN_1QTAGVIDIGNORE En1QtagVIDignore /* Alias Name */ +#define P8_AcptFType_OFFSET 25 /* Accept Frame Type for VLAN ingress control (Ext2) */ +#define P8_AcptFType_MASK (3<<25) /* Accept Frame Type for VLAN ingress control (Ext2) */ +#define P8_AcptFType_AdmitAllFrame (0<<25) /* Accept tagged and untagged frame (Ext2) */ +#define P8_AcptFType_AdmitTaggedOnly (1<<25) /* Accept tagged frame only (Ext2) */ +#define P8_AcptFType_AdmitUntagged (2<<25) /* Accept untagged frame and priority tag frame (Ext2) */ +#define P7_AcptFType_OFFSET 23 /* Accept Frame Type for VLAN ingress control (Ext1) */ +#define P7_AcptFType_MASK (3<<23) /* Accept Frame Type for VLAN ingress control (Ext1) */ +#define P7_AcptFType_AdmitAllFrame (0<<23) /* Accept tagged and untagged frame (Ext1) */ +#define P7_AcptFType_AdmitTaggedOnly (1<<23) /* Accept tagged frame only (Ext1) */ +#define P7_AcptFType_AdmitUntagged (2<<23) /* Accept untagged frame and priority tag frame (Ext1) */ +#define P6_AcptFType_OFFSET 21 /* Accept Frame Type for VLAN ingress control (Ext0) */ +#define P6_AcptFType_MASK (3<<21) /* Accept Frame Type for VLAN ingress control (Ext0) */ +#define P6_AcptFType_AdmitAllFrame (0<<21) /* Accept tagged and untagged frame (Ext0) */ +#define P6_AcptFType_AdmitTaggedOnly (1<<21) /* Accept tagged frame only (Ext0) */ +#define P6_AcptFType_AdmitUntagged (2<<21) /* Accept untagged frame and priority tag frame (Ext0) */ +#define P5_AcptFType_OFFSET 19 /* Accept Frame Type for VLAN ingress control */ +#define P5_AcptFType_MASK (3<<19) /* Accept Frame Type for VLAN ingress control */ +#define P5_AcptFType_AdmitAllFrame (0<<19) /* Accept tagged and untagged frame */ +#define P5_AcptFType_AdmitTaggedOnly (1<<19) /* Accept tagged frame only */ +#define P5_AcptFType_AdmitUntagged (2<<19) /* Accept untagged frame and priority tag frame */ +#define P4_AcptFType_OFFSET 17 /* Accept Frame Type for VLAN ingress control */ +#define P4_AcptFType_MASK (3<<17) /* Accept Frame Type for VLAN ingress control */ +#define P4_AcptFType_AdmitAllFrame (0<<17) /* Accept tagged and untagged frame */ +#define P4_AcptFType_AdmitTaggedOnly (1<<17) /* Accept tagged frame only */ +#define P4_AcptFType_AdmitUntagged (2<<17) /* Accept untagged frame and priority tag frame */ +#define P3_AcptFType_OFFSET 15 /* Accept Frame Type for VLAN ingress control */ +#define P3_AcptFType_MASK (3<<15) /* Accept Frame Type for VLAN ingress control */ +#define P3_AcptFType_AdmitAllFrame (0<<15) /* Accept tagged and untagged frame */ +#define P3_AcptFType_AdmitTaggedOnly (1<<15) /* Accept tagged frame only */ +#define P3_AcptFType_AdmitUntagged (2<<15) /* Accept untagged frame and priority tag frame */ +#define P2_AcptFType_OFFSET 13 /* Accept Frame Type for VLAN ingress control */ +#define P2_AcptFType_MASK (3<<13) /* Accept Frame Type for VLAN ingress control */ +#define P2_AcptFType_AdmitAllFrame (0<<13) /* Accept tagged and untagged frame */ +#define P2_AcptFType_AdmitTaggedOnly (1<<13) /* Accept tagged frame only */ +#define P2_AcptFType_AdmitUntagged (2<<13) /* Accept untagged frame and priority tag frame */ +#define P1_AcptFType_OFFSET 11 /* Accept Frame Type for VLAN ingress control */ +#define P1_AcptFType_MASK (3<<11) /* Accept Frame Type for VLAN ingress control */ +#define P1_AcptFType_AdmitAllFrame (0<<11) /* Accept tagged and untagged frame */ +#define P1_AcptFType_AdmitTaggedOnly (1<<11) /* Accept tagged frame only */ +#define P1_AcptFType_AdmitUntagged (2<<11) /* Accept untagged frame and priority tag frame */ +#define P0_AcptFType_OFFSET 9 /* Accept Frame Type for VLAN ingress control */ +#define P0_AcptFType_MASK (3<<9) /* Accept Frame Type for VLAN ingress control */ +#define P0_AcptFType_AdmitAllFrame (0<<9) /* Accept tagged and untagged frame */ +#define P0_AcptFType_AdmitTaggedOnly (1<<9) /* Accept tagged frame only */ +#define P0_AcptFType_AdmitUntagged (2<<9) /* Accept untagged frame and priority tag frame */ +#define EnVlanInF_OFFSET 0 /* Enable Vlan Ingress Filtering */ +#define EnVlanInF_MASK (0x1ff<<0) /* Enable Vlan Ingress Filtering */ +#define EN_VLAN_INGRESS_FILTER (1) /* Backward compatible for EnVlanInF */ +#define EN_ALL_PORT_VLAN_INGRESS_FILTER EnVlanInF_MASK /* Alias Name */ + +/* PVCR0, PVCR1, PVCR2, PVCR3, PVCR4 - Port-Based VLAN Control Register */ +#define PVIDP0_OFFSET 0 /* Default PVID for Port 0 */ +#define PVIDP0_MASK (0xfff<< 0) /* Default PVID for Port 0 */ +#define DPRIOP0_OFFSET 12 /* Default Port Priority for Port 0 */ +#define DPRIOP0_MASK (7<<12) /* Default Port Priority for Port 0 */ +#define PVIDP1_OFFSET 16 /* Default PVID for Port 1 */ +#define PVIDP1_MASK (0xfff<<16) /* Default PVID for Port 1 */ +#define DPRIOP1_OFFSET 28 /* Default Port Priority for Port 1 */ +#define DPRIOP1_MASK (7<<28) /* Default Port Priority for Port 1 */ +#define PVIDP2_OFFSET 0 /* Default PVID for Port 2 */ +#define PVIDP2_MASK (0xfff<< 0) /* Default PVID for Port 2 */ +#define DPRIOP2_OFFSET 12 /* Default Port Priority for Port 2 */ +#define DPRIOP2_MASK (7<<12) /* Default Port Priority for Port 2 */ +#define PVIDP3_OFFSET 16 /* Default PVID for Port 3 */ +#define PVIDP3_MASK (0xfff<<16) /* Default PVID for Port 3 */ +#define DPRIOP3_OFFSET 28 /* Default Port Priority for Port 3 */ +#define DPRIOP3_MASK (7<<28) /* Default Port Priority for Port 3 */ +#define PVIDP4_OFFSET 0 /* Default PVID for Port 4 */ +#define PVIDP4_MASK (0xfff<< 0) /* Default PVID for Port 4 */ +#define DPRIOP4_OFFSET 12 /* Default Port Priority for Port 4 */ +#define DPRIOP4_MASK (7<<12) /* Default Port Priority for Port 4 */ +#define PVIDP5_OFFSET 16 /* Default PVID for Port 5 */ +#define PVIDP5_MASK (0xfff<<16) /* Default PVID for Port 5 */ +#define DPRIOP5_OFFSET 28 /* Default Port Priority for Port 5 */ +#define DPRIOP5_MASK (7<<28) /* Default Port Priority for Port 5 */ +#define PVIDP6_OFFSET 0 /* Default PVID for Port 6 */ +#define PVIDP6_MASK (0xfff<< 0) /* Default PVID for Port 6 */ +#define DPRIOP6_OFFSET 12 /* Default Port Priority for Port 6 */ +#define DPRIOP6_MASK (7<<12) /* Default Port Priority for Port 6 */ +#define PVIDP7_OFFSET 16 /* Default PVID for Port 7 */ +#define PVIDP7_MASK (0xfff<<16) /* Default PVID for Port 7 */ +#define DPRIOP7_OFFSET 28 /* Default Port Priority for Port 7 */ +#define DPRIOP7_MASK (7<<28) /* Default Port Priority for Port 7 */ +#define PVIDP8_OFFSET 0 /* Default PVID for Port 8 */ +#define PVIDP8_MASK (0xfff<< 0) /* Default PVID for Port 8 */ +#define DPRIOP8_OFFSET 12 /* Default Port Priority for Port 8 */ +#define DPRIOP8_MASK (7<<12) /* Default Port Priority for Port 8 */ + + +/* + * 802.1X Control Register */ +#define DOT1X_BASE (SWCORE_BASE + 0x4B00) +#define DOT1XPORTCR (0x00 +DOT1X_BASE) /* 802.1X port base control register*/ +#define DOT1XMACCR (0x04 +DOT1X_BASE) /* 802.1X mac base control register*/ +#define GVGCR (0x08 +DOT1X_BASE) /* Guest VLAN registerr*/ + +#define DOT1X_DIR_BOTH 0 /* Bi-directional */ +#define DOT1X_DIR_IN 1 /* only filter IN */ +#define DOT1X_UNAUTH 0 /* Un-auth */ +#define DOT1X_AUTH 1 /* Auth */ +#define DOT1X_DISABLE 0 /* Disable */ +#define DOT1X_ENABLE 1 /* Enable */ + +/* DOT1XPORTCR - 802.1X port base control register */ +#define Dot1XPB_P8OPDIR (1<<26) /* Uni/Bi-directional Control Type for Port 8. 0:BOTH, 1:IN */ +#define Dot1XPB_P8Auth (1<<25) /* Authentication Status for Port 8. 0:Unauthorized, 1:Authorized */ +#define Dot1XPB_P8En (1<<24) /* Enabled/Disable Port Based Access Control for Port 8. 0:Disable, 1:Enable */ +#define Dot1XPB_P7OPDIR (1<<23) /* Uni/Bi-directional Control Type for Port 7. 0:BOTH, 1:IN */ +#define Dot1XPB_P7Auth (1<<22) /* Authentication Status for Port 7. 0:Unauthorized, 1:Authorized */ +#define Dot1XPB_P7En (1<<21) /* Enabled/Disable Port Based Access Control for Port 7. 0:Disable, 1:Enable */ +#define Dot1XPB_P6OPDIR (1<<20) /* Uni/Bi-directional Control Type for Port 6. 0:BOTH, 1:IN */ +#define Dot1XPB_P6Auth (1<<19) /* Authentication Status for Port 6. 0:Unauthorized, 1:Authorized */ +#define Dot1XPB_P6En (1<<18) /* Enabled/Disable Port Based Access Control for Port 6. 0:Disable, 1:Enable */ +#define Dot1XPB_P5OPDIR (1<<17) /* Uni/Bi-directional Control Type for Port 5. 0:BOTH, 1:IN */ +#define Dot1XPB_P5Auth (1<<16) /* Authentication Status for Port 5. 0:Unauthorized, 1:Authorized */ +#define Dot1XPB_P5En (1<<15) /* Enabled/Disable Port Based Access Control for Port 5. 0:Disable, 1:Enable */ +#define Dot1XPB_P4OPDIR (1<<14) /* Uni/Bi-directional Control Type for Port 4. 0:BOTH, 1:IN */ +#define Dot1XPB_P4Auth (1<<13) /* Authentication Status for Port 4. 0:Unauthorized, 1:Authorized */ +#define Dot1XPB_P4En (1<<13) /* Enabled/Disable Port Based Access Control for Port 4. 0:Disable, 1:Enable */ +#define Dot1XPB_P3OPDIR (1<<11) /* Uni/Bi-directional Control Type for Port 3. 0:BOTH, 1:IN */ +#define Dot1XPB_P3Auth (1<<10) /* Authentication Status for Port 3. 0:Unauthorized, 1:Authorized */ +#define Dot1XPB_P3En (1<< 9) /* Enabled/Disable Port Based Access Control for Port 3. 0:Disable, 1:Enable */ +#define Dot1XPB_P2OPDIR (1<< 8) /* Uni/Bi-directional Control Type for Port 2. 0:BOTH, 1:IN */ +#define Dot1XPB_P2Auth (1<< 7) /* Authentication Status for Port 2. 0:Unauthorized, 1:Authorized */ +#define Dot1XPB_P2En (1<< 6) /* Enabled/Disable Port Based Access Control for Port 2. 0:Disable, 1:Enable */ +#define Dot1XPB_P1OPDIR (1<< 5) /* Uni/Bi-directional Control Type for Port 1. 0:BOTH, 1:IN */ +#define Dot1XPB_P1Auth (1<< 4) /* Authentication Status for Port 1. 0:Unauthorized, 1:Authorized */ +#define Dot1XPB_P1En (1<< 3) /* Enabled/Disable Port Based Access Control for Port 1. 0:Disable, 1:Enable */ +#define Dot1XPB_P0OPDIR (1<< 2) /* Uni/Bi-directional Control Type for Port 0. 0:BOTH, 1:IN */ +#define Dot1XPB_P0Auth (1<< 1) /* Authentication Status for Port 0. 0:Unauthorized, 1:Authorized */ +#define Dot1XPB_P0En (1<< 0) /* Enabled/Disable Port Based Access Control for Port 0. 0:Disable, 1:Enable */ + +#define Dot1XPB_POPDIR_offset(idx) (((idx)*3) + 2) +#define Dot1XPB_PAuth_offset(idx) (((idx)*3) + 1) +#define Dot1XPB_PEn_offset(idx) ((idx)*3) +#define Dot1XPB_POPDIR(idx, dir) ((dir) << Dot1XPB_POPDIR_offset(idx)) +#define Dot1XPB_PAuth(idx, auth) ((auth) << Dot1XPB_PAuth_offset(idx)) +#define Dot1XPB_PEn(idx, en) ((en) << Dot1XPB_PEn_offset(idx)) + +#define EN_8021X_PORT_CONTROL Dot1XPB_P0En /* Enable 1X Port Base Control*/ +#define EN_8021X_PORT_AUTH Dot1XPB_P0Auth /* port authorized*/ +#define EN_8021X_PORT_DIR_IN Dot1XPB_P0OPDIR /* Only filter In direction*/ +#define EN_DOT1XPB_P0 Dot1XPB_P0En /* Alias Name */ +#define EN_DOT1XPB_P0_AUTH Dot1XPB_P0Auth /* Alias Name */ +#define EN_DOT1XPB_P0_OPINDIR Dot1XPB_P0OPDIR /* Alias Name */ +#define EN_DOT1XPB_P1 Dot1XPB_P1En /* Alias Name */ +#define EN_DOT1XPB_P1_AUTH Dot1XPB_P1Auth /* Alias Name */ +#define EN_DOT1XPB_P1_OPINDIR Dot1XPB_P1OPDIR /* Alias Name */ +#define EN_DOT1XPB_P2 Dot1XPB_P2En /* Alias Name */ +#define EN_DOT1XPB_P2_AUTH Dot1XPB_P2Auth /* Alias Name */ +#define EN_DOT1XPB_P2_OPINDIR Dot1XPB_P2OPDIR /* Alias Name */ +#define EN_DOT1XPB_P3 Dot1XPB_P3En /* Alias Name */ +#define EN_DOT1XPB_P3_AUTH Dot1XPB_P3Auth /* Alias Name */ +#define EN_DOT1XPB_P3_OPINDIR Dot1XPB_P3OPDIR /* Alias Name */ +#define EN_DOT1XPB_P4 Dot1XPB_P4En /* Alias Name */ +#define EN_DOT1XPB_P4_AUTH Dot1XPB_P4Auth /* Alias Name */ +#define EN_DOT1XPB_P4_OPINDIR Dot1XPB_P4OPDIR /* Alias Name */ +#define EN_DOT1XPB_P5 Dot1XPB_P5En /* Alias Name */ +#define EN_DOT1XPB_P5_AUTH Dot1XPB_P5Auth /* Alias Name */ +#define EN_DOT1XPB_P5_OPINDIR Dot1XPB_P5OPDIR /* Alias Name */ +#define EN_DOT1XPB_P6 Dot1XPB_P6En /* Alias Name */ +#define EN_DOT1XPB_P6_AUTH Dot1XPB_P6Auth /* Alias Name */ +#define EN_DOT1XPB_P6_OPINDIR Dot1XPB_P6OPDIR /* Alias Name */ +#define EN_DOT1XPB_P7 Dot1XPB_P7En /* Alias Name */ +#define EN_DOT1XPB_P7_AUTH Dot1XPB_P7Auth /* Alias Name */ +#define EN_DOT1XPB_P7_OPINDIR Dot1XPB_P7OPDIR /* Alias Name */ +#define EN_DOT1XPB_P8 Dot1XPB_P8En /* Alias Name */ +#define EN_DOT1XPB_P8_AUTH Dot1XPB_P8Auth /* Alias Name */ +#define EN_DOT1XPB_P8_OPINDIR Dot1XPB_P8OPDIR /* Alias Name */ + +/* DOT1XMACCR - 802.1X mac base control register*/ +#define Dot1xMAC_OPDIR (1<<10) /* OperCOnntrolledDirections for MAC-Based ACCESS Control. 0:BOTH, 1:IN */ +#define Dot1xMAC_OPDIR_IN Dot1xMAC_OPDIR +#define Dot1xMAC_OPDIR_BOTH 0 +#define Dot1xMAC_P8En (1<< 8) /* Enable/Disable MAC Address Based Control on Port 8. 0:disable, 1:enable */ +#define Dot1xMAC_P7En (1<< 7) /* Enable/Disable MAC Address Based Control on Port 7. 0:disable, 1:enable */ +#define Dot1xMAC_P6En (1<< 6) /* Enable/Disable MAC Address Based Control on Port 6. 0:disable, 1:enable */ +#define Dot1xMAC_P5En (1<< 5) /* Enable/Disable MAC Address Based Control on Port 5. 0:disable, 1:enable */ +#define Dot1xMAC_P4En (1<< 4) /* Enable/Disable MAC Address Based Control on Port 4. 0:disable, 1:enable */ +#define Dot1xMAC_P3En (1<< 3) /* Enable/Disable MAC Address Based Control on Port 3. 0:disable, 1:enable */ +#define Dot1xMAC_P2En (1<< 2) /* Enable/Disable MAC Address Based Control on Port 2. 0:disable, 1:enable */ +#define Dot1xMAC_P1En (1<< 1) /* Enable/Disable MAC Address Based Control on Port 1. 0:disable, 1:enable */ +#define Dot1xMAC_P0En (1<< 0) /* Enable/Disable MAC Address Based Control on Port 0. 0:disable, 1:enable */ +#define EN_DOT1XMAC_OPDIR_IN Dot1xMAC_OPDIR /* Alias Name */ +#define EN_8021X_ALLPORT_MAC_CONTROL 0x01FF +#define EN_8021X_MAC_CONTROL (1) /* Flag to check if port n is enabled */ +#define EN_8021X_PORT0_MAC_CONTROL Dot1xMAC_P0En /* Alias Name */ +#define EN_8021X_PORT1_MAC_CONTROL Dot1xMAC_P1En /* Alias Name */ +#define EN_8021X_PORT2_MAC_CONTROL Dot1xMAC_P2En /* Alias Name */ +#define EN_8021X_PORT3_MAC_CONTROL Dot1xMAC_P3En /* Alias Name */ +#define EN_8021X_PORT4_MAC_CONTROL Dot1xMAC_P4En /* Alias Name */ +#define EN_8021X_PORT5_MAC_CONTROL Dot1xMAC_P5En /* Alias Name */ +#define EN_8021X_PORT6_MAC_CONTROL Dot1xMAC_P6En /* Alias Name */ +#define EN_8021X_PORT7_MAC_CONTROL Dot1xMAC_P7En /* Alias Name */ +#define EN_8021X_PORT8_MAC_CONTROL Dot1xMAC_P8En /* Alias Name */ + +/* GVGCR - Guest VLAN registerr*/ +#define GVR2CPU (1<<15) /* Enable Guest VLAN routing packet to be trap to CPU */ +#define GVOPDIR (1<<14) /* Guest Vlan operation direction control*/ +#define Dot1xUNAUTHBH_OFFSET 12 /* Defaulkt Process of unauthenticated client(/packet) for both port-based and MAC-based Access Control */ +#define Dot1XUNAUTHBH_MASK (3<<12) /* Defaulkt Process of unauthenticated client(/packet) for both port-based and MAC-based Access Control */ +#define Dot1xUNAUTHBH_DROP (0<<12) /* Drop unauthorized frame */ +#define Dot1xUNAUTHBH_TOCPU (1<<12) /* Trap unauthorized frame to CPU */ +#define Dot1xUNAUTHBH_GVLAN (2<<12) /* Enable limited access in Guest VLAN */ +#define Dot1xUNAUTHBH_RESERVED (3<<12) /* Reserved */ +#define GVID_OFFSET 0 /* Guest VLAN VID */ +#define GVID_MASK (0xfff<<0) /* Guest VLAN VID */ +#define EN_DOT1X_GVR2CPU GVR2CPU /* Alias Name */ +#define EN_GVOPDIR GVOPDIR /* Alias Name */ +#define GVLAN_PROCESS_BITS Dot1xUNAUTHBH_OFFSET /* Alias Name */ +#define GVLAN_PROCESS_MASK (Dot1XUNAUTHBH_MASK>>Dot1xUNAUTHBH_OFFSET) /* Alias Name */ +#define DOT1X_PROCESS_DROP (Dot1xUNAUTHBH_DROP>>Dot1xUNAUTHBH_OFFSET) /* Alias Name */ +#define DOT1X_PROCESS_TOCPU (Dot1xUNAUTHBH_TOCPU>>Dot1xUNAUTHBH_OFFSET) /* Alias Name */ +#define DOT1X_PROCESS_GVLAN (Dot1xUNAUTHBH_GVLAN>>Dot1xUNAUTHBH_OFFSET) /* Alias Name */ +#define DOT1X_PROCESS_RESERVED (Dot1xUNAUTHBH_RESERVED>>Dot1xUNAUTHBH_OFFSET) /* Alias Name */ + +/* Link Aggregation Control Register (IEEE 802.3ad) */ +#define LAGCR_BASE (SWCORE_BASE + 0x4C00) +#define LAGHPMR0 (0x00 + LAGCR_BASE) /* Link Aggregation Hashed Index to Port Mapping Register 0 */ +#define LAGCR0 (0x08 + LAGCR_BASE) /* Link Aggregation Control Register 0 */ +#define LAGCR1 (0x0C + LAGCR_BASE) /* Link Aggregation Control Register 1 */ + +/* output queue stats mask */ +#define OUTPUTQUEUE_STAT_MASK_CR0 0xfc000000 +#define OUTPUTQUEUE_STAT_MASK_CR1 0x3fffffff + +/* LAGHPMR0 - Link Aggregation Hashed Index to Port Mapping Register 0 */ +#define LAG_HASHIDX_BITNUM 4 + +/* LAGCR0 - Link Aggregation Control Register 0 */ +#define TRUNKMASK_MASK (0x1ff) + +#define RTL865X_PORTMASK_UNASIGNED 0x5A5A5A5A + +#define RTL865X_PREALLOC_SKB_UNASIGNED 0xA5A5A5A5 + +#define RTL865XC_PORT_NUMBER 9 + +/* Spanning Tree Port State Definition */ +#define RTL8651_PORTSTA_DISABLED 0x00 +#define RTL8651_PORTSTA_BLOCKING 0x01 +#define RTL8651_PORTSTA_LISTENING 0x02 +#define RTL8651_PORTSTA_LEARNING 0x03 +#define RTL8651_PORTSTA_FORWARDING 0x04 + +#define RTL8651_L2TBL_ROW 256 +#define RTL8651_L2TBL_COLUMN 4 + +#define RTL865XC_LAGHASHIDX_NUMBER 8 /* There are 8 hash values in RTL865xC Link Aggregation. */ + +#define RTL865XC_VLAN_NUMBER 4096 + +//Ethernet port bandwidth control +#define RTL8651_BC_FULL 0x00 +#define RTL8651_BC_128K 0x01 +#define RTL8651_BC_256K 0x02 +#define RTL8651_BC_512K 0x03 +#define RTL8651_BC_1M 0x04 +#define RTL8651_BC_2M 0x05 +#define RTL8651_BC_4M 0x06 +#define RTL8651_BC_8M 0x07 +#define RTL8651_BC_16M 0x08 +#define RTL8651_BC_32M 0x09 +#define RTL8651_BC_64M 0x0A + +/* For round robin ration */ +#define RTL8651_RR_H_FIRST 0x03 +#define RTL8651_RR_H16_L1 0x02 +#define RTL8651_RR_H8_L1 0x01 +#define RTL8651_RR_H4_L1 0x00 + +#define RTL865XC_NETINTERFACE_NUMBER 8 + +#define RTL8651_L2_NUMBER 1024 + +enum FDB_FLAGS +{ + FDB_FWD = 0, + FDB_SRCBLK = 1, + FDB_TRAPCPU = 2, +}; + + +/* Miscellaneous control registers +*/ +#define LEDCREG (SWCORE_BASE + 0x4300) /* LED control */ +#define LEDCR1 (LEDCREG+0x04) +#define LEDBCR (LEDCREG+0x0C) + +#define MISC_BASE (SWCORE_BASE + 0x00007000) +//#define LEDCR (0x000 + MISC_BASE) /* LED control */ +#define LEDCR (0x000 + SWCORE_BASE + 0x4300) /* LED control */ //????? +#define BCR0 (0x008 + MISC_BASE) /* Input bandwidth control */ +#define BCR1 (0x00C + MISC_BASE) /* Ouput bandwidth control */ +#define FCREN (0x014 + MISC_BASE) /* Flow control enable control */ +#define FCRTH (0x018 + MISC_BASE) /* Flow control threshold */ +#define FCPTR (0x028 + MISC_BASE) /* Flow control prime threshold register */ +#define PTCR (0x01C + MISC_BASE) /* Port trunk control */ +#define SWTECR (0x020 + MISC_BASE) /* Switch table extended control */ +#define PTRAPCR (0x024 + MISC_BASE) /* Protocol trapping control */ + + + +#define GIDXMCR (0x07C + MISC_BASE) /* GIDX mapping control */ +#define PBVR2 (0x0A0 + MISC_BASE) /* Protocol-Based VLAN Rule 2 -- NetBIOS */ +#define PBVR2E (0x0A4 + MISC_BASE) /* Protocol-Based VLAN Rule 2 Extended */ +#define PBVR3 (0x0A8 + MISC_BASE) /* Protocol-Based VLAN Rule 3 -- PPPoE Control */ +#define PBVR3E (0x0AC + MISC_BASE) /* Protocol-Based VLAN Rule 3 Extended */ +#define PBVR4 (0x0B0 + MISC_BASE) /* Protocol-Based VLAN Rule 4 -- PPPoE Session */ +#define PBVR4E (0x0B4 + MISC_BASE) /* Protocol-Based VLAN Rule 4 Extended */ +#define PBVR5 (0x0B8 + MISC_BASE) /* Protocol-Based VLAN Rule 5 -- User-defined 1*/ +#define PBVR5E (0x0BC + MISC_BASE) /* Protocol-Based VLAN Rule 5 Extended */ +#define PBVR6 (0x0C0 + MISC_BASE) /* Protocol-Based VLAN Rule 6 -- User-defined 2*/ +#define PBVR6E (0x0C4 + MISC_BASE) /* Protocol-Based VLAN Rule 6 Extended */ + +#define PSIR0 (0x0C8 + MISC_BASE) /* Port State Information Register 0 */ +#define PSIR1 (0x0CC + MISC_BASE) /* Port State Information Register 1 */ +#define CHIPID (0x100 + MISC_BASE) /* Chip version ID */ + +/* LED control register field definitions +*/ +#define LED_P0_SPEED (1 << 0) /* LED port 0 collision */ +#define LED_P0_ACT (1 << 1) /* LED port 0 active */ +#define LED_P0_COL (1 << 2) /* LED port 0 speed 100M */ +#define LED_P1_SPEED (1 << 3) /* LED port 1 collision */ +#define LED_P1_ACT (1 << 4) /* LED port 1 active */ +#define LED_P1_COL (1 << 5) /* LED port 1 speed 100M */ +#define LED_P2_SPEED (1 << 6) /* LED port 2 collision */ +#define LED_P2_ACT (1 << 7) /* LED port 2 active */ +#define LED_P2_COL (1 << 8) /* LED port 2 speed 100M */ +#define LED_P3_SPEED (1 << 9) /* LED port 3 collision */ +#define LED_P3_ACT (1 << 10) /* LED port 3 active */ +#define LED_P3_COL (1 << 11) /* LED port 3 speed 100M */ +#define LED_P4_SPEED (1 << 12) /* LED port 4 collision */ +#define LED_P4_ACT (1 << 13) /* LED port 4 active */ +#define LED_P4_COL (1 << 14) /* LED port 4 speed 100M */ +#define LED_P5_SPEED (1 << 15) /* LED port 5 collision */ +#define LED_P5_ACT (1 << 16) /* LED port 5 active */ +#define LED_P5_COL (1 << 17) /* LED port 5 speed 100M */ +#define EN_LED_CPU_CTRL (1 << 18) /* Enable CPU control LED */ +/* Bandwidth control register field definitions +*/ +#define OUT_BC_P0_OFFSET 0 /* Output bandwidth control port 0 offset */ +#define IN_BC_P0_OFFSET 4 /* Input bandwidth control port 0 offset */ +#define OUT_BC_P1_OFFSET 8 /* Output bandwidth control port 1 offset */ +#define IN_BC_P1_OFFSET 12 /* Input bandwidth control port 1 offset */ +#define OUT_BC_P2_OFFSET 16 /* Output bandwidth control port 2 offset */ +#define IN_BC_P2_OFFSET 20 /* Input bandwidth control port 2 offset */ +#define OUT_BC_P3_OFFSET 24 /* Output bandwidth control port 3 offset */ +#define IN_BC_P3_OFFSET 48 /* Input bandwidth control port 3 offset */ +#define OUT_BC_P4_OFFSET 0 /* Output bandwidth control port 4 offset */ +#define IN_BC_P4_OFFSET 4 /* Input bandwidth control port 4 offset */ +#define OUT_BC_P5_OFFSET 8 /* Output bandwidth control port 5 offset */ +#define IN_BC_P5_OFFSET 12 /* Input bandwidth control port 5 offset */ +#define BW_FULL_RATE 0 +#define BW_128K 1 +#define BW_256K 2 +#define BW_512K 3 +#define BW_1M 4 +#define BW_2M 5 +#define BW_4M 6 +#define BW_8M 7 +/* Checksum control register field definitions +*/ +#define ALLOW_L2_CHKSUM_ERR (1 << 0) /* Allow L2 checksum error */ +#define ALLOW_L3_CHKSUM_ERR (1 << 1) /* Allow L3 checksum error */ +#define ALLOW_L4_CHKSUM_ERR (1 << 2) /* Allow L4 checksum error */ +#define EN_ETHER_L3_CHKSUM_REC (1 << 3) /* Enable L3 checksum recalculation*/ +#define EN_ETHER_L4_CHKSUM_REC (1 << 4) /* Enable L4 checksum recalculation*/ +/* Flow control enable register field defintions +*/ +#define EN_INQ_FC_CPU (1 << 31) /* Enable Flow Control on CPU Port */ +#define EN_INQ_FC_5 (1 << 30) /* Enable Flow Control on Port 5 */ +#define EN_INQ_FC_4 (1 << 29) /* Enable Flow Control on Port 4 */ +#define EN_INQ_FC_3 (1 << 28) /* Enable Flow Control on Port 3 */ +#define EN_INQ_FC_2 (1 << 27) /* Enable Flow Control on Port 2 */ +#define EN_INQ_FC_1 (1 << 26) /* Enable Flow Control on Port 1 */ +#define EN_INQ_FC_0 (1 << 25) /* Enable Flow Control on Port 0 */ +#define EN_OUTQ_FC_CPU (1 << 24) /* Enable Flow Control on CPU Port */ +#define EN_OUTQ_FC_5 (1 << 23) /* Enable Flow Control on Port 5 */ +#define EN_OUTQ_FC_4 (1 << 22) /* Enable Flow Control on Port 4 */ +#define EN_OUTQ_FC_3 (1 << 21) /* Enable Flow Control on Port 3 */ +#define EN_OUTQ_FC_2 (1 << 20) /* Enable Flow Control on Port 2 */ +#define EN_OUTQ_FC_1 (1 << 19) /* Enable Flow Control on Port 1 */ +#define EN_OUTQ_FC_0 (1 << 18) /* Enable Flow Control on Port 0 */ +#define CPU_LAUNCH_FC_P5 (1 << 17) /* CPU launch flow control of Port 5 */ +#define CPU_LAUNCH_FC_P4 (1 << 16) /* CPU launch flow control of Port 4 */ +#define CPU_LAUNCH_FC_P3 (1 << 15) /* CPU launch flow control of Port 3 */ +#define CPU_LAUNCH_FC_P2 (1 << 14) /* CPU launch flow control of Port 2 */ +#define CPU_LAUNCH_FC_P1 (1 << 13) /* CPU launch flow control of Port 1 */ +#define CPU_LAUNCH_FC_P0 (1 << 12) /* CPU launch flow control of Port 0 */ +#define EN_MDC_MDIO_FC (1 << 10) /* Enable MDC/MDIO Flow Control */ +#define DSC_TH_OFFSET 0 /* Descriptor Initial threshold */ +/* Flow control threshold register field defintions +*/ +#define IN_Q_PER_PORT_BUF_FC_THH_OFFSET 24 /* InQ per port buffer page flow control high threshold offset */ +#define IN_Q_PER_PORT_BUF_FC_THL_OFFSET 16 /* InQ per port buffer page flow control low threshold offset */ +#define OUT_Q_PER_PORT_BUF_FC_THH_OFFSET 8 /* OutQ per port buffer page flow control high threshold offset */ +#define OUT_Q_PER_PORT_BUF_FC_THL_OFFSET 0 /* OutQ per port buffer page flow control low threshold offset */ +/* Flow control prime threshold register field defintions +*/ +#define IN_Q_PTH_OFFSET 16 /* InQ Prime flow control threshold */ +#define OUT_Q_PTH_OFFSET 0 /* OutQ Prime flow control threshold */ +/* Port trunking control register field definitions +*/ +#define LMPR7_OFFSET 27 /* Physical port index for logical port 7 */ +#define LMPR6_OFFSET 24 /* Physical port index for logical port 6 */ +#define LMPR5_OFFSET 21 /* Physical port index for logical port 5 */ +#define LMPR4_OFFSET 18 /* Physical port index for logical port 4 */ +#define LMPR3_OFFSET 15 /* Physical port index for logical port 3 */ +#define LMPR2_OFFSET 12 /* Physical port index for logical port 2 */ +#define LMPR1_OFFSET 9 /* Physical port index for logical port 1 */ +#define LMPR0_OFFSET 6 /* Physical port index for logical port 0 */ +#define TRUNK1_PORT_MASK_OFFSET 0 /* Physical port mask of trunk 1 */ +/* Port trunking control register field definitions +*/ +#define EN_PPP_OP (1 << 31) /* Enable PPPoE auto insert and remove */ +/* Protocol trapping control register field definitions +*/ +#define EN_ARP_TRAP (1 << 24) /* Enable trapping ARP packets */ +#define EN_RARP_TRAP (1 << 25) /* Enable trapping RARP packets */ +#define EN_PPPOE_TRAP (1 << 26) /* Enable trapping PPPoE packets */ +#define EN_IGMP_TRAP (1 << 27) /* Enable trapping IGMP packets */ +#define EN_DHCP_TRAP1 (1 << 28) /* Enable trapping DHCP 67 packets */ +#define EN_DHCP_TRAP2 (1 << 29) /* Enable trapping DHCP 68 packets */ +#define EN_OSPF_TRAP (1 << 30) /* Enable trapping OSPF packets */ +#define EN_RIP_TRAP (1 << 31) /* Enable trapping RIP packets */ +/* Spanning tree control register field definitions +*/ +#define EN_ESTP_S_DROP (1 << 5) /* Enable egress spanning tree forward S_Drop */ +/* Broadcast storm control register field definitions +*/ +#define EN_BCAST_STORM (1 << 0) /* Enable broadcast storm control */ +#define BCAST_TH_MASK (0xFF << 1) /* Threshold within broadcast interval mask */ +#define BCAST_TH_OFFSET 1 /* Threshold within broadcast interval offset */ +#define TI_100M_MASK (0x3F << 9) /* Time interval for 100M mask */ +#define TI_100M_OFFSET 9 /* Time interval for 100M offset */ +#define TI_10M_MASK (0x3F << 15)/* Time interval for 10M mask */ +#define TI_10M_OFFSET 15 /* Time interval for 10M offset */ +#define EN_L2LRUHASH (1<<4) /*Enable L2 Table hash collision over write the last used entry mode*/ +#define EN_L2FASTAGING (1<<5) /*Enable L2 Fast Aging Out*/ + +/* Table entry aging time control register field definitions +*/ +#define ICMP_TH_OFFSET 26 /* ICMP timeout threshold offset */ +#define ICMP_TH_MASK (0x3f << ICMP_TH_OFFSET) +#define UDP_TH_OFFSET 20 /* UDP timeout threshold offset */ +#define UDP_TH_MASK (0x3f << UDP_TH_OFFSET) +#define TCP_LONG_TH_OFFSET 14 /* TCP long timeout threshold offset */ +#define TCP_LONG_TH_MASK (0x3f << TCP_LONG_TH_OFFSET) +#define TCP_MED_TH_OFFSET 8 /* TCP medium timeout threshold offset */ +#define TCP_MED_TH_MASK (0x3f << TCP_MED_TH_OFFSET) +#define TCP_FAST_TH_OFFSET 2 /* TCP fast timeout threshold offset */ +#define TCP_FAST_TH_MASK (0x3f << TCP_FAST_TH_OFFSET) +/* Port mirror control register field definitions +*/ +#define MIRROR_TO_PORT_OFFSET 26 /* Port receiving the mirrored traffic offset */ +#define MIRROR_FROM_PORT_RX_OFFSET 20 /* Rx port to be mirrored offset */ +#define MIRROR_FROM_PORT_TX_OFFSET 14 /* Tx port to be mirrored offset */ +/* Per port matching action register field definitions +*/ +#define EN_PMATCH_PORT_LIST_OFFSET 26 /* Enable pattern match port list offset */ +#define MATCH_OP_P5_OFFSET 24 /* Offset of operation if matched on port 5 */ +#define MATCH_OP_P4_OFFSET 22 /* Offset of operation if matched on port 4 */ +#define MATCH_OP_P3_OFFSET 20 /* Offset of operation if matched on port 3 */ +#define MATCH_OP_P2_OFFSET 18 /* Offset of operation if matched on port 2 */ +#define MATCH_OP_P1_OFFSET 16 /* Offset of operation if matched on port 1 */ +#define MATCH_OP_P0_OFFSET 14 /* Offset of operation if matched on port 0 */ +#define MATCH_DROP 0 /* Drop if matched */ +#define MATCH_MIRROR_TO_CPU 1 /* Mirror to CPU if matched */ +#define MATCH_FORWARD_TO_CPU 2 /* Forward to CPU if matched */ +#define MATCH_TO_MIRROR_PORT 3 /* To mirror port if matched */ +/* Port based vlan config register field definitions +*/ +#define PVID_MASK 7 /* MASK for PVID */ +#define VIDP0_OFFSET 0 /* Vlan table index for port 0 */ +#define VIDP1_OFFSET 3 /* Vlan table index for port 1 */ +#define VIDP2_OFFSET 6 /* Vlan table index for port 2 */ +#define VIDP3_OFFSET 9 /* Vlan table index for port 3 */ +#define VIDP4_OFFSET 12 /* Vlan table index for port 4 */ +#define VIDP5_OFFSET 15 /* Vlan table index for port 5 */ +/* GIDX mapping control register field definitions +*/ +#define GIDX_MASK 7 /* MASK for GIDX */ +#define GIDX0_OFFSET 0 /* Index to IP table */ +#define GIDX1_OFFSET 3 /* Index to IP table */ +#define GIDX2_OFFSET 6 /* Index to IP table */ +#define GIDX3_OFFSET 9 /* Index to IP table */ +#define GIDX4_OFFSET 12 /* Index to IP table */ +#define GIDX5_OFFSET 15 /* Index to IP table */ +#define GIDX6_OFFSET 18 /* Index to IP table */ +#define GIDX7_OFFSET 21 /* Index to IP table */ +/* Offset control register field definitions +*/ +#define OCR_START_MASK (0x1f << 26) /* Starting value of offset mask */ +#define OCR_START_OFFSET 26 /* Starting value of offset offset */ +#define OCR_END_MASK (0x1f << 20) /* End value of offset mask */ +#define OCR_END_OFFSET 20 /* End value of offset offset */ +/* Protocol-based VLAN Control Register field definitions +*/ +#define PBVCR_PROTO_TYPE_OFFSET 0 /* Protocol-Based VLAN Control Register Protocol Type */ +#define PBVCR_PROTO_TYPE_MASK (0x3 << PBVCR_PROTO_TYPE_OFFSET) +#define PBVCR_PROTO_VALUE_OFFSET 2 /* Protocol-Based VLAN Control Register Protocol Value */ +#define PBVCR_PROTO_VALUE_MASK (0xffff << PBVCR_PROTO_VALUE_OFFSET) +#define PBVCR_VIDXP5_OFFSET 21 /* VLAN index for Port 5 */ +#define PBVCR_VIDXP5_MASK (0x7 << PBVCR_VIDXP5_OFFSET) +#define PBVCR_VP5_OFFSET 20 /* Valid bit for Port 5 */ +#define PBVCR_VP5_MASK (0x1 << PBVCR_VP5_OFFSET) +#define PBVCR_VIDXP4_OFFSET 17 /* VLAN index for Port 4 */ +#define PBVCR_VIDXP4_MASK (0x7 << PBVCR_VIDXP4_OFFSET) +#define PBVCR_VP4_OFFSET 16 /* Valid bit for Port 4 */ +#define PBVCR_VP4_MASK (0x1 << PBVCR_VP4_OFFSET) +#define PBVCR_VIDXP3_OFFSET 13 /* VLAN index for Port 3 */ +#define PBVCR_VIDXP3_MASK (0x7 << PBVCR_VIDXP3_OFFSET) +#define PBVCR_VP3_OFFSET 12 /* Valid bit for Port 3 */ +#define PBVCR_VP3_MASK (0x1 << PBVCR_VP3_OFFSET) +#define PBVCR_VIDXP2_OFFSET 9 /* VLAN index for Port 2 */ +#define PBVCR_VIDXP2_MASK (0x7 << PBVCR_VIDXP2_OFFSET) +#define PBVCR_VP2_OFFSET 8 /* Valid bit for Port 2 */ +#define PBVCR_VP2_MASK (0x1 << PBVCR_VP2_OFFSET) +#define PBVCR_VIDXP1_OFFSET 5 /* VLAN index for Port 1 */ +#define PBVCR_VIDXP1_MASK (0x7 << PBVCR_VIDXP1_OFFSET) +#define PBVCR_VP1_OFFSET 4 /* Valid bit for Port 1 */ +#define PBVCR_VP1_MASK (0x1 << PBVCR_VP1_OFFSET) +#define PBVCR_VIDXP0_OFFSET 3 /* VLAN index for Port 0 */ +#define PBVCR_VIDXP0_MASK (0x7 << PBVCR_VIDXP0_OFFSET) +#define PBVCR_VP0_OFFSET 0 /* Valid bit for Port 0 */ +#define PBVCR_VP0_MASK (0x1 << PBVCR_VP0_OFFSET) +#define PBVCR_VIDXEP2_OFFSET 9 /* VLAN index for Extented Port 2 */ +#define PBVCR_VIDXEP2_MASK (0x7 << PBVCR_VIDXEP2_OFFSET) +#define PBVCR_VEP2_OFFSET 8 /* Valid bit for Extented Port 2 */ +#define PBVCR_VEP2_MASK (0x1 << PBVCR_VEP2_OFFSET) +#define PBVCR_VIDXEP1_OFFSET 5 /* VLAN index for Extented Port 1 */ +#define PBVCR_VIDXEP1_MASK (0x7 << PBVCR_VIDXEP1_OFFSET) +#define PBVCR_VEP1_OFFSET 4 /* Valid bit for Extented Port 1 */ +#define PBVCR_VEP1_MASK (0x1 << PBVCR_VEP1_OFFSET) +#define PBVCR_VIDXEP0_OFFSET 1 /* VLAN index for Extented Port 0 */ +#define PBVCR_VIDXEP0_MASK (0x7 << PBVCR_VIDXEP0_OFFSET) +#define PBVCR_VEP0_OFFSET 0 /* Valid bit for Extented Port 0 */ +#define PBVCR_VEP0_MASK (0x1 << PBVCR_VEP0_OFFSET) + +#if 0 /* Not defined in 865xC spec */ +/* PCMCIA registers +*/ +#define PCMCIA_BASE (SYSTEM_BASE+0x0000) /* 0xBD010000 */ +#define PCMCIA_CFR (0x000 + PCMCIA_BASE) /* PCMCIA Command FIFO Register */ +#define PCMCIA_IER (0x004 + PCMCIA_BASE) /* PCMCIA Interrupt enable register */ +#define PCMCIA_FCR (0x008 + PCMCIA_BASE) /* PCMCIA FIFO control register */ +#define PCMCIA_ISR (0x00C + PCMCIA_BASE) /* PCMCIA Interrupt Status register */ +#define PCTCR (0x010 + PCMCIA_BASE) /* PCMCIA Timing Control Register */ + +//PCMCIA CFG +#define RD_PCMCIA_ATTR 0x10000000 +#define WR_PCMCIA_ATTR 0x00000000 +#define RD_PCMCIA_IO 0x14000000 +#define WR_PCMCIA_IO 0x04000000 + +//PCMCIA IER +#define ERDAI 0x80000000 +#define ERFEI (1<<30) +#define ERFFI (1<<29) +#define ECFDI (1<<28) +#define ECFEI (1<<27) +#define ECFFI (1<<26) + +//PCMCIA FCR +#define EFIFO 0x80000000 +#define RFRST (1<<30) +#define TFRST (1<<29) +#define RTRG_MASK (0x3<<27) +#define RTRG_01 (0x0<<27) +#define RTRG_12 (0x1<<27) +#define RTRG_16 (0x2<<27) +#define RTRG_26 (0x3<<27) +#define RFRC_MASK (0x3f<<21) +#define CFRC_MASK (0x3f<<15) + +//PCMCIA LSR +#define DR 0x80000000 +#define RxEMPTY (1<<30) +#define RxqFULL (1<<29) +#define CMOK (1<<28) +#define CMEMPTY (1<<27) +#define CMFULL (1<<26) +#endif + + + +/* UART registers +*/ +#define UART0_BASE (SYSTEM_BASE+0x2000) /* 0xB8002000 */ +#define UART1_BASE (SYSTEM_BASE+0x2100) + + + + +/* System Control Registers */ + +/* Global interrupt control registers */ +#define GICR_BASE (SYSTEM_BASE+0x3000) /* 0xB8003000 */ +#define GIMR (0x000 + GICR_BASE) /* Global interrupt mask */ +#define GISR (0x004 + GICR_BASE) /* Global interrupt status */ +#define IRR (0x008 + GICR_BASE) /* Interrupt routing */ +#define IRR0 (0x008 + GICR_BASE) /* Interrupt routing */ +#define IRR1 (0x00C + GICR_BASE) /* Interrupt routing */ +#define IRR2 (0x010 + GICR_BASE) /* Interrupt routing */ +#define IRR3 (0x014 + GICR_BASE) /* Interrupt routing */ +/* Global interrupt mask register field definitions +*/ +#define TCIE (1 << 29) /* Timer/Counter interrupt enable */ +#define USBIE (1 << 30) /* USB interrupt enable */ +#define PCMCIAIE (1 << 29) /* PCMCIA interrupt enable */ +#define UART1IE (1 << 28) /* UART 1 interrupt enable */ +#define UART0IE (1 << 27) /* UART 0 interrupt enable */ +#define PCIIE (1 << 26) /* Parallel port interrupt enable */ +#define SWIE (1 << 25) /* Switch core interrupt enable */ +#define PABCIE (1 << 24) /* GPIO port ABC interrupt enable */ +#define IREQ0IE (1 << 23) /* External interrupt 0 enable */ +#define LBCTMOIE (1 << 21) /* LBC time-out interrupt enable */ +#ifdef CONFIG_RTL865XB +#define CRYPTOIE (1 << 20) /* Crypto engine interrupt enable */ +#define AUTHIE (1 << 19) /* Authentication engine interupt enable */ +#define PCMIE (1 << 18) /* PCM interface interrupt enable */ +#define PDEIE (1 << 17) /* GPIO port D,E,F,G,H,I interrupt enable */ +#define PCIBTMOIE (1 << 16) /* PCI bridge time-out interrupt enable */ +#endif /*CONFIG_RTL865XB*/ +/* Global interrupt status register field definitions +*/ +#define TCIP (1 << 31) /* Timer/Counter interrupt pending */ +#define USBIP (1 << 30) /* USB host interrupt pending */ +#define PCMCIAIP (1 << 29) /* PCMCIA interrupt pending */ +#define UART1IP (1 << 28) /* UART 1 interrupt pending */ +#define UART0IP (1 << 27) /* UART 0 interrupt pending */ +#define PCIIP (1 << 26) /* PCI host interrupt pending */ +#define SWIP (1 << 25) /* Switch core interrupt pending */ +#define PABCIP (1 << 24) /* GPIO port ABC interrupt pending */ +#define IREQIP (1 << 23) /* External interrupt 0 pending */ +#define LBCTMOIP (1 << 21) /* LBC time-out interrupt pending */ +#ifdef CONFIG_RTL865XB +#define CRYPTOIP (1 << 20) /* Crypto engine interrupt pending */ +#define AUTHIP (1 << 19) /* Authentication engine interupt pending */ +#define PCMIP (1 << 18) /* PCM interface interrupt pending */ +#define PDEIP (1 << 17) /* GPIO port D,E,F,G,H,I interrupt pending */ +#define PCIBTMOIP (1 << 16) /* PCI bridge time-out interrupt pending */ +#endif /*CONFIG_RTL865XB*/ +#define LX0_BFRAME_IP (1 << 1) /* LBC 0 bus frame time-out interrupt pending flag */ +/* Interrupt routing register field definitions +*/ +#define TCIRS_OFFSET 30 /* Timer/Counter interrupt routing select offset */ +#define USBIRS_OFFSET 28 /* USB interrupt routing select offset */ +#define PCMCIAIRS_OFFSET 26 /* PCI interrupt routing select offset */ +#define UART1IRS_OFFSET 24 /* UART 1 interrupt routing select offset */ +#define UART0IRS_OFFSET 22 /* UART 0 interrupt routing select offset */ +#define PCIIRS_OFFSET 20 /* USB 1 interrupt routing select offset */ +#define SWIRS_OFFSET 18 /* Switch core interrupt routing select offset */ +#define PABCIRS_OFFSET 16 /* GPIO port B interrupt routing select offset */ +#define IREQ0RS_OFFSET 14 /* External interrupt 0 routing select offset */ +#define LBCTMOIRS_OFFSET 10 /* LBC time-out interrupt routing select offset */ +#ifdef CONFIG_RTL865XB +#define TCIRS_MSB_OFFSET 9 /* Timer/Counter interrupt routing select MSB offset */ +#define USBIRS_MSB_OFFSET 8 /* USB interrupt routing select MSB offset */ +#define PCMCIAIRS_MSB_OFFSET 7 /* PCI interrupt routing select MSB offset */ +#define UART1IRS_MSB_OFFSET 6 /* UART 1 interrupt routing select MSB offset */ +#define UART0IRS_MSB_OFFSET 5 /* UART 0 interrupt routing select MSB offset */ +#define PCIIRS_MSB_OFFSET 4 /* USB 1 interrupt routing select MSB offset */ +#define SWIRS_MSB_OFFSET 3 /* Switch core interrupt routing select MSB offset */ +#define PABCIRS_MSB_OFFSET 2 /* GPIO port B interrupt routing select MSB offset */ +#define IREQ0RS_MSB_OFFSET 1 /* External interrupt 0 routing select MSB offset */ +#define LBCTMOIRS_MSB_OFFSET 0 /* LBC time-out interrupt routing select MSB offset */ +#define CRYPTIRS_OFFSET 29 /* Crypto engine interrupt routing select offset */ +#define AUTHIRS_OFFSET 26 /* Authentication engine interrupt routing select offset */ +#define PCMIRS_OFFSET 23 /* PCM interface interrupt routing select offset */ +#define PDEIRS_OFFSET 20 /* GPIO port D,E,F,G,H,I interrupt routing select MSB offset */ +#define PCIBTMOIRS_OFFSET 17 /* PCI bridge time-out interrupt routing select MSB offset */ +#endif /*CONFIG_RTL865XB*/ + + + + + +/* Timer control registers +*/ +#define TIMER_BASE (SYSTEM_BASE+0x3100) /* 0xB8003100 */ +#define TC0DATA (0x000 + TIMER_BASE) /* Timer/Counter 0 data */ +#define TC1DATA (0x004 + TIMER_BASE) /* Timer/Counter 1 data */ +#define TC0CNT (0x008 + TIMER_BASE) /* Timer/Counter 0 count */ +#define TC1CNT (0x00C + TIMER_BASE) /* Timer/Counter 1 count */ +#define TCCNR (0x010 + TIMER_BASE) /* Timer/Counter control */ +#define TCIR (0x014 + TIMER_BASE) /* Timer/Counter intertupt */ +#define CDBR (0x018 + TIMER_BASE) /* Clock division base */ +#define WDTCNR (0x01C + TIMER_BASE) /* Watchdog timer control */ +/* Timer/Counter data register field definitions +*/ +#define TCD_OFFSET 8 +/* Timer/Counter control register field defintions +*/ +#define TC0EN (1 << 31) /* Timer/Counter 0 enable */ +#define TC0MODE_COUNTER 0 /* Timer/Counter 0 counter mode */ +#define TC0MODE_TIMER (1 << 30) /* Timer/Counter 0 timer mode */ +#define TC1EN (1 << 29) /* Timer/Counter 1 enable */ +#define TC1MODE_COUNTER 0 /* Timer/Counter 1 counter mode */ +#define TC1MODE_TIMER (1 << 28) /* Timer/Counter 1 timer mode */ +/* Timer/Counter interrupt register field definitions +*/ +#define TC0IE ((uint32)1 << 31) /* Timer/Counter 0 interrupt enable */ +#define TC1IE (1 << 30) /* Timer/Counter 1 interrupt enable */ +#define TC0IP (1 << 29) /* Timer/Counter 0 interrupt pending */ +#define TC1IP (1 << 28) /* Timer/Counter 1 interrupt pending */ +/* Clock division base register field definitions +*/ +#define DIVF_OFFSET 16 +/* Watchdog control register field definitions +*/ +#define WDTE_OFFSET 24 /* Watchdog enable */ +#define WDSTOP_PATTERN 0xA5 /* Watchdog stop pattern */ +#define WDTCLR (1 << 23) /* Watchdog timer clear */ +#define OVSEL_15 0 /* Overflow select count 2^15 */ +#define OVSEL_16 (1 << 21) /* Overflow select count 2^16 */ +#define OVSEL_17 (2 << 21) /* Overflow select count 2^17 */ +#define OVSEL_18 (3 << 21) /* Overflow select count 2^18 */ +#define WDTIND (1 << 20) /* Indicate whether watchdog ever occurs */ +/* RTC control register field definitions */ +#define WRITE_CDLW_OK (1 << 31) /* Write CDLW OK */ +#define RTCSEL (1 << 30) /* Fase mode */ +#define RTCEN (1 << 29) /* Enable */ + +/* System clock generation */ +#define SCCR (SYSTEM_BASE+0x3200) /* 0xB8003200 System Clock Control Register */ +#define DPLCR0 (SCCR+0x04) /* DPLL Clock Control Register 0 */ +#define DPLCR1 (SCCR+0x08) /* DPLL Clock Control Register 1 */ +#define PCCR (SCCR+0x0C) /* Peripheral Clock Control Register */ + +#define SCCR_CPU_OFFSET 4 /* SCCR CPU(Lexra Bus 0) status offset */ +#define SCCR_STATUS_MASK 0x07 /* SCCR LexaBus0/LexaBus1/Memory mask */ + +#define EN_S0DPLL (1 << 31) /* Enable S0DPLL Tuning */ +#define EN_S1DPLL (1 << 30) /* Enable S1DPLL Tuning */ +#define EN_MDPLL (1 << 31) /* Enable MDPLL Tuning */ +#define S0UPDPLL_MASK 0x3F /* S0_UP_DPLL mask*/ +#define MUPDPLL_MASK 0x3F /* M_UP_DPLL mask*/ +#define S0DOWNDPLL_MASK 0x1F /* S0_DOWN_DPLL mask*/ +#define MDOWNDPLL_MASK 0x1F /* M_DOWN_DPLL mask*/ +#define S0UPDPLL_OFFSET 16 /* S0_UP_DPLL status offset*/ +#define MUPDPLL_OFFSET 5 /* M_UP_DPLL status offset*/ +#define S0DOWNDPLL_OFFSET 11 /* S0_DOWN_DPLL status offset*/ +#define MDOWNDPLL_OFFSET 0 /* M_DOWN_DPLL status offset*/ + +#define S0DOWNDPLL_VALUE (9 << S0DOWNDPLL_OFFSET) /* S0_DOWN_DPLL default test value*/ +#define S0UPDPLL_VALUE_225MHZ (17 << S0UPDPLL_OFFSET) /* S0_UP_DPLL test value 0*/ +#define S0UPDPLL_VALUE_250MHZ (19 << S0UPDPLL_OFFSET) /* S0_UP_DPLL test value 1*/ +#define S0UPDPLL_VALUE_275MHZ (21 << S0UPDPLL_OFFSET) /* S0_UP_DPLL test value 2*/ +#define S0UPDPLL_VALUE_300MHZ (23 << S0UPDPLL_OFFSET) /* S0_UP_DPLL test value 3*/ +#define S0UPDPLL_VALUE_325MHZ (25 << S0UPDPLL_OFFSET) /* S0_UP_DPLL test value 4*/ +#define S0UPDPLL_VALUE_350MHZ (27 << S0UPDPLL_OFFSET) /* S0_UP_DPLL test value 5*/ +#define S0UPDPLL_VALUE_375MHZ (29 << S0UPDPLL_OFFSET) /* S0_UP_DPLL test value 6*/ +#define S0UPDPLL_VALUE_400MHZ (31 << S0UPDPLL_OFFSET) /* S0_UP_DPLL test value 7*/ +#define S0UPDPLL_VALUE_NUM 8 /* S0_UP_DPLL total test values */ +#define S0UPDPLL_VALUE_DEFAULT S0UPDPLL_VALUE_275MHZ /* S0_UP_DPLL default test value */ + +#define MDOWNDPLL_VALUE (9 << MDOWNDPLL_OFFSET) /* M_DOWN_DPLL default test value*/ +#define MUPDPLL_VALUE_137MHZ (10 << MUPDPLL_OFFSET) /* M_UP_DPLL test value 0*/ +#define MUPDPLL_VALUE_150MHZ (11 << MUPDPLL_OFFSET) /* M_UP_DPLL test value 1*/ +#define MUPDPLL_VALUE_162MHZ (12 << MUPDPLL_OFFSET) /* M_UP_DPLL test value 2*/ +#define MUPDPLL_VALUE_175MHZ (13 << MUPDPLL_OFFSET) /* M_UP_DPLL test value 3*/ +#define MUPDPLL_VALUE_187MHZ (14 << MUPDPLL_OFFSET) /* M_UP_DPLL test value 4*/ +#define MUPDPLL_VALUE_NUM 5 /* M_UP_DPLL total test values */ +#define MUPDPLL_VALUE_DEFAULT MUPDPLL_VALUE_137MHZ /* M_UP_DPLL default test value */ + +#if defined(CONFIG_RTL_819X) +/*Shared Pin Register Set */ +#ifdef CONFIG_RTL_8196B + #define PIN_MUX_SEL (SYSTEM_BASE+0x30) /* 0xB8000030 - 0xB8000033 */ +#else + #define PIN_MUX_SEL 0xb8000040 +#endif + +/* Shared Pin Register field definitions */ +#define REG_IOCFG_POMII (3 << 0) /* P0-MII Shared Pin Control Bits */ +#define REG_IOCFG_PCIE (3 << 2) /* PCIE Shared Pin Control Bits */ +#define REG_IOCFG_UART (3 << 5) /* UART Shared Pin Control Bits */ +#define REG_IOCFG_JTAG (7 << 7) /* JTAG Shared Pin Control Bits */ +#define REG_IOCFG_LED_S0 (3 << 10) /* LEDSIG0 Shared Pin Control Bits */ +#define REG_IOCFG_LED_S1 (3 << 12) /* LEDSIG1 Shared Pin Control Bits */ +#define REG_IOCFG_LED_S2 (3 << 14) /* LEDSIG2 Shared Pin Control Bits */ +#define REG_IOCFG_LED_S3 (3 << 16) /* LEDSIG3 Shared Pin Control Bits */ +#define REG_IOCFG_LED_P0 (3 << 18) /* LEDPHASE0 Shared Pin Control Bits */ +#define REG_IOCFG_LED_P1 (3 << 20) /* LEDPHASE1 Shared Pin Control Bits */ +#define REG_IOCFG_LED_P2 (3 << 22) /* LEDPHASE2 Shared Pin Control Bits */ +#define REG_IOCFG_LED_P3 (3 << 24) /* LEDPHASE3 Shared Pin Control Bits */ +#define REG_IOCFG_LED_P4 (3 << 26) /* LEDPHASE4 Shared Pin Control Bits */ +#endif + +/* GPIO Register Set */ +#define GPIO_BASE (SYSTEM_BASE+0x3500) /* 0xB8003500 */ + +#define PABCD_CNR (GPIO_BASE + 0x00) +#define PABCD_PTYPE (GPIO_BASE + 0x04) +#define PABCD_DIR (GPIO_BASE + 0x08) +#define PABCD_DAT (GPIO_BASE + 0x0C) +#define PABCD_ISR (GPIO_BASE + 0x10) +#define PAB_IMR (GPIO_BASE + 0x14) +#define PCD_IMR (GPIO_BASE + 0x18) +#define PEFGH_CNR (GPIO_BASE + 0x1C) +#define PEFGH_PTYPE (GPIO_BASE + 0x20) +#define PEFGH_DIR (GPIO_BASE + 0x24) +#define PEFGH_DAT (GPIO_BASE + 0x28) +#define PEFGH_ISR (GPIO_BASE + 0x2C) +#define PEF_IMR (GPIO_BASE + 0x30) +#define PGH_IMR (GPIO_BASE + 0x34) + +#define PABCDCNR_REG (0x000 + GPIO_BASE) /* Port ABCD control */ +#define PABCDPTYPE_REG (0x004 + GPIO_BASE) /* Port ABCD type */ +#define PABCDDIR_REG (0x008 + GPIO_BASE) /* Port ABCD direction */ +#define PABCDDAT_REG (0x00C + GPIO_BASE) /* Port ABCD data */ +#define PABCDISR_REG (0x010 + GPIO_BASE) /* Port ABCD interrupt status */ +#define PABIMR_REG (0x014 + GPIO_BASE) /* Port AB interrupt mask */ +#define PCDIMR_REG (0x018 + GPIO_BASE) /* Port CD interrupt mask */ +#define PEFGHCNR_REG (0x01C + GPIO_BASE) /* Port ABCD control */ +#define PEFGHPTYPE_REG (0x020 + GPIO_BASE) /* Port ABCD type */ +#define PEFGHDIR_REG (0x024 + GPIO_BASE) /* Port ABCD direction */ +#define PEFGHDAT_REG (0x028 + GPIO_BASE) /* Port ABCD data */ +#define PEFGHISR_REG (0x02C + GPIO_BASE) /* Port ABCD interrupt status */ +#define PEFIMR_REG (0x030 + GPIO_BASE) /* Port AB interrupt mask */ +#define PGHIMR_REG (0x034 + GPIO_BASE) /* Port CD interrupt mask */ + +/*added by Mark*/ +/*PCI control regs*/ +#define PCI_CTRL_BASE (SYSTEM_BASE+0x3400) /* 0xB8003400 */ + +/* GPIO control registers +*/ +#define GPIO_BASE (SYSTEM_BASE+0x3500) /* 0xB8003500 */ +#define PABCNR (0x00C + GPIO_BASE) /* Port AB control */ +#define PABDIR (0x010 + GPIO_BASE) /* Port AB direction */ +#define PABDAT (0x014 + GPIO_BASE) /* Port AB data */ +#define PABISR (0x018 + GPIO_BASE) /* Port AB interrupt status */ +/* #define PABIMR (0x01C + GPIO_BASE) */ /* Port AB interrupt mask */ +/* #define PCIMR (0x050 + GPIO_BASE) */ /* Port C interrupt mask */ +/* Port ABC data register field definitions +*/ +#define PDA_OFFSET 24 /* Port A data offset */ +#define PDB_OFFSET 16 /* Port B data offset */ +#define PDC_OFFSET 8 /* Port C data offset */ +/* Port ABC interrupt status register field definitions +*/ +#define PAIP_OFFSET 24 /* Port A pending status offset */ +#define PBIP_OFFSET 16 /* Port B pending status offset */ +#define PCIP_OFFSET 8 /* Port C pending status offset */ + + + +/* Peripheral Lexra timing control registers +*/ +#define PLTC (0x064 + GICR_BASE) /* Peripheral Lexra timeout control */ +/* Peripheral Lexra timeout control register field definitions +*/ +#define TOEN (1 << 31) +#define TOLIMIT_2_7 (0 << 28) +#define TOLIMIT_2_8 (1 << 28) +#define TOLIMIT_2_9 (2 << 28) +#define TOLIMIT_2_10 (3 << 28) +#define TOLIMIT_2_11 (4 << 28) +#define TOLIMIT_2_12 (5 << 28) +#define TOLIMIT_2_13 (6 << 28) +#define TOLIMIT_2_14 (7 << 28) + +/* Memory Control Register registers +*/ +#define MCR_BASE (SYSTEM_BASE+0x1000) /* 0xB8001000 */ +#define MCR (0x000 + MCR_BASE) /* Memory configuration register */ +#define MTCR0 (0x004 + MCR_BASE) /* Memory timing configuration register */ +#define MTCR1 (0x008 + MCR_BASE) /* Memory timing configuration register */ +#define PFCR (0x010 + MCR_BASE) /* Pre-Fetch Control Register */ +#define MPMR (0x040 + MCR_BASE) + +#if defined(CONFIG_RTL_819X) +#define SDRDRAM_MASK (0x1<<31) +#define DCR (0x004 + MCR_BASE) /* DRAM control register */ +#define COLCNT_MASK (0x1c00000) +#define COLCNT_OFFSET 22 +#define ROWCNT_MASK (0x6000000) +#define ROWCNT_OFFSET 25 +#endif + +// MPMR 0xB8001040 Memory Power Management Register +#define PM_MODE_OFFSET 30 +#define PM_MODE_NORMAL (0 << PM_MODE_OFFSET) +#define PM_MODE_ENABLE_AUTOMATIC_POWER_DOWN (1 << PM_MODE_OFFSET) +#define PM_MODE_ENABLE_SELF_REFRESH (2 << PM_MODE_OFFSET) + +#define CRYPTO_BASE (SYSTEM_BASE+0xC000) /* 0xB801C000 */ +#define IPSSDAR (CRYPTO_BASE+0x00) /* IPSec Source Descriptor Starting Address Register */ +#define IPSDDAR (CRYPTO_BASE+0x04) /* IPSec Destination Descriptor Starting Address Register */ +#define IPSCSR (CRYPTO_BASE+0x08) /* IPSec Command/Status Register */ +#define IPSCTR (CRYPTO_BASE+0x0C) /* IPSec Control Register */ + +/* IPSec Command/Status Register */ +#define IPS_SDUEIP (1<<15) /* Source Descriptor Unavailable Error Interrupt Pending */ +#define IPS_SDLEIP (1<<14) /* Source Descriptor Length Error Interrupt Pending */ +#define IPS_DDUEIP (1<<13) /* Destination Descriptor Unavailable Error Interrupt Pending */ +#define IPS_DDOKIP (1<<12) /* Destination Descriptor OK Interrupt Pending */ +#define IPS_DABFIP (1<<11) /* Data Address Buffer Interrupt Pending */ +#define IPS_POLL (1<<1) /* Descriptor Polling. Set 1 to kick crypto engine to fetch source descriptor. */ +#define IPS_SRST (1<<0) /* Software reset, write 1 to reset */ + +/* IPSec Control Register */ +#define IPS_SDUEIE (1<<15) /* Source Descriptor Unavailable Error Interrupt Enable */ +#define IPS_SDLEIE (1<<14) /* Source Descriptor Length Error Interrupt Enable */ +#define IPS_DDUEIE (1<<13) /* Destination Descriptor Unavailable Error Interrupt Enable */ +#define IPS_DDOKIE (1<<12) /* Destination Descriptor OK Interrupt Enable */ +#define IPS_DABFIE (1<<11) /* Data Address Buffer Interrupt Enable */ +#define IPS_LBKM (1<<8) /* Loopback mode enable */ +#define IPS_SAWB (1<<7) /* Source Address Write Back */ +#define IPS_CKE (1<<6) /* Clock enable */ +#define IPS_DMBS_MASK (0x7<<3) /* Mask for Destination DMA Maximum Burst Size */ +#define IPS_DMBS_16 (0x0<<3) /* 16 Bytes */ +#define IPS_DMBS_32 (0x1<<3) /* 32 Bytes */ +#define IPS_DMBS_64 (0x2<<3) /* 64 Bytes */ +#define IPS_DMBS_128 (0x3<<3) /* 128 Bytes */ +#define IPS_SMBS_MASK (0x7<<0) /* Mask for SourceDMA Maximum Burst Size */ +#define IPS_SMBS_16 (0x0<<0) /* 16 Bytes */ +#define IPS_SMBS_32 (0x1<<0) /* 32 Bytes */ +#define IPS_SMBS_64 (0x2<<0) /* 64 Bytes */ +#define IPS_SMBS_128 (0x3<<0) /* 128 Bytes */ + + +/* PCM */ +#define PCM_BASE (SYSTEM_BASE+0x8000) /* 0xB8008000 */ +#define PCM_GCR (PCM_BASE+0x00) /* PCM Generic Control Register */ +#define PCM_SCR (PCM_BASE+0x04) /* PCM Specific Control Register */ +#define PCM_TSAR (PCM_BASE+0x08) /* PCM Time Slot Assignment Register */ +#define PCM_BSIZE (PCM_BASE+0x0C) /* PCM Buffer Size Register */ +#define PCM_CH0TXBSA (PCM_BASE+0x10) /* PCM Channel 0 Tx Buffer Starting Address */ +#define PCM_CH1TXBSA (PCM_BASE+0x14) /* PCM Channel 1 Tx Buffer Starting Address */ +#define PCM_CH2TXBSA (PCM_BASE+0x18) /* PCM Channel 2 Tx Buffer Starting Address */ +#define PCM_CH3TXBSA (PCM_BASE+0x1C) /* PCM Channel 3 Tx Buffer Starting Address */ +#define PCM_CH0RXBSA (PCM_BASE+0x20) /* PCM Channel 0 Rx Buffer Starting Address */ +#define PCM_CH1RXBSA (PCM_BASE+0x24) /* PCM Channel 1 Rx Buffer Starting Address */ +#define PCM_CH2RXBSA (PCM_BASE+0x28) /* PCM Channel 2 Rx Buffer Starting Address */ +#define PCM_CH3RXBSA (PCM_BASE+0x2C) /* PCM Channel 3 Rx Buffer Starting Address */ +#define PCM_IMR (PCM_BASE+0x30) /* PCM Interrupt Mask Register */ +#define PCM_ISR (PCM_BASE+0x34) /* PCM Interrupt Status Register */ + +#define PAGE1_PCM_OWN ( 1 << 1 ) +#define PAGE0_PCM_OWN ( 1 << 0 ) +#define PCM_PAGE0 0 +#define PCM_PAGE1 1 +#define PCM_CHANNEL0 0 +#define PCM_CHANNEL1 1 +#define PCM_CHANNEL2 2 +#define PCM_CHANNEL3 3 +#define PCM_LINEAR 0 +#define PCM_ALAW 1 +#define PCM_ULAW 2 + +/* PCM Generic Control Register +*/ +#define PCM_AE (1<<12) /* Interrupt Enable */ +#define PCM_CLKDIR (1<<11) /* 0:external source from codec, 1:internal PLL */ +#define PCM_EXDSE (1<<10) /* PCM interface A Extra Data Strobe Enable */ +#define PCM_FSINV (1<< 9) /* PCM interface frame synchronization polarity invert */ +#define PCM_ICC_OFFSET (0) /* PCM interface Channel Inter Change control */ +#define PCM_ICC_MASK (0xf<<PCM_ICC_OFFSET)/* PCM interface Channel Inter Change control */ + +/* PCM Specific Control Register +*/ +#define PCM_allCHILBE (1<<28) /* all channel internal loop back enable */ + +#define PCM_CH0CMPE (1<<27) /* Channel 0 compander enable */ +#define PCM_CH0uA (1<<26) /* Channel 0 u-law/A-law selection; 0:u-law, 1:A-law */ +#define PCM_CH0TE (1<<25) /* Channel 0 transmitter enable */ +#define PCM_CH0RE (1<<24) /* Channel 0 receiver enable */ + +#define PCM_CH1CMPE (1<<19) /* Channel 1 compander enable */ +#define PCM_CH1uA (1<<18) /* Channel 1 u-law/A-law selection; 0:u-law, 1:A-law */ +#define PCM_CH1TE (1<<17) /* Channel 1 transmitter enable */ +#define PCM_CH1RE (1<<16) /* Channel 1 receiver enable */ + +#define PCM_CH2CMPE (1<< 11) /* Channel 2 compander enable */ +#define PCM_CH2uA (1<< 10) /* Channel 2 u-law/A-law selection; 0:u-law, 1:A-law */ +#define PCM_CH2TE (1<< 9) /* Channel 2 transmitter enable */ +#define PCM_CH2RE (1<< 8) /* Channel 2 receiver enable */ + +#define PCM_CH3CMPE (1<< 3) /* Channel 3 compander enable */ +#define PCM_CH3uA (1<< 2) /* Channel 3 u-law/A-law selection; 0:u-law, 1:A-law */ +#define PCM_CH3TE (1<< 1) /* Channel 3 transmitter enable */ +#define PCM_CH3RE (1<< 0) /* Channel 3 receiver enable */ + +/* PCM Time Slot Assignment Register +*/ +#define PCM_CH0TSA_OFFSET (24) /* Channel 0 Time Slot Assignment */ +#define PCM_CH0TSA_MASK (0x1f<<PCM_CH0TSA_OFFSET) /* Channel 0 Time Slot Assignment */ +#define PCM_CH1TSA_OFFSET (16) /* Channel 1 Time Slot Assignment */ +#define PCM_CH1TSA_MASK (0x1f<<PCM_CH1TSA_OFFSET) /* Channel 1 Time Slot Assignment */ +#define PCM_CH2TSA_OFFSET ( 8) /* Channel 2 Time Slot Assignment */ +#define PCM_CH2TSA_MASK (0x1f<<PCM_CH2TSA_OFFSET) /* Channel 2 Time Slot Assignment */ +#define PCM_CH3TSA_OFFSET ( 0) /* Channel 3 Time Slot Assignment */ +#define PCM_CH3TSA_MASK (0x1f<<PCM_CH3TSA_OFFSET) /* Channel 3 Time Slot Assignment */ + +/* PCM Buffer Size Register +*/ +#define PCM_CH0BSIZE_OFFSET (24) /* Channel 0 Buffer Size 4(n+1) bytes */ +#define PCM_CH0BSIZE_MASK (0xff<<PCM_CH0BSIZE_OFFSET) /* Channel 0 Buffer Size 4(n+1) bytes */ +#define PCM_CH1BSIZE_OFFSET (16) /* Channel 1 Buffer Size 4(n+1) bytes */ +#define PCM_CH1BSIZE_MASK (0xff<<PCM_CH1BSIZE_OFFSET) /* Channel 1 Buffer Size 4(n+1) bytes */ +#define PCM_CH2BSIZE_OFFSET ( 8) /* Channel 2 Buffer Size 4(n+1) bytes */ +#define PCM_CH2BSIZE_MASK (0xff<<PCM_CH2BSIZE_OFFSET) /* Channel 2 Buffer Size 4(n+1) bytes */ +#define PCM_CH3BSIZE_OFFSET ( 0) /* Channel 3 Buffer Size 4(n+1) bytes */ +#define PCM_CH3BSIZE_MASK (0xff<<PCM_CH3BSIZE_OFFSET) /* Channel 3 Buffer Size 4(n+1) bytes */ + +/* PCM Channel 0 Tx Buffer Starting Address */ +/* PCM Channel 1 Tx Buffer Starting Address */ +/* PCM Channel 2 Tx Buffer Starting Address */ +/* PCM Channel 3 Tx Buffer Starting Address */ +/* PCM Channel 0 Rx Buffer Starting Address */ +/* PCM Channel 1 Rx Buffer Starting Address */ +/* PCM Channel 2 Rx Buffer Starting Address */ +/* PCM Channel 3 Rx Buffer Starting Address */ +#define PCM_TXBUFPTR_MASK (0xfffffffc) /* Physical Tx buffer starting address */ +#define PCM_P1OWN (0x00000002) /* Page 1 own bit; 1:PCM own, 0:CPU own */ +#define PCM_P0OWN (0x00000001) /* Page 0 own bit; 1:PCM own, 0:CPU own */ + +/* PCM Interrupt Mask Register +*/ +#define PCM_CH0P0OKIE (1<<15) /* Channel 0 page 0 OK Interrupt Enable */ +#define PCM_CH0P1OKIE (1<<14) /* Channel 0 page 1 OK Interrupt Enable */ +#define PCM_CH0TBUAIE (1<<13) /* Channel 0 Transmit Buffer Unavailable Interrupt Enable */ +#define PCM_CH0RBUAIE (1<<12) /* Channel 0 Receive Buffer Unavailable Interrupt Enable */ +#define PCM_CH1P0OKIE (1<<11) /* Channel 1 page 0 OK Interrupt Enable */ +#define PCM_CH1P1OKIE (1<<10) /* Channel 1 page 1 OK Interrupt Enable */ +#define PCM_CH1TBUAIE (1<< 9) /* Channel 1 Transmit Buffer Unavailable Interrupt Enable */ +#define PCM_CH1RBUAIE (1<< 8) /* Channel 1 Receive Buffer Unavailable Interrupt Enable */ +#define PCM_CH2P0OKIE (1<< 7) /* Channel 2 page 0 OK Interrupt Enable */ +#define PCM_CH2P1OKIE (1<< 6) /* Channel 2 page 1 OK Interrupt Enable */ +#define PCM_CH2TBUAIE (1<< 5) /* Channel 2 Transmit Buffer Unavailable Interrupt Enable */ +#define PCM_CH2RBUAIE (1<< 4) /* Channel 2 Receive Buffer Unavailable Interrupt Enable */ +#define PCM_CH3P0OKIE (1<< 3) /* Channel 3 page 0 OK Interrupt Enable */ +#define PCM_CH3P1OKIE (1<< 2) /* Channel 3 page 1 OK Interrupt Enable */ +#define PCM_CH3TBUAIE (1<< 1) /* Channel 3 Transmit Buffer Unavailable Interrupt Enable */ +#define PCM_CH3RBUAIE (1<< 0) /* Channel 3 Receive Buffer Unavailable Interrupt Enable */ + +/* PCM Interrupt Status Register +*/ +#define PCM_CH0TXP0IP (1<<31) /* Channel 0 Tx Page 0 Interrupt Pending */ +#define PCM_CH0TXP1IP (1<<30) /* Channel 0 Tx Page 1 Interrupt Pending */ +#define PCM_CH0RXP0IP (1<<29) /* Channel 0 Rx Page 0 Interrupt Pending */ +#define PCM_CH0RXP1IP (1<<28) /* Channel 0 Rx Page 1 Interrupt Pending */ +#define PCM_CH0TXP0UA (1<<27) /* Channel 0 Tx Page 0 Unavailable Interrupt Pending */ +#define PCM_CH0TXP1UA (1<<26) /* Channel 0 Tx Page 1 Unavailable Interrupt Pending */ +#define PCM_CH0RXP0UA (1<<25) /* Channel 0 Rx Page 0 Unavailable Interrupt Pending */ +#define PCM_CH0RXP1UA (1<<24) /* Channel 0 Rx Page 1 Unavailable Interrupt Pending */ +#define PCM_CH1TXP0IP (1<<23) /* Channel 1 Tx Page 0 Interrupt Pending */ +#define PCM_CH1TXP1IP (1<<22) /* Channel 1 Tx Page 1 Interrupt Pending */ +#define PCM_CH1RXP0IP (1<<21) /* Channel 1 Rx Page 0 Interrupt Pending */ +#define PCM_CH1RXP1IP (1<<20) /* Channel 1 Rx Page 1 Interrupt Pending */ +#define PCM_CH1TXP0UA (1<<19) /* Channel 1 Tx Page 0 Unavailable Interrupt Pending */ +#define PCM_CH1TXP1UA (1<<18) /* Channel 1 Tx Page 1 Unavailable Interrupt Pending */ +#define PCM_CH1RXP0UA (1<<17) /* Channel 1 Rx Page 0 Unavailable Interrupt Pending */ +#define PCM_CH1RXP1UA (1<<16) /* Channel 1 Rx Page 1 Unavailable Interrupt Pending */ +#define PCM_CH2TXP0IP (1<<15) /* Channel 2 Tx Page 0 Interrupt Pending */ +#define PCM_CH2TXP1IP (1<<14) /* Channel 2 Tx Page 1 Interrupt Pending */ +#define PCM_CH2RXP0IP (1<<13) /* Channel 2 Rx Page 0 Interrupt Pending */ +#define PCM_CH2RXP1IP (1<<12) /* Channel 2 Rx Page 1 Interrupt Pending */ +#define PCM_CH2TXP0UA (1<<11) /* Channel 2 Tx Page 0 Unavailable Interrupt Pending */ +#define PCM_CH2TXP1UA (1<<10) /* Channel 2 Tx Page 1 Unavailable Interrupt Pending */ +#define PCM_CH2RXP0UA (1<< 9) /* Channel 2 Rx Page 0 Unavailable Interrupt Pending */ +#define PCM_CH2RXP1UA (1<< 8) /* Channel 2 Rx Page 1 Unavailable Interrupt Pending */ +#define PCM_CH3TXP0IP (1<< 7) /* Channel 3 Tx Page 0 Interrupt Pending */ +#define PCM_CH3TXP1IP (1<< 6) /* Channel 3 Tx Page 1 Interrupt Pending */ +#define PCM_CH3RXP0IP (1<< 5) /* Channel 3 Rx Page 0 Interrupt Pending */ +#define PCM_CH3RXP1IP (1<< 4) /* Channel 3 Rx Page 1 Interrupt Pending */ +#define PCM_CH3TXP0UA (1<< 3) /* Channel 3 Tx Page 0 Unavailable Interrupt Pending */ +#define PCM_CH3TXP1UA (1<< 2) /* Channel 3 Tx Page 1 Unavailable Interrupt Pending */ +#define PCM_CH3RXP0UA (1<< 1) /* Channel 3 Rx Page 0 Unavailable Interrupt Pending */ +#define PCM_CH3RXP1UA (1<< 0) /* Channel 3 Rx Page 1 Unavailable Interrupt Pending */ + + +/* Generic DMA */ +#define GDMA_BASE (SYSTEM_BASE+0xA000) /* 0xB800A000 */ +#define GDMACNR (GDMA_BASE+0x00) /* Generic DMA Control Register */ +#define GDMAIMR (GDMA_BASE+0x04) /* Generic DMA Interrupt Mask Register */ +#define GDMAISR (GDMA_BASE+0x08) /* Generic DMA Interrupt Status Register */ +#define GDMAICVL (GDMA_BASE+0x0C) /* Generic DMA Initial Checksum Value (Left Part) Register */ +#define GDMAICVR (GDMA_BASE+0x10) /* Generic DMA Initial Checksum Value (Right Part) Register */ +#define GDMASBP0 (GDMA_BASE+0x20) /* Generic DMA Source Block Pointer 0 Register */ +#define GDMASBL0 (GDMA_BASE+0x24) /* Generic DMA Source Block Length 0 Register */ +#define GDMASBP1 (GDMA_BASE+0x28) /* Generic DMA Source Block Pointer 1 Register */ +#define GDMASBL1 (GDMA_BASE+0x2C) /* Generic DMA Source Block Length 1 Register */ +#define GDMASBP2 (GDMA_BASE+0x30) /* Generic DMA Source Block Pointer 2 Register */ +#define GDMASBL2 (GDMA_BASE+0x34) /* Generic DMA Source Block Length 2 Register */ +#define GDMASBP3 (GDMA_BASE+0x38) /* Generic DMA Source Block Pointer 3 Register */ +#define GDMASBL3 (GDMA_BASE+0x3C) /* Generic DMA Source Block Length 3 Register */ +#define GDMASBP4 (GDMA_BASE+0x40) /* Generic DMA Source Block Pointer 4 Register */ +#define GDMASBL4 (GDMA_BASE+0x44) /* Generic DMA Source Block Length 4 Register */ +#define GDMASBP5 (GDMA_BASE+0x48) /* Generic DMA Source Block Pointer 5 Register */ +#define GDMASBL5 (GDMA_BASE+0x4C) /* Generic DMA Source Block Length 5 Register */ +#define GDMASBP6 (GDMA_BASE+0x50) /* Generic DMA Source Block Pointer 6 Register */ +#define GDMASBL6 (GDMA_BASE+0x54) /* Generic DMA Source Block Length 6 Register */ +#define GDMASBP7 (GDMA_BASE+0x58) /* Generic DMA Source Block Pointer 7 Register */ +#define GDMASBL7 (GDMA_BASE+0x5C) /* Generic DMA Source Block Length 7 Register */ +#define GDMADBP0 (GDMA_BASE+0x60) /* Generic DMA Destination Block Pointer 0 Register */ +#define GDMADBL0 (GDMA_BASE+0x64) /* Generic DMA Destination Block Length 0 Register */ +#define GDMADBP1 (GDMA_BASE+0x68) /* Generic DMA Destination Block Pointer 1 Register */ +#define GDMADBL1 (GDMA_BASE+0x6C) /* Generic DMA Destination Block Length 1 Register */ +#define GDMADBP2 (GDMA_BASE+0x70) /* Generic DMA Destination Block Pointer 2 Register */ +#define GDMADBL2 (GDMA_BASE+0x74) /* Generic DMA Destination Block Length 2 Register */ +#define GDMADBP3 (GDMA_BASE+0x78) /* Generic DMA Destination Block Pointer 3 Register */ +#define GDMADBL3 (GDMA_BASE+0x7C) /* Generic DMA Destination Block Length 3 Register */ +#define GDMADBP4 (GDMA_BASE+0x80) /* Generic DMA Destination Block Pointer 4 Register */ +#define GDMADBL4 (GDMA_BASE+0x84) /* Generic DMA Destination Block Length 4 Register */ +#define GDMADBP5 (GDMA_BASE+0x88) /* Generic DMA Destination Block Pointer 5 Register */ +#define GDMADBL5 (GDMA_BASE+0x8C) /* Generic DMA Destination Block Length 5 Register */ +#define GDMADBP6 (GDMA_BASE+0x90) /* Generic DMA Destination Block Pointer 6 Register */ +#define GDMADBL6 (GDMA_BASE+0x94) /* Generic DMA Destination Block Length 6 Register */ +#define GDMADBP7 (GDMA_BASE+0x98) /* Generic DMA Destination Block Pointer 7 Register */ +#define GDMADBL7 (GDMA_BASE+0x9C) /* Generic DMA Destination Block Length 7 Register */ + +/* Generic DMA Control Register */ +#define GDMA_ENABLE (1<<31) /* Enable GDMA */ +#define GDMA_POLL (1<<30) /* Kick off GDMA */ +#define GDMA_FUNCMASK (0xf<<24) /* GDMA Function Mask */ +#define GDMA_MEMCPY (0x0<<24) /* Memory Copy */ +#define GDMA_CHKOFF (0x1<<24) /* Checksum Offload */ +#define GDMA_STCAM (0x2<<24) /* Sequential T-CAM */ +#define GDMA_MEMSET (0x3<<24) /* Memory Set */ +#define GDMA_B64ENC (0x4<<24) /* Base 64 Encode */ +#define GDMA_B64DEC (0x5<<24) /* Base 64 Decode */ +#define GDMA_QPENC (0x6<<24) /* Quoted Printable Encode */ +#define GDMA_QPDEC (0x7<<24) /* Quoted Printable Decode */ +#define GDMA_MIC (0x8<<24) /* Wireless MIC */ +#define GDMA_MEMXOR (0x9<<24) /* Memory XOR */ +#define GDMA_MEMCMP (0xa<<24) /* Memory Compare */ +#define GDMA_BYTESWAP (0xb<<24) /* Byte Swap */ +#define GDMA_PATTERN (0xc<<24) /* Pattern Match */ +#define GDMA_SWAPTYPE0 (0<<22) /* Original:{0,1,2,3} => {1,0,3,2} */ +#define GDMA_SWAPTYPE1 (1<<22) /* Original:{0,1,2,3} => {3,2,1,0} */ +#define GDMA_ENTSIZMASK (3<<20) /* T-CAM Entry Size Mask */ +#define GDMA_ENTSIZ32 (0<<20) /* T-CAM Entry Size 32 bits */ +#define GDMA_ENTSIZ64 (1<<20) /* T-CAM Entry Size 64 bits */ +#define GDMA_ENTSIZ128 (2<<20) /* T-CAM Entry Size 128 bits */ +#define GDMA_ENTSIZ256 (3<<20) /* T-CAM Entry Size 256 bits */ + +/* Generic DMA Interrupt Mask Register */ +#define GDMA_COMPIE (1<<31) /* Completed Interrupt Enable */ +#if 0 /* phase out */ +#define GDMA_SBUDRIE (1<<30) /* Source Block Under-run Interrupt Enable */ +#define GDMA_DBUDRIE (1<<29) /* destination Block Under-run Interrupt Enable */ +#endif +#define GDMA_NEEDCPUIE (1<<28) /* Need-CPU Interrupt Enable */ + +/* Generic DMA Interrupt Status Register */ +#define GDMA_COMPIP (1<<31) /* Completed Interrupt Status (write 1 to clear) */ +#if 0 /* phase out */ +#define GDMA_SBUDRIP (1<<30) /* Source Block Under-run Interrupt Status (write 1 to clear) */ +#define GDMA_DBUDRIP (1<<29) /* destination Block Under-run Interrupt Status (write 1 to clear) */ +#endif +#define GDMA_NEEDCPUIP (1<<28) /* Need-CPU Interrupt Status (write 1 to clear) */ + +/* Generic DMA Source Block Length n. Register */ +#define GDMA_LDB (1<<31) /* Last Data Block */ +#define GDMA_BLKLENMASK (0x1fff) /* Block Length (valid value: from 1 to 8K-1 bytes) */ + +#if defined(CONFIG_RTL8186_KB) +void rtl865x_startBooting_ledControl(void); +void rtl865x_wireCompSolidBlue(void); +void rtl865x_wireCompBlinkAmber(void); +#endif + +//hyking:define for 8196C FIB test chip +#if defined(CONFIG_RTL_8196C) +#define RTL8196C_EEE_MAC +#endif + +#define GIGA_P5_PHYID 0x16 +#define BSP_REVR 0xB8000000 +#define BSP_RTL8198_REVISION_A 0xC0000000 +#define BSP_RTL8198_REVISION_B 0xC0000001 +#define SYS_CLK_MAG 0xb8000010 +#define SYS_SW_RESET 0x800 +#endif /* _ASICREGS_H */ + diff --git a/target/linux/realtek/files/include/asm-mips/rtl865x/rtl_glue.h b/target/linux/realtek/files/include/asm-mips/rtl865x/rtl_glue.h new file mode 100644 index 000000000..97bab5a27 --- /dev/null +++ b/target/linux/realtek/files/include/asm-mips/rtl865x/rtl_glue.h @@ -0,0 +1,639 @@ +/* +* -------------------------------------------------------------------- +* Copyright c Realtek Semiconductor Corporation, 2002 +* All rights reserved. +* +* Program : rtl_glue.h +* Abstract :Header of porting layer +* Author : Edward Jin-Ru Chen +* +* $Id: rtl_glue.h,v 1.1 2007-12-07 05:52:23 alva_zhang Exp $ +* $Log: not supported by cvs2svn $ +* Revision 1.1.1.1 2007/08/06 10:04:57 root +* Initial import source to CVS +* +* Revision 1.34 2007/06/07 05:35:30 chenyl +* +: add new function "rtlglue_clearDCache" to clear D-cache without +* writing back to external memory. ( Only for Processor with this function ) +* +* Revision 1.33 2007/06/01 09:20:52 michaelhuang +* -: removed the rtl867x compiler flag. +* +* Revision 1.32 2007/04/09 14:14:01 michaelhuang +* +: added rtlglue_read() function +* +* Revision 1.31 2007/03/02 13:31:59 chenyl +* *: enable range based D-cache flush function. +* +* Revision 1.30 2007/01/09 02:36:08 michaelhuang +* *: Prepare implement test module for RTL8672 +* +* Revision 1.29 2006/12/21 06:57:00 yjlou +* -: remove the following usages: +* printk +* printfByPolling +* +* Revision 1.28 2006/11/28 02:15:14 hyking_liu +* *: Mofify function related with usrDefineTunnel +* +* Revision 1.27 2006/11/21 12:28:35 chenyl +* *: rearrange some code +* *: bug fix - Src VLAN decision +* *: bug fix - D-cache invalidation for FAST extension device forwarding +* *: bug fix - m_unused1 and ph_reserved are needed for FAST extension device forwarding +* +* Revision 1.26 2006/10/26 02:15:32 qy_wang +* *:remove the inculed file net_device.h in rtl8651_layer2fwd.c +* +* Revision 1.25 2006/10/25 07:10:15 qy_wang +* +:add a function to block extension device when link up +* +* Revision 1.24 2006/08/31 15:44:48 chenyl +* *: add some declarations of external APIs +* +* Revision 1.23 2006/07/13 15:55:49 chenyl +* *: modify code for RTL865XC driver compilation. +* *: dos2unix process +* +* Revision 1.22 2006/06/20 05:53:22 brian_bin +* +: brian_bin move open, write, close declaration into __RTL_GLUE__ define brace +* +* Revision 1.21 2006/01/12 08:32:37 brian_bin +* +: brian_bin add kernel system call of file operations +* +* Revision 1.20 2006/01/02 02:52:14 chenyl +* +: VLAN-tag support extension port forwarding and software Rome Driver forwarding. +* +* Revision 1.19 2005/09/16 11:34:48 tony +* *: bug fixed: support kernel space swNic model code for RTL865XC. +* +* Revision 1.18 2005/09/06 02:36:38 yjlou +* +: add random and time glue functions. +* +* Revision 1.17 2005/07/20 15:29:38 yjlou +* +: porting Model Code to Linux Kernel: check RTL865X_MODEL_KERNEL. +* +* Revision 1.16 2005/07/01 09:34:41 yjlou +* *: porting swNic2.c into model code. +* +* Revision 1.15 2005/06/19 05:41:19 yjlou +* *: merge ASIC driver into model code. +* +* Revision 1.14 2005/06/07 15:00:57 chenyl +* *: modify mutex Lock / Unlock code to check the balance of Lock/Unlock function call +* +* Revision 1.13 2004/11/29 07:35:44 chenyl +* *: fix bug : multiple-PPPoE MTU setting bug +* *: fix bug : Never add second session's ip into ASIC in multiple-PPPoE WAN type. +* *: fix bug : Tunekey abnormal behavior when multiple-PPPoE Dial-on-demand Dynamically turn ON/OFF +* *: in forwarding engine Init function, the parameter == 0xffffffff means user want to set as default value +* *: add Mutex-Lock/Unlock checking in testing code +* +* Revision 1.12 2004/11/05 09:54:08 yjlou +* +: support more precise timeUpdate() function. +* +: add EVENT_TRIGGER_TIMEUPDATE==2 +* *: modify #ifdef EVENT_TRIGGER_TIMEUPDATE +* +* Revision 1.11 2004/07/27 10:47:08 cfliu +* -: Remove RTL865x external loopback port related code for PPTP/L2TP/WLAN +* +* Revision 1.10 2004/06/23 08:11:55 yjlou +* *: change the declaration of rtlglue_getmstime() +* +* Revision 1.9 2004/05/03 14:56:18 cfliu +* Add 8650B extension port support. +* Revise all WLAN/extport related code. +* +* Revision 1.8 2004/05/03 02:53:03 chenyl +* *: swNic_getRingSize -> rtlglue_getRingSize and move it from swNic2.c to rtl_glue.c +* *: set default upstream ip to 0 if we config interface to dhcp +* +* Revision 1.7 2004/04/30 08:58:08 chenyl +* +: ip multicast/igmp proxy +* +* Revision 1.6 2004/04/08 12:11:20 cfliu +* Change extension port API.....define rtlglue_extDeviceSend() +* +* Revision 1.5 2004/03/31 09:37:01 cfliu +* Add WDS support +* +* Revision 1.4 2004/03/19 13:13:35 cfliu +* Reorganize ROME driver local header files. Put all private data structures into different .h file corrsponding to its layering +* Rename printf, printk, malloc, free with rtlglue_XXX prefix +* +* Revision 1.1 2004/03/10 11:42:36 cfliu +* Move rtl_glue.* from rtl865x/ +* +* Revision 1.2 2004/03/03 10:40:38 yjlou +* *: commit for mergence the difference in rtl86xx_tbl/ since 2004/02/26. +* +* Revision 1.1 2004/02/25 14:26:33 chhuang +* *** empty log message *** +* +* Revision 1.2 2004/02/25 14:24:52 chhuang +* *** empty log message *** +* +* Revision 1.7 2004/02/24 04:15:43 cfliu +* add API for WLAN acceleration +* +* Revision 1.6 2004/02/18 13:54:37 chhuang +* *** empty log message *** +* +* Revision 1.5 2003/12/26 09:27:50 orlando +* add rtl_glue.h +* +* Revision 1.3 2003/09/30 06:07:50 orlando +* check in RTL8651BLDRV_V20_20030930 +* +* Revision 1.4 2003/06/10 05:33:30 cfliu +* Remove rtl8651_tblDrvFwdSend registration. +* Add rtlglue_drvSend to replace rtl8651_tblDrvFwdSend function pointer +* +* Revision 1.3 2003/06/09 04:48:43 cfliu +* add 3 OS dependent glue functions to support mbuf external cluster allocation. +* Rewrite all help messages using Autoduck's syntax so documentation could generated automatically. +* +* Revision 1.2 2003/05/23 07:47:06 cfliu +* Extract porting function and fix compile warning. +* +* Revision 1.1 2003/05/23 04:55:25 jzchen +* Add rtl glue to solve porting issue +* +*/ + + +#include "rtl_types.h" +#if defined(CONFIG_RTL865X) +//#include "mbuf.h" +#endif + +#ifndef _RTL_GLUE_ +#define _RTL_GLUE_ + +/* @doc RTLGLUE_API + + @module rtl_glue.h - Glue interface for Realtek 8651 Home gateway controller driver | + This guide documents the glue interface for porting 8651 driver to targeted operating system + @normal Chun-Feng Liu (cfliu@realtek.com.tw) <date> + + Copyright <cp>2003 Realtek<tm> Semiconductor Cooperation, All Rights Reserved. + + @head3 List of Symbols | + Here is the list of all functions and variables in this module. + + @index | RTLGLUE_API +*/ + + +extern int32 rtlglue_init(void); +/* +@func int32 | rtlglue_init | Initialize all OS dependent mutex, semaphore objects, etc. here +@rvalue SUCCESS | if initialization succeed +@rvalue FAILED | if initialization failed. This aborts system initialization. +@comm +All required OS supporting capabilities such as mutex, semaphore, and timer service are initialized here. + */ + +extern int32 rtlglue_registerTimerMs(uint32 *eventId,uint32 *eventSerialNumber, + int32 (* callback_func)(uint32 eventSerialNumber,void *), void *callback_func_arg, uint32 msec); +/* +@func int32 | rtlglue_registerTimerMs | OS dependent timer registration function. +@parm uint32 * | eventId | placeholder for saving registered timer event id. +@parm uint32 * | eventSerialNumber | placeholder for saving the unique serial number returned with event id. +@parm int32 (*)(uint32,void *) | callback_func | the registering callback function for execution +@parm void * | callback_func_arg | arguments for callback_func +@parm uint32 | msec | timeout in units of milli-seconds. + +@rvalue SUCCESS | if timer event registration failed. +@rvalue FAILED | if timer event successfully registered. +@comm +a) If the timer service provided by the ported OS is a kernel service(which guarantees atomic operation), +then return value of <p eventSerialNumber> MUST always be zero. + +b) If the timer service is provided by a "soft" timer, ie. a timer thread/task, then the return value of <p eventSerialNumber> must +NOT be zero and MUST be unique every time this glue function is called. This returned value would then be saved by caller and +checked by the callback function upon called-back to prevent race condition between running thread and timer thread. + */ + + +extern int32 rtlglue_cancelTimer(uint32 eventId,uint32 eventSerialNumber); +/* +@func int32 | rtlglue_cancelTimer |OS dependent timer deregistration function. +@parm uint32 | eventId | The identifier of timer event to be cancelled. +@parm uint32 | eventSerialNumber | The serial number of timer event identifier <p eventId>. + +@rvalue SUCCESS | Timer event successfully cancelled. If the OS timer is a kernel service, the registered callback function would NOT be called. If the OS timer is provided via timer thread, the registered callback function may still/may not be called. +@rvalue FAILED | Failed to cancel timer event <p eventId> + */ + +#ifndef RTL865X_TEST +extern int32 rtlglue_mbufMutexLock(void); +#endif +/* +@func int32 | rtlglue_mbufMutexLock | The mutex lock function for mbuf module to protect internal data structure. + +@rvalue 0 | succeed +@rvalue Non-0 | failed + */ + + +#ifndef RTL865X_TEST +extern int32 rtlglue_mbufMutexUnlock(void); +#endif +/* +@func int32 | rtlglue_mbufMutexLock | The mutex unlock function for mbuf module to protect internal data structure. + +@rvalue 0 | succeed +@rvalue Non-0 | failed + */ + + +extern int32 rtlglue_mbufTsleep(uint32 wait_channel); +/* +@func int32 | rtlglue_mbufTsleep | Used by mbuf module, to let calling thread blocking when requested resource not readily available. +@parm uint32 | wait_channel | Identifier of requesting resource. May be an memory address, resource handle, etc. +@rvalue 0 | succeed +@rvalue Non-0 | failed +@comm +Ref FreeBSD's tsleep() or Steven's TCP/IP Vol2 pp456 + */ + + +extern int32 rtlglue_mbufTwakeup(uint32 wait_channel); +/* +@func int32 | rtlglue_mbufTwakeup | Used by mbuf module, to wakeup blocked waiting thread when requesed resource is available +@parm uint32 | wait_channel | Identifier of waiting channel to be waked up. +@rvalue 0 | succeed +@rvalue Non-0 | failed +@comm +Ref FreeBSD's tsleep() or Steven's TCP/IP Vol2 pp456 + */ + +extern int32 rtlglue_mbufAllocCluster(void **buffer, uint32 size, uint32 *id); +/* +@func int32 | rtlglue_mbufAllocCluster | Used by mbuf module, to allocate a cluster externally from OS +@parm void ** | buffer | For output, address of allocated cluster. +@parm uint32 | size | number of bytes requested. +@parm uint32 * | id | For output, identifier of allocated cluster, up to OS memory allocator's interpretation. +@rvalue 0 | succeed +@rvalue Non-0 | failed +@comm +each allocation must set returned buffer's reference count to 1. +But if you are sure you WON'T call any of mbuf's spliting(<p mBuf_split>), cloning(<p mBuf_clonePacket>, +<p mBuf_cloneMbufChain>) or trimming(<p mBuf_trimHead>, <p mBuf_trimTail>) APIs in your code, never mind about reference counts. + */ + +extern int32 rtlglue_mbufFreeCluster(void *buffer, uint32 size, uint32 id); +/* +@func int32 | rtlglue_mbufFreeCluster | Used by mbuf module, to free allocated cluster +@parm void * | buffer | buffer address to free +@parm uint32 | size | identifier of buffer to free +@parm uint32 | id | size of buffer to free +@rvalue 0 | succeed +@rvalue Non-0 | failed +@comm +each buffer returned must has its reference count decremented to exactly 0. mbuf module would query buffer's reference count and make sure it's 1 before calling this function. +But if you are sure you WON'T call any of mbuf's spliting(<p mBuf_split>), cloning(<p mBuf_clonePacket>, +<p mBuf_cloneMbufChain>) or trimming(<p mBuf_trimHead>, <p mBuf_trimTail>) APIs in your code, never mind about reference counts. + */ + +extern int32 rtlglue_mbufClusterRefcnt(void *buffer, uint32 id, uint32 *count, int8 operation); +/* +@func int32 | rtlglue_mbufClusterRefcnt | Used by mbuf module, to free allocated cluster +@parm void * | buffer | buffer address to free +@parm uint32 | id | identifier of designated buffer +@parm uint32 * | count | For output. Placeholder for returned reference number *AFTER* <p operation> done. +@parm int8 | operation | 0: Query, 1: Increment, 2: Decrement +@rvalue 0 | succeed +@rvalue Non-0 | failed +@comm +1) For parameter <p count>: <p count> is the reference count of designated cluster *AFTER* 'operation' done. MUST not be NULL for Query operation, MAY be NULL for Increment o Decrement operation. + +2) When clusters are allocated externally by OS, <p mBuf_data2Mbuf()>, <p mBuf_clusterIsWritable()> +become void. Also, since mbuf module no longer knows which mbuf is the first referee (which owns the write priviledge to +cluster). Design decision here simply grants write priviledge to ALL cluster referees. + +3) Porting Note: If you are sure you WON'T call any of mbuf's spliting(<p mBuf_split>), cloning(<p mBuf_clonePacket>, +<p mBuf_cloneMbufChain>), or trimming(<p mBuf_trimHead>, <p mBuf_trimTail>) APIs, you can always return +1 when operation=0(Query), and do nothing when operation=1(Increment) or 2(Decrement). +*/ + +extern void * rtlglue_mbufClusterToData(void *buffer); +/* +@parm void * | buffer | find mbuf cluster's m_data's position +@rvalue 0 | failed +@rvalue Non-0 | succeed +@comm +return mbuf cluster's m_data's position +*/ +#ifndef RTL865X_TEST +extern int32 rtlglue_drvMutexLock(void); +#endif +/* +@func int32 | rtlglue_drvMutexLock | Used by driver, to safeguard driver internal data structure. + +@rvalue 0 | succeed +@rvalue Non-0 | failed + */ + +#ifndef RTL865X_TEST +extern int32 rtlglue_drvMutexUnlock(void); +#endif +/* +@func int32 | rtlglue_drvMutexLock | Used by driver, to safeguard driver internal data structure. + +@rvalue 0 | succeed +@rvalue Non-0 | failed + */ + + +extern void rtlglue_getMacAddress(ether_addr_t * macAddress, uint32 * number); +/* +@func void | rtlglue_getMacAddress | Used during board initialization, to read the total number of configured MAC addresses and their values in flash. +@parm ether_addr_t * | macAddress | For output. The base MAC address configured for this board. +@parm uint32 * | number | For output. Total (consecutive) number of MAC addresses starting from <p *macAddress>. + +@rvalue 0 | succeed +@rvalue Non-0 | failed +@comm +Read from the flash to get the base MAC address and total number of MAC addresses configured to the board. +If anything goes wrong, a default MAC address would be written back to the flash. + */ + +#if defined(CONFIG_RTL865X) +extern void rtlglue_drvSend(void * pkthdr);//void * assumed to be packet header +/* +@func void | rtlglue_drvSend | The OS dependent raw driver send function for high level driver to send pkt. +@parm void * | pkthdr | The pkthdr address of outgoing mbuf chain +@rdesc None +@comm +Implement this function to provide table driver and upper layer protocols such as PPPoE module to send packet to driver. +The sending packet must have already in mbuf chain format. + */ +#endif /* defined(CONFIG_RTL865X) */ + +#if defined(CONFIG_RTL865X) +/* +@func int32 | rtlglue_extPortMbufFastRecv | Fast Path for packet from Extension device to HW. +@parm struct rtl_pktHdr* | pkt | packet from extension device. +@parm uint16 | myvid | RX VID of this packet. +@parm uint32 | myportmask | RX Port mask of this packet. +@rvalue SUCCESS | Always return SUCCESS. +@comm + +Glue Interface for <p rtl8651_fwdEngineExtPortUcastFastRecv> + +Fast path for extension device to HW Accelerated forwarding. +Note that this function would NOT do + 1. SMAC learning. + 2. Extension Device Bridge. + +Therefore, if extension device would like to use Fast path, it would do these by itself. +*/ +int32 rtlglue_extPortMbufFastRecv( struct rtl_pktHdr *pkt, + uint16 myvid, + uint32 myportmask); +#endif /* defined(CONFIG_RTL865X) */ + +/* +@func int32 | rtlglue_regWlanSta | Register (LinkID<->Port Number) binding into Rome Driver +@parm uint32 | portNumber | Extension Port Number to bind. +@parm uint16 | defaultVID | Default VID of this extension device. +@parm uint32* | linkID_p | pointer to the LinkID of current extension device. +@parm void* | extDevice | extension device's own pointer ( can NOT be NULL ). +@rvalue FAILED | No free LinkID or extDevice == NULL. +@rvalue SUCCESS | Registration OK. +@comm + +Glue Interface for <p rtl8651_fwdEngineRegExtDevice> + +Register Extension Device into Rome Driver: + Extension device would need to provide it's binding <p portNumber> and <p extDevice>. + Rome Driver would fill the <p linkID> if registration success. + <p defaultVID> indicates the default VLAN ID of this extension device. It is used in TX vlan filtering + now. + + - Note: We don't support per-LinkID's untag set setting yet. +*/ + +int32 rtlglue_regWlanSta( uint32 portNumber, + uint16 defaultVID, + uint32 *linkID_p, + void *extDevice); + +/* +@func int32 | rtlglue_unregWlanSta | Un-Register (LinkID<->Port Number) binding. +@parm uint32 | linkID | pointer to the LinkID of current extension device. +@rvalue FAILED | LinkID is not found. +@rvalue SUCCESS | UnRegistration OK. +@comm + +Glue Interface for <p rtl8651_fwdEngineUnregExtDevice> + +UnRegister exist LinkID from Rome Driver. + Extension device would need to provide it's <p linkID> which gotten from registration function. + Rome Driver would remove the related information for this <p linkID>. + */ + +int32 rtlglue_unregWlanSta(uint32 linkID); + +#if defined(CONFIG_RTL865X) +void rtlglue_extDeviceSend(struct rtl_pktHdr *pktHdr, void *txExtDev); +// This function is called back by RTL8651 driver when it wants to send a pkt to WLAN interface. +//First input parameter represents the destination vlan ID, second parameter is the destination link ID +//which was given and learnt from rtl8651_fwdEngineExtPortRecv() during L2 SA learning process. +// It's WLAN driver's job to find out to which card or WDS link the pkt should be sent by maintaining a +//small database keeping linkId<-> device mapping. +// The 'linkId' was assigned by WLAN driver and is not interpreted by 8651 driver. However, linkId=0 +//has special usage reserved for "Broadcast to all vlan member ports" therefore linkId=0 can't be associated +//to any WLAN card or WDS link. +// ***This function is called by 8651 driver and MUST be implemented. +#endif /* defined(CONFIG_RTL865X) */ + +//#endif +#if defined(CONFIG_RTL865X) +int32 rtlglue_reclaimRxBD(uint32 rxDescIdx,struct rtl_pktHdr *pThisPkthdr, struct rtl_mBuf *pThisMbuf); +#endif /* defined(CONFIG_RTL865X) */ +#ifdef CONFIG_RTL865XC +void rtlglue_getRingSize(uint32 *rx, uint32 *tx,int whichDesc); +#else +void rtlglue_getRingSize(uint32 *rx, uint32 *tx); +#endif +uint32 rtlglue_getsectime(void) ; +uint32 rtlglue_getmstime( uint32* ); +void *rtlglue_malloc(uint32); +void rtlglue_free(void *APTR); + +#ifdef __KERNEL__ + #define rtlglue_printf printk +#else + #define rtlglue_printf printf +#endif + +uint32 rtl865x_getHZ(void); + +#if defined(RTL865X_TEST) || defined(RTL865X_MODEL_USER) +#include <stdio.h> +#include <stdlib.h> +#include <ctype.h> +#include <string.h> + + +int32 rtlglue_getDrvMutex(void); +int32 rtlglue_reinitDrvMutex(void); +int32 rtlglue_getMbufMutex(void); +int32 rtlglue_reinitMbufMutex(void); + +extern int test_drvMutex; +extern int test_mbufMutex; + +#define rtlglue_drvMutexLock() \ + do { \ + test_drvMutex ++;\ + } while (0) +#define rtlglue_drvMutexUnlock()\ + do {\ + test_drvMutex --;\ + if (test_drvMutex < 0)\ + {\ + printf("%s (%d) Error: Driver Mutex Lock/Unlcok is not balance (%d).\n", __FUNCTION__, __LINE__, test_drvMutex);\ + }\ + } while (0) + +#define rtlglue_mbufMutexLock() \ + do { \ + test_mbufMutex ++;\ + } while (0) +#define rtlglue_mbufMutexUnlock()\ + do {\ + test_mbufMutex --;\ + if (test_mbufMutex < 0)\ + {\ + printf("%s (%d) Error: Mbuffer Mutex Lock/Unlcok is not balance (%d).\n", __FUNCTION__, __LINE__, test_mbufMutex);\ + }\ + } while (0) + +#define wmb() do {} while(0) + +#define spin_lock(x) do {x=x;} while(0) +#define spin_unlock(x) do {x=x;} while(0) + +#ifdef RTL865X_TEST +int32 spin_lock_irqsave(spinlock_t *spinlock, int32 s); +int32 spin_unlock_irqrestore(spinlock_t *spinlock, int32 s); +#else +#define spin_lock_irqsave(sp,s) do { sp=sp; s=s; } while(0) +#define spin_unlock_irqrestore(sp,s) do { sp=sp; s=s; } while(0) +#endif/*RTL865X_TEST*/ + +#endif /* RTL865X_TEST || RTL865X_MODEL_USER */ + +#define bzero( p, s ) memset( p, 0, s ) + + +/* +@func void | rtlglue_srandom | The OS dependent seed function for random. +@parm uint32 | seed | seed +@comm + */ +void rtlglue_srandom( uint32 seed ); + +/* +@func uint32 | rtlglue_random | The OS dependent random function. +@parm void | | +@comm + */ +uint32 rtlglue_random( void ); + +/* +@func uint32 | rtlglue_time | The OS dependent time function. +@parm uint32* | t | address to store time +@comm + */ +uint32 rtlglue_time( uint32* t ); + +/* +@func int | rtlglue_open | The OS dependent open function. +@parm const char* | path | filename or path +@parm int | flags | file attribute +@parm int | mode | file mode +@comm + */ +int rtlglue_open(const char *path, int flags, int mode ); + +/* +@func int | rtlglue_read | The OS dependent read function. +@parm int | fd | file descriptor +@parm void* | buf | read buffer +@parm int | nbytes | number of bytes to read in buffer +@comm + */ +int rtlglue_read(int fd, void* buf, int nbytes); + +/* +@func int | rtlglue_write | The OS dependent write function. +@parm int | fd | file descriptor +@parm void* | buf | write buffer +@parm int | nbytes | number of bytes to write in buffer +@comm + */ +int rtlglue_write(int fd, void* buf, int nbytes); + +/* +@func int | rtlglue_close | The OS dependent close function. +@parm int | fd | file descriptor +@comm + */ +int rtlglue_close(int fd); + +#if defined(CONFIG_RTL865X) +struct sk_buff *re865x_mbuf2skb(struct rtl_pktHdr* pPkt); +#endif /* defined(CONFIG_RTL865X) */ + +/* +@func void | rtl8651_extDevMakeBlocking | make extension device port STP blocking . +@parm void* | extDev | extension device +@comm + */ +int32 rtlglue_extDevMakeBlocking(void * extDev); + +/* +@func void | rtlglue_getExtDeviceName | Get device NAME of "device" +@parm void* | device | pointer of device to get name. +@parm void* | name | pointer of name to be filled by this API. +@comm + */ +int32 rtlglue_getExtDeviceName(void * device, char* name); + +/* +@func void | rtlglue_pktToProtocolStackPreprocess | Process before packet is trapped to protocol stack. +@comm + */ +inline int32 rtlglue_pktToProtocolStackPreprocess(void); + +/* +@func int32 | rtlglue_flushDCache | Flush D-cache with write-back (if processor support it). +@parm uint32 | start | start address to flush +@parm uint32 | size | total size to flush +@comm +Flush D-cache from <p start> with size being <p size>. +Set <p start> = 0 and <p size> = 0 if we need to flush ALL D-cache entries. +Note that this procedure will flush D-cache entries with writing-back dirty data. +If processor doesn't support such kind of process ( ex. Processor only support Write-through ) +This function will only clear D-cache without any warning or error. + */ +inline int32 rtlglue_flushDCache(uint32 start, uint32 size); + +/* +@func int32 | rtlglue_clearDCache | Flush D-cache WITHOUT write-back. +@parm uint32 | start | start address to flush +@parm uint32 | size | total size to flush +@comm +Flush D-cache from <p start> with size being <p size>. +Set <p start> = 0 and <p size> = 0 if we need to flush ALL D-cache entries. +Note that this procedure will flush D-cache entries WITHOUT writing-back dirty data. + */ +inline int32 rtlglue_clearDCache(uint32 start, uint32 size); + +#endif/*#ifndef _RTL_GLUE_*/ + diff --git a/target/linux/realtek/files/include/asm-mips/rtl865x/rtl_types.h b/target/linux/realtek/files/include/asm-mips/rtl865x/rtl_types.h new file mode 100644 index 000000000..f94206f70 --- /dev/null +++ b/target/linux/realtek/files/include/asm-mips/rtl865x/rtl_types.h @@ -0,0 +1,481 @@ +/* +* Copyright c Realtek Semiconductor Corporation, 2002 +* All rights reserved. +* +* Program : The header file of realtek type definition +* Abstract : +* Author : +* $Id: rtl_types.h,v 1.1 2007-12-07 05:52:23 alva_zhang Exp $ +* $Log: not supported by cvs2svn $ +* Revision 1.1.1.1 2007/08/06 10:04:57 root +* Initial import source to CVS +* +* Revision 1.21 2007/05/15 03:36:56 michaelhuang +* *: fixed compatibility for Linux Kernel 2.6 +* +* Revision 1.20 2007/04/04 15:48:54 chenyl +* +: cleshell commend for asic register configuration : mmtu ( multicast mtu ) +* +* Revision 1.19 2006/08/29 13:00:00 chenyl +* *: New SWNIC driver for RTL865xC +* *: some rearrange in re_core.c for Bootstrap sequence being more readable. +* +* Revision 1.18 2006/02/27 07:47:06 ympan +* +: No change by ympan +* +* Revision 1.17 2005/09/27 05:59:44 chenyl +* *: modify IRAM / DRAM layout: +* IRAM/DRAM-FWD : external used, swNic ... blahblah +* IRAM/DRAM-L2-FWD : fwdengine internal used, L2 and below (ex. preprocess, postprocess) +* IRAM/DRAM-L34-FWD : fwdengine internal used, L3/L4 process only (ex. Routing, decision table...etc). +* +* => If L34 is used, we strongly suggest L2 must be used, too. +* +* Revision 1.16 2005/08/23 14:38:26 chenyl +* +: apply prioirty IRAM/DRAM usage +* +* Revision 1.15 2005/08/22 07:33:55 chenyl +* *: don't set DRAM/IRAM for other OSs yet. +* +* Revision 1.14 2005/08/18 09:14:08 chenyl +* *: add code to porting to other OSs +* +* Revision 1.13 2005/08/18 06:29:29 chenyl +* +: always define the rtlglue_printf in rtl_types.h +* +* Revision 1.12 2005/07/01 09:34:41 yjlou +* *: porting swNic2.c into model code. +* +* Revision 1.11 2005/06/19 05:29:37 yjlou +* *: use 'unsigned int' to replace 'size_t' +* *: define spinlock_t when RTL865X_MODEL_USER defined. +* +* Revision 1.10 2005/06/10 05:32:22 yjlou +* +: Porting CLE Shell to Linux user space for model test. +* See RTL865X_MODEL_USER compile flags. +* +* Revision 1.9 2005/01/10 03:21:43 yjlou +* *: always define __IRAM and __DRAM +* +* Revision 1.8 2004/07/23 13:42:45 tony +* *: remove all warning messages +* +* Revision 1.7 2004/07/05 08:25:32 chenyl +* +: define __IRAM, __DRAM for module test +* +* Revision 1.6 2004/07/04 15:04:55 cfliu +* +: add IRAM and DRAM +* +* Revision 1.5 2004/04/20 03:44:03 tony +* if disable define "RTL865X_OVER_KERNEL" and "RTL865X_OVER_LINUX", __KERNEL__ and __linux__ will be undefined. +* +* Revision 1.4 2004/03/19 13:13:35 cfliu +* Reorganize ROME driver local header files. Put all private data structures into different .h file corrsponding to its layering +* Rename printf, printk, malloc, free with rtlglue_XXX prefix +* +* Revision 1.3 2004/03/05 07:44:27 cfliu +* fix header file problem for ctype.h +* +* Revision 1.2 2004/03/03 10:40:38 yjlou +* *: commit for mergence the difference in rtl86xx_tbl/ since 2004/02/26. +* +* Revision 1.1 2004/02/25 14:26:33 chhuang +* *** empty log message *** +* +* Revision 1.3 2004/02/25 14:24:52 chhuang +* *** empty log message *** +* +* Revision 1.8 2003/12/10 06:30:12 tony +* add linux/config.h, disable define CONFIG_RTL865X_NICDRV2 in mbuf.c by default +* +* Revision 1.7 2003/12/03 14:25:43 cfliu +* change SIZE_T to _SIZE_T. Linux kernel seems to recognize _SIZE_T +* +* Revision 1.6 2003/10/01 12:29:02 tony +* #define DEBUG_P(args...) while(0); +* +* Revision 1.5 2003/10/01 10:31:47 tony +* solve all the compiler warnning messages in the board.c +* +* Revision 1.4 2003/09/30 06:07:50 orlando +* check in RTL8651BLDRV_V20_20030930 +* +* Revision 1.30 2003/07/21 06:27:49 cfliu +* no message +* +* Revision 1.29 2003/04/30 15:32:30 cfliu +* move macros to types.h +* +* Revision 1.28 2003/03/13 10:29:22 cfliu +* Remove unused symbols +* +* Revision 1.27 2003/03/06 05:00:04 cfliu +* Move '#pragma ghs inlineprologue' to rtl_depend.h since it is compiler dependent +* +* Revision 1.26 2003/03/06 03:41:46 danwu +* Prevent compiler from generating internal sub-routine call code at the +* function prologue and epilogue automatically +* +* Revision 1.25 2003/03/03 09:16:35 hiwu +* remove ip4a +* +* Revision 1.24 2003/02/18 10:04:06 jzchen +* Add ether_addr_t to compatable with protocol stack's ether_addr +* +* Revision 1.23 2003/01/21 05:59:51 cfliu +* add min, max, SETBITS, CLEARBITS, etc. +* +* Revision 1.22 2002/11/25 07:31:30 cfliu +* Remove _POSIX_SOURCE since it is cygwin specific +* +* Revision 1.21 2002/09/30 11:51:49 jzchen +* Add ASSERT_ISR for not print inside ISR +* +* Revision 1.20 2002/09/18 01:43:24 jzchen +* Add type limit definition +* +* Revision 1.19 2002/09/16 00:14:34 elvis +* remove struct posix_handle_t (change the handle type from +* structure to uint32) +* +* Revision 1.18 2002/08/20 01:40:40 danwu +* Add definitions of ipaddr_t & macaddr_t. +* +* Revision 1.17 2002/07/30 04:36:30 danwu +* Add ASSERT_CSP. +* +* Revision 1.16 2002/07/19 06:47:30 cfliu +* Add _POSIX_SOURCE symbol +* +* Revision 1.15 2002/07/05 02:10:39 elvis +* Add new types for OSK +* +* Revision 1.14 2002/07/03 12:36:21 orlando +* <rtl_depend.h> will use type definitions. Has to be moved to +* be after the type declaration lines. +* +* Revision 1.13 2002/07/03 09:19:00 cfliu +* Removed all standard header files from source code. They would be included by <core/types.h>-><rtl_depend.h> +* +* Revision 1.12 2002/07/03 09:16:48 cfliu +* Removed all standard header files from source code. They would be included by <core/types.h>-><rtl_depend.h> +* +* Revision 1.11 2002/07/03 07:14:47 orlando +* Add "struct posix_handle_t_", used by POSIX module. +* +* Revision 1.9 2002/06/21 03:15:36 cfliu +* Add time.h for struct timeval +* +* Revision 1.8 2002/06/14 01:58:03 cfliu +* Move sa_family_t to socket +* +* Revision 1.7 2002/06/13 09:37:42 cfliu +* Move byte order conversion routines to socket +* +* Revision 1.6 2002/05/23 04:24:37 hiwu +* change memaddr_t to calladdr_t +* +* Revision 1.5 2002/05/13 10:15:16 hiwu +* add new type definition +* +* Revision 1.4 2002/05/09 05:21:51 cfliu +* Add parenthesis around swaps16, swapl32 +* +* Revision 1.3 2002/04/30 03:07:34 orlando +* Remove UIxx_T definitions to conform with new +* naming conventions. +* +* Revision 1.2 2002/04/29 10:10:32 hiwu +* add NTOHS macro +* +* Revision 1.1.1.1 2002/04/26 08:53:53 orlando +* Initial source tree creation. +* +* Revision 1.9 2002/04/25 03:59:05 cfliu +* no message +* +* Revision 1.8 2002/04/08 08:08:04 hiwu +* initial version +* +*/ + + +#ifndef _RTL_TYPES_H +#define _RTL_TYPES_H + +#ifndef RTL865X_OVER_KERNEL + #undef __KERNEL__ +#endif + +#ifndef RTL865X_OVER_LINUX + #undef __linux__ +#endif + +/* + * Internal names for basic integral types. Omit the typedef if + * not possible for a machine/compiler combination. + */ +#ifdef __linux__ +#ifdef __KERNEL__ +#include <linux/version.h> +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)) +#include <linux/config.h> +#endif +#include <linux/ctype.h> +#include <linux/module.h> +#include <linux/string.h> +#endif /*__KERNEL__*/ +#endif /*__linux__*/ + +/* =============================================================================== + IRAM / DRAM definition + =============================================================================== */ +#undef __DRAM_GEN +#undef __DRAM_FWD +#undef __DRAM_L2_FWD +#undef __DRAM_L34_FWD +#undef __DRAM_EXTDEV +#undef __DRAM_AIRGO +#undef __DRAM_RTKWLAN +#undef __DRAM_CRYPTO +#undef __DRAM_VOIP +#undef __DRAM_TX +#undef __DRAM + +#undef __IRAM_GEN +#undef __IRAM_FWD +#undef __IRAM_L2_FWD +#undef __IRAM_L34_FWD +#undef __IRAM_EXTDEV +#undef __IRAM_AIRGO +#undef __IRAM_RTKWLAN +#undef __IRAM_CRYPTO +#undef __IRAM_VOIP +#undef __IRAM_TX +#undef __IRAM + +#if defined(__linux__)&&defined(__KERNEL__)&&defined(CONFIG_RTL865X) + #define __DRAM_GEN __attribute__ ((section(".dram-gen"))) + #define __DRAM_FWD __attribute__ ((section(".dram-fwd"))) + #define __DRAM_L2_FWD __attribute__ ((section(".dram-l2-fwd"))) + #define __DRAM_L34_FWD __attribute__ ((section(".dram-l34-fwd"))) + #define __DRAM_EXTDEV __attribute__ ((section(".dram-extdev"))) + #define __DRAM_AIRGO __attribute__ ((section(".dram-airgo"))) + #define __DRAM_RTKWLAN __attribute__ ((section(".dram-rtkwlan"))) + #define __DRAM_CRYPTO __attribute__ ((section(".dram-crypto"))) + #define __DRAM_VOIP __attribute__ ((section(".dram-voip"))) + #define __DRAM_TX __attribute__ ((section(".dram-tx"))) + #define __DRAM __attribute__ ((section(".dram"))) + + #define __IRAM_GEN __attribute__ ((section(".iram-gen"))) + #define __IRAM_FWD __attribute__ ((section(".iram-fwd"))) + #define __IRAM_L2_FWD __attribute__ ((section(".iram-l2-fwd"))) + #define __IRAM_L34_FWD __attribute__ ((section(".iram-l34-fwd"))) + #define __IRAM_EXTDEV __attribute__ ((section(".iram-extdev"))) + #define __IRAM_AIRGO __attribute__ ((section(".iram-airgo"))) + #define __IRAM_RTKWLAN __attribute__ ((section(".iram-rtkwlan"))) + #define __IRAM_CRYPTO __attribute__ ((section(".iram-crypto"))) + #define __IRAM_VOIP __attribute__ ((section(".iram-voip"))) + #define __IRAM_TX __attribute__ ((section(".iram-tx"))) + #define __IRAM __attribute__ ((section(".iram"))) +#else + #define __DRAM_GEN + #define __DRAM_FWD + #define __DRAM_L2_FWD + #define __DRAM_L34_FWD + #define __DRAM_EXTDEV + #define __DRAM_AIRGO + #define __DRAM_RTKWLAN + #define __DRAM_CRYPTO + #define __DRAM_VOIP + #define __DRAM_TX + #define __DRAM + + #define __IRAM_GEN + #define __IRAM_FWD + #define __IRAM_L2_FWD + #define __IRAM_L34_FWD + #define __IRAM_EXTDEV + #define __IRAM_AIRGO + #define __IRAM_RTKWLAN + #define __IRAM_CRYPTO + #define __IRAM_VOIP + #define __IRAM_TX + #define __IRAM +#endif + +/* =============================================================================== + print macro + =============================================================================== */ +#if defined(__linux__)&&defined(__KERNEL__) + + #define rtlglue_printf printk + +#else /* defined(__linux__)&&defined(__KERNEL__) */ + +#ifdef RTL865X_TEST + #include <ctype.h> +#endif /* RTL865X_TEST */ + +#define rtlglue_printf printf + +#endif /* defined(__linux__)&&defined(__KERNEL__) */ + +/* =============================================================================== + Type definition + =============================================================================== */ + +typedef unsigned long long uint64; +typedef long long int64; +typedef unsigned int uint32; +typedef int int32; +typedef unsigned short uint16; +typedef short int16; +typedef unsigned char uint8; +typedef char int8; + + +typedef uint32 memaddr; +typedef uint32 ipaddr_t; +typedef struct { + uint16 mac47_32; + uint16 mac31_16; + uint16 mac15_0; +} macaddr_t; + +#define ETHER_ADDR_LEN 6 +typedef struct ether_addr_s { + uint8 octet[ETHER_ADDR_LEN]; +} ether_addr_t; + + + +#ifndef NULL +#define NULL 0 +#endif +#ifndef TRUE +#define TRUE 1 +#endif +#ifndef FALSE +#define FALSE 0 +#endif + +#ifndef SUCCESS +#define SUCCESS 0 +#endif +#ifndef FAILED +#define FAILED -1 +#endif + + + +#define DEBUG_P(args...) while(0); +#ifndef OK +#define OK 0 +#endif +#ifndef NOT_OK +#define NOT_OK 1 +#endif + +#ifndef CLEARBITS +#define CLEARBITS(a,b) ((a) &= ~(b)) +#endif + +#ifndef SETBITS +#define SETBITS(a,b) ((a) |= (b)) +#endif + +#ifndef ISSET +#define ISSET(a,b) (((a) & (b))!=0) +#endif + +#ifndef ISCLEARED +#define ISCLEARED(a,b) (((a) & (b))==0) +#endif + +#ifndef max +#define max(a,b) (((a) > (b)) ? (a) : (b)) +#endif /* max */ + +#ifndef min +#define min(a,b) (((a) < (b)) ? (a) : (b)) +#endif /* min */ + +//round down x to multiple of y. Ex: ROUNDDOWN(20, 7)=14 +#ifndef ROUNDDOWN +#define ROUNDDOWN(x, y) (((x)/(y))*(y)) +#endif + +//round up x to multiple of y. Ex: ROUNDUP(11, 7) = 14 +#ifndef ROUNDUP +#define ROUNDUP(x, y) ((((x)+((y)-1))/(y))*(y)) /* to any y */ +#endif + +#ifndef ROUNDUP2 +#define ROUNDUP2(x, y) (((x)+((y)-1))&(~((y)-1))) /* if y is powers of two */ +#endif + +#ifndef ROUNDUP4 +#define ROUNDUP4(x) ((1+(((x)-1)>>2))<<2) +#endif + +#ifndef IS4BYTEALIGNED +#define IS4BYTEALIGNED(x) ((((x) & 0x3)==0)? 1 : 0) +#endif + +#ifndef __offsetof +#define __offsetof(type, field) ((unsigned long)(&((type *)0)->field)) +#endif + +#ifndef offsetof +#define offsetof(type, field) __offsetof(type, field) +#endif + +#ifndef RTL_PROC_CHECK +#define RTL_PROC_CHECK(expr, success) \ + do {\ + int __retval; \ + if ((__retval = (expr)) != (success))\ + {\ + rtlglue_printf("ERROR >>> [%s]:[%d] failed -- return value: %d\n", __FUNCTION__,__LINE__, __retval);\ + return __retval; \ + }\ + }while(0) +#endif + +#ifndef RTL_STREAM_SAME +#define RTL_STREAM_SAME(s1, s2) \ + ((strlen(s1) == strlen(s2)) && (strcmp(s1, s2) == 0)) +#endif + +#define ASSERT_ISR(x) if(!(x)) {while(1);} +#define RTL_STATIC_INLINE static __inline__ + +#define ASSERT_CSP(x) if (!(x)) {rtlglue_printf("\nAssert Fail: %s %d", __FILE__, __LINE__); while(1);} + +#if defined(RTL865X_TEST) || defined(RTL865X_MODEL_USER) +/* Only model code needs to define the following code. */ +typedef struct { } spinlock_t; +typedef uint8 u8; +typedef uint16 u16; +typedef uint32 u32; +#endif + +#if defined(DRTL_TBLDRV)||defined(RTL865X_TEST) +//only ROME driver and module test code need to include this header file +#include "rtl_glue.h" +#endif + +#if defined(RTL865X_TEST)||defined(RTL865X_MODEL_USER) +#define UNCACHE_MASK 0 +#define UNCACHE(addr) (addr) +#define CACHED(addr) ((uint32)(addr)) +#else +#define UNCACHE_MASK 0x20000000 +#define UNCACHE(addr) ((UNCACHE_MASK)|(uint32)(addr)) +#define CACHED(addr) ((uint32)(addr) & ~(UNCACHE_MASK)) +#endif + + +#endif + diff --git a/target/linux/realtek/files/include/asm-mips/rtl865x/sys.h b/target/linux/realtek/files/include/asm-mips/rtl865x/sys.h new file mode 100644 index 000000000..19b519ffd --- /dev/null +++ b/target/linux/realtek/files/include/asm-mips/rtl865x/sys.h @@ -0,0 +1,43 @@ +struct rtl_pool { /* the pool */ + struct list_head page_list; + spinlock_t lock; + size_t blocks_per_page; + size_t size; + int flags; + size_t allocation; + char name [32]; + wait_queue_head_t waitq; +}; + +struct rtl_page { /* cacheable header for 'allocation' bytes */ + struct list_head page_list; + void *vaddr; + dma_addr_t dma; + unsigned long bitmap [0]; +}; + +#define POOL_TIMEOUT_JIFFIES ((100 /* msec */ * HZ) / 1000) +#define POOL_POISON_BYTE 0xa7 + + +#undef DEBUG + +#ifdef DEBUG +#define DBG(x...) printk(x) +#else +#define DBG(x...) +#endif + + + +#define POOL_TIMEOUT_JIFFIES ((100 /* msec */ * HZ) / 1000) +#define POOL_POISON_BYTE 0xa7 +#define CONFIG_RTLPOOL_DEBUG +void rtl_free_consistent(size_t size, void *vaddr, dma_addr_t handle); +void *consistent_alloc(int gfp, size_t size, dma_addr_t *dma_handle); +void *rtl_alloc_consistent(size_t size, dma_addr_t *handle); +struct rtl_pool* rtl_pool_create(const char *, size_t, size_t ,size_t,int); +void rtl_pool_destroy (struct rtl_pool *pool); +void *rtl_pool_alloc (struct rtl_pool *, int, dma_addr_t *); +void rtl_pool_free (struct rtl_pool *pool, void *vaddr, dma_addr_t dma); + |