162306a36Sopenharmony_ci/**********************************************************************
262306a36Sopenharmony_ci * Author: Cavium, Inc.
362306a36Sopenharmony_ci *
462306a36Sopenharmony_ci * Contact: support@cavium.com
562306a36Sopenharmony_ci *          Please include "LiquidIO" in the subject.
662306a36Sopenharmony_ci *
762306a36Sopenharmony_ci * Copyright (c) 2003-2016 Cavium, Inc.
862306a36Sopenharmony_ci *
962306a36Sopenharmony_ci * This file is free software; you can redistribute it and/or modify
1062306a36Sopenharmony_ci * it under the terms of the GNU General Public License, Version 2, as
1162306a36Sopenharmony_ci * published by the Free Software Foundation.
1262306a36Sopenharmony_ci *
1362306a36Sopenharmony_ci * This file is distributed in the hope that it will be useful, but
1462306a36Sopenharmony_ci * AS-IS and WITHOUT ANY WARRANTY; without even the implied warranty
1562306a36Sopenharmony_ci * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, TITLE, or
1662306a36Sopenharmony_ci * NONINFRINGEMENT.  See the GNU General Public License for more details.
1762306a36Sopenharmony_ci ***********************************************************************/
1862306a36Sopenharmony_ci/*! \file cn66xx_regs.h
1962306a36Sopenharmony_ci *  \brief Host Driver: Register Address and Register Mask values for
2062306a36Sopenharmony_ci *  Octeon CN66XX devices.
2162306a36Sopenharmony_ci */
2262306a36Sopenharmony_ci
2362306a36Sopenharmony_ci#ifndef __CN66XX_REGS_H__
2462306a36Sopenharmony_ci#define __CN66XX_REGS_H__
2562306a36Sopenharmony_ci
2662306a36Sopenharmony_ci#define     CN6XXX_XPANSION_BAR             0x30
2762306a36Sopenharmony_ci
2862306a36Sopenharmony_ci#define     CN6XXX_MSI_CAP                  0x50
2962306a36Sopenharmony_ci#define     CN6XXX_MSI_ADDR_LO              0x54
3062306a36Sopenharmony_ci#define     CN6XXX_MSI_ADDR_HI              0x58
3162306a36Sopenharmony_ci#define     CN6XXX_MSI_DATA                 0x5C
3262306a36Sopenharmony_ci
3362306a36Sopenharmony_ci#define     CN6XXX_PCIE_CAP                 0x70
3462306a36Sopenharmony_ci#define     CN6XXX_PCIE_DEVCAP              0x74
3562306a36Sopenharmony_ci#define     CN6XXX_PCIE_DEVCTL              0x78
3662306a36Sopenharmony_ci#define     CN6XXX_PCIE_LINKCAP             0x7C
3762306a36Sopenharmony_ci#define     CN6XXX_PCIE_LINKCTL             0x80
3862306a36Sopenharmony_ci#define     CN6XXX_PCIE_SLOTCAP             0x84
3962306a36Sopenharmony_ci#define     CN6XXX_PCIE_SLOTCTL             0x88
4062306a36Sopenharmony_ci
4162306a36Sopenharmony_ci#define     CN6XXX_PCIE_ENH_CAP             0x100
4262306a36Sopenharmony_ci#define     CN6XXX_PCIE_UNCORR_ERR_STATUS   0x104
4362306a36Sopenharmony_ci#define     CN6XXX_PCIE_UNCORR_ERR_MASK     0x108
4462306a36Sopenharmony_ci#define     CN6XXX_PCIE_UNCORR_ERR          0x10C
4562306a36Sopenharmony_ci#define     CN6XXX_PCIE_CORR_ERR_STATUS     0x110
4662306a36Sopenharmony_ci#define     CN6XXX_PCIE_CORR_ERR_MASK       0x114
4762306a36Sopenharmony_ci#define     CN6XXX_PCIE_ADV_ERR_CAP         0x118
4862306a36Sopenharmony_ci
4962306a36Sopenharmony_ci#define     CN6XXX_PCIE_ACK_REPLAY_TIMER    0x700
5062306a36Sopenharmony_ci#define     CN6XXX_PCIE_OTHER_MSG           0x704
5162306a36Sopenharmony_ci#define     CN6XXX_PCIE_PORT_FORCE_LINK     0x708
5262306a36Sopenharmony_ci#define     CN6XXX_PCIE_ACK_FREQ            0x70C
5362306a36Sopenharmony_ci#define     CN6XXX_PCIE_PORT_LINK_CTL       0x710
5462306a36Sopenharmony_ci#define     CN6XXX_PCIE_LANE_SKEW           0x714
5562306a36Sopenharmony_ci#define     CN6XXX_PCIE_SYM_NUM             0x718
5662306a36Sopenharmony_ci#define     CN6XXX_PCIE_FLTMSK              0x720
5762306a36Sopenharmony_ci
5862306a36Sopenharmony_ci/* ##############  BAR0 Registers ################  */
5962306a36Sopenharmony_ci
6062306a36Sopenharmony_ci#define    CN6XXX_SLI_CTL_PORT0                    0x0050
6162306a36Sopenharmony_ci#define    CN6XXX_SLI_CTL_PORT1                    0x0060
6262306a36Sopenharmony_ci
6362306a36Sopenharmony_ci#define    CN6XXX_SLI_WINDOW_CTL                   0x02E0
6462306a36Sopenharmony_ci#define    CN6XXX_SLI_DBG_DATA                     0x0310
6562306a36Sopenharmony_ci#define    CN6XXX_SLI_SCRATCH1                     0x03C0
6662306a36Sopenharmony_ci#define    CN6XXX_SLI_SCRATCH2                     0x03D0
6762306a36Sopenharmony_ci#define    CN6XXX_SLI_CTL_STATUS                   0x0570
6862306a36Sopenharmony_ci
6962306a36Sopenharmony_ci#define    CN6XXX_WIN_WR_ADDR_LO                   0x0000
7062306a36Sopenharmony_ci#define    CN6XXX_WIN_WR_ADDR_HI                   0x0004
7162306a36Sopenharmony_ci#define    CN6XXX_WIN_WR_ADDR64                    CN6XXX_WIN_WR_ADDR_LO
7262306a36Sopenharmony_ci
7362306a36Sopenharmony_ci#define    CN6XXX_WIN_RD_ADDR_LO                   0x0010
7462306a36Sopenharmony_ci#define    CN6XXX_WIN_RD_ADDR_HI                   0x0014
7562306a36Sopenharmony_ci#define    CN6XXX_WIN_RD_ADDR64                    CN6XXX_WIN_RD_ADDR_LO
7662306a36Sopenharmony_ci
7762306a36Sopenharmony_ci#define    CN6XXX_WIN_WR_DATA_LO                   0x0020
7862306a36Sopenharmony_ci#define    CN6XXX_WIN_WR_DATA_HI                   0x0024
7962306a36Sopenharmony_ci#define    CN6XXX_WIN_WR_DATA64                    CN6XXX_WIN_WR_DATA_LO
8062306a36Sopenharmony_ci
8162306a36Sopenharmony_ci#define    CN6XXX_WIN_RD_DATA_LO                   0x0040
8262306a36Sopenharmony_ci#define    CN6XXX_WIN_RD_DATA_HI                   0x0044
8362306a36Sopenharmony_ci#define    CN6XXX_WIN_RD_DATA64                    CN6XXX_WIN_RD_DATA_LO
8462306a36Sopenharmony_ci
8562306a36Sopenharmony_ci#define    CN6XXX_WIN_WR_MASK_LO                   0x0030
8662306a36Sopenharmony_ci#define    CN6XXX_WIN_WR_MASK_HI                   0x0034
8762306a36Sopenharmony_ci#define    CN6XXX_WIN_WR_MASK_REG                  CN6XXX_WIN_WR_MASK_LO
8862306a36Sopenharmony_ci
8962306a36Sopenharmony_ci/* 1 register (32-bit) to enable Input queues */
9062306a36Sopenharmony_ci#define    CN6XXX_SLI_PKT_INSTR_ENB               0x1000
9162306a36Sopenharmony_ci
9262306a36Sopenharmony_ci/* 1 register (32-bit) to enable Output queues */
9362306a36Sopenharmony_ci#define    CN6XXX_SLI_PKT_OUT_ENB                 0x1010
9462306a36Sopenharmony_ci
9562306a36Sopenharmony_ci/* 1 register (32-bit) to determine whether Output queues are in reset. */
9662306a36Sopenharmony_ci#define    CN6XXX_SLI_PORT_IN_RST_OQ              0x11F0
9762306a36Sopenharmony_ci
9862306a36Sopenharmony_ci/* 1 register (32-bit) to determine whether Input queues are in reset. */
9962306a36Sopenharmony_ci#define    CN6XXX_SLI_PORT_IN_RST_IQ              0x11F4
10062306a36Sopenharmony_ci
10162306a36Sopenharmony_ci/*###################### REQUEST QUEUE #########################*/
10262306a36Sopenharmony_ci
10362306a36Sopenharmony_ci/* 1 register (32-bit) - instr. size of each input queue. */
10462306a36Sopenharmony_ci#define    CN6XXX_SLI_PKT_INSTR_SIZE             0x1020
10562306a36Sopenharmony_ci
10662306a36Sopenharmony_ci/* 32 registers for Input Queue Instr Count - SLI_PKT_IN_DONE0_CNTS */
10762306a36Sopenharmony_ci#define    CN6XXX_SLI_IQ_INSTR_COUNT_START       0x2000
10862306a36Sopenharmony_ci
10962306a36Sopenharmony_ci/* 32 registers for Input Queue Start Addr - SLI_PKT0_INSTR_BADDR */
11062306a36Sopenharmony_ci#define    CN6XXX_SLI_IQ_BASE_ADDR_START64       0x2800
11162306a36Sopenharmony_ci
11262306a36Sopenharmony_ci/* 32 registers for Input Doorbell - SLI_PKT0_INSTR_BAOFF_DBELL */
11362306a36Sopenharmony_ci#define    CN6XXX_SLI_IQ_DOORBELL_START          0x2C00
11462306a36Sopenharmony_ci
11562306a36Sopenharmony_ci/* 32 registers for Input Queue size - SLI_PKT0_INSTR_FIFO_RSIZE */
11662306a36Sopenharmony_ci#define    CN6XXX_SLI_IQ_SIZE_START              0x3000
11762306a36Sopenharmony_ci
11862306a36Sopenharmony_ci/* 32 registers for Instruction Header Options - SLI_PKT0_INSTR_HEADER */
11962306a36Sopenharmony_ci#define    CN6XXX_SLI_IQ_PKT_INSTR_HDR_START64   0x3400
12062306a36Sopenharmony_ci
12162306a36Sopenharmony_ci/* 1 register (64-bit) - Back Pressure for each input queue - SLI_PKT0_IN_BP */
12262306a36Sopenharmony_ci#define    CN66XX_SLI_INPUT_BP_START64           0x3800
12362306a36Sopenharmony_ci
12462306a36Sopenharmony_ci/* Each Input Queue register is at a 16-byte Offset in BAR0 */
12562306a36Sopenharmony_ci#define    CN6XXX_IQ_OFFSET                      0x10
12662306a36Sopenharmony_ci
12762306a36Sopenharmony_ci/* 1 register (32-bit) - ES, RO, NS, Arbitration for Input Queue Data &
12862306a36Sopenharmony_ci * gather list fetches. SLI_PKT_INPUT_CONTROL.
12962306a36Sopenharmony_ci */
13062306a36Sopenharmony_ci#define    CN6XXX_SLI_PKT_INPUT_CONTROL          0x1170
13162306a36Sopenharmony_ci
13262306a36Sopenharmony_ci/* 1 register (64-bit) - Number of instructions to read at one time
13362306a36Sopenharmony_ci * - 2 bits for each input ring. SLI_PKT_INSTR_RD_SIZE.
13462306a36Sopenharmony_ci */
13562306a36Sopenharmony_ci#define    CN6XXX_SLI_PKT_INSTR_RD_SIZE          0x11A0
13662306a36Sopenharmony_ci
13762306a36Sopenharmony_ci/* 1 register (64-bit) - Assign Input ring to MAC port
13862306a36Sopenharmony_ci * - 2 bits for each input ring. SLI_PKT_IN_PCIE_PORT.
13962306a36Sopenharmony_ci */
14062306a36Sopenharmony_ci#define    CN6XXX_SLI_IN_PCIE_PORT               0x11B0
14162306a36Sopenharmony_ci
14262306a36Sopenharmony_ci/*------- Request Queue Macros ---------*/
14362306a36Sopenharmony_ci#define    CN6XXX_SLI_IQ_BASE_ADDR64(iq)          \
14462306a36Sopenharmony_ci	(CN6XXX_SLI_IQ_BASE_ADDR_START64 + ((iq) * CN6XXX_IQ_OFFSET))
14562306a36Sopenharmony_ci
14662306a36Sopenharmony_ci#define    CN6XXX_SLI_IQ_SIZE(iq)                 \
14762306a36Sopenharmony_ci	(CN6XXX_SLI_IQ_SIZE_START + ((iq) * CN6XXX_IQ_OFFSET))
14862306a36Sopenharmony_ci
14962306a36Sopenharmony_ci#define    CN6XXX_SLI_IQ_PKT_INSTR_HDR64(iq)      \
15062306a36Sopenharmony_ci	(CN6XXX_SLI_IQ_PKT_INSTR_HDR_START64 + ((iq) * CN6XXX_IQ_OFFSET))
15162306a36Sopenharmony_ci
15262306a36Sopenharmony_ci#define    CN6XXX_SLI_IQ_DOORBELL(iq)             \
15362306a36Sopenharmony_ci	(CN6XXX_SLI_IQ_DOORBELL_START + ((iq) * CN6XXX_IQ_OFFSET))
15462306a36Sopenharmony_ci
15562306a36Sopenharmony_ci#define    CN6XXX_SLI_IQ_INSTR_COUNT(iq)          \
15662306a36Sopenharmony_ci	(CN6XXX_SLI_IQ_INSTR_COUNT_START + ((iq) * CN6XXX_IQ_OFFSET))
15762306a36Sopenharmony_ci
15862306a36Sopenharmony_ci#define    CN66XX_SLI_IQ_BP64(iq)                 \
15962306a36Sopenharmony_ci	(CN66XX_SLI_INPUT_BP_START64 + ((iq) * CN6XXX_IQ_OFFSET))
16062306a36Sopenharmony_ci
16162306a36Sopenharmony_ci/*------------------ Masks ----------------*/
16262306a36Sopenharmony_ci#define    CN6XXX_INPUT_CTL_ROUND_ROBIN_ARB         BIT(22)
16362306a36Sopenharmony_ci#define    CN6XXX_INPUT_CTL_DATA_NS                 BIT(8)
16462306a36Sopenharmony_ci#define    CN6XXX_INPUT_CTL_DATA_ES_64B_SWAP        BIT(6)
16562306a36Sopenharmony_ci#define    CN6XXX_INPUT_CTL_DATA_RO                 BIT(5)
16662306a36Sopenharmony_ci#define    CN6XXX_INPUT_CTL_USE_CSR                 BIT(4)
16762306a36Sopenharmony_ci#define    CN6XXX_INPUT_CTL_GATHER_NS               BIT(3)
16862306a36Sopenharmony_ci#define    CN6XXX_INPUT_CTL_GATHER_ES_64B_SWAP      BIT(2)
16962306a36Sopenharmony_ci#define    CN6XXX_INPUT_CTL_GATHER_RO               BIT(1)
17062306a36Sopenharmony_ci
17162306a36Sopenharmony_ci#ifdef __BIG_ENDIAN_BITFIELD
17262306a36Sopenharmony_ci#define    CN6XXX_INPUT_CTL_MASK                    \
17362306a36Sopenharmony_ci	(CN6XXX_INPUT_CTL_DATA_ES_64B_SWAP      \
17462306a36Sopenharmony_ci	  | CN6XXX_INPUT_CTL_USE_CSR              \
17562306a36Sopenharmony_ci	  | CN6XXX_INPUT_CTL_GATHER_ES_64B_SWAP)
17662306a36Sopenharmony_ci#else
17762306a36Sopenharmony_ci#define    CN6XXX_INPUT_CTL_MASK                    \
17862306a36Sopenharmony_ci	(CN6XXX_INPUT_CTL_DATA_ES_64B_SWAP     \
17962306a36Sopenharmony_ci	  | CN6XXX_INPUT_CTL_USE_CSR)
18062306a36Sopenharmony_ci#endif
18162306a36Sopenharmony_ci
18262306a36Sopenharmony_ci/*############################ OUTPUT QUEUE #########################*/
18362306a36Sopenharmony_ci
18462306a36Sopenharmony_ci/* 32 registers for Output queue buffer and info size - SLI_PKT0_OUT_SIZE */
18562306a36Sopenharmony_ci#define    CN6XXX_SLI_OQ0_BUFF_INFO_SIZE         0x0C00
18662306a36Sopenharmony_ci
18762306a36Sopenharmony_ci/* 32 registers for Output Queue Start Addr - SLI_PKT0_SLIST_BADDR */
18862306a36Sopenharmony_ci#define    CN6XXX_SLI_OQ_BASE_ADDR_START64       0x1400
18962306a36Sopenharmony_ci
19062306a36Sopenharmony_ci/* 32 registers for Output Queue Packet Credits - SLI_PKT0_SLIST_BAOFF_DBELL */
19162306a36Sopenharmony_ci#define    CN6XXX_SLI_OQ_PKT_CREDITS_START       0x1800
19262306a36Sopenharmony_ci
19362306a36Sopenharmony_ci/* 32 registers for Output Queue size - SLI_PKT0_SLIST_FIFO_RSIZE */
19462306a36Sopenharmony_ci#define    CN6XXX_SLI_OQ_SIZE_START              0x1C00
19562306a36Sopenharmony_ci
19662306a36Sopenharmony_ci/* 32 registers for Output Queue Packet Count - SLI_PKT0_CNTS */
19762306a36Sopenharmony_ci#define    CN6XXX_SLI_OQ_PKT_SENT_START          0x2400
19862306a36Sopenharmony_ci
19962306a36Sopenharmony_ci/* Each Output Queue register is at a 16-byte Offset in BAR0 */
20062306a36Sopenharmony_ci#define    CN6XXX_OQ_OFFSET                      0x10
20162306a36Sopenharmony_ci
20262306a36Sopenharmony_ci/* 1 register (32-bit) - 1 bit for each output queue
20362306a36Sopenharmony_ci * - Relaxed Ordering setting for reading Output Queues descriptors
20462306a36Sopenharmony_ci * - SLI_PKT_SLIST_ROR
20562306a36Sopenharmony_ci */
20662306a36Sopenharmony_ci#define    CN6XXX_SLI_PKT_SLIST_ROR              0x1030
20762306a36Sopenharmony_ci
20862306a36Sopenharmony_ci/* 1 register (32-bit) - 1 bit for each output queue
20962306a36Sopenharmony_ci * - No Snoop mode for reading Output Queues descriptors
21062306a36Sopenharmony_ci * - SLI_PKT_SLIST_NS
21162306a36Sopenharmony_ci */
21262306a36Sopenharmony_ci#define    CN6XXX_SLI_PKT_SLIST_NS               0x1040
21362306a36Sopenharmony_ci
21462306a36Sopenharmony_ci/* 1 register (64-bit) - 2 bits for each output queue
21562306a36Sopenharmony_ci * - Endian-Swap mode for reading Output Queue descriptors
21662306a36Sopenharmony_ci * - SLI_PKT_SLIST_ES
21762306a36Sopenharmony_ci */
21862306a36Sopenharmony_ci#define    CN6XXX_SLI_PKT_SLIST_ES64             0x1050
21962306a36Sopenharmony_ci
22062306a36Sopenharmony_ci/* 1 register (32-bit) - 1 bit for each output queue
22162306a36Sopenharmony_ci * - InfoPtr mode for Output Queues.
22262306a36Sopenharmony_ci * - SLI_PKT_IPTR
22362306a36Sopenharmony_ci */
22462306a36Sopenharmony_ci#define    CN6XXX_SLI_PKT_IPTR                   0x1070
22562306a36Sopenharmony_ci
22662306a36Sopenharmony_ci/* 1 register (32-bit) - 1 bit for each output queue
22762306a36Sopenharmony_ci * - DPTR format selector for Output queues.
22862306a36Sopenharmony_ci * - SLI_PKT_DPADDR
22962306a36Sopenharmony_ci */
23062306a36Sopenharmony_ci#define    CN6XXX_SLI_PKT_DPADDR                 0x1080
23162306a36Sopenharmony_ci
23262306a36Sopenharmony_ci/* 1 register (32-bit) - 1 bit for each output queue
23362306a36Sopenharmony_ci * - Relaxed Ordering setting for reading Output Queues data
23462306a36Sopenharmony_ci * - SLI_PKT_DATA_OUT_ROR
23562306a36Sopenharmony_ci */
23662306a36Sopenharmony_ci#define    CN6XXX_SLI_PKT_DATA_OUT_ROR           0x1090
23762306a36Sopenharmony_ci
23862306a36Sopenharmony_ci/* 1 register (32-bit) - 1 bit for each output queue
23962306a36Sopenharmony_ci * - No Snoop mode for reading Output Queues data
24062306a36Sopenharmony_ci * - SLI_PKT_DATA_OUT_NS
24162306a36Sopenharmony_ci */
24262306a36Sopenharmony_ci#define    CN6XXX_SLI_PKT_DATA_OUT_NS            0x10A0
24362306a36Sopenharmony_ci
24462306a36Sopenharmony_ci/* 1 register (64-bit)  - 2 bits for each output queue
24562306a36Sopenharmony_ci * - Endian-Swap mode for reading Output Queue data
24662306a36Sopenharmony_ci * - SLI_PKT_DATA_OUT_ES
24762306a36Sopenharmony_ci */
24862306a36Sopenharmony_ci#define    CN6XXX_SLI_PKT_DATA_OUT_ES64          0x10B0
24962306a36Sopenharmony_ci
25062306a36Sopenharmony_ci/* 1 register (32-bit) - 1 bit for each output queue
25162306a36Sopenharmony_ci * - Controls whether SLI_PKTn_CNTS is incremented for bytes or for packets.
25262306a36Sopenharmony_ci * - SLI_PKT_OUT_BMODE
25362306a36Sopenharmony_ci */
25462306a36Sopenharmony_ci#define    CN6XXX_SLI_PKT_OUT_BMODE              0x10D0
25562306a36Sopenharmony_ci
25662306a36Sopenharmony_ci/* 1 register (64-bit) - 2 bits for each output queue
25762306a36Sopenharmony_ci * - Assign PCIE port for Output queues
25862306a36Sopenharmony_ci * - SLI_PKT_PCIE_PORT.
25962306a36Sopenharmony_ci */
26062306a36Sopenharmony_ci#define    CN6XXX_SLI_PKT_PCIE_PORT64            0x10E0
26162306a36Sopenharmony_ci
26262306a36Sopenharmony_ci/* 1 (64-bit) register for Output Queue Packet Count Interrupt Threshold
26362306a36Sopenharmony_ci * & Time Threshold. The same setting applies to all 32 queues.
26462306a36Sopenharmony_ci * The register is defined as a 64-bit registers, but we use the
26562306a36Sopenharmony_ci * 32-bit offsets to define distinct addresses.
26662306a36Sopenharmony_ci */
26762306a36Sopenharmony_ci#define    CN6XXX_SLI_OQ_INT_LEVEL_PKTS          0x1120
26862306a36Sopenharmony_ci#define    CN6XXX_SLI_OQ_INT_LEVEL_TIME          0x1124
26962306a36Sopenharmony_ci
27062306a36Sopenharmony_ci/* 1 (64-bit register) for Output Queue backpressure across all rings. */
27162306a36Sopenharmony_ci#define    CN6XXX_SLI_OQ_WMARK                   0x1180
27262306a36Sopenharmony_ci
27362306a36Sopenharmony_ci/* 1 register to control output queue global backpressure & ring enable. */
27462306a36Sopenharmony_ci#define    CN6XXX_SLI_PKT_CTL                    0x1220
27562306a36Sopenharmony_ci
27662306a36Sopenharmony_ci/*------- Output Queue Macros ---------*/
27762306a36Sopenharmony_ci#define    CN6XXX_SLI_OQ_BASE_ADDR64(oq)          \
27862306a36Sopenharmony_ci	(CN6XXX_SLI_OQ_BASE_ADDR_START64 + ((oq) * CN6XXX_OQ_OFFSET))
27962306a36Sopenharmony_ci
28062306a36Sopenharmony_ci#define    CN6XXX_SLI_OQ_SIZE(oq)                 \
28162306a36Sopenharmony_ci	(CN6XXX_SLI_OQ_SIZE_START + ((oq) * CN6XXX_OQ_OFFSET))
28262306a36Sopenharmony_ci
28362306a36Sopenharmony_ci#define    CN6XXX_SLI_OQ_BUFF_INFO_SIZE(oq)                 \
28462306a36Sopenharmony_ci	(CN6XXX_SLI_OQ0_BUFF_INFO_SIZE + ((oq) * CN6XXX_OQ_OFFSET))
28562306a36Sopenharmony_ci
28662306a36Sopenharmony_ci#define    CN6XXX_SLI_OQ_PKTS_SENT(oq)            \
28762306a36Sopenharmony_ci	(CN6XXX_SLI_OQ_PKT_SENT_START + ((oq) * CN6XXX_OQ_OFFSET))
28862306a36Sopenharmony_ci
28962306a36Sopenharmony_ci#define    CN6XXX_SLI_OQ_PKTS_CREDIT(oq)          \
29062306a36Sopenharmony_ci	(CN6XXX_SLI_OQ_PKT_CREDITS_START + ((oq) * CN6XXX_OQ_OFFSET))
29162306a36Sopenharmony_ci
29262306a36Sopenharmony_ci/*######################### DMA Counters #########################*/
29362306a36Sopenharmony_ci
29462306a36Sopenharmony_ci/* 2 registers (64-bit) - DMA Count - 1 for each DMA counter 0/1. */
29562306a36Sopenharmony_ci#define    CN6XXX_DMA_CNT_START                   0x0400
29662306a36Sopenharmony_ci
29762306a36Sopenharmony_ci/* 2 registers (64-bit) - DMA Timer 0/1, contains DMA timer values
29862306a36Sopenharmony_ci * SLI_DMA_0_TIM
29962306a36Sopenharmony_ci */
30062306a36Sopenharmony_ci#define    CN6XXX_DMA_TIM_START                   0x0420
30162306a36Sopenharmony_ci
30262306a36Sopenharmony_ci/* 2 registers (64-bit) - DMA count & Time Interrupt threshold -
30362306a36Sopenharmony_ci * SLI_DMA_0_INT_LEVEL
30462306a36Sopenharmony_ci */
30562306a36Sopenharmony_ci#define    CN6XXX_DMA_INT_LEVEL_START             0x03E0
30662306a36Sopenharmony_ci
30762306a36Sopenharmony_ci/* Each DMA register is at a 16-byte Offset in BAR0 */
30862306a36Sopenharmony_ci#define    CN6XXX_DMA_OFFSET                      0x10
30962306a36Sopenharmony_ci
31062306a36Sopenharmony_ci/*---------- DMA Counter Macros ---------*/
31162306a36Sopenharmony_ci#define    CN6XXX_DMA_CNT(dq)                      \
31262306a36Sopenharmony_ci	(CN6XXX_DMA_CNT_START + ((dq) * CN6XXX_DMA_OFFSET))
31362306a36Sopenharmony_ci
31462306a36Sopenharmony_ci#define    CN6XXX_DMA_INT_LEVEL(dq)                \
31562306a36Sopenharmony_ci	(CN6XXX_DMA_INT_LEVEL_START + ((dq) * CN6XXX_DMA_OFFSET))
31662306a36Sopenharmony_ci
31762306a36Sopenharmony_ci#define    CN6XXX_DMA_PKT_INT_LEVEL(dq)            \
31862306a36Sopenharmony_ci	(CN6XXX_DMA_INT_LEVEL_START + ((dq) * CN6XXX_DMA_OFFSET))
31962306a36Sopenharmony_ci
32062306a36Sopenharmony_ci#define    CN6XXX_DMA_TIME_INT_LEVEL(dq)           \
32162306a36Sopenharmony_ci	(CN6XXX_DMA_INT_LEVEL_START + 4 + ((dq) * CN6XXX_DMA_OFFSET))
32262306a36Sopenharmony_ci
32362306a36Sopenharmony_ci#define    CN6XXX_DMA_TIM(dq)                      \
32462306a36Sopenharmony_ci	(CN6XXX_DMA_TIM_START + ((dq) * CN6XXX_DMA_OFFSET))
32562306a36Sopenharmony_ci
32662306a36Sopenharmony_ci/*######################## INTERRUPTS #########################*/
32762306a36Sopenharmony_ci
32862306a36Sopenharmony_ci/* 1 register (64-bit) for Interrupt Summary */
32962306a36Sopenharmony_ci#define    CN6XXX_SLI_INT_SUM64                  0x0330
33062306a36Sopenharmony_ci
33162306a36Sopenharmony_ci/* 1 register (64-bit) for Interrupt Enable */
33262306a36Sopenharmony_ci#define    CN6XXX_SLI_INT_ENB64_PORT0            0x0340
33362306a36Sopenharmony_ci#define    CN6XXX_SLI_INT_ENB64_PORT1            0x0350
33462306a36Sopenharmony_ci
33562306a36Sopenharmony_ci/* 1 register (32-bit) to enable Output Queue Packet/Byte Count Interrupt */
33662306a36Sopenharmony_ci#define    CN6XXX_SLI_PKT_CNT_INT_ENB            0x1150
33762306a36Sopenharmony_ci
33862306a36Sopenharmony_ci/* 1 register (32-bit) to enable Output Queue Packet Timer Interrupt */
33962306a36Sopenharmony_ci#define    CN6XXX_SLI_PKT_TIME_INT_ENB           0x1160
34062306a36Sopenharmony_ci
34162306a36Sopenharmony_ci/* 1 register (32-bit) to indicate which Output Queue reached pkt threshold */
34262306a36Sopenharmony_ci#define    CN6XXX_SLI_PKT_CNT_INT                0x1130
34362306a36Sopenharmony_ci
34462306a36Sopenharmony_ci/* 1 register (32-bit) to indicate which Output Queue reached time threshold */
34562306a36Sopenharmony_ci#define    CN6XXX_SLI_PKT_TIME_INT               0x1140
34662306a36Sopenharmony_ci
34762306a36Sopenharmony_ci/*------------------ Interrupt Masks ----------------*/
34862306a36Sopenharmony_ci
34962306a36Sopenharmony_ci#define    CN6XXX_INTR_RML_TIMEOUT_ERR           BIT(1)
35062306a36Sopenharmony_ci#define    CN6XXX_INTR_BAR0_RW_TIMEOUT_ERR       BIT(2)
35162306a36Sopenharmony_ci#define    CN6XXX_INTR_IO2BIG_ERR                BIT(3)
35262306a36Sopenharmony_ci#define    CN6XXX_INTR_PKT_COUNT                 BIT(4)
35362306a36Sopenharmony_ci#define    CN6XXX_INTR_PKT_TIME                  BIT(5)
35462306a36Sopenharmony_ci#define    CN6XXX_INTR_M0UPB0_ERR                BIT(8)
35562306a36Sopenharmony_ci#define    CN6XXX_INTR_M0UPWI_ERR                BIT(9)
35662306a36Sopenharmony_ci#define    CN6XXX_INTR_M0UNB0_ERR                BIT(10)
35762306a36Sopenharmony_ci#define    CN6XXX_INTR_M0UNWI_ERR                BIT(11)
35862306a36Sopenharmony_ci#define    CN6XXX_INTR_M1UPB0_ERR                BIT(12)
35962306a36Sopenharmony_ci#define    CN6XXX_INTR_M1UPWI_ERR                BIT(13)
36062306a36Sopenharmony_ci#define    CN6XXX_INTR_M1UNB0_ERR                BIT(14)
36162306a36Sopenharmony_ci#define    CN6XXX_INTR_M1UNWI_ERR                BIT(15)
36262306a36Sopenharmony_ci#define    CN6XXX_INTR_MIO_INT0                  BIT(16)
36362306a36Sopenharmony_ci#define    CN6XXX_INTR_MIO_INT1                  BIT(17)
36462306a36Sopenharmony_ci#define    CN6XXX_INTR_MAC_INT0                  BIT(18)
36562306a36Sopenharmony_ci#define    CN6XXX_INTR_MAC_INT1                  BIT(19)
36662306a36Sopenharmony_ci
36762306a36Sopenharmony_ci#define    CN6XXX_INTR_DMA0_FORCE                BIT_ULL(32)
36862306a36Sopenharmony_ci#define    CN6XXX_INTR_DMA1_FORCE                BIT_ULL(33)
36962306a36Sopenharmony_ci#define    CN6XXX_INTR_DMA0_COUNT                BIT_ULL(34)
37062306a36Sopenharmony_ci#define    CN6XXX_INTR_DMA1_COUNT                BIT_ULL(35)
37162306a36Sopenharmony_ci#define    CN6XXX_INTR_DMA0_TIME                 BIT_ULL(36)
37262306a36Sopenharmony_ci#define    CN6XXX_INTR_DMA1_TIME                 BIT_ULL(37)
37362306a36Sopenharmony_ci#define    CN6XXX_INTR_INSTR_DB_OF_ERR           BIT_ULL(48)
37462306a36Sopenharmony_ci#define    CN6XXX_INTR_SLIST_DB_OF_ERR           BIT_ULL(49)
37562306a36Sopenharmony_ci#define    CN6XXX_INTR_POUT_ERR                  BIT_ULL(50)
37662306a36Sopenharmony_ci#define    CN6XXX_INTR_PIN_BP_ERR                BIT_ULL(51)
37762306a36Sopenharmony_ci#define    CN6XXX_INTR_PGL_ERR                   BIT_ULL(52)
37862306a36Sopenharmony_ci#define    CN6XXX_INTR_PDI_ERR                   BIT_ULL(53)
37962306a36Sopenharmony_ci#define    CN6XXX_INTR_POP_ERR                   BIT_ULL(54)
38062306a36Sopenharmony_ci#define    CN6XXX_INTR_PINS_ERR                  BIT_ULL(55)
38162306a36Sopenharmony_ci#define    CN6XXX_INTR_SPRT0_ERR                 BIT_ULL(56)
38262306a36Sopenharmony_ci#define    CN6XXX_INTR_SPRT1_ERR                 BIT_ULL(57)
38362306a36Sopenharmony_ci#define    CN6XXX_INTR_ILL_PAD_ERR               BIT_ULL(60)
38462306a36Sopenharmony_ci
38562306a36Sopenharmony_ci#define    CN6XXX_INTR_DMA0_DATA                 (CN6XXX_INTR_DMA0_TIME)
38662306a36Sopenharmony_ci
38762306a36Sopenharmony_ci#define    CN6XXX_INTR_DMA1_DATA                 (CN6XXX_INTR_DMA1_TIME)
38862306a36Sopenharmony_ci
38962306a36Sopenharmony_ci#define    CN6XXX_INTR_DMA_DATA                  \
39062306a36Sopenharmony_ci	(CN6XXX_INTR_DMA0_DATA | CN6XXX_INTR_DMA1_DATA)
39162306a36Sopenharmony_ci
39262306a36Sopenharmony_ci#define    CN6XXX_INTR_PKT_DATA                  (CN6XXX_INTR_PKT_TIME | \
39362306a36Sopenharmony_ci						  CN6XXX_INTR_PKT_COUNT)
39462306a36Sopenharmony_ci
39562306a36Sopenharmony_ci/* Sum of interrupts for all PCI-Express Data Interrupts */
39662306a36Sopenharmony_ci#define    CN6XXX_INTR_PCIE_DATA                 \
39762306a36Sopenharmony_ci	(CN6XXX_INTR_DMA_DATA | CN6XXX_INTR_PKT_DATA)
39862306a36Sopenharmony_ci
39962306a36Sopenharmony_ci#define    CN6XXX_INTR_MIO                       \
40062306a36Sopenharmony_ci	(CN6XXX_INTR_MIO_INT0 | CN6XXX_INTR_MIO_INT1)
40162306a36Sopenharmony_ci
40262306a36Sopenharmony_ci#define    CN6XXX_INTR_MAC                       \
40362306a36Sopenharmony_ci	(CN6XXX_INTR_MAC_INT0 | CN6XXX_INTR_MAC_INT1)
40462306a36Sopenharmony_ci
40562306a36Sopenharmony_ci/* Sum of interrupts for error events */
40662306a36Sopenharmony_ci#define    CN6XXX_INTR_ERR                       \
40762306a36Sopenharmony_ci	(CN6XXX_INTR_BAR0_RW_TIMEOUT_ERR    \
40862306a36Sopenharmony_ci	   | CN6XXX_INTR_IO2BIG_ERR             \
40962306a36Sopenharmony_ci	   | CN6XXX_INTR_M0UPB0_ERR             \
41062306a36Sopenharmony_ci	   | CN6XXX_INTR_M0UPWI_ERR             \
41162306a36Sopenharmony_ci	   | CN6XXX_INTR_M0UNB0_ERR             \
41262306a36Sopenharmony_ci	   | CN6XXX_INTR_M0UNWI_ERR             \
41362306a36Sopenharmony_ci	   | CN6XXX_INTR_M1UPB0_ERR             \
41462306a36Sopenharmony_ci	   | CN6XXX_INTR_M1UPWI_ERR             \
41562306a36Sopenharmony_ci	   | CN6XXX_INTR_M1UNB0_ERR             \
41662306a36Sopenharmony_ci	   | CN6XXX_INTR_M1UNWI_ERR             \
41762306a36Sopenharmony_ci	   | CN6XXX_INTR_INSTR_DB_OF_ERR        \
41862306a36Sopenharmony_ci	   | CN6XXX_INTR_SLIST_DB_OF_ERR        \
41962306a36Sopenharmony_ci	   | CN6XXX_INTR_POUT_ERR               \
42062306a36Sopenharmony_ci	   | CN6XXX_INTR_PIN_BP_ERR             \
42162306a36Sopenharmony_ci	   | CN6XXX_INTR_PGL_ERR                \
42262306a36Sopenharmony_ci	   | CN6XXX_INTR_PDI_ERR                \
42362306a36Sopenharmony_ci	   | CN6XXX_INTR_POP_ERR                \
42462306a36Sopenharmony_ci	   | CN6XXX_INTR_PINS_ERR               \
42562306a36Sopenharmony_ci	   | CN6XXX_INTR_SPRT0_ERR              \
42662306a36Sopenharmony_ci	   | CN6XXX_INTR_SPRT1_ERR              \
42762306a36Sopenharmony_ci	   | CN6XXX_INTR_ILL_PAD_ERR)
42862306a36Sopenharmony_ci
42962306a36Sopenharmony_ci/* Programmed Mask for Interrupt Sum */
43062306a36Sopenharmony_ci#define    CN6XXX_INTR_MASK                      \
43162306a36Sopenharmony_ci	(CN6XXX_INTR_PCIE_DATA              \
43262306a36Sopenharmony_ci	   | CN6XXX_INTR_DMA0_FORCE             \
43362306a36Sopenharmony_ci	   | CN6XXX_INTR_DMA1_FORCE             \
43462306a36Sopenharmony_ci	   | CN6XXX_INTR_MIO                    \
43562306a36Sopenharmony_ci	   | CN6XXX_INTR_MAC                    \
43662306a36Sopenharmony_ci	   | CN6XXX_INTR_ERR)
43762306a36Sopenharmony_ci
43862306a36Sopenharmony_ci#define    CN6XXX_SLI_S2M_PORT0_CTL              0x3D80
43962306a36Sopenharmony_ci#define    CN6XXX_SLI_S2M_PORT1_CTL              0x3D90
44062306a36Sopenharmony_ci#define    CN6XXX_SLI_S2M_PORTX_CTL(port)        \
44162306a36Sopenharmony_ci	(CN6XXX_SLI_S2M_PORT0_CTL + ((port) * 0x10))
44262306a36Sopenharmony_ci
44362306a36Sopenharmony_ci#define    CN6XXX_SLI_INT_ENB64(port)            \
44462306a36Sopenharmony_ci	(CN6XXX_SLI_INT_ENB64_PORT0 + ((port) * 0x10))
44562306a36Sopenharmony_ci
44662306a36Sopenharmony_ci#define    CN6XXX_SLI_MAC_NUMBER                 0x3E00
44762306a36Sopenharmony_ci
44862306a36Sopenharmony_ci/* CN6XXX BAR1 Index registers. */
44962306a36Sopenharmony_ci#define    CN6XXX_PEM_BAR1_INDEX000                0x00011800C00000A8ULL
45062306a36Sopenharmony_ci#define    CN6XXX_PEM_OFFSET                       0x0000000001000000ULL
45162306a36Sopenharmony_ci
45262306a36Sopenharmony_ci#define    CN6XXX_BAR1_INDEX_START                 CN6XXX_PEM_BAR1_INDEX000
45362306a36Sopenharmony_ci#define    CN6XXX_PCI_BAR1_OFFSET                  0x8
45462306a36Sopenharmony_ci
45562306a36Sopenharmony_ci#define    CN6XXX_BAR1_REG(idx, port) \
45662306a36Sopenharmony_ci		(CN6XXX_BAR1_INDEX_START + ((port) * CN6XXX_PEM_OFFSET) + \
45762306a36Sopenharmony_ci		(CN6XXX_PCI_BAR1_OFFSET * (idx)))
45862306a36Sopenharmony_ci
45962306a36Sopenharmony_ci/*############################ DPI #########################*/
46062306a36Sopenharmony_ci
46162306a36Sopenharmony_ci#define    CN6XXX_DPI_CTL                 0x0001df0000000040ULL
46262306a36Sopenharmony_ci
46362306a36Sopenharmony_ci#define    CN6XXX_DPI_DMA_CONTROL         0x0001df0000000048ULL
46462306a36Sopenharmony_ci
46562306a36Sopenharmony_ci#define    CN6XXX_DPI_REQ_GBL_ENB         0x0001df0000000050ULL
46662306a36Sopenharmony_ci
46762306a36Sopenharmony_ci#define    CN6XXX_DPI_REQ_ERR_RSP         0x0001df0000000058ULL
46862306a36Sopenharmony_ci
46962306a36Sopenharmony_ci#define    CN6XXX_DPI_REQ_ERR_RST         0x0001df0000000060ULL
47062306a36Sopenharmony_ci
47162306a36Sopenharmony_ci#define    CN6XXX_DPI_DMA_ENG0_ENB        0x0001df0000000080ULL
47262306a36Sopenharmony_ci
47362306a36Sopenharmony_ci#define    CN6XXX_DPI_DMA_ENG_ENB(q_no)   \
47462306a36Sopenharmony_ci	(CN6XXX_DPI_DMA_ENG0_ENB + ((q_no) * 8))
47562306a36Sopenharmony_ci
47662306a36Sopenharmony_ci#define    CN6XXX_DPI_DMA_ENG0_BUF        0x0001df0000000880ULL
47762306a36Sopenharmony_ci
47862306a36Sopenharmony_ci#define    CN6XXX_DPI_DMA_ENG_BUF(q_no)   \
47962306a36Sopenharmony_ci	(CN6XXX_DPI_DMA_ENG0_BUF + ((q_no) * 8))
48062306a36Sopenharmony_ci
48162306a36Sopenharmony_ci#define    CN6XXX_DPI_SLI_PRT0_CFG        0x0001df0000000900ULL
48262306a36Sopenharmony_ci#define    CN6XXX_DPI_SLI_PRT1_CFG        0x0001df0000000908ULL
48362306a36Sopenharmony_ci#define    CN6XXX_DPI_SLI_PRTX_CFG(port)        \
48462306a36Sopenharmony_ci	(CN6XXX_DPI_SLI_PRT0_CFG + ((port) * 0x10))
48562306a36Sopenharmony_ci
48662306a36Sopenharmony_ci#define    CN6XXX_DPI_DMA_COMMIT_MODE     BIT_ULL(58)
48762306a36Sopenharmony_ci#define    CN6XXX_DPI_DMA_PKT_HP          BIT_ULL(57)
48862306a36Sopenharmony_ci#define    CN6XXX_DPI_DMA_PKT_EN          BIT_ULL(56)
48962306a36Sopenharmony_ci#define    CN6XXX_DPI_DMA_O_ES            BIT_ULL(15)
49062306a36Sopenharmony_ci#define    CN6XXX_DPI_DMA_O_MODE          BIT_ULL(14)
49162306a36Sopenharmony_ci
49262306a36Sopenharmony_ci#define    CN6XXX_DPI_DMA_CTL_MASK             \
49362306a36Sopenharmony_ci	(CN6XXX_DPI_DMA_COMMIT_MODE    |    \
49462306a36Sopenharmony_ci	 CN6XXX_DPI_DMA_PKT_HP         |    \
49562306a36Sopenharmony_ci	 CN6XXX_DPI_DMA_PKT_EN         |    \
49662306a36Sopenharmony_ci	 CN6XXX_DPI_DMA_O_ES           |    \
49762306a36Sopenharmony_ci	 CN6XXX_DPI_DMA_O_MODE)
49862306a36Sopenharmony_ci
49962306a36Sopenharmony_ci/*############################ CIU #########################*/
50062306a36Sopenharmony_ci
50162306a36Sopenharmony_ci#define    CN6XXX_CIU_SOFT_BIST           0x0001070000000738ULL
50262306a36Sopenharmony_ci#define    CN6XXX_CIU_SOFT_RST            0x0001070000000740ULL
50362306a36Sopenharmony_ci
50462306a36Sopenharmony_ci/*############################ MIO #########################*/
50562306a36Sopenharmony_ci#define    CN6XXX_MIO_PTP_CLOCK_CFG       0x0001070000000f00ULL
50662306a36Sopenharmony_ci#define    CN6XXX_MIO_PTP_CLOCK_LO        0x0001070000000f08ULL
50762306a36Sopenharmony_ci#define    CN6XXX_MIO_PTP_CLOCK_HI        0x0001070000000f10ULL
50862306a36Sopenharmony_ci#define    CN6XXX_MIO_PTP_CLOCK_COMP      0x0001070000000f18ULL
50962306a36Sopenharmony_ci#define    CN6XXX_MIO_PTP_TIMESTAMP       0x0001070000000f20ULL
51062306a36Sopenharmony_ci#define    CN6XXX_MIO_PTP_EVT_CNT         0x0001070000000f28ULL
51162306a36Sopenharmony_ci#define    CN6XXX_MIO_PTP_CKOUT_THRESH_LO 0x0001070000000f30ULL
51262306a36Sopenharmony_ci#define    CN6XXX_MIO_PTP_CKOUT_THRESH_HI 0x0001070000000f38ULL
51362306a36Sopenharmony_ci#define    CN6XXX_MIO_PTP_CKOUT_HI_INCR   0x0001070000000f40ULL
51462306a36Sopenharmony_ci#define    CN6XXX_MIO_PTP_CKOUT_LO_INCR   0x0001070000000f48ULL
51562306a36Sopenharmony_ci#define    CN6XXX_MIO_PTP_PPS_THRESH_LO   0x0001070000000f50ULL
51662306a36Sopenharmony_ci#define    CN6XXX_MIO_PTP_PPS_THRESH_HI   0x0001070000000f58ULL
51762306a36Sopenharmony_ci#define    CN6XXX_MIO_PTP_PPS_HI_INCR     0x0001070000000f60ULL
51862306a36Sopenharmony_ci#define    CN6XXX_MIO_PTP_PPS_LO_INCR     0x0001070000000f68ULL
51962306a36Sopenharmony_ci
52062306a36Sopenharmony_ci#define    CN6XXX_MIO_QLM4_CFG            0x00011800000015B0ULL
52162306a36Sopenharmony_ci#define    CN6XXX_MIO_RST_BOOT            0x0001180000001600ULL
52262306a36Sopenharmony_ci
52362306a36Sopenharmony_ci#define    CN6XXX_MIO_QLM_CFG_MASK        0x7
52462306a36Sopenharmony_ci
52562306a36Sopenharmony_ci/*############################ LMC #########################*/
52662306a36Sopenharmony_ci
52762306a36Sopenharmony_ci#define    CN6XXX_LMC0_RESET_CTL               0x0001180088000180ULL
52862306a36Sopenharmony_ci#define    CN6XXX_LMC0_RESET_CTL_DDR3RST_MASK  0x0000000000000001ULL
52962306a36Sopenharmony_ci
53062306a36Sopenharmony_ci#endif
531