Skip to content
Permalink
Browse files

drivers: net: pfe_eth: LS1012A PFE headers

Contains all the pfe header files.

Signed-off-by: Calvin Johnson <calvin.johnson@nxp.com>
Signed-off-by: Anjaneyulu Jagarlmudi <anji.jagarlmudi@nxp.com>
  • Loading branch information
calvinjonxp authored and Prabhakar Kushwaha committed Oct 3, 2017
1 parent 676ef26 commit af5f82203668bbdefc7a69cec5b5ac6a728674bf
@@ -0,0 +1,75 @@
/*
* Copyright 2015-2016 Freescale Semiconductor, Inc.
* Copyright 2017 NXP
*
* SPDX-License-Identifier: GPL-2.0+
*/

#ifndef _CBUS_H_
#define _CBUS_H_

#include "cbus/emac.h"
#include "cbus/gpi.h"
#include "cbus/bmu.h"
#include "cbus/hif.h"
#include "cbus/tmu_csr.h"
#include "cbus/class_csr.h"
#include "cbus/hif_nocpy.h"
#include "cbus/util_csr.h"

#define CBUS_BASE_ADDR ((void *)CONFIG_SYS_FSL_PFE_ADDR)

/* PFE Control and Status Register Desciption */
#define EMAC1_BASE_ADDR (CBUS_BASE_ADDR + 0x200000)
#define EGPI1_BASE_ADDR (CBUS_BASE_ADDR + 0x210000)
#define EMAC2_BASE_ADDR (CBUS_BASE_ADDR + 0x220000)
#define EGPI2_BASE_ADDR (CBUS_BASE_ADDR + 0x230000)
#define BMU1_BASE_ADDR (CBUS_BASE_ADDR + 0x240000)
#define BMU2_BASE_ADDR (CBUS_BASE_ADDR + 0x250000)
#define ARB_BASE_ADDR (CBUS_BASE_ADDR + 0x260000)
#define DDR_CONFIG_BASE_ADDR (CBUS_BASE_ADDR + 0x270000)
#define HIF_BASE_ADDR (CBUS_BASE_ADDR + 0x280000)
#define HGPI_BASE_ADDR (CBUS_BASE_ADDR + 0x290000)
#define LMEM_BASE_ADDR (CBUS_BASE_ADDR + 0x300000)
#define LMEM_SIZE 0x10000
#define LMEM_END (LMEM_BASE_ADDR + LMEM_SIZE)
#define TMU_CSR_BASE_ADDR (CBUS_BASE_ADDR + 0x310000)
#define CLASS_CSR_BASE_ADDR (CBUS_BASE_ADDR + 0x320000)
#define HIF_NOCPY_BASE_ADDR (CBUS_BASE_ADDR + 0x350000)
#define UTIL_CSR_BASE_ADDR (CBUS_BASE_ADDR + 0x360000)
#define CBUS_GPT_BASE_ADDR (CBUS_BASE_ADDR + 0x370000)

/*
* defgroup XXX_MEM_ACCESS_ADDR PE memory access through CSR
* XXX_MEM_ACCESS_ADDR register bit definitions.
*/
/* Internal Memory Write. */
#define PE_MEM_ACCESS_WRITE (1<<31)
/* Internal Memory Read. */
#define PE_MEM_ACCESS_READ (0<<31)

#define PE_MEM_ACCESS_IMEM (1<<15)
#define PE_MEM_ACCESS_DMEM (1<<16)
/* Byte Enables of the Internal memory access. These are interpred in BE */
#define PE_MEM_ACCESS_BYTE_ENABLE(offset, size) (((((1 << (size)) - 1) << (4 \
- (offset) - (size)))\
& 0xf) << 24)
/* PFE cores states */
#define CORE_DISABLE 0x00000000
#define CORE_ENABLE 0x00000001
#define CORE_SW_RESET 0x00000002

/* LMEM defines */
#define LMEM_HDR_SIZE 0x0010
#define LMEM_BUF_SIZE_LN2 0x7
#define LMEM_BUF_SIZE (1 << LMEM_BUF_SIZE_LN2)

/* DDR defines */
#define DDR_HDR_SIZE 0x0100
#define DDR_BUF_SIZE_LN2 0xb
#define DDR_BUF_SIZE (1 << DDR_BUF_SIZE_LN2)

/* Clock generation through PLL */
#define PLL_CLK_EN 1

#endif /* _CBUS_H_ */
@@ -0,0 +1,40 @@
/*
* Copyright 2015-2016 Freescale Semiconductor, Inc.
* Copyright 2017 NXP
*
* SPDX-License-Identifier: GPL-2.0+
*/

#ifndef _BMU_H_
#define _BMU_H_

#define BMU_VERSION 0x000
#define BMU_CTRL 0x004
#define BMU_UCAST_CONFIG 0x008
#define BMU_UCAST_BASE_ADDR 0x00c
#define BMU_BUF_SIZE 0x010
#define BMU_BUF_CNT 0x014
#define BMU_THRES 0x018
#define BMU_INT_SRC 0x020
#define BMU_INT_ENABLE 0x024
#define BMU_ALLOC_CTRL 0x030
#define BMU_FREE_CTRL 0x034
#define BMU_FREE_ERR_ADDR 0x038
#define BMU_CURR_BUF_CNT 0x03c
#define BMU_MCAST_CNT 0x040
#define BMU_MCAST_ALLOC_CTRL 0x044
#define BMU_REM_BUF_CNT 0x048
#define BMU_LOW_WATERMARK 0x050
#define BMU_HIGH_WATERMARK 0x054
#define BMU_INT_MEM_ACCESS 0x100

struct bmu_cfg {
u32 baseaddr;
u32 count;
u32 size;
};

#define BMU1_BUF_SIZE LMEM_BUF_SIZE_LN2
#define BMU2_BUF_SIZE DDR_BUF_SIZE_LN2

#endif /* _BMU_H_ */
@@ -0,0 +1,181 @@
/*
* Copyright 2015-2016 Freescale Semiconductor, Inc.
* Copyright 2017 NXP
*
* SPDX-License-Identifier: GPL-2.0+
*/

#ifndef _CLASS_CSR_H_
#define _CLASS_CSR_H_

/*
* @file class_csr.h.
* class_csr - block containing all the classifier control and status register.
* Mapped on CBUS and accessible from all PE's and ARM.
*/
#define CLASS_VERSION (CLASS_CSR_BASE_ADDR + 0x000)
#define CLASS_TX_CTRL (CLASS_CSR_BASE_ADDR + 0x004)
#define CLASS_INQ_PKTPTR (CLASS_CSR_BASE_ADDR + 0x010)
/* (ddr_hdr_size[24:16], lmem_hdr_size[5:0]) */
#define CLASS_HDR_SIZE (CLASS_CSR_BASE_ADDR + 0x014)
/* LMEM header size for the Classifier block.
* Data in the LMEM is written from this offset.
*/
#define CLASS_HDR_SIZE_LMEM(off) ((off) & 0x3f)
/* DDR header size for the Classifier block.
* Data in the DDR is written from this offset.
*/
#define CLASS_HDR_SIZE_DDR(off) (((off) & 0x1ff) << 16)

/* DMEM address of first [15:0] and second [31:16] buffers on QB side. */
#define CLASS_PE0_QB_DM_ADDR0 (CLASS_CSR_BASE_ADDR + 0x020)
/* DMEM address of third [15:0] and fourth [31:16] buffers on QB side. */
#define CLASS_PE0_QB_DM_ADDR1 (CLASS_CSR_BASE_ADDR + 0x024)

/* DMEM address of first [15:0] and second [31:16] buffers on RO side. */
#define CLASS_PE0_RO_DM_ADDR0 (CLASS_CSR_BASE_ADDR + 0x060)
/* DMEM address of third [15:0] and fourth [31:16] buffers on RO side. */
#define CLASS_PE0_RO_DM_ADDR1 (CLASS_CSR_BASE_ADDR + 0x064)

/*
* @name Class PE memory access. Allows external PE's and HOST to
* read/write PMEM/DMEM memory ranges for each classifier PE.
*/
#define CLASS_MEM_ACCESS_ADDR (CLASS_CSR_BASE_ADDR + 0x100)
/* Internal Memory Access Write Data [31:0] */
#define CLASS_MEM_ACCESS_WDATA (CLASS_CSR_BASE_ADDR + 0x104)
/* Internal Memory Access Read Data [31:0] */
#define CLASS_MEM_ACCESS_RDATA (CLASS_CSR_BASE_ADDR + 0x108)
#define CLASS_TM_INQ_ADDR (CLASS_CSR_BASE_ADDR + 0x114)
#define CLASS_PE_STATUS (CLASS_CSR_BASE_ADDR + 0x118)

#define CLASS_PE_SYS_CLK_RATIO (CLASS_CSR_BASE_ADDR + 0x200)
#define CLASS_AFULL_THRES (CLASS_CSR_BASE_ADDR + 0x204)
#define CLASS_GAP_BETWEEN_READS (CLASS_CSR_BASE_ADDR + 0x208)
#define CLASS_MAX_BUF_CNT (CLASS_CSR_BASE_ADDR + 0x20c)
#define CLASS_TSQ_FIFO_THRES (CLASS_CSR_BASE_ADDR + 0x210)
#define CLASS_TSQ_MAX_CNT (CLASS_CSR_BASE_ADDR + 0x214)
#define CLASS_IRAM_DATA_0 (CLASS_CSR_BASE_ADDR + 0x218)
#define CLASS_IRAM_DATA_1 (CLASS_CSR_BASE_ADDR + 0x21c)
#define CLASS_IRAM_DATA_2 (CLASS_CSR_BASE_ADDR + 0x220)
#define CLASS_IRAM_DATA_3 (CLASS_CSR_BASE_ADDR + 0x224)

#define CLASS_BUS_ACCESS_ADDR (CLASS_CSR_BASE_ADDR + 0x228)
/* bit 23:0 of PE peripheral address are stored in CLASS_BUS_ACCESS_ADDR */
#define CLASS_BUS_ACCESS_ADDR_MASK (0x0001FFFF)

#define CLASS_BUS_ACCESS_WDATA (CLASS_CSR_BASE_ADDR + 0x22c)
#define CLASS_BUS_ACCESS_RDATA (CLASS_CSR_BASE_ADDR + 0x230)

/*
* (route_entry_size[9:0], route_hash_size[23:16]
* (this is actually ln2(size)))
*/
#define CLASS_ROUTE_HASH_ENTRY_SIZE (CLASS_CSR_BASE_ADDR + 0x234)
#define CLASS_ROUTE_ENTRY_SIZE(size) ((size) & 0x1ff)
#define CLASS_ROUTE_HASH_SIZE(hash_bits) (((hash_bits) & 0xff) << 16)

#define CLASS_ROUTE_TABLE_BASE (CLASS_CSR_BASE_ADDR + 0x238)
#define CLASS_ROUTE_MULTI (CLASS_CSR_BASE_ADDR + 0x23c)
#define CLASS_SMEM_OFFSET (CLASS_CSR_BASE_ADDR + 0x240)
#define CLASS_LMEM_BUF_SIZE (CLASS_CSR_BASE_ADDR + 0x244)
#define CLASS_VLAN_ID (CLASS_CSR_BASE_ADDR + 0x248)
#define CLASS_BMU1_BUF_FREE (CLASS_CSR_BASE_ADDR + 0x24c)
#define CLASS_USE_TMU_INQ (CLASS_CSR_BASE_ADDR + 0x250)
#define CLASS_VLAN_ID1 (CLASS_CSR_BASE_ADDR + 0x254)

#define CLASS_BUS_ACCESS_BASE (CLASS_CSR_BASE_ADDR + 0x258)
/* bit 31:24 of PE peripheral address are stored in CLASS_BUS_ACCESS_BASE */
#define CLASS_BUS_ACCESS_BASE_MASK (0xFF000000)

#define CLASS_HIF_PARSE (CLASS_CSR_BASE_ADDR + 0x25c)

#define CLASS_HOST_PE0_GP (CLASS_CSR_BASE_ADDR + 0x260)
#define CLASS_PE0_GP (CLASS_CSR_BASE_ADDR + 0x264)
#define CLASS_HOST_PE1_GP (CLASS_CSR_BASE_ADDR + 0x268)
#define CLASS_PE1_GP (CLASS_CSR_BASE_ADDR + 0x26c)
#define CLASS_HOST_PE2_GP (CLASS_CSR_BASE_ADDR + 0x270)
#define CLASS_PE2_GP (CLASS_CSR_BASE_ADDR + 0x274)
#define CLASS_HOST_PE3_GP (CLASS_CSR_BASE_ADDR + 0x278)
#define CLASS_PE3_GP (CLASS_CSR_BASE_ADDR + 0x27c)
#define CLASS_HOST_PE4_GP (CLASS_CSR_BASE_ADDR + 0x280)
#define CLASS_PE4_GP (CLASS_CSR_BASE_ADDR + 0x284)
#define CLASS_HOST_PE5_GP (CLASS_CSR_BASE_ADDR + 0x288)
#define CLASS_PE5_GP (CLASS_CSR_BASE_ADDR + 0x28c)

#define CLASS_PE_INT_SRC (CLASS_CSR_BASE_ADDR + 0x290)
#define CLASS_PE_INT_ENABLE (CLASS_CSR_BASE_ADDR + 0x294)

#define CLASS_TPID0_TPID1 (CLASS_CSR_BASE_ADDR + 0x298)
#define CLASS_TPID2 (CLASS_CSR_BASE_ADDR + 0x29c)

#define CLASS_L4_CHKSUM_ADDR (CLASS_CSR_BASE_ADDR + 0x2a0)

#define CLASS_PE0_DEBUG (CLASS_CSR_BASE_ADDR + 0x2a4)
#define CLASS_PE1_DEBUG (CLASS_CSR_BASE_ADDR + 0x2a8)
#define CLASS_PE2_DEBUG (CLASS_CSR_BASE_ADDR + 0x2ac)
#define CLASS_PE3_DEBUG (CLASS_CSR_BASE_ADDR + 0x2b0)
#define CLASS_PE4_DEBUG (CLASS_CSR_BASE_ADDR + 0x2b4)
#define CLASS_PE5_DEBUG (CLASS_CSR_BASE_ADDR + 0x2b8)

#define CLASS_STATE (CLASS_CSR_BASE_ADDR + 0x2bc)
#define CLASS_AXI_CTRL (CLASS_CSR_BASE_ADDR + 0x2d0)

/* CLASS defines */
#define CLASS_PBUF_SIZE 0x100 /* Fixed by hardware */
#define CLASS_PBUF_HEADER_OFFSET 0x80 /* Can be configured */

#define CLASS_PBUF0_BASE_ADDR 0x000 /* Can be configured */
/* Can be configured */
#define CLASS_PBUF1_BASE_ADDR (CLASS_PBUF0_BASE_ADDR + CLASS_PBUF_SIZE)
/* Can be configured */
#define CLASS_PBUF2_BASE_ADDR (CLASS_PBUF1_BASE_ADDR + CLASS_PBUF_SIZE)
/* Can be configured */
#define CLASS_PBUF3_BASE_ADDR (CLASS_PBUF2_BASE_ADDR + CLASS_PBUF_SIZE)

#define CLASS_PBUF0_HEADER_BASE_ADDR (CLASS_PBUF0_BASE_ADDR +\
CLASS_PBUF_HEADER_OFFSET)
#define CLASS_PBUF1_HEADER_BASE_ADDR (CLASS_PBUF1_BASE_ADDR +\
CLASS_PBUF_HEADER_OFFSET)
#define CLASS_PBUF2_HEADER_BASE_ADDR (CLASS_PBUF2_BASE_ADDR +\
CLASS_PBUF_HEADER_OFFSET)
#define CLASS_PBUF3_HEADER_BASE_ADDR (CLASS_PBUF3_BASE_ADDR +\
CLASS_PBUF_HEADER_OFFSET)

#define CLASS_PE0_RO_DM_ADDR0_VAL ((CLASS_PBUF1_BASE_ADDR << 16) |\
CLASS_PBUF0_BASE_ADDR)
#define CLASS_PE0_RO_DM_ADDR1_VAL ((CLASS_PBUF3_BASE_ADDR << 16) |\
CLASS_PBUF2_BASE_ADDR)

#define CLASS_PE0_QB_DM_ADDR0_VAL ((CLASS_PBUF1_HEADER_BASE_ADDR << 16)\
| CLASS_PBUF0_HEADER_BASE_ADDR)
#define CLASS_PE0_QB_DM_ADDR1_VAL ((CLASS_PBUF3_HEADER_BASE_ADDR << 16)\
| CLASS_PBUF2_HEADER_BASE_ADDR)

#define CLASS_ROUTE_SIZE 128
#define CLASS_ROUTE_HASH_BITS 20
#define CLASS_ROUTE_HASH_MASK ((1 << CLASS_ROUTE_HASH_BITS) - 1)

#define TWO_LEVEL_ROUTE (1 << 0)
#define PHYNO_IN_HASH (1 << 1)
#define HW_ROUTE_FETCH (1 << 3)
#define HW_BRIDGE_FETCH (1 << 5)
#define IP_ALIGNED (1 << 6)
#define ARC_HIT_CHECK_EN (1 << 7)
#define CLASS_TOE (1 << 11)
#define HASH_NORMAL (0 << 12)
#define HASH_CRC_PORT (1 << 12)
#define HASH_CRC_IP (2 << 12)
#define HASH_CRC_PORT_IP (3 << 12)
#define QB2BUS_LE (1 << 15)

#define TCP_CHKSUM_DROP (1 << 0)
#define UDP_CHKSUM_DROP (1 << 1)
#define IPV4_CHKSUM_DROP (1 << 9)

struct class_cfg {
u32 route_table_baseaddr;
u32 route_table_hash_bits;
};

#endif /* _CLASS_CSR_H_ */

0 comments on commit af5f822

Please sign in to comment.
You can’t perform that action at this time.