mips: octeon: Add ethernet support
Subsystems (2)
cover mips: octeon: Add ethernet support
This patchset adds the networking files and drivers including device helper headers and C files. Please excuse the massive amount of files in this patch series. Also the sometimes huge files (mostly headers with register definitions) that I needed to include.
The infrastructure code with all the headers is ported mistly without any intended functional changes from the 2013 Cavium / Marvell U-Boot version. It has undergone many hours of extensive code cleanup and reformatting. Some of it done by using tools (checkpatch, Lindent, clang format etc) and also some of it done manually, as I couldn't find some tools that could do the needed work in a reliable and functional way. The result is that checkpatch now only throws a "few" warnings that are left. Some of those can't be removed without an even more extensive cleanup / rewrite of the code, like the addition of typedefs.
The added header, helper and infrastructure files in the first part of the patch-series (patches 1-43) are the foundation, that is used by the main Octeon U-Boot ethernet driver (patch 50/52). Patches 47-49 add the DT nodes and properties to the corresponding dtsi / dts files. Patches 51 & 52 finally enable the ethernet support both MIPS Octeon boards, EBB7304 & NIC23.
All this is tested on the 2 Cavium / Marvell MIPS Octeon boards:
EBB7304 & NIC23
This patchset including the small Marvell PHY patches is available in this gitlab branch:
https://source.denx.de/u-boot/custodians/u-boot-marvell/-/tree/mips-octeon-ethernet-v1-2022-03-30
Thanks,
Stefan
Aaron Williams (40):
mips: octeon: Add misc cvmx-* header files
mips: octeon: Add cvmx-ilk-defs.h header file
mips: octeon: Add cvmx-iob-defs.h header file
mips: octeon: Add cvmx-lbk-defs.h header file
mips: octeon: Add cvmx-npei-defs.h header file
mips: octeon: Add cvmx-pcsxx-defs.h header file
mips: octeon: Add cvmx-xcv-defs.h header file
mips: octeon: Add cvmx-helper-agl.c
mips: octeon: Add cvmx-helper-bgx.c
mips: octeon: Add cvmx-helper-board.c
mips: octeon: Add cvmx-helper-fpa.c
mips: octeon: Add cvmx-helper-igl.c
mips: octeon: Add cvmx-helper-ipd.c
mips: octeon: Add cvmx-helper-loop.c
mips: octeon: Add cvmx-helper-npi.c
mips: octeon: Add cvmx-helper-pki.c
mips: octeon: Add cvmx-helper-pko.c
mips: octeon: Add cvmx-helper-pko3.c
mips: octeon: Add cvmx-helper-rgmii.c
mips: octeon: Add cvmx-helper-sgmii.c
mips: octeon: Add cvmx-helper-sfp.c
mips: octeon: Add cvmx-helper-xaui.c
mips: octeon: Add cvmx-agl.c
mips: octeon: Add cvmx-cmd-queue.c
mips: octeon: Add cvmx-fau-compat.c
mips: octeon: Add cvmx-fpa.c
mips: octeon: Add cvmx-fpa-resource.c
mips: octeon: Add cvmx-global-resource.c
mips: octeon: Add cvmx-ilk.c
mips: octeon: Add cvmx-ipd.c
mips: octeon: Add cvmx-pki.c
mips: octeon: Add cvmx-pki-resources.c
mips: octeon: Add cvmx-pko.c
mips: octeon: Add cvmx-pko3.c
mips: octeon: Add cvmx-pko3-queue.c
mips: octeon: Add cvmx-pko3-compat.c
mips: octeon: Add cvmx-pko3-resources.c
mips: octeon: Add cvmx-pko-internal-ports-range.c
mips: octeon: Add cvmx-qlm-tables.c
mips: octeon: Add cvmx-range.c
Stefan Roese (12):
mips: octeon: Misc changes to existing headers for upcoming eth
support
mips: octeon: Misc changes to existing C files for upcoming eth
support
mips: octeon: Makefile: Enable building of the newly added C files
mips: octeon: cpu.c: Move bootmem init to arch_early_init_r()
mips: octeon: cpu.c: Implement configure_lmtdma_window()
mips: octeon: octeon_common.h: Move init SP because of increased image
size
mips: octeon: mrvl,cn73xx.dtsi: Add ethernet (BGX) and SMI DT nodes
mips: octeon: mrvl,octeon-ebb7304.dts: Add ethernet DT support
mips: octeon: mrvl,octeon-nic23.dts: Add ethernet DT support
net: Add ethernet support for MIPS Octeon
mips: octeon: ebb7304: Enable ethernet support
mips: octeon: nic23: Enable ethernet support
arch/mips/Kconfig | 1 + arch/mips/dts/mrvl,cn73xx.dtsi | 35 + arch/mips/dts/mrvl,octeon-ebb7304.dts | 45 + arch/mips/dts/mrvl,octeon-nic23.dts | 238 ++ arch/mips/mach-octeon/Makefile | 35 +- arch/mips/mach-octeon/cpu.c | 47 +- arch/mips/mach-octeon/cvmx-agl.c | 216 + arch/mips/mach-octeon/cvmx-bootmem.c | 3 +- arch/mips/mach-octeon/cvmx-cmd-queue.c | 449 +++ arch/mips/mach-octeon/cvmx-fau-compat.c | 53 + arch/mips/mach-octeon/cvmx-fpa-resource.c | 305 ++ arch/mips/mach-octeon/cvmx-fpa.c | 1672 ++++++++ arch/mips/mach-octeon/cvmx-global-resources.c | 639 +++ arch/mips/mach-octeon/cvmx-helper-agl.c | 231 ++ arch/mips/mach-octeon/cvmx-helper-bgx.c | 3215 +++++++++++++++ arch/mips/mach-octeon/cvmx-helper-board.c | 2030 ++++++++++ arch/mips/mach-octeon/cvmx-helper-cfg.c | 67 +- arch/mips/mach-octeon/cvmx-helper-fdt.c | 645 ++- arch/mips/mach-octeon/cvmx-helper-fpa.c | 329 ++ arch/mips/mach-octeon/cvmx-helper-ilk.c | 926 +++++ arch/mips/mach-octeon/cvmx-helper-ipd.c | 313 ++ arch/mips/mach-octeon/cvmx-helper-loop.c | 178 + arch/mips/mach-octeon/cvmx-helper-npi.c | 146 + arch/mips/mach-octeon/cvmx-helper-pki.c | 2156 ++++++++++ arch/mips/mach-octeon/cvmx-helper-pko.c | 312 ++ arch/mips/mach-octeon/cvmx-helper-pko3.c | 1252 ++++++ arch/mips/mach-octeon/cvmx-helper-rgmii.c | 431 ++ arch/mips/mach-octeon/cvmx-helper-sfp.c | 1877 +++++++++ arch/mips/mach-octeon/cvmx-helper-sgmii.c | 781 ++++ arch/mips/mach-octeon/cvmx-helper-xaui.c | 587 +++ arch/mips/mach-octeon/cvmx-helper.c | 45 +- arch/mips/mach-octeon/cvmx-ilk.c | 1618 ++++++++ arch/mips/mach-octeon/cvmx-ipd.c | 690 ++++ arch/mips/mach-octeon/cvmx-pki-resources.c | 519 +++ arch/mips/mach-octeon/cvmx-pki.c | 1619 ++++++++ .../cvmx-pko-internal-ports-range.c | 164 + arch/mips/mach-octeon/cvmx-pko.c | 1110 ++++++ arch/mips/mach-octeon/cvmx-pko3-compat.c | 656 +++ arch/mips/mach-octeon/cvmx-pko3-queue.c | 1331 ++++++ arch/mips/mach-octeon/cvmx-pko3-resources.c | 229 ++ arch/mips/mach-octeon/cvmx-pko3.c | 2143 ++++++++++ arch/mips/mach-octeon/cvmx-qlm-tables.c | 292 ++ arch/mips/mach-octeon/cvmx-range.c | 344 ++ arch/mips/mach-octeon/include/mach/cvmx-agl.h | 45 + .../mach-octeon/include/mach/cvmx-bootmem.h | 3 +- .../mach-octeon/include/mach/cvmx-config.h | 128 + arch/mips/mach-octeon/include/mach/cvmx-fau.h | 581 +++ arch/mips/mach-octeon/include/mach/cvmx-fpa.h | 3 +- .../mips/mach-octeon/include/mach/cvmx-fpa3.h | 37 - .../include/mach/cvmx-helper-board.h | 6 +- .../include/mach/cvmx-helper-fdt.h | 40 +- .../include/mach/cvmx-helper-pko.h | 2 +- .../mach-octeon/include/mach/cvmx-helper.h | 20 + .../mach-octeon/include/mach/cvmx-ilk-defs.h | 2269 +++++++++++ .../mach-octeon/include/mach/cvmx-iob-defs.h | 1328 ++++++ .../mach-octeon/include/mach/cvmx-lbk-defs.h | 157 + .../mips/mach-octeon/include/mach/cvmx-mdio.h | 516 +++ .../mach-octeon/include/mach/cvmx-npei-defs.h | 3550 +++++++++++++++++ .../include/mach/cvmx-pcsxx-defs.h | 787 ++++ .../include/mach/cvmx-pki-cluster.h | 343 ++ arch/mips/mach-octeon/include/mach/cvmx-pko.h | 213 + .../include/mach/cvmx-pko3-resources.h | 36 + .../mips/mach-octeon/include/mach/cvmx-pko3.h | 1052 +++++ .../mach-octeon/include/mach/cvmx-range.h | 23 + .../mips/mach-octeon/include/mach/cvmx-regs.h | 100 +- .../mach-octeon/include/mach/cvmx-xcv-defs.h | 226 ++ .../mach-octeon/include/mach/octeon_eth.h | 54 +- board/Marvell/octeon_nic23/board.c | 87 +- configs/octeon_ebb7304_defconfig | 7 + configs/octeon_nic23_defconfig | 10 +- drivers/net/Kconfig | 7 + drivers/net/Makefile | 1 + drivers/net/octeon/Makefile | 6 + drivers/net/octeon/octeon_eth.c | 1060 +++++ drivers/net/octeon/octeon_mdio.c | 226 ++ include/configs/octeon_common.h | 2 +- include/configs/octeon_ebb7304.h | 2 + 77 files changed, 42315 insertions(+), 586 deletions(-) create mode 100644 arch/mips/mach-octeon/cvmx-agl.c create mode 100644 arch/mips/mach-octeon/cvmx-cmd-queue.c create mode 100644 arch/mips/mach-octeon/cvmx-fau-compat.c create mode 100644 arch/mips/mach-octeon/cvmx-fpa-resource.c create mode 100644 arch/mips/mach-octeon/cvmx-fpa.c create mode 100644 arch/mips/mach-octeon/cvmx-global-resources.c create mode 100644 arch/mips/mach-octeon/cvmx-helper-agl.c create mode 100644 arch/mips/mach-octeon/cvmx-helper-bgx.c create mode 100644 arch/mips/mach-octeon/cvmx-helper-board.c create mode 100644 arch/mips/mach-octeon/cvmx-helper-fpa.c create mode 100644 arch/mips/mach-octeon/cvmx-helper-ilk.c create mode 100644 arch/mips/mach-octeon/cvmx-helper-ipd.c create mode 100644 arch/mips/mach-octeon/cvmx-helper-loop.c create mode 100644 arch/mips/mach-octeon/cvmx-helper-npi.c create mode 100644 arch/mips/mach-octeon/cvmx-helper-pki.c create mode 100644 arch/mips/mach-octeon/cvmx-helper-pko.c create mode 100644 arch/mips/mach-octeon/cvmx-helper-pko3.c create mode 100644 arch/mips/mach-octeon/cvmx-helper-rgmii.c create mode 100644 arch/mips/mach-octeon/cvmx-helper-sfp.c create mode 100644 arch/mips/mach-octeon/cvmx-helper-sgmii.c create mode 100644 arch/mips/mach-octeon/cvmx-helper-xaui.c create mode 100644 arch/mips/mach-octeon/cvmx-ilk.c create mode 100644 arch/mips/mach-octeon/cvmx-ipd.c create mode 100644 arch/mips/mach-octeon/cvmx-pki-resources.c create mode 100644 arch/mips/mach-octeon/cvmx-pki.c create mode 100644 arch/mips/mach-octeon/cvmx-pko-internal-ports-range.c create mode 100644 arch/mips/mach-octeon/cvmx-pko.c create mode 100644 arch/mips/mach-octeon/cvmx-pko3-compat.c create mode 100644 arch/mips/mach-octeon/cvmx-pko3-queue.c create mode 100644 arch/mips/mach-octeon/cvmx-pko3-resources.c create mode 100644 arch/mips/mach-octeon/cvmx-pko3.c create mode 100644 arch/mips/mach-octeon/cvmx-qlm-tables.c create mode 100644 arch/mips/mach-octeon/cvmx-range.c create mode 100644 arch/mips/mach-octeon/include/mach/cvmx-agl.h create mode 100644 arch/mips/mach-octeon/include/mach/cvmx-config.h create mode 100644 arch/mips/mach-octeon/include/mach/cvmx-fau.h create mode 100644 arch/mips/mach-octeon/include/mach/cvmx-ilk-defs.h create mode 100644 arch/mips/mach-octeon/include/mach/cvmx-iob-defs.h create mode 100644 arch/mips/mach-octeon/include/mach/cvmx-lbk-defs.h create mode 100644 arch/mips/mach-octeon/include/mach/cvmx-mdio.h create mode 100644 arch/mips/mach-octeon/include/mach/cvmx-npei-defs.h create mode 100644 arch/mips/mach-octeon/include/mach/cvmx-pcsxx-defs.h create mode 100644 arch/mips/mach-octeon/include/mach/cvmx-pki-cluster.h create mode 100644 arch/mips/mach-octeon/include/mach/cvmx-pko.h create mode 100644 arch/mips/mach-octeon/include/mach/cvmx-pko3-resources.h create mode 100644 arch/mips/mach-octeon/include/mach/cvmx-pko3.h create mode 100644 arch/mips/mach-octeon/include/mach/cvmx-range.h create mode 100644 arch/mips/mach-octeon/include/mach/cvmx-xcv-defs.h create mode 100644 drivers/net/octeon/Makefile create mode 100644 drivers/net/octeon/octeon_eth.c create mode 100644 drivers/net/octeon/octeon_mdio.c
Signature · 1 line
2.35.1
PATCH 1/52 mips: octeon: Add misc cvmx-* header files
From: Aaron Williams <[email protected]>
Import misc cvmx-helper header files from 2013 U-Boot. They will be used by the later added drivers to support networking on the MIPS Octeon II / III platforms.
--- arch/mips/mach-octeon/include/mach/cvmx-agl.h | 45 + .../mach-octeon/include/mach/cvmx-config.h | 128 ++ arch/mips/mach-octeon/include/mach/cvmx-fau.h | 581 +++++++++ .../mips/mach-octeon/include/mach/cvmx-mdio.h | 516 ++++++++ .../include/mach/cvmx-pki-cluster.h | 343 ++++++ arch/mips/mach-octeon/include/mach/cvmx-pko.h | 213 ++++ .../include/mach/cvmx-pko3-resources.h | 36 + .../mips/mach-octeon/include/mach/cvmx-pko3.h | 1052 +++++++++++++++++ .../mach-octeon/include/mach/cvmx-range.h | 23 + 9 files changed, 2937 insertions(+) create mode 100644 arch/mips/mach-octeon/include/mach/cvmx-agl.h create mode 100644 arch/mips/mach-octeon/include/mach/cvmx-config.h create mode 100644 arch/mips/mach-octeon/include/mach/cvmx-fau.h create mode 100644 arch/mips/mach-octeon/include/mach/cvmx-mdio.h create mode 100644 arch/mips/mach-octeon/include/mach/cvmx-pki-cluster.h create mode 100644 arch/mips/mach-octeon/include/mach/cvmx-pko.h create mode 100644 arch/mips/mach-octeon/include/mach/cvmx-pko3-resources.h create mode 100644 arch/mips/mach-octeon/include/mach/cvmx-pko3.h create mode 100644 arch/mips/mach-octeon/include/mach/cvmx-range.h
arch/mips/mach-octeon/include/mach/cvmx-agl.h new file +45 -0
@@ -0,0 +1,45 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* +* Copyright (C) 2018-2022 Marvell International Ltd. +* +* Functions for AGL (RGMII) commong initialization, configuration. +*/ + +#ifndef __CVMX_AGL_H__ +#define __CVMX_AGL_H__ + +/* +* @param port to enable +* +* @return Zero on success, negative on failure +*/ +int cvmx_agl_enable (int port); + +cvmx_helper_link_info_t cvmx_agl_link_get (int port); + +/* +* Set MII/RGMII link based on mode. +* +* @param port interface port to set the link. +* @param link_info Link status +* +* @return 0 on success and 1 on failure +*/ +int cvmx_agl_link_set (int port,cvmx_helper_link_info_t link_info); + +/** +* Disables the sending of flow control (pause) frames on the specified +* AGL (RGMII) port(s). +* +* @param interface Which interface (0 or 1) +* @param port_mask Mask (4bits) of which ports on the interface to disable +* backpressure on. +* 1 => disable backpressure +* 0 => enable backpressure +* +* @return 0 on success +* -1 on error +*/ +int cvmx_agl_set_backpressure_override (u32 interface,uint32_t port_mask); + +#endif /* __CVMX_AGL_H__ */
arch/mips/mach-octeon/include/mach/cvmx-config.h new file +128 -0
128 lines not on this page · raw message
arch/mips/mach-octeon/include/mach/cvmx-fau.h new file +581 -0
581 lines not on this page · raw message
arch/mips/mach-octeon/include/mach/cvmx-mdio.h new file +516 -0
516 lines not on this page · raw message
arch/mips/mach-octeon/include/mach/cvmx-pki-cluster.h new file +343 -0
343 lines not on this page · raw message
arch/mips/mach-octeon/include/mach/cvmx-pko.h new file +213 -0
213 lines not on this page · raw message
arch/mips/mach-octeon/include/mach/cvmx-pko3-resources.h new file +36 -0
@@ -0,0 +1,36 @@ +// SPDX-License-Identifier: GPL-2.0 +/* +* Copyright (C) 2018-2022 Marvell International Ltd. +*/ + +#ifndef __CVMX_PKO3_RESOURCES_H__ +#define __CVMX_PKO3_RESOURCES_H__ + +/* +* Allocate or reserve contiguous list of PKO queues. +* +* @param node is the node number for PKO queues. +* @param level is the PKO queue level. +* @param owner is the owner of PKO queue resources. +* @param base_queue is the PKO queue base number(specify -1 to allocate). +* @param num_queues is the number of PKO queues that have to be reserved or allocated. +* @return returns queue_base if successful or -1 on failure. +*/ +int cvmx_pko_alloc_queues (int node,int level,int owner,int base_queue, +int num_queues); + +/** +* Free an allocated/reserved PKO queues for a certain level and owner +* +* @param node on which to allocate/reserve PKO queues +* @param level of PKO queue +* @param owner of reserved/allocated resources +* @return 0 on success, -1 on failure +*/ +int cvmx_pko_free_queues (int node,int level,int owner); + +int __cvmx_pko3_dq_param_setup (unsigned node); + +int cvmx_pko3_num_level_queues (enum cvmx_pko3_level_e level); + +#endif /* __CVMX_PKO3_RESOURCES_H__ */
arch/mips/mach-octeon/include/mach/cvmx-pko3.h new file +1052 -0
1,052 lines not on this page · raw message
arch/mips/mach-octeon/include/mach/cvmx-range.h new file +23 -0
@@ -0,0 +1,23 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* +* Copyright (C) 2018-2022 Marvell International Ltd. +*/ + +#ifndef __CVMX_RANGE_H__ +#define __CVMX_RANGE_H__ + +int cvmx_range_init (u64 range_addr,int size); +int cvmx_range_alloc (u64 range_addr,uint64_t owner,uint64_t cnt,int align); +int cvmx_range_alloc_ordered (u64 range_addr,uint64_t owner,u64 cnt,int align, +int reverse); +int cvmx_range_alloc_non_contiguos (u64 range_addr,uint64_t owner,u64 cnt, +int elements[]); +int cvmx_range_reserve (u64 range_addr,uint64_t owner,u64 base,uint64_t cnt); +int cvmx_range_free_with_base (u64 range_addr,int base,int cnt); +int cvmx_range_free_with_owner (u64 range_addr,uint64_t owner); +u64 cvmx_range_get_owner (u64 range_addr,uint64_t base); +void cvmx_range_show (uint64_t range_addr); +int cvmx_range_memory_size (int nelements); +int cvmx_range_free_mutiple (u64 range_addr,int bases[],int count); + +#endif // __CVMX_RANGE_H__
Signature · 1 line
2.35.1
PATCH 2/52 mips: octeon: Add cvmx-ilk-defs.h header file
In reply to Stefan RoeseFrom: Aaron Williams <[email protected]>
Import cvmx-igl-defs.h header file from 2013 U-Boot. It will be used by the later added drivers to support networking on the MIPS Octeon II / III platforms.
--- .../mach-octeon/include/mach/cvmx-ilk-defs.h | 2269 +++++++++++++++++ 1 file changed, 2269 insertions(+) create mode 100644 arch/mips/mach-octeon/include/mach/cvmx-ilk-defs.h
arch/mips/mach-octeon/include/mach/cvmx-ilk-defs.h new file +2269 -0
@@ -0,0 +1,2269 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* +* Copyright (C) 2018-2022 Marvell International Ltd. +* +* Configuration and status register (CSR) type definitions for +* Octeon ilk. +*/ + +#ifndef __CVMX_ILK_DEFS_H__ +#define __CVMX_ILK_DEFS_H__ + +#define CVMX_ILK_BIST_SUM (0x0001180014000038ull) +#define CVMX_ILK_GBL_CFG (0x0001180014000000ull) +#define CVMX_ILK_GBL_ERR_CFG (0x0001180014000058ull) +#define CVMX_ILK_GBL_INT (0x0001180014000008ull) +#define CVMX_ILK_GBL_INT_EN (0x0001180014000010ull) +#define CVMX_ILK_INT_SUM (0x0001180014000030ull) +#define CVMX_ILK_LNEX_TRN_CTL (offset) \ + (0x00011800140380F0ull + ((offset) & 15) * 1024) +#define CVMX_ILK_LNEX_TRN_LD (offset) \ + (0x00011800140380E0ull + ((offset) & 15) * 1024) +#define CVMX_ILK_LNEX_TRN_LP (offset) \ + (0x00011800140380E8ull + ((offset) & 15) * 1024) +#define CVMX_ILK_LNE_DBG (0x0001180014030008ull) +#define CVMX_ILK_LNE_STS_MSG (0x0001180014030000ull) +#define CVMX_ILK_RID_CFG (0x0001180014000050ull) +#define CVMX_ILK_RXF_IDX_PMAP (0x0001180014000020ull) +#define CVMX_ILK_RXF_MEM_PMAP (0x0001180014000028ull) +#define CVMX_ILK_RXX_BYTE_CNTX (offset, block_id) \ + (0x0001180014023000ull + \ + (((offset) & 255) + ((block_id) & 1) * 0x800ull) * 8) +#define CVMX_ILK_RXX_CAL_ENTRYX (offset, block_id) \ + (0x0001180014021000ull + \ + (((offset) & 511) + ((block_id) & 1) * 0x800ull) * 8) +#define CVMX_ILK_RXX_CFG0 (offset) (0x0001180014020000ull + ((offset) & 1) * 16384) +#define CVMX_ILK_RXX_CFG1 (offset) (0x0001180014020008ull + ((offset) & 1) * 16384) +#define CVMX_ILK_RXX_CHAX (offset, block_id) \ + (0x0001180014002000ull + \ + (((offset) & 255) + ((block_id) & 1) * 0x200ull) * 8) +#define CVMX_ILK_RXX_CHA_XONX (offset, block_id) \ + (0x0001180014020400ull + (((offset) & 3) + ((block_id) & 1) * 0x800ull) * 8) +#define CVMX_ILK_RXX_ERR_CFG (offset) \ + (0x00011800140200E0ull + ((offset) & 1) * 16384) +#define CVMX_ILK_RXX_FLOW_CTL0 (offset) \ + (0x0001180014020090ull + ((offset) & 1) * 16384) +#define CVMX_ILK_RXX_FLOW_CTL1 (offset) \ + (0x0001180014020098ull + ((offset) & 1) * 16384) +#define CVMX_ILK_RXX_IDX_CAL (offset) \ + (0x00011800140200A0ull + ((offset) & 1) * 16384) +#define CVMX_ILK_RXX_IDX_STAT0 (offset) \ + (0x0001180014020070ull + ((offset) & 1) * 16384) +#define CVMX_ILK_RXX_IDX_STAT1 (offset) \ + (0x0001180014020078ull + ((offset) & 1) * 16384) +#define CVMX_ILK_RXX_INT (offset) (0x0001180014020010ull + ((offset) & 1) * 16384) +#define CVMX_ILK_RXX_INT_EN (offset) \ + (0x0001180014020018ull + ((offset) & 1) * 16384) +#define CVMX_ILK_RXX_JABBER (offset) \ + (0x00011800140200B8ull + ((offset) & 1) * 16384) +#define CVMX_ILK_RXX_MEM_CAL0 (offset) \ + (0x00011800140200A8ull + ((offset) & 1) * 16384) +#define CVMX_ILK_RXX_MEM_CAL1 (offset) \ + (0x00011800140200B0ull + ((offset) & 1) * 16384) +#define CVMX_ILK_RXX_MEM_STAT0 (offset) \ + (0x0001180014020080ull + ((offset) & 1) * 16384) +#define CVMX_ILK_RXX_MEM_STAT1 (offset) \ + (0x0001180014020088ull + ((offset) & 1) * 16384) +#define CVMX_ILK_RXX_PKT_CNTX (offset, block_id) \ + (0x0001180014022000ull + \ + (((offset) & 255) + ((block_id) & 1) * 0x800ull) * 8) +#define CVMX_ILK_RXX_RID (offset) (0x00011800140200C0ull + ((offset) & 1) * 16384) +#define CVMX_ILK_RXX_STAT0 (offset) \ + (0x0001180014020020ull + ((offset) & 1) * 16384) +#define CVMX_ILK_RXX_STAT1 (offset) \ + (0x0001180014020028ull + ((offset) & 1) * 16384) +#define CVMX_ILK_RXX_STAT2 (offset) \ + (0x0001180014020030ull + ((offset) & 1) * 16384) +#define CVMX_ILK_RXX_STAT3 (offset) \ + (0x0001180014020038ull + ((offset) & 1) * 16384) +#define CVMX_ILK_RXX_STAT4 (offset) \ + (0x0001180014020040ull + ((offset) & 1) * 16384) +#define CVMX_ILK_RXX_STAT5 (offset) \ + (0x0001180014020048ull + ((offset) & 1) * 16384) +#define CVMX_ILK_RXX_STAT6 (offset) \ + (0x0001180014020050ull + ((offset) & 1) * 16384) +#define CVMX_ILK_RXX_STAT7 (offset) \ + (0x0001180014020058ull + ((offset) & 1) * 16384) +#define CVMX_ILK_RXX_STAT8 (offset) \ + (0x0001180014020060ull + ((offset) & 1) * 16384) +#define CVMX_ILK_RXX_STAT9 (offset) \ + (0x0001180014020068ull + ((offset) & 1) * 16384) +#define CVMX_ILK_RX_LNEX_CFG (offset) \ + (0x0001180014038000ull + ((offset) & 15) * 1024) +#define CVMX_ILK_RX_LNEX_INT (offset) \ + (0x0001180014038008ull + ((offset) & 15) * 1024) +#define CVMX_ILK_RX_LNEX_INT_EN (offset) \ + (0x0001180014038010ull + ((offset) & 7) * 1024) +#define CVMX_ILK_RX_LNEX_STAT0 (offset) \ + (0x0001180014038018ull + ((offset) & 15) * 1024) +#define CVMX_ILK_RX_LNEX_STAT1 (offset) \ + (0x0001180014038020ull + ((offset) & 15) * 1024) +#define CVMX_ILK_RX_LNEX_STAT10 (offset) \ + (0x0001180014038068ull + ((offset) & 15) * 1024) +#define CVMX_ILK_RX_LNEX_STAT2 (offset) \ + (0x0001180014038028ull + ((offset) & 15) * 1024) +#define CVMX_ILK_RX_LNEX_STAT3 (offset) \ + (0x0001180014038030ull + ((offset) & 15) * 1024) +#define CVMX_ILK_RX_LNEX_STAT4 (offset) \ + (0x0001180014038038ull + ((offset) & 15) * 1024) +#define CVMX_ILK_RX_LNEX_STAT5 (offset) \ + (0x0001180014038040ull + ((offset) & 15) * 1024) +#define CVMX_ILK_RX_LNEX_STAT6 (offset) \ + (0x0001180014038048ull + ((offset) & 15) * 1024) +#define CVMX_ILK_RX_LNEX_STAT7 (offset) \ + (0x0001180014038050ull + ((offset) & 15) * 1024) +#define CVMX_ILK_RX_LNEX_STAT8 (offset) \ + (0x0001180014038058ull + ((offset) & 15) * 1024) +#define CVMX_ILK_RX_LNEX_STAT9 (offset) \ + (0x0001180014038060ull + ((offset) & 15) * 1024) +#define CVMX_ILK_SER_CFG (0x0001180014000018ull) +#define CVMX_ILK_TXX_BYTE_CNTX (offset, block_id) \ + (0x0001180014013000ull + \ + (((offset) & 255) + ((block_id) & 1) * 0x800ull) * 8) +#define CVMX_ILK_TXX_CAL_ENTRYX (offset, block_id) \ + (0x0001180014011000ull + \ + (((offset) & 511) + ((block_id) & 1) * 0x800ull) * 8) +#define CVMX_ILK_TXX_CFG0 (offset) (0x0001180014010000ull + ((offset) & 1) * 16384) +#define CVMX_ILK_TXX_CFG1 (offset) (0x0001180014010008ull + ((offset) & 1) * 16384) +#define CVMX_ILK_TXX_CHA_XONX (offset, block_id) \ + (0x0001180014010400ull + (((offset) & 3) + ((block_id) & 1) * 0x800ull) * 8) +#define CVMX_ILK_TXX_DBG (offset) (0x0001180014010070ull + ((offset) & 1) * 16384) +#define CVMX_ILK_TXX_ERR_CFG (offset) \ + (0x00011800140100B0ull + ((offset) & 1) * 16384) +#define CVMX_ILK_TXX_FLOW_CTL0 (offset) \ + (0x0001180014010048ull + ((offset) & 1) * 16384) +#define CVMX_ILK_TXX_FLOW_CTL1 (offset) \ + (0x0001180014010050ull + ((offset) & 1) * 16384) +#define CVMX_ILK_TXX_IDX_CAL (offset) \ + (0x0001180014010058ull + ((offset) & 1) * 16384) +#define CVMX_ILK_TXX_IDX_PMAP (offset) \ + (0x0001180014010010ull + ((offset) & 1) * 16384) +#define CVMX_ILK_TXX_IDX_STAT0 (offset) \ + (0x0001180014010020ull + ((offset) & 1) * 16384) +#define CVMX_ILK_TXX_IDX_STAT1 (offset) \ + (0x0001180014010028ull + ((offset) & 1) * 16384) +#define CVMX_ILK_TXX_INT (offset) (0x0001180014010078ull + ((offset) & 1) * 16384) +#define CVMX_ILK_TXX_INT_EN (offset) \ + (0x0001180014010080ull + ((offset) & 1) * 16384) +#define CVMX_ILK_TXX_MEM_CAL0 (offset) \ + (0x0001180014010060ull + ((offset) & 1) * 16384) +#define CVMX_ILK_TXX_MEM_CAL1 (offset) \ + (0x0001180014010068ull + ((offset) & 1) * 16384) +#define CVMX_ILK_TXX_MEM_PMAP (offset) \ + (0x0001180014010018ull + ((offset) & 1) * 16384) +#define CVMX_ILK_TXX_MEM_STAT0 (offset) \ + (0x0001180014010030ull + ((offset) & 1) * 16384) +#define CVMX_ILK_TXX_MEM_STAT1 (offset) \ + (0x0001180014010038ull + ((offset) & 1) * 16384) +#define CVMX_ILK_TXX_PIPE (offset) (0x0001180014010088ull + ((offset) & 1) * 16384) +#define CVMX_ILK_TXX_PKT_CNTX (offset, block_id) \ + (0x0001180014012000ull + \ + (((offset) & 255) + ((block_id) & 1) * 0x800ull) * 8) +#define CVMX_ILK_TXX_RMATCH (offset) \ + (0x0001180014010040ull + ((offset) & 1) * 16384) + +/** +* cvmx_ilk_bist_sum +*/ +union cvmx_ilk_bist_sum { +u64 u64; +struct cvmx_ilk_bist_sum_s { +u64 rxf_x2p :1 ; +u64 rxf_mem19 :1 ; +u64 rxf_mem18 :1 ; +u64 rxf_mem17 :1 ; +u64 rxf_mem16 :1 ; +u64 rxf_mem15 :1 ; +u64 reserved_52_57 :6 ; +u64 rxf_mem8 :1 ; +u64 rxf_mem7 :1 ; +u64 rxf_mem6 :1 ; +u64 rxf_mem5 :1 ; +u64 rxf_mem4 :1 ; +u64 rxf_mem3 :1 ; +u64 reserved_36_45 :10 ; +u64 rle7_dsk1 :1 ; +u64 rle7_dsk0 :1 ; +u64 rle6_dsk1 :1 ; +u64 rle6_dsk0 :1 ; +u64 rle5_dsk1 :1 ; +u64 rle5_dsk0 :1 ; +u64 rle4_dsk1 :1 ; +u64 rle4_dsk0 :1 ; +u64 rle3_dsk1 :1 ; +u64 rle3_dsk0 :1 ; +u64 rle2_dsk1 :1 ; +u64 rle2_dsk0 :1 ; +u64 rle1_dsk1 :1 ; +u64 rle1_dsk0 :1 ; +u64 rle0_dsk1 :1 ; +u64 rle0_dsk0 :1 ; +u64 rlk1_pmap :1 ; +u64 reserved_18_18 :1 ; +u64 rlk1_fwc :1 ; +u64 reserved_16_16 :1 ; +u64 rlk0_pmap :1 ; +u64 rlk0_stat1 :1 ; +u64 rlk0_fwc :1 ; +u64 rlk0_stat :1 ; +u64 tlk1_stat1 :1 ; +u64 tlk1_fwc :1 ; +u64 reserved_9_9 :1 ; +u64 tlk1_txf2 :1 ; +u64 tlk1_txf1 :1 ; +u64 tlk1_txf0 :1 ; +u64 tlk0_stat1 :1 ; +u64 tlk0_fwc :1 ; +u64 reserved_3_3 :1 ; +u64 tlk0_txf2 :1 ; +u64 tlk0_txf1 :1 ; +u64 tlk0_txf0 :1 ; + } s; +struct cvmx_ilk_bist_sum_cn68xx { +u64 reserved_58_63 :6 ; +u64 rxf_x2p1 :1 ; +u64 rxf_x2p0 :1 ; +u64 rxf_pmap :1 ; +u64 rxf_mem2 :1 ; +u64 rxf_mem1 :1 ; +u64 rxf_mem0 :1 ; +u64 reserved_36_51 :16 ; +u64 rle7_dsk1 :1 ; +u64 rle7_dsk0 :1 ; +u64 rle6_dsk1 :1 ; +u64 rle6_dsk0 :1 ; +u64 rle5_dsk1 :1 ; +u64 rle5_dsk0 :1 ; +u64 rle4_dsk1 :1 ; +u64 rle4_dsk0 :1 ; +u64 rle3_dsk1 :1 ; +u64 rle3_dsk0 :1 ; +u64 rle2_dsk1 :1 ; +u64 rle2_dsk0 :1 ; +u64 rle1_dsk1 :1 ; +u64 rle1_dsk0 :1 ; +u64 rle0_dsk1 :1 ; +u64 rle0_dsk0 :1 ; +u64 reserved_19_19 :1 ; +u64 rlk1_stat1 :1 ; +u64 rlk1_fwc :1 ; +u64 rlk1_stat :1 ; +u64 reserved_15_15 :1 ; +u64 rlk0_stat1 :1 ; +u64 rlk0_fwc :1 ; +u64 rlk0_stat :1 ; +u64 tlk1_stat1 :1 ; +u64 tlk1_fwc :1 ; +u64 tlk1_stat0 :1 ; +u64 tlk1_txf2 :1 ; +u64 tlk1_txf1 :1 ; +u64 tlk1_txf0 :1 ; +u64 tlk0_stat1 :1 ; +u64 tlk0_fwc :1 ; +u64 tlk0_stat0 :1 ; +u64 tlk0_txf2 :1 ; +u64 tlk0_txf1 :1 ; +u64 tlk0_txf0 :1 ; + } cn68xx; +struct cvmx_ilk_bist_sum_cn68xxp1 { +u64 reserved_58_63 :6 ; +u64 rxf_x2p1 :1 ; +u64 rxf_x2p0 :1 ; +u64 rxf_pmap :1 ; +u64 rxf_mem2 :1 ; +u64 rxf_mem1 :1 ; +u64 rxf_mem0 :1 ; +u64 reserved_36_51 :16 ; +u64 rle7_dsk1 :1 ; +u64 rle7_dsk0 :1 ; +u64 rle6_dsk1 :1 ; +u64 rle6_dsk0 :1 ; +u64 rle5_dsk1 :1 ; +u64 rle5_dsk0 :1 ; +u64 rle4_dsk1 :1 ; +u64 rle4_dsk0 :1 ; +u64 rle3_dsk1 :1 ; +u64 rle3_dsk0 :1 ; +u64 rle2_dsk1 :1 ; +u64 rle2_dsk0 :1 ; +u64 rle1_dsk1 :1 ; +u64 rle1_dsk0 :1 ; +u64 rle0_dsk1 :1 ; +u64 rle0_dsk0 :1 ; +u64 reserved_18_19 :2 ; +u64 rlk1_fwc :1 ; +u64 rlk1_stat :1 ; +u64 reserved_14_15 :2 ; +u64 rlk0_fwc :1 ; +u64 rlk0_stat :1 ; +u64 reserved_11_11 :1 ; +u64 tlk1_fwc :1 ; +u64 tlk1_stat :1 ; +u64 tlk1_txf2 :1 ; +u64 tlk1_txf1 :1 ; +u64 tlk1_txf0 :1 ; +u64 reserved_5_5 :1 ; +u64 tlk0_fwc :1 ; +u64 tlk0_stat :1 ; +u64 tlk0_txf2 :1 ; +u64 tlk0_txf1 :1 ; +u64 tlk0_txf0 :1 ; + } cn68xxp1; +struct cvmx_ilk_bist_sum_cn78xx { +u64 rxf_x2p :1 ; +u64 rxf_mem19 :1 ; +u64 rxf_mem18 :1 ; +u64 rxf_mem17 :1 ; +u64 rxf_mem16 :1 ; +u64 rxf_mem15 :1 ; +u64 rxf_mem14 :1 ; +u64 rxf_mem13 :1 ; +u64 rxf_mem12 :1 ; +u64 rxf_mem11 :1 ; +u64 rxf_mem10 :1 ; +u64 rxf_mem9 :1 ; +u64 rxf_mem8 :1 ; +u64 rxf_mem7 :1 ; +u64 rxf_mem6 :1 ; +u64 rxf_mem5 :1 ; +u64 rxf_mem4 :1 ; +u64 rxf_mem3 :1 ; +u64 rxf_mem2 :1 ; +u64 rxf_mem1 :1 ; +u64 rxf_mem0 :1 ; +u64 reserved_36_42 :7 ; +u64 rle7_dsk1 :1 ; +u64 rle7_dsk0 :1 ; +u64 rle6_dsk1 :1 ; +u64 rle6_dsk0 :1 ; +u64 rle5_dsk1 :1 ; +u64 rle5_dsk0 :1 ; +u64 rle4_dsk1 :1 ; +u64 rle4_dsk0 :1 ; +u64 rle3_dsk1 :1 ; +u64 rle3_dsk0 :1 ; +u64 rle2_dsk1 :1 ; +u64 rle2_dsk0 :1 ; +u64 rle1_dsk1 :1 ; +u64 rle1_dsk0 :1 ; +u64 rle0_dsk1 :1 ; +u64 rle0_dsk0 :1 ; +u64 rlk1_pmap :1 ; +u64 rlk1_stat :1 ; +u64 rlk1_fwc :1 ; +u64 rlk1_stat1 :1 ; +u64 rlk0_pmap :1 ; +u64 rlk0_stat1 :1 ; +u64 rlk0_fwc :1 ; +u64 rlk0_stat :1 ; +u64 tlk1_stat1 :1 ; +u64 tlk1_fwc :1 ; +u64 tlk1_stat0 :1 ; +u64 tlk1_txf2 :1 ; +u64 tlk1_txf1 :1 ; +u64 tlk1_txf0 :1 ; +u64 tlk0_stat1 :1 ; +u64 tlk0_fwc :1 ; +u64 tlk0_stat0 :1 ; +u64 tlk0_txf2 :1 ; +u64 tlk0_txf1 :1 ; +u64 tlk0_txf0 :1 ; + } cn78xx; +struct cvmx_ilk_bist_sum_cn78xx cn78xxp1; +}; + +typedef union cvmx_ilk_bist_sum cvmx_ilk_bist_sum_t ; + +/** +* cvmx_ilk_gbl_cfg +*/ +union cvmx_ilk_gbl_cfg { +u64 u64; +struct cvmx_ilk_gbl_cfg_s { +u64 reserved_4_63 :60 ; +u64 rid_rstdis :1 ; +u64 reset :1 ; +u64 cclk_dis :1 ; +u64 rxf_xlink :1 ; + } s; +struct cvmx_ilk_gbl_cfg_s cn68xx; +struct cvmx_ilk_gbl_cfg_cn68xxp1 { +u64 reserved_2_63 :62 ; +u64 cclk_dis :1 ; +u64 rxf_xlink :1 ; + } cn68xxp1; +struct cvmx_ilk_gbl_cfg_s cn78xx; +struct cvmx_ilk_gbl_cfg_s cn78xxp1; +}; + +typedef union cvmx_ilk_gbl_cfg cvmx_ilk_gbl_cfg_t ; + +/** +* cvmx_ilk_gbl_err_cfg +*/ +union cvmx_ilk_gbl_err_cfg { +u64 u64; +struct cvmx_ilk_gbl_err_cfg_s { +u64 reserved_20_63 :44 ; +u64 rxf_flip :2 ; +u64 x2p_flip :2 ; +u64 reserved_2_15 :14 ; +u64 rxf_cor_dis :1 ; +u64 x2p_cor_dis :1 ; + } s; +struct cvmx_ilk_gbl_err_cfg_s cn78xx; +struct cvmx_ilk_gbl_err_cfg_s cn78xxp1; +}; + +typedef union cvmx_ilk_gbl_err_cfg cvmx_ilk_gbl_err_cfg_t ; + +/** +* cvmx_ilk_gbl_int +*/ +union cvmx_ilk_gbl_int { +u64 u64; +struct cvmx_ilk_gbl_int_s { +u64 reserved_9_63 :55 ; +u64 x2p_dbe :1 ; +u64 x2p_sbe :1 ; +u64 rxf_dbe :1 ; +u64 rxf_sbe :1 ; +u64 rxf_push_full :1 ; +u64 rxf_pop_empty :1 ; +u64 rxf_ctl_perr :1 ; +u64 rxf_lnk1_perr :1 ; +u64 rxf_lnk0_perr :1 ; + } s; +struct cvmx_ilk_gbl_int_cn68xx { +u64 reserved_5_63 :59 ; +u64 rxf_push_full :1 ; +u64 rxf_pop_empty :1 ; +u64 rxf_ctl_perr :1 ; +u64 rxf_lnk1_perr :1 ; +u64 rxf_lnk0_perr :1 ; + } cn68xx; +struct cvmx_ilk_gbl_int_cn68xx cn68xxp1; +struct cvmx_ilk_gbl_int_s cn78xx; +struct cvmx_ilk_gbl_int_s cn78xxp1; +}; + +typedef union cvmx_ilk_gbl_int cvmx_ilk_gbl_int_t ; + +/** +* cvmx_ilk_gbl_int_en +*/ +union cvmx_ilk_gbl_int_en { +u64 u64; +struct cvmx_ilk_gbl_int_en_s { +u64 reserved_5_63 :59 ; +u64 rxf_push_full :1 ; +u64 rxf_pop_empty :1 ; +u64 rxf_ctl_perr :1 ; +u64 rxf_lnk1_perr :1 ; +u64 rxf_lnk0_perr :1 ; + } s; +struct cvmx_ilk_gbl_int_en_s cn68xx; +struct cvmx_ilk_gbl_int_en_s cn68xxp1; +}; + +typedef union cvmx_ilk_gbl_int_en cvmx_ilk_gbl_int_en_t ; + +/** +* cvmx_ilk_int_sum +*/ +union cvmx_ilk_int_sum { +u64 u64; +struct cvmx_ilk_int_sum_s { +u64 reserved_13_63 :51 ; +u64 rle7_int :1 ; +u64 rle6_int :1 ; +u64 rle5_int :1 ; +u64 rle4_int :1 ; +u64 rle3_int :1 ; +u64 rle2_int :1 ; +u64 rle1_int :1 ; +u64 rle0_int :1 ; +u64 rlk1_int :1 ; +u64 rlk0_int :1 ; +u64 tlk1_int :1 ; +u64 tlk0_int :1 ; +u64 gbl_int :1 ; + } s; +struct cvmx_ilk_int_sum_s cn68xx; +struct cvmx_ilk_int_sum_s cn68xxp1; +}; + +typedef union cvmx_ilk_int_sum cvmx_ilk_int_sum_t ; + +/** +* cvmx_ilk_lne#_trn_ctl +*/ +union cvmx_ilk_lnex_trn_ctl { +u64 u64; +struct cvmx_ilk_lnex_trn_ctl_s { +u64 reserved_4_63 :60 ; +u64 trn_lock :1 ; +u64 trn_done :1 ; +u64 trn_ena :1 ; +u64 eie_det :1 ; + } s; +struct cvmx_ilk_lnex_trn_ctl_s cn78xx; +struct cvmx_ilk_lnex_trn_ctl_s cn78xxp1; +}; + +typedef union cvmx_ilk_lnex_trn_ctl cvmx_ilk_lnex_trn_ctl_t ; + +/** +* cvmx_ilk_lne#_trn_ld +*/ +union cvmx_ilk_lnex_trn_ld { +u64 u64; +struct cvmx_ilk_lnex_trn_ld_s { +u64 lp_manual :1 ; +u64 reserved_49_62 :14 ; +u64 ld_cu_val :1 ; +u64 ld_cu_dat :16 ; +u64 reserved_17_31 :15 ; +u64 ld_sr_val :1 ; +u64 ld_sr_dat :16 ; + } s; +struct cvmx_ilk_lnex_trn_ld_s cn78xx; +struct cvmx_ilk_lnex_trn_ld_s cn78xxp1; +}; + +typedef union cvmx_ilk_lnex_trn_ld cvmx_ilk_lnex_trn_ld_t ; + +/** +* cvmx_ilk_lne#_trn_lp +*/ +union cvmx_ilk_lnex_trn_lp { +u64 u64; +struct cvmx_ilk_lnex_trn_lp_s { +u64 reserved_49_63 :15 ; +u64 lp_cu_val :1 ; +u64 lp_cu_dat :16 ; +u64 reserved_17_31 :15 ; +u64 lp_sr_val :1 ; +u64 lp_sr_dat :16 ; + } s; +struct cvmx_ilk_lnex_trn_lp_s cn78xx; +struct cvmx_ilk_lnex_trn_lp_s cn78xxp1; +}; + +typedef union cvmx_ilk_lnex_trn_lp cvmx_ilk_lnex_trn_lp_t ; + +/** +* cvmx_ilk_lne_dbg +*/ +union cvmx_ilk_lne_dbg { +u64 u64; +struct cvmx_ilk_lne_dbg_s { +u64 reserved_60_63 :4 ; +u64 tx_bad_crc32 :1 ; +u64 tx_bad_6467_cnt :5 ; +u64 tx_bad_sync_cnt :3 ; +u64 tx_bad_scram_cnt :3 ; +u64 tx_bad_lane_sel :16 ; +u64 tx_dis_dispr :16 ; +u64 tx_dis_scram :16 ; + } s; +struct cvmx_ilk_lne_dbg_cn68xx { +u64 reserved_60_63 :4 ; +u64 tx_bad_crc32 :1 ; +u64 tx_bad_6467_cnt :5 ; +u64 tx_bad_sync_cnt :3 ; +u64 tx_bad_scram_cnt :3 ; +u64 reserved_40_47 :8 ; +u64 tx_bad_lane_sel :8 ; +u64 reserved_24_31 :8 ; +u64 tx_dis_dispr :8 ; +u64 reserved_8_15 :8 ; +u64 tx_dis_scram :8 ; + } cn68xx; +struct cvmx_ilk_lne_dbg_cn68xx cn68xxp1; +struct cvmx_ilk_lne_dbg_s cn78xx; +struct cvmx_ilk_lne_dbg_s cn78xxp1; +}; + +typedef union cvmx_ilk_lne_dbg cvmx_ilk_lne_dbg_t ; + +/** +* cvmx_ilk_lne_sts_msg +*/ +union cvmx_ilk_lne_sts_msg { +u64 u64; +struct cvmx_ilk_lne_sts_msg_s { +u64 rx_lnk_stat :16 ; +u64 rx_lne_stat :16 ; +u64 tx_lnk_stat :16 ; +u64 tx_lne_stat :16 ; + } s; +struct cvmx_ilk_lne_sts_msg_cn68xx { +u64 reserved_56_63 :8 ; +u64 rx_lnk_stat :8 ; +u64 reserved_40_47 :8 ; +u64 rx_lne_stat :8 ; +u64 reserved_24_31 :8 ; +u64 tx_lnk_stat :8 ; +u64 reserved_8_15 :8 ; +u64 tx_lne_stat :8 ; + } cn68xx; +struct cvmx_ilk_lne_sts_msg_cn68xx cn68xxp1; +struct cvmx_ilk_lne_sts_msg_s cn78xx; +struct cvmx_ilk_lne_sts_msg_s cn78xxp1; +}; + +typedef union cvmx_ilk_lne_sts_msg cvmx_ilk_lne_sts_msg_t ; + +/** +* cvmx_ilk_rid_cfg +*/ +union cvmx_ilk_rid_cfg { +u64 u64; +struct cvmx_ilk_rid_cfg_s { +u64 reserved_39_63 :25 ; +u64 max_cnt :7 ; +u64 reserved_7_31 :25 ; +u64 base :7 ; + } s; +struct cvmx_ilk_rid_cfg_s cn78xx; +struct cvmx_ilk_rid_cfg_s cn78xxp1; +}; + +typedef union cvmx_ilk_rid_cfg cvmx_ilk_rid_cfg_t ; + +/** +* cvmx_ilk_rx#_byte_cnt# +*/ +union cvmx_ilk_rxx_byte_cntx { +u64 u64; +struct cvmx_ilk_rxx_byte_cntx_s { +u64 reserved_40_63 :24 ; +u64 rx_bytes :40 ; + } s; +struct cvmx_ilk_rxx_byte_cntx_s cn78xx; +struct cvmx_ilk_rxx_byte_cntx_s cn78xxp1; +}; + +typedef union cvmx_ilk_rxx_byte_cntx cvmx_ilk_rxx_byte_cntx_t ; + +/** +* cvmx_ilk_rx#_cal_entry# +*/ +union cvmx_ilk_rxx_cal_entryx { +u64 u64; +struct cvmx_ilk_rxx_cal_entryx_s { +u64 reserved_34_63 :30 ; +u64 ctl :2 ; +u64 reserved_8_31 :24 ; +u64 channel :8 ; + } s; +struct cvmx_ilk_rxx_cal_entryx_s cn78xx; +struct cvmx_ilk_rxx_cal_entryx_s cn78xxp1; +}; + +typedef union cvmx_ilk_rxx_cal_entryx cvmx_ilk_rxx_cal_entryx_t ; + +/** +* cvmx_ilk_rx#_cfg0 +*/ +union cvmx_ilk_rxx_cfg0 { +u64 u64; +struct cvmx_ilk_rxx_cfg0_s { +u64 ext_lpbk_fc :1 ; +u64 ext_lpbk :1 ; +u64 reserved_60_61 :2 ; +u64 lnk_stats_wrap :1 ; +u64 bcw_push :1 ; +u64 mproto_ign :1 ; +u64 ptrn_mode :1 ; +u64 lnk_stats_rdclr :1 ; +u64 lnk_stats_ena :1 ; +u64 mltuse_fc_ena :1 ; +u64 cal_ena :1 ; +u64 mfrm_len :13 ; +u64 brst_shrt :7 ; +u64 lane_rev :1 ; +u64 brst_max :5 ; +u64 reserved_25_25 :1 ; +u64 cal_depth :9 ; +u64 lane_ena :16 ; + } s; +struct cvmx_ilk_rxx_cfg0_cn68xx { +u64 ext_lpbk_fc :1 ; +u64 ext_lpbk :1 ; +u64 reserved_60_61 :2 ; +u64 lnk_stats_wrap :1 ; +u64 bcw_push :1 ; +u64 mproto_ign :1 ; +u64 ptrn_mode :1 ; +u64 lnk_stats_rdclr :1 ; +u64 lnk_stats_ena :1 ; +u64 mltuse_fc_ena :1 ; +u64 cal_ena :1 ; +u64 mfrm_len :13 ; +u64 brst_shrt :7 ; +u64 lane_rev :1 ; +u64 brst_max :5 ; +u64 reserved_25_25 :1 ; +u64 cal_depth :9 ; +u64 reserved_8_15 :8 ; +u64 lane_ena :8 ; + } cn68xx; +struct cvmx_ilk_rxx_cfg0_cn68xxp1 { +u64 ext_lpbk_fc :1 ; +u64 ext_lpbk :1 ; +u64 reserved_57_61 :5 ; +u64 ptrn_mode :1 ; +u64 lnk_stats_rdclr :1 ; +u64 lnk_stats_ena :1 ; +u64 mltuse_fc_ena :1 ; +u64 cal_ena :1 ; +u64 mfrm_len :13 ; +u64 brst_shrt :7 ; +u64 lane_rev :1 ; +u64 brst_max :5 ; +u64 reserved_25_25 :1 ; +u64 cal_depth :9 ; +u64 reserved_8_15 :8 ; +u64 lane_ena :8 ; + } cn68xxp1; +struct cvmx_ilk_rxx_cfg0_s cn78xx; +struct cvmx_ilk_rxx_cfg0_s cn78xxp1; +}; + +typedef union cvmx_ilk_rxx_cfg0 cvmx_ilk_rxx_cfg0_t ; + +/** +* cvmx_ilk_rx#_cfg1 +*/ +union cvmx_ilk_rxx_cfg1 { +u64 u64; +struct cvmx_ilk_rxx_cfg1_s { +u64 reserved_62_63 :2 ; +u64 rx_fifo_cnt :12 ; +u64 reserved_49_49 :1 ; +u64 rx_fifo_hwm :13 ; +u64 reserved_35_35 :1 ; +u64 rx_fifo_max :13 ; +u64 pkt_flush :1 ; +u64 pkt_ena :1 ; +u64 la_mode :1 ; +u64 tx_link_fc :1 ; +u64 rx_link_fc :1 ; +u64 rx_align_ena :1 ; +u64 rx_bdry_lock_ena :16 ; + } s; +struct cvmx_ilk_rxx_cfg1_cn68xx { +u64 reserved_62_63 :2 ; +u64 rx_fifo_cnt :12 ; +u64 reserved_48_49 :2 ; +u64 rx_fifo_hwm :12 ; +u64 reserved_34_35 :2 ; +u64 rx_fifo_max :12 ; +u64 pkt_flush :1 ; +u64 pkt_ena :1 ; +u64 la_mode :1 ; +u64 tx_link_fc :1 ; +u64 rx_link_fc :1 ; +u64 rx_align_ena :1 ; +u64 reserved_8_15 :8 ; +u64 rx_bdry_lock_ena :8 ; + } cn68xx; +struct cvmx_ilk_rxx_cfg1_cn68xx cn68xxp1; +struct cvmx_ilk_rxx_cfg1_s cn78xx; +struct cvmx_ilk_rxx_cfg1_s cn78xxp1; +}; + +typedef union cvmx_ilk_rxx_cfg1 cvmx_ilk_rxx_cfg1_t ; + +/** +* cvmx_ilk_rx#_cha# +*/ +union cvmx_ilk_rxx_chax { +u64 u64; +struct cvmx_ilk_rxx_chax_s { +u64 reserved_6_63 :58 ; +u64 port_kind :6 ; + } s; +struct cvmx_ilk_rxx_chax_s cn78xx; +struct cvmx_ilk_rxx_chax_s cn78xxp1; +}; + +typedef union cvmx_ilk_rxx_chax cvmx_ilk_rxx_chax_t ; + +/** +* cvmx_ilk_rx#_cha_xon# +*/ +union cvmx_ilk_rxx_cha_xonx { +u64 u64; +struct cvmx_ilk_rxx_cha_xonx_s { +u64 xon :64 ; + } s; +struct cvmx_ilk_rxx_cha_xonx_s cn78xx; +struct cvmx_ilk_rxx_cha_xonx_s cn78xxp1; +}; + +typedef union cvmx_ilk_rxx_cha_xonx cvmx_ilk_rxx_cha_xonx_t ; + +/** +* cvmx_ilk_rx#_err_cfg +*/ +union cvmx_ilk_rxx_err_cfg { +u64 u64; +struct cvmx_ilk_rxx_err_cfg_s { +u64 reserved_20_63 :44 ; +u64 fwc_flip :2 ; +u64 pmap_flip :2 ; +u64 reserved_2_15 :14 ; +u64 fwc_cor_dis :1 ; +u64 pmap_cor_dis :1 ; + } s; +struct cvmx_ilk_rxx_err_cfg_s cn78xx; +struct cvmx_ilk_rxx_err_cfg_s cn78xxp1; +}; + +typedef union cvmx_ilk_rxx_err_cfg cvmx_ilk_rxx_err_cfg_t ; + +/** +* cvmx_ilk_rx#_flow_ctl0 +*/ +union cvmx_ilk_rxx_flow_ctl0 { +u64 u64; +struct cvmx_ilk_rxx_flow_ctl0_s { +u64 status :64 ; + } s; +struct cvmx_ilk_rxx_flow_ctl0_s cn68xx; +struct cvmx_ilk_rxx_flow_ctl0_s cn68xxp1; +}; + +typedef union cvmx_ilk_rxx_flow_ctl0 cvmx_ilk_rxx_flow_ctl0_t ; + +/** +* cvmx_ilk_rx#_flow_ctl1 +*/ +union cvmx_ilk_rxx_flow_ctl1 { +u64 u64; +struct cvmx_ilk_rxx_flow_ctl1_s { +u64 status :64 ; + } s; +struct cvmx_ilk_rxx_flow_ctl1_s cn68xx; +struct cvmx_ilk_rxx_flow_ctl1_s cn68xxp1; +}; + +typedef union cvmx_ilk_rxx_flow_ctl1 cvmx_ilk_rxx_flow_ctl1_t ; + +/** +* cvmx_ilk_rx#_idx_cal +*/ +union cvmx_ilk_rxx_idx_cal { +u64 u64; +struct cvmx_ilk_rxx_idx_cal_s { +u64 reserved_14_63 :50 ; +u64 inc :6 ; +u64 reserved_6_7 :2 ; +u64 index :6 ; + } s; +struct cvmx_ilk_rxx_idx_cal_s cn68xx; +struct cvmx_ilk_rxx_idx_cal_s cn68xxp1; +}; + +typedef union cvmx_ilk_rxx_idx_cal cvmx_ilk_rxx_idx_cal_t ; + +/** +* cvmx_ilk_rx#_idx_stat0 +*/ +union cvmx_ilk_rxx_idx_stat0 { +u64 u64; +struct cvmx_ilk_rxx_idx_stat0_s { +u64 reserved_32_63 :32 ; +u64 clr :1 ; +u64 reserved_24_30 :7 ; +u64 inc :8 ; +u64 reserved_8_15 :8 ; +u64 index :8 ; + } s; +struct cvmx_ilk_rxx_idx_stat0_s cn68xx; +struct cvmx_ilk_rxx_idx_stat0_s cn68xxp1; +}; + +typedef union cvmx_ilk_rxx_idx_stat0 cvmx_ilk_rxx_idx_stat0_t ; + +/** +* cvmx_ilk_rx#_idx_stat1 +*/ +union cvmx_ilk_rxx_idx_stat1 { +u64 u64; +struct cvmx_ilk_rxx_idx_stat1_s { +u64 reserved_32_63 :32 ; +u64 clr :1 ; +u64 reserved_24_30 :7 ; +u64 inc :8 ; +u64 reserved_8_15 :8 ; +u64 index :8 ; + } s; +struct cvmx_ilk_rxx_idx_stat1_s cn68xx; +struct cvmx_ilk_rxx_idx_stat1_s cn68xxp1; +}; + +typedef union cvmx_ilk_rxx_idx_stat1 cvmx_ilk_rxx_idx_stat1_t ; + +/** +* cvmx_ilk_rx#_int +*/ +union cvmx_ilk_rxx_int { +u64 u64; +struct cvmx_ilk_rxx_int_s { +u64 reserved_13_63 :51 ; +u64 pmap_dbe :1 ; +u64 pmap_sbe :1 ; +u64 fwc_dbe :1 ; +u64 fwc_sbe :1 ; +u64 pkt_drop_sop :1 ; +u64 pkt_drop_rid :1 ; +u64 pkt_drop_rxf :1 ; +u64 lane_bad_word :1 ; +u64 stat_cnt_ovfl :1 ; +u64 lane_align_done :1 ; +u64 word_sync_done :1 ; +u64 crc24_err :1 ; +u64 lane_align_fail :1 ; + } s; +struct cvmx_ilk_rxx_int_cn68xx { +u64 reserved_9_63 :55 ; +u64 pkt_drop_sop :1 ; +u64 pkt_drop_rid :1 ; +u64 pkt_drop_rxf :1 ; +u64 lane_bad_word :1 ; +u64 stat_cnt_ovfl :1 ; +u64 lane_align_done :1 ; +u64 word_sync_done :1 ; +u64 crc24_err :1 ; +u64 lane_align_fail :1 ; + } cn68xx; +struct cvmx_ilk_rxx_int_cn68xxp1 { +u64 reserved_8_63 :56 ; +u64 pkt_drop_rid :1 ; +u64 pkt_drop_rxf :1 ; +u64 lane_bad_word :1 ; +u64 stat_cnt_ovfl :1 ; +u64 lane_align_done :1 ; +u64 word_sync_done :1 ; +u64 crc24_err :1 ; +u64 lane_align_fail :1 ; + } cn68xxp1; +struct cvmx_ilk_rxx_int_s cn78xx; +struct cvmx_ilk_rxx_int_s cn78xxp1; +}; + +typedef union cvmx_ilk_rxx_int cvmx_ilk_rxx_int_t ; + +/** +* cvmx_ilk_rx#_int_en +*/ +union cvmx_ilk_rxx_int_en { +u64 u64; +struct cvmx_ilk_rxx_int_en_s { +u64 reserved_9_63 :55 ; +u64 pkt_drop_sop :1 ; +u64 pkt_drop_rid :1 ; +u64 pkt_drop_rxf :1 ; +u64 lane_bad_word :1 ; +u64 stat_cnt_ovfl :1 ; +u64 lane_align_done :1 ; +u64 word_sync_done :1 ; +u64 crc24_err :1 ; +u64 lane_align_fail :1 ; + } s; +struct cvmx_ilk_rxx_int_en_s cn68xx; +struct cvmx_ilk_rxx_int_en_cn68xxp1 { +u64 reserved_8_63 :56 ; +u64 pkt_drop_rid :1 ; +u64 pkt_drop_rxf :1 ; +u64 lane_bad_word :1 ; +u64 stat_cnt_ovfl :1 ; +u64 lane_align_done :1 ; +u64 word_sync_done :1 ; +u64 crc24_err :1 ; +u64 lane_align_fail :1 ; + } cn68xxp1; +}; + +typedef union cvmx_ilk_rxx_int_en cvmx_ilk_rxx_int_en_t ; + +/** +* cvmx_ilk_rx#_jabber +*/ +union cvmx_ilk_rxx_jabber { +u64 u64; +struct cvmx_ilk_rxx_jabber_s { +u64 reserved_16_63 :48 ; +u64 cnt :16 ; + } s; +struct cvmx_ilk_rxx_jabber_s cn68xx; +struct cvmx_ilk_rxx_jabber_s cn68xxp1; +struct cvmx_ilk_rxx_jabber_s cn78xx; +struct cvmx_ilk_rxx_jabber_s cn78xxp1; +}; + +typedef union cvmx_ilk_rxx_jabber cvmx_ilk_rxx_jabber_t ; + +/** +* cvmx_ilk_rx#_mem_cal0 +* +* Notes: +* Software must program the calendar table prior to enabling the +* link. +* +* Software must always write ILK_RXx_MEM_CAL0 then ILK_RXx_MEM_CAL1. +* Software must never write them in reverse order or write one without +* writing the other. +* +* A given calendar table entry has no effect on PKO pipe +* backpressure when either: +* - ENTRY_CTLx=Link (1), or +* - ENTRY_CTLx=XON (3) and PORT_PIPEx is outside the range of ILK_TXx_PIPE[BASE/NUMP]. +* +* Within the 8 calendar table entries of one IDX value, if more +* than one affects the same PKO pipe, XOFF always wins over XON, +* regardless of the calendar table order. +* +* Software must always read ILK_RXx_MEM_CAL0 then ILK_RXx_MEM_CAL1. Software +* must never read them in reverse order or read one without reading the +* other. +*/ +union cvmx_ilk_rxx_mem_cal0 { +u64 u64; +struct cvmx_ilk_rxx_mem_cal0_s { +u64 reserved_36_63 :28 ; +u64 entry_ctl3 :2 ; +u64 port_pipe3 :7 ; +u64 entry_ctl2 :2 ; +u64 port_pipe2 :7 ; +u64 entry_ctl1 :2 ; +u64 port_pipe1 :7 ; +u64 entry_ctl0 :2 ; +u64 port_pipe0 :7 ; + } s; +struct cvmx_ilk_rxx_mem_cal0_s cn68xx; +struct cvmx_ilk_rxx_mem_cal0_s cn68xxp1; +}; + +typedef union cvmx_ilk_rxx_mem_cal0 cvmx_ilk_rxx_mem_cal0_t ; + +/** +* cvmx_ilk_rx#_mem_cal1 +* +* Notes: +* Software must program the calendar table prior to enabling the +* link. +* +* Software must always write ILK_RXx_MEM_CAL0 then ILK_RXx_MEM_CAL1. +* Software must never write them in reverse order or write one without +* writing the other. +* +* A given calendar table entry has no effect on PKO pipe +* backpressure when either: +* - ENTRY_CTLx=Link (1), or +* - ENTRY_CTLx=XON (3) and PORT_PIPEx is outside the range of ILK_TXx_PIPE[BASE/NUMP]. +* +* Within the 8 calendar table entries of one IDX value, if more +* than one affects the same PKO pipe, XOFF always wins over XON, +* regardless of the calendar table order. +* +* Software must always read ILK_RXx_MEM_CAL0 then ILK_Rx_MEM_CAL1. Software +* must never read them in reverse order or read one without reading the +* other. +*/ +union cvmx_ilk_rxx_mem_cal1 { +u64 u64; +struct cvmx_ilk_rxx_mem_cal1_s { +u64 reserved_36_63 :28 ; +u64 entry_ctl7 :2 ; +u64 port_pipe7 :7 ; +u64 entry_ctl6 :2 ; +u64 port_pipe6 :7 ; +u64 entry_ctl5 :2 ; +u64 port_pipe5 :7 ; +u64 entry_ctl4 :2 ; +u64 port_pipe4 :7 ; + } s; +struct cvmx_ilk_rxx_mem_cal1_s cn68xx; +struct cvmx_ilk_rxx_mem_cal1_s cn68xxp1; +}; + +typedef union cvmx_ilk_rxx_mem_cal1 cvmx_ilk_rxx_mem_cal1_t ; + +/** +* cvmx_ilk_rx#_mem_stat0 +*/ +union cvmx_ilk_rxx_mem_stat0 { +u64 u64; +struct cvmx_ilk_rxx_mem_stat0_s { +u64 reserved_28_63 :36 ; +u64 rx_pkt :28 ; + } s; +struct cvmx_ilk_rxx_mem_stat0_s cn68xx; +struct cvmx_ilk_rxx_mem_stat0_s cn68xxp1; +}; + +typedef union cvmx_ilk_rxx_mem_stat0 cvmx_ilk_rxx_mem_stat0_t ; + +/** +* cvmx_ilk_rx#_mem_stat1 +*/ +union cvmx_ilk_rxx_mem_stat1 { +u64 u64; +struct cvmx_ilk_rxx_mem_stat1_s { +u64 reserved_36_63 :28 ; +u64 rx_bytes :36 ; + } s; +struct cvmx_ilk_rxx_mem_stat1_s cn68xx; +struct cvmx_ilk_rxx_mem_stat1_s cn68xxp1; +}; + +typedef union cvmx_ilk_rxx_mem_stat1 cvmx_ilk_rxx_mem_stat1_t ; + +/** +* cvmx_ilk_rx#_pkt_cnt# +*/ +union cvmx_ilk_rxx_pkt_cntx { +u64 u64; +struct cvmx_ilk_rxx_pkt_cntx_s { +u64 reserved_34_63 :30 ; +u64 rx_pkt :34 ; + } s; +struct cvmx_ilk_rxx_pkt_cntx_s cn78xx; +struct cvmx_ilk_rxx_pkt_cntx_s cn78xxp1; +}; + +typedef union cvmx_ilk_rxx_pkt_cntx cvmx_ilk_rxx_pkt_cntx_t ; + +/** +* cvmx_ilk_rx#_rid +*/ +union cvmx_ilk_rxx_rid { +u64 u64; +struct cvmx_ilk_rxx_rid_s { +u64 reserved_7_63 :57 ; +u64 max_cnt :7 ; + } s; +struct cvmx_ilk_rxx_rid_cn68xx { +u64 reserved_6_63 :58 ; +u64 max_cnt :6 ; + } cn68xx; +struct cvmx_ilk_rxx_rid_s cn78xx; +struct cvmx_ilk_rxx_rid_s cn78xxp1; +}; + +typedef union cvmx_ilk_rxx_rid cvmx_ilk_rxx_rid_t ; + +/** +* cvmx_ilk_rx#_stat0 +*/ +union cvmx_ilk_rxx_stat0 { +u64 u64; +struct cvmx_ilk_rxx_stat0_s { +u64 reserved_35_63 :29 ; +u64 crc24_match_cnt :35 ; + } s; +struct cvmx_ilk_rxx_stat0_cn68xx { +u64 reserved_33_63 :31 ; +u64 crc24_match_cnt :33 ; + } cn68xx; +struct cvmx_ilk_rxx_stat0_cn68xxp1 { +u64 reserved_27_63 :37 ; +u64 crc24_match_cnt :27 ; + } cn68xxp1; +struct cvmx_ilk_rxx_stat0_s cn78xx; +struct cvmx_ilk_rxx_stat0_s cn78xxp1; +}; + +typedef union cvmx_ilk_rxx_stat0 cvmx_ilk_rxx_stat0_t ; + +/** +* cvmx_ilk_rx#_stat1 +*/ +union cvmx_ilk_rxx_stat1 { +u64 u64; +struct cvmx_ilk_rxx_stat1_s { +u64 reserved_20_63 :44 ; +u64 crc24_err_cnt :20 ; + } s; +struct cvmx_ilk_rxx_stat1_cn68xx { +u64 reserved_18_63 :46 ; +u64 crc24_err_cnt :18 ; + } cn68xx; +struct cvmx_ilk_rxx_stat1_cn68xx cn68xxp1; +struct cvmx_ilk_rxx_stat1_s cn78xx; +struct cvmx_ilk_rxx_stat1_s cn78xxp1; +}; + +typedef union cvmx_ilk_rxx_stat1 cvmx_ilk_rxx_stat1_t ; + +/** +* cvmx_ilk_rx#_stat2 +*/ +union cvmx_ilk_rxx_stat2 { +u64 u64; +struct cvmx_ilk_rxx_stat2_s { +u64 reserved_50_63 :14 ; +u64 brst_not_full_cnt :18 ; +u64 reserved_30_31 :2 ; +u64 brst_cnt :30 ; + } s; +struct cvmx_ilk_rxx_stat2_cn68xx { +u64 reserved_48_63 :16 ; +u64 brst_not_full_cnt :16 ; +u64 reserved_28_31 :4 ; +u64 brst_cnt :28 ; + } cn68xx; +struct cvmx_ilk_rxx_stat2_cn68xxp1 { +u64 reserved_48_63 :16 ; +u64 brst_not_full_cnt :16 ; +u64 reserved_16_31 :16 ; +u64 brst_cnt :16 ; + } cn68xxp1; +struct cvmx_ilk_rxx_stat2_s cn78xx; +struct cvmx_ilk_rxx_stat2_s cn78xxp1; +}; + +typedef union cvmx_ilk_rxx_stat2 cvmx_ilk_rxx_stat2_t ; + +/** +* cvmx_ilk_rx#_stat3 +*/ +union cvmx_ilk_rxx_stat3 { +u64 u64; +struct cvmx_ilk_rxx_stat3_s { +u64 reserved_18_63 :46 ; +u64 brst_max_err_cnt :18 ; + } s; +struct cvmx_ilk_rxx_stat3_cn68xx { +u64 reserved_16_63 :48 ; +u64 brst_max_err_cnt :16 ; + } cn68xx; +struct cvmx_ilk_rxx_stat3_cn68xx cn68xxp1; +struct cvmx_ilk_rxx_stat3_s cn78xx; +struct cvmx_ilk_rxx_stat3_s cn78xxp1; +}; + +typedef union cvmx_ilk_rxx_stat3 cvmx_ilk_rxx_stat3_t ; + +/** +* cvmx_ilk_rx#_stat4 +*/ +union cvmx_ilk_rxx_stat4 { +u64 u64; +struct cvmx_ilk_rxx_stat4_s { +u64 reserved_18_63 :46 ; +u64 brst_shrt_err_cnt :18 ; + } s; +struct cvmx_ilk_rxx_stat4_cn68xx { +u64 reserved_16_63 :48 ; +u64 brst_shrt_err_cnt :16 ; + } cn68xx; +struct cvmx_ilk_rxx_stat4_cn68xx cn68xxp1; +struct cvmx_ilk_rxx_stat4_s cn78xx; +struct cvmx_ilk_rxx_stat4_s cn78xxp1; +}; + +typedef union cvmx_ilk_rxx_stat4 cvmx_ilk_rxx_stat4_t ; + +/** +* cvmx_ilk_rx#_stat5 +*/ +union cvmx_ilk_rxx_stat5 { +u64 u64; +struct cvmx_ilk_rxx_stat5_s { +u64 reserved_25_63 :39 ; +u64 align_cnt :25 ; + } s; +struct cvmx_ilk_rxx_stat5_cn68xx { +u64 reserved_23_63 :41 ; +u64 align_cnt :23 ; + } cn68xx; +struct cvmx_ilk_rxx_stat5_cn68xxp1 { +u64 reserved_16_63 :48 ; +u64 align_cnt :16 ; + } cn68xxp1; +struct cvmx_ilk_rxx_stat5_s cn78xx; +struct cvmx_ilk_rxx_stat5_s cn78xxp1; +}; + +typedef union cvmx_ilk_rxx_stat5 cvmx_ilk_rxx_stat5_t ; + +/** +* cvmx_ilk_rx#_stat6 +*/ +union cvmx_ilk_rxx_stat6 { +u64 u64; +struct cvmx_ilk_rxx_stat6_s { +u64 reserved_18_63 :46 ; +u64 align_err_cnt :18 ; + } s; +struct cvmx_ilk_rxx_stat6_cn68xx { +u64 reserved_16_63 :48 ; +u64 align_err_cnt :16 ; + } cn68xx; +struct cvmx_ilk_rxx_stat6_cn68xx cn68xxp1; +struct cvmx_ilk_rxx_stat6_s cn78xx; +struct cvmx_ilk_rxx_stat6_s cn78xxp1; +}; + +typedef union cvmx_ilk_rxx_stat6 cvmx_ilk_rxx_stat6_t ; + +/** +* cvmx_ilk_rx#_stat7 +*/ +union cvmx_ilk_rxx_stat7 { +u64 u64; +struct cvmx_ilk_rxx_stat7_s { +u64 reserved_18_63 :46 ; +u64 bad_64b67b_cnt :18 ; + } s; +struct cvmx_ilk_rxx_stat7_cn68xx { +u64 reserved_16_63 :48 ; +u64 bad_64b67b_cnt :16 ; + } cn68xx; +struct cvmx_ilk_rxx_stat7_cn68xx cn68xxp1; +struct cvmx_ilk_rxx_stat7_s cn78xx; +struct cvmx_ilk_rxx_stat7_s cn78xxp1; +}; + +typedef union cvmx_ilk_rxx_stat7 cvmx_ilk_rxx_stat7_t ; + +/** +* cvmx_ilk_rx#_stat8 +*/ +union cvmx_ilk_rxx_stat8 { +u64 u64; +struct cvmx_ilk_rxx_stat8_s { +u64 reserved_32_63 :32 ; +u64 pkt_drop_rid_cnt :16 ; +u64 pkt_drop_rxf_cnt :16 ; + } s; +struct cvmx_ilk_rxx_stat8_s cn68xx; +struct cvmx_ilk_rxx_stat8_s cn68xxp1; +struct cvmx_ilk_rxx_stat8_s cn78xx; +struct cvmx_ilk_rxx_stat8_s cn78xxp1; +}; + +typedef union cvmx_ilk_rxx_stat8 cvmx_ilk_rxx_stat8_t ; + +/** +* cvmx_ilk_rx#_stat9 +* +* This register is reserved. +* +*/ +union cvmx_ilk_rxx_stat9 { +u64 u64; +struct cvmx_ilk_rxx_stat9_s { +u64 reserved_0_63 :64 ; + } s; +struct cvmx_ilk_rxx_stat9_s cn68xx; +struct cvmx_ilk_rxx_stat9_s cn68xxp1; +struct cvmx_ilk_rxx_stat9_s cn78xx; +struct cvmx_ilk_rxx_stat9_s cn78xxp1; +}; + +typedef union cvmx_ilk_rxx_stat9 cvmx_ilk_rxx_stat9_t ; + +/** +* cvmx_ilk_rx_lne#_cfg +*/ +union cvmx_ilk_rx_lnex_cfg { +u64 u64; +struct cvmx_ilk_rx_lnex_cfg_s { +u64 reserved_9_63 :55 ; +u64 rx_dis_psh_skip :1 ; +u64 reserved_7_7 :1 ; +u64 rx_dis_disp_chk :1 ; +u64 rx_scrm_sync :1 ; +u64 rx_bdry_sync :1 ; +u64 rx_dis_ukwn :1 ; +u64 rx_dis_scram :1 ; +u64 stat_rdclr :1 ; +u64 stat_ena :1 ; + } s; +struct cvmx_ilk_rx_lnex_cfg_cn68xx { +u64 reserved_9_63 :55 ; +u64 rx_dis_psh_skip :1 ; +u64 reserved_6_7 :2 ; +u64 rx_scrm_sync :1 ; +u64 rx_bdry_sync :1 ; +u64 rx_dis_ukwn :1 ; +u64 rx_dis_scram :1 ; +u64 stat_rdclr :1 ; +u64 stat_ena :1 ; + } cn68xx; +struct cvmx_ilk_rx_lnex_cfg_cn68xxp1 { +u64 reserved_5_63 :59 ; +u64 rx_bdry_sync :1 ; +u64 rx_dis_ukwn :1 ; +u64 rx_dis_scram :1 ; +u64 stat_rdclr :1 ; +u64 stat_ena :1 ; + } cn68xxp1; +struct cvmx_ilk_rx_lnex_cfg_s cn78xx; +struct cvmx_ilk_rx_lnex_cfg_s cn78xxp1; +}; + +typedef union cvmx_ilk_rx_lnex_cfg cvmx_ilk_rx_lnex_cfg_t ; + +/** +* cvmx_ilk_rx_lne#_int +*/ +union cvmx_ilk_rx_lnex_int { +u64 u64; +struct cvmx_ilk_rx_lnex_int_s { +u64 reserved_10_63 :54 ; +u64 disp_err :1 ; +u64 bad_64b67b :1 ; +u64 stat_cnt_ovfl :1 ; +u64 stat_msg :1 ; +u64 dskew_fifo_ovfl :1 ; +u64 scrm_sync_loss :1 ; +u64 ukwn_cntl_word :1 ; +u64 crc32_err :1 ; +u64 bdry_sync_loss :1 ; +u64 serdes_lock_loss :1 ; + } s; +struct cvmx_ilk_rx_lnex_int_cn68xx { +u64 reserved_9_63 :55 ; +u64 bad_64b67b :1 ; +u64 stat_cnt_ovfl :1 ; +u64 stat_msg :1 ; +u64 dskew_fifo_ovfl :1 ; +u64 scrm_sync_loss :1 ; +u64 ukwn_cntl_word :1 ; +u64 crc32_err :1 ; +u64 bdry_sync_loss :1 ; +u64 serdes_lock_loss :1 ; + } cn68xx; +struct cvmx_ilk_rx_lnex_int_cn68xx cn68xxp1; +struct cvmx_ilk_rx_lnex_int_s cn78xx; +struct cvmx_ilk_rx_lnex_int_s cn78xxp1; +}; + +typedef union cvmx_ilk_rx_lnex_int cvmx_ilk_rx_lnex_int_t ; + +/** +* cvmx_ilk_rx_lne#_int_en +*/ +union cvmx_ilk_rx_lnex_int_en { +u64 u64; +struct cvmx_ilk_rx_lnex_int_en_s { +u64 reserved_9_63 :55 ; +u64 bad_64b67b :1 ; +u64 stat_cnt_ovfl :1 ; +u64 stat_msg :1 ; +u64 dskew_fifo_ovfl :1 ; +u64 scrm_sync_loss :1 ; +u64 ukwn_cntl_word :1 ; +u64 crc32_err :1 ; +u64 bdry_sync_loss :1 ; +u64 serdes_lock_loss :1 ; + } s; +struct cvmx_ilk_rx_lnex_int_en_s cn68xx; +struct cvmx_ilk_rx_lnex_int_en_s cn68xxp1; +}; + +typedef union cvmx_ilk_rx_lnex_int_en cvmx_ilk_rx_lnex_int_en_t ; + +/** +* cvmx_ilk_rx_lne#_stat0 +*/ +union cvmx_ilk_rx_lnex_stat0 { +u64 u64; +struct cvmx_ilk_rx_lnex_stat0_s { +u64 reserved_18_63 :46 ; +u64 ser_lock_loss_cnt :18 ; + } s; +struct cvmx_ilk_rx_lnex_stat0_s cn68xx; +struct cvmx_ilk_rx_lnex_stat0_s cn68xxp1; +struct cvmx_ilk_rx_lnex_stat0_s cn78xx; +struct cvmx_ilk_rx_lnex_stat0_s cn78xxp1; +}; + +typedef union cvmx_ilk_rx_lnex_stat0 cvmx_ilk_rx_lnex_stat0_t ; + +/** +* cvmx_ilk_rx_lne#_stat1 +*/ +union cvmx_ilk_rx_lnex_stat1 { +u64 u64; +struct cvmx_ilk_rx_lnex_stat1_s { +u64 reserved_18_63 :46 ; +u64 bdry_sync_loss_cnt :18 ; + } s; +struct cvmx_ilk_rx_lnex_stat1_s cn68xx; +struct cvmx_ilk_rx_lnex_stat1_s cn68xxp1; +struct cvmx_ilk_rx_lnex_stat1_s cn78xx; +struct cvmx_ilk_rx_lnex_stat1_s cn78xxp1; +}; + +typedef union cvmx_ilk_rx_lnex_stat1 cvmx_ilk_rx_lnex_stat1_t ; + +/** +* cvmx_ilk_rx_lne#_stat10 +*/ +union cvmx_ilk_rx_lnex_stat10 { +u64 u64; +struct cvmx_ilk_rx_lnex_stat10_s { +u64 reserved_43_63 :21 ; +u64 prbs_bad :11 ; +u64 reserved_11_31 :21 ; +u64 prbs_good :11 ; + } s; +struct cvmx_ilk_rx_lnex_stat10_s cn78xx; +struct cvmx_ilk_rx_lnex_stat10_s cn78xxp1; +}; + +typedef union cvmx_ilk_rx_lnex_stat10 cvmx_ilk_rx_lnex_stat10_t ; + +/** +* cvmx_ilk_rx_lne#_stat2 +*/ +union cvmx_ilk_rx_lnex_stat2 { +u64 u64; +struct cvmx_ilk_rx_lnex_stat2_s { +u64 reserved_50_63 :14 ; +u64 syncw_good_cnt :18 ; +u64 reserved_18_31 :14 ; +u64 syncw_bad_cnt :18 ; + } s; +struct cvmx_ilk_rx_lnex_stat2_s cn68xx; +struct cvmx_ilk_rx_lnex_stat2_s cn68xxp1; +struct cvmx_ilk_rx_lnex_stat2_s cn78xx; +struct cvmx_ilk_rx_lnex_stat2_s cn78xxp1; +}; + +typedef union cvmx_ilk_rx_lnex_stat2 cvmx_ilk_rx_lnex_stat2_t ; + +/** +* cvmx_ilk_rx_lne#_stat3 +*/ +union cvmx_ilk_rx_lnex_stat3 { +u64 u64; +struct cvmx_ilk_rx_lnex_stat3_s { +u64 reserved_18_63 :46 ; +u64 bad_64b67b_cnt :18 ; + } s; +struct cvmx_ilk_rx_lnex_stat3_s cn68xx; +struct cvmx_ilk_rx_lnex_stat3_s cn68xxp1; +struct cvmx_ilk_rx_lnex_stat3_s cn78xx; +struct cvmx_ilk_rx_lnex_stat3_s cn78xxp1; +}; + +typedef union cvmx_ilk_rx_lnex_stat3 cvmx_ilk_rx_lnex_stat3_t ; + +/** +* cvmx_ilk_rx_lne#_stat4 +*/ +union cvmx_ilk_rx_lnex_stat4 { +u64 u64; +struct cvmx_ilk_rx_lnex_stat4_s { +u64 reserved_59_63 :5 ; +u64 cntl_word_cnt :27 ; +u64 reserved_27_31 :5 ; +u64 data_word_cnt :27 ; + } s; +struct cvmx_ilk_rx_lnex_stat4_s cn68xx; +struct cvmx_ilk_rx_lnex_stat4_s cn68xxp1; +struct cvmx_ilk_rx_lnex_stat4_s cn78xx; +struct cvmx_ilk_rx_lnex_stat4_s cn78xxp1; +}; + +typedef union cvmx_ilk_rx_lnex_stat4 cvmx_ilk_rx_lnex_stat4_t ; + +/** +* cvmx_ilk_rx_lne#_stat5 +*/ +union cvmx_ilk_rx_lnex_stat5 { +u64 u64; +struct cvmx_ilk_rx_lnex_stat5_s { +u64 reserved_18_63 :46 ; +u64 unkwn_word_cnt :18 ; + } s; +struct cvmx_ilk_rx_lnex_stat5_s cn68xx; +struct cvmx_ilk_rx_lnex_stat5_s cn68xxp1; +struct cvmx_ilk_rx_lnex_stat5_s cn78xx; +struct cvmx_ilk_rx_lnex_stat5_s cn78xxp1; +}; + +typedef union cvmx_ilk_rx_lnex_stat5 cvmx_ilk_rx_lnex_stat5_t ; + +/** +* cvmx_ilk_rx_lne#_stat6 +*/ +union cvmx_ilk_rx_lnex_stat6 { +u64 u64; +struct cvmx_ilk_rx_lnex_stat6_s { +u64 reserved_18_63 :46 ; +u64 scrm_sync_loss_cnt :18 ; + } s; +struct cvmx_ilk_rx_lnex_stat6_s cn68xx; +struct cvmx_ilk_rx_lnex_stat6_s cn68xxp1; +struct cvmx_ilk_rx_lnex_stat6_s cn78xx; +struct cvmx_ilk_rx_lnex_stat6_s cn78xxp1; +}; + +typedef union cvmx_ilk_rx_lnex_stat6 cvmx_ilk_rx_lnex_stat6_t ; + +/** +* cvmx_ilk_rx_lne#_stat7 +*/ +union cvmx_ilk_rx_lnex_stat7 { +u64 u64; +struct cvmx_ilk_rx_lnex_stat7_s { +u64 reserved_18_63 :46 ; +u64 scrm_match_cnt :18 ; + } s; +struct cvmx_ilk_rx_lnex_stat7_s cn68xx; +struct cvmx_ilk_rx_lnex_stat7_s cn68xxp1; +struct cvmx_ilk_rx_lnex_stat7_s cn78xx; +struct cvmx_ilk_rx_lnex_stat7_s cn78xxp1; +}; + +typedef union cvmx_ilk_rx_lnex_stat7 cvmx_ilk_rx_lnex_stat7_t ; + +/** +* cvmx_ilk_rx_lne#_stat8 +*/ +union cvmx_ilk_rx_lnex_stat8 { +u64 u64; +struct cvmx_ilk_rx_lnex_stat8_s { +u64 reserved_18_63 :46 ; +u64 skipw_good_cnt :18 ; + } s; +struct cvmx_ilk_rx_lnex_stat8_s cn68xx; +struct cvmx_ilk_rx_lnex_stat8_s cn68xxp1; +struct cvmx_ilk_rx_lnex_stat8_s cn78xx; +struct cvmx_ilk_rx_lnex_stat8_s cn78xxp1; +}; + +typedef union cvmx_ilk_rx_lnex_stat8 cvmx_ilk_rx_lnex_stat8_t ; + +/** +* cvmx_ilk_rx_lne#_stat9 +*/ +union cvmx_ilk_rx_lnex_stat9 { +u64 u64; +struct cvmx_ilk_rx_lnex_stat9_s { +u64 reserved_50_63 :14 ; +u64 crc32_err_cnt :18 ; +u64 reserved_27_31 :5 ; +u64 crc32_match_cnt :27 ; + } s; +struct cvmx_ilk_rx_lnex_stat9_s cn68xx; +struct cvmx_ilk_rx_lnex_stat9_s cn68xxp1; +struct cvmx_ilk_rx_lnex_stat9_s cn78xx; +struct cvmx_ilk_rx_lnex_stat9_s cn78xxp1; +}; + +typedef union cvmx_ilk_rx_lnex_stat9 cvmx_ilk_rx_lnex_stat9_t ; + +/** +* cvmx_ilk_rxf_idx_pmap +*/ +union cvmx_ilk_rxf_idx_pmap { +u64 u64; +struct cvmx_ilk_rxf_idx_pmap_s { +u64 reserved_25_63 :39 ; +u64 inc :9 ; +u64 reserved_9_15 :7 ; +u64 index :9 ; + } s; +struct cvmx_ilk_rxf_idx_pmap_s cn68xx; +struct cvmx_ilk_rxf_idx_pmap_s cn68xxp1; +}; + +typedef union cvmx_ilk_rxf_idx_pmap cvmx_ilk_rxf_idx_pmap_t ; + +/** +* cvmx_ilk_rxf_mem_pmap +*/ +union cvmx_ilk_rxf_mem_pmap { +u64 u64; +struct cvmx_ilk_rxf_mem_pmap_s { +u64 reserved_6_63 :58 ; +u64 port_kind :6 ; + } s; +struct cvmx_ilk_rxf_mem_pmap_s cn68xx; +struct cvmx_ilk_rxf_mem_pmap_s cn68xxp1; +}; + +typedef union cvmx_ilk_rxf_mem_pmap cvmx_ilk_rxf_mem_pmap_t ; + +/** +* cvmx_ilk_ser_cfg +*/ +union cvmx_ilk_ser_cfg { +u64 u64; +struct cvmx_ilk_ser_cfg_s { +u64 reserved_57_63 :7 ; +u64 ser_rxpol_auto :1 ; +u64 ser_rxpol :16 ; +u64 ser_txpol :16 ; +u64 ser_reset_n :16 ; +u64 ser_pwrup :4 ; +u64 ser_haul :4 ; + } s; +struct cvmx_ilk_ser_cfg_cn68xx { +u64 reserved_57_63 :7 ; +u64 ser_rxpol_auto :1 ; +u64 reserved_48_55 :8 ; +u64 ser_rxpol :8 ; +u64 reserved_32_39 :8 ; +u64 ser_txpol :8 ; +u64 reserved_16_23 :8 ; +u64 ser_reset_n :8 ; +u64 reserved_6_7 :2 ; +u64 ser_pwrup :2 ; +u64 reserved_2_3 :2 ; +u64 ser_haul :2 ; + } cn68xx; +struct cvmx_ilk_ser_cfg_cn68xx cn68xxp1; +struct cvmx_ilk_ser_cfg_s cn78xx; +struct cvmx_ilk_ser_cfg_s cn78xxp1; +}; + +typedef union cvmx_ilk_ser_cfg cvmx_ilk_ser_cfg_t ; + +/** +* cvmx_ilk_tx#_byte_cnt# +*/ +union cvmx_ilk_txx_byte_cntx { +u64 u64; +struct cvmx_ilk_txx_byte_cntx_s { +u64 reserved_40_63 :24 ; +u64 tx_bytes :40 ; + } s; +struct cvmx_ilk_txx_byte_cntx_s cn78xx; +struct cvmx_ilk_txx_byte_cntx_s cn78xxp1; +}; + +typedef union cvmx_ilk_txx_byte_cntx cvmx_ilk_txx_byte_cntx_t ; + +/** +* cvmx_ilk_tx#_cal_entry# +*/ +union cvmx_ilk_txx_cal_entryx { +u64 u64; +struct cvmx_ilk_txx_cal_entryx_s { +u64 reserved_34_63 :30 ; +u64 ctl :2 ; +u64 reserved_8_31 :24 ; +u64 channel :8 ; + } s; +struct cvmx_ilk_txx_cal_entryx_s cn78xx; +struct cvmx_ilk_txx_cal_entryx_s cn78xxp1; +}; + +typedef union cvmx_ilk_txx_cal_entryx cvmx_ilk_txx_cal_entryx_t ; + +/** +* cvmx_ilk_tx#_cfg0 +*/ +union cvmx_ilk_txx_cfg0 { +u64 u64; +struct cvmx_ilk_txx_cfg0_s { +u64 ext_lpbk_fc :1 ; +u64 ext_lpbk :1 ; +u64 int_lpbk :1 ; +u64 txf_byp_dis :1 ; +u64 reserved_57_59 :3 ; +u64 ptrn_mode :1 ; +u64 lnk_stats_rdclr :1 ; +u64 lnk_stats_ena :1 ; +u64 mltuse_fc_ena :1 ; +u64 cal_ena :1 ; +u64 mfrm_len :13 ; +u64 brst_shrt :7 ; +u64 lane_rev :1 ; +u64 brst_max :5 ; +u64 reserved_25_25 :1 ; +u64 cal_depth :9 ; +u64 lane_ena :16 ; + } s; +struct cvmx_ilk_txx_cfg0_cn68xx { +u64 ext_lpbk_fc :1 ; +u64 ext_lpbk :1 ; +u64 int_lpbk :1 ; +u64 reserved_57_60 :4 ; +u64 ptrn_mode :1 ; +u64 reserved_55_55 :1 ; +u64 lnk_stats_ena :1 ; +u64 mltuse_fc_ena :1 ; +u64 cal_ena :1 ; +u64 mfrm_len :13 ; +u64 brst_shrt :7 ; +u64 lane_rev :1 ; +u64 brst_max :5 ; +u64 reserved_25_25 :1 ; +u64 cal_depth :9 ; +u64 reserved_8_15 :8 ; +u64 lane_ena :8 ; + } cn68xx; +struct cvmx_ilk_txx_cfg0_cn68xx cn68xxp1; +struct cvmx_ilk_txx_cfg0_s cn78xx; +struct cvmx_ilk_txx_cfg0_s cn78xxp1; +}; + +typedef union cvmx_ilk_txx_cfg0 cvmx_ilk_txx_cfg0_t ; + +/** +* cvmx_ilk_tx#_cfg1 +*/ +union cvmx_ilk_txx_cfg1 { +u64 u64; +struct cvmx_ilk_txx_cfg1_s { +u64 ser_low :4 ; +u64 reserved_53_59 :7 ; +u64 brst_min :5 ; +u64 reserved_43_47 :5 ; +u64 ser_limit :10 ; +u64 pkt_busy :1 ; +u64 pipe_crd_dis :1 ; +u64 ptp_delay :5 ; +u64 skip_cnt :4 ; +u64 pkt_flush :1 ; +u64 pkt_ena :1 ; +u64 la_mode :1 ; +u64 tx_link_fc :1 ; +u64 rx_link_fc :1 ; +u64 reserved_12_16 :5 ; +u64 tx_link_fc_jam :1 ; +u64 rx_link_fc_pkt :1 ; +u64 rx_link_fc_ign :1 ; +u64 rmatch :1 ; +u64 tx_mltuse :8 ; + } s; +struct cvmx_ilk_txx_cfg1_cn68xx { +u64 reserved_33_63 :31 ; +u64 pkt_busy :1 ; +u64 pipe_crd_dis :1 ; +u64 ptp_delay :5 ; +u64 skip_cnt :4 ; +u64 pkt_flush :1 ; +u64 pkt_ena :1 ; +u64 la_mode :1 ; +u64 tx_link_fc :1 ; +u64 rx_link_fc :1 ; +u64 reserved_12_16 :5 ; +u64 tx_link_fc_jam :1 ; +u64 rx_link_fc_pkt :1 ; +u64 rx_link_fc_ign :1 ; +u64 rmatch :1 ; +u64 tx_mltuse :8 ; + } cn68xx; +struct cvmx_ilk_txx_cfg1_cn68xxp1 { +u64 reserved_32_63 :32 ; +u64 pipe_crd_dis :1 ; +u64 ptp_delay :5 ; +u64 skip_cnt :4 ; +u64 pkt_flush :1 ; +u64 pkt_ena :1 ; +u64 la_mode :1 ; +u64 tx_link_fc :1 ; +u64 rx_link_fc :1 ; +u64 reserved_12_16 :5 ; +u64 tx_link_fc_jam :1 ; +u64 rx_link_fc_pkt :1 ; +u64 rx_link_fc_ign :1 ; +u64 rmatch :1 ; +u64 tx_mltuse :8 ; + } cn68xxp1; +struct cvmx_ilk_txx_cfg1_s cn78xx; +struct cvmx_ilk_txx_cfg1_s cn78xxp1; +}; + +typedef union cvmx_ilk_txx_cfg1 cvmx_ilk_txx_cfg1_t ; + +/** +* cvmx_ilk_tx#_cha_xon# +*/ +union cvmx_ilk_txx_cha_xonx { +u64 u64; +struct cvmx_ilk_txx_cha_xonx_s { +u64 status :64 ; + } s; +struct cvmx_ilk_txx_cha_xonx_s cn78xx; +struct cvmx_ilk_txx_cha_xonx_s cn78xxp1; +}; + +typedef union cvmx_ilk_txx_cha_xonx cvmx_ilk_txx_cha_xonx_t ; + +/** +* cvmx_ilk_tx#_dbg +*/ +union cvmx_ilk_txx_dbg { +u64 u64; +struct cvmx_ilk_txx_dbg_s { +u64 reserved_29_63 :35 ; +u64 data_rate :13 ; +u64 low_delay :6 ; +u64 reserved_3_9 :7 ; +u64 tx_bad_crc24 :1 ; +u64 tx_bad_ctlw2 :1 ; +u64 tx_bad_ctlw1 :1 ; + } s; +struct cvmx_ilk_txx_dbg_cn68xx { +u64 reserved_3_63 :61 ; +u64 tx_bad_crc24 :1 ; +u64 tx_bad_ctlw2 :1 ; +u64 tx_bad_ctlw1 :1 ; + } cn68xx; +struct cvmx_ilk_txx_dbg_cn68xx cn68xxp1; +struct cvmx_ilk_txx_dbg_s cn78xx; +struct cvmx_ilk_txx_dbg_s cn78xxp1; +}; + +typedef union cvmx_ilk_txx_dbg cvmx_ilk_txx_dbg_t ; + +/** +* cvmx_ilk_tx#_err_cfg +*/ +union cvmx_ilk_txx_err_cfg { +u64 u64; +struct cvmx_ilk_txx_err_cfg_s { +u64 reserved_20_63 :44 ; +u64 fwc_flip :2 ; +u64 txf_flip :2 ; +u64 reserved_2_15 :14 ; +u64 fwc_cor_dis :1 ; +u64 txf_cor_dis :1 ; + } s; +struct cvmx_ilk_txx_err_cfg_s cn78xx; +struct cvmx_ilk_txx_err_cfg_s cn78xxp1; +}; + +typedef union cvmx_ilk_txx_err_cfg cvmx_ilk_txx_err_cfg_t ; + +/** +* cvmx_ilk_tx#_flow_ctl0 +*/ +union cvmx_ilk_txx_flow_ctl0 { +u64 u64; +struct cvmx_ilk_txx_flow_ctl0_s { +u64 status :64 ; + } s; +struct cvmx_ilk_txx_flow_ctl0_s cn68xx; +struct cvmx_ilk_txx_flow_ctl0_s cn68xxp1; +}; + +typedef union cvmx_ilk_txx_flow_ctl0 cvmx_ilk_txx_flow_ctl0_t ; + +/** +* cvmx_ilk_tx#_flow_ctl1 +* +* Notes: +* Do not publish. +* +*/ +union cvmx_ilk_txx_flow_ctl1 { +u64 u64; +struct cvmx_ilk_txx_flow_ctl1_s { +u64 reserved_0_63 :64 ; + } s; +struct cvmx_ilk_txx_flow_ctl1_s cn68xx; +struct cvmx_ilk_txx_flow_ctl1_s cn68xxp1; +}; + +typedef union cvmx_ilk_txx_flow_ctl1 cvmx_ilk_txx_flow_ctl1_t ; + +/** +* cvmx_ilk_tx#_idx_cal +*/ +union cvmx_ilk_txx_idx_cal { +u64 u64; +struct cvmx_ilk_txx_idx_cal_s { +u64 reserved_14_63 :50 ; +u64 inc :6 ; +u64 reserved_6_7 :2 ; +u64 index :6 ; + } s; +struct cvmx_ilk_txx_idx_cal_s cn68xx; +struct cvmx_ilk_txx_idx_cal_s cn68xxp1; +}; + +typedef union cvmx_ilk_txx_idx_cal cvmx_ilk_txx_idx_cal_t ; + +/** +* cvmx_ilk_tx#_idx_pmap +*/ +union cvmx_ilk_txx_idx_pmap { +u64 u64; +struct cvmx_ilk_txx_idx_pmap_s { +u64 reserved_23_63 :41 ; +u64 inc :7 ; +u64 reserved_7_15 :9 ; +u64 index :7 ; + } s; +struct cvmx_ilk_txx_idx_pmap_s cn68xx; +struct cvmx_ilk_txx_idx_pmap_s cn68xxp1; +}; + +typedef union cvmx_ilk_txx_idx_pmap cvmx_ilk_txx_idx_pmap_t ; + +/** +* cvmx_ilk_tx#_idx_stat0 +*/ +union cvmx_ilk_txx_idx_stat0 { +u64 u64; +struct cvmx_ilk_txx_idx_stat0_s { +u64 reserved_32_63 :32 ; +u64 clr :1 ; +u64 reserved_24_30 :7 ; +u64 inc :8 ; +u64 reserved_8_15 :8 ; +u64 index :8 ; + } s; +struct cvmx_ilk_txx_idx_stat0_s cn68xx; +struct cvmx_ilk_txx_idx_stat0_s cn68xxp1; +}; + +typedef union cvmx_ilk_txx_idx_stat0 cvmx_ilk_txx_idx_stat0_t ; + +/** +* cvmx_ilk_tx#_idx_stat1 +*/ +union cvmx_ilk_txx_idx_stat1 { +u64 u64; +struct cvmx_ilk_txx_idx_stat1_s { +u64 reserved_32_63 :32 ; +u64 clr :1 ; +u64 reserved_24_30 :7 ; +u64 inc :8 ; +u64 reserved_8_15 :8 ; +u64 index :8 ; + } s; +struct cvmx_ilk_txx_idx_stat1_s cn68xx; +struct cvmx_ilk_txx_idx_stat1_s cn68xxp1; +}; + +typedef union cvmx_ilk_txx_idx_stat1 cvmx_ilk_txx_idx_stat1_t ; + +/** +* cvmx_ilk_tx#_int +*/ +union cvmx_ilk_txx_int { +u64 u64; +struct cvmx_ilk_txx_int_s { +u64 reserved_8_63 :56 ; +u64 fwc_dbe :1 ; +u64 fwc_sbe :1 ; +u64 txf_dbe :1 ; +u64 txf_sbe :1 ; +u64 stat_cnt_ovfl :1 ; +u64 bad_pipe :1 ; +u64 bad_seq :1 ; +u64 txf_err :1 ; + } s; +struct cvmx_ilk_txx_int_cn68xx { +u64 reserved_4_63 :60 ; +u64 stat_cnt_ovfl :1 ; +u64 bad_pipe :1 ; +u64 bad_seq :1 ; +u64 txf_err :1 ; + } cn68xx; +struct cvmx_ilk_txx_int_cn68xx cn68xxp1; +struct cvmx_ilk_txx_int_s cn78xx; +struct cvmx_ilk_txx_int_s cn78xxp1; +}; + +typedef union cvmx_ilk_txx_int cvmx_ilk_txx_int_t ; + +/** +* cvmx_ilk_tx#_int_en +*/ +union cvmx_ilk_txx_int_en { +u64 u64; +struct cvmx_ilk_txx_int_en_s { +u64 reserved_4_63 :60 ; +u64 stat_cnt_ovfl :1 ; +u64 bad_pipe :1 ; +u64 bad_seq :1 ; +u64 txf_err :1 ; + } s; +struct cvmx_ilk_txx_int_en_s cn68xx; +struct cvmx_ilk_txx_int_en_s cn68xxp1; +}; + +typedef union cvmx_ilk_txx_int_en cvmx_ilk_txx_int_en_t ; + +/** +* cvmx_ilk_tx#_mem_cal0 +* +* Notes: +* Software must always read ILK_TXx_MEM_CAL0 then ILK_TXx_MEM_CAL1. Software +* must never read them in reverse order or read one without reading the +* other. +* +* Software must always write ILK_TXx_MEM_CAL0 then ILK_TXx_MEM_CAL1. +* Software must never write them in reverse order or write one without +* writing the other. +*/ +union cvmx_ilk_txx_mem_cal0 { +u64 u64; +struct cvmx_ilk_txx_mem_cal0_s { +u64 reserved_36_63 :28 ; +u64 entry_ctl3 :2 ; +u64 reserved_33_33 :1 ; +u64 bpid3 :6 ; +u64 entry_ctl2 :2 ; +u64 reserved_24_24 :1 ; +u64 bpid2 :6 ; +u64 entry_ctl1 :2 ; +u64 reserved_15_15 :1 ; +u64 bpid1 :6 ; +u64 entry_ctl0 :2 ; +u64 reserved_6_6 :1 ; +u64 bpid0 :6 ; + } s; +struct cvmx_ilk_txx_mem_cal0_s cn68xx; +struct cvmx_ilk_txx_mem_cal0_s cn68xxp1; +}; + +typedef union cvmx_ilk_txx_mem_cal0 cvmx_ilk_txx_mem_cal0_t ; + +/** +* cvmx_ilk_tx#_mem_cal1 +* +* Notes: +* Software must always read ILK_TXx_MEM_CAL0 then ILK_TXx_MEM_CAL1. Software +* must never read them in reverse order or read one without reading the +* other. +* +* Software must always write ILK_TXx_MEM_CAL0 then ILK_TXx_MEM_CAL1. +* Software must never write them in reverse order or write one without +* writing the other. +*/ +union cvmx_ilk_txx_mem_cal1 { +u64 u64; +struct cvmx_ilk_txx_mem_cal1_s { +u64 reserved_36_63 :28 ; +u64 entry_ctl7 :2 ; +u64 reserved_33_33 :1 ; +u64 bpid7 :6 ; +u64 entry_ctl6 :2 ; +u64 reserved_24_24 :1 ; +u64 bpid6 :6 ; +u64 entry_ctl5 :2 ; +u64 reserved_15_15 :1 ; +u64 bpid5 :6 ; +u64 entry_ctl4 :2 ; +u64 reserved_6_6 :1 ; +u64 bpid4 :6 ; + } s; +struct cvmx_ilk_txx_mem_cal1_s cn68xx; +struct cvmx_ilk_txx_mem_cal1_s cn68xxp1; +}; + +typedef union cvmx_ilk_txx_mem_cal1 cvmx_ilk_txx_mem_cal1_t ; + +/** +* cvmx_ilk_tx#_mem_pmap +*/ +union cvmx_ilk_txx_mem_pmap { +u64 u64; +struct cvmx_ilk_txx_mem_pmap_s { +u64 reserved_17_63 :47 ; +u64 remap :1 ; +u64 reserved_8_15 :8 ; +u64 channel :8 ; + } s; +struct cvmx_ilk_txx_mem_pmap_s cn68xx; +struct cvmx_ilk_txx_mem_pmap_cn68xxp1 { +u64 reserved_8_63 :56 ; +u64 channel :8 ; + } cn68xxp1; +}; + +typedef union cvmx_ilk_txx_mem_pmap cvmx_ilk_txx_mem_pmap_t ; + +/** +* cvmx_ilk_tx#_mem_stat0 +*/ +union cvmx_ilk_txx_mem_stat0 { +u64 u64; +struct cvmx_ilk_txx_mem_stat0_s { +u64 reserved_28_63 :36 ; +u64 tx_pkt :28 ; + } s; +struct cvmx_ilk_txx_mem_stat0_s cn68xx; +struct cvmx_ilk_txx_mem_stat0_s cn68xxp1; +}; + +typedef union cvmx_ilk_txx_mem_stat0 cvmx_ilk_txx_mem_stat0_t ; + +/** +* cvmx_ilk_tx#_mem_stat1 +*/ +union cvmx_ilk_txx_mem_stat1 { +u64 u64; +struct cvmx_ilk_txx_mem_stat1_s { +u64 reserved_36_63 :28 ; +u64 tx_bytes :36 ; + } s; +struct cvmx_ilk_txx_mem_stat1_s cn68xx; +struct cvmx_ilk_txx_mem_stat1_s cn68xxp1; +}; + +typedef union cvmx_ilk_txx_mem_stat1 cvmx_ilk_txx_mem_stat1_t ; + +/** +* cvmx_ilk_tx#_pipe +*/ +union cvmx_ilk_txx_pipe { +u64 u64; +struct cvmx_ilk_txx_pipe_s { +u64 reserved_24_63 :40 ; +u64 nump :8 ; +u64 reserved_7_15 :9 ; +u64 base :7 ; + } s; +struct cvmx_ilk_txx_pipe_s cn68xx; +struct cvmx_ilk_txx_pipe_s cn68xxp1; +}; + +typedef union cvmx_ilk_txx_pipe cvmx_ilk_txx_pipe_t ; + +/** +* cvmx_ilk_tx#_pkt_cnt# +*/ +union cvmx_ilk_txx_pkt_cntx { +u64 u64; +struct cvmx_ilk_txx_pkt_cntx_s { +u64 reserved_34_63 :30 ; +u64 tx_pkt :34 ; + } s; +struct cvmx_ilk_txx_pkt_cntx_s cn78xx; +struct cvmx_ilk_txx_pkt_cntx_s cn78xxp1; +}; + +typedef union cvmx_ilk_txx_pkt_cntx cvmx_ilk_txx_pkt_cntx_t ; + +/** +* cvmx_ilk_tx#_rmatch +*/ +union cvmx_ilk_txx_rmatch { +u64 u64; +struct cvmx_ilk_txx_rmatch_s { +u64 reserved_50_63 :14 ; +u64 grnlrty :2 ; +u64 brst_limit :16 ; +u64 time_limit :16 ; +u64 rate_limit :16 ; + } s; +struct cvmx_ilk_txx_rmatch_s cn68xx; +struct cvmx_ilk_txx_rmatch_s cn68xxp1; +struct cvmx_ilk_txx_rmatch_s cn78xx; +struct cvmx_ilk_txx_rmatch_s cn78xxp1; +}; + +typedef union cvmx_ilk_txx_rmatch cvmx_ilk_txx_rmatch_t ; + +#endif
Signature · 1 line
2.35.1
PATCH 3/52 mips: octeon: Add cvmx-iob-defs.h header file
In reply to Stefan RoeseFrom: Aaron Williams <[email protected]>
Import cvmx-iob-defs.h header file from 2013 U-Boot. It will be used by the later added drivers to support networking on the MIPS Octeon II / III platforms.
--- .../mach-octeon/include/mach/cvmx-iob-defs.h | 1328 +++++++++++++++++ 1 file changed, 1328 insertions(+) create mode 100644 arch/mips/mach-octeon/include/mach/cvmx-iob-defs.h
arch/mips/mach-octeon/include/mach/cvmx-iob-defs.h new file +1328 -0
@@ -0,0 +1,1328 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* +* Copyright (C) 2018-2022 Marvell International Ltd. +* +* Configuration and status register (CSR) type definitions for +* Octeon iob. +*/ + +#ifndef __CVMX_IOB_DEFS_H__ +#define __CVMX_IOB_DEFS_H__ + +#define CVMX_IOB_BIST_STATUS (0x00011800F00007F8ull) +#define CVMX_IOB_CHIP_CUR_PWR (0x00011800F0000828ull) +#define CVMX_IOB_CHIP_GLB_PWR_THROTTLE (0x00011800F0000808ull) +#define CVMX_IOB_CHIP_PWR_OUT (0x00011800F0000818ull) +#define CVMX_IOB_CTL_STATUS (0x00011800F0000050ull) +#define CVMX_IOB_DWB_PRI_CNT (0x00011800F0000028ull) +#define CVMX_IOB_FAU_TIMEOUT (0x00011800F0000000ull) +#define CVMX_IOB_I2C_PRI_CNT (0x00011800F0000010ull) +#define CVMX_IOB_INB_CONTROL_MATCH (0x00011800F0000078ull) +#define CVMX_IOB_INB_CONTROL_MATCH_ENB (0x00011800F0000088ull) +#define CVMX_IOB_INB_DATA_MATCH (0x00011800F0000070ull) +#define CVMX_IOB_INB_DATA_MATCH_ENB (0x00011800F0000080ull) +#define CVMX_IOB_INT_ENB (0x00011800F0000060ull) +#define CVMX_IOB_INT_SUM (0x00011800F0000058ull) +#define CVMX_IOB_N2C_L2C_PRI_CNT (0x00011800F0000020ull) +#define CVMX_IOB_N2C_RSP_PRI_CNT (0x00011800F0000008ull) +#define CVMX_IOB_OUTB_COM_PRI_CNT (0x00011800F0000040ull) +#define CVMX_IOB_OUTB_CONTROL_MATCH (0x00011800F0000098ull) +#define CVMX_IOB_OUTB_CONTROL_MATCH_ENB (0x00011800F00000A8ull) +#define CVMX_IOB_OUTB_DATA_MATCH (0x00011800F0000090ull) +#define CVMX_IOB_OUTB_DATA_MATCH_ENB (0x00011800F00000A0ull) +#define CVMX_IOB_OUTB_FPA_PRI_CNT (0x00011800F0000048ull) +#define CVMX_IOB_OUTB_REQ_PRI_CNT (0x00011800F0000038ull) +#define CVMX_IOB_P2C_REQ_PRI_CNT (0x00011800F0000018ull) +#define CVMX_IOB_PKT_ERR (0x00011800F0000068ull) +#define CVMX_IOB_PP_BIST_STATUS (0x00011800F0000700ull) +#define CVMX_IOB_TO_CMB_CREDITS (0x00011800F00000B0ull) +#define CVMX_IOB_TO_NCB_DID_00_CREDITS (0x00011800F0000800ull) +#define CVMX_IOB_TO_NCB_DID_111_CREDITS (0x00011800F0000B78ull) +#define CVMX_IOB_TO_NCB_DID_223_CREDITS (0x00011800F0000EF8ull) +#define CVMX_IOB_TO_NCB_DID_24_CREDITS (0x00011800F00008C0ull) +#define CVMX_IOB_TO_NCB_DID_32_CREDITS (0x00011800F0000900ull) +#define CVMX_IOB_TO_NCB_DID_40_CREDITS (0x00011800F0000940ull) +#define CVMX_IOB_TO_NCB_DID_55_CREDITS (0x00011800F00009B8ull) +#define CVMX_IOB_TO_NCB_DID_64_CREDITS (0x00011800F0000A00ull) +#define CVMX_IOB_TO_NCB_DID_79_CREDITS (0x00011800F0000A78ull) +#define CVMX_IOB_TO_NCB_DID_96_CREDITS (0x00011800F0000B00ull) +#define CVMX_IOB_TO_NCB_DID_98_CREDITS (0x00011800F0000B10ull) + +/** +* cvmx_iob_bist_status +* +* The result of the BIST run on the IOB memories. +* +*/ +union cvmx_iob_bist_status { +u64 u64; +struct cvmx_iob_bist_status_s { +u64 reserved_2_63 :62 ; +u64 ibd :1 ; +u64 icd :1 ; + } s; +struct cvmx_iob_bist_status_cn30xx { +u64 reserved_18_63 :46 ; +u64 icnrcb :1 ; +u64 icr0 :1 ; +u64 icr1 :1 ; +u64 icnr1 :1 ; +u64 icnr0 :1 ; +u64 ibdr0 :1 ; +u64 ibdr1 :1 ; +u64 ibr0 :1 ; +u64 ibr1 :1 ; +u64 icnrt :1 ; +u64 ibrq0 :1 ; +u64 ibrq1 :1 ; +u64 icrn0 :1 ; +u64 icrn1 :1 ; +u64 icrp0 :1 ; +u64 icrp1 :1 ; +u64 ibd :1 ; +u64 icd :1 ; + } cn30xx; +struct cvmx_iob_bist_status_cn30xx cn31xx; +struct cvmx_iob_bist_status_cn30xx cn38xx; +struct cvmx_iob_bist_status_cn30xx cn38xxp2; +struct cvmx_iob_bist_status_cn30xx cn50xx; +struct cvmx_iob_bist_status_cn30xx cn52xx; +struct cvmx_iob_bist_status_cn30xx cn52xxp1; +struct cvmx_iob_bist_status_cn30xx cn56xx; +struct cvmx_iob_bist_status_cn30xx cn56xxp1; +struct cvmx_iob_bist_status_cn30xx cn58xx; +struct cvmx_iob_bist_status_cn30xx cn58xxp1; +struct cvmx_iob_bist_status_cn61xx { +u64 reserved_23_63 :41 ; +u64 xmdfif :1 ; +u64 xmcfif :1 ; +u64 iorfif :1 ; +u64 rsdfif :1 ; +u64 iocfif :1 ; +u64 icnrcb :1 ; +u64 icr0 :1 ; +u64 icr1 :1 ; +u64 icnr1 :1 ; +u64 icnr0 :1 ; +u64 ibdr0 :1 ; +u64 ibdr1 :1 ; +u64 ibr0 :1 ; +u64 ibr1 :1 ; +u64 icnrt :1 ; +u64 ibrq0 :1 ; +u64 ibrq1 :1 ; +u64 icrn0 :1 ; +u64 icrn1 :1 ; +u64 icrp0 :1 ; +u64 icrp1 :1 ; +u64 ibd :1 ; +u64 icd :1 ; + } cn61xx; +struct cvmx_iob_bist_status_cn61xx cn63xx; +struct cvmx_iob_bist_status_cn61xx cn63xxp1; +struct cvmx_iob_bist_status_cn61xx cn66xx; +struct cvmx_iob_bist_status_cn68xx { +u64 reserved_18_63 :46 ; +u64 xmdfif :1 ; +u64 xmcfif :1 ; +u64 iorfif :1 ; +u64 rsdfif :1 ; +u64 iocfif :1 ; +u64 icnrcb :1 ; +u64 icr0 :1 ; +u64 icr1 :1 ; +u64 icnr0 :1 ; +u64 ibr0 :1 ; +u64 ibr1 :1 ; +u64 icnrt :1 ; +u64 ibrq0 :1 ; +u64 ibrq1 :1 ; +u64 icrn0 :1 ; +u64 icrn1 :1 ; +u64 ibd :1 ; +u64 icd :1 ; + } cn68xx; +struct cvmx_iob_bist_status_cn68xx cn68xxp1; +struct cvmx_iob_bist_status_cn61xx cn70xx; +struct cvmx_iob_bist_status_cn61xx cn70xxp1; +struct cvmx_iob_bist_status_cn61xx cnf71xx; +}; + +typedef union cvmx_iob_bist_status cvmx_iob_bist_status_t ; + +/** +* cvmx_iob_chip_cur_pwr +*/ +union cvmx_iob_chip_cur_pwr { +u64 u64; +struct cvmx_iob_chip_cur_pwr_s { +u64 reserved_8_63 :56 ; +u64 current_power_setting :8 ; + } s; +struct cvmx_iob_chip_cur_pwr_s cn70xx; +struct cvmx_iob_chip_cur_pwr_s cn70xxp1; +}; + +typedef union cvmx_iob_chip_cur_pwr cvmx_iob_chip_cur_pwr_t ; + +/** +* cvmx_iob_chip_glb_pwr_throttle +* +* Controls the min/max power settings. +* +*/ +union cvmx_iob_chip_glb_pwr_throttle { +u64 u64; +struct cvmx_iob_chip_glb_pwr_throttle_s { +u64 reserved_34_63 :30 ; +u64 pwr_bw :2 ; +u64 pwr_max :8 ; +u64 pwr_min :8 ; +u64 pwr_setting :16 ; + } s; +struct cvmx_iob_chip_glb_pwr_throttle_s cn70xx; +struct cvmx_iob_chip_glb_pwr_throttle_s cn70xxp1; +}; + +typedef union cvmx_iob_chip_glb_pwr_throttle cvmx_iob_chip_glb_pwr_throttle_t ; + +/** +* cvmx_iob_chip_pwr_out +* +* Power numbers from the various partitions on the chip. +* +*/ +union cvmx_iob_chip_pwr_out { +u64 u64; +struct cvmx_iob_chip_pwr_out_s { +u64 cpu_pwr :16 ; +u64 chip_power :16 ; +u64 coproc_power :16 ; +u64 avg_chip_power :16 ; + } s; +struct cvmx_iob_chip_pwr_out_s cn70xx; +struct cvmx_iob_chip_pwr_out_s cn70xxp1; +}; + +typedef union cvmx_iob_chip_pwr_out cvmx_iob_chip_pwr_out_t ; + +/** +* cvmx_iob_ctl_status +* +* IOB Control Status = IOB Control and Status Register +* Provides control for IOB functions. +*/ +union cvmx_iob_ctl_status { +u64 u64; +struct cvmx_iob_ctl_status_s { +u64 reserved_11_63 :53 ; +u64 fif_dly :1 ; +u64 xmc_per :4 ; +u64 reserved_3_5 :3 ; +u64 pko_enb :1 ; +u64 dwb_enb :1 ; +u64 fau_end :1 ; + } s; +struct cvmx_iob_ctl_status_cn30xx { +u64 reserved_5_63 :59 ; +u64 outb_mat :1 ; +u64 inb_mat :1 ; +u64 pko_enb :1 ; +u64 dwb_enb :1 ; +u64 fau_end :1 ; + } cn30xx; +struct cvmx_iob_ctl_status_cn30xx cn31xx; +struct cvmx_iob_ctl_status_cn30xx cn38xx; +struct cvmx_iob_ctl_status_cn30xx cn38xxp2; +struct cvmx_iob_ctl_status_cn30xx cn50xx; +struct cvmx_iob_ctl_status_cn52xx { +u64 reserved_6_63 :58 ; +u64 rr_mode :1 ; +u64 outb_mat :1 ; +u64 inb_mat :1 ; +u64 pko_enb :1 ; +u64 dwb_enb :1 ; +u64 fau_end :1 ; + } cn52xx; +struct cvmx_iob_ctl_status_cn30xx cn52xxp1; +struct cvmx_iob_ctl_status_cn30xx cn56xx; +struct cvmx_iob_ctl_status_cn30xx cn56xxp1; +struct cvmx_iob_ctl_status_cn30xx cn58xx; +struct cvmx_iob_ctl_status_cn30xx cn58xxp1; +struct cvmx_iob_ctl_status_cn61xx { +u64 reserved_11_63 :53 ; +u64 fif_dly :1 ; +u64 xmc_per :4 ; +u64 rr_mode :1 ; +u64 outb_mat :1 ; +u64 inb_mat :1 ; +u64 pko_enb :1 ; +u64 dwb_enb :1 ; +u64 fau_end :1 ; + } cn61xx; +struct cvmx_iob_ctl_status_cn63xx { +u64 reserved_10_63 :54 ; +u64 xmc_per :4 ; +u64 rr_mode :1 ; +u64 outb_mat :1 ; +u64 inb_mat :1 ; +u64 pko_enb :1 ; +u64 dwb_enb :1 ; +u64 fau_end :1 ; + } cn63xx; +struct cvmx_iob_ctl_status_cn63xx cn63xxp1; +struct cvmx_iob_ctl_status_cn61xx cn66xx; +struct cvmx_iob_ctl_status_cn68xx { +u64 reserved_11_63 :53 ; +u64 fif_dly :1 ; +u64 xmc_per :4 ; +u64 rsvr5 :1 ; +u64 outb_mat :1 ; +u64 inb_mat :1 ; +u64 pko_enb :1 ; +u64 dwb_enb :1 ; +u64 fau_end :1 ; + } cn68xx; +struct cvmx_iob_ctl_status_cn68xx cn68xxp1; +struct cvmx_iob_ctl_status_cn70xx { +u64 reserved_10_63 :54 ; +u64 xmc_per :4 ; +u64 rr_mode :1 ; +u64 rsv4 :1 ; +u64 rsv3 :1 ; +u64 pko_enb :1 ; +u64 dwb_enb :1 ; +u64 fau_end :1 ; + } cn70xx; +struct cvmx_iob_ctl_status_cn70xx cn70xxp1; +struct cvmx_iob_ctl_status_cn61xx cnf71xx; +}; + +typedef union cvmx_iob_ctl_status cvmx_iob_ctl_status_t ; + +/** +* cvmx_iob_dwb_pri_cnt +* +* DWB To CMB Priority Counter = Don't Write Back to CMB Priority Counter Enable and Timer Value +* Enables and supplies the timeout count for raising the priority of Don't Write Back request to +* the L2C. +*/ +union cvmx_iob_dwb_pri_cnt { +u64 u64; +struct cvmx_iob_dwb_pri_cnt_s { +u64 reserved_16_63 :48 ; +u64 cnt_enb :1 ; +u64 cnt_val :15 ; + } s; +struct cvmx_iob_dwb_pri_cnt_s cn38xx; +struct cvmx_iob_dwb_pri_cnt_s cn38xxp2; +struct cvmx_iob_dwb_pri_cnt_s cn52xx; +struct cvmx_iob_dwb_pri_cnt_s cn52xxp1; +struct cvmx_iob_dwb_pri_cnt_s cn56xx; +struct cvmx_iob_dwb_pri_cnt_s cn56xxp1; +struct cvmx_iob_dwb_pri_cnt_s cn58xx; +struct cvmx_iob_dwb_pri_cnt_s cn58xxp1; +struct cvmx_iob_dwb_pri_cnt_s cn61xx; +struct cvmx_iob_dwb_pri_cnt_s cn63xx; +struct cvmx_iob_dwb_pri_cnt_s cn63xxp1; +struct cvmx_iob_dwb_pri_cnt_s cn66xx; +struct cvmx_iob_dwb_pri_cnt_s cn70xx; +struct cvmx_iob_dwb_pri_cnt_s cn70xxp1; +struct cvmx_iob_dwb_pri_cnt_s cnf71xx; +}; + +typedef union cvmx_iob_dwb_pri_cnt cvmx_iob_dwb_pri_cnt_t ; + +/** +* cvmx_iob_fau_timeout +* +* FAU Timeout = Fetch and Add Unit Tag-Switch Timeout +* How many clokc ticks the FAU unit will wait for a tag-switch before timing out. +* for Queue 0. +*/ +union cvmx_iob_fau_timeout { +u64 u64; +struct cvmx_iob_fau_timeout_s { +u64 reserved_13_63 :51 ; +u64 tout_enb :1 ; +u64 tout_val :12 ; + } s; +struct cvmx_iob_fau_timeout_s cn30xx; +struct cvmx_iob_fau_timeout_s cn31xx; +struct cvmx_iob_fau_timeout_s cn38xx; +struct cvmx_iob_fau_timeout_s cn38xxp2; +struct cvmx_iob_fau_timeout_s cn50xx; +struct cvmx_iob_fau_timeout_s cn52xx; +struct cvmx_iob_fau_timeout_s cn52xxp1; +struct cvmx_iob_fau_timeout_s cn56xx; +struct cvmx_iob_fau_timeout_s cn56xxp1; +struct cvmx_iob_fau_timeout_s cn58xx; +struct cvmx_iob_fau_timeout_s cn58xxp1; +struct cvmx_iob_fau_timeout_s cn61xx; +struct cvmx_iob_fau_timeout_s cn63xx; +struct cvmx_iob_fau_timeout_s cn63xxp1; +struct cvmx_iob_fau_timeout_s cn66xx; +struct cvmx_iob_fau_timeout_s cn68xx; +struct cvmx_iob_fau_timeout_s cn68xxp1; +struct cvmx_iob_fau_timeout_s cn70xx; +struct cvmx_iob_fau_timeout_s cn70xxp1; +struct cvmx_iob_fau_timeout_s cnf71xx; +}; + +typedef union cvmx_iob_fau_timeout cvmx_iob_fau_timeout_t ; + +/** +* cvmx_iob_i2c_pri_cnt +* +* IPD To CMB Store Priority Counter = IPD to CMB Store Priority Counter Enable and Timer Value +* Enables and supplies the timeout count for raising the priority of IPD Store access to the +* CMB. +*/ +union cvmx_iob_i2c_pri_cnt { +u64 u64; +struct cvmx_iob_i2c_pri_cnt_s { +u64 reserved_16_63 :48 ; +u64 cnt_enb :1 ; +u64 cnt_val :15 ; + } s; +struct cvmx_iob_i2c_pri_cnt_s cn38xx; +struct cvmx_iob_i2c_pri_cnt_s cn38xxp2; +struct cvmx_iob_i2c_pri_cnt_s cn52xx; +struct cvmx_iob_i2c_pri_cnt_s cn52xxp1; +struct cvmx_iob_i2c_pri_cnt_s cn56xx; +struct cvmx_iob_i2c_pri_cnt_s cn56xxp1; +struct cvmx_iob_i2c_pri_cnt_s cn58xx; +struct cvmx_iob_i2c_pri_cnt_s cn58xxp1; +struct cvmx_iob_i2c_pri_cnt_s cn61xx; +struct cvmx_iob_i2c_pri_cnt_s cn63xx; +struct cvmx_iob_i2c_pri_cnt_s cn63xxp1; +struct cvmx_iob_i2c_pri_cnt_s cn66xx; +struct cvmx_iob_i2c_pri_cnt_s cn70xx; +struct cvmx_iob_i2c_pri_cnt_s cn70xxp1; +struct cvmx_iob_i2c_pri_cnt_s cnf71xx; +}; + +typedef union cvmx_iob_i2c_pri_cnt cvmx_iob_i2c_pri_cnt_t ; + +/** +* cvmx_iob_inb_control_match +* +* Match pattern for the inbound control to set the INB_MATCH_BIT. +* +*/ +union cvmx_iob_inb_control_match { +u64 u64; +struct cvmx_iob_inb_control_match_s { +u64 reserved_29_63 :35 ; +u64 mask :8 ; +u64 opc :4 ; +u64 dst :9 ; +u64 src :8 ; + } s; +struct cvmx_iob_inb_control_match_s cn30xx; +struct cvmx_iob_inb_control_match_s cn31xx; +struct cvmx_iob_inb_control_match_s cn38xx; +struct cvmx_iob_inb_control_match_s cn38xxp2; +struct cvmx_iob_inb_control_match_s cn50xx; +struct cvmx_iob_inb_control_match_s cn52xx; +struct cvmx_iob_inb_control_match_s cn52xxp1; +struct cvmx_iob_inb_control_match_s cn56xx; +struct cvmx_iob_inb_control_match_s cn56xxp1; +struct cvmx_iob_inb_control_match_s cn58xx; +struct cvmx_iob_inb_control_match_s cn58xxp1; +struct cvmx_iob_inb_control_match_s cn61xx; +struct cvmx_iob_inb_control_match_s cn63xx; +struct cvmx_iob_inb_control_match_s cn63xxp1; +struct cvmx_iob_inb_control_match_s cn66xx; +struct cvmx_iob_inb_control_match_s cn68xx; +struct cvmx_iob_inb_control_match_s cn68xxp1; +struct cvmx_iob_inb_control_match_s cn70xx; +struct cvmx_iob_inb_control_match_s cn70xxp1; +struct cvmx_iob_inb_control_match_s cnf71xx; +}; + +typedef union cvmx_iob_inb_control_match cvmx_iob_inb_control_match_t ; + +/** +* cvmx_iob_inb_control_match_enb +* +* Enables the match of the corresponding bit in the IOB_INB_CONTROL_MATCH reister. +* +*/ +union cvmx_iob_inb_control_match_enb { +u64 u64; +struct cvmx_iob_inb_control_match_enb_s { +u64 reserved_29_63 :35 ; +u64 mask :8 ; +u64 opc :4 ; +u64 dst :9 ; +u64 src :8 ; + } s; +struct cvmx_iob_inb_control_match_enb_s cn30xx; +struct cvmx_iob_inb_control_match_enb_s cn31xx; +struct cvmx_iob_inb_control_match_enb_s cn38xx; +struct cvmx_iob_inb_control_match_enb_s cn38xxp2; +struct cvmx_iob_inb_control_match_enb_s cn50xx; +struct cvmx_iob_inb_control_match_enb_s cn52xx; +struct cvmx_iob_inb_control_match_enb_s cn52xxp1; +struct cvmx_iob_inb_control_match_enb_s cn56xx; +struct cvmx_iob_inb_control_match_enb_s cn56xxp1; +struct cvmx_iob_inb_control_match_enb_s cn58xx; +struct cvmx_iob_inb_control_match_enb_s cn58xxp1; +struct cvmx_iob_inb_control_match_enb_s cn61xx; +struct cvmx_iob_inb_control_match_enb_s cn63xx; +struct cvmx_iob_inb_control_match_enb_s cn63xxp1; +struct cvmx_iob_inb_control_match_enb_s cn66xx; +struct cvmx_iob_inb_control_match_enb_s cn68xx; +struct cvmx_iob_inb_control_match_enb_s cn68xxp1; +struct cvmx_iob_inb_control_match_enb_s cn70xx; +struct cvmx_iob_inb_control_match_enb_s cn70xxp1; +struct cvmx_iob_inb_control_match_enb_s cnf71xx; +}; + +typedef union cvmx_iob_inb_control_match_enb cvmx_iob_inb_control_match_enb_t ; + +/** +* cvmx_iob_inb_data_match +* +* Match pattern for the inbound data to set the INB_MATCH_BIT. +* +*/ +union cvmx_iob_inb_data_match { +u64 u64; +struct cvmx_iob_inb_data_match_s { +u64 data :64 ; + } s; +struct cvmx_iob_inb_data_match_s cn30xx; +struct cvmx_iob_inb_data_match_s cn31xx; +struct cvmx_iob_inb_data_match_s cn38xx; +struct cvmx_iob_inb_data_match_s cn38xxp2; +struct cvmx_iob_inb_data_match_s cn50xx; +struct cvmx_iob_inb_data_match_s cn52xx; +struct cvmx_iob_inb_data_match_s cn52xxp1; +struct cvmx_iob_inb_data_match_s cn56xx; +struct cvmx_iob_inb_data_match_s cn56xxp1; +struct cvmx_iob_inb_data_match_s cn58xx; +struct cvmx_iob_inb_data_match_s cn58xxp1; +struct cvmx_iob_inb_data_match_s cn61xx; +struct cvmx_iob_inb_data_match_s cn63xx; +struct cvmx_iob_inb_data_match_s cn63xxp1; +struct cvmx_iob_inb_data_match_s cn66xx; +struct cvmx_iob_inb_data_match_s cn68xx; +struct cvmx_iob_inb_data_match_s cn68xxp1; +struct cvmx_iob_inb_data_match_s cn70xx; +struct cvmx_iob_inb_data_match_s cn70xxp1; +struct cvmx_iob_inb_data_match_s cnf71xx; +}; + +typedef union cvmx_iob_inb_data_match cvmx_iob_inb_data_match_t ; + +/** +* cvmx_iob_inb_data_match_enb +* +* Enables the match of the corresponding bit in the IOB_INB_DATA_MATCH reister. +* +*/ +union cvmx_iob_inb_data_match_enb { +u64 u64; +struct cvmx_iob_inb_data_match_enb_s { +u64 data :64 ; + } s; +struct cvmx_iob_inb_data_match_enb_s cn30xx; +struct cvmx_iob_inb_data_match_enb_s cn31xx; +struct cvmx_iob_inb_data_match_enb_s cn38xx; +struct cvmx_iob_inb_data_match_enb_s cn38xxp2; +struct cvmx_iob_inb_data_match_enb_s cn50xx; +struct cvmx_iob_inb_data_match_enb_s cn52xx; +struct cvmx_iob_inb_data_match_enb_s cn52xxp1; +struct cvmx_iob_inb_data_match_enb_s cn56xx; +struct cvmx_iob_inb_data_match_enb_s cn56xxp1; +struct cvmx_iob_inb_data_match_enb_s cn58xx; +struct cvmx_iob_inb_data_match_enb_s cn58xxp1; +struct cvmx_iob_inb_data_match_enb_s cn61xx; +struct cvmx_iob_inb_data_match_enb_s cn63xx; +struct cvmx_iob_inb_data_match_enb_s cn63xxp1; +struct cvmx_iob_inb_data_match_enb_s cn66xx; +struct cvmx_iob_inb_data_match_enb_s cn68xx; +struct cvmx_iob_inb_data_match_enb_s cn68xxp1; +struct cvmx_iob_inb_data_match_enb_s cn70xx; +struct cvmx_iob_inb_data_match_enb_s cn70xxp1; +struct cvmx_iob_inb_data_match_enb_s cnf71xx; +}; + +typedef union cvmx_iob_inb_data_match_enb cvmx_iob_inb_data_match_enb_t ; + +/** +* cvmx_iob_int_enb +* +* The IOB's interrupt enable register. +* +*/ +union cvmx_iob_int_enb { +u64 u64; +struct cvmx_iob_int_enb_s { +u64 reserved_8_63 :56 ; +u64 outb_mat :1 ; +u64 inb_mat :1 ; +u64 p_dat :1 ; +u64 np_dat :1 ; +u64 p_eop :1 ; +u64 p_sop :1 ; +u64 np_eop :1 ; +u64 np_sop :1 ; + } s; +struct cvmx_iob_int_enb_cn30xx { +u64 reserved_4_63 :60 ; +u64 p_eop :1 ; +u64 p_sop :1 ; +u64 np_eop :1 ; +u64 np_sop :1 ; + } cn30xx; +struct cvmx_iob_int_enb_cn30xx cn31xx; +struct cvmx_iob_int_enb_cn30xx cn38xx; +struct cvmx_iob_int_enb_cn30xx cn38xxp2; +struct cvmx_iob_int_enb_cn50xx { +u64 reserved_6_63 :58 ; +u64 p_dat :1 ; +u64 np_dat :1 ; +u64 p_eop :1 ; +u64 p_sop :1 ; +u64 np_eop :1 ; +u64 np_sop :1 ; + } cn50xx; +struct cvmx_iob_int_enb_cn50xx cn52xx; +struct cvmx_iob_int_enb_cn50xx cn52xxp1; +struct cvmx_iob_int_enb_cn50xx cn56xx; +struct cvmx_iob_int_enb_cn50xx cn56xxp1; +struct cvmx_iob_int_enb_cn50xx cn58xx; +struct cvmx_iob_int_enb_cn50xx cn58xxp1; +struct cvmx_iob_int_enb_cn50xx cn61xx; +struct cvmx_iob_int_enb_cn50xx cn63xx; +struct cvmx_iob_int_enb_cn50xx cn63xxp1; +struct cvmx_iob_int_enb_cn50xx cn66xx; +struct cvmx_iob_int_enb_cn68xx { +u64 reserved_0_63 :64 ; + } cn68xx; +struct cvmx_iob_int_enb_cn68xx cn68xxp1; +struct cvmx_iob_int_enb_s cn70xx; +struct cvmx_iob_int_enb_s cn70xxp1; +struct cvmx_iob_int_enb_cn50xx cnf71xx; +}; + +typedef union cvmx_iob_int_enb cvmx_iob_int_enb_t ; + +/** +* cvmx_iob_int_sum +* +* Contains the different interrupt summary bits of the IOB. +* +*/ +union cvmx_iob_int_sum { +u64 u64; +struct cvmx_iob_int_sum_s { +u64 reserved_8_63 :56 ; +u64 outb_mat :1 ; +u64 inb_mat :1 ; +u64 p_dat :1 ; +u64 np_dat :1 ; +u64 p_eop :1 ; +u64 p_sop :1 ; +u64 np_eop :1 ; +u64 np_sop :1 ; + } s; +struct cvmx_iob_int_sum_cn30xx { +u64 reserved_4_63 :60 ; +u64 p_eop :1 ; +u64 p_sop :1 ; +u64 np_eop :1 ; +u64 np_sop :1 ; + } cn30xx; +struct cvmx_iob_int_sum_cn30xx cn31xx; +struct cvmx_iob_int_sum_cn30xx cn38xx; +struct cvmx_iob_int_sum_cn30xx cn38xxp2; +struct cvmx_iob_int_sum_cn50xx { +u64 reserved_6_63 :58 ; +u64 p_dat :1 ; +u64 np_dat :1 ; +u64 p_eop :1 ; +u64 p_sop :1 ; +u64 np_eop :1 ; +u64 np_sop :1 ; + } cn50xx; +struct cvmx_iob_int_sum_cn50xx cn52xx; +struct cvmx_iob_int_sum_cn50xx cn52xxp1; +struct cvmx_iob_int_sum_cn50xx cn56xx; +struct cvmx_iob_int_sum_cn50xx cn56xxp1; +struct cvmx_iob_int_sum_cn50xx cn58xx; +struct cvmx_iob_int_sum_cn50xx cn58xxp1; +struct cvmx_iob_int_sum_cn50xx cn61xx; +struct cvmx_iob_int_sum_cn50xx cn63xx; +struct cvmx_iob_int_sum_cn50xx cn63xxp1; +struct cvmx_iob_int_sum_cn50xx cn66xx; +struct cvmx_iob_int_sum_cn68xx { +u64 reserved_0_63 :64 ; + } cn68xx; +struct cvmx_iob_int_sum_cn68xx cn68xxp1; +struct cvmx_iob_int_sum_s cn70xx; +struct cvmx_iob_int_sum_s cn70xxp1; +struct cvmx_iob_int_sum_cn50xx cnf71xx; +}; + +typedef union cvmx_iob_int_sum cvmx_iob_int_sum_t ; + +/** +* cvmx_iob_n2c_l2c_pri_cnt +* +* NCB To CMB L2C Priority Counter = NCB to CMB L2C Priority Counter Enable and Timer Value +* Enables and supplies the timeout count for raising the priority of NCB Store/Load access to +* the CMB. +*/ +union cvmx_iob_n2c_l2c_pri_cnt { +u64 u64; +struct cvmx_iob_n2c_l2c_pri_cnt_s { +u64 reserved_16_63 :48 ; +u64 cnt_enb :1 ; +u64 cnt_val :15 ; + } s; +struct cvmx_iob_n2c_l2c_pri_cnt_s cn38xx; +struct cvmx_iob_n2c_l2c_pri_cnt_s cn38xxp2; +struct cvmx_iob_n2c_l2c_pri_cnt_s cn52xx; +struct cvmx_iob_n2c_l2c_pri_cnt_s cn52xxp1; +struct cvmx_iob_n2c_l2c_pri_cnt_s cn56xx; +struct cvmx_iob_n2c_l2c_pri_cnt_s cn56xxp1; +struct cvmx_iob_n2c_l2c_pri_cnt_s cn58xx; +struct cvmx_iob_n2c_l2c_pri_cnt_s cn58xxp1; +struct cvmx_iob_n2c_l2c_pri_cnt_s cn61xx; +struct cvmx_iob_n2c_l2c_pri_cnt_s cn63xx; +struct cvmx_iob_n2c_l2c_pri_cnt_s cn63xxp1; +struct cvmx_iob_n2c_l2c_pri_cnt_s cn66xx; +struct cvmx_iob_n2c_l2c_pri_cnt_s cn70xx; +struct cvmx_iob_n2c_l2c_pri_cnt_s cn70xxp1; +struct cvmx_iob_n2c_l2c_pri_cnt_s cnf71xx; +}; + +typedef union cvmx_iob_n2c_l2c_pri_cnt cvmx_iob_n2c_l2c_pri_cnt_t ; + +/** +* cvmx_iob_n2c_rsp_pri_cnt +* +* NCB To CMB Response Priority Counter = NCB to CMB Response Priority Counter Enable and Timer +* Value +* Enables and supplies the timeout count for raising the priority of NCB Responses access to the +* CMB. +*/ +union cvmx_iob_n2c_rsp_pri_cnt { +u64 u64; +struct cvmx_iob_n2c_rsp_pri_cnt_s { +u64 reserved_16_63 :48 ; +u64 cnt_enb :1 ; +u64 cnt_val :15 ; + } s; +struct cvmx_iob_n2c_rsp_pri_cnt_s cn38xx; +struct cvmx_iob_n2c_rsp_pri_cnt_s cn38xxp2; +struct cvmx_iob_n2c_rsp_pri_cnt_s cn52xx; +struct cvmx_iob_n2c_rsp_pri_cnt_s cn52xxp1; +struct cvmx_iob_n2c_rsp_pri_cnt_s cn56xx; +struct cvmx_iob_n2c_rsp_pri_cnt_s cn56xxp1; +struct cvmx_iob_n2c_rsp_pri_cnt_s cn58xx; +struct cvmx_iob_n2c_rsp_pri_cnt_s cn58xxp1; +struct cvmx_iob_n2c_rsp_pri_cnt_s cn61xx; +struct cvmx_iob_n2c_rsp_pri_cnt_s cn63xx; +struct cvmx_iob_n2c_rsp_pri_cnt_s cn63xxp1; +struct cvmx_iob_n2c_rsp_pri_cnt_s cn66xx; +struct cvmx_iob_n2c_rsp_pri_cnt_s cn70xx; +struct cvmx_iob_n2c_rsp_pri_cnt_s cn70xxp1; +struct cvmx_iob_n2c_rsp_pri_cnt_s cnf71xx; +}; + +typedef union cvmx_iob_n2c_rsp_pri_cnt cvmx_iob_n2c_rsp_pri_cnt_t ; + +/** +* cvmx_iob_outb_com_pri_cnt +* +* Commit To NCB Priority Counter = Commit to NCB Priority Counter Enable and Timer Value +* Enables and supplies the timeout count for raising the priority of Commit request to the +* Outbound NCB. +*/ +union cvmx_iob_outb_com_pri_cnt { +u64 u64; +struct cvmx_iob_outb_com_pri_cnt_s { +u64 reserved_16_63 :48 ; +u64 cnt_enb :1 ; +u64 cnt_val :15 ; + } s; +struct cvmx_iob_outb_com_pri_cnt_s cn38xx; +struct cvmx_iob_outb_com_pri_cnt_s cn38xxp2; +struct cvmx_iob_outb_com_pri_cnt_s cn52xx; +struct cvmx_iob_outb_com_pri_cnt_s cn52xxp1; +struct cvmx_iob_outb_com_pri_cnt_s cn56xx; +struct cvmx_iob_outb_com_pri_cnt_s cn56xxp1; +struct cvmx_iob_outb_com_pri_cnt_s cn58xx; +struct cvmx_iob_outb_com_pri_cnt_s cn58xxp1; +struct cvmx_iob_outb_com_pri_cnt_s cn61xx; +struct cvmx_iob_outb_com_pri_cnt_s cn63xx; +struct cvmx_iob_outb_com_pri_cnt_s cn63xxp1; +struct cvmx_iob_outb_com_pri_cnt_s cn66xx; +struct cvmx_iob_outb_com_pri_cnt_s cn68xx; +struct cvmx_iob_outb_com_pri_cnt_s cn68xxp1; +struct cvmx_iob_outb_com_pri_cnt_s cn70xx; +struct cvmx_iob_outb_com_pri_cnt_s cn70xxp1; +struct cvmx_iob_outb_com_pri_cnt_s cnf71xx; +}; + +typedef union cvmx_iob_outb_com_pri_cnt cvmx_iob_outb_com_pri_cnt_t ; + +/** +* cvmx_iob_outb_control_match +* +* Match pattern for the outbound control to set the OUTB_MATCH_BIT. +* +*/ +union cvmx_iob_outb_control_match { +u64 u64; +struct cvmx_iob_outb_control_match_s { +u64 reserved_26_63 :38 ; +u64 mask :8 ; +u64 eot :1 ; +u64 dst :8 ; +u64 src :9 ; + } s; +struct cvmx_iob_outb_control_match_s cn30xx; +struct cvmx_iob_outb_control_match_s cn31xx; +struct cvmx_iob_outb_control_match_s cn38xx; +struct cvmx_iob_outb_control_match_s cn38xxp2; +struct cvmx_iob_outb_control_match_s cn50xx; +struct cvmx_iob_outb_control_match_s cn52xx; +struct cvmx_iob_outb_control_match_s cn52xxp1; +struct cvmx_iob_outb_control_match_s cn56xx; +struct cvmx_iob_outb_control_match_s cn56xxp1; +struct cvmx_iob_outb_control_match_s cn58xx; +struct cvmx_iob_outb_control_match_s cn58xxp1; +struct cvmx_iob_outb_control_match_s cn61xx; +struct cvmx_iob_outb_control_match_s cn63xx; +struct cvmx_iob_outb_control_match_s cn63xxp1; +struct cvmx_iob_outb_control_match_s cn66xx; +struct cvmx_iob_outb_control_match_s cn68xx; +struct cvmx_iob_outb_control_match_s cn68xxp1; +struct cvmx_iob_outb_control_match_s cn70xx; +struct cvmx_iob_outb_control_match_s cn70xxp1; +struct cvmx_iob_outb_control_match_s cnf71xx; +}; + +typedef union cvmx_iob_outb_control_match cvmx_iob_outb_control_match_t ; + +/** +* cvmx_iob_outb_control_match_enb +* +* Enables the match of the corresponding bit in the IOB_OUTB_CONTROL_MATCH reister. +* +*/ +union cvmx_iob_outb_control_match_enb { +u64 u64; +struct cvmx_iob_outb_control_match_enb_s { +u64 reserved_26_63 :38 ; +u64 mask :8 ; +u64 eot :1 ; +u64 dst :8 ; +u64 src :9 ; + } s; +struct cvmx_iob_outb_control_match_enb_s cn30xx; +struct cvmx_iob_outb_control_match_enb_s cn31xx; +struct cvmx_iob_outb_control_match_enb_s cn38xx; +struct cvmx_iob_outb_control_match_enb_s cn38xxp2; +struct cvmx_iob_outb_control_match_enb_s cn50xx; +struct cvmx_iob_outb_control_match_enb_s cn52xx; +struct cvmx_iob_outb_control_match_enb_s cn52xxp1; +struct cvmx_iob_outb_control_match_enb_s cn56xx; +struct cvmx_iob_outb_control_match_enb_s cn56xxp1; +struct cvmx_iob_outb_control_match_enb_s cn58xx; +struct cvmx_iob_outb_control_match_enb_s cn58xxp1; +struct cvmx_iob_outb_control_match_enb_s cn61xx; +struct cvmx_iob_outb_control_match_enb_s cn63xx; +struct cvmx_iob_outb_control_match_enb_s cn63xxp1; +struct cvmx_iob_outb_control_match_enb_s cn66xx; +struct cvmx_iob_outb_control_match_enb_s cn68xx; +struct cvmx_iob_outb_control_match_enb_s cn68xxp1; +struct cvmx_iob_outb_control_match_enb_s cn70xx; +struct cvmx_iob_outb_control_match_enb_s cn70xxp1; +struct cvmx_iob_outb_control_match_enb_s cnf71xx; +}; + +typedef union cvmx_iob_outb_control_match_enb cvmx_iob_outb_control_match_enb_t ; + +/** +* cvmx_iob_outb_data_match +* +* Match pattern for the outbound data to set the OUTB_MATCH_BIT. +* +*/ +union cvmx_iob_outb_data_match { +u64 u64; +struct cvmx_iob_outb_data_match_s { +u64 data :64 ; + } s; +struct cvmx_iob_outb_data_match_s cn30xx; +struct cvmx_iob_outb_data_match_s cn31xx; +struct cvmx_iob_outb_data_match_s cn38xx; +struct cvmx_iob_outb_data_match_s cn38xxp2; +struct cvmx_iob_outb_data_match_s cn50xx; +struct cvmx_iob_outb_data_match_s cn52xx; +struct cvmx_iob_outb_data_match_s cn52xxp1; +struct cvmx_iob_outb_data_match_s cn56xx; +struct cvmx_iob_outb_data_match_s cn56xxp1; +struct cvmx_iob_outb_data_match_s cn58xx; +struct cvmx_iob_outb_data_match_s cn58xxp1; +struct cvmx_iob_outb_data_match_s cn61xx; +struct cvmx_iob_outb_data_match_s cn63xx; +struct cvmx_iob_outb_data_match_s cn63xxp1; +struct cvmx_iob_outb_data_match_s cn66xx; +struct cvmx_iob_outb_data_match_s cn68xx; +struct cvmx_iob_outb_data_match_s cn68xxp1; +struct cvmx_iob_outb_data_match_s cn70xx; +struct cvmx_iob_outb_data_match_s cn70xxp1; +struct cvmx_iob_outb_data_match_s cnf71xx; +}; + +typedef union cvmx_iob_outb_data_match cvmx_iob_outb_data_match_t ; + +/** +* cvmx_iob_outb_data_match_enb +* +* Enables the match of the corresponding bit in the IOB_OUTB_DATA_MATCH reister. +* +*/ +union cvmx_iob_outb_data_match_enb { +u64 u64; +struct cvmx_iob_outb_data_match_enb_s { +u64 data :64 ; + } s; +struct cvmx_iob_outb_data_match_enb_s cn30xx; +struct cvmx_iob_outb_data_match_enb_s cn31xx; +struct cvmx_iob_outb_data_match_enb_s cn38xx; +struct cvmx_iob_outb_data_match_enb_s cn38xxp2; +struct cvmx_iob_outb_data_match_enb_s cn50xx; +struct cvmx_iob_outb_data_match_enb_s cn52xx; +struct cvmx_iob_outb_data_match_enb_s cn52xxp1; +struct cvmx_iob_outb_data_match_enb_s cn56xx; +struct cvmx_iob_outb_data_match_enb_s cn56xxp1; +struct cvmx_iob_outb_data_match_enb_s cn58xx; +struct cvmx_iob_outb_data_match_enb_s cn58xxp1; +struct cvmx_iob_outb_data_match_enb_s cn61xx; +struct cvmx_iob_outb_data_match_enb_s cn63xx; +struct cvmx_iob_outb_data_match_enb_s cn63xxp1; +struct cvmx_iob_outb_data_match_enb_s cn66xx; +struct cvmx_iob_outb_data_match_enb_s cn68xx; +struct cvmx_iob_outb_data_match_enb_s cn68xxp1; +struct cvmx_iob_outb_data_match_enb_s cn70xx; +struct cvmx_iob_outb_data_match_enb_s cn70xxp1; +struct cvmx_iob_outb_data_match_enb_s cnf71xx; +}; + +typedef union cvmx_iob_outb_data_match_enb cvmx_iob_outb_data_match_enb_t ; + +/** +* cvmx_iob_outb_fpa_pri_cnt +* +* FPA To NCB Priority Counter = FPA Returns to NCB Priority Counter Enable and Timer Value +* Enables and supplies the timeout count for raising the priority of FPA Rreturn Page request to +* the Outbound NCB. +*/ +union cvmx_iob_outb_fpa_pri_cnt { +u64 u64; +struct cvmx_iob_outb_fpa_pri_cnt_s { +u64 reserved_16_63 :48 ; +u64 cnt_enb :1 ; +u64 cnt_val :15 ; + } s; +struct cvmx_iob_outb_fpa_pri_cnt_s cn38xx; +struct cvmx_iob_outb_fpa_pri_cnt_s cn38xxp2; +struct cvmx_iob_outb_fpa_pri_cnt_s cn52xx; +struct cvmx_iob_outb_fpa_pri_cnt_s cn52xxp1; +struct cvmx_iob_outb_fpa_pri_cnt_s cn56xx; +struct cvmx_iob_outb_fpa_pri_cnt_s cn56xxp1; +struct cvmx_iob_outb_fpa_pri_cnt_s cn58xx; +struct cvmx_iob_outb_fpa_pri_cnt_s cn58xxp1; +struct cvmx_iob_outb_fpa_pri_cnt_s cn61xx; +struct cvmx_iob_outb_fpa_pri_cnt_s cn63xx; +struct cvmx_iob_outb_fpa_pri_cnt_s cn63xxp1; +struct cvmx_iob_outb_fpa_pri_cnt_s cn66xx; +struct cvmx_iob_outb_fpa_pri_cnt_s cn68xx; +struct cvmx_iob_outb_fpa_pri_cnt_s cn68xxp1; +struct cvmx_iob_outb_fpa_pri_cnt_s cn70xx; +struct cvmx_iob_outb_fpa_pri_cnt_s cn70xxp1; +struct cvmx_iob_outb_fpa_pri_cnt_s cnf71xx; +}; + +typedef union cvmx_iob_outb_fpa_pri_cnt cvmx_iob_outb_fpa_pri_cnt_t ; + +/** +* cvmx_iob_outb_req_pri_cnt +* +* Request To NCB Priority Counter = Request to NCB Priority Counter Enable and Timer Value +* Enables and supplies the timeout count for raising the priority of Request transfers to the +* Outbound NCB. +*/ +union cvmx_iob_outb_req_pri_cnt { +u64 u64; +struct cvmx_iob_outb_req_pri_cnt_s { +u64 reserved_16_63 :48 ; +u64 cnt_enb :1 ; +u64 cnt_val :15 ; + } s; +struct cvmx_iob_outb_req_pri_cnt_s cn38xx; +struct cvmx_iob_outb_req_pri_cnt_s cn38xxp2; +struct cvmx_iob_outb_req_pri_cnt_s cn52xx; +struct cvmx_iob_outb_req_pri_cnt_s cn52xxp1; +struct cvmx_iob_outb_req_pri_cnt_s cn56xx; +struct cvmx_iob_outb_req_pri_cnt_s cn56xxp1; +struct cvmx_iob_outb_req_pri_cnt_s cn58xx; +struct cvmx_iob_outb_req_pri_cnt_s cn58xxp1; +struct cvmx_iob_outb_req_pri_cnt_s cn61xx; +struct cvmx_iob_outb_req_pri_cnt_s cn63xx; +struct cvmx_iob_outb_req_pri_cnt_s cn63xxp1; +struct cvmx_iob_outb_req_pri_cnt_s cn66xx; +struct cvmx_iob_outb_req_pri_cnt_s cn68xx; +struct cvmx_iob_outb_req_pri_cnt_s cn68xxp1; +struct cvmx_iob_outb_req_pri_cnt_s cn70xx; +struct cvmx_iob_outb_req_pri_cnt_s cn70xxp1; +struct cvmx_iob_outb_req_pri_cnt_s cnf71xx; +}; + +typedef union cvmx_iob_outb_req_pri_cnt cvmx_iob_outb_req_pri_cnt_t ; + +/** +* cvmx_iob_p2c_req_pri_cnt +* +* PKO To CMB Response Priority Counter = PKO to CMB Response Priority Counter Enable and Timer +* Value +* Enables and supplies the timeout count for raising the priority of PKO Load access to the CMB. +*/ +union cvmx_iob_p2c_req_pri_cnt { +u64 u64; +struct cvmx_iob_p2c_req_pri_cnt_s { +u64 reserved_16_63 :48 ; +u64 cnt_enb :1 ; +u64 cnt_val :15 ; + } s; +struct cvmx_iob_p2c_req_pri_cnt_s cn38xx; +struct cvmx_iob_p2c_req_pri_cnt_s cn38xxp2; +struct cvmx_iob_p2c_req_pri_cnt_s cn52xx; +struct cvmx_iob_p2c_req_pri_cnt_s cn52xxp1; +struct cvmx_iob_p2c_req_pri_cnt_s cn56xx; +struct cvmx_iob_p2c_req_pri_cnt_s cn56xxp1; +struct cvmx_iob_p2c_req_pri_cnt_s cn58xx; +struct cvmx_iob_p2c_req_pri_cnt_s cn58xxp1; +struct cvmx_iob_p2c_req_pri_cnt_s cn61xx; +struct cvmx_iob_p2c_req_pri_cnt_s cn63xx; +struct cvmx_iob_p2c_req_pri_cnt_s cn63xxp1; +struct cvmx_iob_p2c_req_pri_cnt_s cn66xx; +struct cvmx_iob_p2c_req_pri_cnt_s cn70xx; +struct cvmx_iob_p2c_req_pri_cnt_s cn70xxp1; +struct cvmx_iob_p2c_req_pri_cnt_s cnf71xx; +}; + +typedef union cvmx_iob_p2c_req_pri_cnt cvmx_iob_p2c_req_pri_cnt_t ; + +/** +* cvmx_iob_pkt_err +* +* Provides status about the failing packet recevie error. +* +*/ +union cvmx_iob_pkt_err { +u64 u64; +struct cvmx_iob_pkt_err_s { +u64 reserved_12_63 :52 ; +u64 vport :6 ; +u64 port :6 ; + } s; +struct cvmx_iob_pkt_err_cn30xx { +u64 reserved_6_63 :58 ; +u64 port :6 ; + } cn30xx; +struct cvmx_iob_pkt_err_cn30xx cn31xx; +struct cvmx_iob_pkt_err_cn30xx cn38xx; +struct cvmx_iob_pkt_err_cn30xx cn38xxp2; +struct cvmx_iob_pkt_err_cn30xx cn50xx; +struct cvmx_iob_pkt_err_cn30xx cn52xx; +struct cvmx_iob_pkt_err_cn30xx cn52xxp1; +struct cvmx_iob_pkt_err_cn30xx cn56xx; +struct cvmx_iob_pkt_err_cn30xx cn56xxp1; +struct cvmx_iob_pkt_err_cn30xx cn58xx; +struct cvmx_iob_pkt_err_cn30xx cn58xxp1; +struct cvmx_iob_pkt_err_s cn61xx; +struct cvmx_iob_pkt_err_s cn63xx; +struct cvmx_iob_pkt_err_s cn63xxp1; +struct cvmx_iob_pkt_err_s cn66xx; +struct cvmx_iob_pkt_err_s cn70xx; +struct cvmx_iob_pkt_err_s cn70xxp1; +struct cvmx_iob_pkt_err_s cnf71xx; +}; + +typedef union cvmx_iob_pkt_err cvmx_iob_pkt_err_t ; + +/** +* cvmx_iob_pp_bist_status +* +* The result of the BIST run on the PPs. +* +*/ +union cvmx_iob_pp_bist_status { +u64 u64; +struct cvmx_iob_pp_bist_status_s { +u64 reserved_4_63 :60 ; +u64 pp_bstat :4 ; + } s; +struct cvmx_iob_pp_bist_status_s cn70xx; +struct cvmx_iob_pp_bist_status_s cn70xxp1; +}; + +typedef union cvmx_iob_pp_bist_status cvmx_iob_pp_bist_status_t ; + +/** +* cvmx_iob_to_cmb_credits +* +* Controls the number of reads and writes that may be outstanding to the L2C (via the CMB). +* +*/ +union cvmx_iob_to_cmb_credits { +u64 u64; +struct cvmx_iob_to_cmb_credits_s { +u64 reserved_6_63 :58 ; +u64 ncb_rd :3 ; +u64 ncb_wr :3 ; + } s; +struct cvmx_iob_to_cmb_credits_cn52xx { +u64 reserved_9_63 :55 ; +u64 pko_rd :3 ; +u64 ncb_rd :3 ; +u64 ncb_wr :3 ; + } cn52xx; +struct cvmx_iob_to_cmb_credits_cn52xx cn61xx; +struct cvmx_iob_to_cmb_credits_cn52xx cn63xx; +struct cvmx_iob_to_cmb_credits_cn52xx cn63xxp1; +struct cvmx_iob_to_cmb_credits_cn52xx cn66xx; +struct cvmx_iob_to_cmb_credits_cn68xx { +u64 reserved_9_63 :55 ; +u64 dwb :3 ; +u64 ncb_rd :3 ; +u64 ncb_wr :3 ; + } cn68xx; +struct cvmx_iob_to_cmb_credits_cn68xx cn68xxp1; +struct cvmx_iob_to_cmb_credits_cn52xx cn70xx; +struct cvmx_iob_to_cmb_credits_cn52xx cn70xxp1; +struct cvmx_iob_to_cmb_credits_cn52xx cnf71xx; +}; + +typedef union cvmx_iob_to_cmb_credits cvmx_iob_to_cmb_credits_t ; + +/** +* cvmx_iob_to_ncb_did_00_credits +* +* IOB_TO_NCB_DID_00_CREDITS = IOB NCB DID 00 Credits +* +* Number of credits for NCB DID 00. +*/ +union cvmx_iob_to_ncb_did_00_credits { +u64 u64; +struct cvmx_iob_to_ncb_did_00_credits_s { +u64 reserved_7_63 :57 ; +u64 crd :7 ; + } s; +struct cvmx_iob_to_ncb_did_00_credits_s cn68xx; +struct cvmx_iob_to_ncb_did_00_credits_s cn68xxp1; +}; + +typedef union cvmx_iob_to_ncb_did_00_credits cvmx_iob_to_ncb_did_00_credits_t ; + +/** +* cvmx_iob_to_ncb_did_111_credits +* +* IOB_TO_NCB_DID_111_CREDITS = IOB NCB DID 111 Credits +* +* Number of credits for NCB DID 111. +*/ +union cvmx_iob_to_ncb_did_111_credits { +u64 u64; +struct cvmx_iob_to_ncb_did_111_credits_s { +u64 reserved_7_63 :57 ; +u64 crd :7 ; + } s; +struct cvmx_iob_to_ncb_did_111_credits_s cn68xx; +struct cvmx_iob_to_ncb_did_111_credits_s cn68xxp1; +}; + +typedef union cvmx_iob_to_ncb_did_111_credits cvmx_iob_to_ncb_did_111_credits_t ; + +/** +* cvmx_iob_to_ncb_did_223_credits +* +* IOB_TO_NCB_DID_223_CREDITS = IOB NCB DID 223 Credits +* +* Number of credits for NCB DID 223. +*/ +union cvmx_iob_to_ncb_did_223_credits { +u64 u64; +struct cvmx_iob_to_ncb_did_223_credits_s { +u64 reserved_7_63 :57 ; +u64 crd :7 ; + } s; +struct cvmx_iob_to_ncb_did_223_credits_s cn68xx; +struct cvmx_iob_to_ncb_did_223_credits_s cn68xxp1; +}; + +typedef union cvmx_iob_to_ncb_did_223_credits cvmx_iob_to_ncb_did_223_credits_t ; + +/** +* cvmx_iob_to_ncb_did_24_credits +* +* IOB_TO_NCB_DID_24_CREDITS = IOB NCB DID 24 Credits +* +* Number of credits for NCB DID 24. +*/ +union cvmx_iob_to_ncb_did_24_credits { +u64 u64; +struct cvmx_iob_to_ncb_did_24_credits_s { +u64 reserved_7_63 :57 ; +u64 crd :7 ; + } s; +struct cvmx_iob_to_ncb_did_24_credits_s cn68xx; +struct cvmx_iob_to_ncb_did_24_credits_s cn68xxp1; +}; + +typedef union cvmx_iob_to_ncb_did_24_credits cvmx_iob_to_ncb_did_24_credits_t ; + +/** +* cvmx_iob_to_ncb_did_32_credits +* +* IOB_TO_NCB_DID_32_CREDITS = IOB NCB DID 32 Credits +* +* Number of credits for NCB DID 32. +*/ +union cvmx_iob_to_ncb_did_32_credits { +u64 u64; +struct cvmx_iob_to_ncb_did_32_credits_s { +u64 reserved_7_63 :57 ; +u64 crd :7 ; + } s; +struct cvmx_iob_to_ncb_did_32_credits_s cn68xx; +struct cvmx_iob_to_ncb_did_32_credits_s cn68xxp1; +}; + +typedef union cvmx_iob_to_ncb_did_32_credits cvmx_iob_to_ncb_did_32_credits_t ; + +/** +* cvmx_iob_to_ncb_did_40_credits +* +* IOB_TO_NCB_DID_40_CREDITS = IOB NCB DID 40 Credits +* +* Number of credits for NCB DID 40. +*/ +union cvmx_iob_to_ncb_did_40_credits { +u64 u64; +struct cvmx_iob_to_ncb_did_40_credits_s { +u64 reserved_7_63 :57 ; +u64 crd :7 ; + } s; +struct cvmx_iob_to_ncb_did_40_credits_s cn68xx; +struct cvmx_iob_to_ncb_did_40_credits_s cn68xxp1; +}; + +typedef union cvmx_iob_to_ncb_did_40_credits cvmx_iob_to_ncb_did_40_credits_t ; + +/** +* cvmx_iob_to_ncb_did_55_credits +* +* IOB_TO_NCB_DID_55_CREDITS = IOB NCB DID 55 Credits +* +* Number of credits for NCB DID 55. +*/ +union cvmx_iob_to_ncb_did_55_credits { +u64 u64; +struct cvmx_iob_to_ncb_did_55_credits_s { +u64 reserved_7_63 :57 ; +u64 crd :7 ; + } s; +struct cvmx_iob_to_ncb_did_55_credits_s cn68xx; +struct cvmx_iob_to_ncb_did_55_credits_s cn68xxp1; +}; + +typedef union cvmx_iob_to_ncb_did_55_credits cvmx_iob_to_ncb_did_55_credits_t ; + +/** +* cvmx_iob_to_ncb_did_64_credits +* +* IOB_TO_NCB_DID_64_CREDITS = IOB NCB DID 64 Credits +* +* Number of credits for NCB DID 64. +*/ +union cvmx_iob_to_ncb_did_64_credits { +u64 u64; +struct cvmx_iob_to_ncb_did_64_credits_s { +u64 reserved_7_63 :57 ; +u64 crd :7 ; + } s; +struct cvmx_iob_to_ncb_did_64_credits_s cn68xx; +struct cvmx_iob_to_ncb_did_64_credits_s cn68xxp1; +}; + +typedef union cvmx_iob_to_ncb_did_64_credits cvmx_iob_to_ncb_did_64_credits_t ; + +/** +* cvmx_iob_to_ncb_did_79_credits +* +* IOB_TO_NCB_DID_79_CREDITS = IOB NCB DID 79 Credits +* +* Number of credits for NCB DID 79. +*/ +union cvmx_iob_to_ncb_did_79_credits { +u64 u64; +struct cvmx_iob_to_ncb_did_79_credits_s { +u64 reserved_7_63 :57 ; +u64 crd :7 ; + } s; +struct cvmx_iob_to_ncb_did_79_credits_s cn68xx; +struct cvmx_iob_to_ncb_did_79_credits_s cn68xxp1; +}; + +typedef union cvmx_iob_to_ncb_did_79_credits cvmx_iob_to_ncb_did_79_credits_t ; + +/** +* cvmx_iob_to_ncb_did_96_credits +* +* IOB_TO_NCB_DID_96_CREDITS = IOB NCB DID 96 Credits +* +* Number of credits for NCB DID 96. +*/ +union cvmx_iob_to_ncb_did_96_credits { +u64 u64; +struct cvmx_iob_to_ncb_did_96_credits_s { +u64 reserved_7_63 :57 ; +u64 crd :7 ; + } s; +struct cvmx_iob_to_ncb_did_96_credits_s cn68xx; +struct cvmx_iob_to_ncb_did_96_credits_s cn68xxp1; +}; + +typedef union cvmx_iob_to_ncb_did_96_credits cvmx_iob_to_ncb_did_96_credits_t ; + +/** +* cvmx_iob_to_ncb_did_98_credits +* +* IOB_TO_NCB_DID_98_CREDITS = IOB NCB DID 96 Credits +* +* Number of credits for NCB DID 98. +*/ +union cvmx_iob_to_ncb_did_98_credits { +u64 u64; +struct cvmx_iob_to_ncb_did_98_credits_s { +u64 reserved_7_63 :57 ; +u64 crd :7 ; + } s; +struct cvmx_iob_to_ncb_did_98_credits_s cn68xx; +struct cvmx_iob_to_ncb_did_98_credits_s cn68xxp1; +}; + +typedef union cvmx_iob_to_ncb_did_98_credits cvmx_iob_to_ncb_did_98_credits_t ; + +#endif
Signature · 1 line
2.35.1
PATCH 4/52 mips: octeon: Add cvmx-lbk-defs.h header file
In reply to Stefan RoeseFrom: Aaron Williams <[email protected]>
Import cvmx-lbk-defs.h header file from 2013 U-Boot. It will be used by the later added drivers to support networking on the MIPS Octeon II / III platforms.
--- .../mach-octeon/include/mach/cvmx-lbk-defs.h | 157 ++++++++++++++++++ 1 file changed, 157 insertions(+) create mode 100644 arch/mips/mach-octeon/include/mach/cvmx-lbk-defs.h
arch/mips/mach-octeon/include/mach/cvmx-lbk-defs.h new file +157 -0
@@ -0,0 +1,157 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* +* Copyright (C) 2018-2022 Marvell International Ltd. +* +* Configuration and status register (CSR) type definitions for +* Octeon lbk. +*/ + +#ifndef __CVMX_LBK_DEFS_H__ +#define __CVMX_LBK_DEFS_H__ + +#define CVMX_LBK_BIST_RESULT (0x0001180012000020ull) +#define CVMX_LBK_CHX_PKIND (offset) (0x0001180012000200ull + ((offset) & 63) * 8) +#define CVMX_LBK_CLK_GATE_CTL (0x0001180012000008ull) +#define CVMX_LBK_DAT_ERR_INFO (0x0001180012000050ull) +#define CVMX_LBK_ECC_CFG (0x0001180012000060ull) +#define CVMX_LBK_INT (0x0001180012000040ull) +#define CVMX_LBK_SFT_RST (0x0001180012000000ull) + +/** +* cvmx_lbk_bist_result +* +* This register provides access to the internal BIST results. Each bit is the +* BIST result of an individual memory (per bit, 0 = pass and 1 = fail). +*/ +union cvmx_lbk_bist_result { +u64 u64; +struct cvmx_lbk_bist_result_s { +u64 reserved_1_63 :63 ; +u64 dat :1 ; + } s; +struct cvmx_lbk_bist_result_s cn73xx; +struct cvmx_lbk_bist_result_s cn78xx; +struct cvmx_lbk_bist_result_s cn78xxp1; +struct cvmx_lbk_bist_result_s cnf75xx; +}; + +typedef union cvmx_lbk_bist_result cvmx_lbk_bist_result_t ; + +/** +* cvmx_lbk_ch#_pkind +*/ +union cvmx_lbk_chx_pkind { +u64 u64; +struct cvmx_lbk_chx_pkind_s { +u64 reserved_6_63 :58 ; +u64 pkind :6 ; + } s; +struct cvmx_lbk_chx_pkind_s cn73xx; +struct cvmx_lbk_chx_pkind_s cn78xx; +struct cvmx_lbk_chx_pkind_s cn78xxp1; +struct cvmx_lbk_chx_pkind_s cnf75xx; +}; + +typedef union cvmx_lbk_chx_pkind cvmx_lbk_chx_pkind_t ; + +/** +* cvmx_lbk_clk_gate_ctl +* +* This register is for diagnostic use only. +* +*/ +union cvmx_lbk_clk_gate_ctl { +u64 u64; +struct cvmx_lbk_clk_gate_ctl_s { +u64 reserved_1_63 :63 ; +u64 dis :1 ; + } s; +struct cvmx_lbk_clk_gate_ctl_s cn73xx; +struct cvmx_lbk_clk_gate_ctl_s cn78xx; +struct cvmx_lbk_clk_gate_ctl_s cn78xxp1; +struct cvmx_lbk_clk_gate_ctl_s cnf75xx; +}; + +typedef union cvmx_lbk_clk_gate_ctl cvmx_lbk_clk_gate_ctl_t ; + +/** +* cvmx_lbk_dat_err_info +*/ +union cvmx_lbk_dat_err_info { +u64 u64; +struct cvmx_lbk_dat_err_info_s { +u64 reserved_58_63 :6 ; +u64 dbe_ecc_out :9 ; +u64 dbe_synd :9 ; +u64 dbe_addr :8 ; +u64 reserved_26_31 :6 ; +u64 sbe_ecc_out :9 ; +u64 sbe_synd :9 ; +u64 sbe_addr :8 ; + } s; +struct cvmx_lbk_dat_err_info_s cn73xx; +struct cvmx_lbk_dat_err_info_s cn78xx; +struct cvmx_lbk_dat_err_info_s cn78xxp1; +struct cvmx_lbk_dat_err_info_s cnf75xx; +}; + +typedef union cvmx_lbk_dat_err_info cvmx_lbk_dat_err_info_t ; + +/** +* cvmx_lbk_ecc_cfg +*/ +union cvmx_lbk_ecc_cfg { +u64 u64; +struct cvmx_lbk_ecc_cfg_s { +u64 reserved_3_63 :61 ; +u64 dat_flip :2 ; +u64 dat_cdis :1 ; + } s; +struct cvmx_lbk_ecc_cfg_s cn73xx; +struct cvmx_lbk_ecc_cfg_s cn78xx; +struct cvmx_lbk_ecc_cfg_s cn78xxp1; +struct cvmx_lbk_ecc_cfg_s cnf75xx; +}; + +typedef union cvmx_lbk_ecc_cfg cvmx_lbk_ecc_cfg_t ; + +/** +* cvmx_lbk_int +*/ +union cvmx_lbk_int { +u64 u64; +struct cvmx_lbk_int_s { +u64 reserved_6_63 :58 ; +u64 chan_oflow :1 ; +u64 chan_uflow :1 ; +u64 dat_oflow :1 ; +u64 dat_uflow :1 ; +u64 dat_dbe :1 ; +u64 dat_sbe :1 ; + } s; +struct cvmx_lbk_int_s cn73xx; +struct cvmx_lbk_int_s cn78xx; +struct cvmx_lbk_int_s cn78xxp1; +struct cvmx_lbk_int_s cnf75xx; +}; + +typedef union cvmx_lbk_int cvmx_lbk_int_t ; + +/** +* cvmx_lbk_sft_rst +*/ +union cvmx_lbk_sft_rst { +u64 u64; +struct cvmx_lbk_sft_rst_s { +u64 reserved_1_63 :63 ; +u64 reset :1 ; + } s; +struct cvmx_lbk_sft_rst_s cn73xx; +struct cvmx_lbk_sft_rst_s cn78xx; +struct cvmx_lbk_sft_rst_s cn78xxp1; +struct cvmx_lbk_sft_rst_s cnf75xx; +}; + +typedef union cvmx_lbk_sft_rst cvmx_lbk_sft_rst_t ; + +#endif
Signature · 1 line
2.35.1
PATCH 5/52 mips: octeon: Add cvmx-npei-defs.h header file
In reply to Stefan RoeseFrom: Aaron Williams <[email protected]>
Import cvmx-npei-defs.h header file from 2013 U-Boot. It will be used by the later added drivers to support networking on the MIPS Octeon II / III platforms.
--- .../mach-octeon/include/mach/cvmx-npei-defs.h | 3550 +++++++++++++++++ 1 file changed, 3550 insertions(+) create mode 100644 arch/mips/mach-octeon/include/mach/cvmx-npei-defs.h
arch/mips/mach-octeon/include/mach/cvmx-npei-defs.h new file +3550 -0
@@ -0,0 +1,3550 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* +* Copyright (C) 2018-2022 Marvell International Ltd. +* +* Configuration and status register (CSR) type definitions for +* Octeon npei. +*/ + +#ifndef __CVMX_NPEI_DEFS_H__ +#define __CVMX_NPEI_DEFS_H__ + +#define CVMX_NPEI_BAR1_INDEXX (offset) \ + (0x0000000000000000ull + ((offset) & 31) * 16) +#define CVMX_NPEI_BIST_STATUS (0x0000000000000580ull) +#define CVMX_NPEI_BIST_STATUS2 (0x0000000000000680ull) +#define CVMX_NPEI_CTL_PORT0 (0x0000000000000250ull) +#define CVMX_NPEI_CTL_PORT1 (0x0000000000000260ull) +#define CVMX_NPEI_CTL_STATUS (0x0000000000000570ull) +#define CVMX_NPEI_CTL_STATUS2 (0x0000000000003C00ull) +#define CVMX_NPEI_DATA_OUT_CNT (0x00000000000005F0ull) +#define CVMX_NPEI_DBG_DATA (0x0000000000000510ull) +#define CVMX_NPEI_DBG_SELECT (0x0000000000000500ull) +#define CVMX_NPEI_DMA0_INT_LEVEL (0x00000000000005C0ull) +#define CVMX_NPEI_DMA1_INT_LEVEL (0x00000000000005D0ull) +#define CVMX_NPEI_DMAX_COUNTS (offset) \ + (0x0000000000000450ull + ((offset) & 7) * 16) +#define CVMX_NPEI_DMAX_DBELL (offset) (0x00000000000003B0ull + ((offset) & 7) * 16) +#define CVMX_NPEI_DMAX_IBUFF_SADDR (offset) \ + (0x0000000000000400ull + ((offset) & 7) * 16) +#define CVMX_NPEI_DMAX_NADDR (offset) (0x00000000000004A0ull + ((offset) & 7) * 16) +#define CVMX_NPEI_DMA_CNTS (0x00000000000005E0ull) +#define CVMX_NPEI_DMA_CONTROL (0x00000000000003A0ull) +#define CVMX_NPEI_DMA_PCIE_REQ_NUM (0x00000000000005B0ull) +#define CVMX_NPEI_DMA_STATE1 (0x00000000000006C0ull) +#define CVMX_NPEI_DMA_STATE1_P1 (0x0000000000000680ull) +#define CVMX_NPEI_DMA_STATE2 (0x00000000000006D0ull) +#define CVMX_NPEI_DMA_STATE2_P1 (0x0000000000000690ull) +#define CVMX_NPEI_DMA_STATE3_P1 (0x00000000000006A0ull) +#define CVMX_NPEI_DMA_STATE4_P1 (0x00000000000006B0ull) +#define CVMX_NPEI_DMA_STATE5_P1 (0x00000000000006C0ull) +#define CVMX_NPEI_INT_A_ENB (0x0000000000000560ull) +#define CVMX_NPEI_INT_A_ENB2 (0x0000000000003CE0ull) +#define CVMX_NPEI_INT_A_SUM (0x0000000000000550ull) +#define CVMX_NPEI_INT_ENB (0x0000000000000540ull) +#define CVMX_NPEI_INT_ENB2 (0x0000000000003CD0ull) +#define CVMX_NPEI_INT_INFO (0x0000000000000590ull) +#define CVMX_NPEI_INT_SUM (0x0000000000000530ull) +#define CVMX_NPEI_INT_SUM2 (0x0000000000003CC0ull) +#define CVMX_NPEI_LAST_WIN_RDATA0 (0x0000000000000600ull) +#define CVMX_NPEI_LAST_WIN_RDATA1 (0x0000000000000610ull) +#define CVMX_NPEI_MEM_ACCESS_CTL (0x00000000000004F0ull) +#define CVMX_NPEI_MEM_ACCESS_SUBIDX (offset) \ + (0x0000000000000280ull + ((offset) & 31) * 16 - 16 * 12) +#define CVMX_NPEI_MSI_ENB0 (0x0000000000003C50ull) +#define CVMX_NPEI_MSI_ENB1 (0x0000000000003C60ull) +#define CVMX_NPEI_MSI_ENB2 (0x0000000000003C70ull) +#define CVMX_NPEI_MSI_ENB3 (0x0000000000003C80ull) +#define CVMX_NPEI_MSI_RCV0 (0x0000000000003C10ull) +#define CVMX_NPEI_MSI_RCV1 (0x0000000000003C20ull) +#define CVMX_NPEI_MSI_RCV2 (0x0000000000003C30ull) +#define CVMX_NPEI_MSI_RCV3 (0x0000000000003C40ull) +#define CVMX_NPEI_MSI_RD_MAP (0x0000000000003CA0ull) +#define CVMX_NPEI_MSI_W1C_ENB0 (0x0000000000003CF0ull) +#define CVMX_NPEI_MSI_W1C_ENB1 (0x0000000000003D00ull) +#define CVMX_NPEI_MSI_W1C_ENB2 (0x0000000000003D10ull) +#define CVMX_NPEI_MSI_W1C_ENB3 (0x0000000000003D20ull) +#define CVMX_NPEI_MSI_W1S_ENB0 (0x0000000000003D30ull) +#define CVMX_NPEI_MSI_W1S_ENB1 (0x0000000000003D40ull) +#define CVMX_NPEI_MSI_W1S_ENB2 (0x0000000000003D50ull) +#define CVMX_NPEI_MSI_W1S_ENB3 (0x0000000000003D60ull) +#define CVMX_NPEI_MSI_WR_MAP (0x0000000000003C90ull) +#define CVMX_NPEI_PCIE_CREDIT_CNT (0x0000000000003D70ull) +#define CVMX_NPEI_PCIE_MSI_RCV (0x0000000000003CB0ull) +#define CVMX_NPEI_PCIE_MSI_RCV_B1 (0x0000000000000650ull) +#define CVMX_NPEI_PCIE_MSI_RCV_B2 (0x0000000000000660ull) +#define CVMX_NPEI_PCIE_MSI_RCV_B3 (0x0000000000000670ull) +#define CVMX_NPEI_PKTX_CNTS (offset) (0x0000000000002400ull + ((offset) & 31) * 16) +#define CVMX_NPEI_PKTX_INSTR_BADDR (offset) \ + (0x0000000000002800ull + ((offset) & 31) * 16) +#define CVMX_NPEI_PKTX_INSTR_BAOFF_DBELL (offset) \ + (0x0000000000002C00ull + ((offset) & 31) * 16) +#define CVMX_NPEI_PKTX_INSTR_FIFO_RSIZE (offset) \ + (0x0000000000003000ull + ((offset) & 31) * 16) +#define CVMX_NPEI_PKTX_INSTR_HEADER (offset) \ + (0x0000000000003400ull + ((offset) & 31) * 16) +#define CVMX_NPEI_PKTX_IN_BP (offset) \ + (0x0000000000003800ull + ((offset) & 31) * 16) +#define CVMX_NPEI_PKTX_SLIST_BADDR (offset) \ + (0x0000000000001400ull + ((offset) & 31) * 16) +#define CVMX_NPEI_PKTX_SLIST_BAOFF_DBELL (offset) \ + (0x0000000000001800ull + ((offset) & 31) * 16) +#define CVMX_NPEI_PKTX_SLIST_FIFO_RSIZE (offset) \ + (0x0000000000001C00ull + ((offset) & 31) * 16) +#define CVMX_NPEI_PKT_CNT_INT (0x0000000000001110ull) +#define CVMX_NPEI_PKT_CNT_INT_ENB (0x0000000000001130ull) +#define CVMX_NPEI_PKT_DATA_OUT_ES (0x00000000000010B0ull) +#define CVMX_NPEI_PKT_DATA_OUT_NS (0x00000000000010A0ull) +#define CVMX_NPEI_PKT_DATA_OUT_ROR (0x0000000000001090ull) +#define CVMX_NPEI_PKT_DPADDR (0x0000000000001080ull) +#define CVMX_NPEI_PKT_INPUT_CONTROL (0x0000000000001150ull) +#define CVMX_NPEI_PKT_INSTR_ENB (0x0000000000001000ull) +#define CVMX_NPEI_PKT_INSTR_RD_SIZE (0x0000000000001190ull) +#define CVMX_NPEI_PKT_INSTR_SIZE (0x0000000000001020ull) +#define CVMX_NPEI_PKT_INT_LEVELS (0x0000000000001100ull) +#define CVMX_NPEI_PKT_IN_BP (0x00000000000006B0ull) +#define CVMX_NPEI_PKT_IN_DONEX_CNTS (offset) \ + (0x0000000000002000ull + ((offset) & 31) * 16) +#define CVMX_NPEI_PKT_IN_INSTR_COUNTS (0x00000000000006A0ull) +#define CVMX_NPEI_PKT_IN_PCIE_PORT (0x00000000000011A0ull) +#define CVMX_NPEI_PKT_IPTR (0x0000000000001070ull) +#define CVMX_NPEI_PKT_OUTPUT_WMARK (0x0000000000001160ull) +#define CVMX_NPEI_PKT_OUT_BMODE (0x00000000000010D0ull) +#define CVMX_NPEI_PKT_OUT_ENB (0x0000000000001010ull) +#define CVMX_NPEI_PKT_PCIE_PORT (0x00000000000010E0ull) +#define CVMX_NPEI_PKT_PORT_IN_RST (0x0000000000000690ull) +#define CVMX_NPEI_PKT_SLIST_ES (0x0000000000001050ull) +#define CVMX_NPEI_PKT_SLIST_ID_SIZE (0x0000000000001180ull) +#define CVMX_NPEI_PKT_SLIST_NS (0x0000000000001040ull) +#define CVMX_NPEI_PKT_SLIST_ROR (0x0000000000001030ull) +#define CVMX_NPEI_PKT_TIME_INT (0x0000000000001120ull) +#define CVMX_NPEI_PKT_TIME_INT_ENB (0x0000000000001140ull) +#define CVMX_NPEI_RSL_INT_BLOCKS (0x0000000000000520ull) +#define CVMX_NPEI_SCRATCH_1 (0x0000000000000270ull) +#define CVMX_NPEI_STATE1 (0x0000000000000620ull) +#define CVMX_NPEI_STATE2 (0x0000000000000630ull) +#define CVMX_NPEI_STATE3 (0x0000000000000640ull) +#define CVMX_NPEI_WINDOW_CTL (0x0000000000000380ull) +#define CVMX_NPEI_WIN_RD_ADDR (0x0000000000000210ull) +#define CVMX_NPEI_WIN_RD_DATA (0x0000000000000240ull) +#define CVMX_NPEI_WIN_WR_ADDR (0x0000000000000200ull) +#define CVMX_NPEI_WIN_WR_DATA (0x0000000000000220ull) +#define CVMX_NPEI_WIN_WR_MASK (0x0000000000000230ull) + +/** +* cvmx_npei_bar1_index# +* +* Total Address is 16Kb; 0x0000 - 0x3fff, 0x000 - 0x7fe(Reg, every other 8B) +* +* General 5kb; 0x0000 - 0x13ff, 0x000 - 0x27e(Reg-General) +* PktMem 10Kb; 0x1400 - 0x3bff, 0x280 - 0x77e(Reg-General-Packet) +* Rsvd 1Kb; 0x3c00 - 0x3fff, 0x780 - 0x7fe(Reg-NCB Only Mode) +* == NPEI_PKT_CNT_INT_ENB[PORT] +* == NPEI_PKT_TIME_INT_ENB[PORT] +* == NPEI_PKT_CNT_INT[PORT] +* == NPEI_PKT_TIME_INT[PORT] +* == NPEI_PKT_PCIE_PORT[PP] +* == NPEI_PKT_SLIST_ROR[ROR] +* == NPEI_PKT_SLIST_ROR[NSR] ? +* == NPEI_PKT_SLIST_ES[ES] +* == NPEI_PKTn_SLIST_BAOFF_DBELL[AOFF] +* == NPEI_PKTn_SLIST_BAOFF_DBELL[DBELL] +* == NPEI_PKTn_CNTS[CNT] +* NPEI_CTL_STATUS[OUTn_ENB] == NPEI_PKT_OUT_ENB[ENB] +* NPEI_BASE_ADDRESS_OUTPUTn[BADDR] == NPEI_PKTn_SLIST_BADDR[ADDR] +* NPEI_DESC_OUTPUTn[SIZE] == NPEI_PKTn_SLIST_FIFO_RSIZE[RSIZE] +* NPEI_Pn_DBPAIR_ADDR[NADDR] == NPEI_PKTn_SLIST_BADDR[ADDR] + +* NPEI_PKTn_SLIST_BAOFF_DBELL[AOFF] +* NPEI_PKT_CREDITSn[PTR_CNT] == NPEI_PKTn_SLIST_BAOFF_DBELL[DBELL] +* NPEI_P0_PAIR_CNTS[AVAIL] == NPEI_PKTn_SLIST_BAOFF_DBELL[DBELL] +* NPEI_P0_PAIR_CNTS[FCNT] == +* NPEI_PKTS_SENTn[PKT_CNT] == NPEI_PKTn_CNTS[CNT] +* NPEI_OUTPUT_CONTROL[Pn_BMODE] == NPEI_PKT_OUT_BMODE[BMODE] +* NPEI_PKT_CREDITSn[PKT_CNT] == NPEI_PKTn_CNTS[CNT] +* NPEI_BUFF_SIZE_OUTPUTn[BSIZE] == NPEI_PKT_SLIST_ID_SIZE[BSIZE] +* NPEI_BUFF_SIZE_OUTPUTn[ISIZE] == NPEI_PKT_SLIST_ID_SIZE[ISIZE] +* NPEI_OUTPUT_CONTROL[On_CSRM] == NPEI_PKT_DPADDR[DPTR] & +* NPEI_PKT_OUT_USE_IPTR[PORT] +* NPEI_OUTPUT_CONTROL[On_ES] == NPEI_PKT_DATA_OUT_ES[ES] +* NPEI_OUTPUT_CONTROL[On_NS] == NPEI_PKT_DATA_OUT_NS[NSR] ? +* NPEI_OUTPUT_CONTROL[On_RO] == NPEI_PKT_DATA_OUT_ROR[ROR] +* NPEI_PKTS_SENT_INT_LEVn[PKT_CNT] == NPEI_PKT_INT_LEVELS[CNT] +* NPEI_PKTS_SENT_TIMEn[PKT_TIME] == NPEI_PKT_INT_LEVELS[TIME] +* NPEI_OUTPUT_CONTROL[IPTR_On] == NPEI_PKT_IPTR[IPTR] +* NPEI_PCIE_PORT_OUTPUT[] == NPEI_PKT_PCIE_PORT[PP] +* +* NPEI_BAR1_INDEXX = NPEI BAR1 IndexX Register +* +* Contains address index and control bits for access to memory ranges of +* BAR-1. Index is build from supplied address [25:22]. +* NPEI_BAR1_INDEX0 through NPEI_BAR1_INDEX15 is used for transactions +* orginating with PCIE-PORT0 and NPEI_BAR1_INDEX16 +* through NPEI_BAR1_INDEX31 is used for transactions originating with +* PCIE-PORT1. +*/ +union cvmx_npei_bar1_indexx { +u32 u32; +struct cvmx_npei_bar1_indexx_s { +u32 reserved_18_31 :14 ; +u32 addr_idx :14 ; +u32 ca :1 ; +u32 end_swp :2 ; +u32 addr_v :1 ; + } s; +struct cvmx_npei_bar1_indexx_s cn52xx; +struct cvmx_npei_bar1_indexx_s cn52xxp1; +struct cvmx_npei_bar1_indexx_s cn56xx; +struct cvmx_npei_bar1_indexx_s cn56xxp1; +}; + +typedef union cvmx_npei_bar1_indexx cvmx_npei_bar1_indexx_t ; + +/** +* cvmx_npei_bist_status +* +* NPEI_BIST_STATUS = NPI's BIST Status Register +* +* Results from BIST runs of NPEI's memories. +*/ +union cvmx_npei_bist_status { +u64 u64; +struct cvmx_npei_bist_status_s { +u64 pkt_rdf :1 ; +u64 reserved_60_62 :3 ; +u64 pcr_gim :1 ; +u64 pkt_pif :1 ; +u64 pcsr_int :1 ; +u64 pcsr_im :1 ; +u64 pcsr_cnt :1 ; +u64 pcsr_id :1 ; +u64 pcsr_sl :1 ; +u64 reserved_50_52 :3 ; +u64 pkt_ind :1 ; +u64 pkt_slm :1 ; +u64 reserved_36_47 :12 ; +u64 d0_pst :1 ; +u64 d1_pst :1 ; +u64 d2_pst :1 ; +u64 d3_pst :1 ; +u64 reserved_31_31 :1 ; +u64 n2p0_c :1 ; +u64 n2p0_o :1 ; +u64 n2p1_c :1 ; +u64 n2p1_o :1 ; +u64 cpl_p0 :1 ; +u64 cpl_p1 :1 ; +u64 p2n1_po :1 ; +u64 p2n1_no :1 ; +u64 p2n1_co :1 ; +u64 p2n0_po :1 ; +u64 p2n0_no :1 ; +u64 p2n0_co :1 ; +u64 p2n0_c0 :1 ; +u64 p2n0_c1 :1 ; +u64 p2n0_n :1 ; +u64 p2n0_p0 :1 ; +u64 p2n0_p1 :1 ; +u64 p2n1_c0 :1 ; +u64 p2n1_c1 :1 ; +u64 p2n1_n :1 ; +u64 p2n1_p0 :1 ; +u64 p2n1_p1 :1 ; +u64 csm0 :1 ; +u64 csm1 :1 ; +u64 dif0 :1 ; +u64 dif1 :1 ; +u64 dif2 :1 ; +u64 dif3 :1 ; +u64 reserved_2_2 :1 ; +u64 msi :1 ; +u64 ncb_cmd :1 ; + } s; +struct cvmx_npei_bist_status_cn52xx { +u64 pkt_rdf :1 ; +u64 reserved_60_62 :3 ; +u64 pcr_gim :1 ; +u64 pkt_pif :1 ; +u64 pcsr_int :1 ; +u64 pcsr_im :1 ; +u64 pcsr_cnt :1 ; +u64 pcsr_id :1 ; +u64 pcsr_sl :1 ; +u64 pkt_imem :1 ; +u64 pkt_pfm :1 ; +u64 pkt_pof :1 ; +u64 reserved_48_49 :2 ; +u64 pkt_pop0 :1 ; +u64 pkt_pop1 :1 ; +u64 d0_mem :1 ; +u64 d1_mem :1 ; +u64 d2_mem :1 ; +u64 d3_mem :1 ; +u64 d4_mem :1 ; +u64 ds_mem :1 ; +u64 reserved_36_39 :4 ; +u64 d0_pst :1 ; +u64 d1_pst :1 ; +u64 d2_pst :1 ; +u64 d3_pst :1 ; +u64 d4_pst :1 ; +u64 n2p0_c :1 ; +u64 n2p0_o :1 ; +u64 n2p1_c :1 ; +u64 n2p1_o :1 ; +u64 cpl_p0 :1 ; +u64 cpl_p1 :1 ; +u64 p2n1_po :1 ; +u64 p2n1_no :1 ; +u64 p2n1_co :1 ; +u64 p2n0_po :1 ; +u64 p2n0_no :1 ; +u64 p2n0_co :1 ; +u64 p2n0_c0 :1 ; +u64 p2n0_c1 :1 ; +u64 p2n0_n :1 ; +u64 p2n0_p0 :1 ; +u64 p2n0_p1 :1 ; +u64 p2n1_c0 :1 ; +u64 p2n1_c1 :1 ; +u64 p2n1_n :1 ; +u64 p2n1_p0 :1 ; +u64 p2n1_p1 :1 ; +u64 csm0 :1 ; +u64 csm1 :1 ; +u64 dif0 :1 ; +u64 dif1 :1 ; +u64 dif2 :1 ; +u64 dif3 :1 ; +u64 dif4 :1 ; +u64 msi :1 ; +u64 ncb_cmd :1 ; + } cn52xx; +struct cvmx_npei_bist_status_cn52xxp1 { +u64 reserved_46_63 :18 ; +u64 d0_mem0 :1 ; +u64 d1_mem1 :1 ; +u64 d2_mem2 :1 ; +u64 d3_mem3 :1 ; +u64 dr0_mem :1 ; +u64 d0_mem :1 ; +u64 d1_mem :1 ; +u64 d2_mem :1 ; +u64 d3_mem :1 ; +u64 dr1_mem :1 ; +u64 d0_pst :1 ; +u64 d1_pst :1 ; +u64 d2_pst :1 ; +u64 d3_pst :1 ; +u64 dr2_mem :1 ; +u64 n2p0_c :1 ; +u64 n2p0_o :1 ; +u64 n2p1_c :1 ; +u64 n2p1_o :1 ; +u64 cpl_p0 :1 ; +u64 cpl_p1 :1 ; +u64 p2n1_po :1 ; +u64 p2n1_no :1 ; +u64 p2n1_co :1 ; +u64 p2n0_po :1 ; +u64 p2n0_no :1 ; +u64 p2n0_co :1 ; +u64 p2n0_c0 :1 ; +u64 p2n0_c1 :1 ; +u64 p2n0_n :1 ; +u64 p2n0_p0 :1 ; +u64 p2n0_p1 :1 ; +u64 p2n1_c0 :1 ; +u64 p2n1_c1 :1 ; +u64 p2n1_n :1 ; +u64 p2n1_p0 :1 ; +u64 p2n1_p1 :1 ; +u64 csm0 :1 ; +u64 csm1 :1 ; +u64 dif0 :1 ; +u64 dif1 :1 ; +u64 dif2 :1 ; +u64 dif3 :1 ; +u64 dr3_mem :1 ; +u64 msi :1 ; +u64 ncb_cmd :1 ; + } cn52xxp1; +struct cvmx_npei_bist_status_cn52xx cn56xx; +struct cvmx_npei_bist_status_cn56xxp1 { +u64 reserved_58_63 :6 ; +u64 pcsr_int :1 ; +u64 pcsr_im :1 ; +u64 pcsr_cnt :1 ; +u64 pcsr_id :1 ; +u64 pcsr_sl :1 ; +u64 pkt_pout :1 ; +u64 pkt_imem :1 ; +u64 pkt_cntm :1 ; +u64 pkt_ind :1 ; +u64 pkt_slm :1 ; +u64 pkt_odf :1 ; +u64 pkt_oif :1 ; +u64 pkt_out :1 ; +u64 pkt_i0 :1 ; +u64 pkt_i1 :1 ; +u64 pkt_s0 :1 ; +u64 pkt_s1 :1 ; +u64 d0_mem :1 ; +u64 d1_mem :1 ; +u64 d2_mem :1 ; +u64 d3_mem :1 ; +u64 d4_mem :1 ; +u64 d0_pst :1 ; +u64 d1_pst :1 ; +u64 d2_pst :1 ; +u64 d3_pst :1 ; +u64 d4_pst :1 ; +u64 n2p0_c :1 ; +u64 n2p0_o :1 ; +u64 n2p1_c :1 ; +u64 n2p1_o :1 ; +u64 cpl_p0 :1 ; +u64 cpl_p1 :1 ; +u64 p2n1_po :1 ; +u64 p2n1_no :1 ; +u64 p2n1_co :1 ; +u64 p2n0_po :1 ; +u64 p2n0_no :1 ; +u64 p2n0_co :1 ; +u64 p2n0_c0 :1 ; +u64 p2n0_c1 :1 ; +u64 p2n0_n :1 ; +u64 p2n0_p0 :1 ; +u64 p2n0_p1 :1 ; +u64 p2n1_c0 :1 ; +u64 p2n1_c1 :1 ; +u64 p2n1_n :1 ; +u64 p2n1_p0 :1 ; +u64 p2n1_p1 :1 ; +u64 csm0 :1 ; +u64 csm1 :1 ; +u64 dif0 :1 ; +u64 dif1 :1 ; +u64 dif2 :1 ; +u64 dif3 :1 ; +u64 dif4 :1 ; +u64 msi :1 ; +u64 ncb_cmd :1 ; + } cn56xxp1; +}; + +typedef union cvmx_npei_bist_status cvmx_npei_bist_status_t ; + +/** +* cvmx_npei_bist_status2 +* +* NPEI_BIST_STATUS2 = NPI's BIST Status Register2 +* +* Results from BIST runs of NPEI's memories. +*/ +union cvmx_npei_bist_status2 { +u64 u64; +struct cvmx_npei_bist_status2_s { +u64 reserved_14_63 :50 ; +u64 prd_tag :1 ; +u64 prd_st0 :1 ; +u64 prd_st1 :1 ; +u64 prd_err :1 ; +u64 nrd_st :1 ; +u64 nwe_st :1 ; +u64 nwe_wr0 :1 ; +u64 nwe_wr1 :1 ; +u64 pkt_rd :1 ; +u64 psc_p0 :1 ; +u64 psc_p1 :1 ; +u64 pkt_gd :1 ; +u64 pkt_gl :1 ; +u64 pkt_blk :1 ; + } s; +struct cvmx_npei_bist_status2_s cn52xx; +struct cvmx_npei_bist_status2_s cn56xx; +}; + +typedef union cvmx_npei_bist_status2 cvmx_npei_bist_status2_t ; + +/** +* cvmx_npei_ctl_port0 +* +* NPEI_CTL_PORT0 = NPEI's Control Port 0 +* +* Contains control for access for Port0 +*/ +union cvmx_npei_ctl_port0 { +u64 u64; +struct cvmx_npei_ctl_port0_s { +u64 reserved_21_63 :43 ; +u64 waitl_com :1 ; +u64 intd :1 ; +u64 intc :1 ; +u64 intb :1 ; +u64 inta :1 ; +u64 intd_map :2 ; +u64 intc_map :2 ; +u64 intb_map :2 ; +u64 inta_map :2 ; +u64 ctlp_ro :1 ; +u64 reserved_6_6 :1 ; +u64 ptlp_ro :1 ; +u64 bar2_enb :1 ; +u64 bar2_esx :2 ; +u64 bar2_cax :1 ; +u64 wait_com :1 ; + } s; +struct cvmx_npei_ctl_port0_s cn52xx; +struct cvmx_npei_ctl_port0_s cn52xxp1; +struct cvmx_npei_ctl_port0_s cn56xx; +struct cvmx_npei_ctl_port0_s cn56xxp1; +}; + +typedef union cvmx_npei_ctl_port0 cvmx_npei_ctl_port0_t ; + +/** +* cvmx_npei_ctl_port1 +* +* NPEI_CTL_PORT1 = NPEI's Control Port1 +* +* Contains control for access for Port1 +*/ +union cvmx_npei_ctl_port1 { +u64 u64; +struct cvmx_npei_ctl_port1_s { +u64 reserved_21_63 :43 ; +u64 waitl_com :1 ; +u64 intd :1 ; +u64 intc :1 ; +u64 intb :1 ; +u64 inta :1 ; +u64 intd_map :2 ; +u64 intc_map :2 ; +u64 intb_map :2 ; +u64 inta_map :2 ; +u64 ctlp_ro :1 ; +u64 reserved_6_6 :1 ; +u64 ptlp_ro :1 ; +u64 bar2_enb :1 ; +u64 bar2_esx :2 ; +u64 bar2_cax :1 ; +u64 wait_com :1 ; + } s; +struct cvmx_npei_ctl_port1_s cn52xx; +struct cvmx_npei_ctl_port1_s cn52xxp1; +struct cvmx_npei_ctl_port1_s cn56xx; +struct cvmx_npei_ctl_port1_s cn56xxp1; +}; + +typedef union cvmx_npei_ctl_port1 cvmx_npei_ctl_port1_t ; + +/** +* cvmx_npei_ctl_status +* +* NPEI_CTL_STATUS = NPEI Control Status Register +* +* Contains control and status for NPEI. Writes to this register are not +* oSrdered with writes/reads to the PCIe Memory space. +* To ensure that a write has completed the user must read the register +* before making an access(i.e. PCIe memory space) +* that requires the value of this register to be updated. +*/ +union cvmx_npei_ctl_status { +u64 u64; +struct cvmx_npei_ctl_status_s { +u64 reserved_44_63 :20 ; +u64 p1_ntags :6 ; +u64 p0_ntags :6 ; +u64 cfg_rtry :16 ; +u64 ring_en :1 ; +u64 lnk_rst :1 ; +u64 arb :1 ; +u64 pkt_bp :4 ; +u64 host_mode :1 ; +u64 chip_rev :8 ; + } s; +struct cvmx_npei_ctl_status_s cn52xx; +struct cvmx_npei_ctl_status_cn52xxp1 { +u64 reserved_44_63 :20 ; +u64 p1_ntags :6 ; +u64 p0_ntags :6 ; +u64 cfg_rtry :16 ; +u64 reserved_15_15 :1 ; +u64 lnk_rst :1 ; +u64 arb :1 ; +u64 reserved_9_12 :4 ; +u64 host_mode :1 ; +u64 chip_rev :8 ; + } cn52xxp1; +struct cvmx_npei_ctl_status_s cn56xx; +struct cvmx_npei_ctl_status_cn56xxp1 { +u64 reserved_15_63 :49 ; +u64 lnk_rst :1 ; +u64 arb :1 ; +u64 pkt_bp :4 ; +u64 host_mode :1 ; +u64 chip_rev :8 ; + } cn56xxp1; +}; + +typedef union cvmx_npei_ctl_status cvmx_npei_ctl_status_t ; + +/** +* cvmx_npei_ctl_status2 +* +* NPEI_CTL_STATUS2 = NPEI's Control Status2 Register +* +* Contains control and status for NPEI. +* Writes to this register are not ordered with writes/reads to the PCI +* Memory space. +* To ensure that a write has completed the user must read the register before +* making an access(i.e. PCI memory space) that requires the value of this +* register to be updated. +*/ +union cvmx_npei_ctl_status2 { +u64 u64; +struct cvmx_npei_ctl_status2_s { +u64 reserved_16_63 :48 ; +u64 mps :1 ; +u64 mrrs :3 ; +u64 c1_w_flt :1 ; +u64 c0_w_flt :1 ; +u64 c1_b1_s :3 ; +u64 c0_b1_s :3 ; +u64 c1_wi_d :1 ; +u64 c1_b0_d :1 ; +u64 c0_wi_d :1 ; +u64 c0_b0_d :1 ; + } s; +struct cvmx_npei_ctl_status2_s cn52xx; +struct cvmx_npei_ctl_status2_s cn52xxp1; +struct cvmx_npei_ctl_status2_s cn56xx; +struct cvmx_npei_ctl_status2_s cn56xxp1; +}; + +typedef union cvmx_npei_ctl_status2 cvmx_npei_ctl_status2_t ; + +/** +* cvmx_npei_data_out_cnt +* +* NPEI_DATA_OUT_CNT = NPEI DATA OUT COUNT +* +* The EXEC data out fifo-count and the data unload counter. +*/ +union cvmx_npei_data_out_cnt { +u64 u64; +struct cvmx_npei_data_out_cnt_s { +u64 reserved_44_63 :20 ; +u64 p1_ucnt :16 ; +u64 p1_fcnt :6 ; +u64 p0_ucnt :16 ; +u64 p0_fcnt :6 ; + } s; +struct cvmx_npei_data_out_cnt_s cn52xx; +struct cvmx_npei_data_out_cnt_s cn52xxp1; +struct cvmx_npei_data_out_cnt_s cn56xx; +struct cvmx_npei_data_out_cnt_s cn56xxp1; +}; + +typedef union cvmx_npei_data_out_cnt cvmx_npei_data_out_cnt_t ; + +/** +* cvmx_npei_dbg_data +* +* NPEI_DBG_DATA = NPEI Debug Data Register +* +* Value returned on the debug-data lines from the RSLs +*/ +union cvmx_npei_dbg_data { +u64 u64; +struct cvmx_npei_dbg_data_s { +u64 reserved_28_63 :36 ; +u64 qlm0_rev_lanes :1 ; +u64 reserved_25_26 :2 ; +u64 qlm1_spd :2 ; +u64 c_mul :5 ; +u64 dsel_ext :1 ; +u64 data :17 ; + } s; +struct cvmx_npei_dbg_data_cn52xx { +u64 reserved_29_63 :35 ; +u64 qlm0_link_width :1 ; +u64 qlm0_rev_lanes :1 ; +u64 qlm1_mode :2 ; +u64 qlm1_spd :2 ; +u64 c_mul :5 ; +u64 dsel_ext :1 ; +u64 data :17 ; + } cn52xx; +struct cvmx_npei_dbg_data_cn52xx cn52xxp1; +struct cvmx_npei_dbg_data_cn56xx { +u64 reserved_29_63 :35 ; +u64 qlm2_rev_lanes :1 ; +u64 qlm0_rev_lanes :1 ; +u64 qlm3_spd :2 ; +u64 qlm1_spd :2 ; +u64 c_mul :5 ; +u64 dsel_ext :1 ; +u64 data :17 ; + } cn56xx; +struct cvmx_npei_dbg_data_cn56xx cn56xxp1; +}; + +typedef union cvmx_npei_dbg_data cvmx_npei_dbg_data_t ; + +/** +* cvmx_npei_dbg_select +* +* NPEI_DBG_SELECT = Debug Select Register +* +* Contains the debug select value last written to the RSLs. +*/ +union cvmx_npei_dbg_select { +u64 u64; +struct cvmx_npei_dbg_select_s { +u64 reserved_16_63 :48 ; +u64 dbg_sel :16 ; + } s; +struct cvmx_npei_dbg_select_s cn52xx; +struct cvmx_npei_dbg_select_s cn52xxp1; +struct cvmx_npei_dbg_select_s cn56xx; +struct cvmx_npei_dbg_select_s cn56xxp1; +}; + +typedef union cvmx_npei_dbg_select cvmx_npei_dbg_select_t ; + +/** +* cvmx_npei_dma#_counts +* +* NPEI_DMA[0..4]_COUNTS = DMA Instruction Counts +* +* Values for determing the number of instructions for DMA[0..4] in the NPEI. +*/ +union cvmx_npei_dmax_counts { +u64 u64; +struct cvmx_npei_dmax_counts_s { +u64 reserved_39_63 :25 ; +u64 fcnt :7 ; +u64 dbell :32 ; + } s; +struct cvmx_npei_dmax_counts_s cn52xx; +struct cvmx_npei_dmax_counts_s cn52xxp1; +struct cvmx_npei_dmax_counts_s cn56xx; +struct cvmx_npei_dmax_counts_s cn56xxp1; +}; + +typedef union cvmx_npei_dmax_counts cvmx_npei_dmax_counts_t ; + +/** +* cvmx_npei_dma#_dbell +* +* NPEI_DMA_DBELL[0..4] = DMA Door Bell +* +* The door bell register for DMA[0..4] queue. +*/ +union cvmx_npei_dmax_dbell { +u32 u32; +struct cvmx_npei_dmax_dbell_s { +u32 reserved_16_31 :16 ; +u32 dbell :16 ; + } s; +struct cvmx_npei_dmax_dbell_s cn52xx; +struct cvmx_npei_dmax_dbell_s cn52xxp1; +struct cvmx_npei_dmax_dbell_s cn56xx; +struct cvmx_npei_dmax_dbell_s cn56xxp1; +}; + +typedef union cvmx_npei_dmax_dbell cvmx_npei_dmax_dbell_t ; + +/** +* cvmx_npei_dma#_ibuff_saddr +* +* NPEI_DMA[0..4]_IBUFF_SADDR = DMA Instruction Buffer Starting Address +* +* The address to start reading Instructions from for DMA[0..4]. +*/ +union cvmx_npei_dmax_ibuff_saddr { +u64 u64; +struct cvmx_npei_dmax_ibuff_saddr_s { +u64 reserved_37_63 :27 ; +u64 idle :1 ; +u64 saddr :29 ; +u64 reserved_0_6 :7 ; + } s; +struct cvmx_npei_dmax_ibuff_saddr_s cn52xx; +struct cvmx_npei_dmax_ibuff_saddr_cn52xxp1 { +u64 reserved_36_63 :28 ; +u64 saddr :29 ; +u64 reserved_0_6 :7 ; + } cn52xxp1; +struct cvmx_npei_dmax_ibuff_saddr_s cn56xx; +struct cvmx_npei_dmax_ibuff_saddr_cn52xxp1 cn56xxp1; +}; + +typedef union cvmx_npei_dmax_ibuff_saddr cvmx_npei_dmax_ibuff_saddr_t ; + +/** +* cvmx_npei_dma#_naddr +* +* NPEI_DMA[0..4]_NADDR = DMA Next Ichunk Address +* +* Place NPEI will read the next Ichunk data from. This is valid when state is 0 +*/ +union cvmx_npei_dmax_naddr { +u64 u64; +struct cvmx_npei_dmax_naddr_s { +u64 reserved_36_63 :28 ; +u64 addr :36 ; + } s; +struct cvmx_npei_dmax_naddr_s cn52xx; +struct cvmx_npei_dmax_naddr_s cn52xxp1; +struct cvmx_npei_dmax_naddr_s cn56xx; +struct cvmx_npei_dmax_naddr_s cn56xxp1; +}; + +typedef union cvmx_npei_dmax_naddr cvmx_npei_dmax_naddr_t ; + +/** +* cvmx_npei_dma0_int_level +* +* NPEI_DMA0_INT_LEVEL = NPEI DMA0 Interrupt Level +* +* Thresholds for DMA count and timer interrupts for DMA0. +*/ +union cvmx_npei_dma0_int_level { +u64 u64; +struct cvmx_npei_dma0_int_level_s { +u64 time :32 ; +u64 cnt :32 ; + } s; +struct cvmx_npei_dma0_int_level_s cn52xx; +struct cvmx_npei_dma0_int_level_s cn52xxp1; +struct cvmx_npei_dma0_int_level_s cn56xx; +struct cvmx_npei_dma0_int_level_s cn56xxp1; +}; + +typedef union cvmx_npei_dma0_int_level cvmx_npei_dma0_int_level_t ; + +/** +* cvmx_npei_dma1_int_level +* +* NPEI_DMA1_INT_LEVEL = NPEI DMA1 Interrupt Level +* +* Thresholds for DMA count and timer interrupts for DMA1. +*/ +union cvmx_npei_dma1_int_level { +u64 u64; +struct cvmx_npei_dma1_int_level_s { +u64 time :32 ; +u64 cnt :32 ; + } s; +struct cvmx_npei_dma1_int_level_s cn52xx; +struct cvmx_npei_dma1_int_level_s cn52xxp1; +struct cvmx_npei_dma1_int_level_s cn56xx; +struct cvmx_npei_dma1_int_level_s cn56xxp1; +}; + +typedef union cvmx_npei_dma1_int_level cvmx_npei_dma1_int_level_t ; + +/** +* cvmx_npei_dma_cnts +* +* NPEI_DMA_CNTS = NPEI DMA Count +* +* The DMA Count values for DMA0 and DMA1. +*/ +union cvmx_npei_dma_cnts { +u64 u64; +struct cvmx_npei_dma_cnts_s { +u64 dma1 :32 ; +u64 dma0 :32 ; + } s; +struct cvmx_npei_dma_cnts_s cn52xx; +struct cvmx_npei_dma_cnts_s cn52xxp1; +struct cvmx_npei_dma_cnts_s cn56xx; +struct cvmx_npei_dma_cnts_s cn56xxp1; +}; + +typedef union cvmx_npei_dma_cnts cvmx_npei_dma_cnts_t ; + +/** +* cvmx_npei_dma_control +* +* NPEI_DMA_CONTROL = DMA Control Register +* +* Controls operation of the DMA IN/OUT. +*/ +union cvmx_npei_dma_control { +u64 u64; +struct cvmx_npei_dma_control_s { +u64 reserved_40_63 :24 ; +u64 p_32b_m :1 ; +u64 dma4_enb :1 ; +u64 dma3_enb :1 ; +u64 dma2_enb :1 ; +u64 dma1_enb :1 ; +u64 dma0_enb :1 ; +u64 b0_lend :1 ; +u64 dwb_denb :1 ; +u64 dwb_ichk :9 ; +u64 fpa_que :3 ; +u64 o_add1 :1 ; +u64 o_ro :1 ; +u64 o_ns :1 ; +u64 o_es :2 ; +u64 o_mode :1 ; +u64 csize :14 ; + } s; +struct cvmx_npei_dma_control_s cn52xx; +struct cvmx_npei_dma_control_cn52xxp1 { +u64 reserved_38_63 :26 ; +u64 dma3_enb :1 ; +u64 dma2_enb :1 ; +u64 dma1_enb :1 ; +u64 dma0_enb :1 ; +u64 b0_lend :1 ; +u64 dwb_denb :1 ; +u64 dwb_ichk :9 ; +u64 fpa_que :3 ; +u64 o_add1 :1 ; +u64 o_ro :1 ; +u64 o_ns :1 ; +u64 o_es :2 ; +u64 o_mode :1 ; +u64 csize :14 ; + } cn52xxp1; +struct cvmx_npei_dma_control_s cn56xx; +struct cvmx_npei_dma_control_cn56xxp1 { +u64 reserved_39_63 :25 ; +u64 dma4_enb :1 ; +u64 dma3_enb :1 ; +u64 dma2_enb :1 ; +u64 dma1_enb :1 ; +u64 dma0_enb :1 ; +u64 b0_lend :1 ; +u64 dwb_denb :1 ; +u64 dwb_ichk :9 ; +u64 fpa_que :3 ; +u64 o_add1 :1 ; +u64 o_ro :1 ; +u64 o_ns :1 ; +u64 o_es :2 ; +u64 o_mode :1 ; +u64 csize :14 ; + } cn56xxp1; +}; + +typedef union cvmx_npei_dma_control cvmx_npei_dma_control_t ; + +/** +* cvmx_npei_dma_pcie_req_num +* +* NPEI_DMA_PCIE_REQ_NUM = NPEI DMA PCIE Outstanding Read Request Number +* +* Outstanding PCIE read request number for DMAs and Packet, maximum number +* is 16 +*/ +union cvmx_npei_dma_pcie_req_num { +u64 u64; +struct cvmx_npei_dma_pcie_req_num_s { +u64 dma_arb :1 ; +u64 reserved_53_62 :10 ; +u64 pkt_cnt :5 ; +u64 reserved_45_47 :3 ; +u64 dma4_cnt :5 ; +u64 reserved_37_39 :3 ; +u64 dma3_cnt :5 ; +u64 reserved_29_31 :3 ; +u64 dma2_cnt :5 ; +u64 reserved_21_23 :3 ; +u64 dma1_cnt :5 ; +u64 reserved_13_15 :3 ; +u64 dma0_cnt :5 ; +u64 reserved_5_7 :3 ; +u64 dma_cnt :5 ; + } s; +struct cvmx_npei_dma_pcie_req_num_s cn52xx; +struct cvmx_npei_dma_pcie_req_num_s cn56xx; +}; + +typedef union cvmx_npei_dma_pcie_req_num cvmx_npei_dma_pcie_req_num_t ; + +/** +* cvmx_npei_dma_state1 +* +* NPEI_DMA_STATE1 = NPI's DMA State 1 +* +* Results from DMA state register 1 +*/ +union cvmx_npei_dma_state1 { +u64 u64; +struct cvmx_npei_dma_state1_s { +u64 reserved_40_63 :24 ; +u64 d4_dwe :8 ; +u64 d3_dwe :8 ; +u64 d2_dwe :8 ; +u64 d1_dwe :8 ; +u64 d0_dwe :8 ; + } s; +struct cvmx_npei_dma_state1_s cn52xx; +}; + +typedef union cvmx_npei_dma_state1 cvmx_npei_dma_state1_t ; + +/** +* cvmx_npei_dma_state1_p1 +* +* NPEI_DMA_STATE1_P1 = NPEI DMA Request and Instruction State +* +* DMA engine Debug information. +*/ +union cvmx_npei_dma_state1_p1 { +u64 u64; +struct cvmx_npei_dma_state1_p1_s { +u64 reserved_60_63 :4 ; +u64 d0_difst :7 ; +u64 d1_difst :7 ; +u64 d2_difst :7 ; +u64 d3_difst :7 ; +u64 d4_difst :7 ; +u64 d0_reqst :5 ; +u64 d1_reqst :5 ; +u64 d2_reqst :5 ; +u64 d3_reqst :5 ; +u64 d4_reqst :5 ; + } s; +struct cvmx_npei_dma_state1_p1_cn52xxp1 { +u64 reserved_60_63 :4 ; +u64 d0_difst :7 ; +u64 d1_difst :7 ; +u64 d2_difst :7 ; +u64 d3_difst :7 ; +u64 reserved_25_31 :7 ; +u64 d0_reqst :5 ; +u64 d1_reqst :5 ; +u64 d2_reqst :5 ; +u64 d3_reqst :5 ; +u64 reserved_0_4 :5 ; + } cn52xxp1; +struct cvmx_npei_dma_state1_p1_s cn56xxp1; +}; + +typedef union cvmx_npei_dma_state1_p1 cvmx_npei_dma_state1_p1_t ; + +/** +* cvmx_npei_dma_state2 +* +* NPEI_DMA_STATE2 = NPI's DMA State 2 +* +* Results from DMA state register 2 +*/ +union cvmx_npei_dma_state2 { +u64 u64; +struct cvmx_npei_dma_state2_s { +u64 reserved_28_63 :36 ; +u64 ndwe :4 ; +u64 reserved_21_23 :3 ; +u64 ndre :5 ; +u64 reserved_10_15 :6 ; +u64 prd :10 ; + } s; +struct cvmx_npei_dma_state2_s cn52xx; +}; + +typedef union cvmx_npei_dma_state2 cvmx_npei_dma_state2_t ; + +/** +* cvmx_npei_dma_state2_p1 +* +* NPEI_DMA_STATE2_P1 = NPEI DMA Instruction Fetch State +* +* DMA engine Debug information. +*/ +union cvmx_npei_dma_state2_p1 { +u64 u64; +struct cvmx_npei_dma_state2_p1_s { +u64 reserved_45_63 :19 ; +u64 d0_dffst :9 ; +u64 d1_dffst :9 ; +u64 d2_dffst :9 ; +u64 d3_dffst :9 ; +u64 d4_dffst :9 ; + } s; +struct cvmx_npei_dma_state2_p1_cn52xxp1 { +u64 reserved_45_63 :19 ; +u64 d0_dffst :9 ; +u64 d1_dffst :9 ; +u64 d2_dffst :9 ; +u64 d3_dffst :9 ; +u64 reserved_0_8 :9 ; + } cn52xxp1; +struct cvmx_npei_dma_state2_p1_s cn56xxp1; +}; + +typedef union cvmx_npei_dma_state2_p1 cvmx_npei_dma_state2_p1_t ; + +/** +* cvmx_npei_dma_state3_p1 +* +* NPEI_DMA_STATE3_P1 = NPEI DMA DRE State +* +* DMA engine Debug information. +*/ +union cvmx_npei_dma_state3_p1 { +u64 u64; +struct cvmx_npei_dma_state3_p1_s { +u64 reserved_60_63 :4 ; +u64 d0_drest :15 ; +u64 d1_drest :15 ; +u64 d2_drest :15 ; +u64 d3_drest :15 ; + } s; +struct cvmx_npei_dma_state3_p1_s cn52xxp1; +struct cvmx_npei_dma_state3_p1_s cn56xxp1; +}; + +typedef union cvmx_npei_dma_state3_p1 cvmx_npei_dma_state3_p1_t ; + +/** +* cvmx_npei_dma_state4_p1 +* +* NPEI_DMA_STATE4_P1 = NPEI DMA DWE State +* +* DMA engine Debug information. +*/ +union cvmx_npei_dma_state4_p1 { +u64 u64; +struct cvmx_npei_dma_state4_p1_s { +u64 reserved_52_63 :12 ; +u64 d0_dwest :13 ; +u64 d1_dwest :13 ; +u64 d2_dwest :13 ; +u64 d3_dwest :13 ; + } s; +struct cvmx_npei_dma_state4_p1_s cn52xxp1; +struct cvmx_npei_dma_state4_p1_s cn56xxp1; +}; + +typedef union cvmx_npei_dma_state4_p1 cvmx_npei_dma_state4_p1_t ; + +/** +* cvmx_npei_dma_state5_p1 +* +* NPEI_DMA_STATE5_P1 = NPEI DMA DWE and DRE State +* +* DMA engine Debug information. +*/ +union cvmx_npei_dma_state5_p1 { +u64 u64; +struct cvmx_npei_dma_state5_p1_s { +u64 reserved_28_63 :36 ; +u64 d4_drest :15 ; +u64 d4_dwest :13 ; + } s; +struct cvmx_npei_dma_state5_p1_s cn56xxp1; +}; + +typedef union cvmx_npei_dma_state5_p1 cvmx_npei_dma_state5_p1_t ; + +/** +* cvmx_npei_int_a_enb +* +* NPEI_INTERRUPT_A_ENB = NPI's Interrupt A Enable Register +* +* Used to allow the generation of interrupts (MSI/INTA) to the PCIe +* CoresUsed to enable the various interrupting conditions of NPEI +*/ +union cvmx_npei_int_a_enb { +u64 u64; +struct cvmx_npei_int_a_enb_s { +u64 reserved_10_63 :54 ; +u64 pout_err :1 ; +u64 pin_bp :1 ; +u64 p1_rdlk :1 ; +u64 p0_rdlk :1 ; +u64 pgl_err :1 ; +u64 pdi_err :1 ; +u64 pop_err :1 ; +u64 pins_err :1 ; +u64 dma1_cpl :1 ; +u64 dma0_cpl :1 ; + } s; +struct cvmx_npei_int_a_enb_s cn52xx; +struct cvmx_npei_int_a_enb_cn52xxp1 { +u64 reserved_2_63 :62 ; +u64 dma1_cpl :1 ; +u64 dma0_cpl :1 ; + } cn52xxp1; +struct cvmx_npei_int_a_enb_s cn56xx; +}; + +typedef union cvmx_npei_int_a_enb cvmx_npei_int_a_enb_t ; + +/** +* cvmx_npei_int_a_enb2 +* +* NPEI_INTERRUPT_A_ENB2 = NPEI's Interrupt A Enable2 Register +* +* Used to enable the various interrupting conditions of NPEI +*/ +union cvmx_npei_int_a_enb2 { +u64 u64; +struct cvmx_npei_int_a_enb2_s { +u64 reserved_10_63 :54 ; +u64 pout_err :1 ; +u64 pin_bp :1 ; +u64 p1_rdlk :1 ; +u64 p0_rdlk :1 ; +u64 pgl_err :1 ; +u64 pdi_err :1 ; +u64 pop_err :1 ; +u64 pins_err :1 ; +u64 dma1_cpl :1 ; +u64 dma0_cpl :1 ; + } s; +struct cvmx_npei_int_a_enb2_s cn52xx; +struct cvmx_npei_int_a_enb2_cn52xxp1 { +u64 reserved_2_63 :62 ; +u64 dma1_cpl :1 ; +u64 dma0_cpl :1 ; + } cn52xxp1; +struct cvmx_npei_int_a_enb2_s cn56xx; +}; + +typedef union cvmx_npei_int_a_enb2 cvmx_npei_int_a_enb2_t ; + +/** +* cvmx_npei_int_a_sum +* +* NPEI_INTERRUPT_A_SUM = NPI Interrupt A Summary Register +* +* Set when an interrupt condition occurs, write '1' to clear. When an +* interrupt bitin this register is set and +* the cooresponding bit in the NPEI_INT_A_ENB register is set, then +* NPEI_INT_SUM[61] will be set. +*/ +union cvmx_npei_int_a_sum { +u64 u64; +struct cvmx_npei_int_a_sum_s { +u64 reserved_10_63 :54 ; +u64 pout_err :1 ; +u64 pin_bp :1 ; +u64 p1_rdlk :1 ; +u64 p0_rdlk :1 ; +u64 pgl_err :1 ; +u64 pdi_err :1 ; +u64 pop_err :1 ; +u64 pins_err :1 ; +u64 dma1_cpl :1 ; +u64 dma0_cpl :1 ; + } s; +struct cvmx_npei_int_a_sum_s cn52xx; +struct cvmx_npei_int_a_sum_cn52xxp1 { +u64 reserved_2_63 :62 ; +u64 dma1_cpl :1 ; +u64 dma0_cpl :1 ; + } cn52xxp1; +struct cvmx_npei_int_a_sum_s cn56xx; +}; + +typedef union cvmx_npei_int_a_sum cvmx_npei_int_a_sum_t ; + +/** +* cvmx_npei_int_enb +* +* NPEI_INTERRUPT_ENB = NPI's Interrupt Enable Register +* +* Used to allow the generation of interrupts (MSI/INTA) to the PCIe +* CoresUsed to enable the various interrupting conditions of NPI +*/ +union cvmx_npei_int_enb { +u64 u64; +struct cvmx_npei_int_enb_s { +u64 mio_inta :1 ; +u64 reserved_62_62 :1 ; +u64 int_a :1 ; +u64 c1_ldwn :1 ; +u64 c0_ldwn :1 ; +u64 c1_exc :1 ; +u64 c0_exc :1 ; +u64 c1_up_wf :1 ; +u64 c0_up_wf :1 ; +u64 c1_un_wf :1 ; +u64 c0_un_wf :1 ; +u64 c1_un_bx :1 ; +u64 c1_un_wi :1 ; +u64 c1_un_b2 :1 ; +u64 c1_un_b1 :1 ; +u64 c1_un_b0 :1 ; +u64 c1_up_bx :1 ; +u64 c1_up_wi :1 ; +u64 c1_up_b2 :1 ; +u64 c1_up_b1 :1 ; +u64 c1_up_b0 :1 ; +u64 c0_un_bx :1 ; +u64 c0_un_wi :1 ; +u64 c0_un_b2 :1 ; +u64 c0_un_b1 :1 ; +u64 c0_un_b0 :1 ; +u64 c0_up_bx :1 ; +u64 c0_up_wi :1 ; +u64 c0_up_b2 :1 ; +u64 c0_up_b1 :1 ; +u64 c0_up_b0 :1 ; +u64 c1_hpint :1 ; +u64 c1_pmei :1 ; +u64 c1_wake :1 ; +u64 crs1_dr :1 ; +u64 c1_se :1 ; +u64 crs1_er :1 ; +u64 c1_aeri :1 ; +u64 c0_hpint :1 ; +u64 c0_pmei :1 ; +u64 c0_wake :1 ; +u64 crs0_dr :1 ; +u64 c0_se :1 ; +u64 crs0_er :1 ; +u64 c0_aeri :1 ; +u64 ptime :1 ; +u64 pcnt :1 ; +u64 pidbof :1 ; +u64 psldbof :1 ; +u64 dtime1 :1 ; +u64 dtime0 :1 ; +u64 dcnt1 :1 ; +u64 dcnt0 :1 ; +u64 dma1fi :1 ; +u64 dma0fi :1 ; +u64 dma4dbo :1 ; +u64 dma3dbo :1 ; +u64 dma2dbo :1 ; +u64 dma1dbo :1 ; +u64 dma0dbo :1 ; +u64 iob2big :1 ; +u64 bar0_to :1 ; +u64 rml_wto :1 ; +u64 rml_rto :1 ; + } s; +struct cvmx_npei_int_enb_s cn52xx; +struct cvmx_npei_int_enb_cn52xxp1 { +u64 mio_inta :1 ; +u64 reserved_62_62 :1 ; +u64 int_a :1 ; +u64 c1_ldwn :1 ; +u64 c0_ldwn :1 ; +u64 c1_exc :1 ; +u64 c0_exc :1 ; +u64 c1_up_wf :1 ; +u64 c0_up_wf :1 ; +u64 c1_un_wf :1 ; +u64 c0_un_wf :1 ; +u64 c1_un_bx :1 ; +u64 c1_un_wi :1 ; +u64 c1_un_b2 :1 ; +u64 c1_un_b1 :1 ; +u64 c1_un_b0 :1 ; +u64 c1_up_bx :1 ; +u64 c1_up_wi :1 ; +u64 c1_up_b2 :1 ; +u64 c1_up_b1 :1 ; +u64 c1_up_b0 :1 ; +u64 c0_un_bx :1 ; +u64 c0_un_wi :1 ; +u64 c0_un_b2 :1 ; +u64 c0_un_b1 :1 ; +u64 c0_un_b0 :1 ; +u64 c0_up_bx :1 ; +u64 c0_up_wi :1 ; +u64 c0_up_b2 :1 ; +u64 c0_up_b1 :1 ; +u64 c0_up_b0 :1 ; +u64 c1_hpint :1 ; +u64 c1_pmei :1 ; +u64 c1_wake :1 ; +u64 crs1_dr :1 ; +u64 c1_se :1 ; +u64 crs1_er :1 ; +u64 c1_aeri :1 ; +u64 c0_hpint :1 ; +u64 c0_pmei :1 ; +u64 c0_wake :1 ; +u64 crs0_dr :1 ; +u64 c0_se :1 ; +u64 crs0_er :1 ; +u64 c0_aeri :1 ; +u64 ptime :1 ; +u64 pcnt :1 ; +u64 pidbof :1 ; +u64 psldbof :1 ; +u64 dtime1 :1 ; +u64 dtime0 :1 ; +u64 dcnt1 :1 ; +u64 dcnt0 :1 ; +u64 dma1fi :1 ; +u64 dma0fi :1 ; +u64 reserved_8_8 :1 ; +u64 dma3dbo :1 ; +u64 dma2dbo :1 ; +u64 dma1dbo :1 ; +u64 dma0dbo :1 ; +u64 iob2big :1 ; +u64 bar0_to :1 ; +u64 rml_wto :1 ; +u64 rml_rto :1 ; + } cn52xxp1; +struct cvmx_npei_int_enb_s cn56xx; +struct cvmx_npei_int_enb_cn56xxp1 { +u64 mio_inta :1 ; +u64 reserved_61_62 :2 ; +u64 c1_ldwn :1 ; +u64 c0_ldwn :1 ; +u64 c1_exc :1 ; +u64 c0_exc :1 ; +u64 c1_up_wf :1 ; +u64 c0_up_wf :1 ; +u64 c1_un_wf :1 ; +u64 c0_un_wf :1 ; +u64 c1_un_bx :1 ; +u64 c1_un_wi :1 ; +u64 c1_un_b2 :1 ; +u64 c1_un_b1 :1 ; +u64 c1_un_b0 :1 ; +u64 c1_up_bx :1 ; +u64 c1_up_wi :1 ; +u64 c1_up_b2 :1 ; +u64 c1_up_b1 :1 ; +u64 c1_up_b0 :1 ; +u64 c0_un_bx :1 ; +u64 c0_un_wi :1 ; +u64 c0_un_b2 :1 ; +u64 c0_un_b1 :1 ; +u64 c0_un_b0 :1 ; +u64 c0_up_bx :1 ; +u64 c0_up_wi :1 ; +u64 c0_up_b2 :1 ; +u64 c0_up_b1 :1 ; +u64 c0_up_b0 :1 ; +u64 c1_hpint :1 ; +u64 c1_pmei :1 ; +u64 c1_wake :1 ; +u64 reserved_29_29 :1 ; +u64 c1_se :1 ; +u64 reserved_27_27 :1 ; +u64 c1_aeri :1 ; +u64 c0_hpint :1 ; +u64 c0_pmei :1 ; +u64 c0_wake :1 ; +u64 reserved_22_22 :1 ; +u64 c0_se :1 ; +u64 reserved_20_20 :1 ; +u64 c0_aeri :1 ; +u64 ptime :1 ; +u64 pcnt :1 ; +u64 pidbof :1 ; +u64 psldbof :1 ; +u64 dtime1 :1 ; +u64 dtime0 :1 ; +u64 dcnt1 :1 ; +u64 dcnt0 :1 ; +u64 dma1fi :1 ; +u64 dma0fi :1 ; +u64 dma4dbo :1 ; +u64 dma3dbo :1 ; +u64 dma2dbo :1 ; +u64 dma1dbo :1 ; +u64 dma0dbo :1 ; +u64 iob2big :1 ; +u64 bar0_to :1 ; +u64 rml_wto :1 ; +u64 rml_rto :1 ; + } cn56xxp1; +}; + +typedef union cvmx_npei_int_enb cvmx_npei_int_enb_t ; + +/** +* cvmx_npei_int_enb2 +* +* NPEI_INTERRUPT_ENB2 = NPI's Interrupt Enable2 Register +* +* Used to enable the various interrupting conditions of NPI +*/ +union cvmx_npei_int_enb2 { +u64 u64; +struct cvmx_npei_int_enb2_s { +u64 reserved_62_63 :2 ; +u64 int_a :1 ; +u64 c1_ldwn :1 ; +u64 c0_ldwn :1 ; +u64 c1_exc :1 ; +u64 c0_exc :1 ; +u64 c1_up_wf :1 ; +u64 c0_up_wf :1 ; +u64 c1_un_wf :1 ; +u64 c0_un_wf :1 ; +u64 c1_un_bx :1 ; +u64 c1_un_wi :1 ; +u64 c1_un_b2 :1 ; +u64 c1_un_b1 :1 ; +u64 c1_un_b0 :1 ; +u64 c1_up_bx :1 ; +u64 c1_up_wi :1 ; +u64 c1_up_b2 :1 ; +u64 c1_up_b1 :1 ; +u64 c1_up_b0 :1 ; +u64 c0_un_bx :1 ; +u64 c0_un_wi :1 ; +u64 c0_un_b2 :1 ; +u64 c0_un_b1 :1 ; +u64 c0_un_b0 :1 ; +u64 c0_up_bx :1 ; +u64 c0_up_wi :1 ; +u64 c0_up_b2 :1 ; +u64 c0_up_b1 :1 ; +u64 c0_up_b0 :1 ; +u64 c1_hpint :1 ; +u64 c1_pmei :1 ; +u64 c1_wake :1 ; +u64 crs1_dr :1 ; +u64 c1_se :1 ; +u64 crs1_er :1 ; +u64 c1_aeri :1 ; +u64 c0_hpint :1 ; +u64 c0_pmei :1 ; +u64 c0_wake :1 ; +u64 crs0_dr :1 ; +u64 c0_se :1 ; +u64 crs0_er :1 ; +u64 c0_aeri :1 ; +u64 ptime :1 ; +u64 pcnt :1 ; +u64 pidbof :1 ; +u64 psldbof :1 ; +u64 dtime1 :1 ; +u64 dtime0 :1 ; +u64 dcnt1 :1 ; +u64 dcnt0 :1 ; +u64 dma1fi :1 ; +u64 dma0fi :1 ; +u64 dma4dbo :1 ; +u64 dma3dbo :1 ; +u64 dma2dbo :1 ; +u64 dma1dbo :1 ; +u64 dma0dbo :1 ; +u64 iob2big :1 ; +u64 bar0_to :1 ; +u64 rml_wto :1 ; +u64 rml_rto :1 ; + } s; +struct cvmx_npei_int_enb2_s cn52xx; +struct cvmx_npei_int_enb2_cn52xxp1 { +u64 reserved_62_63 :2 ; +u64 int_a :1 ; +u64 c1_ldwn :1 ; +u64 c0_ldwn :1 ; +u64 c1_exc :1 ; +u64 c0_exc :1 ; +u64 c1_up_wf :1 ; +u64 c0_up_wf :1 ; +u64 c1_un_wf :1 ; +u64 c0_un_wf :1 ; +u64 c1_un_bx :1 ; +u64 c1_un_wi :1 ; +u64 c1_un_b2 :1 ; +u64 c1_un_b1 :1 ; +u64 c1_un_b0 :1 ; +u64 c1_up_bx :1 ; +u64 c1_up_wi :1 ; +u64 c1_up_b2 :1 ; +u64 c1_up_b1 :1 ; +u64 c1_up_b0 :1 ; +u64 c0_un_bx :1 ; +u64 c0_un_wi :1 ; +u64 c0_un_b2 :1 ; +u64 c0_un_b1 :1 ; +u64 c0_un_b0 :1 ; +u64 c0_up_bx :1 ; +u64 c0_up_wi :1 ; +u64 c0_up_b2 :1 ; +u64 c0_up_b1 :1 ; +u64 c0_up_b0 :1 ; +u64 c1_hpint :1 ; +u64 c1_pmei :1 ; +u64 c1_wake :1 ; +u64 crs1_dr :1 ; +u64 c1_se :1 ; +u64 crs1_er :1 ; +u64 c1_aeri :1 ; +u64 c0_hpint :1 ; +u64 c0_pmei :1 ; +u64 c0_wake :1 ; +u64 crs0_dr :1 ; +u64 c0_se :1 ; +u64 crs0_er :1 ; +u64 c0_aeri :1 ; +u64 ptime :1 ; +u64 pcnt :1 ; +u64 pidbof :1 ; +u64 psldbof :1 ; +u64 dtime1 :1 ; +u64 dtime0 :1 ; +u64 dcnt1 :1 ; +u64 dcnt0 :1 ; +u64 dma1fi :1 ; +u64 dma0fi :1 ; +u64 reserved_8_8 :1 ; +u64 dma3dbo :1 ; +u64 dma2dbo :1 ; +u64 dma1dbo :1 ; +u64 dma0dbo :1 ; +u64 iob2big :1 ; +u64 bar0_to :1 ; +u64 rml_wto :1 ; +u64 rml_rto :1 ; + } cn52xxp1; +struct cvmx_npei_int_enb2_s cn56xx; +struct cvmx_npei_int_enb2_cn56xxp1 { +u64 reserved_61_63 :3 ; +u64 c1_ldwn :1 ; +u64 c0_ldwn :1 ; +u64 c1_exc :1 ; +u64 c0_exc :1 ; +u64 c1_up_wf :1 ; +u64 c0_up_wf :1 ; +u64 c1_un_wf :1 ; +u64 c0_un_wf :1 ; +u64 c1_un_bx :1 ; +u64 c1_un_wi :1 ; +u64 c1_un_b2 :1 ; +u64 c1_un_b1 :1 ; +u64 c1_un_b0 :1 ; +u64 c1_up_bx :1 ; +u64 c1_up_wi :1 ; +u64 c1_up_b2 :1 ; +u64 c1_up_b1 :1 ; +u64 c1_up_b0 :1 ; +u64 c0_un_bx :1 ; +u64 c0_un_wi :1 ; +u64 c0_un_b2 :1 ; +u64 c0_un_b1 :1 ; +u64 c0_un_b0 :1 ; +u64 c0_up_bx :1 ; +u64 c0_up_wi :1 ; +u64 c0_up_b2 :1 ; +u64 c0_up_b1 :1 ; +u64 c0_up_b0 :1 ; +u64 c1_hpint :1 ; +u64 c1_pmei :1 ; +u64 c1_wake :1 ; +u64 reserved_29_29 :1 ; +u64 c1_se :1 ; +u64 reserved_27_27 :1 ; +u64 c1_aeri :1 ; +u64 c0_hpint :1 ; +u64 c0_pmei :1 ; +u64 c0_wake :1 ; +u64 reserved_22_22 :1 ; +u64 c0_se :1 ; +u64 reserved_20_20 :1 ; +u64 c0_aeri :1 ; +u64 ptime :1 ; +u64 pcnt :1 ; +u64 pidbof :1 ; +u64 psldbof :1 ; +u64 dtime1 :1 ; +u64 dtime0 :1 ; +u64 dcnt1 :1 ; +u64 dcnt0 :1 ; +u64 dma1fi :1 ; +u64 dma0fi :1 ; +u64 dma4dbo :1 ; +u64 dma3dbo :1 ; +u64 dma2dbo :1 ; +u64 dma1dbo :1 ; +u64 dma0dbo :1 ; +u64 iob2big :1 ; +u64 bar0_to :1 ; +u64 rml_wto :1 ; +u64 rml_rto :1 ; + } cn56xxp1; +}; + +typedef union cvmx_npei_int_enb2 cvmx_npei_int_enb2_t ; + +/** +* cvmx_npei_int_info +* +* NPEI_INT_INFO = NPI Interrupt Information +* +* Contains information about some of the interrupt condition that can occur +* in the NPEI_INTERRUPT_SUM register. +*/ +union cvmx_npei_int_info { +u64 u64; +struct cvmx_npei_int_info_s { +u64 reserved_12_63 :52 ; +u64 pidbof :6 ; +u64 psldbof :6 ; + } s; +struct cvmx_npei_int_info_s cn52xx; +struct cvmx_npei_int_info_s cn56xx; +struct cvmx_npei_int_info_s cn56xxp1; +}; + +typedef union cvmx_npei_int_info cvmx_npei_int_info_t ; + +/** +* cvmx_npei_int_sum +* +* NPEI_INTERRUPT_SUM = NPI Interrupt Summary Register +* +* Set when an interrupt condition occurs, write '1' to clear. +*/ +union cvmx_npei_int_sum { +u64 u64; +struct cvmx_npei_int_sum_s { +u64 mio_inta :1 ; +u64 reserved_62_62 :1 ; +u64 int_a :1 ; +u64 c1_ldwn :1 ; +u64 c0_ldwn :1 ; +u64 c1_exc :1 ; +u64 c0_exc :1 ; +u64 c1_up_wf :1 ; +u64 c0_up_wf :1 ; +u64 c1_un_wf :1 ; +u64 c0_un_wf :1 ; +u64 c1_un_bx :1 ; +u64 c1_un_wi :1 ; +u64 c1_un_b2 :1 ; +u64 c1_un_b1 :1 ; +u64 c1_un_b0 :1 ; +u64 c1_up_bx :1 ; +u64 c1_up_wi :1 ; +u64 c1_up_b2 :1 ; +u64 c1_up_b1 :1 ; +u64 c1_up_b0 :1 ; +u64 c0_un_bx :1 ; +u64 c0_un_wi :1 ; +u64 c0_un_b2 :1 ; +u64 c0_un_b1 :1 ; +u64 c0_un_b0 :1 ; +u64 c0_up_bx :1 ; +u64 c0_up_wi :1 ; +u64 c0_up_b2 :1 ; +u64 c0_up_b1 :1 ; +u64 c0_up_b0 :1 ; +u64 c1_hpint :1 ; +u64 c1_pmei :1 ; +u64 c1_wake :1 ; +u64 crs1_dr :1 ; +u64 c1_se :1 ; +u64 crs1_er :1 ; +u64 c1_aeri :1 ; +u64 c0_hpint :1 ; +u64 c0_pmei :1 ; +u64 c0_wake :1 ; +u64 crs0_dr :1 ; +u64 c0_se :1 ; +u64 crs0_er :1 ; +u64 c0_aeri :1 ; +u64 ptime :1 ; +u64 pcnt :1 ; +u64 pidbof :1 ; +u64 psldbof :1 ; +u64 dtime1 :1 ; +u64 dtime0 :1 ; +u64 dcnt1 :1 ; +u64 dcnt0 :1 ; +u64 dma1fi :1 ; +u64 dma0fi :1 ; +u64 dma4dbo :1 ; +u64 dma3dbo :1 ; +u64 dma2dbo :1 ; +u64 dma1dbo :1 ; +u64 dma0dbo :1 ; +u64 iob2big :1 ; +u64 bar0_to :1 ; +u64 rml_wto :1 ; +u64 rml_rto :1 ; + } s; +struct cvmx_npei_int_sum_s cn52xx; +struct cvmx_npei_int_sum_cn52xxp1 { +u64 mio_inta :1 ; +u64 reserved_62_62 :1 ; +u64 int_a :1 ; +u64 c1_ldwn :1 ; +u64 c0_ldwn :1 ; +u64 c1_exc :1 ; +u64 c0_exc :1 ; +u64 c1_up_wf :1 ; +u64 c0_up_wf :1 ; +u64 c1_un_wf :1 ; +u64 c0_un_wf :1 ; +u64 c1_un_bx :1 ; +u64 c1_un_wi :1 ; +u64 c1_un_b2 :1 ; +u64 c1_un_b1 :1 ; +u64 c1_un_b0 :1 ; +u64 c1_up_bx :1 ; +u64 c1_up_wi :1 ; +u64 c1_up_b2 :1 ; +u64 c1_up_b1 :1 ; +u64 c1_up_b0 :1 ; +u64 c0_un_bx :1 ; +u64 c0_un_wi :1 ; +u64 c0_un_b2 :1 ; +u64 c0_un_b1 :1 ; +u64 c0_un_b0 :1 ; +u64 c0_up_bx :1 ; +u64 c0_up_wi :1 ; +u64 c0_up_b2 :1 ; +u64 c0_up_b1 :1 ; +u64 c0_up_b0 :1 ; +u64 c1_hpint :1 ; +u64 c1_pmei :1 ; +u64 c1_wake :1 ; +u64 crs1_dr :1 ; +u64 c1_se :1 ; +u64 crs1_er :1 ; +u64 c1_aeri :1 ; +u64 c0_hpint :1 ; +u64 c0_pmei :1 ; +u64 c0_wake :1 ; +u64 crs0_dr :1 ; +u64 c0_se :1 ; +u64 crs0_er :1 ; +u64 c0_aeri :1 ; +u64 reserved_15_18 :4 ; +u64 dtime1 :1 ; +u64 dtime0 :1 ; +u64 dcnt1 :1 ; +u64 dcnt0 :1 ; +u64 dma1fi :1 ; +u64 dma0fi :1 ; +u64 reserved_8_8 :1 ; +u64 dma3dbo :1 ; +u64 dma2dbo :1 ; +u64 dma1dbo :1 ; +u64 dma0dbo :1 ; +u64 iob2big :1 ; +u64 bar0_to :1 ; +u64 rml_wto :1 ; +u64 rml_rto :1 ; + } cn52xxp1; +struct cvmx_npei_int_sum_s cn56xx; +struct cvmx_npei_int_sum_cn56xxp1 { +u64 mio_inta :1 ; +u64 reserved_61_62 :2 ; +u64 c1_ldwn :1 ; +u64 c0_ldwn :1 ; +u64 c1_exc :1 ; +u64 c0_exc :1 ; +u64 c1_up_wf :1 ; +u64 c0_up_wf :1 ; +u64 c1_un_wf :1 ; +u64 c0_un_wf :1 ; +u64 c1_un_bx :1 ; +u64 c1_un_wi :1 ; +u64 c1_un_b2 :1 ; +u64 c1_un_b1 :1 ; +u64 c1_un_b0 :1 ; +u64 c1_up_bx :1 ; +u64 c1_up_wi :1 ; +u64 c1_up_b2 :1 ; +u64 c1_up_b1 :1 ; +u64 c1_up_b0 :1 ; +u64 c0_un_bx :1 ; +u64 c0_un_wi :1 ; +u64 c0_un_b2 :1 ; +u64 c0_un_b1 :1 ; +u64 c0_un_b0 :1 ; +u64 c0_up_bx :1 ; +u64 c0_up_wi :1 ; +u64 c0_up_b2 :1 ; +u64 c0_up_b1 :1 ; +u64 c0_up_b0 :1 ; +u64 c1_hpint :1 ; +u64 c1_pmei :1 ; +u64 c1_wake :1 ; +u64 reserved_29_29 :1 ; +u64 c1_se :1 ; +u64 reserved_27_27 :1 ; +u64 c1_aeri :1 ; +u64 c0_hpint :1 ; +u64 c0_pmei :1 ; +u64 c0_wake :1 ; +u64 reserved_22_22 :1 ; +u64 c0_se :1 ; +u64 reserved_20_20 :1 ; +u64 c0_aeri :1 ; +u64 reserved_15_18 :4 ; +u64 dtime1 :1 ; +u64 dtime0 :1 ; +u64 dcnt1 :1 ; +u64 dcnt0 :1 ; +u64 dma1fi :1 ; +u64 dma0fi :1 ; +u64 dma4dbo :1 ; +u64 dma3dbo :1 ; +u64 dma2dbo :1 ; +u64 dma1dbo :1 ; +u64 dma0dbo :1 ; +u64 iob2big :1 ; +u64 bar0_to :1 ; +u64 rml_wto :1 ; +u64 rml_rto :1 ; + } cn56xxp1; +}; + +typedef union cvmx_npei_int_sum cvmx_npei_int_sum_t ; + +/** +* cvmx_npei_int_sum2 +* +* NPEI_INTERRUPT_SUM2 = NPI Interrupt Summary2 Register +* +* This is a read only copy of the NPEI_INTERRUPT_SUM register with bit +* variances. +*/ +union cvmx_npei_int_sum2 { +u64 u64; +struct cvmx_npei_int_sum2_s { +u64 mio_inta :1 ; +u64 reserved_62_62 :1 ; +u64 int_a :1 ; +u64 c1_ldwn :1 ; +u64 c0_ldwn :1 ; +u64 c1_exc :1 ; +u64 c0_exc :1 ; +u64 c1_up_wf :1 ; +u64 c0_up_wf :1 ; +u64 c1_un_wf :1 ; +u64 c0_un_wf :1 ; +u64 c1_un_bx :1 ; +u64 c1_un_wi :1 ; +u64 c1_un_b2 :1 ; +u64 c1_un_b1 :1 ; +u64 c1_un_b0 :1 ; +u64 c1_up_bx :1 ; +u64 c1_up_wi :1 ; +u64 c1_up_b2 :1 ; +u64 c1_up_b1 :1 ; +u64 c1_up_b0 :1 ; +u64 c0_un_bx :1 ; +u64 c0_un_wi :1 ; +u64 c0_un_b2 :1 ; +u64 c0_un_b1 :1 ; +u64 c0_un_b0 :1 ; +u64 c0_up_bx :1 ; +u64 c0_up_wi :1 ; +u64 c0_up_b2 :1 ; +u64 c0_up_b1 :1 ; +u64 c0_up_b0 :1 ; +u64 c1_hpint :1 ; +u64 c1_pmei :1 ; +u64 c1_wake :1 ; +u64 crs1_dr :1 ; +u64 c1_se :1 ; +u64 crs1_er :1 ; +u64 c1_aeri :1 ; +u64 c0_hpint :1 ; +u64 c0_pmei :1 ; +u64 c0_wake :1 ; +u64 crs0_dr :1 ; +u64 c0_se :1 ; +u64 crs0_er :1 ; +u64 c0_aeri :1 ; +u64 reserved_15_18 :4 ; +u64 dtime1 :1 ; +u64 dtime0 :1 ; +u64 dcnt1 :1 ; +u64 dcnt0 :1 ; +u64 dma1fi :1 ; +u64 dma0fi :1 ; +u64 reserved_8_8 :1 ; +u64 dma3dbo :1 ; +u64 dma2dbo :1 ; +u64 dma1dbo :1 ; +u64 dma0dbo :1 ; +u64 iob2big :1 ; +u64 bar0_to :1 ; +u64 rml_wto :1 ; +u64 rml_rto :1 ; + } s; +struct cvmx_npei_int_sum2_s cn52xx; +struct cvmx_npei_int_sum2_s cn52xxp1; +struct cvmx_npei_int_sum2_s cn56xx; +}; + +typedef union cvmx_npei_int_sum2 cvmx_npei_int_sum2_t ; + +/** +* cvmx_npei_last_win_rdata0 +* +* NPEI_LAST_WIN_RDATA0 = NPEI Last Window Read Data Port0 +* +* The data from the last initiated window read. +*/ +union cvmx_npei_last_win_rdata0 { +u64 u64; +struct cvmx_npei_last_win_rdata0_s { +u64 data :64 ; + } s; +struct cvmx_npei_last_win_rdata0_s cn52xx; +struct cvmx_npei_last_win_rdata0_s cn52xxp1; +struct cvmx_npei_last_win_rdata0_s cn56xx; +struct cvmx_npei_last_win_rdata0_s cn56xxp1; +}; + +typedef union cvmx_npei_last_win_rdata0 cvmx_npei_last_win_rdata0_t ; + +/** +* cvmx_npei_last_win_rdata1 +* +* NPEI_LAST_WIN_RDATA1 = NPEI Last Window Read Data Port1 +* +* The data from the last initiated window read. +*/ +union cvmx_npei_last_win_rdata1 { +u64 u64; +struct cvmx_npei_last_win_rdata1_s { +u64 data :64 ; + } s; +struct cvmx_npei_last_win_rdata1_s cn52xx; +struct cvmx_npei_last_win_rdata1_s cn52xxp1; +struct cvmx_npei_last_win_rdata1_s cn56xx; +struct cvmx_npei_last_win_rdata1_s cn56xxp1; +}; + +typedef union cvmx_npei_last_win_rdata1 cvmx_npei_last_win_rdata1_t ; + +/** +* cvmx_npei_mem_access_ctl +* +* NPEI_MEM_ACCESS_CTL = NPEI's Memory Access Control +* +* Contains control for access to the PCIe address space. +*/ +union cvmx_npei_mem_access_ctl { +u64 u64; +struct cvmx_npei_mem_access_ctl_s { +u64 reserved_14_63 :50 ; +u64 max_word :4 ; +u64 timer :10 ; + } s; +struct cvmx_npei_mem_access_ctl_s cn52xx; +struct cvmx_npei_mem_access_ctl_s cn52xxp1; +struct cvmx_npei_mem_access_ctl_s cn56xx; +struct cvmx_npei_mem_access_ctl_s cn56xxp1; +}; + +typedef union cvmx_npei_mem_access_ctl cvmx_npei_mem_access_ctl_t ; + +/** +* cvmx_npei_mem_access_subid# +* +* NPEI_MEM_ACCESS_SUBIDX = NPEI Memory Access SubidX Register +* +* Contains address index and control bits for access to memory from Core PPs. +*/ +union cvmx_npei_mem_access_subidx { +u64 u64; +struct cvmx_npei_mem_access_subidx_s { +u64 reserved_42_63 :22 ; +u64 zero :1 ; +u64 port :2 ; +u64 nmerge :1 ; +u64 esr :2 ; +u64 esw :2 ; +u64 nsr :1 ; +u64 nsw :1 ; +u64 ror :1 ; +u64 row :1 ; +u64 ba :30 ; + } s; +struct cvmx_npei_mem_access_subidx_s cn52xx; +struct cvmx_npei_mem_access_subidx_s cn52xxp1; +struct cvmx_npei_mem_access_subidx_s cn56xx; +struct cvmx_npei_mem_access_subidx_s cn56xxp1; +}; + +typedef union cvmx_npei_mem_access_subidx cvmx_npei_mem_access_subidx_t ; + +/** +* cvmx_npei_msi_enb0 +* +* NPEI_MSI_ENB0 = NPEI MSI Enable0 +* +* Used to enable the interrupt generation for the bits in the NPEI_MSI_RCV0. +*/ +union cvmx_npei_msi_enb0 { +u64 u64; +struct cvmx_npei_msi_enb0_s { +u64 enb :64 ; + } s; +struct cvmx_npei_msi_enb0_s cn52xx; +struct cvmx_npei_msi_enb0_s cn52xxp1; +struct cvmx_npei_msi_enb0_s cn56xx; +struct cvmx_npei_msi_enb0_s cn56xxp1; +}; + +typedef union cvmx_npei_msi_enb0 cvmx_npei_msi_enb0_t ; + +/** +* cvmx_npei_msi_enb1 +* +* NPEI_MSI_ENB1 = NPEI MSI Enable1 +* +* Used to enable the interrupt generation for the bits in the NPEI_MSI_RCV1. +*/ +union cvmx_npei_msi_enb1 { +u64 u64; +struct cvmx_npei_msi_enb1_s { +u64 enb :64 ; + } s; +struct cvmx_npei_msi_enb1_s cn52xx; +struct cvmx_npei_msi_enb1_s cn52xxp1; +struct cvmx_npei_msi_enb1_s cn56xx; +struct cvmx_npei_msi_enb1_s cn56xxp1; +}; + +typedef union cvmx_npei_msi_enb1 cvmx_npei_msi_enb1_t ; + +/** +* cvmx_npei_msi_enb2 +* +* NPEI_MSI_ENB2 = NPEI MSI Enable2 +* +* Used to enable the interrupt generation for the bits in the NPEI_MSI_RCV2. +*/ +union cvmx_npei_msi_enb2 { +u64 u64; +struct cvmx_npei_msi_enb2_s { +u64 enb :64 ; + } s; +struct cvmx_npei_msi_enb2_s cn52xx; +struct cvmx_npei_msi_enb2_s cn52xxp1; +struct cvmx_npei_msi_enb2_s cn56xx; +struct cvmx_npei_msi_enb2_s cn56xxp1; +}; + +typedef union cvmx_npei_msi_enb2 cvmx_npei_msi_enb2_t ; + +/** +* cvmx_npei_msi_enb3 +* +* NPEI_MSI_ENB3 = NPEI MSI Enable3 +* +* Used to enable the interrupt generation for the bits in the NPEI_MSI_RCV3. +*/ +union cvmx_npei_msi_enb3 { +u64 u64; +struct cvmx_npei_msi_enb3_s { +u64 enb :64 ; + } s; +struct cvmx_npei_msi_enb3_s cn52xx; +struct cvmx_npei_msi_enb3_s cn52xxp1; +struct cvmx_npei_msi_enb3_s cn56xx; +struct cvmx_npei_msi_enb3_s cn56xxp1; +}; + +typedef union cvmx_npei_msi_enb3 cvmx_npei_msi_enb3_t ; + +/** +* cvmx_npei_msi_rcv0 +* +* NPEI_MSI_RCV0 = NPEI MSI Receive0 +* +* Contains bits [63:0] of the 256 bits oof MSI interrupts. +*/ +union cvmx_npei_msi_rcv0 { +u64 u64; +struct cvmx_npei_msi_rcv0_s { +u64 intr :64 ; + } s; +struct cvmx_npei_msi_rcv0_s cn52xx; +struct cvmx_npei_msi_rcv0_s cn52xxp1; +struct cvmx_npei_msi_rcv0_s cn56xx; +struct cvmx_npei_msi_rcv0_s cn56xxp1; +}; + +typedef union cvmx_npei_msi_rcv0 cvmx_npei_msi_rcv0_t ; + +/** +* cvmx_npei_msi_rcv1 +* +* NPEI_MSI_RCV1 = NPEI MSI Receive1 +* +* Contains bits [127:64] of the 256 bits oof MSI interrupts. +*/ +union cvmx_npei_msi_rcv1 { +u64 u64; +struct cvmx_npei_msi_rcv1_s { +u64 intr :64 ; + } s; +struct cvmx_npei_msi_rcv1_s cn52xx; +struct cvmx_npei_msi_rcv1_s cn52xxp1; +struct cvmx_npei_msi_rcv1_s cn56xx; +struct cvmx_npei_msi_rcv1_s cn56xxp1; +}; + +typedef union cvmx_npei_msi_rcv1 cvmx_npei_msi_rcv1_t ; + +/** +* cvmx_npei_msi_rcv2 +* +* NPEI_MSI_RCV2 = NPEI MSI Receive2 +* +* Contains bits [191:128] of the 256 bits oof MSI interrupts. +*/ +union cvmx_npei_msi_rcv2 { +u64 u64; +struct cvmx_npei_msi_rcv2_s { +u64 intr :64 ; + } s; +struct cvmx_npei_msi_rcv2_s cn52xx; +struct cvmx_npei_msi_rcv2_s cn52xxp1; +struct cvmx_npei_msi_rcv2_s cn56xx; +struct cvmx_npei_msi_rcv2_s cn56xxp1; +}; + +typedef union cvmx_npei_msi_rcv2 cvmx_npei_msi_rcv2_t ; + +/** +* cvmx_npei_msi_rcv3 +* +* NPEI_MSI_RCV3 = NPEI MSI Receive3 +* +* Contains bits [255:192] of the 256 bits oof MSI interrupts. +*/ +union cvmx_npei_msi_rcv3 { +u64 u64; +struct cvmx_npei_msi_rcv3_s { +u64 intr :64 ; + } s; +struct cvmx_npei_msi_rcv3_s cn52xx; +struct cvmx_npei_msi_rcv3_s cn52xxp1; +struct cvmx_npei_msi_rcv3_s cn56xx; +struct cvmx_npei_msi_rcv3_s cn56xxp1; +}; + +typedef union cvmx_npei_msi_rcv3 cvmx_npei_msi_rcv3_t ; + +/** +* cvmx_npei_msi_rd_map +* +* NPEI_MSI_RD_MAP = NPEI MSI Read MAP +* +* Used to read the mapping function of the NPEI_PCIE_MSI_RCV to NPEI_MSI_RCV +* registers. +*/ +union cvmx_npei_msi_rd_map { +u64 u64; +struct cvmx_npei_msi_rd_map_s { +u64 reserved_16_63 :48 ; +u64 rd_int :8 ; +u64 msi_int :8 ; + } s; +struct cvmx_npei_msi_rd_map_s cn52xx; +struct cvmx_npei_msi_rd_map_s cn52xxp1; +struct cvmx_npei_msi_rd_map_s cn56xx; +struct cvmx_npei_msi_rd_map_s cn56xxp1; +}; + +typedef union cvmx_npei_msi_rd_map cvmx_npei_msi_rd_map_t ; + +/** +* cvmx_npei_msi_w1c_enb0 +* +* NPEI_MSI_W1C_ENB0 = NPEI MSI Write 1 To Clear Enable0 +* +* Used to clear bits in NPEI_MSI_ENB0. This is a PASS2 register. +*/ +union cvmx_npei_msi_w1c_enb0 { +u64 u64; +struct cvmx_npei_msi_w1c_enb0_s { +u64 clr :64 ; + } s; +struct cvmx_npei_msi_w1c_enb0_s cn52xx; +struct cvmx_npei_msi_w1c_enb0_s cn56xx; +}; + +typedef union cvmx_npei_msi_w1c_enb0 cvmx_npei_msi_w1c_enb0_t ; + +/** +* cvmx_npei_msi_w1c_enb1 +* +* NPEI_MSI_W1C_ENB1 = NPEI MSI Write 1 To Clear Enable1 +* +* Used to clear bits in NPEI_MSI_ENB1. This is a PASS2 register. +*/ +union cvmx_npei_msi_w1c_enb1 { +u64 u64; +struct cvmx_npei_msi_w1c_enb1_s { +u64 clr :64 ; + } s; +struct cvmx_npei_msi_w1c_enb1_s cn52xx; +struct cvmx_npei_msi_w1c_enb1_s cn56xx; +}; + +typedef union cvmx_npei_msi_w1c_enb1 cvmx_npei_msi_w1c_enb1_t ; + +/** +* cvmx_npei_msi_w1c_enb2 +* +* NPEI_MSI_W1C_ENB2 = NPEI MSI Write 1 To Clear Enable2 +* +* Used to clear bits in NPEI_MSI_ENB2. This is a PASS2 register. +*/ +union cvmx_npei_msi_w1c_enb2 { +u64 u64; +struct cvmx_npei_msi_w1c_enb2_s { +u64 clr :64 ; + } s; +struct cvmx_npei_msi_w1c_enb2_s cn52xx; +struct cvmx_npei_msi_w1c_enb2_s cn56xx; +}; + +typedef union cvmx_npei_msi_w1c_enb2 cvmx_npei_msi_w1c_enb2_t ; + +/** +* cvmx_npei_msi_w1c_enb3 +* +* NPEI_MSI_W1C_ENB3 = NPEI MSI Write 1 To Clear Enable3 +* +* Used to clear bits in NPEI_MSI_ENB3. This is a PASS2 register. +*/ +union cvmx_npei_msi_w1c_enb3 { +u64 u64; +struct cvmx_npei_msi_w1c_enb3_s { +u64 clr :64 ; + } s; +struct cvmx_npei_msi_w1c_enb3_s cn52xx; +struct cvmx_npei_msi_w1c_enb3_s cn56xx; +}; + +typedef union cvmx_npei_msi_w1c_enb3 cvmx_npei_msi_w1c_enb3_t ; + +/** +* cvmx_npei_msi_w1s_enb0 +* +* NPEI_MSI_W1S_ENB0 = NPEI MSI Write 1 To Set Enable0 +* +* Used to set bits in NPEI_MSI_ENB0. This is a PASS2 register. +*/ +union cvmx_npei_msi_w1s_enb0 { +u64 u64; +struct cvmx_npei_msi_w1s_enb0_s { +u64 set :64 ; + } s; +struct cvmx_npei_msi_w1s_enb0_s cn52xx; +struct cvmx_npei_msi_w1s_enb0_s cn56xx; +}; + +typedef union cvmx_npei_msi_w1s_enb0 cvmx_npei_msi_w1s_enb0_t ; + +/** +* cvmx_npei_msi_w1s_enb1 +* +* NPEI_MSI_W1S_ENB0 = NPEI MSI Write 1 To Set Enable1 +* +* Used to set bits in NPEI_MSI_ENB1. This is a PASS2 register. +*/ +union cvmx_npei_msi_w1s_enb1 { +u64 u64; +struct cvmx_npei_msi_w1s_enb1_s { +u64 set :64 ; + } s; +struct cvmx_npei_msi_w1s_enb1_s cn52xx; +struct cvmx_npei_msi_w1s_enb1_s cn56xx; +}; + +typedef union cvmx_npei_msi_w1s_enb1 cvmx_npei_msi_w1s_enb1_t ; + +/** +* cvmx_npei_msi_w1s_enb2 +* +* NPEI_MSI_W1S_ENB2 = NPEI MSI Write 1 To Set Enable2 +* +* Used to set bits in NPEI_MSI_ENB2. This is a PASS2 register. +*/ +union cvmx_npei_msi_w1s_enb2 { +u64 u64; +struct cvmx_npei_msi_w1s_enb2_s { +u64 set :64 ; + } s; +struct cvmx_npei_msi_w1s_enb2_s cn52xx; +struct cvmx_npei_msi_w1s_enb2_s cn56xx; +}; + +typedef union cvmx_npei_msi_w1s_enb2 cvmx_npei_msi_w1s_enb2_t ; + +/** +* cvmx_npei_msi_w1s_enb3 +* +* NPEI_MSI_W1S_ENB3 = NPEI MSI Write 1 To Set Enable3 +* +* Used to set bits in NPEI_MSI_ENB3. This is a PASS2 register. +*/ +union cvmx_npei_msi_w1s_enb3 { +u64 u64; +struct cvmx_npei_msi_w1s_enb3_s { +u64 set :64 ; + } s; +struct cvmx_npei_msi_w1s_enb3_s cn52xx; +struct cvmx_npei_msi_w1s_enb3_s cn56xx; +}; + +typedef union cvmx_npei_msi_w1s_enb3 cvmx_npei_msi_w1s_enb3_t ; + +/** +* cvmx_npei_msi_wr_map +* +* NPEI_MSI_WR_MAP = NPEI MSI Write MAP +* +* Used to write the mapping function of the NPEI_PCIE_MSI_RCV to NPEI_MSI_RCV +* registers. +*/ +union cvmx_npei_msi_wr_map { +u64 u64; +struct cvmx_npei_msi_wr_map_s { +u64 reserved_16_63 :48 ; +u64 ciu_int :8 ; +u64 msi_int :8 ; + } s; +struct cvmx_npei_msi_wr_map_s cn52xx; +struct cvmx_npei_msi_wr_map_s cn52xxp1; +struct cvmx_npei_msi_wr_map_s cn56xx; +struct cvmx_npei_msi_wr_map_s cn56xxp1; +}; + +typedef union cvmx_npei_msi_wr_map cvmx_npei_msi_wr_map_t ; + +/** +* cvmx_npei_pcie_credit_cnt +* +* NPEI_PCIE_CREDIT_CNT = NPEI PCIE Credit Count +* +* Contains the number of credits for the pcie port FIFOs used by the NPEI. +* This value needs to be set BEFORE PCIe traffic +* flow from NPEI to PCIE Ports starts. A write to this register will cause +* the credit counts in the NPEI for the two +* PCIE ports to be reset to the value in this register. +*/ +union cvmx_npei_pcie_credit_cnt { +u64 u64; +struct cvmx_npei_pcie_credit_cnt_s { +u64 reserved_48_63 :16 ; +u64 p1_ccnt :8 ; +u64 p1_ncnt :8 ; +u64 p1_pcnt :8 ; +u64 p0_ccnt :8 ; +u64 p0_ncnt :8 ; +u64 p0_pcnt :8 ; + } s; +struct cvmx_npei_pcie_credit_cnt_s cn52xx; +struct cvmx_npei_pcie_credit_cnt_s cn56xx; +}; + +typedef union cvmx_npei_pcie_credit_cnt cvmx_npei_pcie_credit_cnt_t ; + +/** +* cvmx_npei_pcie_msi_rcv +* +* NPEI_PCIE_MSI_RCV = NPEI PCIe MSI Receive +* +* Register where MSI writes are directed from the PCIe. +*/ +union cvmx_npei_pcie_msi_rcv { +u64 u64; +struct cvmx_npei_pcie_msi_rcv_s { +u64 reserved_8_63 :56 ; +u64 intr :8 ; + } s; +struct cvmx_npei_pcie_msi_rcv_s cn52xx; +struct cvmx_npei_pcie_msi_rcv_s cn52xxp1; +struct cvmx_npei_pcie_msi_rcv_s cn56xx; +struct cvmx_npei_pcie_msi_rcv_s cn56xxp1; +}; + +typedef union cvmx_npei_pcie_msi_rcv cvmx_npei_pcie_msi_rcv_t ; + +/** +* cvmx_npei_pcie_msi_rcv_b1 +* +* NPEI_PCIE_MSI_RCV_B1 = NPEI PCIe MSI Receive Byte 1 +* +* Register where MSI writes are directed from the PCIe. +*/ +union cvmx_npei_pcie_msi_rcv_b1 { +u64 u64; +struct cvmx_npei_pcie_msi_rcv_b1_s { +u64 reserved_16_63 :48 ; +u64 intr :8 ; +u64 reserved_0_7 :8 ; + } s; +struct cvmx_npei_pcie_msi_rcv_b1_s cn52xx; +struct cvmx_npei_pcie_msi_rcv_b1_s cn52xxp1; +struct cvmx_npei_pcie_msi_rcv_b1_s cn56xx; +struct cvmx_npei_pcie_msi_rcv_b1_s cn56xxp1; +}; + +typedef union cvmx_npei_pcie_msi_rcv_b1 cvmx_npei_pcie_msi_rcv_b1_t ; + +/** +* cvmx_npei_pcie_msi_rcv_b2 +* +* NPEI_PCIE_MSI_RCV_B2 = NPEI PCIe MSI Receive Byte 2 +* +* Register where MSI writes are directed from the PCIe. +*/ +union cvmx_npei_pcie_msi_rcv_b2 { +u64 u64; +struct cvmx_npei_pcie_msi_rcv_b2_s { +u64 reserved_24_63 :40 ; +u64 intr :8 ; +u64 reserved_0_15 :16 ; + } s; +struct cvmx_npei_pcie_msi_rcv_b2_s cn52xx; +struct cvmx_npei_pcie_msi_rcv_b2_s cn52xxp1; +struct cvmx_npei_pcie_msi_rcv_b2_s cn56xx; +struct cvmx_npei_pcie_msi_rcv_b2_s cn56xxp1; +}; + +typedef union cvmx_npei_pcie_msi_rcv_b2 cvmx_npei_pcie_msi_rcv_b2_t ; + +/** +* cvmx_npei_pcie_msi_rcv_b3 +* +* NPEI_PCIE_MSI_RCV_B3 = NPEI PCIe MSI Receive Byte 3 +* +* Register where MSI writes are directed from the PCIe. +*/ +union cvmx_npei_pcie_msi_rcv_b3 { +u64 u64; +struct cvmx_npei_pcie_msi_rcv_b3_s { +u64 reserved_32_63 :32 ; +u64 intr :8 ; +u64 reserved_0_23 :24 ; + } s; +struct cvmx_npei_pcie_msi_rcv_b3_s cn52xx; +struct cvmx_npei_pcie_msi_rcv_b3_s cn52xxp1; +struct cvmx_npei_pcie_msi_rcv_b3_s cn56xx; +struct cvmx_npei_pcie_msi_rcv_b3_s cn56xxp1; +}; + +typedef union cvmx_npei_pcie_msi_rcv_b3 cvmx_npei_pcie_msi_rcv_b3_t ; + +/** +* cvmx_npei_pkt#_cnts +* +* NPEI_PKT[0..31]_CNTS = NPEI Packet ring# Counts +* +* The counters for output rings. +*/ +union cvmx_npei_pktx_cnts { +u64 u64; +struct cvmx_npei_pktx_cnts_s { +u64 reserved_54_63 :10 ; +u64 timer :22 ; +u64 cnt :32 ; + } s; +struct cvmx_npei_pktx_cnts_s cn52xx; +struct cvmx_npei_pktx_cnts_s cn56xx; +}; + +typedef union cvmx_npei_pktx_cnts cvmx_npei_pktx_cnts_t ; + +/** +* cvmx_npei_pkt#_in_bp +* +* NPEI_PKT[0..31]_IN_BP = NPEI Packet ring# Input Backpressure +* +* The counters and thresholds for input packets to apply backpressure to +* processing of the packets. +*/ +union cvmx_npei_pktx_in_bp { +u64 u64; +struct cvmx_npei_pktx_in_bp_s { +u64 wmark :32 ; +u64 cnt :32 ; + } s; +struct cvmx_npei_pktx_in_bp_s cn52xx; +struct cvmx_npei_pktx_in_bp_s cn56xx; +}; + +typedef union cvmx_npei_pktx_in_bp cvmx_npei_pktx_in_bp_t ; + +/** +* cvmx_npei_pkt#_instr_baddr +* +* NPEI_PKT[0..31]_INSTR_BADDR = NPEI Packet ring# Instruction Base Address +* +* Start of Instruction for input packets. +*/ +union cvmx_npei_pktx_instr_baddr { +u64 u64; +struct cvmx_npei_pktx_instr_baddr_s { +u64 addr :61 ; +u64 reserved_0_2 :3 ; + } s; +struct cvmx_npei_pktx_instr_baddr_s cn52xx; +struct cvmx_npei_pktx_instr_baddr_s cn56xx; +}; + +typedef union cvmx_npei_pktx_instr_baddr cvmx_npei_pktx_instr_baddr_t ; + +/** +* cvmx_npei_pkt#_instr_baoff_dbell +* +* NPEI_PKT[0..31]_INSTR_BAOFF_DBELL = NPEI Packet ring# Instruction Base +* Address Offset and Doorbell +* +* The doorbell and base address offset for next read. +*/ +union cvmx_npei_pktx_instr_baoff_dbell { +u64 u64; +struct cvmx_npei_pktx_instr_baoff_dbell_s { +u64 aoff :32 ; +u64 dbell :32 ; + } s; +struct cvmx_npei_pktx_instr_baoff_dbell_s cn52xx; +struct cvmx_npei_pktx_instr_baoff_dbell_s cn56xx; +}; + +typedef union cvmx_npei_pktx_instr_baoff_dbell +cvmx_npei_pktx_instr_baoff_dbell_t ; + +/** +* cvmx_npei_pkt#_instr_fifo_rsize +* +* NPEI_PKT[0..31]_INSTR_FIFO_RSIZE = NPEI Packet ring# Instruction FIFO and +* Ring Size. +* +* Fifo field and ring size for Instructions. +*/ +union cvmx_npei_pktx_instr_fifo_rsize { +u64 u64; +struct cvmx_npei_pktx_instr_fifo_rsize_s { +u64 max :9 ; +u64 rrp :9 ; +u64 wrp :9 ; +u64 fcnt :5 ; +u64 rsize :32 ; + } s; +struct cvmx_npei_pktx_instr_fifo_rsize_s cn52xx; +struct cvmx_npei_pktx_instr_fifo_rsize_s cn56xx; +}; + +typedef union cvmx_npei_pktx_instr_fifo_rsize cvmx_npei_pktx_instr_fifo_rsize_t ; + +/** +* cvmx_npei_pkt#_instr_header +* +* NPEI_PKT[0..31]_INSTR_HEADER = NPEI Packet ring# Instruction Header. +* +* VAlues used to build input packet header. +*/ +union cvmx_npei_pktx_instr_header { +u64 u64; +struct cvmx_npei_pktx_instr_header_s { +u64 reserved_44_63 :20 ; +u64 pbp :1 ; +u64 reserved_38_42 :5 ; +u64 rparmode :2 ; +u64 reserved_35_35 :1 ; +u64 rskp_len :7 ; +u64 reserved_22_27 :6 ; +u64 use_ihdr :1 ; +u64 reserved_16_20 :5 ; +u64 par_mode :2 ; +u64 reserved_13_13 :1 ; +u64 skp_len :7 ; +u64 reserved_0_5 :6 ; + } s; +struct cvmx_npei_pktx_instr_header_s cn52xx; +struct cvmx_npei_pktx_instr_header_s cn56xx; +}; + +typedef union cvmx_npei_pktx_instr_header cvmx_npei_pktx_instr_header_t ; + +/** +* cvmx_npei_pkt#_slist_baddr +* +* NPEI_PKT[0..31]_SLIST_BADDR = NPEI Packet ring# Scatter List Base Address +* +* Start of Scatter List for output packet pointers - MUST be 16 byte aligned +*/ +union cvmx_npei_pktx_slist_baddr { +u64 u64; +struct cvmx_npei_pktx_slist_baddr_s { +u64 addr :60 ; +u64 reserved_0_3 :4 ; + } s; +struct cvmx_npei_pktx_slist_baddr_s cn52xx; +struct cvmx_npei_pktx_slist_baddr_s cn56xx; +}; + +typedef union cvmx_npei_pktx_slist_baddr cvmx_npei_pktx_slist_baddr_t ; + +/** +* cvmx_npei_pkt#_slist_baoff_dbell +* +* NPEI_PKT[0..31]_SLIST_BAOFF_DBELL = NPEI Packet ring# Scatter List Base +* Address Offset and Doorbell +* +* The doorbell and base address offset for next read. +*/ +union cvmx_npei_pktx_slist_baoff_dbell { +u64 u64; +struct cvmx_npei_pktx_slist_baoff_dbell_s { +u64 aoff :32 ; +u64 dbell :32 ; + } s; +struct cvmx_npei_pktx_slist_baoff_dbell_s cn52xx; +struct cvmx_npei_pktx_slist_baoff_dbell_s cn56xx; +}; + +typedef union cvmx_npei_pktx_slist_baoff_dbell +cvmx_npei_pktx_slist_baoff_dbell_t ; + +/** +* cvmx_npei_pkt#_slist_fifo_rsize +* +* NPEI_PKT[0..31]_SLIST_FIFO_RSIZE = NPEI Packet ring# Scatter List FIFO and +* Ring Size. +* +* The number of scatter pointer pairs in the scatter list. +*/ +union cvmx_npei_pktx_slist_fifo_rsize { +u64 u64; +struct cvmx_npei_pktx_slist_fifo_rsize_s { +u64 reserved_32_63 :32 ; +u64 rsize :32 ; + } s; +struct cvmx_npei_pktx_slist_fifo_rsize_s cn52xx; +struct cvmx_npei_pktx_slist_fifo_rsize_s cn56xx; +}; + +typedef union cvmx_npei_pktx_slist_fifo_rsize cvmx_npei_pktx_slist_fifo_rsize_t ; + +/** +* cvmx_npei_pkt_cnt_int +* +* NPEI_PKT_CNT_INT = NPI Packet Counter Interrupt +* +* The packets rings that are interrupting because of Packet Counters. +*/ +union cvmx_npei_pkt_cnt_int { +u64 u64; +struct cvmx_npei_pkt_cnt_int_s { +u64 reserved_32_63 :32 ; +u64 port :32 ; + } s; +struct cvmx_npei_pkt_cnt_int_s cn52xx; +struct cvmx_npei_pkt_cnt_int_s cn56xx; +}; + +typedef union cvmx_npei_pkt_cnt_int cvmx_npei_pkt_cnt_int_t ; + +/** +* cvmx_npei_pkt_cnt_int_enb +* +* NPEI_PKT_CNT_INT_ENB = NPI Packet Counter Interrupt Enable +* +* Enable for the packets rings that are interrupting because of Packet Counters. +*/ +union cvmx_npei_pkt_cnt_int_enb { +u64 u64; +struct cvmx_npei_pkt_cnt_int_enb_s { +u64 reserved_32_63 :32 ; +u64 port :32 ; + } s; +struct cvmx_npei_pkt_cnt_int_enb_s cn52xx; +struct cvmx_npei_pkt_cnt_int_enb_s cn56xx; +}; + +typedef union cvmx_npei_pkt_cnt_int_enb cvmx_npei_pkt_cnt_int_enb_t ; + +/** +* cvmx_npei_pkt_data_out_es +* +* NPEI_PKT_DATA_OUT_ES = NPEI's Packet Data Out Endian Swap +* +* The Endian Swap for writing Data Out. +*/ +union cvmx_npei_pkt_data_out_es { +u64 u64; +struct cvmx_npei_pkt_data_out_es_s { +u64 es :64 ; + } s; +struct cvmx_npei_pkt_data_out_es_s cn52xx; +struct cvmx_npei_pkt_data_out_es_s cn56xx; +}; + +typedef union cvmx_npei_pkt_data_out_es cvmx_npei_pkt_data_out_es_t ; + +/** +* cvmx_npei_pkt_data_out_ns +* +* NPEI_PKT_DATA_OUT_NS = NPEI's Packet Data Out No Snoop +* +* The NS field for the TLP when writing packet data. +*/ +union cvmx_npei_pkt_data_out_ns { +u64 u64; +struct cvmx_npei_pkt_data_out_ns_s { +u64 reserved_32_63 :32 ; +u64 nsr :32 ; + } s; +struct cvmx_npei_pkt_data_out_ns_s cn52xx; +struct cvmx_npei_pkt_data_out_ns_s cn56xx; +}; + +typedef union cvmx_npei_pkt_data_out_ns cvmx_npei_pkt_data_out_ns_t ; + +/** +* cvmx_npei_pkt_data_out_ror +* +* NPEI_PKT_DATA_OUT_ROR = NPEI's Packet Data Out Relaxed Ordering +* +* The ROR field for the TLP when writing Packet Data. +*/ +union cvmx_npei_pkt_data_out_ror { +u64 u64; +struct cvmx_npei_pkt_data_out_ror_s { +u64 reserved_32_63 :32 ; +u64 ror :32 ; + } s; +struct cvmx_npei_pkt_data_out_ror_s cn52xx; +struct cvmx_npei_pkt_data_out_ror_s cn56xx; +}; + +typedef union cvmx_npei_pkt_data_out_ror cvmx_npei_pkt_data_out_ror_t ; + +/** +* cvmx_npei_pkt_dpaddr +* +* NPEI_PKT_DPADDR = NPEI's Packet Data Pointer Addr +* +* Used to detemine address and attributes for packet data writes. +*/ +union cvmx_npei_pkt_dpaddr { +u64 u64; +struct cvmx_npei_pkt_dpaddr_s { +u64 reserved_32_63 :32 ; +u64 dptr :32 ; + } s; +struct cvmx_npei_pkt_dpaddr_s cn52xx; +struct cvmx_npei_pkt_dpaddr_s cn56xx; +}; + +typedef union cvmx_npei_pkt_dpaddr cvmx_npei_pkt_dpaddr_t ; + +/** +* cvmx_npei_pkt_in_bp +* +* NPEI_PKT_IN_BP = NPEI Packet Input Backpressure +* +* Which input rings have backpressure applied. +*/ +union cvmx_npei_pkt_in_bp { +u64 u64; +struct cvmx_npei_pkt_in_bp_s { +u64 reserved_32_63 :32 ; +u64 bp :32 ; + } s; +struct cvmx_npei_pkt_in_bp_s cn52xx; +struct cvmx_npei_pkt_in_bp_s cn56xx; +}; + +typedef union cvmx_npei_pkt_in_bp cvmx_npei_pkt_in_bp_t ; + +/** +* cvmx_npei_pkt_in_done#_cnts +* +* NPEI_PKT_IN_DONE[0..31]_CNTS = NPEI Instruction Done ring# Counts +* +* Counters for instructions completed on Input rings. +*/ +union cvmx_npei_pkt_in_donex_cnts { +u64 u64; +struct cvmx_npei_pkt_in_donex_cnts_s { +u64 reserved_32_63 :32 ; +u64 cnt :32 ; + } s; +struct cvmx_npei_pkt_in_donex_cnts_s cn52xx; +struct cvmx_npei_pkt_in_donex_cnts_s cn56xx; +}; + +typedef union cvmx_npei_pkt_in_donex_cnts cvmx_npei_pkt_in_donex_cnts_t ; + +/** +* cvmx_npei_pkt_in_instr_counts +* +* NPEI_PKT_IN_INSTR_COUNTS = NPEI Packet Input Instrutction Counts +* +* Keeps track of the number of instructions read into the FIFO and Packets +* sent to IPD. +*/ +union cvmx_npei_pkt_in_instr_counts { +u64 u64; +struct cvmx_npei_pkt_in_instr_counts_s { +u64 wr_cnt :32 ; +u64 rd_cnt :32 ; + } s; +struct cvmx_npei_pkt_in_instr_counts_s cn52xx; +struct cvmx_npei_pkt_in_instr_counts_s cn56xx; +}; + +typedef union cvmx_npei_pkt_in_instr_counts cvmx_npei_pkt_in_instr_counts_t ; + +/** +* cvmx_npei_pkt_in_pcie_port +* +* NPEI_PKT_IN_PCIE_PORT = NPEI's Packet In To PCIe Port Assignment +* +* Assigns Packet Input rings to PCIe ports. +*/ +union cvmx_npei_pkt_in_pcie_port { +u64 u64; +struct cvmx_npei_pkt_in_pcie_port_s { +u64 pp :64 ; + } s; +struct cvmx_npei_pkt_in_pcie_port_s cn52xx; +struct cvmx_npei_pkt_in_pcie_port_s cn56xx; +}; + +typedef union cvmx_npei_pkt_in_pcie_port cvmx_npei_pkt_in_pcie_port_t ; + +/** +* cvmx_npei_pkt_input_control +* +* NPEI_PKT_INPUT_CONTROL = NPEI's Packet Input Control +* +* Control for reads for gather list and instructions. +*/ +union cvmx_npei_pkt_input_control { +u64 u64; +struct cvmx_npei_pkt_input_control_s { +u64 reserved_23_63 :41 ; +u64 pkt_rr :1 ; +u64 pbp_dhi :13 ; +u64 d_nsr :1 ; +u64 d_esr :2 ; +u64 d_ror :1 ; +u64 use_csr :1 ; +u64 nsr :1 ; +u64 esr :2 ; +u64 ror :1 ; + } s; +struct cvmx_npei_pkt_input_control_s cn52xx; +struct cvmx_npei_pkt_input_control_s cn56xx; +}; + +typedef union cvmx_npei_pkt_input_control cvmx_npei_pkt_input_control_t ; + +/** +* cvmx_npei_pkt_instr_enb +* +* NPEI_PKT_INSTR_ENB = NPEI's Packet Instruction Enable +* +* Enables the instruction fetch for a Packet-ring. +*/ +union cvmx_npei_pkt_instr_enb { +u64 u64; +struct cvmx_npei_pkt_instr_enb_s { +u64 reserved_32_63 :32 ; +u64 enb :32 ; + } s; +struct cvmx_npei_pkt_instr_enb_s cn52xx; +struct cvmx_npei_pkt_instr_enb_s cn56xx; +}; + +typedef union cvmx_npei_pkt_instr_enb cvmx_npei_pkt_instr_enb_t ; + +/** +* cvmx_npei_pkt_instr_rd_size +* +* NPEI_PKT_INSTR_RD_SIZE = NPEI Instruction Read Size +* +* The number of instruction allowed to be read at one time. +*/ +union cvmx_npei_pkt_instr_rd_size { +u64 u64; +struct cvmx_npei_pkt_instr_rd_size_s { +u64 rdsize :64 ; + } s; +struct cvmx_npei_pkt_instr_rd_size_s cn52xx; +struct cvmx_npei_pkt_instr_rd_size_s cn56xx; +}; + +typedef union cvmx_npei_pkt_instr_rd_size cvmx_npei_pkt_instr_rd_size_t ; + +/** +* cvmx_npei_pkt_instr_size +* +* NPEI_PKT_INSTR_SIZE = NPEI's Packet Instruction Size +* +* Determines if instructions are 64 or 32 byte in size for a Packet-ring. +*/ +union cvmx_npei_pkt_instr_size { +u64 u64; +struct cvmx_npei_pkt_instr_size_s { +u64 reserved_32_63 :32 ; +u64 is_64b :32 ; + } s; +struct cvmx_npei_pkt_instr_size_s cn52xx; +struct cvmx_npei_pkt_instr_size_s cn56xx; +};
Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.35.1
Part of the diff is not shown here. View the raw message.
PATCH 6/52 mips: octeon: Add cvmx-pcsxx-defs.h header file
In reply to Stefan RoeseFrom: Aaron Williams <[email protected]>
Import cvmx-pcsxxx-defs.h header file from 2013 U-Boot. It will be used by the later added drivers to support networking on the MIPS Octeon II / III platforms.
--- .../include/mach/cvmx-pcsxx-defs.h | 787 ++++++++++++++++++ 1 file changed, 787 insertions(+) create mode 100644 arch/mips/mach-octeon/include/mach/cvmx-pcsxx-defs.h
arch/mips/mach-octeon/include/mach/cvmx-pcsxx-defs.h new file +787 -0
@@ -0,0 +1,787 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* +* Copyright (C) 2018-2022 Marvell International Ltd. +* +* Configuration and status register (CSR) type definitions for +* Octeon pcsxx. +*/ + +#ifndef __CVMX_PCSXX_DEFS_H__ +#define __CVMX_PCSXX_DEFS_H__ + +static inline u64 CVMX_PCSXX_10GBX_STATUS_REG (unsigned long offset) +{ +switch (cvmx_get_octeon_family ()) { +case OCTEON_CN66XX &OCTEON_FAMILY_MASK : +case OCTEON_CN61XX &OCTEON_FAMILY_MASK : +return 0x00011800B0000828ull + (offset) *0x8000000ull ; +case OCTEON_CN70XX &OCTEON_FAMILY_MASK : +case OCTEON_CN63XX &OCTEON_FAMILY_MASK : +return 0x00011800B0000828ull + (offset) *0x8000000ull ; +case OCTEON_CN68XX &OCTEON_FAMILY_MASK : +return 0x00011800B0000828ull + (offset) *0x1000000ull ; + } +return 0x00011800B0000828ull + (offset) *0x8000000ull ; +} + +static inline u64 CVMX_PCSXX_BIST_STATUS_REG (unsigned long offset) +{ +switch (cvmx_get_octeon_family ()) { +case OCTEON_CN66XX &OCTEON_FAMILY_MASK : +case OCTEON_CN61XX &OCTEON_FAMILY_MASK : +return 0x00011800B0000870ull + (offset) *0x8000000ull ; +case OCTEON_CN70XX &OCTEON_FAMILY_MASK : +case OCTEON_CN63XX &OCTEON_FAMILY_MASK : +return 0x00011800B0000870ull + (offset) *0x8000000ull ; +case OCTEON_CN68XX &OCTEON_FAMILY_MASK : +return 0x00011800B0000870ull + (offset) *0x1000000ull ; + } +return 0x00011800B0000870ull + (offset) *0x8000000ull ; +} + +static inline u64 CVMX_PCSXX_BIT_LOCK_STATUS_REG (unsigned long offset) +{ +switch (cvmx_get_octeon_family ()) { +case OCTEON_CN66XX &OCTEON_FAMILY_MASK : +case OCTEON_CN61XX &OCTEON_FAMILY_MASK : +return 0x00011800B0000850ull + (offset) *0x8000000ull ; +case OCTEON_CN70XX &OCTEON_FAMILY_MASK : +case OCTEON_CN63XX &OCTEON_FAMILY_MASK : +return 0x00011800B0000850ull + (offset) *0x8000000ull ; +case OCTEON_CN68XX &OCTEON_FAMILY_MASK : +return 0x00011800B0000850ull + (offset) *0x1000000ull ; + } +return 0x00011800B0000850ull + (offset) *0x8000000ull ; +} + +static inline u64 CVMX_PCSXX_CONTROL1_REG (unsigned long offset) +{ +switch (cvmx_get_octeon_family ()) { +case OCTEON_CN66XX &OCTEON_FAMILY_MASK : +case OCTEON_CN61XX &OCTEON_FAMILY_MASK : +return 0x00011800B0000800ull + (offset) *0x8000000ull ; +case OCTEON_CN70XX &OCTEON_FAMILY_MASK : +case OCTEON_CN63XX &OCTEON_FAMILY_MASK : +return 0x00011800B0000800ull + (offset) *0x8000000ull ; +case OCTEON_CN68XX &OCTEON_FAMILY_MASK : +return 0x00011800B0000800ull + (offset) *0x1000000ull ; + } +return 0x00011800B0000800ull + (offset) *0x8000000ull ; +} + +static inline u64 CVMX_PCSXX_CONTROL2_REG (unsigned long offset) +{ +switch (cvmx_get_octeon_family ()) { +case OCTEON_CN66XX &OCTEON_FAMILY_MASK : +case OCTEON_CN61XX &OCTEON_FAMILY_MASK : +return 0x00011800B0000818ull + (offset) *0x8000000ull ; +case OCTEON_CN70XX &OCTEON_FAMILY_MASK : +case OCTEON_CN63XX &OCTEON_FAMILY_MASK : +return 0x00011800B0000818ull + (offset) *0x8000000ull ; +case OCTEON_CN68XX &OCTEON_FAMILY_MASK : +return 0x00011800B0000818ull + (offset) *0x1000000ull ; + } +return 0x00011800B0000818ull + (offset) *0x8000000ull ; +} + +static inline u64 CVMX_PCSXX_INT_EN_REG (unsigned long offset) +{ +switch (cvmx_get_octeon_family ()) { +case OCTEON_CN66XX &OCTEON_FAMILY_MASK : +case OCTEON_CN61XX &OCTEON_FAMILY_MASK : +return 0x00011800B0000860ull + (offset) *0x8000000ull ; +case OCTEON_CN70XX &OCTEON_FAMILY_MASK : +case OCTEON_CN63XX &OCTEON_FAMILY_MASK : +return 0x00011800B0000860ull + (offset) *0x8000000ull ; +case OCTEON_CN68XX &OCTEON_FAMILY_MASK : +return 0x00011800B0000860ull + (offset) *0x1000000ull ; + } +return 0x00011800B0000860ull + (offset) *0x8000000ull ; +} + +static inline u64 CVMX_PCSXX_INT_REG (unsigned long offset) +{ +switch (cvmx_get_octeon_family ()) { +case OCTEON_CN66XX &OCTEON_FAMILY_MASK : +case OCTEON_CN61XX &OCTEON_FAMILY_MASK : +return 0x00011800B0000858ull + (offset) *0x8000000ull ; +case OCTEON_CN70XX &OCTEON_FAMILY_MASK : +case OCTEON_CN63XX &OCTEON_FAMILY_MASK : +return 0x00011800B0000858ull + (offset) *0x8000000ull ; +case OCTEON_CN68XX &OCTEON_FAMILY_MASK : +return 0x00011800B0000858ull + (offset) *0x1000000ull ; + } +return 0x00011800B0000858ull + (offset) *0x8000000ull ; +} + +static inline u64 CVMX_PCSXX_LOG_ANL_REG (unsigned long offset) +{ +switch (cvmx_get_octeon_family ()) { +case OCTEON_CN66XX &OCTEON_FAMILY_MASK : +case OCTEON_CN61XX &OCTEON_FAMILY_MASK : +return 0x00011800B0000868ull + (offset) *0x8000000ull ; +case OCTEON_CN70XX &OCTEON_FAMILY_MASK : +case OCTEON_CN63XX &OCTEON_FAMILY_MASK : +return 0x00011800B0000868ull + (offset) *0x8000000ull ; +case OCTEON_CN68XX &OCTEON_FAMILY_MASK : +return 0x00011800B0000868ull + (offset) *0x1000000ull ; + } +return 0x00011800B0000868ull + (offset) *0x8000000ull ; +} + +static inline u64 CVMX_PCSXX_MISC_CTL_REG (unsigned long offset) +{ +switch (cvmx_get_octeon_family ()) { +case OCTEON_CN66XX &OCTEON_FAMILY_MASK : +case OCTEON_CN61XX &OCTEON_FAMILY_MASK : +return 0x00011800B0000848ull + (offset) *0x8000000ull ; +case OCTEON_CN70XX &OCTEON_FAMILY_MASK : +case OCTEON_CN63XX &OCTEON_FAMILY_MASK : +return 0x00011800B0000848ull + (offset) *0x8000000ull ; +case OCTEON_CN68XX &OCTEON_FAMILY_MASK : +return 0x00011800B0000848ull + (offset) *0x1000000ull ; + } +return 0x00011800B0000848ull + (offset) *0x8000000ull ; +} + +static inline u64 CVMX_PCSXX_RX_SYNC_STATES_REG (unsigned long offset) +{ +switch (cvmx_get_octeon_family ()) { +case OCTEON_CN66XX &OCTEON_FAMILY_MASK : +case OCTEON_CN61XX &OCTEON_FAMILY_MASK : +return 0x00011800B0000838ull + (offset) *0x8000000ull ; +case OCTEON_CN70XX &OCTEON_FAMILY_MASK : +case OCTEON_CN63XX &OCTEON_FAMILY_MASK : +return 0x00011800B0000838ull + (offset) *0x8000000ull ; +case OCTEON_CN68XX &OCTEON_FAMILY_MASK : +return 0x00011800B0000838ull + (offset) *0x1000000ull ; + } +return 0x00011800B0000838ull + (offset) *0x8000000ull ; +} + +#define CVMX_PCSXX_SERDES_CRDT_CNT_REG (offset) (0x00011800B0000880ull) +static inline u64 CVMX_PCSXX_SPD_ABIL_REG (unsigned long offset) +{ +switch (cvmx_get_octeon_family ()) { +case OCTEON_CN66XX &OCTEON_FAMILY_MASK : +case OCTEON_CN61XX &OCTEON_FAMILY_MASK : +return 0x00011800B0000810ull + (offset) *0x8000000ull ; +case OCTEON_CN70XX &OCTEON_FAMILY_MASK : +case OCTEON_CN63XX &OCTEON_FAMILY_MASK : +return 0x00011800B0000810ull + (offset) *0x8000000ull ; +case OCTEON_CN68XX &OCTEON_FAMILY_MASK : +return 0x00011800B0000810ull + (offset) *0x1000000ull ; + } +return 0x00011800B0000810ull + (offset) *0x8000000ull ; +} + +static inline u64 CVMX_PCSXX_STATUS1_REG (unsigned long offset) +{ +switch (cvmx_get_octeon_family ()) { +case OCTEON_CN66XX &OCTEON_FAMILY_MASK : +case OCTEON_CN61XX &OCTEON_FAMILY_MASK : +return 0x00011800B0000808ull + (offset) *0x8000000ull ; +case OCTEON_CN70XX &OCTEON_FAMILY_MASK : +case OCTEON_CN63XX &OCTEON_FAMILY_MASK : +return 0x00011800B0000808ull + (offset) *0x8000000ull ; +case OCTEON_CN68XX &OCTEON_FAMILY_MASK : +return 0x00011800B0000808ull + (offset) *0x1000000ull ; + } +return 0x00011800B0000808ull + (offset) *0x8000000ull ; +} + +static inline u64 CVMX_PCSXX_STATUS2_REG (unsigned long offset) +{ +switch (cvmx_get_octeon_family ()) { +case OCTEON_CN66XX &OCTEON_FAMILY_MASK : +case OCTEON_CN61XX &OCTEON_FAMILY_MASK : +return 0x00011800B0000820ull + (offset) *0x8000000ull ; +case OCTEON_CN70XX &OCTEON_FAMILY_MASK : +case OCTEON_CN63XX &OCTEON_FAMILY_MASK : +return 0x00011800B0000820ull + (offset) *0x8000000ull ; +case OCTEON_CN68XX &OCTEON_FAMILY_MASK : +return 0x00011800B0000820ull + (offset) *0x1000000ull ; + } +return 0x00011800B0000820ull + (offset) *0x8000000ull ; +} + +static inline u64 CVMX_PCSXX_TX_RX_POLARITY_REG (unsigned long offset) +{ +switch (cvmx_get_octeon_family ()) { +case OCTEON_CN66XX &OCTEON_FAMILY_MASK : +case OCTEON_CN61XX &OCTEON_FAMILY_MASK : +return 0x00011800B0000840ull + (offset) *0x8000000ull ; +case OCTEON_CN70XX &OCTEON_FAMILY_MASK : +case OCTEON_CN63XX &OCTEON_FAMILY_MASK : +return 0x00011800B0000840ull + (offset) *0x8000000ull ; +case OCTEON_CN68XX &OCTEON_FAMILY_MASK : +return 0x00011800B0000840ull + (offset) *0x1000000ull ; + } +return 0x00011800B0000840ull + (offset) *0x8000000ull ; +} + +static inline u64 CVMX_PCSXX_TX_RX_STATES_REG (unsigned long offset) +{ +switch (cvmx_get_octeon_family ()) { +case OCTEON_CN66XX &OCTEON_FAMILY_MASK : +case OCTEON_CN61XX &OCTEON_FAMILY_MASK : +return 0x00011800B0000830ull + (offset) *0x8000000ull ; +case OCTEON_CN70XX &OCTEON_FAMILY_MASK : +case OCTEON_CN63XX &OCTEON_FAMILY_MASK : +return 0x00011800B0000830ull + (offset) *0x8000000ull ; +case OCTEON_CN68XX &OCTEON_FAMILY_MASK : +return 0x00011800B0000830ull + (offset) *0x1000000ull ; + } +return 0x00011800B0000830ull + (offset) *0x8000000ull ; +} + +/** +* cvmx_pcsx#_10gbx_status_reg +* +* PCSX_10GBX_STATUS_REG = 10gbx_status_reg +* +*/ +union cvmx_pcsxx_10gbx_status_reg { +u64 u64; +struct cvmx_pcsxx_10gbx_status_reg_s { +u64 reserved_13_63 :51 ; +u64 alignd :1 ; +u64 pattst :1 ; +u64 reserved_4_10 :7 ; +u64 l3sync :1 ; +u64 l2sync :1 ; +u64 l1sync :1 ; +u64 l0sync :1 ; + } s; +struct cvmx_pcsxx_10gbx_status_reg_s cn52xx; +struct cvmx_pcsxx_10gbx_status_reg_s cn52xxp1; +struct cvmx_pcsxx_10gbx_status_reg_s cn56xx; +struct cvmx_pcsxx_10gbx_status_reg_s cn56xxp1; +struct cvmx_pcsxx_10gbx_status_reg_s cn61xx; +struct cvmx_pcsxx_10gbx_status_reg_s cn63xx; +struct cvmx_pcsxx_10gbx_status_reg_s cn63xxp1; +struct cvmx_pcsxx_10gbx_status_reg_s cn66xx; +struct cvmx_pcsxx_10gbx_status_reg_s cn68xx; +struct cvmx_pcsxx_10gbx_status_reg_s cn68xxp1; +struct cvmx_pcsxx_10gbx_status_reg_s cn70xx; +struct cvmx_pcsxx_10gbx_status_reg_s cn70xxp1; +}; + +typedef union cvmx_pcsxx_10gbx_status_reg cvmx_pcsxx_10gbx_status_reg_t ; + +/** +* cvmx_pcsx#_bist_status_reg +* +* PCSX Bist Status Register +* +*/ +union cvmx_pcsxx_bist_status_reg { +u64 u64; +struct cvmx_pcsxx_bist_status_reg_s { +u64 reserved_1_63 :63 ; +u64 bist_status :1 ; + } s; +struct cvmx_pcsxx_bist_status_reg_s cn52xx; +struct cvmx_pcsxx_bist_status_reg_s cn52xxp1; +struct cvmx_pcsxx_bist_status_reg_s cn56xx; +struct cvmx_pcsxx_bist_status_reg_s cn56xxp1; +struct cvmx_pcsxx_bist_status_reg_s cn61xx; +struct cvmx_pcsxx_bist_status_reg_s cn63xx; +struct cvmx_pcsxx_bist_status_reg_s cn63xxp1; +struct cvmx_pcsxx_bist_status_reg_s cn66xx; +struct cvmx_pcsxx_bist_status_reg_s cn68xx; +struct cvmx_pcsxx_bist_status_reg_s cn68xxp1; +struct cvmx_pcsxx_bist_status_reg_s cn70xx; +struct cvmx_pcsxx_bist_status_reg_s cn70xxp1; +}; + +typedef union cvmx_pcsxx_bist_status_reg cvmx_pcsxx_bist_status_reg_t ; + +/** +* cvmx_pcsx#_bit_lock_status_reg +* +* PCSX Bit Lock Status Register +* +*/ +union cvmx_pcsxx_bit_lock_status_reg { +u64 u64; +struct cvmx_pcsxx_bit_lock_status_reg_s { +u64 reserved_4_63 :60 ; +u64 bitlck3 :1 ; +u64 bitlck2 :1 ; +u64 bitlck1 :1 ; +u64 bitlck0 :1 ; + } s; +struct cvmx_pcsxx_bit_lock_status_reg_s cn52xx; +struct cvmx_pcsxx_bit_lock_status_reg_s cn52xxp1; +struct cvmx_pcsxx_bit_lock_status_reg_s cn56xx; +struct cvmx_pcsxx_bit_lock_status_reg_s cn56xxp1; +struct cvmx_pcsxx_bit_lock_status_reg_s cn61xx; +struct cvmx_pcsxx_bit_lock_status_reg_s cn63xx; +struct cvmx_pcsxx_bit_lock_status_reg_s cn63xxp1; +struct cvmx_pcsxx_bit_lock_status_reg_s cn66xx; +struct cvmx_pcsxx_bit_lock_status_reg_s cn68xx; +struct cvmx_pcsxx_bit_lock_status_reg_s cn68xxp1; +struct cvmx_pcsxx_bit_lock_status_reg_s cn70xx; +struct cvmx_pcsxx_bit_lock_status_reg_s cn70xxp1; +}; + +typedef union cvmx_pcsxx_bit_lock_status_reg cvmx_pcsxx_bit_lock_status_reg_t ; + +/** +* cvmx_pcsx#_control1_reg +* +* NOTE: Logic Analyzer is enabled with LA_EN for the specified PCS lane only. +* PKT_SZ is effective only when LA_EN=1 +* For normal operation(sgmii or 1000Base-X), this bit must be 0. +* See pcsx.csr for xaui logic analyzer mode. +* For full description see document at .../rtl/pcs/readme_logic_analyzer.txt +* +* +* PCSX regs follow IEEE Std 802.3-2005, Section: 45.2.3 +* +* +* PCSX_CONTROL1_REG = Control Register1 +*/ +union cvmx_pcsxx_control1_reg { +u64 u64; +struct cvmx_pcsxx_control1_reg_s { +u64 reserved_16_63 :48 ; +u64 reset :1 ; +u64 loopbck1 :1 ; +u64 spdsel1 :1 ; +u64 reserved_12_12 :1 ; +u64 lo_pwr :1 ; +u64 reserved_7_10 :4 ; +u64 spdsel0 :1 ; +u64 spd :4 ; +u64 reserved_0_1 :2 ; + } s; +struct cvmx_pcsxx_control1_reg_s cn52xx; +struct cvmx_pcsxx_control1_reg_s cn52xxp1; +struct cvmx_pcsxx_control1_reg_s cn56xx; +struct cvmx_pcsxx_control1_reg_s cn56xxp1; +struct cvmx_pcsxx_control1_reg_s cn61xx; +struct cvmx_pcsxx_control1_reg_s cn63xx; +struct cvmx_pcsxx_control1_reg_s cn63xxp1; +struct cvmx_pcsxx_control1_reg_s cn66xx; +struct cvmx_pcsxx_control1_reg_s cn68xx; +struct cvmx_pcsxx_control1_reg_s cn68xxp1; +struct cvmx_pcsxx_control1_reg_s cn70xx; +struct cvmx_pcsxx_control1_reg_s cn70xxp1; +}; + +typedef union cvmx_pcsxx_control1_reg cvmx_pcsxx_control1_reg_t ; + +/** +* cvmx_pcsx#_control2_reg +* +* PCSX_CONTROL2_REG = Control Register2 +* +*/ +union cvmx_pcsxx_control2_reg { +u64 u64; +struct cvmx_pcsxx_control2_reg_s { +u64 reserved_2_63 :62 ; +u64 type :2 ; + } s; +struct cvmx_pcsxx_control2_reg_s cn52xx; +struct cvmx_pcsxx_control2_reg_s cn52xxp1; +struct cvmx_pcsxx_control2_reg_s cn56xx; +struct cvmx_pcsxx_control2_reg_s cn56xxp1; +struct cvmx_pcsxx_control2_reg_s cn61xx; +struct cvmx_pcsxx_control2_reg_s cn63xx; +struct cvmx_pcsxx_control2_reg_s cn63xxp1; +struct cvmx_pcsxx_control2_reg_s cn66xx; +struct cvmx_pcsxx_control2_reg_s cn68xx; +struct cvmx_pcsxx_control2_reg_s cn68xxp1; +struct cvmx_pcsxx_control2_reg_s cn70xx; +struct cvmx_pcsxx_control2_reg_s cn70xxp1; +}; + +typedef union cvmx_pcsxx_control2_reg cvmx_pcsxx_control2_reg_t ; + +/** +* cvmx_pcsx#_int_en_reg +* +* PCSX Interrupt Enable Register +* +*/ +union cvmx_pcsxx_int_en_reg { +u64 u64; +struct cvmx_pcsxx_int_en_reg_s { +u64 reserved_7_63 :57 ; +u64 dbg_sync_en :1 ; +u64 algnlos_en :1 ; +u64 synlos_en :1 ; +u64 bitlckls_en :1 ; +u64 rxsynbad_en :1 ; +u64 rxbad_en :1 ; +u64 txflt_en :1 ; + } s; +struct cvmx_pcsxx_int_en_reg_cn52xx { +u64 reserved_6_63 :58 ; +u64 algnlos_en :1 ; +u64 synlos_en :1 ; +u64 bitlckls_en :1 ; +u64 rxsynbad_en :1 ; +u64 rxbad_en :1 ; +u64 txflt_en :1 ; + } cn52xx; +struct cvmx_pcsxx_int_en_reg_cn52xx cn52xxp1; +struct cvmx_pcsxx_int_en_reg_cn52xx cn56xx; +struct cvmx_pcsxx_int_en_reg_cn52xx cn56xxp1; +struct cvmx_pcsxx_int_en_reg_s cn61xx; +struct cvmx_pcsxx_int_en_reg_s cn63xx; +struct cvmx_pcsxx_int_en_reg_s cn63xxp1; +struct cvmx_pcsxx_int_en_reg_s cn66xx; +struct cvmx_pcsxx_int_en_reg_s cn68xx; +struct cvmx_pcsxx_int_en_reg_s cn68xxp1; +struct cvmx_pcsxx_int_en_reg_s cn70xx; +struct cvmx_pcsxx_int_en_reg_s cn70xxp1; +}; + +typedef union cvmx_pcsxx_int_en_reg cvmx_pcsxx_int_en_reg_t ; + +/** +* cvmx_pcsx#_int_reg +* +* PCSX Interrupt Register +* Note: DBG_SYNC is a edge triggered interrupt. When set it indicates PCS Synchronization state +* machine in +* Figure 48-7 state diagram in IEEE Std 802.3-2005 changes state SYNC_ACQUIRED_1 to +* SYNC_ACQUIRED_2 +* indicating an invalid code group was received on one of the 4 receive lanes. +* This interrupt should be always disabled and used only for link problem debugging help. +*/ +union cvmx_pcsxx_int_reg { +u64 u64; +struct cvmx_pcsxx_int_reg_s { +u64 reserved_7_63 :57 ; +u64 dbg_sync :1 ; +u64 algnlos :1 ; +u64 synlos :1 ; +u64 bitlckls :1 ; +u64 rxsynbad :1 ; +u64 rxbad :1 ; +u64 txflt :1 ; + } s; +struct cvmx_pcsxx_int_reg_cn52xx { +u64 reserved_6_63 :58 ; +u64 algnlos :1 ; +u64 synlos :1 ; +u64 bitlckls :1 ; +u64 rxsynbad :1 ; +u64 rxbad :1 ; +u64 txflt :1 ; + } cn52xx; +struct cvmx_pcsxx_int_reg_cn52xx cn52xxp1; +struct cvmx_pcsxx_int_reg_cn52xx cn56xx; +struct cvmx_pcsxx_int_reg_cn52xx cn56xxp1; +struct cvmx_pcsxx_int_reg_s cn61xx; +struct cvmx_pcsxx_int_reg_s cn63xx; +struct cvmx_pcsxx_int_reg_s cn63xxp1; +struct cvmx_pcsxx_int_reg_s cn66xx; +struct cvmx_pcsxx_int_reg_s cn68xx; +struct cvmx_pcsxx_int_reg_s cn68xxp1; +struct cvmx_pcsxx_int_reg_s cn70xx; +struct cvmx_pcsxx_int_reg_s cn70xxp1; +}; + +typedef union cvmx_pcsxx_int_reg cvmx_pcsxx_int_reg_t ; + +/** +* cvmx_pcsx#_log_anl_reg +* +* PCSX Logic Analyzer Register +* NOTE: Logic Analyzer is enabled with LA_EN for xaui only. PKT_SZ is effective only when +* LA_EN=1 +* For normal operation(xaui), this bit must be 0. The dropped lane is used to send rxc[3:0]. +* See pcs.csr for sgmii/1000Base-X logic analyzer mode. +* For full description see document at .../rtl/pcs/readme_logic_analyzer.txt +*/ +union cvmx_pcsxx_log_anl_reg { +u64 u64; +struct cvmx_pcsxx_log_anl_reg_s { +u64 reserved_7_63 :57 ; +u64 enc_mode :1 ; +u64 drop_ln :2 ; +u64 lafifovfl :1 ; +u64 la_en :1 ; +u64 pkt_sz :2 ; + } s; +struct cvmx_pcsxx_log_anl_reg_s cn52xx; +struct cvmx_pcsxx_log_anl_reg_s cn52xxp1; +struct cvmx_pcsxx_log_anl_reg_s cn56xx; +struct cvmx_pcsxx_log_anl_reg_s cn56xxp1; +struct cvmx_pcsxx_log_anl_reg_s cn61xx; +struct cvmx_pcsxx_log_anl_reg_s cn63xx; +struct cvmx_pcsxx_log_anl_reg_s cn63xxp1; +struct cvmx_pcsxx_log_anl_reg_s cn66xx; +struct cvmx_pcsxx_log_anl_reg_s cn68xx; +struct cvmx_pcsxx_log_anl_reg_s cn68xxp1; +struct cvmx_pcsxx_log_anl_reg_s cn70xx; +struct cvmx_pcsxx_log_anl_reg_s cn70xxp1; +}; + +typedef union cvmx_pcsxx_log_anl_reg cvmx_pcsxx_log_anl_reg_t ; + +/** +* cvmx_pcsx#_misc_ctl_reg +* +* PCSX Misc Control Register +* LN_SWAP for XAUI is to simplify interconnection layout between devices +*/ +union cvmx_pcsxx_misc_ctl_reg { +u64 u64; +struct cvmx_pcsxx_misc_ctl_reg_s { +u64 reserved_4_63 :60 ; +u64 tx_swap :1 ; +u64 rx_swap :1 ; +u64 xaui :1 ; +u64 gmxeno :1 ; + } s; +struct cvmx_pcsxx_misc_ctl_reg_s cn52xx; +struct cvmx_pcsxx_misc_ctl_reg_s cn52xxp1; +struct cvmx_pcsxx_misc_ctl_reg_s cn56xx; +struct cvmx_pcsxx_misc_ctl_reg_s cn56xxp1; +struct cvmx_pcsxx_misc_ctl_reg_s cn61xx; +struct cvmx_pcsxx_misc_ctl_reg_s cn63xx; +struct cvmx_pcsxx_misc_ctl_reg_s cn63xxp1; +struct cvmx_pcsxx_misc_ctl_reg_s cn66xx; +struct cvmx_pcsxx_misc_ctl_reg_s cn68xx; +struct cvmx_pcsxx_misc_ctl_reg_s cn68xxp1; +struct cvmx_pcsxx_misc_ctl_reg_s cn70xx; +struct cvmx_pcsxx_misc_ctl_reg_s cn70xxp1; +}; + +typedef union cvmx_pcsxx_misc_ctl_reg cvmx_pcsxx_misc_ctl_reg_t ; + +/** +* cvmx_pcsx#_rx_sync_states_reg +* +* PCSX_RX_SYNC_STATES_REG = Receive Sync States Register +* +*/ +union cvmx_pcsxx_rx_sync_states_reg { +u64 u64; +struct cvmx_pcsxx_rx_sync_states_reg_s { +u64 reserved_16_63 :48 ; +u64 sync3st :4 ; +u64 sync2st :4 ; +u64 sync1st :4 ; +u64 sync0st :4 ; + } s; +struct cvmx_pcsxx_rx_sync_states_reg_s cn52xx; +struct cvmx_pcsxx_rx_sync_states_reg_s cn52xxp1; +struct cvmx_pcsxx_rx_sync_states_reg_s cn56xx; +struct cvmx_pcsxx_rx_sync_states_reg_s cn56xxp1; +struct cvmx_pcsxx_rx_sync_states_reg_s cn61xx; +struct cvmx_pcsxx_rx_sync_states_reg_s cn63xx; +struct cvmx_pcsxx_rx_sync_states_reg_s cn63xxp1; +struct cvmx_pcsxx_rx_sync_states_reg_s cn66xx; +struct cvmx_pcsxx_rx_sync_states_reg_s cn68xx; +struct cvmx_pcsxx_rx_sync_states_reg_s cn68xxp1; +struct cvmx_pcsxx_rx_sync_states_reg_s cn70xx; +struct cvmx_pcsxx_rx_sync_states_reg_s cn70xxp1; +}; + +typedef union cvmx_pcsxx_rx_sync_states_reg cvmx_pcsxx_rx_sync_states_reg_t ; + +/** +* cvmx_pcsx#_serdes_crdt_cnt_reg +* +* PCSX SERDES Credit Count +* +*/ +union cvmx_pcsxx_serdes_crdt_cnt_reg { +u64 u64; +struct cvmx_pcsxx_serdes_crdt_cnt_reg_s { +u64 reserved_5_63 :59 ; +u64 cnt :5 ; + } s; +struct cvmx_pcsxx_serdes_crdt_cnt_reg_s cn70xx; +struct cvmx_pcsxx_serdes_crdt_cnt_reg_s cn70xxp1; +}; + +typedef union cvmx_pcsxx_serdes_crdt_cnt_reg cvmx_pcsxx_serdes_crdt_cnt_reg_t ; + +/** +* cvmx_pcsx#_spd_abil_reg +* +* PCSX_SPD_ABIL_REG = Speed ability register +* +*/ +union cvmx_pcsxx_spd_abil_reg { +u64 u64; +struct cvmx_pcsxx_spd_abil_reg_s { +u64 reserved_2_63 :62 ; +u64 tenpasst :1 ; +u64 tengb :1 ; + } s; +struct cvmx_pcsxx_spd_abil_reg_s cn52xx; +struct cvmx_pcsxx_spd_abil_reg_s cn52xxp1; +struct cvmx_pcsxx_spd_abil_reg_s cn56xx; +struct cvmx_pcsxx_spd_abil_reg_s cn56xxp1; +struct cvmx_pcsxx_spd_abil_reg_s cn61xx; +struct cvmx_pcsxx_spd_abil_reg_s cn63xx; +struct cvmx_pcsxx_spd_abil_reg_s cn63xxp1; +struct cvmx_pcsxx_spd_abil_reg_s cn66xx; +struct cvmx_pcsxx_spd_abil_reg_s cn68xx; +struct cvmx_pcsxx_spd_abil_reg_s cn68xxp1; +struct cvmx_pcsxx_spd_abil_reg_s cn70xx; +struct cvmx_pcsxx_spd_abil_reg_s cn70xxp1; +}; + +typedef union cvmx_pcsxx_spd_abil_reg cvmx_pcsxx_spd_abil_reg_t ; + +/** +* cvmx_pcsx#_status1_reg +* +* PCSX_STATUS1_REG = Status Register1 +* +*/ +union cvmx_pcsxx_status1_reg { +u64 u64; +struct cvmx_pcsxx_status1_reg_s { +u64 reserved_8_63 :56 ; +u64 flt :1 ; +u64 reserved_3_6 :4 ; +u64 rcv_lnk :1 ; +u64 lpable :1 ; +u64 reserved_0_0 :1 ; + } s; +struct cvmx_pcsxx_status1_reg_s cn52xx; +struct cvmx_pcsxx_status1_reg_s cn52xxp1; +struct cvmx_pcsxx_status1_reg_s cn56xx; +struct cvmx_pcsxx_status1_reg_s cn56xxp1; +struct cvmx_pcsxx_status1_reg_s cn61xx; +struct cvmx_pcsxx_status1_reg_s cn63xx; +struct cvmx_pcsxx_status1_reg_s cn63xxp1; +struct cvmx_pcsxx_status1_reg_s cn66xx; +struct cvmx_pcsxx_status1_reg_s cn68xx; +struct cvmx_pcsxx_status1_reg_s cn68xxp1; +struct cvmx_pcsxx_status1_reg_s cn70xx; +struct cvmx_pcsxx_status1_reg_s cn70xxp1; +}; + +typedef union cvmx_pcsxx_status1_reg cvmx_pcsxx_status1_reg_t ; + +/** +* cvmx_pcsx#_status2_reg +* +* PCSX_STATUS2_REG = Status Register2 +* +*/ +union cvmx_pcsxx_status2_reg { +u64 u64; +struct cvmx_pcsxx_status2_reg_s { +u64 reserved_16_63 :48 ; +u64 dev :2 ; +u64 reserved_12_13 :2 ; +u64 xmtflt :1 ; +u64 rcvflt :1 ; +u64 reserved_3_9 :7 ; +u64 tengb_w :1 ; +u64 tengb_x :1 ; +u64 tengb_r :1 ; + } s; +struct cvmx_pcsxx_status2_reg_s cn52xx; +struct cvmx_pcsxx_status2_reg_s cn52xxp1; +struct cvmx_pcsxx_status2_reg_s cn56xx; +struct cvmx_pcsxx_status2_reg_s cn56xxp1; +struct cvmx_pcsxx_status2_reg_s cn61xx; +struct cvmx_pcsxx_status2_reg_s cn63xx; +struct cvmx_pcsxx_status2_reg_s cn63xxp1; +struct cvmx_pcsxx_status2_reg_s cn66xx; +struct cvmx_pcsxx_status2_reg_s cn68xx; +struct cvmx_pcsxx_status2_reg_s cn68xxp1; +struct cvmx_pcsxx_status2_reg_s cn70xx; +struct cvmx_pcsxx_status2_reg_s cn70xxp1; +}; + +typedef union cvmx_pcsxx_status2_reg cvmx_pcsxx_status2_reg_t ; + +/** +* cvmx_pcsx#_tx_rx_polarity_reg +* +* RX lane polarity vector [3:0] = XOR_RXPLRT<9:6> ^ [4[RXPLRT<1>]]; +* TX lane polarity vector [3:0] = XOR_TXPLRT<5:2> ^ [4[TXPLRT<0>]]; +* In short keep <1:0> to 2'b00, and use <5:2> and <9:6> fields to define per lane polarities +*/ +union cvmx_pcsxx_tx_rx_polarity_reg { +u64 u64; +struct cvmx_pcsxx_tx_rx_polarity_reg_s { +u64 reserved_10_63 :54 ; +u64 xor_rxplrt :4 ; +u64 xor_txplrt :4 ; +u64 rxplrt :1 ; +u64 txplrt :1 ; + } s; +struct cvmx_pcsxx_tx_rx_polarity_reg_s cn52xx; +struct cvmx_pcsxx_tx_rx_polarity_reg_cn52xxp1 { +u64 reserved_2_63 :62 ; +u64 rxplrt :1 ; +u64 txplrt :1 ; + } cn52xxp1; +struct cvmx_pcsxx_tx_rx_polarity_reg_s cn56xx; +struct cvmx_pcsxx_tx_rx_polarity_reg_cn52xxp1 cn56xxp1; +struct cvmx_pcsxx_tx_rx_polarity_reg_s cn61xx; +struct cvmx_pcsxx_tx_rx_polarity_reg_s cn63xx; +struct cvmx_pcsxx_tx_rx_polarity_reg_s cn63xxp1; +struct cvmx_pcsxx_tx_rx_polarity_reg_s cn66xx; +struct cvmx_pcsxx_tx_rx_polarity_reg_s cn68xx; +struct cvmx_pcsxx_tx_rx_polarity_reg_s cn68xxp1; +struct cvmx_pcsxx_tx_rx_polarity_reg_s cn70xx; +struct cvmx_pcsxx_tx_rx_polarity_reg_s cn70xxp1; +}; + +typedef union cvmx_pcsxx_tx_rx_polarity_reg cvmx_pcsxx_tx_rx_polarity_reg_t ; + +/** +* cvmx_pcsx#_tx_rx_states_reg +* +* PCSX_TX_RX_STATES_REG = Transmit Receive States Register +* +*/ +union cvmx_pcsxx_tx_rx_states_reg { +u64 u64; +struct cvmx_pcsxx_tx_rx_states_reg_s { +u64 reserved_14_63 :50 ; +u64 term_err :1 ; +u64 syn3bad :1 ; +u64 syn2bad :1 ; +u64 syn1bad :1 ; +u64 syn0bad :1 ; +u64 rxbad :1 ; +u64 algn_st :3 ; +u64 rx_st :2 ; +u64 tx_st :3 ; + } s; +struct cvmx_pcsxx_tx_rx_states_reg_s cn52xx; +struct cvmx_pcsxx_tx_rx_states_reg_cn52xxp1 { +u64 reserved_13_63 :51 ; +u64 syn3bad :1 ; +u64 syn2bad :1 ; +u64 syn1bad :1 ; +u64 syn0bad :1 ; +u64 rxbad :1 ; +u64 algn_st :3 ; +u64 rx_st :2 ; +u64 tx_st :3 ; + } cn52xxp1; +struct cvmx_pcsxx_tx_rx_states_reg_s cn56xx; +struct cvmx_pcsxx_tx_rx_states_reg_cn52xxp1 cn56xxp1; +struct cvmx_pcsxx_tx_rx_states_reg_s cn61xx; +struct cvmx_pcsxx_tx_rx_states_reg_s cn63xx; +struct cvmx_pcsxx_tx_rx_states_reg_s cn63xxp1; +struct cvmx_pcsxx_tx_rx_states_reg_s cn66xx; +struct cvmx_pcsxx_tx_rx_states_reg_s cn68xx; +struct cvmx_pcsxx_tx_rx_states_reg_s cn68xxp1; +struct cvmx_pcsxx_tx_rx_states_reg_s cn70xx; +struct cvmx_pcsxx_tx_rx_states_reg_s cn70xxp1; +}; + +typedef union cvmx_pcsxx_tx_rx_states_reg cvmx_pcsxx_tx_rx_states_reg_t ; + +#endif
Signature · 1 line
2.35.1
PATCH 7/52 mips: octeon: Add cvmx-xcv-defs.h header file
In reply to Stefan RoeseFrom: Aaron Williams <[email protected]>
Import cvmx-xcv-defs.h header file from 2013 U-Boot. It will be used by the later added drivers to support networking on the MIPS Octeon II / III platforms.
--- .../mach-octeon/include/mach/cvmx-xcv-defs.h | 226 ++++++++++++++++++ 1 file changed, 226 insertions(+) create mode 100644 arch/mips/mach-octeon/include/mach/cvmx-xcv-defs.h
arch/mips/mach-octeon/include/mach/cvmx-xcv-defs.h new file +226 -0
@@ -0,0 +1,226 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* +* Copyright (C) 2018-2022 Marvell International Ltd. +* +* Configuration and status register (CSR) type definitions for +* Octeon xcv. +*/ + +#ifndef __CVMX_XCV_DEFS_H__ +#define __CVMX_XCV_DEFS_H__ + +#define CVMX_XCV_BATCH_CRD_RET (0x00011800DB000100ull) +#define CVMX_XCV_COMP_CTL (0x00011800DB000020ull) +#define CVMX_XCV_CTL (0x00011800DB000030ull) +#define CVMX_XCV_DLL_CTL (0x00011800DB000010ull) +#define CVMX_XCV_ECO (0x00011800DB000200ull) +#define CVMX_XCV_INBND_STATUS (0x00011800DB000080ull) +#define CVMX_XCV_INT (0x00011800DB000040ull) +#define CVMX_XCV_RESET (0x00011800DB000000ull) + +/** +* cvmx_xcv_batch_crd_ret +*/ +union cvmx_xcv_batch_crd_ret { +u64 u64; +struct cvmx_xcv_batch_crd_ret_s { +u64 reserved_1_63 :63 ; +u64 crd_ret :1 ; + } s; +struct cvmx_xcv_batch_crd_ret_s cn73xx; +}; + +typedef union cvmx_xcv_batch_crd_ret cvmx_xcv_batch_crd_ret_t ; + +/** +* cvmx_xcv_comp_ctl +* +* This register controls programmable compensation. +* +*/ +union cvmx_xcv_comp_ctl { +u64 u64; +struct cvmx_xcv_comp_ctl_s { +u64 drv_byp :1 ; +u64 reserved_61_62 :2 ; +u64 cmp_pctl :5 ; +u64 reserved_53_55 :3 ; +u64 cmp_nctl :5 ; +u64 reserved_45_47 :3 ; +u64 drv_pctl :5 ; +u64 reserved_37_39 :3 ; +u64 drv_nctl :5 ; +u64 reserved_31_31 :1 ; +u64 pctl_lock :1 ; +u64 pctl_sat :1 ; +u64 reserved_28_28 :1 ; +u64 nctl_lock :1 ; +u64 reserved_1_26 :26 ; +u64 nctl_sat :1 ; + } s; +struct cvmx_xcv_comp_ctl_s cn73xx; +}; + +typedef union cvmx_xcv_comp_ctl cvmx_xcv_comp_ctl_t ; + +/** +* cvmx_xcv_ctl +* +* This register contains the status control bits. +* +*/ +union cvmx_xcv_ctl { +u64 u64; +struct cvmx_xcv_ctl_s { +u64 reserved_4_63 :60 ; +u64 lpbk_ext :1 ; +u64 lpbk_int :1 ; +u64 speed :2 ; + } s; +struct cvmx_xcv_ctl_s cn73xx; +}; + +typedef union cvmx_xcv_ctl cvmx_xcv_ctl_t ; + +/** +* cvmx_xcv_dll_ctl +* +* The RGMII timing specification requires that devices transmit clock and +* data synchronously. The specification requires external sources (namely +* the PC board trace routes) to introduce the appropriate 1.5 to 2.0 ns of +* delay. +* +* To eliminate the need for the PC board delays, the RGMII interface has optional +* on-board DLLs for both transmit and receive. For correct operation, at most one +* of the transmitter, board, or receiver involved in an RGMII link should +* introduce delay. By default/reset, the RGMII receivers delay the received clock, +* and the RGMII transmitters do not delay the transmitted clock. Whether this +* default works as-is with a given link partner depends on the behavior of the +* link partner and the PC board. +* +* These are the possible modes of RGMII receive operation: +* +* * XCV_DLL_CTL[CLKRX_BYP] = 0 (reset value) - The RGMII +* receive interface introduces clock delay using its internal DLL. +* This mode is appropriate if neither the remote +* transmitter nor the PC board delays the clock. +* +* * XCV_DLL_CTL[CLKRX_BYP] = 1, [CLKRX_SET] = 0x0 - The +* RGMII receive interface introduces no clock delay. This mode +* is appropriate if either the remote transmitter or the PC board +* delays the clock. +* +* These are the possible modes of RGMII transmit operation: +* +* * XCV_DLL_CTL[CLKTX_BYP] = 1, [CLKTX_SET] = 0x0 (reset value) - +* The RGMII transmit interface introduces no clock +* delay. This mode is appropriate is either the remote receiver +* or the PC board delays the clock. +* +* * XCV_DLL_CTL[CLKTX_BYP] = 0 - The RGMII transmit +* interface introduces clock delay using its internal DLL. +* This mode is appropriate if neither the remote receiver +* nor the PC board delays the clock. +*/ +union cvmx_xcv_dll_ctl { +u64 u64; +struct cvmx_xcv_dll_ctl_s { +u64 reserved_32_63 :32 ; +u64 lock :1 ; +u64 clk_set :7 ; +u64 clkrx_byp :1 ; +u64 clkrx_set :7 ; +u64 clktx_byp :1 ; +u64 clktx_set :7 ; +u64 reserved_2_7 :6 ; +u64 refclk_sel :2 ; + } s; +struct cvmx_xcv_dll_ctl_s cn73xx; +}; + +typedef union cvmx_xcv_dll_ctl cvmx_xcv_dll_ctl_t ; + +/** +* cvmx_xcv_eco +*/ +union cvmx_xcv_eco { +u64 u64; +struct cvmx_xcv_eco_s { +u64 reserved_16_63 :48 ; +u64 eco_rw :16 ; + } s; +struct cvmx_xcv_eco_s cn73xx; +}; + +typedef union cvmx_xcv_eco cvmx_xcv_eco_t ; + +/** +* cvmx_xcv_inbnd_status +* +* This register contains RGMII in-band status. +* +*/ +union cvmx_xcv_inbnd_status { +u64 u64; +struct cvmx_xcv_inbnd_status_s { +u64 reserved_4_63 :60 ; +u64 duplex :1 ; +u64 speed :2 ; +u64 link :1 ; + } s; +struct cvmx_xcv_inbnd_status_s cn73xx; +}; + +typedef union cvmx_xcv_inbnd_status cvmx_xcv_inbnd_status_t ; + +/** +* cvmx_xcv_int +* +* This register controls interrupts. +* +*/ +union cvmx_xcv_int { +u64 u64; +struct cvmx_xcv_int_s { +u64 reserved_7_63 :57 ; +u64 tx_ovrflw :1 ; +u64 tx_undflw :1 ; +u64 incomp_byte :1 ; +u64 duplex :1 ; +u64 reserved_2_2 :1 ; +u64 speed :1 ; +u64 link :1 ; + } s; +struct cvmx_xcv_int_s cn73xx; +}; + +typedef union cvmx_xcv_int cvmx_xcv_int_t ; + +/** +* cvmx_xcv_reset +* +* This register controls reset. +* +*/ +union cvmx_xcv_reset { +u64 u64; +struct cvmx_xcv_reset_s { +u64 enable :1 ; +u64 reserved_16_62 :47 ; +u64 clkrst :1 ; +u64 reserved_12_14 :3 ; +u64 dllrst :1 ; +u64 reserved_8_10 :3 ; +u64 comp :1 ; +u64 reserved_4_6 :3 ; +u64 tx_pkt_rst_n :1 ; +u64 tx_dat_rst_n :1 ; +u64 rx_pkt_rst_n :1 ; +u64 rx_dat_rst_n :1 ; + } s; +struct cvmx_xcv_reset_s cn73xx; +}; + +typedef union cvmx_xcv_reset cvmx_xcv_reset_t ; + +#endif
Signature · 1 line
2.35.1
PATCH 8/52 mips: octeon: Misc changes to existing headers for upcoming eth support
In reply to Stefan RoeseThis patch includes misc changes to already present Octeon MIPS header files, which are necessary for the upcoming ethernet support.
The changes are mostly:
- DM GPIO & I2C infrastructure
- Coding style cleanup while reworking the headers
--- .../mach-octeon/include/mach/cvmx-bootmem.h | 3 +- arch/mips/mach-octeon/include/mach/cvmx-fpa.h | 3 +- .../mips/mach-octeon/include/mach/cvmx-fpa3.h | 37 ------- .../include/mach/cvmx-helper-board.h | 6 +- .../include/mach/cvmx-helper-fdt.h | 40 +++---- .../include/mach/cvmx-helper-pko.h | 2 +- .../mach-octeon/include/mach/cvmx-helper.h | 20 ++++ .../mips/mach-octeon/include/mach/cvmx-regs.h | 100 ++++++++++++++++-- .../mach-octeon/include/mach/octeon_eth.h | 54 +++++----- 9 files changed, 166 insertions(+), 99 deletions(-)
arch/mips/mach-octeon/include/mach/cvmx-bootmem.h +2 -1
@@ -26,7 +26,8 @@/* Real physical addresses of memory regions */ #define OCTEON_DDR0_BASE (0x0ULL) -#define OCTEON_DDR0_SIZE (0x010000000ULL) +/* Use 16MiB here, as 256 leads to overwriting U-Boot reloc space */ +#define OCTEON_DDR0_SIZE (0x001000000ULL)#define OCTEON_DDR1_BASE ((OCTEON_IS_OCTEON2() || OCTEON_IS_OCTEON3()) \ ? 0x20000000ULL : 0x410000000ULL)#define OCTEON_DDR1_SIZE (0x010000000ULL)
arch/mips/mach-octeon/include/mach/cvmx-fpa.h +2 -1
@@ -104,8 +104,9 @@ static inline void *cvmx_fpa_alloc(u64 pool)/* FPA3 is handled differently */ if ((octeon_has_feature (OCTEON_FEATURE_FPA3 ))) {return cvmx_fpa3_alloc (cvmx_fpa1_pool_to_fpa3_aura (pool)); - }else + }else {return cvmx_fpa1_alloc (pool); + } }/**
arch/mips/mach-octeon/include/mach/cvmx-fpa3.h +0 -37
@@ -526,41 +526,4 @@ const char *cvmx_fpa3_get_pool_name(cvmx_fpa3_pool_t pool);int cvmx_fpa3_get_pool_buf_size (cvmx_fpa3_pool_t pool);const char *cvmx_fpa3_get_aura_name (cvmx_fpa3_gaura_t aura); -/* FIXME: Need a different macro for stage2 of u-boot */ - -static inline void cvmx_fpa3_stage2_init (int aura,int pool,u64 stack_paddr,int stacklen, -int buffer_sz,int buf_cnt) -{ -cvmx_fpa_poolx_cfg_t pool_cfg; - -/* Configure pool stack */ -cvmx_write_csr_node (0 ,CVMX_FPA_POOLX_STACK_BASE (pool), stack_paddr); -cvmx_write_csr_node (0 ,CVMX_FPA_POOLX_STACK_ADDR (pool), stack_paddr); -cvmx_write_csr_node (0 ,CVMX_FPA_POOLX_STACK_END (pool), stack_paddr + stacklen); - -/* Configure pool with buffer size */ - pool_cfg.u64 =0 ; - pool_cfg.cn78xx.nat_align =1 ; - pool_cfg.cn78xx.buf_size = buffer_sz >>7 ; - pool_cfg.cn78xx.l_type =0x2 ; - pool_cfg.cn78xx.ena =0 ; -cvmx_write_csr_node (0 ,CVMX_FPA_POOLX_CFG (pool), pool_cfg.u64); -/* Reset pool before starting */ - pool_cfg.cn78xx.ena =1 ; -cvmx_write_csr_node (0 ,CVMX_FPA_POOLX_CFG (pool), pool_cfg.u64); - -cvmx_write_csr_node (0 ,CVMX_FPA_AURAX_CFG (aura),0 ); -cvmx_write_csr_node (0 ,CVMX_FPA_AURAX_CNT_ADD (aura), buf_cnt); -cvmx_write_csr_node (0 ,CVMX_FPA_AURAX_POOL (aura), (u64 )pool); -} - -static inline void cvmx_fpa3_stage2_disable (int aura,int pool) -{ -cvmx_write_csr_node (0 ,CVMX_FPA_AURAX_POOL (aura),0 ); -cvmx_write_csr_node (0 ,CVMX_FPA_POOLX_CFG (pool),0 ); -cvmx_write_csr_node (0 ,CVMX_FPA_POOLX_STACK_BASE (pool),0 ); -cvmx_write_csr_node (0 ,CVMX_FPA_POOLX_STACK_ADDR (pool),0 ); -cvmx_write_csr_node (0 ,CVMX_FPA_POOLX_STACK_END (pool),0 ); -} -#endif /* __CVMX_FPA3_H__ */
arch/mips/mach-octeon/include/mach/cvmx-helper-board.h +4 -2
@@ -9,6 +9,8 @@ #ifndef __CVMX_HELPER_BOARD_H__ #define __CVMX_HELPER_BOARD_H__ +#include <asm-generic/gpio.h> + #define CVMX_VSC7224_NAME_LEN 16 typedef enum {
@@ -185,8 +187,8 @@ struct cvmx_vsc7224 {struct cvmx_fdt_i2c_bus_info *i2c_bus;/** Address of VSC7224 on i2c bus */ int i2c_addr; -struct cvmx_fdt_gpio_info *los_gpio;/** LoS GPIO pin */ -struct cvmx_fdt_gpio_info *reset_gpio;/** Reset GPIO pin */ +struct gpio_desc los_gpio;/** LoS GPIO pin */ +struct gpio_desc reset_gpio;/** Reset GPIO pin */ int of_offset;/** Offset in device tree */ };
arch/mips/mach-octeon/include/mach/cvmx-helper-fdt.h +20 -20
@@ -14,10 +14,13 @@#include <fdtdec.h> #include <time.h> #include <asm/global_data.h> +#include <asm-generic/gpio.h> +#include <dm/device.h> #include <linux/libfdt.h> #include <mach/cvmx-helper-sfp.h> +/* todo: this is deprecated and some of it can be removed at some time */ enum cvmx_i2c_bus_type {CVMX_I2C_BUS_OCTEON ,CVMX_I2C_MUX_PCA9540 ,
@@ -55,6 +58,8 @@ struct cvmx_fdt_i2c_bus_info {u8 enable_bit;/** True if mux, false if switch */ bool is_mux; + +struct udevice *i2c_bus; };/**
@@ -85,22 +90,24 @@ struct cvmx_fdt_sfp_info {bool is_qsfp;/** True if EEPROM data is valid */ bool valid; +/** SFP tx_disable GPIO descriptor */ -struct cvmx_fdt_gpio_info *tx_disable; +struct gpio_desc tx_disable;/** SFP mod_abs/QSFP mod_prs GPIO descriptor */ -struct cvmx_fdt_gpio_info *mod_abs; +struct gpio_desc mod_abs;/** SFP tx_error GPIO descriptor */ -struct cvmx_fdt_gpio_info *tx_error; +struct gpio_desc tx_error;/** SFP rx_los GPIO discriptor */ -struct cvmx_fdt_gpio_info *rx_los; +struct gpio_desc rx_los;/** QSFP select GPIO descriptor */ -struct cvmx_fdt_gpio_info *select; +struct gpio_desc select;/** QSFP reset GPIO descriptor */ -struct cvmx_fdt_gpio_info *reset; +struct gpio_desc reset;/** QSFP interrupt GPIO descriptor */ -struct cvmx_fdt_gpio_info *interrupt; +struct gpio_desc interrupt;/** QSFP lp_mode GPIO descriptor */ -struct cvmx_fdt_gpio_info *lp_mode; +struct gpio_desc lp_mode; +/** Last mod_abs value */ int last_mod_abs;/** Last rx_los value */
@@ -146,6 +153,9 @@ struct cvmx_fdt_sfp_info {int cvmx_fdt_lookup_phandles (const void *fdt_addr,int node,const char *prop_name,int *lenp,int *nodes); +int cvmx_ofnode_lookup_phandles (ofnode node,const char *prop_name, +int *lenp,ofnode *nodes); +/** * Helper to return the address property *
@@ -341,8 +351,7 @@ int cvmx_fdt_node_offset_by_compatible_list(const void *fdt_addr, int startoffse* Given the parent offset of an i2c device build up a list describing the bus * which can contain i2c muxes and switches. * -* @param[in] fdt_addr address of device tree -* @param of_offset Offset of the parent node of a GPIO device in +* @param[in] node ofnode of the parent node of a GPIO device in * the device tree. * * Return: pointer to list of i2c devices starting from the root which
@@ -351,7 +360,7 @@ int cvmx_fdt_node_offset_by_compatible_list(const void *fdt_addr, int startoffse* * @see cvmx_fdt_free_i2c_bus() */ -struct cvmx_fdt_i2c_bus_info *cvmx_fdt_get_i2c_bus (const void *fdt_addr,int of_offset); +struct cvmx_fdt_i2c_bus_info *cvmx_ofnode_get_i2c_bus (ofnode node);/** * Return the Octeon bus number for a bus descriptor
@@ -496,15 +505,6 @@ int __cvmx_fdt_parse_vsc7224(const void *fdt_addr);*/ int __cvmx_fdt_parse_avsp5410 (const void *fdt_addr); -/** -* Parse SFP information from device tree -* -* @param[in] fdt_addr Address of flat device tree -* -* Return: pointer to sfp info or NULL if error -*/ -struct cvmx_fdt_sfp_info *cvmx_helper_fdt_parse_sfp_info (const void *fdt_addr,int of_offset); -/** * @INTERNAL * Parses either a CS4343 phy or a slice of the phy from the device tree
arch/mips/mach-octeon/include/mach/cvmx-helper-pko.h +1 -1
@@ -17,7 +17,7 @@* number. Users should set this pointer to a function before * calling any cvmx-helper operations. */ -void (*cvmx_override_pko_queue_priority)(int ipd_port,u8 *priorities); +extern void (*cvmx_override_pko_queue_priority)(int ipd_port,u8 *priorities);/** * Gets the fpa pool number of pko pool
arch/mips/mach-octeon/include/mach/cvmx-helper.h +20 -0
@@ -127,6 +127,26 @@ enum cvmx_pko_padding { CVMX_PKO_PADDING_60 = 1, }; +/** +* cvmx_override_iface_phy_mode(int interface, int index) is a function pointer. +* It is meant to allow customization of interfaces which do not have a PHY. +* +* @returns 0 if MAC decides TX_CONFIG_REG or 1 if PHY decides TX_CONFIG_REG. +* +* If this function pointer is NULL then it defaults to the MAC. +*/ +extern int (*cvmx_override_iface_phy_mode) (int interface,int index); + +/** +* cvmx_override_ipd_port_setup(int ipd_port) is a function +* pointer. It is meant to allow customization of the IPD port/port kind +* setup before packet input/output comes online. It is called +* after cvmx-helper does the default IPD configuration, but +* before IPD is enabled. Users should set this pointer to a +* function before calling any cvmx-helper operations. +*/ +extern void (*cvmx_override_ipd_port_setup) (int ipd_port); +/** * This function enables the IPD and also enables the packet interfaces. * The packet interfaces (RGMII and SPI) must be enabled after the
arch/mips/mach-octeon/include/mach/cvmx-regs.h +92 -8
147 lines not on this page · raw message
arch/mips/mach-octeon/include/mach/octeon_eth.h +25 -29
93 lines not on this page · raw message
Signature · 1 line
2.35.1
PATCH 9/52 mips: octeon: Add cvmx-helper-agl.c
In reply to Stefan RoeseFrom: Aaron Williams <[email protected]>
Import cvmx-helper-agl.c from 2013 U-Boot. It will be used by the later added drivers to support networking on the MIPS Octeon II / III platforms.
--- arch/mips/mach-octeon/cvmx-helper-agl.c | 231 ++++++++++++++++++++++++ 1 file changed, 231 insertions(+) create mode 100644 arch/mips/mach-octeon/cvmx-helper-agl.c
arch/mips/mach-octeon/cvmx-helper-agl.c new file +231 -0
@@ -0,0 +1,231 @@ +// SPDX-License-Identifier: GPL-2.0 +/* +* Copyright (C) 2018-2022 Marvell International Ltd. +* +* Functions for AGL (RGMII) initialization, configuration, +* and monitoring. +*/ + +#include <log.h> +#include <time.h> +#include <linux/delay.h> + +#include <mach/cvmx-regs.h> +#include <mach/cvmx-csr.h> +#include <mach/cvmx-bootmem.h> +#include <mach/octeon-model.h> +#include <mach/cvmx-fuse.h> +#include <mach/octeon-feature.h> +#include <mach/cvmx-qlm.h> +#include <mach/octeon_qlm.h> +#include <mach/cvmx-pcie.h> +#include <mach/cvmx-coremask.h> + +#include <mach/cvmx-helper.h> +#include <mach/cvmx-helper-cfg.h> + +#include <mach/cvmx-agl.h> +#include <mach/cvmx-pki.h> + +#include <mach/cvmx-agl-defs.h> +#include <mach/cvmx-pko-defs.h> + +int __cvmx_helper_agl_enumerate (int xiface) +{ +if (OCTEON_IS_MODEL (OCTEON_CN70XX )) { +union cvmx_agl_prtx_ctl agl_prtx_ctl; + + agl_prtx_ctl.u64 =csr_rd (CVMX_AGL_PRTX_CTL (0 )); +if (agl_prtx_ctl.s.mode ==0 )/* RGMII */ +return 1 ; + } +return 0 ; +} + +/** +* @INTERNAL +* Convert interface to port to assess CSRs. +* +* @param xiface Interface to probe +* @return The port corresponding to the interface +*/ +int cvmx_helper_agl_get_port (int xiface) +{ +struct cvmx_xiface xi =cvmx_helper_xiface_to_node_interface (xiface); + +if (OCTEON_IS_MODEL (OCTEON_CN70XX )) +return xi.interface -4 ; +return -1 ; +} + +/** +* @INTERNAL +* Probe a RGMII interface and determine the number of ports +* connected to it. The RGMII interface should still be down +* after this call. +* +* @param interface to probe +* +* @return Number of ports on the interface. Zero to disable. +*/ +int __cvmx_helper_agl_probe (int interface) +{ +int port =cvmx_helper_agl_get_port (interface); +union cvmx_agl_gmx_bist gmx_bist; +union cvmx_agl_gmx_prtx_cfg gmx_prtx_cfg; +union cvmx_agl_prtx_ctl agl_prtx_ctl; +int result; + + result =__cvmx_helper_agl_enumerate (interface); +if (result ==0 ) +return 0 ; + +/* Check BIST status */ + gmx_bist.u64 =csr_rd (CVMX_AGL_GMX_BIST ); +if (gmx_bist.u64) +printf ("Management port AGL failed BIST (0x%016llx) on AGL%d\n" , +CAST64 (gmx_bist.u64), port); + +/* Disable the external input/output */ + gmx_prtx_cfg.u64 =csr_rd (CVMX_AGL_GMX_PRTX_CFG (port)); + gmx_prtx_cfg.s.en =0 ; +csr_wr (CVMX_AGL_GMX_PRTX_CFG (port), gmx_prtx_cfg.u64); + +/* Set the rgx_ref_clk MUX with AGL_PRTx_CTL[REFCLK_SEL]. Default value +* is 0 (RGMII REFCLK). Recommended to use RGMII RXC(1) or sclk/4 (2) +* to save cost. +*/ + + agl_prtx_ctl.u64 =csr_rd (CVMX_AGL_PRTX_CTL (port)); + agl_prtx_ctl.s.clkrst =0 ; + agl_prtx_ctl.s.dllrst =0 ; + agl_prtx_ctl.s.clktx_byp =0 ; + +if (OCTEON_IS_MODEL (OCTEON_CN70XX )) { +bool tx_enable_bypass; +int tx_delay; + + agl_prtx_ctl.s.refclk_sel = +cvmx_helper_get_agl_refclk_sel (interface, port); + agl_prtx_ctl.s.clkrx_set = +cvmx_helper_get_agl_rx_clock_skew (interface, port); + agl_prtx_ctl.s.clkrx_byp = +cvmx_helper_get_agl_rx_clock_delay_bypass (interface, + port); +cvmx_helper_cfg_get_rgmii_tx_clk_delay ( + interface, port, &tx_enable_bypass, &tx_delay); + agl_prtx_ctl.s.clktx_byp = tx_enable_bypass; + agl_prtx_ctl.s.clktx_set = tx_delay; + } +csr_wr (CVMX_AGL_PRTX_CTL (port), agl_prtx_ctl.u64); +/* Force write out before wait */ +csr_rd (CVMX_AGL_PRTX_CTL (port)); +udelay (500 ); + +/* Enable the componsation controller */ + agl_prtx_ctl.u64 =csr_rd (CVMX_AGL_PRTX_CTL (port)); + agl_prtx_ctl.s.drv_byp =0 ; +csr_wr (CVMX_AGL_PRTX_CTL (port), agl_prtx_ctl.u64); +/* Force write out before wait */ +csr_rd (CVMX_AGL_PRTX_CTL (port)); + +if (!OCTEON_IS_OCTEON3 ()) { +/* Enable the interface */ + agl_prtx_ctl.u64 =csr_rd (CVMX_AGL_PRTX_CTL (port)); + agl_prtx_ctl.s.enable =1 ; +csr_wr (CVMX_AGL_PRTX_CTL (port), agl_prtx_ctl.u64); +/* Read the value back to force the previous write */ + agl_prtx_ctl.u64 =csr_rd (CVMX_AGL_PRTX_CTL (port)); + } + +/* Enable the compensation controller */ + agl_prtx_ctl.u64 =csr_rd (CVMX_AGL_PRTX_CTL (port)); + agl_prtx_ctl.s.comp =1 ; +csr_wr (CVMX_AGL_PRTX_CTL (port), agl_prtx_ctl.u64); +/* Force write out before wait */ +csr_rd (CVMX_AGL_PRTX_CTL (port)); + +/* for componsation state to lock. */ +udelay (500 ); + +return result; +} + +/** +* @INTERNAL +* Bringup and enable a RGMII interface. After this call packet +* I/O should be fully functional. This is called with IPD +* enabled but PKO disabled. +* +* @param interface to bring up +* +* @return Zero on success, negative on failure +*/ +int __cvmx_helper_agl_enable (int interface) +{ +int port =cvmx_helper_agl_get_port (interface); +int ipd_port =cvmx_helper_get_ipd_port (interface, port); +union cvmx_pko_mem_port_ptrs pko_mem_port_ptrs; +union cvmx_pko_reg_read_idx read_idx; +int do_link_set =1 ; +int i; + +/* Setup PKO for AGL interface. Back pressure is not supported. */ + pko_mem_port_ptrs.u64 =0 ; + read_idx.u64 =0 ; + read_idx.s.inc =1 ; +csr_wr (CVMX_PKO_REG_READ_IDX , read_idx.u64); + +for (i =0 ; i <40 ; i++) { + pko_mem_port_ptrs.u64 =csr_rd (CVMX_PKO_MEM_PORT_PTRS ); +if (pko_mem_port_ptrs.s.pid ==24 ) { + pko_mem_port_ptrs.s.eid =10 ; + pko_mem_port_ptrs.s.bp_port =40 ; +csr_wr (CVMX_PKO_MEM_PORT_PTRS , pko_mem_port_ptrs.u64); +break ; + } + } + +cvmx_agl_enable (port); +if (do_link_set) +cvmx_agl_link_set (port,cvmx_agl_link_get (ipd_port)); + +return 0 ; +} + +/** +* @INTERNAL +* Return the link state of an IPD/PKO port as returned by +* auto negotiation. The result of this function may not match +* Octeon's link config if auto negotiation has changed since +* the last call to cvmx_helper_link_set(). +* +* @param ipd_port IPD/PKO port to query +* +* @return Link state +*/ +cvmx_helper_link_info_t __cvmx_helper_agl_link_get (int ipd_port) +{ +return cvmx_agl_link_get (ipd_port); +} + +/** +* @INTERNAL +* Configure an IPD/PKO port for the specified link state. This +* function does not influence auto negotiation at the PHY level. +* The passed link state must always match the link state returned +* by cvmx_helper_link_get(). It is normally best to use +* cvmx_helper_link_autoconf() instead. +* +* @param ipd_port IPD/PKO port to configure +* @param link_info The new link state +* +* @return Zero on success, negative on failure +*/ +int __cvmx_helper_agl_link_set (int ipd_port,cvmx_helper_link_info_t link_info) +{ +int interface =cvmx_helper_get_interface_num (ipd_port); +int port =cvmx_helper_agl_get_port (interface); + +return cvmx_agl_link_set (port, link_info); +}
Signature · 1 line
2.35.1
PATCH 10/52 mips: octeon: Add cvmx-helper-bgx.c
In reply to Stefan RoeseFrom: Aaron Williams <[email protected]>
Import cvmx-helper-bgx.c from 2013 U-Boot. It will be used by the later added drivers to support networking on the MIPS Octeon II / III platforms.
--- arch/mips/mach-octeon/cvmx-helper-bgx.c | 3215 +++++++++++++++++++++++ 1 file changed, 3215 insertions(+) create mode 100644 arch/mips/mach-octeon/cvmx-helper-bgx.c
arch/mips/mach-octeon/cvmx-helper-bgx.c new file +3215 -0
@@ -0,0 +1,3215 @@ +// SPDX-License-Identifier: GPL-2.0 +/* +* Copyright (C) 2018-2022 Marvell International Ltd. +* +* Functions to configure the BGX MAC. +*/ + +#include <log.h> +#include <linux/delay.h> + +#include <mach/cvmx-regs.h> +#include <mach/cvmx-csr.h> +#include <mach/cvmx-bootmem.h> +#include <mach/octeon-model.h> +#include <mach/cvmx-fuse.h> +#include <mach/octeon-feature.h> +#include <mach/cvmx-qlm.h> +#include <mach/octeon_qlm.h> +#include <mach/cvmx-pcie.h> +#include <mach/cvmx-coremask.h> + +#include <mach/cvmx-agl-defs.h> +#include <mach/cvmx-bgxx-defs.h> +#include <mach/cvmx-gmxx-defs.h> +#include <mach/cvmx-ipd-defs.h> +#include <mach/cvmx-pki-defs.h> +#include <mach/cvmx-xcv-defs.h> + +#include <mach/cvmx-helper.h> +#include <mach/cvmx-helper-board.h> +#include <mach/cvmx-helper-fdt.h> +#include <mach/cvmx-helper-bgx.h> +#include <mach/cvmx-helper-cfg.h> +#include <mach/cvmx-helper-util.h> +#include <mach/cvmx-helper-pki.h> + +#include <mach/cvmx-global-resources.h> +#include <mach/cvmx-pko-internal-ports-range.h> +#include <mach/cvmx-ilk.h> +#include <mach/cvmx-pip.h> + +/* Enable this define to see BGX error messages */ +/*#define DEBUG_BGX */ + +/* Enable this variable to trace functions called for initializing BGX */ +static const int debug; + +/** +* cvmx_helper_bgx_override_autoneg(int xiface, int index) is a function pointer +* to override enabling/disabling of autonegotiation for SGMII, 10G-KR or 40G-KR4 +* interfaces. This function is called when interface is initialized. +*/ +int (*cvmx_helper_bgx_override_autoneg)(int xiface,int index) =NULL ; + +/* +* cvmx_helper_bgx_override_fec(int xiface) is a function pointer +* to override enabling/disabling of FEC for 10G interfaces. This function +* is called when interface is initialized. +*/ +int (*cvmx_helper_bgx_override_fec)(int xiface,int index) =NULL ; + +/** +* Delay after enabling an interface based on the mode. Different modes take +* different amounts of time. +*/ +static void +__cvmx_helper_bgx_interface_enable_delay (cvmx_helper_interface_mode_t mode) +{ +switch (mode) { +case CVMX_HELPER_INTERFACE_MODE_10G_KR : +case CVMX_HELPER_INTERFACE_MODE_40G_KR4 : +case CVMX_HELPER_INTERFACE_MODE_XLAUI : +case CVMX_HELPER_INTERFACE_MODE_XFI : +mdelay (250 ); +break ; +case CVMX_HELPER_INTERFACE_MODE_RXAUI : +case CVMX_HELPER_INTERFACE_MODE_XAUI : +mdelay (100 ); +break ; +case CVMX_HELPER_INTERFACE_MODE_SGMII : +mdelay (50 ); +break ; +default : +mdelay (50 ); +break ; + } +} + +/** +* @INTERNAL +* +* Returns number of ports based on interface +* @param xiface Which xiface +* @return Number of ports based on xiface +*/ +int __cvmx_helper_bgx_enumerate (int xiface) +{ +cvmx_bgxx_cmr_tx_lmacs_t lmacs; +struct cvmx_xiface xi =cvmx_helper_xiface_to_node_interface (xiface); + + lmacs.u64 =csr_rd_node (xi.node,CVMX_BGXX_CMR_TX_LMACS (xi.interface)); +return lmacs.s.lmacs; +} + +/** +* @INTERNAL +* +* Returns mode of each BGX LMAC (port). +* This is different than 'cvmx_helper_interface_get_mode()' which +* provides mode of an entire interface, but when BGX is in "mixed" +* mode this function should be called instead to get the protocol +* for each port (BGX LMAC) individually. +* Both function return the same enumerated mode. +* +* @param xiface is the global interface identifier +* @param index is the interface port index +* @returns mode of the individual port +*/ +cvmx_helper_interface_mode_t cvmx_helper_bgx_get_mode (int xiface,int index) +{ +struct cvmx_xiface xi =cvmx_helper_xiface_to_node_interface (xiface); +cvmx_bgxx_cmrx_config_t cmr_config; +cvmx_bgxx_spux_br_pmd_control_t pmd_control; + + cmr_config.u64 =csr_rd_node ( + xi.node,CVMX_BGXX_CMRX_CONFIG (index, xi.interface)); + +switch (cmr_config.s.lmac_type) { +case 0 : +return CVMX_HELPER_INTERFACE_MODE_SGMII ; +case 1 : +return CVMX_HELPER_INTERFACE_MODE_XAUI ; +case 2 : +return CVMX_HELPER_INTERFACE_MODE_RXAUI ; +case 3 : +if (OCTEON_IS_MODEL (OCTEON_CN78XX_PASS1_X )) +return cvmx_helper_interface_get_mode (xiface); + pmd_control.u64 =csr_rd_node ( + xi.node, +CVMX_BGXX_SPUX_BR_PMD_CONTROL (index, xi.interface)); +if (pmd_control.s.train_en) +return CVMX_HELPER_INTERFACE_MODE_10G_KR ; +else +return CVMX_HELPER_INTERFACE_MODE_XFI ; +break ; +case 4 : +if (OCTEON_IS_MODEL (OCTEON_CN78XX_PASS1_X )) +return cvmx_helper_interface_get_mode (xiface); + pmd_control.u64 =csr_rd_node ( + xi.node, +CVMX_BGXX_SPUX_BR_PMD_CONTROL (index, xi.interface)); +if (pmd_control.s.train_en) +return CVMX_HELPER_INTERFACE_MODE_40G_KR4 ; +else +return CVMX_HELPER_INTERFACE_MODE_XLAUI ; +break ; +case 5 : +return CVMX_HELPER_INTERFACE_MODE_RGMII ; +default : +return CVMX_HELPER_INTERFACE_MODE_DISABLED ; + } +} + +/** +* @INTERNAL +* Disable the BGX port +* +* @param xipd_port IPD port of the BGX interface to disable +*/ +void cvmx_helper_bgx_disable (int xipd_port) +{ +int xiface =cvmx_helper_get_interface_num (xipd_port); +struct cvmx_xiface xi =cvmx_helper_xiface_to_node_interface (xiface); +struct cvmx_xport xp =cvmx_helper_ipd_port_to_xport (xipd_port); +int node = xi.node; +int index =cvmx_helper_get_interface_index_num (xp.port); +cvmx_bgxx_cmrx_config_t cmr_config; + + cmr_config.u64 = +csr_rd_node (node,CVMX_BGXX_CMRX_CONFIG (index, xi.interface)); +if (debug) +debug ("%s: Disabling tx and rx packets on xipd port 0x%x\n" , + __func__, xipd_port); + cmr_config.s.data_pkt_tx_en =0 ; + cmr_config.s.data_pkt_rx_en =0 ; +csr_wr_node (node,CVMX_BGXX_CMRX_CONFIG (index, xi.interface), + cmr_config.u64); +} + +static int __cvmx_helper_bgx_rgmii_speed (cvmx_helper_link_info_t link_info) +{ +cvmx_xcv_reset_t xcv_reset; +cvmx_xcv_ctl_t xcv_ctl; +cvmx_xcv_batch_crd_ret_t crd_ret; +cvmx_xcv_dll_ctl_t dll_ctl; +cvmx_xcv_comp_ctl_t comp_ctl; +int speed; +int up = link_info.s.link_up; +int do_credits; + +if (link_info.s.speed ==100 ) + speed =1 ; +else if (link_info.s.speed ==10 ) + speed =0 ; +else + speed =2 ; + + xcv_reset.u64 =csr_rd (CVMX_XCV_RESET ); + xcv_ctl.u64 =csr_rd (CVMX_XCV_CTL ); + do_credits = up && !xcv_reset.s.enable; + +if (xcv_ctl.s.lpbk_int) { + xcv_reset.s.clkrst =0 ; +csr_wr (CVMX_XCV_RESET , xcv_reset.u64); + } + +if (up && (!xcv_reset.s.enable || xcv_ctl.s.speed != speed)) { +if (debug) +debug ("%s: *** Enabling XCV block\n" , __func__); +/* Enable the XCV block */ + xcv_reset.u64 =csr_rd (CVMX_XCV_RESET ); + xcv_reset.s.enable =1 ; +csr_wr (CVMX_XCV_RESET , xcv_reset.u64); + +/* Set operating mode */ + xcv_ctl.u64 =csr_rd (CVMX_XCV_CTL ); + xcv_ctl.s.speed = speed; +csr_wr (CVMX_XCV_CTL , xcv_ctl.u64); + +/* Configure DLL - enable or bypass */ +/* TX no bypass, RX bypass */ + dll_ctl.u64 =csr_rd (CVMX_XCV_DLL_CTL ); + dll_ctl.s.clkrx_set =0 ; + dll_ctl.s.clkrx_byp =1 ; + dll_ctl.s.clktx_byp =0 ; +csr_wr (CVMX_XCV_DLL_CTL , dll_ctl.u64); + +/* Enable */ + dll_ctl.u64 =csr_rd (CVMX_XCV_DLL_CTL ); + dll_ctl.s.refclk_sel =0 ; +csr_wr (CVMX_XCV_DLL_CTL , dll_ctl.u64); + xcv_reset.u64 =csr_rd (CVMX_XCV_RESET ); + xcv_reset.s.dllrst =0 ; +csr_wr (CVMX_XCV_RESET , xcv_reset.u64); + +/* Delay deems to be need so XCV_DLL_CTL[CLK_SET] works */ +udelay (10 ); + + comp_ctl.u64 =csr_rd (CVMX_XCV_COMP_CTL ); +//comp_ctl.s.drv_pctl = 0; +//comp_ctl.s.drv_nctl = 0; + comp_ctl.s.drv_byp =0 ; +csr_wr (CVMX_XCV_COMP_CTL , comp_ctl.u64); + +/* enable */ + xcv_reset.u64 =csr_rd (CVMX_XCV_RESET ); + xcv_reset.s.comp =1 ; +csr_wr (CVMX_XCV_RESET , xcv_reset.u64); + +/* setup the RXC */ + xcv_reset.u64 =csr_rd (CVMX_XCV_RESET ); + xcv_reset.s.clkrst = !xcv_ctl.s.lpbk_int; +csr_wr (CVMX_XCV_RESET , xcv_reset.u64); + +/* datapaths come out of the reset +* - the datapath resets will disengage BGX from the RGMII +* interface +* - XCV will continue to return TX credits for each tick that +* is sent on the TX data path +*/ + xcv_reset.u64 =csr_rd (CVMX_XCV_RESET ); + xcv_reset.s.tx_dat_rst_n =1 ; + xcv_reset.s.rx_dat_rst_n =1 ; +csr_wr (CVMX_XCV_RESET , xcv_reset.u64); + }else if (debug) { +debug ("%s: *** Not enabling XCV\n" , __func__); +debug (" up: %s, xcv_reset.s.enable: %d, xcv_ctl.s.speed: %d, speed: %d\n" , + up ?"true" :"false" , (unsigned int )xcv_reset.s.enable, + (unsigned int )xcv_ctl.s.speed, speed); + } + +/* enable the packet flow +* - The packet resets will be only disengage on packet boundaries +* - XCV will continue to return TX credits for each tick that is +* sent on the TX datapath +*/ + xcv_reset.u64 =csr_rd (CVMX_XCV_RESET ); + xcv_reset.s.tx_pkt_rst_n = up; + xcv_reset.s.rx_pkt_rst_n = up; +csr_wr (CVMX_XCV_RESET , xcv_reset.u64); + +/* Full reset when link is down */ +if (!up) { +if (debug) +debug ("%s: *** Disabling XCV reset\n" , __func__); +/* wait 2*MTU in time */ +mdelay (10 ); +/* reset the world */ +csr_wr (CVMX_XCV_RESET ,0 ); + } + +/* grant PKO TX credits */ +if (do_credits) { + crd_ret.u64 =csr_rd (CVMX_XCV_BATCH_CRD_RET ); + crd_ret.s.crd_ret =1 ; +csr_wr (CVMX_XCV_BATCH_CRD_RET , crd_ret.u64); + } + +return 0 ; +} + +static void __cvmx_bgx_common_init_pknd (int xiface,int index) +{ +int num_ports; +int num_chl =16 ; +struct cvmx_xiface xi =cvmx_helper_xiface_to_node_interface (xiface); +int node = xi.node; +int pknd; +cvmx_bgxx_cmrx_rx_bp_on_t bgx_rx_bp_on; +cvmx_bgxx_cmrx_rx_id_map_t cmr_rx_id_map; +cvmx_bgxx_cmr_chan_msk_and_t chan_msk_and; +cvmx_bgxx_cmr_chan_msk_or_t chan_msk_or; + +if (debug) +debug ("%s: interface %u:%d/%d\n" , __func__, xi.node, + xi.interface, index); + + num_ports =cvmx_helper_ports_on_interface (xiface); +/* Modify bp_on mark, depending on number of LMACS on that interface +* and write it for every port +*/ + bgx_rx_bp_on.u64 =0 ; + bgx_rx_bp_on.s.mark = (CVMX_BGX_RX_FIFO_SIZE / (num_ports *4 *16 )); + +/* Setup pkind */ + pknd =cvmx_helper_get_pknd (xiface, index); + cmr_rx_id_map.u64 =csr_rd_node ( + node,CVMX_BGXX_CMRX_RX_ID_MAP (index, xi.interface)); + cmr_rx_id_map.s.pknd = pknd; +/* Change the default reassembly id (RID), as max 14 RIDs allowed */ +if (OCTEON_IS_MODEL (OCTEON_CN73XX )) + cmr_rx_id_map.s.rid = ((4 * xi.interface) +2 + index); +csr_wr_node (node,CVMX_BGXX_CMRX_RX_ID_MAP (index, xi.interface), + cmr_rx_id_map.u64); +/* Set backpressure channel mask AND/OR registers */ + chan_msk_and.u64 = +csr_rd_node (node,CVMX_BGXX_CMR_CHAN_MSK_AND (xi.interface)); + chan_msk_or.u64 = +csr_rd_node (node,CVMX_BGXX_CMR_CHAN_MSK_OR (xi.interface)); + chan_msk_and.s.msk_and |= ((1 << num_chl) -1 ) << (16 * index); + chan_msk_or.s.msk_or |= ((1 << num_chl) -1 ) << (16 * index); +csr_wr_node (node,CVMX_BGXX_CMR_CHAN_MSK_AND (xi.interface), + chan_msk_and.u64); +csr_wr_node (node,CVMX_BGXX_CMR_CHAN_MSK_OR (xi.interface), + chan_msk_or.u64); +/* set rx back pressure (bp_on) on value */ +csr_wr_node (node,CVMX_BGXX_CMRX_RX_BP_ON (index, xi.interface), + bgx_rx_bp_on.u64); +} + +/** +* @INTERNAL +* Probe a SGMII interface and determine the number of ports +* connected to it. The SGMII interface should still be down after +* this call. This is used by interfaces using the bgx mac. +* +* @param xiface Interface to probe +* +* @return Number of ports on the interface. Zero to disable. +*/ +int __cvmx_helper_bgx_probe (int xiface) +{ +return __cvmx_helper_bgx_enumerate (xiface); +} + +/** +* @INTERNAL +* Return the size of the BGX TX_FIFO for a given LMAC, +* or 0 if the requested LMAC is inactive. +* +* TBD: Need also to add a "__cvmx_helper_bgx_speed()" function to +* return the speed of each LMAC. +*/ +int __cvmx_helper_bgx_fifo_size (int xiface,unsigned int lmac) +{ +cvmx_bgxx_cmr_tx_lmacs_t lmacs; +struct cvmx_xiface xi =cvmx_helper_xiface_to_node_interface (xiface); +unsigned int tx_fifo_size =CVMX_BGX_TX_FIFO_SIZE ; + +/* FIXME: Add validation for interface# < BGX_count */ + lmacs.u64 =csr_rd_node (xi.node,CVMX_BGXX_CMR_TX_LMACS (xi.interface)); + +switch (lmacs.s.lmacs) { +case 1 : +if (lmac >0 ) +return 0 ; +else +return tx_fifo_size; +case 2 : +if (lmac >1 ) +return 0 ; +else +return tx_fifo_size >>1 ; +case 3 : +if (lmac >2 ) +return 0 ; +else +return tx_fifo_size >>2 ; +case 4 : +if (lmac >3 ) +return 0 ; +else +return tx_fifo_size >>2 ; +default : +return 0 ; + } +} + +/** +* @INTERNAL +* Perform initialization required only once for an SGMII port. +* +* @param xiface Interface to init +* @param index Index of prot on the interface +* +* @return Zero on success, negative on failure +*/ +static int __cvmx_helper_bgx_sgmii_hardware_init_one_time (int xiface,int index) +{ +struct cvmx_xiface xi =cvmx_helper_xiface_to_node_interface (xiface); +int node = xi.node; +const u64 clock_mhz =1200 ;/* todo: fixme */ +cvmx_bgxx_gmp_pcs_miscx_ctl_t gmp_misc_ctl; +cvmx_bgxx_gmp_pcs_linkx_timer_t gmp_timer; + +if (!cvmx_helper_is_port_valid (xi.interface, index)) +return 0 ; + +if (debug) +debug ("%s: interface %u:%d/%d\n" , __func__, xi.node, + xi.interface, index); + +/* +* Write PCS*_LINK*_TIMER_COUNT_REG[COUNT] with the +* appropriate value. 1000BASE-X specifies a 10ms +* interval. SGMII specifies a 1.6ms interval. +*/ + gmp_misc_ctl.u64 =csr_rd_node ( + node,CVMX_BGXX_GMP_PCS_MISCX_CTL (index, xi.interface)); +/* Adjust the MAC mode if requested by device tree */ + gmp_misc_ctl.s.mac_phy =cvmx_helper_get_mac_phy_mode (xiface, index); + gmp_misc_ctl.s.mode =cvmx_helper_get_1000x_mode (xiface, index); +csr_wr_node (node,CVMX_BGXX_GMP_PCS_MISCX_CTL (index, xi.interface), + gmp_misc_ctl.u64); + + gmp_timer.u64 =csr_rd_node ( + node,CVMX_BGXX_GMP_PCS_LINKX_TIMER (index, xi.interface)); +if (gmp_misc_ctl.s.mode) +/* 1000BASE-X */ + gmp_timer.s.count = (10000ull * clock_mhz) >>10 ; +else +/* SGMII */ + gmp_timer.s.count = (1600ull * clock_mhz) >>10 ; + +csr_wr_node (node,CVMX_BGXX_GMP_PCS_LINKX_TIMER (index, xi.interface), + gmp_timer.u64); + +/* +* Write the advertisement register to be used as the +* tx_Config_Reg<D15:D0> of the autonegotiation. In +* 1000BASE-X mode, tx_Config_Reg<D15:D0> is PCS*_AN*_ADV_REG. +* In SGMII PHY mode, tx_Config_Reg<D15:D0> is +* PCS*_SGM*_AN_ADV_REG. In SGMII MAC mode, +* tx_Config_Reg<D15:D0> is the fixed value 0x4001, so this +* step can be skipped. +*/ +if (gmp_misc_ctl.s.mode) { +/* 1000BASE-X */ +cvmx_bgxx_gmp_pcs_anx_adv_t gmp_an_adv; + + gmp_an_adv.u64 =csr_rd_node ( + node,CVMX_BGXX_GMP_PCS_ANX_ADV (index, xi.interface)); + gmp_an_adv.s.rem_flt =0 ; + gmp_an_adv.s.pause =3 ; + gmp_an_adv.s.hfd =1 ; + gmp_an_adv.s.fd =1 ; +csr_wr_node (node, +CVMX_BGXX_GMP_PCS_ANX_ADV (index, xi.interface), + gmp_an_adv.u64); + }else { +if (gmp_misc_ctl.s.mac_phy) { +/* PHY Mode */ +cvmx_bgxx_gmp_pcs_sgmx_an_adv_t gmp_sgmx_an_adv; + + gmp_sgmx_an_adv.u64 = +csr_rd_node (node,CVMX_BGXX_GMP_PCS_SGMX_AN_ADV ( + index, xi.interface)); + gmp_sgmx_an_adv.s.dup =1 ; + gmp_sgmx_an_adv.s.speed =2 ; +csr_wr_node (node, +CVMX_BGXX_GMP_PCS_SGMX_AN_ADV (index, + xi.interface), + gmp_sgmx_an_adv.u64); + }else { +/* MAC Mode - Nothing to do */ + } + } +return 0 ; +} + +/** +* @INTERNAL +* Bring up the SGMII interface to be ready for packet I/O but +* leave I/O disabled using the GMX override. This function +* follows the bringup documented in 10.6.3 of the manual. +* +* @param xiface Interface to bringup +* @param num_ports Number of ports on the interface +* +* @return Zero on success, negative on failure +*/ +static int __cvmx_helper_bgx_sgmii_hardware_init (int xiface,int num_ports) +{ +int index; +int do_link_set =1 ; + +for (index =0 ; index < num_ports; index++) { +int xipd_port =cvmx_helper_get_ipd_port (xiface, index); +cvmx_helper_interface_mode_t mode; + +if (!cvmx_helper_is_port_valid (xiface, index)) +continue ; + +__cvmx_helper_bgx_port_init (xipd_port,0 ); + + mode =cvmx_helper_bgx_get_mode (xiface, index); +if (mode ==CVMX_HELPER_INTERFACE_MODE_RGMII ) +continue ; + +if (do_link_set) +__cvmx_helper_bgx_sgmii_link_set ( + xipd_port, +__cvmx_helper_bgx_sgmii_link_get (xipd_port)); + } + +return 0 ; +} + +/** +* @INTERNAL +* Bringup and enable a SGMII interface. After this call packet +* I/O should be fully functional. This is called with IPD +* enabled but PKO disabled. This is used by interfaces using +* the bgx mac. +* +* @param xiface Interface to bring up +* +* @return Zero on success, negative on failure +*/ +int __cvmx_helper_bgx_sgmii_enable (int xiface) +{ +int num_ports; + + num_ports =cvmx_helper_ports_on_interface (xiface); +__cvmx_helper_bgx_sgmii_hardware_init (xiface, num_ports); + +return 0 ; +} + +/** +* @INTERNAL +* Initialize the SERDES link for the first time or after a loss +* of link. +* +* @param xiface Interface to init +* @param index Index of prot on the interface +* +* @return Zero on success, negative on failure +*/ +static int __cvmx_helper_bgx_sgmii_hardware_init_link (int xiface,int index) +{ +cvmx_bgxx_gmp_pcs_mrx_control_t gmp_control; +cvmx_bgxx_gmp_pcs_miscx_ctl_t gmp_misc_ctl; +cvmx_bgxx_cmrx_config_t cmr_config; +int phy_mode, mode_1000x; +struct cvmx_xiface xi =cvmx_helper_xiface_to_node_interface (xiface); +int interface = xi.interface; +int node = xi.node; +int autoneg =0 ; + +if (!cvmx_helper_is_port_valid (xiface, index)) +return 0 ; + +if (debug) +debug ("%s: interface %u:%d/%d\n" , __func__, xi.node, + xi.interface, index); + + gmp_control.u64 =csr_rd_node ( + node,CVMX_BGXX_GMP_PCS_MRX_CONTROL (index, xi.interface)); +/* Take PCS through a reset sequence */ + gmp_control.s.reset =1 ; +csr_wr_node (node,CVMX_BGXX_GMP_PCS_MRX_CONTROL (index, xi.interface), + gmp_control.u64); + +/* Wait until GMP_PCS_MRX_CONTROL[reset] comes out of reset */ +if (CVMX_WAIT_FOR_FIELD64_NODE ( + node,CVMX_BGXX_GMP_PCS_MRX_CONTROL (index, xi.interface), + cvmx_bgxx_gmp_pcs_mrx_control_t, reset, ==, 0, 10000)) { +debug ("SGMII%d: Timeout waiting for port %d to finish reset\n" , + interface, index); +return -1 ; + } + + cmr_config.u64 = +csr_rd_node (node,CVMX_BGXX_CMRX_CONFIG (index, xi.interface)); + + gmp_control.u64 =csr_rd_node ( + node,CVMX_BGXX_GMP_PCS_MRX_CONTROL (index, xi.interface)); +if (cvmx_helper_get_port_phy_present (xiface, index)) { + gmp_control.s.pwr_dn =0 ; + }else { + gmp_control.s.spdmsb =1 ; + gmp_control.s.spdlsb =0 ; + gmp_control.s.pwr_dn =0 ; + } +/* Write GMP_PCS_MR*_CONTROL[RST_AN]=1 to ensure a fresh SGMII +* negotiation starts. +*/ + autoneg =cvmx_helper_get_port_autonegotiation (xiface, index); + gmp_control.s.rst_an =1 ; + gmp_control.s.an_en = (cmr_config.s.lmac_type !=5 ) && autoneg; +csr_wr_node (node,CVMX_BGXX_GMP_PCS_MRX_CONTROL (index, xi.interface), + gmp_control.u64); + + phy_mode =cvmx_helper_get_mac_phy_mode (xiface, index); + mode_1000x =cvmx_helper_get_1000x_mode (xiface, index); + + gmp_misc_ctl.u64 =csr_rd_node ( + node,CVMX_BGXX_GMP_PCS_MISCX_CTL (index, xi.interface)); + gmp_misc_ctl.s.mac_phy = phy_mode; + gmp_misc_ctl.s.mode = mode_1000x; +csr_wr_node (node,CVMX_BGXX_GMP_PCS_MISCX_CTL (index, xi.interface), + gmp_misc_ctl.u64); + +if (phy_mode || !autoneg) +/* In PHY mode we can't query the link status so we just +* assume that the link is up +*/ +return 0 ; + +/* Wait for GMP_PCS_MRX_CONTROL[an_cpt] to be set, indicating that +* SGMII autonegotiation is complete. In MAC mode this isn't an +* ethernet link, but a link between OCTEON and PHY. +*/ +if (cmr_config.s.lmac_type !=5 && +CVMX_WAIT_FOR_FIELD64_NODE ( + node,CVMX_BGXX_GMP_PCS_MRX_STATUS (index, xi.interface), + cvmx_bgxx_gmp_pcs_mrx_status_t, an_cpt, ==, 1, 10000)) { +debug ("SGMII%d: Port %d link timeout\n" , interface, index); +return -1 ; + } + +return 0 ; +} + +/** +* @INTERNAL +* Configure an SGMII link to the specified speed after the SERDES +* link is up. +* +* @param xiface Interface to init +* @param index Index of prot on the interface +* @param link_info Link state to configure +* +* @return Zero on success, negative on failure +*/ +static int __cvmx_helper_bgx_sgmii_hardware_init_link_speed ( +int xiface,int index,cvmx_helper_link_info_t link_info) +{ +cvmx_bgxx_cmrx_config_t cmr_config; +cvmx_bgxx_gmp_pcs_miscx_ctl_t gmp_miscx_ctl; +cvmx_bgxx_gmp_gmi_prtx_cfg_t gmp_prtx_cfg; +struct cvmx_xiface xi =cvmx_helper_xiface_to_node_interface (xiface); +int node = xi.node; + +if (!cvmx_helper_is_port_valid (xiface, index)) +return 0 ; + +if (debug) +debug ("%s: interface %u:%d/%d\n" , __func__, xi.node, + xi.interface, index); + +/* Disable GMX before we make any changes. */ + cmr_config.u64 = +csr_rd_node (node,CVMX_BGXX_CMRX_CONFIG (index, xi.interface)); + cmr_config.s.data_pkt_tx_en =0 ; + cmr_config.s.data_pkt_rx_en =0 ; +csr_wr_node (node,CVMX_BGXX_CMRX_CONFIG (index, xi.interface), + cmr_config.u64); + +/* Wait for GMX to be idle */ +if (CVMX_WAIT_FOR_FIELD64_NODE ( + node,CVMX_BGXX_GMP_GMI_PRTX_CFG (index, xi.interface), + cvmx_bgxx_gmp_gmi_prtx_cfg_t, rx_idle, ==, 1, 10000) || +CVMX_WAIT_FOR_FIELD64_NODE ( + node,CVMX_BGXX_GMP_GMI_PRTX_CFG (index, xi.interface), + cvmx_bgxx_gmp_gmi_prtx_cfg_t, tx_idle, ==, 1, 10000)) { +debug ("SGMII%d:%d: Timeout waiting for port %d to be idle\n" , + node, xi.interface, index); +return -1 ; + } + +/* Read GMX CFG again to make sure the disable completed */ + gmp_prtx_cfg.u64 =csr_rd_node ( + node,CVMX_BGXX_GMP_GMI_PRTX_CFG (index, xi.interface)); + +/* +* Get the misc control for PCS. We will need to set the +* duplication amount. +*/ + gmp_miscx_ctl.u64 =csr_rd_node ( + node,CVMX_BGXX_GMP_PCS_MISCX_CTL (index, xi.interface)); + +/* +* Use GMXENO to force the link down if the status we get says +* it should be down. +*/ + gmp_miscx_ctl.s.gmxeno = !link_info.s.link_up; + +/* Only change the duplex setting if the link is up */ +if (link_info.s.link_up) + gmp_prtx_cfg.s.duplex = link_info.s.full_duplex; + +/* Do speed based setting for GMX */ +switch (link_info.s.speed) { +case 10 : + gmp_prtx_cfg.s.speed =0 ; + gmp_prtx_cfg.s.speed_msb =1 ; + gmp_prtx_cfg.s.slottime =0 ; +/* Setting from GMX-603 */ + gmp_miscx_ctl.s.samp_pt =25 ; +csr_wr_node (node, +CVMX_BGXX_GMP_GMI_TXX_SLOT (index, xi.interface), +64 ); +csr_wr_node (node, +CVMX_BGXX_GMP_GMI_TXX_BURST (index, xi.interface), +0 ); +break ; +case 100 : + gmp_prtx_cfg.s.speed =0 ; + gmp_prtx_cfg.s.speed_msb =0 ; + gmp_prtx_cfg.s.slottime =0 ; + gmp_miscx_ctl.s.samp_pt =0x5 ; +csr_wr_node (node, +CVMX_BGXX_GMP_GMI_TXX_SLOT (index, xi.interface), +64 ); +csr_wr_node (node, +CVMX_BGXX_GMP_GMI_TXX_BURST (index, xi.interface), +0 ); +break ; +case 1000 : + gmp_prtx_cfg.s.speed =1 ; + gmp_prtx_cfg.s.speed_msb =0 ; + gmp_prtx_cfg.s.slottime =1 ; + gmp_miscx_ctl.s.samp_pt =1 ; +csr_wr_node (node, +CVMX_BGXX_GMP_GMI_TXX_SLOT (index, xi.interface), +512 ); +if (gmp_prtx_cfg.s.duplex) +/* full duplex */ +csr_wr_node (node, +CVMX_BGXX_GMP_GMI_TXX_BURST (index, + xi.interface), +0 ); +else +/* half duplex */ +csr_wr_node (node, +CVMX_BGXX_GMP_GMI_TXX_BURST (index, + xi.interface), +8192 ); +break ; +default : +break ; + } + +/* Write the new misc control for PCS */ +csr_wr_node (node,CVMX_BGXX_GMP_PCS_MISCX_CTL (index, xi.interface), + gmp_miscx_ctl.u64); + +/* Write the new GMX settings with the port still disabled */ +csr_wr_node (node,CVMX_BGXX_GMP_GMI_PRTX_CFG (index, xi.interface), + gmp_prtx_cfg.u64); + +/* Read GMX CFG again to make sure the config completed */ +csr_rd_node (node,CVMX_BGXX_GMP_GMI_PRTX_CFG (index, xi.interface)); + +/* Enable back BGX. */ + cmr_config.u64 = +csr_rd_node (node,CVMX_BGXX_CMRX_CONFIG (index, xi.interface)); +if (debug) +debug ("%s: Enabling tx and rx packets on %d:%d\n" , __func__, + xi.interface, index); + cmr_config.s.data_pkt_tx_en =1 ; + cmr_config.s.data_pkt_rx_en =1 ; +csr_wr_node (node,CVMX_BGXX_CMRX_CONFIG (index, xi.interface), + cmr_config.u64); + +return 0 ; +} + +/** +* Enables or disables forward error correction +* +* @param xiface interface +* @param index port index +* @param enable set to true to enable FEC, false to disable +* +* @return 0 for success, -1 on error +* +* @NOTE: If autonegotiation is enabled then autonegotiation will be +* restarted for negotiating FEC. +*/ +int cvmx_helper_set_fec (int xiface,int index,bool enable) +{ +cvmx_bgxx_spux_fec_control_t spu_fec_control; +struct cvmx_xiface xi =cvmx_helper_xiface_to_node_interface (xiface); +int interface = xi.interface; +int node = xi.node; +cvmx_helper_interface_mode_t mode; + +if (debug) +debug ("%s: interface: %u:%d/%d: %sable\n" , __func__, interface, + node, index, enable ?"en" :"dis" ); + + mode =cvmx_helper_bgx_get_mode (xiface, index); + +/* FEC is only supported for KR mode and XLAUI*/ +if (mode !=CVMX_HELPER_INTERFACE_MODE_10G_KR && + mode !=CVMX_HELPER_INTERFACE_MODE_40G_KR4 && + mode !=CVMX_HELPER_INTERFACE_MODE_XLAUI && + mode !=CVMX_HELPER_INTERFACE_MODE_XFI ) +return 0 ; + + spu_fec_control.u64 = +csr_rd_node (node,CVMX_BGXX_SPUX_FEC_CONTROL (index, interface)); + + spu_fec_control.s.fec_en = enable; +csr_wr_node (node,CVMX_BGXX_SPUX_FEC_CONTROL (index, interface), + spu_fec_control.u64); + +cvmx_helper_set_port_fec (xiface, index, enable); + +if (cvmx_helper_get_port_autonegotiation (xiface, index)) +return cvmx_helper_set_autonegotiation (xiface, index, true); +else +return 0 ; +} + +/** +* Enables or disables autonegotiation for an interface. +* +* @param xiface interface to set autonegotiation +* @param index port index +* @param enable true to enable autonegotiation, false to disable it +* +* @return 0 for success, -1 on error. +*/ +int cvmx_helper_set_autonegotiation (int xiface,int index,bool enable) +{ +union cvmx_bgxx_gmp_pcs_mrx_control gmp_control; +union cvmx_bgxx_spux_an_control spu_an_control; +union cvmx_bgxx_spux_an_adv spu_an_adv; +union cvmx_bgxx_spux_fec_control spu_fec_control; +struct cvmx_xiface xi =cvmx_helper_xiface_to_node_interface (xiface); +int interface = xi.interface; +int node = xi.node; +cvmx_helper_interface_mode_t mode; + +if (debug) +debug ("%s: interface: %u:%d/%d: %sable\n" , __func__, interface, + node, index, enable ?"en" :"dis" ); + + mode =cvmx_helper_bgx_get_mode (xiface, index); + +switch (mode) { +case CVMX_HELPER_INTERFACE_MODE_RGMII : + enable = false; +case CVMX_HELPER_INTERFACE_MODE_SGMII : + gmp_control.u64 =csr_rd_node ( + node,CVMX_BGXX_GMP_PCS_MRX_CONTROL (index, interface)); + gmp_control.s.an_en = enable; + gmp_control.s.rst_an = enable; +csr_wr_node (node, +CVMX_BGXX_GMP_PCS_MRX_CONTROL (index, interface), + gmp_control.u64); +if (enable && +CVMX_WAIT_FOR_FIELD64_NODE ( + node, +CVMX_BGXX_GMP_PCS_MRX_STATUS (index, interface), + cvmx_bgxx_gmp_pcs_mrx_status_t, an_cpt, ==, 1, +10000 )) { +debug ("SGMII%d: Port %d link timeout\n" , interface, + index); +return -1 ; + } +break ; +case CVMX_HELPER_INTERFACE_MODE_XAUI : +case CVMX_HELPER_INTERFACE_MODE_XFI : +case CVMX_HELPER_INTERFACE_MODE_10G_KR : +case CVMX_HELPER_INTERFACE_MODE_XLAUI : +case CVMX_HELPER_INTERFACE_MODE_40G_KR4 : + spu_an_adv.u64 =csr_rd_node ( + node,CVMX_BGXX_SPUX_AN_ADV (index, interface)); + spu_fec_control.u64 =csr_rd_node ( + node,CVMX_BGXX_SPUX_FEC_CONTROL (index, interface)); + spu_an_adv.s.fec_req = spu_fec_control.s.fec_en; + spu_an_adv.s.fec_able =1 ; + spu_an_adv.s.a100g_cr10 =0 ; + spu_an_adv.s.a40g_cr4 =0 ; + spu_an_adv.s.a40g_kr4 = + (mode ==CVMX_HELPER_INTERFACE_MODE_40G_KR4 ); + spu_an_adv.s.a10g_kr = + (mode ==CVMX_HELPER_INTERFACE_MODE_10G_KR ); + spu_an_adv.s.a10g_kx4 =0 ; + spu_an_adv.s.a1g_kx =0 ; + spu_an_adv.s.xnp_able =0 ; + spu_an_adv.s.rf =0 ; +csr_wr_node (node,CVMX_BGXX_SPUX_AN_ADV (index, interface), + spu_an_adv.u64); + spu_fec_control.u64 =csr_rd_node ( + node,CVMX_BGXX_SPUX_FEC_CONTROL (index, interface)); + spu_an_control.u64 =csr_rd_node ( + node,CVMX_BGXX_SPUX_AN_CONTROL (index, interface)); + spu_an_control.s.an_en = enable; + spu_an_control.s.xnp_en =0 ; + spu_an_control.s.an_restart = enable; +csr_wr_node (node,CVMX_BGXX_SPUX_AN_CONTROL (index, interface), + spu_an_control.u64); + +if (enable && +CVMX_WAIT_FOR_FIELD64_NODE ( + node,CVMX_BGXX_SPUX_AN_STATUS (index, interface), + cvmx_bgxx_spux_an_status_t, an_complete, ==, 1, +10000 )) { +debug ("XAUI/XLAUI/XFI%d: Port %d link timeout\n" , + interface, index); +return -1 ; + } +break ; +default : +break ; + } + +cvmx_helper_set_port_autonegotiation (xiface, index, enable); + +return 0 ; +} + +/** +* @INTERNAL +* Return the link state of an IPD/PKO port as returned by +* auto negotiation. The result of this function may not match +* Octeon's link config if auto negotiation has changed since +* the last call to cvmx_helper_link_set(). This is used by +* interfaces using the bgx mac. +* +* @param xipd_port IPD/PKO port to query +* +* @return Link state +*/ +cvmx_helper_link_info_t __cvmx_helper_bgx_sgmii_link_get (int xipd_port) +{ +cvmx_helper_link_info_t result; +cvmx_bgxx_gmp_pcs_mrx_control_t gmp_control; +cvmx_bgxx_gmp_pcs_miscx_ctl_t gmp_misc_ctl; +int xiface =cvmx_helper_get_interface_num (xipd_port); +struct cvmx_xiface xi =cvmx_helper_xiface_to_node_interface (xiface); +struct cvmx_xport xp =cvmx_helper_ipd_port_to_xport (xipd_port); +int node = xi.node; +int index =cvmx_helper_get_interface_index_num (xp.port); + + result.u64 =0 ; + +if (!cvmx_helper_is_port_valid (xiface, index)) +return result; + +if (debug) +debug ("%s: interface %u:%d/%d\n" , __func__, xi.node, + xi.interface, index); + + gmp_control.u64 =csr_rd_node ( + node,CVMX_BGXX_GMP_PCS_MRX_CONTROL (index, xi.interface)); +if (gmp_control.s.loopbck1) { +int qlm =cvmx_qlm_lmac (xiface, index); +int speed; + +if (OCTEON_IS_MODEL (OCTEON_CN78XX )) + speed =cvmx_qlm_get_gbaud_mhz_node (node, qlm); +else + speed =cvmx_qlm_get_gbaud_mhz (qlm); +/* Force 1Gbps full duplex link for internal loopback */ + result.s.link_up =1 ; + result.s.full_duplex =1 ; + result.s.speed = speed *8 /10 ; +return result; + } + + gmp_misc_ctl.u64 =csr_rd_node ( + node,CVMX_BGXX_GMP_PCS_MISCX_CTL (index, xi.interface)); +if (gmp_misc_ctl.s.mac_phy || +cvmx_helper_get_port_force_link_up (xiface, index)) { +int qlm =cvmx_qlm_lmac (xiface, index); +int speed; + +if (OCTEON_IS_MODEL (OCTEON_CN78XX )) + speed =cvmx_qlm_get_gbaud_mhz_node (node, qlm); +else + speed =cvmx_qlm_get_gbaud_mhz (qlm); +/* PHY Mode */ +/* Note that this also works for 1000base-X mode */ + + result.s.speed = speed *8 /10 ; + result.s.full_duplex =1 ; + result.s.link_up =1 ; +return result; + } + +/* MAC Mode */ +return __cvmx_helper_board_link_get (xipd_port); +} + +/** +* This sequence brings down the link for the XCV RGMII interface +* +* @param interface Interface (BGX) number. Port index is always 0 +*/ +static void __cvmx_helper_bgx_rgmii_link_set_down (int interface) +{ +union cvmx_xcv_reset xcv_reset; +union cvmx_bgxx_cmrx_config cmr_config; +union cvmx_bgxx_gmp_pcs_mrx_control mr_control; +union cvmx_bgxx_cmrx_rx_fifo_len rx_fifo_len; +union cvmx_bgxx_cmrx_tx_fifo_len tx_fifo_len; + + xcv_reset.u64 =csr_rd (CVMX_XCV_RESET ); + xcv_reset.s.rx_pkt_rst_n =0 ; +csr_wr (CVMX_XCV_RESET , xcv_reset.u64); +csr_rd (CVMX_XCV_RESET ); +mdelay (10 );/* Wait for 1 MTU */ + + cmr_config.u64 =csr_rd (CVMX_BGXX_CMRX_CONFIG (0 , interface)); + cmr_config.s.data_pkt_rx_en =0 ; +csr_wr (CVMX_BGXX_CMRX_CONFIG (0 , interface), cmr_config.u64); + +/* Wait for RX and TX to be idle */ +do { + rx_fifo_len.u64 = +csr_rd (CVMX_BGXX_CMRX_RX_FIFO_LEN (0 , interface)); + tx_fifo_len.u64 = +csr_rd (CVMX_BGXX_CMRX_TX_FIFO_LEN (0 , interface)); + }while (rx_fifo_len.s.fifo_len >0 && tx_fifo_len.s.lmac_idle !=1 ); + + cmr_config.u64 =csr_rd (CVMX_BGXX_CMRX_CONFIG (0 , interface)); + cmr_config.s.data_pkt_tx_en =0 ; +csr_wr (CVMX_BGXX_CMRX_CONFIG (0 , interface), cmr_config.u64); + + xcv_reset.u64 =csr_rd (CVMX_XCV_RESET ); + xcv_reset.s.tx_pkt_rst_n =0 ; +csr_wr (CVMX_XCV_RESET , xcv_reset.u64); + mr_control.u64 =csr_rd (CVMX_BGXX_GMP_PCS_MRX_CONTROL (0 , interface)); + mr_control.s.pwr_dn =1 ; +csr_wr (CVMX_BGXX_GMP_PCS_MRX_CONTROL (0 , interface), mr_control.u64); +} + +/** +* Sets a BGS SGMII link down. +* +* @param node Octeon node number +* @param iface BGX interface number +* @param index BGX port index +*/ +static void __cvmx_helper_bgx_sgmii_link_set_down (int node,int iface, +int index) +{ +union cvmx_bgxx_gmp_pcs_miscx_ctl gmp_misc_ctl; +union cvmx_bgxx_gmp_pcs_mrx_control gmp_control; +union cvmx_bgxx_cmrx_config cmr_config; + + cmr_config.u64 =csr_rd_node (node,CVMX_BGXX_CMRX_CONFIG (index, iface)); + cmr_config.s.data_pkt_tx_en =0 ; + cmr_config.s.data_pkt_rx_en =0 ; +csr_wr_node (node,CVMX_BGXX_CMRX_CONFIG (index, iface), cmr_config.u64); + + gmp_misc_ctl.u64 = +csr_rd_node (node,CVMX_BGXX_GMP_PCS_MISCX_CTL (index, iface)); + +/* Disable autonegotiation only when in MAC mode. */ +if (gmp_misc_ctl.s.mac_phy ==0 ) { + gmp_control.u64 =csr_rd_node ( + node,CVMX_BGXX_GMP_PCS_MRX_CONTROL (index, iface)); + gmp_control.s.an_en =0 ; +csr_wr_node (node,CVMX_BGXX_GMP_PCS_MRX_CONTROL (index, iface), + gmp_control.u64); + } + +/* Use GMXENO to force the link down. It will get reenabled later... */ + gmp_misc_ctl.s.gmxeno =1 ; +csr_wr_node (node,CVMX_BGXX_GMP_PCS_MISCX_CTL (index, iface), + gmp_misc_ctl.u64); +csr_rd_node (node,CVMX_BGXX_GMP_PCS_MISCX_CTL (index, iface)); +} + +/** +* @INTERNAL +* Configure an IPD/PKO port for the specified link state. This +* function does not influence auto negotiation at the PHY level. +* The passed link state must always match the link state returned +* by cvmx_helper_link_get(). It is normally best to use +* cvmx_helper_link_autoconf() instead. This is used by interfaces +* using the bgx mac. +* +* @param xipd_port IPD/PKO port to configure +* @param link_info The new link state +* +* @return Zero on success, negative on failure +*/ +int __cvmx_helper_bgx_sgmii_link_set (int xipd_port, +cvmx_helper_link_info_t link_info) +{ +cvmx_bgxx_cmrx_config_t cmr_config; +int xiface =cvmx_helper_get_interface_num (xipd_port); +struct cvmx_xiface xi =cvmx_helper_xiface_to_node_interface (xiface); +struct cvmx_xport xp =cvmx_helper_ipd_port_to_xport (xipd_port); +int node = xi.node; +int index =cvmx_helper_get_interface_index_num (xp.port); +const int iface = xi.interface; +int rc =0 ; + +if (!cvmx_helper_is_port_valid (xiface, index)) +return 0 ; + +if (debug) +debug ("%s: interface %u:%d/%d\n" , __func__, xi.node, + xi.interface, index); + + cmr_config.u64 =csr_rd_node (node,CVMX_BGXX_CMRX_CONFIG (index, iface)); +if (link_info.s.link_up) { + cmr_config.s.enable =1 ; +csr_wr_node (node,CVMX_BGXX_CMRX_CONFIG (index, iface), + cmr_config.u64); +/* Apply workaround for errata BGX-22429 */ +if (OCTEON_IS_MODEL (OCTEON_CN78XX_PASS1_X ) && index) { +cvmx_bgxx_cmrx_config_t cmr0; + + cmr0.u64 =csr_rd_node (node, +CVMX_BGXX_CMRX_CONFIG (0 , iface)); + cmr0.s.enable =1 ; +csr_wr_node (node,CVMX_BGXX_CMRX_CONFIG (0 , iface), + cmr0.u64); + } +__cvmx_helper_bgx_sgmii_hardware_init_link (xiface, index); + }else if (cvmx_helper_bgx_is_rgmii (xi.interface, index)) { +if (debug) +debug ("%s: Bringing down XCV RGMII interface %d\n" , + __func__, xi.interface); +__cvmx_helper_bgx_rgmii_link_set_down (xi.interface); + }else {/* Link is down, not RGMII */ +__cvmx_helper_bgx_sgmii_link_set_down (node, iface, index); +return 0 ; + } + rc =__cvmx_helper_bgx_sgmii_hardware_init_link_speed (xiface, index, + link_info); +if (cvmx_helper_bgx_is_rgmii (xiface, index)) + rc =__cvmx_helper_bgx_rgmii_speed (link_info); + +return rc; +} + +/** +* @INTERNAL +* Bringup XAUI interface. After this call packet I/O should be +* fully functional. +* +* @param index port on interface to bring up +* @param xiface Interface to bring up +* +* @return Zero on success, negative on failure +*/ +static int __cvmx_helper_bgx_xaui_init (int index,int xiface) +{ +cvmx_bgxx_cmrx_config_t cmr_config; +cvmx_bgxx_spux_br_pmd_control_t pmd_control; +cvmx_bgxx_spux_misc_control_t spu_misc_control; +cvmx_bgxx_spux_control1_t spu_control1; +cvmx_bgxx_spux_an_control_t spu_an_control; +cvmx_bgxx_spux_an_adv_t spu_an_adv; +cvmx_bgxx_spux_fec_control_t spu_fec_control; +cvmx_bgxx_spu_dbg_control_t spu_dbg_control; +cvmx_bgxx_smux_tx_append_t smu_tx_append; +cvmx_bgxx_smux_tx_ctl_t smu_tx_ctl; +cvmx_helper_interface_mode_t mode; +struct cvmx_xiface xi =cvmx_helper_xiface_to_node_interface (xiface); +int interface = xi.interface; +int node = xi.node; +int use_auto_neg =0 ; +int kr_mode =0 ; + +if (debug) +debug ("%s: interface %u:%d/%d\n" , __func__, xi.node, + xi.interface, index); + + mode =cvmx_helper_bgx_get_mode (xiface, index); + +if (mode ==CVMX_HELPER_INTERFACE_MODE_10G_KR || + mode ==CVMX_HELPER_INTERFACE_MODE_40G_KR4 ) { + kr_mode =1 ; +if (cvmx_helper_bgx_override_autoneg) + use_auto_neg = +cvmx_helper_bgx_override_autoneg (xiface, index); +else + use_auto_neg =cvmx_helper_get_port_autonegotiation ( + xiface, index); + } + +/* NOTE: This code was moved first, out of order compared to the HRM +* because the RESET causes all SPU registers to loose their value +*/ +/* 4. Next, bring up the SMU/SPU and the BGX reconciliation layer +* logic: +*/ +/* 4a. Take SMU/SPU through a reset sequence. Write +* BGX(0..5)_SPU(0..3)_CONTROL1[RESET] = 1. Read +* BGX(0..5)_SPU(0..3)_CONTROL1[RESET] until it changes value to 0. Keep +* BGX(0..5)_SPU(0..3)_MISC_CONTROL[RX_PACKET_DIS] = 1 to disable +* reception. +*/ + spu_control1.u64 = +csr_rd_node (node,CVMX_BGXX_SPUX_CONTROL1 (index, xi.interface)); + spu_control1.s.reset =1 ; +csr_wr_node (node,CVMX_BGXX_SPUX_CONTROL1 (index, xi.interface), + spu_control1.u64); + +/* 1. Wait for PCS to come out of reset */ +if (CVMX_WAIT_FOR_FIELD64_NODE ( + node,CVMX_BGXX_SPUX_CONTROL1 (index, xi.interface), + cvmx_bgxx_spux_control1_t, reset, ==, 0, 10000)) { +debug ("BGX%d:%d: SPU stuck in reset\n" , node, interface); +return -1 ; + } + +/* 2. Write BGX(0..5)_CMR(0..3)_CONFIG[ENABLE] to 0, +* BGX(0..5)_SPU(0..3)_CONTROL1[LO_PWR] = 1 and +* BGX(0..5)_SPU(0..3)_MISC_CONTROL[RX_PACKET_DIS] = 1. +*/ + spu_control1.u64 = +csr_rd_node (node,CVMX_BGXX_SPUX_CONTROL1 (index, xi.interface)); + spu_control1.s.lo_pwr =1 ; +csr_wr_node (node,CVMX_BGXX_SPUX_CONTROL1 (index, xi.interface), + spu_control1.u64); + + spu_misc_control.u64 =csr_rd_node ( + node,CVMX_BGXX_SPUX_MISC_CONTROL (index, xi.interface)); + spu_misc_control.s.rx_packet_dis =1 ; +csr_wr_node (node,CVMX_BGXX_SPUX_MISC_CONTROL (index, xi.interface), + spu_misc_control.u64); + +/* 3. At this point, it may be appropriate to disable all BGX and +* SMU/SPU interrupts, as a number of them will occur during bring-up +* of the Link. +* - zero BGX(0..5)_SMU(0..3)_RX_INT +* - zero BGX(0..5)_SMU(0..3)_TX_INT +* - zero BGX(0..5)_SPU(0..3)_INT +*/ +csr_wr_node (node,CVMX_BGXX_SMUX_RX_INT (index, xi.interface), +csr_rd_node (node, +CVMX_BGXX_SMUX_RX_INT (index, xi.interface))); +csr_wr_node (node,CVMX_BGXX_SMUX_TX_INT (index, xi.interface), +csr_rd_node (node, +CVMX_BGXX_SMUX_TX_INT (index, xi.interface))); +csr_wr_node (node,CVMX_BGXX_SPUX_INT (index, xi.interface), +csr_rd_node (node,CVMX_BGXX_SPUX_INT (index, xi.interface))); + +/* 4. Configure the BGX LMAC. */ +/* 4a. Configure the LMAC type (40GBASE-R/10GBASE-R/RXAUI/XAUI) and +* SerDes selection in the BGX(0..5)_CMR(0..3)_CONFIG register, but keep +* the ENABLE, DATA_PKT_TX_EN and DATA_PKT_RX_EN bits clear. +*/ +/* Already done in bgx_setup_one_time */ + +/* 4b. Write BGX(0..5)_SPU(0..3)_CONTROL1[LO_PWR] = 1 and +* BGX(0..5)_SPU(0..3)_MISC_CONTROL[RX_PACKET_DIS] = 1. +*/ +/* 4b. Initialize the selected SerDes lane(s) in the QLM. See Section +* 28.1.2.2 in the GSER chapter. +*/ +/* Already done in QLM setup */ + +/* 4c. For 10GBASE-KR or 40GBASE-KR, enable link training by writing +* BGX(0..5)_SPU(0..3)_BR_PMD_CONTROL[TRAIN_EN] = 1. +*/ + +if (kr_mode && !OCTEON_IS_MODEL (OCTEON_CN78XX_PASS1_X )) { +csr_wr_node (node, +CVMX_BGXX_SPUX_BR_PMD_LP_CUP (index, interface),0 ); +csr_wr_node (node, +CVMX_BGXX_SPUX_BR_PMD_LD_CUP (index, interface),0 ); +csr_wr_node (node, +CVMX_BGXX_SPUX_BR_PMD_LD_REP (index, interface),0 ); + pmd_control.u64 =csr_rd_node ( + node,CVMX_BGXX_SPUX_BR_PMD_CONTROL (index, interface)); + pmd_control.s.train_en =1 ; +csr_wr_node (node, +CVMX_BGXX_SPUX_BR_PMD_CONTROL (index, interface), + pmd_control.u64); + } + +/* 4d. Program all other relevant BGX configuration while +* BGX(0..5)_CMR(0..3)_CONFIG[ENABLE] = 0. This includes all things +* described in this chapter. +*/ +/* Always add FCS to PAUSE frames */ + smu_tx_append.u64 =csr_rd_node ( + node,CVMX_BGXX_SMUX_TX_APPEND (index, xi.interface)); + smu_tx_append.s.fcs_c =1 ; +csr_wr_node (node,CVMX_BGXX_SMUX_TX_APPEND (index, xi.interface), + smu_tx_append.u64); + +/* 4e. If Forward Error Correction is desired for 10GBASE-R or +* 40GBASE-R, enable it by writing +* BGX(0..5)_SPU(0..3)_FEC_CONTROL[FEC_EN] = 1. +*/ +/* FEC is optional for 10GBASE-KR, 40GBASE-KR4, and XLAUI. We're going +* to disable it by default +*/ + spu_fec_control.u64 =csr_rd_node ( + node,CVMX_BGXX_SPUX_FEC_CONTROL (index, xi.interface)); +if (cvmx_helper_bgx_override_fec) + spu_fec_control.s.fec_en = +cvmx_helper_bgx_override_fec (xiface, index); +else + spu_fec_control.s.fec_en = +cvmx_helper_get_port_fec (xiface, index); +csr_wr_node (node,CVMX_BGXX_SPUX_FEC_CONTROL (index, xi.interface), + spu_fec_control.u64); + +/* 4f. If Auto-Negotiation is desired, configure and enable +* Auto-Negotiation as described in Section 33.6.2. +*/ + spu_an_control.u64 =csr_rd_node ( + node,CVMX_BGXX_SPUX_AN_CONTROL (index, xi.interface)); +/* Disable extended next pages */ + spu_an_control.s.xnp_en =0 ; + spu_an_control.s.an_en = use_auto_neg; +csr_wr_node (node,CVMX_BGXX_SPUX_AN_CONTROL (index, xi.interface), + spu_an_control.u64); + + spu_fec_control.u64 =csr_rd_node ( + node,CVMX_BGXX_SPUX_FEC_CONTROL (index, xi.interface)); + spu_an_adv.u64 = +csr_rd_node (node,CVMX_BGXX_SPUX_AN_ADV (index, xi.interface)); + spu_an_adv.s.fec_req = spu_fec_control.s.fec_en; + spu_an_adv.s.fec_able =1 ; + spu_an_adv.s.a100g_cr10 =0 ; + spu_an_adv.s.a40g_cr4 =0 ; + spu_an_adv.s.a40g_kr4 = (mode ==CVMX_HELPER_INTERFACE_MODE_40G_KR4 ); + spu_an_adv.s.a10g_kr = (mode ==CVMX_HELPER_INTERFACE_MODE_10G_KR ); + spu_an_adv.s.a10g_kx4 =0 ; + spu_an_adv.s.a1g_kx =0 ; + spu_an_adv.s.xnp_able =0 ; + spu_an_adv.s.rf =0 ; +csr_wr_node (node,CVMX_BGXX_SPUX_AN_ADV (index, xi.interface), + spu_an_adv.u64); + +/* 3. Set BGX(0..5)_SPU_DBG_CONTROL[AN_ARB_LINK_CHK_EN] = 1. */ + spu_dbg_control.u64 = +csr_rd_node (node,CVMX_BGXX_SPU_DBG_CONTROL (xi.interface)); + spu_dbg_control.s.an_nonce_match_dis =1 ;/* Needed for loopback */ + spu_dbg_control.s.an_arb_link_chk_en |= kr_mode; +csr_wr_node (node,CVMX_BGXX_SPU_DBG_CONTROL (xi.interface), + spu_dbg_control.u64); + +/* 4. Execute the link bring-up sequence in Section 33.6.3. */ + +/* 5. If the auto-negotiation protocol is successful, +* BGX(0..5)_SPU(0..3)_AN_ADV[AN_COMPLETE] is set along with +* BGX(0..5)_SPU(0..3)_INT[AN_COMPLETE] when the link is up. +*/ + +/* 3h. Set BGX(0..5)_CMR(0..3)_CONFIG[ENABLE] = 1 and +* BGX(0..5)_SPU(0..3)_CONTROL1[LO_PWR] = 0 to enable the LMAC. +*/ + cmr_config.u64 = +csr_rd_node (node,CVMX_BGXX_CMRX_CONFIG (index, xi.interface)); + cmr_config.s.enable =1 ; +csr_wr_node (node,CVMX_BGXX_CMRX_CONFIG (index, xi.interface), + cmr_config.u64); +/* Apply workaround for errata BGX-22429 */ +if (OCTEON_IS_MODEL (OCTEON_CN78XX_PASS1_X ) && index) { +cvmx_bgxx_cmrx_config_t cmr0; + + cmr0.u64 =csr_rd_node (node, +CVMX_BGXX_CMRX_CONFIG (0 , xi.interface)); + cmr0.s.enable =1 ; +csr_wr_node (node,CVMX_BGXX_CMRX_CONFIG (0 , xi.interface), + cmr0.u64); + } + + spu_control1.u64 = +csr_rd_node (node,CVMX_BGXX_SPUX_CONTROL1 (index, xi.interface)); + spu_control1.s.lo_pwr =0 ; +csr_wr_node (node,CVMX_BGXX_SPUX_CONTROL1 (index, xi.interface), + spu_control1.u64); + +/* 4g. Set the polarity and lane swapping of the QLM SerDes. Refer to +* Section 33.4.1, BGX(0..5)_SPU(0..3)_MISC_CONTROL[XOR_TXPLRT,XOR_RXPLRT] +* and BGX(0..5)_SPU(0..3)_MISC_CONTROL[TXPLRT,RXPLRT]. +*/ + +/* 4c. Write BGX(0..5)_SPU(0..3)_CONTROL1[LO_PWR] = 0. */ + spu_control1.u64 = +csr_rd_node (node,CVMX_BGXX_SPUX_CONTROL1 (index, xi.interface)); + spu_control1.s.lo_pwr =0 ; +csr_wr_node (node,CVMX_BGXX_SPUX_CONTROL1 (index, xi.interface), + spu_control1.u64); + +/* 4d. Select Deficit Idle Count mode and unidirectional enable/disable +* via BGX(0..5)_SMU(0..3)_TX_CTL[DIC_EN,UNI_EN]. +*/ + smu_tx_ctl.u64 = +csr_rd_node (node,CVMX_BGXX_SMUX_TX_CTL (index, xi.interface)); + smu_tx_ctl.s.dic_en =1 ; + smu_tx_ctl.s.uni_en =0 ; +csr_wr_node (node,CVMX_BGXX_SMUX_TX_CTL (index, xi.interface), + smu_tx_ctl.u64); + + { +/* Calculate the number of s-clk cycles per usec. */ +const u64 clock_mhz =1200 ;/* todo: fixme */ +cvmx_bgxx_spu_dbg_control_t dbg_control; + + dbg_control.u64 =csr_rd_node ( + node,CVMX_BGXX_SPU_DBG_CONTROL (xi.interface)); + dbg_control.s.us_clk_period = clock_mhz -1 ; +csr_wr_node (node,CVMX_BGXX_SPU_DBG_CONTROL (xi.interface), + dbg_control.u64); + } +/* The PHY often takes at least 100ms to stabilize */ +__cvmx_helper_bgx_interface_enable_delay (mode); +return 0 ; +} + +static void __cvmx_bgx_start_training (int node,int unit,int index) +{ +cvmx_bgxx_spux_int_t spu_int; +cvmx_bgxx_spux_br_pmd_control_t pmd_control; +cvmx_bgxx_spux_an_control_t an_control; + +/* Clear the training interrupts (W1C) */ + spu_int.u64 =0 ; + spu_int.s.training_failure =1 ; + spu_int.s.training_done =1 ; +csr_wr_node (node,CVMX_BGXX_SPUX_INT (index, unit), spu_int.u64); + +/* These registers aren't cleared when training is restarted. Manually +* clear them as per Errata BGX-20968. +*/ +csr_wr_node (node,CVMX_BGXX_SPUX_BR_PMD_LP_CUP (index, unit),0 ); +csr_wr_node (node,CVMX_BGXX_SPUX_BR_PMD_LD_CUP (index, unit),0 ); +csr_wr_node (node,CVMX_BGXX_SPUX_BR_PMD_LD_REP (index, unit),0 ); + +/* Disable autonegotiation */ + an_control.u64 = +csr_rd_node (node,CVMX_BGXX_SPUX_AN_CONTROL (index, unit)); + an_control.s.an_en =0 ; +csr_wr_node (node,CVMX_BGXX_SPUX_AN_CONTROL (index, unit), + an_control.u64); +udelay (1 ); + +/* Restart training */ + pmd_control.u64 = +csr_rd_node (node,CVMX_BGXX_SPUX_BR_PMD_CONTROL (index, unit)); + pmd_control.s.train_en =1 ; +csr_wr_node (node,CVMX_BGXX_SPUX_BR_PMD_CONTROL (index, unit), + pmd_control.u64); + +udelay (1 ); + pmd_control.u64 = +csr_rd_node (node,CVMX_BGXX_SPUX_BR_PMD_CONTROL (index, unit)); + pmd_control.s.train_restart =1 ; +csr_wr_node (node,CVMX_BGXX_SPUX_BR_PMD_CONTROL (index, unit), + pmd_control.u64); +} + +static void __cvmx_bgx_restart_training (int node,int unit,int index) +{ +cvmx_bgxx_spux_int_t spu_int; +cvmx_bgxx_spux_br_pmd_control_t pmd_control; + +/* Clear the training interrupts (W1C) */ + spu_int.u64 =0 ; + spu_int.s.training_failure =1 ; + spu_int.s.training_done =1 ; +csr_wr_node (node,CVMX_BGXX_SPUX_INT (index, unit), spu_int.u64); + +udelay (1700 );/* Wait 1.7 msec */ + +/* These registers aren't cleared when training is restarted. Manually +* clear them as per Errata BGX-20968. +*/ +csr_wr_node (node,CVMX_BGXX_SPUX_BR_PMD_LP_CUP (index, unit),0 ); +csr_wr_node (node,CVMX_BGXX_SPUX_BR_PMD_LD_CUP (index, unit),0 ); +csr_wr_node (node,CVMX_BGXX_SPUX_BR_PMD_LD_REP (index, unit),0 ); + +/* Restart training */ + pmd_control.u64 = +csr_rd_node (node,CVMX_BGXX_SPUX_BR_PMD_CONTROL (index, unit)); + pmd_control.s.train_restart =1 ; +csr_wr_node (node,CVMX_BGXX_SPUX_BR_PMD_CONTROL (index, unit), + pmd_control.u64); +} + +/* +* @INTERNAL +* Wrapper function to configure the BGX, does not enable. +* +* @param xipd_port IPD/PKO port to configure. +* @param phy_pres If set, enable disparity, only applies to RXAUI interface +* +* @return Zero on success, negative on failure. +*/ +int __cvmx_helper_bgx_port_init (int xipd_port,int phy_pres) +{ +int xiface =cvmx_helper_get_interface_num (xipd_port); +struct cvmx_xiface xi =cvmx_helper_xiface_to_node_interface (xiface); +struct cvmx_xport xp =cvmx_helper_ipd_port_to_xport (xipd_port); +int index =cvmx_helper_get_interface_index_num (xp.port); +cvmx_helper_interface_mode_t mode; + +if (debug) +debug ("%s: interface %u:%d/%d\n" , __func__, xi.node, + xi.interface, index); + + mode =cvmx_helper_bgx_get_mode (xiface, index); + +__cvmx_bgx_common_init_pknd (xiface, index); + +if (mode ==CVMX_HELPER_INTERFACE_MODE_SGMII || + mode ==CVMX_HELPER_INTERFACE_MODE_RGMII ) { +cvmx_bgxx_gmp_gmi_txx_thresh_t gmi_tx_thresh; +cvmx_bgxx_gmp_gmi_txx_append_t gmp_txx_append; +cvmx_bgxx_gmp_gmi_txx_sgmii_ctl_t gmp_sgmii_ctl; + +/* Set TX Threshold */ + gmi_tx_thresh.u64 =0 ; + gmi_tx_thresh.s.cnt =0x20 ; +csr_wr_node (xi.node, +CVMX_BGXX_GMP_GMI_TXX_THRESH (index, xi.interface), + gmi_tx_thresh.u64); +__cvmx_helper_bgx_sgmii_hardware_init_one_time (xiface, index); + gmp_txx_append.u64 =csr_rd_node ( + xi.node, +CVMX_BGXX_GMP_GMI_TXX_APPEND (index, xi.interface)); + gmp_sgmii_ctl.u64 =csr_rd_node ( + xi.node, +CVMX_BGXX_GMP_GMI_TXX_SGMII_CTL (index, xi.interface)); + gmp_sgmii_ctl.s.align = gmp_txx_append.s.preamble ?0 :1 ; +csr_wr_node (xi.node, +CVMX_BGXX_GMP_GMI_TXX_SGMII_CTL (index, + xi.interface), + gmp_sgmii_ctl.u64); +if (mode ==CVMX_HELPER_INTERFACE_MODE_RGMII ) { +/* Disable XCV interface when initialized */ +union cvmx_xcv_reset xcv_reset; + +if (debug) +debug ("%s: Disabling RGMII XCV interface\n" , + __func__); + xcv_reset.u64 =csr_rd (CVMX_XCV_RESET ); + xcv_reset.s.enable =0 ; + xcv_reset.s.tx_pkt_rst_n =0 ; + xcv_reset.s.rx_pkt_rst_n =0 ; +csr_wr (CVMX_XCV_RESET , xcv_reset.u64); + } + }else { +int res, cred; +cvmx_bgxx_smux_tx_thresh_t smu_tx_thresh; + + res =__cvmx_helper_bgx_xaui_init (index, xiface); +if (res ==-1 ) { +#ifdef DEBUG_BGX +debug ("Failed to enable XAUI for %d:BGX(%d,%d)\n" , + xi.node, xi.interface, index); +#endif +return res; + } +/* See BVX_SMU_TX_THRESH register descriptin */ + cred =__cvmx_helper_bgx_fifo_size (xiface, index) >>4 ; + smu_tx_thresh.u64 =0 ; + smu_tx_thresh.s.cnt = cred -10 ; +csr_wr_node (xi.node, +CVMX_BGXX_SMUX_TX_THRESH (index, xi.interface), + smu_tx_thresh.u64); +if (debug) +debug ("%s: BGX%d:%d TX-thresh=%d\n" , __func__, + xi.interface, index, + (unsigned int )smu_tx_thresh.s.cnt); + +/* Set disparity for RXAUI interface as described in the +* Marvell RXAUI Interface specification. +*/ +if (mode ==CVMX_HELPER_INTERFACE_MODE_RXAUI && phy_pres) { +cvmx_bgxx_spux_misc_control_t misc_control; + + misc_control.u64 =csr_rd_node ( + xi.node,CVMX_BGXX_SPUX_MISC_CONTROL ( + index, xi.interface)); + misc_control.s.intlv_rdisp =1 ; +csr_wr_node (xi.node, +CVMX_BGXX_SPUX_MISC_CONTROL (index, + xi.interface), + misc_control.u64); + } + } +return 0 ; +} + +/** +* @INTERNAL +* Configure a port for internal and/or external loopback. Internal loopback +* causes packets sent by the port to be received by Octeon. External loopback +* causes packets received from the wire to sent out again. This is used by +* interfaces using the bgx mac. +* +* @param xipd_port IPD/PKO port to loopback. +* @param enable_internal +* Non zero if you want internal loopback +* @param enable_external +* Non zero if you want external loopback +* +* @return Zero on success, negative on failure. +*/ +int __cvmx_helper_bgx_sgmii_configure_loopback (int xipd_port, +int enable_internal, +int enable_external) +{ +int xiface =cvmx_helper_get_interface_num (xipd_port); +struct cvmx_xiface xi =cvmx_helper_xiface_to_node_interface (xiface); +struct cvmx_xport xp =cvmx_helper_ipd_port_to_xport (xipd_port); +int node = xi.node; +int index =cvmx_helper_get_interface_index_num (xp.port); +cvmx_bgxx_gmp_pcs_mrx_control_t gmp_mrx_control; +cvmx_bgxx_gmp_pcs_miscx_ctl_t gmp_misc_ctl; + +if (!cvmx_helper_is_port_valid (xiface, index)) +return 0 ; + +if (debug) +debug ("%s: interface %u:%d/%d\n" , __func__, xi.node, + xi.interface, index); + +if (cvmx_helper_bgx_is_rgmii (xi.interface, index)) { +cvmx_xcv_ctl_t xcv_ctl; +cvmx_helper_link_info_t link_info; + + xcv_ctl.u64 =csr_rd (CVMX_XCV_CTL ); + xcv_ctl.s.lpbk_int = enable_internal; + xcv_ctl.s.lpbk_ext = enable_external; +csr_wr (CVMX_XCV_CTL , xcv_ctl.u64); + +/* Initialize link and speed */ +__cvmx_helper_bgx_sgmii_hardware_init_link (xiface, index); + link_info =__cvmx_helper_bgx_sgmii_link_get (xipd_port); +__cvmx_helper_bgx_sgmii_hardware_init_link_speed (xiface, index, + link_info); +__cvmx_helper_bgx_rgmii_speed (link_info); + }else { + gmp_mrx_control.u64 =csr_rd_node ( + node, +CVMX_BGXX_GMP_PCS_MRX_CONTROL (index, xi.interface)); + gmp_mrx_control.s.loopbck1 = enable_internal; +csr_wr_node (node, +CVMX_BGXX_GMP_PCS_MRX_CONTROL (index, xi.interface), + gmp_mrx_control.u64); + + gmp_misc_ctl.u64 =csr_rd_node ( + node,CVMX_BGXX_GMP_PCS_MISCX_CTL (index, xi.interface)); + gmp_misc_ctl.s.loopbck2 = enable_external; +csr_wr_node (node, +CVMX_BGXX_GMP_PCS_MISCX_CTL (index, xi.interface), + gmp_misc_ctl.u64); +__cvmx_helper_bgx_sgmii_hardware_init_link (xiface, index); + } + +return 0 ; +} + +static int __cvmx_helper_bgx_xaui_link_init (int index,int xiface) +{ +struct cvmx_xiface xi =cvmx_helper_xiface_to_node_interface (xiface); +int node = xi.node; +cvmx_bgxx_spux_status1_t spu_status1; +cvmx_bgxx_spux_status2_t spu_status2; +cvmx_bgxx_spux_br_status2_t br_status2; +cvmx_bgxx_spux_int_t spu_int; +cvmx_bgxx_spux_misc_control_t spu_misc_control; +cvmx_bgxx_spux_an_control_t spu_an_control; +cvmx_bgxx_spux_an_status_t spu_an_status; +cvmx_bgxx_spux_br_pmd_control_t pmd_control; +cvmx_bgxx_cmrx_config_t cmr_config; +cvmx_helper_interface_mode_t mode; +int use_training =0 ; +int rgmii_first =0 ; +int qlm =cvmx_qlm_lmac (xiface, index); +int use_ber =0 ; +u64 err_blks; +u64 ber_cnt; +u64 error_debounce; + +if (debug) +debug ("%s: interface %u:%d/%d\n" , __func__, xi.node, + xi.interface, index); + + rgmii_first =cvmx_helper_bgx_is_rgmii (xi.interface, index); + + mode =cvmx_helper_bgx_get_mode (xiface, index); +if (mode ==CVMX_HELPER_INTERFACE_MODE_10G_KR || + mode ==CVMX_HELPER_INTERFACE_MODE_40G_KR4 ) + use_training =1 ; + +if ((mode ==CVMX_HELPER_INTERFACE_MODE_XFI || + mode ==CVMX_HELPER_INTERFACE_MODE_XLAUI || + mode ==CVMX_HELPER_INTERFACE_MODE_10G_KR || + mode ==CVMX_HELPER_INTERFACE_MODE_40G_KR4 )) + use_ber =1 ; + +/* Disable packet reception, CMR as well as SPU block */ + cmr_config.u64 = +csr_rd_node (node,CVMX_BGXX_CMRX_CONFIG (index, xi.interface)); + cmr_config.s.data_pkt_tx_en =0 ; + cmr_config.s.data_pkt_rx_en =0 ; +csr_wr_node (node,CVMX_BGXX_CMRX_CONFIG (index, xi.interface), + cmr_config.u64); + spu_misc_control.u64 =csr_rd_node ( + node,CVMX_BGXX_SPUX_MISC_CONTROL (index, xi.interface)); + spu_misc_control.s.rx_packet_dis =1 ; +csr_wr_node (node,CVMX_BGXX_SPUX_MISC_CONTROL (index, xi.interface), + spu_misc_control.u64); + + spu_an_control.u64 =csr_rd_node ( + node,CVMX_BGXX_SPUX_AN_CONTROL (index, xi.interface)); +if (spu_an_control.s.an_en) { +if (OCTEON_IS_MODEL (OCTEON_CN78XX_PASS1_X )) { +cvmx_bgxx_spux_int_t spu_int; + + spu_int.u64 =csr_rd_node ( + node,CVMX_BGXX_SPUX_INT (index, xi.interface)); +if (!spu_int.s.an_link_good) { +static u64 restart_auto_neg[2 ][6 ][4 ] = { + [0 ...1 ][0 ...5 ] = { [0 ...3 ] =0 } + }; +u64 now =get_timer (0 ); +u64 next_restart = + restart_auto_neg[node][xi.interface] + [index] + +2000 ; + +if (now >= next_restart) +return -1 ; + + restart_auto_neg[node][xi.interface][index] = + now; + +/* Clear the auto negotiation (W1C) */ + spu_int.u64 =0 ; + spu_int.s.an_complete =1 ; + spu_int.s.an_link_good =1 ; + spu_int.s.an_page_rx =1 ; +csr_wr_node (node, +CVMX_BGXX_SPUX_INT (index, + xi.interface), + spu_int.u64); +/* Restart auto negotiation */ + spu_an_control.u64 =csr_rd_node ( + node,CVMX_BGXX_SPUX_AN_CONTROL ( + index, xi.interface)); + spu_an_control.s.an_restart =1 ; +csr_wr_node (node, +CVMX_BGXX_SPUX_AN_CONTROL ( + index, xi.interface), + spu_an_control.u64); +return -1 ; + } + }else { + spu_an_status.u64 =csr_rd_node ( + node, +CVMX_BGXX_SPUX_AN_STATUS (index, xi.interface)); +if (!spu_an_status.s.an_complete) { +static u64 restart_auto_neg[2 ][6 ][4 ] = { + [0 ...1 ][0 ...5 ] = { [0 ...3 ] =0 } + }; +u64 now =get_timer (0 ); +u64 next_restart = + restart_auto_neg[node][xi.interface] + [index] + +2000 ; +if (now >= next_restart) { +#ifdef DEBUG_BGX +debug ("WARNING: BGX%d:%d: Waiting for autoneg to complete\n" , + xi.interface, index); +#endif +return -1 ; + } + + restart_auto_neg[node][xi.interface][index] = + now; +/* Restart auto negotiation */ + spu_an_control.u64 =csr_rd_node ( + node,CVMX_BGXX_SPUX_AN_CONTROL ( + index, xi.interface)); + spu_an_control.s.an_restart =1 ; +csr_wr_node (node, +CVMX_BGXX_SPUX_AN_CONTROL ( + index, xi.interface), + spu_an_control.u64); +return -1 ; + } + } + } + +if (use_training) { + spu_int.u64 =csr_rd_node ( + node,CVMX_BGXX_SPUX_INT (index, xi.interface)); + pmd_control.u64 =csr_rd_node ( + node, +CVMX_BGXX_SPUX_BR_PMD_CONTROL (index, xi.interface)); +if (OCTEON_IS_MODEL (OCTEON_CN78XX_PASS1_X ) && + pmd_control.s.train_en ==0 ) { +__cvmx_bgx_start_training (node, xi.interface, index); +return -1 ; + } +cvmx_qlm_gser_errata_27882 (node, qlm, index); + spu_int.u64 =csr_rd_node ( + node,CVMX_BGXX_SPUX_INT (index, xi.interface)); + +if (spu_int.s.training_failure && + !OCTEON_IS_MODEL (OCTEON_CN78XX_PASS1_X )) { +__cvmx_bgx_restart_training (node, xi.interface, index); +return -1 ; + } +if (!spu_int.s.training_done) { +debug ("Waiting for link training\n" ); +return -1 ; + } + } + +/* (GSER-21957) GSER RX Equalization may make >= 5gbaud non-KR +* channel with DXAUI, RXAUI, XFI and XLAUI, we need to perform +* RX equalization when the link is receiving data the first time +*/ +if (use_training ==0 ) { +int lane = index; +cvmx_bgxx_spux_control1_t control1; + + cmr_config.u64 =csr_rd_node ( + node,CVMX_BGXX_CMRX_CONFIG (index, xi.interface)); + control1.u64 =csr_rd_node ( + node,CVMX_BGXX_SPUX_CONTROL1 (index, xi.interface)); +if (control1.s.loopbck) { +/* Skip RX equalization when in loopback */ + }else if (mode ==CVMX_HELPER_INTERFACE_MODE_XLAUI || + mode ==CVMX_HELPER_INTERFACE_MODE_XAUI ) { + lane =-1 ; +if (__cvmx_qlm_rx_equalization (node, qlm, lane)) { +#ifdef DEBUG_BGX +debug ("%d:%d:%d: Waiting for RX Equalization on QLM%d\n" , + node, xi.interface, index, qlm); +#endif +return -1 ; + } +/* If BGX2 uses both dlms, then configure other dlm also. */ +if (OCTEON_IS_MODEL (OCTEON_CN73XX ) && + xi.interface ==2 ) { +if (__cvmx_qlm_rx_equalization (node,6 , lane)) { +#ifdef DEBUG_BGX +debug ("%d:%d:%d: Waiting for RX Equalization on QLM%d\n" , + node, xi.interface, index, qlm); +#endif +return -1 ; + } + } +/* RXAUI */ + }else if (mode ==CVMX_HELPER_INTERFACE_MODE_RXAUI ) { + lane = index *2 ; +if (OCTEON_IS_MODEL (OCTEON_CN73XX ) && index >=2 && + xi.interface ==2 ) { + lane =0 ; + } +if (rgmii_first) + lane--; +if (__cvmx_qlm_rx_equalization (node, qlm, lane) || +__cvmx_qlm_rx_equalization (node, qlm, lane +1 )) { +#ifdef DEBUG_BGX +debug ("%d:%d:%d: Waiting for RX Equalization on QLM%d\n" , + node, xi.interface, index, qlm); +#endif +return -1 ; + } +/* XFI */ + }else if (cmr_config.s.lmac_type !=5 ) { +if (rgmii_first) + lane--; +if (OCTEON_IS_MODEL (OCTEON_CN73XX ) && index >=2 && + xi.interface ==2 ) { + lane = index -2 ; + }else if (OCTEON_IS_MODEL (OCTEON_CNF75XX ) && + index >=2 ) { + lane = index -2 ; + } +if (__cvmx_qlm_rx_equalization (node, qlm, lane)) { +#ifdef DEBUG_BGX +debug ("%d:%d:%d: Waiting for RX Equalization on QLM%d\n" , + node, xi.interface, index, qlm); +#endif +return -1 ; + } + } + } + +if (CVMX_WAIT_FOR_FIELD64_NODE ( + node,CVMX_BGXX_SPUX_CONTROL1 (index, xi.interface), + cvmx_bgxx_spux_control1_t, reset, ==, 0, 10000)) { +#ifdef DEBUG_BGX +debug ("ERROR: %d:BGX%d:%d: PCS in reset" , node, xi.interface, + index); +#endif +return -1 ; + } + +if (use_ber) { +if (CVMX_WAIT_FOR_FIELD64_NODE ( + node, +CVMX_BGXX_SPUX_BR_STATUS1 (index, xi.interface), + cvmx_bgxx_spux_br_status1_t, blk_lock, ==, 1, +10000 )) { +#ifdef DEBUG_BGX +debug ("ERROR: %d:BGX%d:%d: BASE-R PCS block not locked\n" , + node, xi.interface, index); + +if (mode ==CVMX_HELPER_INTERFACE_MODE_XLAUI || + mode ==CVMX_HELPER_INTERFACE_MODE_40G_KR4 ) { +cvmx_bgxx_spux_br_algn_status_t bstatus; + + bstatus.u64 =csr_rd_node ( + node,CVMX_BGXX_SPUX_BR_ALGN_STATUS ( + index, xi.interface)); +debug ("ERROR: %d:BGX%d:%d: LANE BLOCK_LOCK:%x LANE MARKER_LOCK:%x\n" , + node, xi.interface, index, + bstatus.s.block_lock, + bstatus.s.marker_lock); + } +#endif +return -1 ; + } + }else { +/* (5) Check to make sure that the link appears up and stable. +*/ +/* Wait for PCS to be aligned */ +if (CVMX_WAIT_FOR_FIELD64_NODE ( + node,CVMX_BGXX_SPUX_BX_STATUS (index, xi.interface), + cvmx_bgxx_spux_bx_status_t, alignd, ==, 1, 10000)) { +#ifdef DEBUG_BGX +debug ("ERROR: %d:BGX%d:%d: PCS not aligned\n" , node, + xi.interface, index); +#endif +return -1 ; + } + } + +if (use_ber) { +/* Set the BGXX_SPUX_BR_STATUS2.latched_lock bit (latching low). +* This will be checked prior to enabling packet tx and rx, +* ensuring block lock is sustained throughout the BGX link-up +* procedure +*/ + br_status2.u64 =csr_rd_node ( + node,CVMX_BGXX_SPUX_BR_STATUS2 (index, xi.interface)); + br_status2.s.latched_lock =1 ; +csr_wr_node (node, +CVMX_BGXX_SPUX_BR_STATUS2 (index, xi.interface), + br_status2.u64); + } + +/* Clear rcvflt bit (latching high) and read it back */ + spu_status2.u64 = +csr_rd_node (node,CVMX_BGXX_SPUX_STATUS2 (index, xi.interface)); + spu_status2.s.rcvflt =1 ; +csr_wr_node (node,CVMX_BGXX_SPUX_STATUS2 (index, xi.interface), + spu_status2.u64); + + spu_status2.u64 = +csr_rd_node (node,CVMX_BGXX_SPUX_STATUS2 (index, xi.interface)); +if (spu_status2.s.rcvflt) { +#ifdef DEBUG_BGX +debug ("ERROR: %d:BGX%d:%d: Receive fault, need to retry\n" , + node, xi.interface, index); +#endif +if (OCTEON_IS_MODEL (OCTEON_CN78XX_PASS1_X ) && use_training) +__cvmx_bgx_restart_training (node, xi.interface, index); +/* debug("training restarting\n"); */ +return -1 ; + } + +/* Wait for MAC RX to be ready */ +if (CVMX_WAIT_FOR_FIELD64_NODE ( + node,CVMX_BGXX_SMUX_RX_CTL (index, xi.interface), + cvmx_bgxx_smux_rx_ctl_t, status, ==, 0, 10000)) { +#ifdef DEBUG_BGX +debug ("ERROR: %d:BGX%d:%d: RX not ready\n" , node, xi.interface, + index); +#endif +return -1 ; + } + +/* Wait for BGX RX to be idle */ +if (CVMX_WAIT_FOR_FIELD64_NODE ( + node,CVMX_BGXX_SMUX_CTRL (index, xi.interface), + cvmx_bgxx_smux_ctrl_t, rx_idle, ==, 1, 10000)) { +#ifdef DEBUG_BGX +debug ("ERROR: %d:BGX%d:%d: RX not idle\n" , node, xi.interface, + index); +#endif +return -1 ; + } + +/* Wait for GMX TX to be idle */ +if (CVMX_WAIT_FOR_FIELD64_NODE ( + node,CVMX_BGXX_SMUX_CTRL (index, xi.interface), + cvmx_bgxx_smux_ctrl_t, tx_idle, ==, 1, 10000)) { +#ifdef DEBUG_BGX +debug ("ERROR: %d:BGX%d:%d: TX not idle\n" , node, xi.interface, + index); +#endif +return -1 ; + } + +/* rcvflt should still be 0 */ + spu_status2.u64 = +csr_rd_node (node,CVMX_BGXX_SPUX_STATUS2 (index, xi.interface)); +if (spu_status2.s.rcvflt) { +#ifdef DEBUG_BGX +debug ("ERROR: %d:BGX%d:%d: Receive fault, need to retry\n" , + node, xi.interface, index); +#endif +return -1 ; + } + +/* Receive link is latching low. Force it high and verify it */ + spu_status1.u64 = +csr_rd_node (node,CVMX_BGXX_SPUX_STATUS1 (index, xi.interface)); + spu_status1.s.rcv_lnk =1 ; +csr_wr_node (node,CVMX_BGXX_SPUX_STATUS1 (index, xi.interface), + spu_status1.u64); + +if (CVMX_WAIT_FOR_FIELD64_NODE ( + node,CVMX_BGXX_SPUX_STATUS1 (index, xi.interface), + cvmx_bgxx_spux_status1_t, rcv_lnk, ==, 1, 10000)) { +#ifdef DEBUG_BGX +debug ("ERROR: %d:BGX%d:%d: Receive link down\n" , node, + xi.interface, index); +#endif +return -1 ; + } + +if (use_ber) { +/* Clearing BER_CNT and ERR_BLKs */ + br_status2.u64 =csr_rd_node ( + node,CVMX_BGXX_SPUX_BR_STATUS2 (index, xi.interface)); + +/* If set, clear the LATCHED_BER by writing it to a one. */ +if (br_status2.s.latched_ber) +csr_wr_node (node, +CVMX_BGXX_SPUX_BR_STATUS2 (index, + xi.interface), + br_status2.u64); + + error_debounce =get_timer (0 ); + +/* Clear error counts */ + err_blks =0 ; + ber_cnt =0 ; + +/* Verify that the link is up and error free for 100ms */ +while (get_timer (error_debounce) <100 ) { + spu_status1.u64 =csr_rd_node ( + node, +CVMX_BGXX_SPUX_STATUS1 (index, xi.interface)); +/* Checking that Receive link is still up (rcv_lnk = 1 (up)) */ +if (!spu_status1.s.rcv_lnk) { +#ifdef DEBUG_BGX +debug ("ERROR: %d:BGX%d:%d: Receive link down\n" , + node, xi.interface, index); +#endif +return -1 ; + } + +/* Checking if latched_ber = 1 (BER >= 10e^4) */ + br_status2.u64 =csr_rd_node ( + node, +CVMX_BGXX_SPUX_BR_STATUS2 (index, xi.interface)); + err_blks += br_status2.s.err_blks; + ber_cnt += br_status2.s.ber_cnt; + +if (br_status2.s.latched_ber) { +#ifdef DEBUG_BGX +debug ("ERROR: %d:BGX%d:%d: BER test failed, BER >= 10e^4, need to retry\n" , + node, xi.interface, index); +#endif +return -1 ; + } +/* Checking that latched BLOCK_LOCK is still set (Block Lock never lost) */ +if (!br_status2.s.latched_lock) { +#ifdef DEBUG_BGX +debug ("ERROR: %d:BGX%d:%d: BASE-R PCS block lock lost, need to retry\n" , + node, xi.interface, index); +#endif +return -1 ; + } + +/* Check error counters. Must be 0 (this error rate# +* is much higher than 1E-12) +*/ +if (err_blks >0 ) { +#ifdef DEBUG_BGX +debug ("ERROR: %d:BGX%d:%d: BASE-R errored-blocks (%llu) detected, need to retry\n" , + node, xi.interface, index, + (unsigned long long )err_blks); +#endif +return -1 ; + } + +if (ber_cnt >0 ) { +#ifdef DEBUG_BGX +debug ("ERROR: %d:BGX%d:%d: BASE-R bit-errors (%llu) detected, need to retry\n" , + node, xi.interface, index, + (unsigned long long )ber_cnt); +#endif +return -1 ; + } + +udelay (1000 ); + } + +/* Clear out the BGX error counters/bits. These errors are +* expected as part of the BGX link up procedure +*/ +/* BIP_ERR counters clear as part of this read */ +csr_rd_node (node, +CVMX_BGXX_SPUX_BR_BIP_ERR_CNT (index, xi.interface)); +/* BER_CNT and ERR_BLKs clear as part of this read */ + br_status2.u64 =csr_rd_node ( + node,CVMX_BGXX_SPUX_BR_STATUS2 (index, xi.interface)); + } + +/* (7) Enable packet transmit and receive */ + spu_misc_control.u64 =csr_rd_node ( + node,CVMX_BGXX_SPUX_MISC_CONTROL (index, xi.interface)); + spu_misc_control.s.rx_packet_dis =0 ; +csr_wr_node (node,CVMX_BGXX_SPUX_MISC_CONTROL (index, xi.interface), + spu_misc_control.u64); + +if (debug) +debug ("%s: Enabling tx and rx data packets\n" , __func__); + cmr_config.u64 = +csr_rd_node (node,CVMX_BGXX_CMRX_CONFIG (index, xi.interface)); + cmr_config.s.data_pkt_tx_en =1 ; + cmr_config.s.data_pkt_rx_en =1 ; +csr_wr_node (node,CVMX_BGXX_CMRX_CONFIG (index, xi.interface), + cmr_config.u64); +return 0 ; +} + +int __cvmx_helper_bgx_xaui_enable (int xiface) +{ +int index; +cvmx_helper_interface_mode_t mode; +int num_ports =cvmx_helper_ports_on_interface (xiface); + +for (index =0 ; index < num_ports; index++) { +int res; +int xipd_port =cvmx_helper_get_ipd_port (xiface, index); +int phy_pres; +struct cvmx_xiface xi = +cvmx_helper_xiface_to_node_interface (xiface); +static int count + [CVMX_MAX_NODES ][CVMX_HELPER_MAX_IFACE ] + [CVMX_HELPER_CFG_MAX_PORT_PER_IFACE ] = { + [0 ...CVMX_MAX_NODES - +1 ][0 ...CVMX_HELPER_MAX_IFACE - +1 ] = { [0 ...CVMX_HELPER_CFG_MAX_PORT_PER_IFACE - +1 ] =0 } + }; + + mode =cvmx_helper_bgx_get_mode (xiface, index); + +/* Set disparity for RXAUI interface as described in the +* Marvell RXAUI Interface specification. +*/ +if (mode ==CVMX_HELPER_INTERFACE_MODE_RXAUI && + (cvmx_helper_get_port_phy_present (xiface, index))) + phy_pres =1 ; +else + phy_pres =0 ; +__cvmx_helper_bgx_port_init (xipd_port, phy_pres); + +retry_link: + res =__cvmx_helper_bgx_xaui_link_init (index, xiface); +/* RX Equalization or autonegotiation can take little longer +* retry the link maybe 5 times for now +*/ +if (res ==-1 && count[xi.node][xi.interface][index] <5 ) { + count[xi.node][xi.interface][index]++; +#ifdef DEBUG_BGX +debug ("%d:BGX(%d,%d): Failed to get link, retrying\n" , + xi.node, xi.interface, index); +#endif + goto retry_link; + } + +if (res ==-1 ) { +#ifdef DEBUG_BGX +debug ("%d:BGX(%d,%d): Failed to get link\n" , xi.node, + xi.interface, index); +#endif +continue ; + } + } +return 0 ; +} + +cvmx_helper_link_info_t __cvmx_helper_bgx_xaui_link_get (int xipd_port) +{ +int xiface =cvmx_helper_get_interface_num (xipd_port); +struct cvmx_xiface xi =cvmx_helper_xiface_to_node_interface (xiface); +struct cvmx_xport xp =cvmx_helper_ipd_port_to_xport (xipd_port); +int index =cvmx_helper_get_interface_index_num (xp.port); +cvmx_bgxx_spux_status1_t spu_status1; +cvmx_bgxx_smux_tx_ctl_t smu_tx_ctl; +cvmx_bgxx_smux_rx_ctl_t smu_rx_ctl; +cvmx_bgxx_cmrx_config_t cmr_config; +cvmx_helper_link_info_t result; +cvmx_helper_interface_mode_t mode; +cvmx_bgxx_spux_misc_control_t spu_misc_control; +cvmx_bgxx_spux_br_status2_t br_status2; + + result.u64 =0 ; + +if (debug) +debug ("%s: interface %u:%d/%d\n" , __func__, xi.node, + xi.interface, index); + + mode =cvmx_helper_bgx_get_mode (xiface, index); +if (mode ==CVMX_HELPER_INTERFACE_MODE_RGMII ) +return __cvmx_helper_bgx_sgmii_link_get (xipd_port); + +/* Reading current rx/tx link status */ + spu_status1.u64 =csr_rd_node ( + xi.node,CVMX_BGXX_SPUX_STATUS1 (index, xi.interface)); + smu_tx_ctl.u64 =csr_rd_node ( + xi.node,CVMX_BGXX_SMUX_TX_CTL (index, xi.interface)); + smu_rx_ctl.u64 =csr_rd_node ( + xi.node,CVMX_BGXX_SMUX_RX_CTL (index, xi.interface)); +/* Reading tx/rx packet enables */ + cmr_config.u64 =csr_rd_node ( + xi.node,CVMX_BGXX_CMRX_CONFIG (index, xi.interface)); + spu_misc_control.u64 =csr_rd_node ( + xi.node,CVMX_BGXX_SPUX_MISC_CONTROL (index, xi.interface)); + +if (smu_tx_ctl.s.ls ==0 && smu_rx_ctl.s.status ==0 && + cmr_config.s.data_pkt_tx_en ==1 && + cmr_config.s.data_pkt_rx_en ==1 && + spu_misc_control.s.rx_packet_dis ==0 && + spu_status1.s.rcv_lnk) { +int lanes; +int qlm =cvmx_qlm_lmac (xiface, index); +u64 speed; + + result.s.link_up =1 ; + result.s.full_duplex =1 ; +if (OCTEON_IS_MODEL (OCTEON_CN78XX )) + speed =cvmx_qlm_get_gbaud_mhz_node (xi.node, qlm); +else + speed =cvmx_qlm_get_gbaud_mhz (qlm); + + cmr_config.u64 =csr_rd_node ( + xi.node,CVMX_BGXX_CMRX_CONFIG (index, xi.interface)); +switch (cmr_config.s.lmac_type) { +default : +case 1 :// XAUI + speed = (speed *8 +5 ) /10 ; + lanes =4 ; +break ; +case 2 :// RXAUI + speed = (speed *8 +5 ) /10 ; + lanes =2 ; +break ; +case 3 :// XFI + speed = (speed *64 +33 ) /66 ; + lanes =1 ; +break ; +case 4 :// XLAUI +/* Adjust the speed when XLAUI is configured at 6.250Gbps */ +if (speed ==6250 ) + speed =6445 ; + speed = (speed *64 +33 ) /66 ; + lanes =4 ; +break ; + } + +if (debug) +debug ("%s: baud: %llu, lanes: %d\n" , __func__, + (unsigned long long )speed, lanes); + speed *= lanes; + result.s.speed = speed; + }else { +int res; +u64 err_blks =0 ; +u64 ber_cnt =0 ; + +/* Check for err_blk and ber errors if 10G or 40G */ +if ((mode ==CVMX_HELPER_INTERFACE_MODE_XFI || + mode ==CVMX_HELPER_INTERFACE_MODE_XLAUI || + mode ==CVMX_HELPER_INTERFACE_MODE_10G_KR || + mode ==CVMX_HELPER_INTERFACE_MODE_40G_KR4 )) { + br_status2.u64 =csr_rd_node ( + xi.node, +CVMX_BGXX_SPUX_BR_STATUS2 (index, xi.interface)); + err_blks = br_status2.s.err_blks; + ber_cnt = br_status2.s.ber_cnt; + } + +/* Checking if the link is up and error-free but we are receiving remote-faults */ +if (smu_tx_ctl.s.ls !=1 && smu_rx_ctl.s.status !=1 && + cmr_config.s.data_pkt_tx_en ==1 && + cmr_config.s.data_pkt_rx_en ==1 && + spu_misc_control.s.rx_packet_dis ==0 && + err_blks ==0 && ber_cnt ==0 && + spu_status1.s.rcv_lnk) { + result.s.init_success =1 ; +#ifdef DEBUG_BGX +debug ("Receiving remote-fault ordered sets %d:BGX(%d,%d)\n" , + xi.node, xi.interface, index); +#endif + + }else { + res =__cvmx_helper_bgx_xaui_link_init (index, xiface); +if (res ==-1 ) { +#ifdef DEBUG_BGX +debug ("Failed to get %d:BGX(%d,%d) link\n" , + xi.node, xi.interface, index); +#endif + }else { +#ifdef DEBUG_BGX +debug ("Link initialization successful %d:BGX(%d,%d)\n" , + xi.node, xi.interface, index); +#endif + result.s.init_success =1 ; + } + } + } + +return result; +} + +int __cvmx_helper_bgx_xaui_link_set (int xipd_port, +cvmx_helper_link_info_t link_info) +{ +int xiface =cvmx_helper_get_interface_num (xipd_port); +struct cvmx_xiface xi =cvmx_helper_xiface_to_node_interface (xiface); +struct cvmx_xport xp =cvmx_helper_ipd_port_to_xport (xipd_port); +int node = xi.node; +int index =cvmx_helper_get_interface_index_num (xp.port); +cvmx_bgxx_smux_tx_ctl_t smu_tx_ctl; +cvmx_bgxx_smux_rx_ctl_t smu_rx_ctl; +cvmx_bgxx_spux_status1_t spu_status1; +cvmx_helper_interface_mode_t mode; +cvmx_bgxx_cmrx_config_t cmr_config; +cvmx_bgxx_spux_misc_control_t spu_misc_control; + +if (debug) +debug ("%s: interface %u:%d/%d\n" , __func__, xi.node, + xi.interface, index); + + mode =cvmx_helper_bgx_get_mode (xiface, index); +if (mode ==CVMX_HELPER_INTERFACE_MODE_RGMII ) +return __cvmx_helper_bgx_sgmii_link_set (xipd_port, link_info); + +/* Reading current rx/tx link status */ + smu_tx_ctl.u64 = +csr_rd_node (node,CVMX_BGXX_SMUX_TX_CTL (index, xi.interface)); + smu_rx_ctl.u64 = +csr_rd_node (node,CVMX_BGXX_SMUX_RX_CTL (index, xi.interface)); + spu_status1.u64 = +csr_rd_node (node,CVMX_BGXX_SPUX_STATUS1 (index, xi.interface)); +/* Reading tx/rx packet enables */ + cmr_config.u64 =csr_rd_node ( + xi.node,CVMX_BGXX_CMRX_CONFIG (index, xi.interface)); + spu_misc_control.u64 =csr_rd_node ( + xi.node,CVMX_BGXX_SPUX_MISC_CONTROL (index, xi.interface)); + +/* If the link shouldn't be up, then just return */ +if (!link_info.s.link_up) +return 0 ; + +/* Do nothing if both RX and TX are happy and packet +* transmission/reception is enabled +*/ +if (smu_tx_ctl.s.ls ==0 && smu_rx_ctl.s.status ==0 && + cmr_config.s.data_pkt_tx_en ==1 && + cmr_config.s.data_pkt_rx_en ==1 && + spu_misc_control.s.rx_packet_dis ==0 && spu_status1.s.rcv_lnk) +return 0 ; + +/* Bring the link up */ +return __cvmx_helper_bgx_xaui_link_init (index, xiface); +} + +int __cvmx_helper_bgx_xaui_configure_loopback (int xipd_port, +int enable_internal, +int enable_external) +{ +int xiface =cvmx_helper_get_interface_num (xipd_port); +struct cvmx_xiface xi =cvmx_helper_xiface_to_node_interface (xiface); +struct cvmx_xport xp =cvmx_helper_ipd_port_to_xport (xipd_port); +int node = xi.node; +int index =cvmx_helper_get_interface_index_num (xp.port); +cvmx_bgxx_spux_control1_t spu_control1; +cvmx_bgxx_smux_ext_loopback_t smu_ext_loopback; + +if (debug) +debug ("%s: interface %u:%d/%d\n" , __func__, xi.node, + xi.interface, index); + +/* INT_BEAT_GEN must be set for loopback if the QLMs are not clocked. +* Set it whenever we use internal loopback +*/ +if (enable_internal) { +cvmx_bgxx_cmrx_config_t cmr_config; + + cmr_config.u64 =csr_rd_node ( + node,CVMX_BGXX_CMRX_CONFIG (index, xi.interface)); + cmr_config.s.int_beat_gen =1 ; +csr_wr_node (node,CVMX_BGXX_CMRX_CONFIG (index, xi.interface), + cmr_config.u64); + } +/* Set the internal loop */ + spu_control1.u64 = +csr_rd_node (node,CVMX_BGXX_SPUX_CONTROL1 (index, xi.interface)); + spu_control1.s.loopbck = enable_internal; +csr_wr_node (node,CVMX_BGXX_SPUX_CONTROL1 (index, xi.interface), + spu_control1.u64); +/* Set the external loop */ + smu_ext_loopback.u64 =csr_rd_node ( + node,CVMX_BGXX_SMUX_EXT_LOOPBACK (index, xi.interface)); + smu_ext_loopback.s.en = enable_external; +csr_wr_node (node,CVMX_BGXX_SMUX_EXT_LOOPBACK (index, xi.interface), + smu_ext_loopback.u64); + +return __cvmx_helper_bgx_xaui_link_init (index, xiface); +} + +int __cvmx_helper_bgx_mixed_enable (int xiface) +{ +int index; +int num_ports =cvmx_helper_ports_on_interface (xiface); +cvmx_helper_interface_mode_t mode; + +for (index =0 ; index < num_ports; index++) { +int xipd_port, phy_pres =0 ; + +if (!cvmx_helper_is_port_valid (xiface, index)) +continue ; + + mode =cvmx_helper_bgx_get_mode (xiface, index); + + xipd_port =cvmx_helper_get_ipd_port (xiface, index); + +if (mode ==CVMX_HELPER_INTERFACE_MODE_RXAUI && + (cvmx_helper_get_port_phy_present (xiface, index))) + phy_pres =1 ; + +if (__cvmx_helper_bgx_port_init (xipd_port, phy_pres)) +continue ; + +/* For RGMII interface, initialize the link after PKO is setup */ +if (mode ==CVMX_HELPER_INTERFACE_MODE_RGMII ) +continue ; +/* Call SGMII init code for lmac_type = 0|5 */ +else if (mode ==CVMX_HELPER_INTERFACE_MODE_SGMII ) { +int do_link_set =1 ; + +if (do_link_set) +__cvmx_helper_bgx_sgmii_link_set ( + xipd_port, +__cvmx_helper_bgx_sgmii_link_get ( + xipd_port)); +/* All other lmac type call XAUI init code */ + }else { +int res; +struct cvmx_xiface xi = +cvmx_helper_xiface_to_node_interface (xiface); +static int count + [CVMX_MAX_NODES ][CVMX_HELPER_MAX_IFACE ] + [CVMX_HELPER_CFG_MAX_PORT_PER_IFACE ] = { + [0 ...CVMX_MAX_NODES - +1 ][0 ...CVMX_HELPER_MAX_IFACE - +1 ] = { [0 ...CVMX_HELPER_CFG_MAX_PORT_PER_IFACE - +1 ] =0 } + }; + +retry_link: + res =__cvmx_helper_bgx_xaui_link_init (index, xiface); +/* RX Equalization or autonegotiation can take little +* longer retry the link maybe 5 times for now +*/ +if (res ==-1 && + count[xi.node][xi.interface][index] <5 ) { + count[xi.node][xi.interface][index]++; + goto retry_link; + } + +if (res ==-1 ) { +#ifdef DEBUG_BGX +debug ("Failed to get %d:BGX(%d,%d) link\n" , + xi.node, xi.interface, index); +#endif +continue ; + } + } + } +return 0 ; +} + +cvmx_helper_link_info_t __cvmx_helper_bgx_mixed_link_get (int xipd_port) +{ +int xiface =cvmx_helper_get_interface_num (xipd_port); +int index =cvmx_helper_get_interface_index_num (xipd_port); +cvmx_helper_interface_mode_t mode; + + mode =cvmx_helper_bgx_get_mode (xiface, index); +if (mode ==CVMX_HELPER_INTERFACE_MODE_SGMII || + mode ==CVMX_HELPER_INTERFACE_MODE_RGMII ) +return __cvmx_helper_bgx_sgmii_link_get (xipd_port); +else +return __cvmx_helper_bgx_xaui_link_get (xipd_port); +} + +int __cvmx_helper_bgx_mixed_link_set (int xipd_port, +cvmx_helper_link_info_t link_info) +{ +int xiface =cvmx_helper_get_interface_num (xipd_port); +int index =cvmx_helper_get_interface_index_num (xipd_port); +cvmx_helper_interface_mode_t mode; + + mode =cvmx_helper_bgx_get_mode (xiface, index); +if (mode ==CVMX_HELPER_INTERFACE_MODE_SGMII || + mode ==CVMX_HELPER_INTERFACE_MODE_RGMII ) +return __cvmx_helper_bgx_sgmii_link_set (xipd_port, link_info); +else +return __cvmx_helper_bgx_xaui_link_set (xipd_port, link_info); +} + +int __cvmx_helper_bgx_mixed_configure_loopback (int xipd_port, +int enable_internal, +int enable_external) +{ +int xiface =cvmx_helper_get_interface_num (xipd_port); +int index =cvmx_helper_get_interface_index_num (xipd_port); +cvmx_helper_interface_mode_t mode; + + mode =cvmx_helper_bgx_get_mode (xiface, index); +if (mode ==CVMX_HELPER_INTERFACE_MODE_SGMII || + mode ==CVMX_HELPER_INTERFACE_MODE_RGMII ) +return __cvmx_helper_bgx_sgmii_configure_loopback ( + xipd_port, enable_internal, enable_external); +else +return __cvmx_helper_bgx_xaui_configure_loopback ( + xipd_port, enable_internal, enable_external); +} + +/** +* @INTERNAL +* Configure Priority-Based Flow Control (a.k.a. PFC/CBFC) +* on a specific BGX interface/port. +*/ +void __cvmx_helper_bgx_xaui_config_pfc (unsigned int node, +unsigned int interface, +unsigned int index,bool pfc_enable) +{ +int xiface =cvmx_helper_node_interface_to_xiface (node, interface); +struct cvmx_xiface xi =cvmx_helper_xiface_to_node_interface (xiface); +cvmx_bgxx_smux_cbfc_ctl_t cbfc_ctl; + +if (debug) +debug ("%s: interface %u:%d/%d\n" , __func__, xi.node, + xi.interface, index); + + cbfc_ctl.u64 = +csr_rd_node (node,CVMX_BGXX_SMUX_CBFC_CTL (index, xi.interface)); + +/* Enable all PFC controls if requiested */ + cbfc_ctl.s.rx_en = pfc_enable; + cbfc_ctl.s.tx_en = pfc_enable; +if (debug) +debug ("%s: CVMX_BGXX_SMUX_CBFC_CTL(%d,%d)=%#llx\n" , __func__, + index, xi.interface, (unsigned long long )cbfc_ctl.u64); +csr_wr_node (node,CVMX_BGXX_SMUX_CBFC_CTL (index, xi.interface), + cbfc_ctl.u64); +} + +/** +* This function control how the hardware handles incoming PAUSE +* packets. The most common modes of operation: +* ctl_bck = 1, ctl_drp = 1: hardware handles everything +* ctl_bck = 0, ctl_drp = 0: software sees all PAUSE frames +* ctl_bck = 0, ctl_drp = 1: all PAUSE frames are completely ignored +* @param node node number. +* @param interface interface number +* @param index port number +* @param ctl_bck 1: Forward PAUSE information to TX block +* @param ctl_drp 1: Drop control PAUSE frames. +*/ +void cvmx_helper_bgx_rx_pause_ctl (unsigned int node,unsigned int interface, +unsigned int index,unsigned int ctl_bck, +unsigned int ctl_drp) +{ +int xiface =cvmx_helper_node_interface_to_xiface (node, interface); +struct cvmx_xiface xi =cvmx_helper_xiface_to_node_interface (xiface); +cvmx_bgxx_smux_rx_frm_ctl_t frm_ctl; + +if (debug) +debug ("%s: interface %u:%d/%d\n" , __func__, xi.node, + xi.interface, index); + + frm_ctl.u64 =csr_rd_node ( + node,CVMX_BGXX_SMUX_RX_FRM_CTL (index, xi.interface)); + frm_ctl.s.ctl_bck = ctl_bck; + frm_ctl.s.ctl_drp = ctl_drp; +csr_wr_node (node,CVMX_BGXX_SMUX_RX_FRM_CTL (index, xi.interface), + frm_ctl.u64); +} + +/** +* This function configures the receive action taken for multicast, broadcast +* and dmac filter match packets. +* @param node node number. +* @param interface interface number +* @param index port number +* @param cam_accept 0: reject packets on dmac filter match +* 1: accept packet on dmac filter match +* @param mcast_mode 0x0 = Force reject all multicast packets +* 0x1 = Force accept all multicast packets +* 0x2 = Use the address filter CAM +* @param bcast_accept 0 = Reject all broadcast packets +* 1 = Accept all broadcast packets +*/ +void cvmx_helper_bgx_rx_adr_ctl (unsigned int node,unsigned int interface, +unsigned int index,unsigned int cam_accept, +unsigned int mcast_mode, +unsigned int bcast_accept) +{ +int xiface =cvmx_helper_node_interface_to_xiface (node, interface); +struct cvmx_xiface xi =cvmx_helper_xiface_to_node_interface (xiface); +cvmx_bgxx_cmrx_rx_adr_ctl_t adr_ctl; + +if (debug) +debug ("%s: interface %u:%d/%d\n" , __func__, xi.node, + xi.interface, index); + + adr_ctl.u64 =csr_rd_node ( + node,CVMX_BGXX_CMRX_RX_ADR_CTL (index, xi.interface)); + adr_ctl.s.cam_accept = cam_accept; + adr_ctl.s.mcst_mode = mcast_mode; + adr_ctl.s.bcst_accept = bcast_accept; + +csr_wr_node (node,CVMX_BGXX_CMRX_RX_ADR_CTL (index, xi.interface), + adr_ctl.u64); +} + +/** +* Function to control the generation of FCS, padding by the BGX +* +*/ +void cvmx_helper_bgx_tx_options (unsigned int node,unsigned int interface, +unsigned int index,bool fcs_enable, +bool pad_enable) +{ +cvmx_bgxx_cmrx_config_t cmr_config; +cvmx_bgxx_gmp_gmi_txx_append_t gmp_txx_append; +cvmx_bgxx_gmp_gmi_txx_min_pkt_t gmp_min_pkt; +cvmx_bgxx_smux_tx_min_pkt_t smu_min_pkt; +cvmx_bgxx_smux_tx_append_t smu_tx_append; +int xiface =cvmx_helper_node_interface_to_xiface (node, interface); +struct cvmx_xiface xi =cvmx_helper_xiface_to_node_interface (xiface); + +if (!cvmx_helper_is_port_valid (xiface, index)) +return ; + +if (debug) +debug ("%s: interface %u:%d/%d, fcs: %s, pad: %s\n" , __func__, + xi.node, xi.interface, index, + fcs_enable ?"true" :"false" , + pad_enable ?"true" :"false" ); + + cmr_config.u64 = +csr_rd_node (node,CVMX_BGXX_CMRX_CONFIG (index, xi.interface)); + + (void )cmr_config;/* In case we need LMAC_TYPE later */ + +/* Setting options for both BGX subsystems, regardless of LMAC type */ + +/* Set GMP (SGMII) Tx options */ + gmp_min_pkt.u64 =0 ; +/* per HRM Sec 34.3.4.4 */ + gmp_min_pkt.s.min_size =59 ; +csr_wr_node (node,CVMX_BGXX_GMP_GMI_TXX_MIN_PKT (index, xi.interface), + gmp_min_pkt.u64); + gmp_txx_append.u64 =csr_rd_node ( + node,CVMX_BGXX_GMP_GMI_TXX_APPEND (index, xi.interface)); + gmp_txx_append.s.fcs = fcs_enable; + gmp_txx_append.s.pad = pad_enable; +csr_wr_node (node,CVMX_BGXX_GMP_GMI_TXX_APPEND (index, xi.interface), + gmp_txx_append.u64); + +/* Set SMUX (XAUI/XFI) Tx options */ +/* HRM Sec 33.3.4.3 should read 64 */ + smu_min_pkt.u64 =0 ; + smu_min_pkt.s.min_size =0x40 ; +csr_wr_node (node,CVMX_BGXX_SMUX_TX_MIN_PKT (index, xi.interface), + smu_min_pkt.u64); + smu_tx_append.u64 =csr_rd_node ( + node,CVMX_BGXX_SMUX_TX_APPEND (index, xi.interface)); + smu_tx_append.s.fcs_d = fcs_enable;/* Set data-packet FCS */ + smu_tx_append.s.pad = pad_enable; +csr_wr_node (node,CVMX_BGXX_SMUX_TX_APPEND (index, xi.interface), + smu_tx_append.u64); +} + +/** +* Set mac for the ipd_port +* +* @param xipd_port ipd_port to set the mac +* @param bcst If set, accept all broadcast packets +* @param mcst Multicast mode +* 0 = Force reject all multicast packets +* 1 = Force accept all multicast packets +* 2 = use the address filter CAM. +* @param mac mac address for the ipd_port, or 0 to disable MAC filtering +*/ +void cvmx_helper_bgx_set_mac (int xipd_port,int bcst,int mcst,u64 mac) +{ +int xiface =cvmx_helper_get_interface_num (xipd_port); +struct cvmx_xiface xi =cvmx_helper_xiface_to_node_interface (xiface); +int node = xi.node; +int index; +cvmx_bgxx_cmr_rx_adrx_cam_t adr_cam; +cvmx_bgxx_cmrx_rx_adr_ctl_t adr_ctl; +cvmx_bgxx_cmrx_config_t cmr_config; +int saved_state_tx, saved_state_rx; + + index =cvmx_helper_get_interface_index_num (xipd_port); + +if (!cvmx_helper_is_port_valid (xiface, index)) +return ; + +if (debug) +debug ("%s: interface %u:%d/%d\n" , __func__, xi.node, + xi.interface, index); + + cmr_config.u64 = +csr_rd_node (node,CVMX_BGXX_CMRX_CONFIG (index, xi.interface)); + saved_state_tx = cmr_config.s.data_pkt_tx_en; + saved_state_rx = cmr_config.s.data_pkt_rx_en; + cmr_config.s.data_pkt_tx_en =0 ; + cmr_config.s.data_pkt_rx_en =0 ; +csr_wr_node (node,CVMX_BGXX_CMRX_CONFIG (index, xi.interface), + cmr_config.u64); + +/* Set the mac */ + adr_cam.u64 =0 ; + adr_cam.s.id = index; + +if (mac !=0ull ) + adr_cam.s.en =1 ; + adr_cam.s.adr = mac; + +csr_wr_node (node,CVMX_BGXX_CMR_RX_ADRX_CAM (index *8 , xi.interface), + adr_cam.u64); + + adr_ctl.u64 =csr_rd_node ( + node,CVMX_BGXX_CMRX_RX_ADR_CTL (index, xi.interface)); +if (mac !=0ull ) + adr_ctl.s.cam_accept = +1 ;/* Accept the packet on DMAC CAM address */ +else + adr_ctl.s.cam_accept =0 ;/* No filtering, promiscuous */ + + adr_ctl.s.mcst_mode = mcst;/* Use the address filter CAM */ + adr_ctl.s.bcst_accept = bcst;/* Accept all broadcast packets */ +csr_wr_node (node,CVMX_BGXX_CMRX_RX_ADR_CTL (index, xi.interface), + adr_ctl.u64); +/* Set SMAC for PAUSE frames */ +csr_wr_node (node,CVMX_BGXX_GMP_GMI_SMACX (index, xi.interface), mac); + +/* Restore back the interface state */ + cmr_config.s.data_pkt_tx_en = saved_state_tx; + cmr_config.s.data_pkt_rx_en = saved_state_rx; +csr_wr_node (node,CVMX_BGXX_CMRX_CONFIG (index, xi.interface), + cmr_config.u64); + +/* Wait 100ms after bringing up the link to give the PHY some time */ +if (cmr_config.s.enable) { +cvmx_helper_interface_mode_t mode; + + mode =cvmx_helper_bgx_get_mode (xiface, index); +__cvmx_helper_bgx_interface_enable_delay (mode); + } +} + +/** +* Disables the sending of flow control (pause) frames on the specified +* BGX port(s). +* +* @param xiface Which xiface +* @param port_mask Mask (4bits) of which ports on the interface to disable +* backpressure on. +* 1 => disable backpressure +* 0 => enable backpressure +* +* @return 0 on success +* -1 on error +* +* FIXME: Should change the API to handle a single port in every +* invocation, for consistency with other API calls. +*/ +int cvmx_bgx_set_backpressure_override (int xiface,unsigned int port_mask) +{ +struct cvmx_xiface xi =cvmx_helper_xiface_to_node_interface (xiface); +cvmx_bgxx_cmr_rx_ovr_bp_t rx_ovr_bp; +int node = xi.node; + +if (xi.interface >=CVMX_HELPER_MAX_GMX ) +return 0 ; + +if (debug) +debug ("%s: interface %u:%d port_mask=%#x\n" , __func__, xi.node, + xi.interface, port_mask); + +/* Check for valid arguments */ + rx_ovr_bp.u64 =0 ; + rx_ovr_bp.s.en = port_mask;/* Per port Enable back pressure override */ + rx_ovr_bp.s.ign_fifo_bp = + port_mask;/* Ignore the RX FIFO full when computing BP */ + +csr_wr_node (node,CVMX_BGXX_CMR_RX_OVR_BP (xi.interface), rx_ovr_bp.u64); +return 0 ; +} + +/** +* Set maximum packet size for a BGX port +* +*/ +void cvmx_helper_bgx_set_jabber (int xiface,unsigned int index, +unsigned int size) +{ +struct cvmx_xiface xi =cvmx_helper_xiface_to_node_interface (xiface); +int node; +cvmx_helper_interface_mode_t mode; + +if (!octeon_has_feature (OCTEON_FEATURE_BGX )) +return ; + +if (!cvmx_helper_is_port_valid (xiface, index)) +return ; + + node = xi.node; + + mode =cvmx_helper_bgx_get_mode (xiface, index); + +/* Set GMI or SMUX register based on lmac_type */ +if (mode ==CVMX_HELPER_INTERFACE_MODE_SGMII || + mode ==CVMX_HELPER_INTERFACE_MODE_RGMII ) { +csr_wr_node (node, +CVMX_BGXX_GMP_GMI_RXX_JABBER (index, xi.interface), + size); + }else { +csr_wr_node (node,CVMX_BGXX_SMUX_RX_JABBER (index, xi.interface), + size); + } +} + +/** +* Shutdown a BGX port +* +*/ +int cvmx_helper_bgx_shutdown_port (int xiface,int index) +{ +cvmx_bgxx_cmrx_config_t cmr_config; +int node; +struct cvmx_xiface xi =cvmx_helper_xiface_to_node_interface (xiface); + + node = xi.node; + +if (xi.interface >=CVMX_HELPER_MAX_GMX ) +return 0 ; + +if (debug) +debug ("%s: interface %u:%d/%d\n" , __func__, node, xi.interface, + index); + +if (!cvmx_helper_is_port_valid (xiface, index)) +return 0 ; + +/* Disable BGX CMR before we make any changes. */ + cmr_config.u64 = +csr_rd_node (node,CVMX_BGXX_CMRX_CONFIG (index, xi.interface)); + + cmr_config.s.data_pkt_tx_en =0 ; + cmr_config.s.data_pkt_rx_en =0 ; +csr_wr_node (node,CVMX_BGXX_CMRX_CONFIG (index, xi.interface), + cmr_config.u64); + +/* Clear pending common interrupts */ +csr_wr_node (node,CVMX_BGXX_CMRX_INT (index, xi.interface),0x7 ); + +if (cmr_config.s.lmac_type ==0 || + cmr_config.s.lmac_type ==5 ) {/* SGMII */ +/* Clear GMP interrupts */ +csr_wr_node (node, +CVMX_BGXX_GMP_GMI_RXX_INT (index, xi.interface), +0xfff ); +csr_wr_node (node, +CVMX_BGXX_GMP_GMI_TXX_INT (index, xi.interface), +0x1f ); +/* Wait for GMX to be idle */ +if (CVMX_WAIT_FOR_FIELD64_NODE ( + node, +CVMX_BGXX_GMP_GMI_PRTX_CFG (index, xi.interface), + cvmx_bgxx_gmp_gmi_prtx_cfg_t, rx_idle, ==, 1, +10000 ) || +CVMX_WAIT_FOR_FIELD64_NODE ( + node, +CVMX_BGXX_GMP_GMI_PRTX_CFG (index, xi.interface), + cvmx_bgxx_gmp_gmi_prtx_cfg_t, tx_idle, ==, 1, +10000 )) { +printf ("ERROR: %s: SGMII: Timeout waiting for port %u:%d/%d to stop\n" , + __func__, node, xi.interface, index); +return -1 ; + } +/* Read GMX CFG again to make sure the disable completed */ +csr_rd_node (node, +CVMX_BGXX_GMP_GMI_PRTX_CFG (index, xi.interface)); +/* FIXME Disable RGMII interface */ + }else {/* XAUI/XFI/10-KR */ +/* Clear all pending SMUX interrupts */ +csr_wr_node (node,CVMX_BGXX_SMUX_RX_INT (index, xi.interface), +0xfff ); +csr_wr_node (node,CVMX_BGXX_SMUX_TX_INT (index, xi.interface), +0x1f ); +csr_wr_node (node,CVMX_BGXX_SPUX_INT (index, xi.interface), +0x7fff ); + +/* Wait for GMX RX to be idle */ +if (CVMX_WAIT_FOR_FIELD64_NODE ( + node,CVMX_BGXX_SMUX_CTRL (index, xi.interface), + cvmx_bgxx_smux_ctrl_t, rx_idle, ==, 1, 10000) || +CVMX_WAIT_FOR_FIELD64_NODE ( + node,CVMX_BGXX_SMUX_CTRL (index, xi.interface), + cvmx_bgxx_smux_ctrl_t, tx_idle, ==, 1, 10000)) { +printf ("ERROR: %s: XAUI: Timeout waiting for port %u:%d/%d to stop\n" , + __func__, node, xi.interface, index); +return -1 ; + } + } +return 0 ; +} + +int cvmx_bgx_set_pause_pkt_param (int xipd_port,u64 smac,u64 dmac, +unsigned int type,unsigned int time, +unsigned int interval) +{ +int node, xiface, iface, index, mode; +struct cvmx_xiface xi; + + xiface =cvmx_helper_get_interface_num (xipd_port); + xi =cvmx_helper_xiface_to_node_interface (xiface); + +if (xi.interface >=CVMX_HELPER_MAX_GMX ) +return 0 ; + + node = xi.node;
Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.35.1
Part of the diff is not shown here. View the raw message.
PATCH 11/52 mips: octeon: Add cvmx-helper-board.c
In reply to Stefan RoeseFrom: Aaron Williams <[email protected]>
Import cvmx-helper-board.c from 2013 U-Boot. It will be used by the later added drivers to support networking on the MIPS Octeon II / III platforms.
--- arch/mips/mach-octeon/cvmx-helper-board.c | 2030 +++++++++++++++++++++ 1 file changed, 2030 insertions(+) create mode 100644 arch/mips/mach-octeon/cvmx-helper-board.c
arch/mips/mach-octeon/cvmx-helper-board.c new file +2030 -0
@@ -0,0 +1,2030 @@ +// SPDX-License-Identifier: GPL-2.0 +/* +* Copyright (C) 2018-2022 Marvell International Ltd. +* +* Helper functions to abstract board specific data about +* network ports from the rest of the cvmx-helper files. +*/ + +#include <i2c.h> +#include <log.h> +#include <malloc.h> +#include <net.h> +#include <linux/delay.h> + +#include <mach/cvmx-regs.h> +#include <mach/cvmx-csr.h> +#include <mach/cvmx-bootmem.h> +#include <mach/octeon-model.h> +#include <mach/octeon_fdt.h> +#include <mach/cvmx-helper.h> +#include <mach/cvmx-helper-board.h> +#include <mach/cvmx-helper-cfg.h> +#include <mach/cvmx-helper-fdt.h> +#include <mach/cvmx-helper-gpio.h> + +#include <mach/cvmx-smix-defs.h> +#include <mach/cvmx-mdio.h> +#include <mach/cvmx-qlm.h> + +DECLARE_GLOBAL_DATA_PTR ; + +static bool sfp_parsed; + +static int __cvmx_helper_78xx_parse_phy (struct cvmx_phy_info *phy_info, +int ipd_port); +static int __get_phy_info_from_dt (cvmx_phy_info_t *phy_info,int ipd_port); + +/** +* Writes to a Microsemi VSC7224 16-bit register +* +* @param[in] i2c_bus i2c bus data structure (must be enabled) +* @param addr Address of VSC7224 on the i2c bus +* @param reg 8-bit register number to write to +* @param val 16-bit value to write +* +* @return 0 for success +*/ +static int cvmx_write_vsc7224_reg (const struct cvmx_fdt_i2c_bus_info *i2c_bus, +u8 addr,u8 reg,u16 val) +{ +struct udevice *dev; +u8 buffer[2 ]; +int ret; + + ret =i2c_get_chip (i2c_bus->i2c_bus, addr,1 , &dev); +if (ret) { +debug ("Cannot find I2C device: %d\n" , ret); +return -1 ; + } + + ret =dm_i2c_write (dev, reg, buffer,2 ); +if (ret) { +debug ("Cannot write I2C device: %d\n" , ret); +return -1 ; + } + +return 0 ; +} + +/** +* Writes to a Microsemi VSC7224 16-bit register +* +* @param[in] i2c_bus i2c bus data structure (must be enabled) +* @param addr Address of VSC7224 on the i2c bus +* @param reg 8-bit register number to write to +* +* @return 16-bit value or error if < 0 +*/ +static int cvmx_read_vsc7224_reg (const struct cvmx_fdt_i2c_bus_info *i2c_bus, +u8 addr,u8 reg) +{ +struct udevice *dev; +u8 buffer[2 ]; +int ret; + + ret =i2c_get_chip (i2c_bus->i2c_bus, addr,1 , &dev); +if (ret) { +debug ("Cannot find I2C device: %d\n" , ret); +return -1 ; + } + + ret =dm_i2c_read (dev, reg, buffer,2 ); +if (ret) { +debug ("Cannot read I2C device: %d\n" , ret); +return -1 ; + } + +return (buffer[0 ] <<8 ) | buffer[1 ]; +} + +/** +* @INTERNAL +* Return loss of signal +* +* @param xiface xinterface number +* @param index port index on interface +* +* @return 0 if signal present, 1 if loss of signal. +* +* @NOTE: A result of 0 is possible in some cases where the signal is +* not present. +* +* This is for use with __cvmx_qlm_rx_equilization +*/ +int __cvmx_helper_get_los (int xiface,int index) +{ +struct cvmx_fdt_sfp_info *sfp; +struct cvmx_vsc7224_chan *vsc7224_chan; +struct cvmx_vsc7224 *vsc7224; +int los =0 ; +int val; +int mode =cvmx_helper_interface_get_mode (xiface); + + sfp =cvmx_helper_cfg_get_sfp_info (xiface, index); + +/* Check all SFP slots in the group +* NOTE: Usually there is only one SFP or QSFP slot except in the case +* where multiple SFP+ slots are grouped together for XLAUI mode. +*/ +while (sfp && sfp->check_mod_abs) { + los = sfp->check_mod_abs (sfp, sfp->mod_abs_data); +if (los >=0 ) +cvmx_sfp_validate_module (sfp, mode); +if (los || los <0 ) { +debug ("%s(0x%x, %d): los detected (mod_abs) los: %d\n" , + __func__, xiface, index, los); +return 1 ; + } + vsc7224_chan = sfp->vsc7224_chan; +while (vsc7224_chan) { +u64 done; +int channel_num = vsc7224_chan->lane; +int los_bit =1 << channel_num; +int lol_bit =0x10 << channel_num; + +/* We only care about receive channels so skip rx. +* Also, in XFI mode we don't care about different +* XFI ports so skip those. +*/ +if (vsc7224_chan->is_tx || + vsc7224_chan->index != index || + vsc7224_chan->xiface != xiface) { + vsc7224_chan = vsc7224_chan->next; +continue ; + } + + vsc7224 = vsc7224_chan->vsc7224; +/* Poll for LoS/LoL for 2ms */ +cvmx_write_vsc7224_reg (vsc7224->i2c_bus, + vsc7224->i2c_addr,0x7f ,0x40 ); + done =20 ; +do { + val =cvmx_read_vsc7224_reg (vsc7224->i2c_bus, + vsc7224->i2c_addr, +0xc0 ); + val &= (los_bit | lol_bit); +if (val) { +debug ("%s(0x%x, %d): LOS/LOL detected from VSC7224: 0x%x\n" , + __func__, xiface, index, val); +return 1 ; + } +udelay (100 ); + }while (done--); + +/* Move to the next channel */ + vsc7224_chan = vsc7224_chan->next; + } +/* Move to the next SFP+ slot */ + sfp = sfp->next; + } +debug ("%s(0x%x, %d): los: 0\n" , __func__, xiface, index); +return 0 ; +} + +/** +* Function called whenever mod_abs/mod_prs has changed for Microsemi VSC7224 +* +* @param sfp pointer to SFP data structure +* @param val 1 if absent, 0 if present, otherwise not set +* @param data user-defined data +* +* @return 0 for success, -1 on error +*/ +int cvmx_sfp_vsc7224_mod_abs_changed (struct cvmx_fdt_sfp_info *sfp,int val, +void *data) +{ +int err; +struct cvmx_sfp_mod_info *mod_info; +int length; +struct cvmx_vsc7224 *vsc7224; +struct cvmx_vsc7224_chan *vsc7224_chan; +struct cvmx_vsc7224_tap *taps, *match =NULL ; +int i; + +debug ("%s(%s, %d, %p): Module %s\n" , __func__, sfp->name, val, data, + val ?"absent" :"present" ); +if (val) +return 0 ; + +/* We're here if we detect that the module is now present */ + err =cvmx_sfp_read_i2c_eeprom (sfp); +if (err) { +debug ("%s: Error reading the SFP module eeprom for %s\n" , + __func__, sfp->name); +return err; + } + mod_info = &sfp->sfp_info; + +if (!mod_info->valid || !sfp->valid) { +debug ("%s: Module data is invalid\n" , __func__); +return -1 ; + } + + vsc7224_chan = sfp->vsc7224_chan; +while (vsc7224_chan) { +/* We don't do any rx tuning */ +if (!vsc7224_chan->is_tx) { + vsc7224_chan = vsc7224_chan->next; +continue ; + } + +/* Walk through all the channels */ + taps = vsc7224_chan->taps; +if (mod_info->limiting) + length =0 ; +else + length = mod_info->max_copper_cable_len; +debug ("%s: limiting: %d, length: %d\n" , __func__, + mod_info->limiting, length); + +/* Find a matching length in the taps table */ +for (i =0 ; i < vsc7224_chan->num_taps; i++) { +if (length >= taps->len) + match = taps; + taps++; + } +if (!match) { +debug ("%s(%s, %d, %p): Error: no matching tap for length %d\n" , + __func__, sfp->name, val, data, length); +return -1 ; + } +debug ("%s(%s): Applying %cx taps to vsc7224 %s:%d for cable length %d+\n" , + __func__, sfp->name, vsc7224_chan->is_tx ?'t' :'r' , + vsc7224_chan->vsc7224->name, vsc7224_chan->lane, + match->len); +/* Program the taps */ + vsc7224 = vsc7224_chan->vsc7224; +cvmx_write_vsc7224_reg (vsc7224->i2c_bus, vsc7224->i2c_addr, +0x7f , vsc7224_chan->lane); +if (!vsc7224_chan->maintap_disable) +cvmx_write_vsc7224_reg (vsc7224->i2c_bus, + vsc7224->i2c_addr,0x99 , + match->main_tap); +if (!vsc7224_chan->pretap_disable) +cvmx_write_vsc7224_reg (vsc7224->i2c_bus, + vsc7224->i2c_addr,0x9a , + match->pre_tap); +if (!vsc7224_chan->posttap_disable) +cvmx_write_vsc7224_reg (vsc7224->i2c_bus, + vsc7224->i2c_addr,0x9b , + match->post_tap); + +/* Re-use val and disable taps if needed */ +if (vsc7224_chan->maintap_disable || + vsc7224_chan->pretap_disable || + vsc7224_chan->posttap_disable) { + val =cvmx_read_vsc7224_reg (vsc7224->i2c_bus, + vsc7224->i2c_addr,0x97 ); +if (vsc7224_chan->maintap_disable) + val |=0x800 ; +if (vsc7224_chan->pretap_disable) + val |=0x1000 ; +if (vsc7224_chan->posttap_disable) + val |=0x400 ; +cvmx_write_vsc7224_reg (vsc7224->i2c_bus, + vsc7224->i2c_addr,0x97 , val); + } + vsc7224_chan = vsc7224_chan->next; + } + +return err; +} + +/** +* Update the mod_abs and error LED +* +* @param ipd_port ipd port number +* @param link link information +*/ +static void __cvmx_helper_update_sfp (int ipd_port, +struct cvmx_fdt_sfp_info *sfp_info, +cvmx_helper_link_info_t link) +{ +debug ("%s(%d): checking mod_abs\n" , __func__, ipd_port); + +cvmx_sfp_check_mod_abs (sfp_info, sfp_info->mod_abs_data); +} + +static void cvmx_sfp_update_link (struct cvmx_fdt_sfp_info *sfp, +cvmx_helper_link_info_t link) +{ +while (sfp) { +debug ("%s(%s): checking mod_abs\n" , __func__, sfp->name); +if (link.s.link_up && sfp->last_mod_abs) +cvmx_sfp_check_mod_abs (sfp, sfp->mod_abs_data); + sfp = sfp->next_iface_sfp; + } +} + +/** +* @INTERNAL +* This function is used ethernet ports link speed. This functions uses the +* device tree information to determine the phy address and type of PHY. +* The only supproted PHYs are Marvell and Broadcom. +* +* @param ipd_port IPD input port associated with the port we want to get link +* status for. +* +* @return The ports link status. If the link isn't fully resolved, this must +* return zero. +*/ +cvmx_helper_link_info_t __cvmx_helper_board_link_get_from_dt (int ipd_port) +{ +cvmx_helper_link_info_t result; +cvmx_phy_info_t *phy_info =NULL ; +cvmx_phy_info_t local_phy_info; +int xiface =0 , index =0 ; +bool use_inband = false; +struct cvmx_fdt_sfp_info *sfp_info; + const void *fdt_addr = CASTPTR(const void *, gd->fdt_blob); + + result.u64 =0 ; + +if (ipd_port >=0 ) { +int mode; + + xiface =cvmx_helper_get_interface_num (ipd_port); + index =cvmx_helper_get_interface_index_num (ipd_port); + mode =cvmx_helper_interface_get_mode (xiface); +if (!cvmx_helper_get_port_autonegotiation (xiface, index)) { + result.s.link_up =1 ; + result.s.full_duplex =1 ; +switch (mode) { +case CVMX_HELPER_INTERFACE_MODE_RGMII : +case CVMX_HELPER_INTERFACE_MODE_GMII : +case CVMX_HELPER_INTERFACE_MODE_SGMII : +case CVMX_HELPER_INTERFACE_MODE_QSGMII : +case CVMX_HELPER_INTERFACE_MODE_AGL : +case CVMX_HELPER_INTERFACE_MODE_SPI : +if (OCTEON_IS_MODEL (OCTEON_CN70XX )) { +struct cvmx_xiface xi = +cvmx_helper_xiface_to_node_interface ( + xiface); +u64 gbaud =cvmx_qlm_get_gbaud_mhz (0 ); + + result.s.speed = gbaud *8 /10 ; +if (cvmx_qlm_get_dlm_mode ( +0 , xi.interface) == +CVMX_QLM_MODE_SGMII ) + result.s.speed >>=1 ; +else + result.s.speed >>=2 ; + }else { + result.s.speed =1000 ; + } +break ; +case CVMX_HELPER_INTERFACE_MODE_RXAUI : +case CVMX_HELPER_INTERFACE_MODE_XAUI : +case CVMX_HELPER_INTERFACE_MODE_10G_KR : +case CVMX_HELPER_INTERFACE_MODE_XFI : + result.s.speed =10000 ; +break ; +case CVMX_HELPER_INTERFACE_MODE_XLAUI : +case CVMX_HELPER_INTERFACE_MODE_40G_KR4 : + result.s.speed =40000 ; +break ; +default : +break ; + } + + sfp_info =cvmx_helper_cfg_get_sfp_info (xiface, index); +/* Initialize the SFP info if it hasn't already been +* done. +*/ +if (!sfp_info && !sfp_parsed) { +cvmx_sfp_parse_device_tree (fdt_addr); + sfp_parsed = true; +cvmx_sfp_read_all_modules (); + sfp_info =cvmx_helper_cfg_get_sfp_info (xiface, + index); + } +/* If the link is down or the link is up but we still +* register the module as being absent, re-check +* mod_abs. +*/ +cvmx_sfp_update_link (sfp_info, result); + +cvmx_helper_update_link_led (xiface, index, result); + +return result; + } + phy_info =cvmx_helper_get_port_phy_info (xiface, index); +if (!phy_info) { +debug ("%s: phy info not saved in config, allocating for 0x%x:%d\n" , + __func__, xiface, index); + + phy_info = (cvmx_phy_info_t *)cvmx_bootmem_alloc ( +sizeof (*phy_info),0 ); +if (!phy_info) { +debug ("%s: Out of memory\n" , __func__); +return result; + } +memset (phy_info,0 ,sizeof (*phy_info)); + phy_info->phy_addr =-1 ; +debug ("%s: Setting phy info for 0x%x:%d to %p\n" , + __func__, xiface, index, phy_info); +cvmx_helper_set_port_phy_info (xiface, index, phy_info); + } + }else { +/* For management ports we don't store the PHY information +* so we use a local copy instead. +*/ + phy_info = &local_phy_info; +memset (phy_info,0 ,sizeof (*phy_info)); + phy_info->phy_addr =-1 ; + } + +if (phy_info->phy_addr ==-1 ) { +if (octeon_has_feature (OCTEON_FEATURE_BGX )) { +if (__cvmx_helper_78xx_parse_phy (phy_info, ipd_port)) { + phy_info->phy_addr =-1 ; + use_inband = true; + } + }else if (__get_phy_info_from_dt (phy_info, ipd_port) <0 ) { + phy_info->phy_addr =-1 ; + use_inband = true; + } + } + +/* If we can't get the PHY info from the device tree then try +* the inband state. +*/ +if (use_inband) { + result.s.full_duplex =1 ; + result.s.link_up =1 ; + result.s.speed =1000 ; +return result; + } + +if (phy_info->phy_addr <0 ) +return result; + +if (phy_info->link_function) + result = phy_info->link_function (phy_info); +else + result =cvmx_helper_link_get (ipd_port); + + sfp_info =cvmx_helper_cfg_get_sfp_info (xiface, index); +while (sfp_info) { +/* If the link is down or the link is up but we still register +* the module as being absent, re-check mod_abs. +*/ +if (!result.s.link_up || + (result.s.link_up && sfp_info->last_mod_abs)) +__cvmx_helper_update_sfp (ipd_port, sfp_info, result); + sfp_info = sfp_info->next_iface_sfp; + } + +return result; +} + +cvmx_helper_link_info_t __cvmx_helper_board_link_get (int ipd_port) +{ +cvmx_helper_link_info_t result; + +/* Unless we fix it later, all links are defaulted to down */ + result.u64 =0 ; + +return __cvmx_helper_board_link_get_from_dt (ipd_port); +} + +void cvmx_helper_update_link_led (int xiface,int index, +cvmx_helper_link_info_t result) +{ +} + +void cvmx_helper_leds_show_error (struct cvmx_phy_gpio_leds *leds,bool error) +{ +} + +int __cvmx_helper_board_interface_probe (int interface,int supported_ports) +{ +return supported_ports; +} + +/** +* Returns the Ethernet node offset in the device tree +* +* @param fdt_addr - pointer to flat device tree in memory +* @param aliases - offset of alias in device tree +* @param ipd_port - ipd port number to look up +* +* @returns offset of Ethernet node if >= 0, error if -1 +*/ +int __pip_eth_node (const void *fdt_addr,int aliases,int ipd_port) +{ +char name_buffer[20 ]; +const char *pip_path; +int pip, iface, eth; +int interface_num =cvmx_helper_get_interface_num (ipd_port); +int interface_index =cvmx_helper_get_interface_index_num (ipd_port); +cvmx_helper_interface_mode_t interface_mode = +cvmx_helper_interface_get_mode (interface_num); + +/* The following are not found in the device tree */ +switch (interface_mode) { +case CVMX_HELPER_INTERFACE_MODE_ILK : +case CVMX_HELPER_INTERFACE_MODE_LOOP : +case CVMX_HELPER_INTERFACE_MODE_SRIO : +debug ("ERROR: No node expected for interface: %d, port: %d, mode: %s\n" , + interface_index, ipd_port, +cvmx_helper_interface_mode_to_string (interface_mode)); +return -1 ; +default : +break ; + } + pip_path = (const char *)fdt_getprop (fdt_addr, aliases,"pip" ,NULL ); +if (!pip_path) { +debug ("ERROR: pip path not found in device tree\n" ); +return -1 ; + } + pip =fdt_path_offset (fdt_addr, pip_path); +debug ("ipdd_port=%d pip_path=%s pip=%d " , ipd_port, pip_path, pip); +if (pip <0 ) { +debug ("ERROR: pip not found in device tree\n" ); +return -1 ; + } +snprintf (name_buffer,sizeof (name_buffer),"interface@%d" , + interface_num); + iface =fdt_subnode_offset (fdt_addr, pip, name_buffer); +debug ("iface=%d " , iface); +if (iface <0 ) { +debug ("ERROR : pip intf %d not found in device tree\n" , + interface_num); +return -1 ; + } +snprintf (name_buffer,sizeof (name_buffer),"ethernet@%x" , + interface_index); + eth =fdt_subnode_offset (fdt_addr, iface, name_buffer); +debug ("eth=%d\n" , eth); +if (eth <0 ) { +debug ("ERROR : pip interface@%d ethernet@%d not found in device tree\n" , + interface_num, interface_index); +return -1 ; + } +return eth; +} + +int __mix_eth_node (const void *fdt_addr,int aliases,int interface_index) +{ +char name_buffer[20 ]; +const char *mix_path; +int mix; + +snprintf (name_buffer,sizeof (name_buffer),"mix%d" , interface_index); + mix_path = + (const char *)fdt_getprop (fdt_addr, aliases, name_buffer,NULL ); +if (!mix_path) { +debug ("ERROR: mix%d path not found in device tree\n" , + interface_index); + } + mix =fdt_path_offset (fdt_addr, mix_path); +if (mix <0 ) { +debug ("ERROR: %s not found in device tree\n" , mix_path); +return -1 ; + } +return mix; +} + +static int __mdiobus_addr_to_unit (u32 addr) +{ +int unit = (addr >>7 ) &3 ; + +if (!OCTEON_IS_MODEL (OCTEON_CN68XX ) && !OCTEON_IS_MODEL (OCTEON_CN78XX )) + unit >>=1 ; +return unit; +} + +/** +* Parse the muxed MDIO interface information from the device tree +* +* @param phy_info - pointer to phy info data structure to update +* @param mdio_offset - offset of MDIO bus +* @param mux_offset - offset of MUX, parent of mdio_offset +* +* @return 0 for success or -1 +*/ +static int __get_muxed_mdio_info_from_dt (cvmx_phy_info_t *phy_info, +int mdio_offset,int mux_offset) +{ + const void *fdt_addr = CASTPTR(const void *, gd->fdt_blob); +int phandle; +int smi_offset; +int gpio_offset; +u64 smi_addr =0 ; +int len; +u32 *pgpio_handle; +int gpio_count =0 ; +u32 *prop_val; +int offset; +const char *prop_name; + +debug ("%s(%p, 0x%x, 0x%x)\n" , __func__, phy_info, mdio_offset, + mux_offset); + +/* Get register value to put onto the GPIO lines to select */ + phy_info->gpio_value = +cvmx_fdt_get_int (fdt_addr, mdio_offset,"reg" ,-1 ); +if (phy_info->gpio_value <0 ) { +debug ("Could not get register value for muxed MDIO bus from DT\n" ); +return -1 ; + } + + smi_offset =cvmx_fdt_lookup_phandle (fdt_addr, mux_offset, +"mdio-parent-bus" ); +if (smi_offset <0 ) { +debug ("Invalid SMI offset for muxed MDIO interface in device tree\n" ); +return -1 ; + } + smi_addr =cvmx_fdt_get_uint64 (fdt_addr, smi_offset,"reg" ,0 ); + +/* Convert SMI address to a MDIO interface */ +switch (smi_addr) { +case 0x1180000001800 : +case 0x1180000003800 :/* 68XX address */ + phy_info->mdio_unit =0 ; +break ; +case 0x1180000001900 : +case 0x1180000003880 : + phy_info->mdio_unit =1 ; +break ; +case 0x1180000003900 : + phy_info->mdio_unit =2 ; +break ; +case 0x1180000003980 : + phy_info->mdio_unit =3 ; +break ; +default : + phy_info->mdio_unit =1 ; +break ; + } +/* Find the GPIO MUX controller */ + pgpio_handle = + (u32 *)fdt_getprop (fdt_addr, mux_offset,"gpios" , &len); +if (!pgpio_handle || len <12 || (len %12 ) !=0 || + len >CVMX_PHY_MUX_MAX_GPIO *12 ) { +debug ("Invalid GPIO for muxed MDIO controller in DT\n" ); +return -1 ; + } + +for (gpio_count =0 ; gpio_count < len /12 ; gpio_count++) { + phandle =fdt32_to_cpu (pgpio_handle[gpio_count *3 ]); + phy_info->gpio[gpio_count] = +fdt32_to_cpu (pgpio_handle[gpio_count *3 +1 ]); + gpio_offset =fdt_node_offset_by_phandle (fdt_addr, phandle); +if (gpio_offset <0 ) { +debug ("Cannot access parent GPIO node in DT\n" ); +return -1 ; + } +if (!fdt_node_check_compatible (fdt_addr, gpio_offset, +"cavium,octeon-3860-gpio" )) { + phy_info->gpio_type[gpio_count] =GPIO_OCTEON ; + }else if (!fdt_node_check_compatible (fdt_addr, gpio_offset, +"nxp,pca8574" )) { +/* GPIO is a TWSI GPIO unit which might sit behind +* another mux. +*/ + phy_info->gpio_type[gpio_count] =GPIO_PCA8574 ; + prop_val = (u32 *)fdt_getprop ( + fdt_addr, gpio_offset,"reg" ,NULL ); +if (!prop_val) { +debug ("Could not find TWSI address of npx pca8574 GPIO from DT\n" ); +return -1 ; + } +/* Get the TWSI address of the GPIO unit */ + phy_info->cvmx_gpio_twsi[gpio_count] = +fdt32_to_cpu (*prop_val); +/* Get the selector on the GPIO mux if present */ + offset =fdt_parent_offset (fdt_addr, gpio_offset); + prop_val = (u32 *)fdt_getprop (fdt_addr, offset, +"reg" ,NULL ); +if (prop_val) { + phy_info->gpio_parent_mux_select = +fdt32_to_cpu (*prop_val); +/* Go up another level */ + offset =fdt_parent_offset (fdt_addr, offset); +if (!fdt_node_check_compatible (fdt_addr, offset, +"nxp,pca9548" )) { + prop_val = (u32 *)fdt_getprop ( + fdt_addr, offset,"reg" ,NULL ); +if (!prop_val) { +debug ("Could not read MUX TWSI address from DT\n" ); +return -1 ; + } + phy_info->gpio_parent_mux_twsi = +fdt32_to_cpu (*prop_val); + } + } + }else { + prop_name = (char *)fdt_getprop (fdt_addr, gpio_offset, +"compatible" ,NULL ); +debug ("Unknown GPIO type %s\n" , prop_name); +return -1 ; + } + } +return 0 ; +} + +/** +* @INTERNAL +* Converts a BGX address to the node, interface and port number +* +* @param bgx_addr Address of CSR register +* +* @return node, interface and port number, will be -1 for invalid address. +*/ +static struct cvmx_xiface __cvmx_bgx_reg_addr_to_xiface (u64 bgx_addr) +{ +struct cvmx_xiface xi = {-1 ,-1 }; + + xi.node =cvmx_csr_addr_to_node (bgx_addr); + bgx_addr =cvmx_csr_addr_strip_node (bgx_addr); +if ((bgx_addr &0xFFFFFFFFF0000000 ) !=0x00011800E0000000 ) { +debug ("%s: Invalid BGX address 0x%llx\n" , __func__, + (unsigned long long )bgx_addr); + xi.node =-1 ; +return xi; + } + xi.interface = (bgx_addr >>24 ) &0x0F ; + +return xi; +} + +static cvmx_helper_link_info_t +__get_marvell_phy_link_state (cvmx_phy_info_t *phy_info) +{ +cvmx_helper_link_info_t result; +int phy_status; +u32 phy_addr = phy_info->phy_addr; + + result.u64 =0 ; +/* Set to page 0 */ +cvmx_mdio_write (phy_addr >>8 , phy_addr &0xff ,22 ,0 ); +/* All the speed information can be read from register 17 in one go. */ + phy_status =cvmx_mdio_read (phy_addr >>8 , phy_addr &0xff ,17 ); + +/* If the resolve bit 11 isn't set, see if autoneg is turned off +* (bit 12, reg 0). The resolve bit doesn't get set properly when +* autoneg is off, so force it +*/ +if ((phy_status & (1 <<11 )) ==0 ) { +int auto_status = +cvmx_mdio_read (phy_addr >>8 , phy_addr &0xff ,0 ); +if ((auto_status & (1 <<12 )) ==0 ) + phy_status |=1 <<11 ; + } + +/* Link is up = Speed/Duplex Resolved + RT-Link Up + G-Link Up. */ +if ((phy_status &0x0c08 ) ==0x0c08 ) { + result.s.link_up =1 ; + result.s.full_duplex = ((phy_status >>13 ) &1 ); +switch ((phy_status >>14 ) &3 ) { +case 0 :/* 10 Mbps */ + result.s.speed =10 ; +break ; +case 1 :/* 100 Mbps */ + result.s.speed =100 ; +break ; +case 2 :/* 1 Gbps */ + result.s.speed =1000 ; +break ; +case 3 :/* Illegal */ + result.u64 =0 ; +break ; + } + } +return result; +} + +/** +* @INTERNAL +* Get link state of broadcom PHY +* +* @param phy_info PHY information +*/ +static cvmx_helper_link_info_t +__get_broadcom_phy_link_state (cvmx_phy_info_t *phy_info) +{ +cvmx_helper_link_info_t result; +u32 phy_addr = phy_info->phy_addr; +int phy_status; + + result.u64 =0 ; +/* Below we are going to read SMI/MDIO register 0x19 which works +* on Broadcom parts +*/ + phy_status =cvmx_mdio_read (phy_addr >>8 , phy_addr &0xff ,0x19 ); +switch ((phy_status >>8 ) &0x7 ) { +case 0 : + result.u64 =0 ; +break ; +case 1 : + result.s.link_up =1 ; + result.s.full_duplex =0 ; + result.s.speed =10 ; +break ; +case 2 : + result.s.link_up =1 ; + result.s.full_duplex =1 ; + result.s.speed =10 ; +break ; +case 3 : + result.s.link_up =1 ; + result.s.full_duplex =0 ; + result.s.speed =100 ; +break ; +case 4 : + result.s.link_up =1 ; + result.s.full_duplex =1 ; + result.s.speed =100 ; +break ; +case 5 : + result.s.link_up =1 ; + result.s.full_duplex =1 ; + result.s.speed =100 ; +break ; +case 6 : + result.s.link_up =1 ; + result.s.full_duplex =0 ; + result.s.speed =1000 ; +break ; +case 7 : + result.s.link_up =1 ; + result.s.full_duplex =1 ; + result.s.speed =1000 ; +break ; + } +return result; +} + +/** +* @INTERNAL +* Get link state of generic gigabit PHY +* +* @param phy_info - information about the PHY +* +* @returns link status of the PHY +*/ +static cvmx_helper_link_info_t +__cvmx_get_generic_8023_c22_phy_link_state (cvmx_phy_info_t *phy_info) +{ +cvmx_helper_link_info_t result; +u32 phy_addr = phy_info->phy_addr; +int phy_basic_control;/* Register 0x0 */ +int phy_basic_status;/* Register 0x1 */ +int phy_anog_adv;/* Register 0x4 */ +int phy_link_part_avail;/* Register 0x5 */ +int phy_control;/* Register 0x9 */ +int phy_status;/* Register 0xA */ + + result.u64 =0 ; + + phy_basic_status =cvmx_mdio_read (phy_addr >>8 , phy_addr &0xff ,1 ); +if (!(phy_basic_status &0x4 ))/* Check if link is up */ +return result;/* Link is down, return link down */ + + result.s.link_up =1 ; + phy_basic_control =cvmx_mdio_read (phy_addr >>8 , phy_addr &0xff ,0 ); +/* Check if autonegotiation is enabled and completed */ +if ((phy_basic_control & (1 <<12 )) && (phy_basic_status & (1 <<5 ))) { + phy_status = +cvmx_mdio_read (phy_addr >>8 , phy_addr &0xff ,0xA ); + phy_control = +cvmx_mdio_read (phy_addr >>8 , phy_addr &0xff ,0x9 ); + + phy_status &= phy_control <<2 ; + phy_link_part_avail = +cvmx_mdio_read (phy_addr >>8 , phy_addr &0xff ,0x5 ); + phy_anog_adv = +cvmx_mdio_read (phy_addr >>8 , phy_addr &0xff ,0x4 ); + phy_link_part_avail &= phy_anog_adv; + +if (phy_status &0xC00 ) {/* Gigabit full or half */ + result.s.speed =1000 ; + result.s.full_duplex = !!(phy_status &0x800 ); + }else if (phy_link_part_avail & +0x0180 ) {/* 100 full or half */ + result.s.speed =100 ; + result.s.full_duplex = !!(phy_link_part_avail &0x100 ); + }else if (phy_link_part_avail &0x0060 ) { + result.s.speed =10 ; + result.s.full_duplex = !!(phy_link_part_avail &0x0040 ); + } + }else { +/* Not autonegotiated */ + result.s.full_duplex = !!(phy_basic_control & (1 <<8 )); + +if (phy_basic_control & (1 <<6 )) + result.s.speed =1000 ; +else if (phy_basic_control & (1 <<13 )) + result.s.speed =100 ; +else + result.s.speed =10 ; + } +return result; +} + +static cvmx_helper_link_info_t +__cvmx_get_qualcomm_s17_phy_link_state (cvmx_phy_info_t *phy_info) +{ +cvmx_helper_link_info_t result; +u32 phy_addr = phy_info->phy_addr; +int phy_status; +int auto_status; + + result.u64 =0 ; + + phy_status =cvmx_mdio_read (phy_addr >>8 , phy_addr &0xff ,17 ); + +/* If bit 11 isn't set see if autonegotiation is turned off +* (bit 12, reg 0). The resolved bit doesn't get set properly when +* autonegotiation is off, so force it. +*/ +if ((phy_status & (1 <<11 )) ==0 ) { + auto_status =cvmx_mdio_read (phy_addr >>8 , phy_addr &0xff ,0 ); +if ((auto_status & (1 <<12 )) ==0 ) + phy_status |=1 <<11 ; + } +/* Only return a link if the PHY has finished autonegotiation and set +* the resolved bit (bit 11). +*/ +if (phy_status & (1 <<11 )) { + result.s.link_up =1 ; + result.s.full_duplex = !!(phy_status & (1 <<13 )); +switch ((phy_status >>14 ) &3 ) { +case 0 :/* 10Mbps */ + result.s.speed =10 ; +break ; +case 1 :/* 100Mbps */ + result.s.speed =100 ; +break ; +case 2 :/* 1Gbps */ + result.s.speed =1000 ; +break ; +default :/* Illegal */ + result.u64 =0 ; +break ; + } + } +debug (" link: %s, duplex: %s, speed: %lu\n" , + result.s.link_up ?"up" :"down" , + result.s.full_duplex ?"full" :"half" , + (unsigned long )result.s.speed); +return result; +} + +static cvmx_helper_link_info_t +__get_generic_8023_c45_phy_link_state (cvmx_phy_info_t *phy_info) +{ +cvmx_helper_link_info_t result; +int phy_status; +int pma_ctrl1; +u32 phy_addr = phy_info->phy_addr; + + result.u64 =0 ; + pma_ctrl1 =cvmx_mdio_45_read (phy_addr >>8 , phy_addr &0xff ,1 ,0 ); +if ((pma_ctrl1 &0x207c ) ==0x2040 ) + result.s.speed =10000 ; +/* PMA Status 1 (1x0001) */ + phy_status =cvmx_mdio_45_read (phy_addr >>8 , phy_addr &0xff ,1 ,0xa ); +if (phy_status <0 ) +return result; + + result.s.full_duplex =1 ; +if ((phy_status &1 ) ==0 ) +return result; + phy_status =cvmx_mdio_45_read (phy_addr >>8 , phy_addr &0xff ,4 ,0x18 ); +if (phy_status <0 ) +return result; + result.s.link_up = (phy_status &0x1000 ) ?1 :0 ; + +return result; +} + +static cvmx_helper_link_info_t +__cvmx_get_cortina_phy_link_state (cvmx_phy_info_t *phy_info) +{ +cvmx_helper_link_info_t result; + + result.s.link_up =1 ; + result.s.full_duplex =1 ; + result.s.speed =1000 ; +return result; +} + +static cvmx_helper_link_info_t +__get_vitesse_vsc8490_phy_link_state (cvmx_phy_info_t *phy_info) +{ +cvmx_helper_link_info_t result; + + result.s.link_up =1 ; + result.s.full_duplex =1 ; + result.s.speed =1000 ; +return result; +} + +static cvmx_helper_link_info_t +__get_aquantia_phy_link_state (cvmx_phy_info_t *phy_info) +{ +cvmx_helper_link_info_t result; + + result.s.link_up =1 ; + result.s.full_duplex =1 ; + result.s.speed =1000 ; +return result; +} + +static int __cvmx_helper_78xx_parse_phy (struct cvmx_phy_info *phy_info, +int ipd_port) +{ + const void *fdt_addr = CASTPTR(const void *, gd->fdt_blob); +const char *compat; +int phy; +int parent; +u64 mdio_base; +int node, bus; +int phy_addr; +int index =cvmx_helper_get_interface_index_num (ipd_port); +int xiface =cvmx_helper_get_interface_num (ipd_port); +int compat_len =0 ; + +debug ("%s(0x%p, %d) ENTER\n" , __func__, phy_info, ipd_port); + + phy =cvmx_helper_get_phy_fdt_node_offset (xiface, index); +debug ("%s: xiface: 0x%x, index: %d, ipd_port: %d, phy fdt offset: %d\n" , + __func__, xiface, index, ipd_port, phy); +if (phy <0 ) { +/* If this is the first time through we need to first parse the +* device tree to get the node offsets. +*/ +debug ("No config present, calling __cvmx_helper_parse_bgx_dt\n" ); +if (__cvmx_helper_parse_bgx_dt (fdt_addr)) { +printf ("Error: could not parse BGX device tree\n" ); +return -1 ; + } +if (__cvmx_fdt_parse_vsc7224 (fdt_addr)) { +debug ("Error: could not parse Microsemi VSC7224 in DT\n" ); +return -1 ; + } +if (octeon_has_feature (OCTEON_FEATURE_BGX_XCV ) && +__cvmx_helper_parse_bgx_rgmii_dt (fdt_addr)) { +printf ("Error: could not parse BGX XCV device tree\n" ); +return -1 ; + } + phy =cvmx_helper_get_phy_fdt_node_offset (xiface, index); +if (phy <0 ) { +debug ("%s: Could not get PHY node offset for IPD port 0x%x, xiface: 0x%x, index: %d\n" , + __func__, ipd_port, xiface, index); +return -1 ; + } +debug ("%s: phy: %d (%s)\n" , __func__, phy, +fdt_get_name (fdt_addr, phy,NULL )); + } + + compat = (const char *)fdt_getprop (fdt_addr, phy,"compatible" , + &compat_len); +if (!compat) { +printf ("ERROR: %d:%d:no compatible prop in phy\n" , xiface, + index); +return -1 ; + } + +debug (" compatible: %s\n" , compat); + + phy_info->fdt_offset = phy; + phy_addr =cvmx_fdt_get_int (fdt_addr, phy,"reg" ,-1 ); +if (phy_addr ==-1 ) { +printf ("Error: %d:%d:could not get PHY address\n" , xiface, + index); +return -1 ; + } +debug (" PHY address: %d, compat: %s\n" , phy_addr, compat); + +if (!memcmp ("marvell" , compat,strlen ("marvell" ))) { + phy_info->phy_type =MARVELL_GENERIC_PHY ; + phy_info->link_function = __get_marvell_phy_link_state; + }else if (!memcmp ("broadcom" , compat,strlen ("broadcom" ))) { + phy_info->phy_type =BROADCOM_GENERIC_PHY ; + phy_info->link_function = __get_broadcom_phy_link_state; + }else if (!memcmp ("cortina" , compat,strlen ("cortina" ))) { + phy_info->phy_type =CORTINA_PHY ; + phy_info->link_function = __cvmx_get_cortina_phy_link_state; + }else if (!strcmp ("vitesse,vsc8490" , compat)) { + phy_info->phy_type =VITESSE_VSC8490_PHY ; + phy_info->link_function = __get_vitesse_vsc8490_phy_link_state; + }else if (fdt_stringlist_contains (compat, compat_len, +"ethernet-phy-ieee802.3-c22" )) { + phy_info->phy_type =GENERIC_8023_C22_PHY ; + phy_info->link_function = + __cvmx_get_generic_8023_c22_phy_link_state; + }else if (fdt_stringlist_contains (compat, compat_len, +"ethernet-phy-ieee802.3-c45" )) { + phy_info->phy_type =GENERIC_8023_C22_PHY ; + phy_info->link_function = __get_generic_8023_c45_phy_link_state; + } + + phy_info->ipd_port = ipd_port; + phy_info->phy_sub_addr =0 ; + phy_info->direct_connect =1 ; + + parent =fdt_parent_offset (fdt_addr, phy); +if (!fdt_node_check_compatible (fdt_addr, parent, +"ethernet-phy-nexus" )) { +debug (" nexus PHY found\n" ); +if (phy_info->phy_type ==CORTINA_PHY ) { +/* The Cortina CS422X uses the same PHY device for +* multiple ports for XFI. In this case we use a +* nexus and each PHY address is the slice or +* sub-address and the actual PHY address is the +* nexus address. +*/ + phy_info->phy_sub_addr = phy_addr; + phy_addr = +cvmx_fdt_get_int (fdt_addr, parent,"reg" ,-1 ); +debug (" Cortina PHY real address: 0x%x\n" , phy_addr); + } + parent =fdt_parent_offset (fdt_addr, parent); + } + +debug (" Parent: %s\n" ,fdt_get_name (fdt_addr, parent,NULL )); +if (!fdt_node_check_compatible (fdt_addr, parent, +"cavium,octeon-3860-mdio" )) { +debug (" Found Octeon MDIO\n" ); + mdio_base =cvmx_fdt_get_uint64 (fdt_addr, parent,"reg" , +FDT_ADDR_T_NONE ); +debug (" MDIO address: 0x%llx\n" , + (unsigned long long )mdio_base); + + mdio_base =cvmx_fdt_translate_address (fdt_addr, parent, + (u32 *)&mdio_base); +debug (" Translated: 0x%llx\n" , (unsigned long long )mdio_base); +if (mdio_base ==FDT_ADDR_T_NONE ) { +printf ("Could not get MDIO base address from reg field\n" ); +return -1 ; + } +__cvmx_mdio_addr_to_node_bus (mdio_base, &node, &bus); +if (bus <0 ) { +printf ("Invalid MDIO address 0x%llx, could not detect bus and node\n" , + (unsigned long long )mdio_base); +return -1 ; + } +debug (" MDIO node: %d, bus: %d\n" , node, bus); + phy_info->mdio_unit = (node <<2 ) | (bus &3 ); + phy_info->phy_addr = phy_addr | (phy_info->mdio_unit <<8 ); + }else { +printf ("%s: Error: incompatible MDIO bus %s for IPD port %d\n" , + __func__, + (const char *)fdt_get_name (fdt_addr, parent,NULL ), + ipd_port); +return -1 ; + } + +debug ("%s: EXIT 0\n" , __func__); + +return 0 ; +} + +/** +* Return the MII PHY address associated with the given IPD +* port. The phy address is obtained from the device tree. +* +* @param[out] phy_info - PHY information data structure updated +* @param ipd_port Octeon IPD port to get the MII address for. +* +* @return MII PHY address and bus number, -1 on error, -2 if PHY info missing (OK). +*/ +static int __get_phy_info_from_dt (cvmx_phy_info_t *phy_info,int ipd_port) +{ + const void *fdt_addr = CASTPTR(const void *, gd->fdt_blob); +int aliases, eth, phy, phy_parent, ret, i; +int mdio_parent; +const char *phy_compatible_str; +const char *host_mode_str =NULL ; +int interface; +int phy_addr_offset =0 ; + +debug ("%s(%p, %d)\n" , __func__, phy_info, ipd_port); + +if (octeon_has_feature (OCTEON_FEATURE_BGX )) +return __cvmx_helper_78xx_parse_phy (phy_info, ipd_port); + + phy_info->phy_addr =-1 ; + phy_info->phy_sub_addr =0 ; + phy_info->ipd_port = ipd_port; + phy_info->direct_connect =-1 ; + phy_info->phy_type = (cvmx_phy_type_t)-1 ; +for (i =0 ; i <CVMX_PHY_MUX_MAX_GPIO ; i++) + phy_info->gpio[i] =-1 ; + phy_info->mdio_unit =-1 ; + phy_info->gpio_value =-1 ; + phy_info->gpio_parent_mux_twsi =-1 ; + phy_info->gpio_parent_mux_select =-1 ; + phy_info->link_function =NULL ; + phy_info->fdt_offset =-1 ; +if (!fdt_addr) { +debug ("No device tree found.\n" ); +return -1 ; + } + + aliases =fdt_path_offset (fdt_addr,"/aliases" ); +if (aliases <0 ) { +debug ("Error: No /aliases node in device tree.\n" ); +return -1 ; + } +if (ipd_port <0 ) { +int interface_index = + ipd_port -CVMX_HELPER_BOARD_MGMT_IPD_PORT ; + eth =__mix_eth_node (fdt_addr, aliases, interface_index); + }else { + eth =__pip_eth_node (fdt_addr, aliases, ipd_port); + } +if (eth <0 ) { +debug ("ERROR : cannot find interface for ipd_port=%d\n" , + ipd_port); +return -1 ; + } + + interface =cvmx_helper_get_interface_num (ipd_port); +/* Get handle to phy */ + phy =cvmx_fdt_lookup_phandle (fdt_addr, eth,"phy-handle" ); +if (phy <0 ) { +cvmx_helper_interface_mode_t if_mode; + +/* Note that it's OK for RXAUI and ILK to not have a PHY +* connected (i.e. EBB boards in loopback). +*/ +debug ("Cannot get phy-handle for ipd_port: %d\n" , ipd_port); + if_mode =cvmx_helper_interface_get_mode (interface); +if (if_mode !=CVMX_HELPER_INTERFACE_MODE_RXAUI && + if_mode !=CVMX_HELPER_INTERFACE_MODE_ILK ) { +debug ("ERROR : phy handle not found in device tree ipd_port=%d\n" , + ipd_port); +return -1 ; + }else { +return -2 ; + } + } + + phy_compatible_str = + (const char *)fdt_getprop (fdt_addr, phy,"compatible" ,NULL ); +if (!phy_compatible_str) { +debug ("ERROR: no compatible prop in phy\n" ); +return -1 ; + } +debug ("Checking compatible string \"%s\" for ipd port %d\n" , + phy_compatible_str, ipd_port); + phy_info->fdt_offset = phy; +if (!memcmp ("marvell" , phy_compatible_str,strlen ("marvell" ))) { +debug ("Marvell PHY detected for ipd_port %d\n" , ipd_port); + phy_info->phy_type =MARVELL_GENERIC_PHY ; + phy_info->link_function = __get_marvell_phy_link_state; + }else if (!memcmp ("broadcom" , phy_compatible_str, +strlen ("broadcom" ))) { + phy_info->phy_type =BROADCOM_GENERIC_PHY ; + phy_info->link_function = __get_broadcom_phy_link_state; +debug ("Broadcom PHY detected for ipd_port %d\n" , ipd_port); + }else if (!memcmp ("vitesse" , phy_compatible_str,strlen ("vitesse" ))) { +debug ("Vitesse PHY detected for ipd_port %d\n" , ipd_port); +if (!fdt_node_check_compatible (fdt_addr, phy, +"vitesse,vsc8490" )) { + phy_info->phy_type =VITESSE_VSC8490_PHY ; +debug ("Vitesse VSC8490 detected\n" ); + phy_info->link_function = + __get_vitesse_vsc8490_phy_link_state; + }else if (!fdt_node_check_compatible ( + fdt_addr, phy, +"ethernet-phy-ieee802.3-c22" )) { + phy_info->phy_type =GENERIC_8023_C22_PHY ; + phy_info->link_function = + __cvmx_get_generic_8023_c22_phy_link_state; +debug ("Vitesse 802.3 c22 detected\n" ); + }else { + phy_info->phy_type =GENERIC_8023_C45_PHY ; + phy_info->link_function = + __get_generic_8023_c45_phy_link_state; +debug ("Vitesse 802.3 c45 detected\n" ); + } + }else if (!memcmp ("aquantia" , phy_compatible_str, +strlen ("aquantia" ))) { + phy_info->phy_type =AQUANTIA_PHY ; + phy_info->link_function = __get_aquantia_phy_link_state; +debug ("Aquantia c45 PHY detected\n" ); + }else if (!memcmp ("cortina" , phy_compatible_str,strlen ("cortina" ))) { + phy_info->phy_type =CORTINA_PHY ; + phy_info->link_function = __cvmx_get_cortina_phy_link_state; + host_mode_str = (const char *)fdt_getprop ( + fdt_addr, phy,"cortina,host-mode" ,NULL ); +debug ("Cortina PHY detected for ipd_port %d\n" , ipd_port); + }else if (!memcmp ("ti" , phy_compatible_str,strlen ("ti" ))) { + phy_info->phy_type =GENERIC_8023_C45_PHY ; + phy_info->link_function = __get_generic_8023_c45_phy_link_state; +debug ("TI PHY detected for ipd_port %d\n" , ipd_port); + }else if (!fdt_node_check_compatible (fdt_addr, phy, +"atheros,ar8334" ) || + !fdt_node_check_compatible (fdt_addr, phy, +"qualcomm,qca8334" ) || + !fdt_node_check_compatible (fdt_addr, phy, +"atheros,ar8337" ) || + !fdt_node_check_compatible (fdt_addr, phy, +"qualcomm,qca8337" )) { + phy_info->phy_type =QUALCOMM_S17 ; + phy_info->link_function = + __cvmx_get_qualcomm_s17_phy_link_state; +debug ("Qualcomm QCA833X switch detected\n" ); + }else if (!fdt_node_check_compatible (fdt_addr, phy, +"ethernet-phy-ieee802.3-c22" )) { + phy_info->phy_type =GENERIC_8023_C22_PHY ; + phy_info->link_function = + __cvmx_get_generic_8023_c22_phy_link_state; +debug ("Generic 802.3 c22 PHY detected\n" ); + }else if (!fdt_node_check_compatible (fdt_addr, phy, +"ethernet-phy-ieee802.3-c45" )) { + phy_info->phy_type =GENERIC_8023_C45_PHY ; + phy_info->link_function = __get_generic_8023_c45_phy_link_state; +debug ("Generic 802.3 c45 PHY detected\n" ); + }else { +debug ("Unknown PHY compatibility\n" ); + phy_info->phy_type = (cvmx_phy_type_t)-1 ; + phy_info->link_function =NULL ; + } + + phy_info->host_mode =CVMX_PHY_HOST_MODE_UNKNOWN ; +if (host_mode_str) { +if (strcmp (host_mode_str,"rxaui" ) ==0 ) + phy_info->host_mode =CVMX_PHY_HOST_MODE_RXAUI ; +else if (strcmp (host_mode_str,"xaui" ) ==0 ) + phy_info->host_mode =CVMX_PHY_HOST_MODE_XAUI ; +else if (strcmp (host_mode_str,"sgmii" ) ==0 ) + phy_info->host_mode =CVMX_PHY_HOST_MODE_SGMII ; +else if (strcmp (host_mode_str,"qsgmii" ) ==0 ) + phy_info->host_mode =CVMX_PHY_HOST_MODE_QSGMII ; +else +debug ("Unknown PHY host mode\n" ); + } + +/* Check if PHY parent is the octeon MDIO bus. Some boards are connected +* though a MUX and for them direct_connect_to_phy will be 0 +*/ + phy_parent =fdt_parent_offset (fdt_addr, phy); +if (phy_parent <0 ) { +debug ("ERROR : cannot find phy parent for ipd_port=%d ret=%d\n" , + ipd_port, phy_parent); +return -1 ; + } +/* For multi-phy devices and devices on a MUX, go to the parent */ + ret =fdt_node_check_compatible (fdt_addr, phy_parent, +"ethernet-phy-nexus" ); +if (ret ==0 ) { +/* It's a nexus so check the grandparent. */ + phy_addr_offset = +cvmx_fdt_get_int (fdt_addr, phy_parent,"reg" ,0 ); + phy_parent =fdt_parent_offset (fdt_addr, phy_parent); + } + +/* Check for a muxed MDIO interface */ + mdio_parent =fdt_parent_offset (fdt_addr, phy_parent); + ret =fdt_node_check_compatible (fdt_addr, mdio_parent, +"cavium,mdio-mux" ); +if (ret ==0 ) { + ret =__get_muxed_mdio_info_from_dt (phy_info, phy_parent, + mdio_parent); +if (ret) { +printf ("Error reading mdio mux information for ipd port %d\n" , + ipd_port); +return -1 ; + } + } + ret =fdt_node_check_compatible (fdt_addr, phy_parent, +"cavium,octeon-3860-mdio" ); +if (ret ==0 ) { +u32 *mdio_reg_base = + (u32 *)fdt_getprop (fdt_addr, phy_parent,"reg" ,0 ); + phy_info->direct_connect =1 ; +if (mdio_reg_base ==0 ) { +debug ("ERROR : unable to get reg property in phy mdio\n" ); +return -1 ; + } + phy_info->mdio_unit = +__mdiobus_addr_to_unit (fdt32_to_cpu (mdio_reg_base[1 ])); +debug ("phy parent=%s reg_base=%08x mdio_unit=%d\n" , +fdt_get_name (fdt_addr, phy_parent,NULL ), + (int )mdio_reg_base[1 ], phy_info->mdio_unit); + }else { + phy_info->direct_connect =0 ; +/* The PHY is not directly connected to the Octeon MDIO bus. +* SE doesn't have abstractions for MDIO MUX or MDIO MUX +* drivers and hence for the non direct cases code will be +* needed which is board specific. +* For now the MDIO Unit is defaulted to 1. +*/ +debug ("%s PHY at address: %d is not directly connected\n" , + __func__, phy_info->phy_addr); + } + + phy_info->phy_addr =cvmx_fdt_get_int (fdt_addr, phy,"reg" ,-1 ); +if (phy_info->phy_addr <0 ) { +debug ("ERROR: Could not read phy address from reg in DT\n" ); +return -1 ; + } + phy_info->phy_addr += phy_addr_offset; + phy_info->phy_addr |= phy_info->mdio_unit <<8 ; +debug ("%s(%p, %d) => 0x%x\n" , __func__, phy_info, ipd_port, + phy_info->phy_addr); +return phy_info->phy_addr; +} + +/** +* @INTERNAL +* This function outputs the cvmx_phy_info_t data structure for the specified +* port. +* +* @param phy_info - phy info data structure +* @param ipd_port - port to get phy info for +* +* @return 0 for success, -1 if info not available +* +* NOTE: The phy_info data structure is subject to change. +*/ +int cvmx_helper_board_get_phy_info (cvmx_phy_info_t *phy_info,int ipd_port) +{ +int retcode; + + retcode =__get_phy_info_from_dt (phy_info, ipd_port); + +return (retcode >=0 ) ?0 :-1 ; +} + +/** +* Return the MII PHY address associated with the given IPD +* port. The phy address is obtained from the device tree. +* +* @param ipd_port Octeon IPD port to get the MII address for. +* +* @return MII PHY address and bus number or -1 on error, -2 if phy info missing (OK). +*/ +int cvmx_helper_board_get_mii_address_from_dt (int ipd_port) +{ +cvmx_phy_info_t phy_info; +int retcode =__get_phy_info_from_dt (&phy_info, ipd_port); + +if (retcode >=0 ) +return phy_info.phy_addr; +else +return retcode; +} + +/** +* Return the MII PHY address associated with the given IPD +* port. A result of -1 means there isn't a MII capable PHY +* connected to this port. On chips supporting multiple MII +* busses the bus number is encoded in bits <15:8>. +* +* This function must be modified for every new Octeon board. +* Internally it uses switch statements based on the cvmx_sysinfo +* data to determine board types and revisions. It replies on the +* fact that every Octeon board receives a unique board type +* enumeration from the bootloader. +* +* @param ipd_port Octeon IPD port to get the MII address for. +* +* @return MII PHY address and bus number or -1. +*/ +int cvmx_helper_board_get_mii_address (int ipd_port) +{ +cvmx_phy_info_t phy_info; +int retcode; + +debug ("%s(0x%x) getting phy info from device tree\n" , __func__, + ipd_port); +memset (&phy_info,0 ,sizeof (phy_info)); + retcode =__get_phy_info_from_dt (&phy_info, ipd_port); + +if (retcode ==-2 ) { +debug ("%s(0x%x): phy info missing in device tree\n" , __func__, + ipd_port); +return retcode; + }else if (retcode <0 ) { +debug ("%s: could not get phy info for port %d\n" , __func__, + ipd_port); +return retcode; + } +debug ("%s: phy address: 0x%x\n" , __func__, phy_info.phy_addr); + +/* Some unknown board. Somebody forgot to update this function... */ +debug ("%s: Unknown board type\n" , __func__); +return -1 ; +} + +/** +* @INTERNAL +* Parse the device tree and set whether a port is valid or not. +* +* @param fdt_addr Pointer to device tree +* +* @return 0 for success, -1 on error. +*/ +int __cvmx_helper_parse_bgx_dt (const void *fdt_addr) +{ +int port_index; +struct cvmx_xiface xi; +int fdt_port_node =-1 ; +int fdt_interface_node; +int fdt_phy_node; +u64 reg_addr; +int xiface; +struct cvmx_phy_info *phy_info; +static bool parsed; +int err; +int ipd_port; + +if (parsed) { +debug ("%s: Already parsed\n" , __func__); +return 0 ; + } +while ((fdt_port_node =fdt_node_offset_by_compatible ( + fdt_addr, fdt_port_node, +"cavium,octeon-7890-bgx-port" )) >=0 ) { +/* Get the port number */ + port_index = +cvmx_fdt_get_int (fdt_addr, fdt_port_node,"reg" ,-1 ); +if (port_index <0 ) { +debug ("Error: missing reg field for bgx port in device tree\n" ); +return -1 ; + } +debug ("%s: Parsing BGX port %d\n" , __func__, port_index); +/* Get the interface number */ + fdt_interface_node =fdt_parent_offset (fdt_addr, fdt_port_node); +if (fdt_interface_node <0 ) { +debug ("Error: device tree corrupt!\n" ); +return -1 ; + } +if (fdt_node_check_compatible (fdt_addr, fdt_interface_node, +"cavium,octeon-7890-bgx" )) { +debug ("Error: incompatible Ethernet MAC Nexus in device tree!\n" ); +return -1 ; + } + reg_addr = +cvmx_fdt_get_addr (fdt_addr, fdt_interface_node,"reg" ); +debug ("%s: BGX interface address: 0x%llx\n" , __func__, + (unsigned long long )reg_addr); +if (reg_addr ==FDT_ADDR_T_NONE ) { +debug ("Device tree BGX node has invalid address 0x%llx\n" , + (unsigned long long )reg_addr); +return -1 ; + } + reg_addr =cvmx_fdt_translate_address (fdt_addr, + fdt_interface_node, + (u32 *)®_addr); + xi =__cvmx_bgx_reg_addr_to_xiface (reg_addr); +if (xi.node <0 ) { +debug ("Device tree BGX node has invalid address 0x%llx\n" , + (unsigned long long )reg_addr); +return -1 ; + } +debug ("%s: Found BGX node %d, interface %d\n" , __func__, + xi.node, xi.interface); + xiface =cvmx_helper_node_interface_to_xiface (xi.node, + xi.interface); +cvmx_helper_set_port_fdt_node_offset (xiface, port_index, + fdt_port_node); +cvmx_helper_set_port_valid (xiface, port_index, true); + +cvmx_helper_set_port_fdt_node_offset (xiface, port_index, + fdt_port_node); +if (fdt_getprop (fdt_addr, fdt_port_node, +"cavium,sgmii-mac-phy-mode" ,NULL )) +cvmx_helper_set_mac_phy_mode (xiface, port_index, true); +else +cvmx_helper_set_mac_phy_mode (xiface, port_index, false); + +if (fdt_getprop (fdt_addr, fdt_port_node,"cavium,force-link-up" , +NULL )) +cvmx_helper_set_port_force_link_up (xiface, port_index, + true); +else +cvmx_helper_set_port_force_link_up (xiface, port_index, + false); + +if (fdt_getprop (fdt_addr, fdt_port_node, +"cavium,sgmii-mac-1000x-mode" ,NULL )) +cvmx_helper_set_1000x_mode (xiface, port_index, true); +else +cvmx_helper_set_1000x_mode (xiface, port_index, false); + +if (fdt_getprop (fdt_addr, fdt_port_node, +"cavium,disable-autonegotiation" ,NULL )) +cvmx_helper_set_port_autonegotiation (xiface, port_index, + false); +else +cvmx_helper_set_port_autonegotiation (xiface, port_index, + true); + + fdt_phy_node =cvmx_fdt_lookup_phandle (fdt_addr, fdt_port_node, +"phy-handle" ); +if (fdt_phy_node >=0 ) { +cvmx_helper_set_phy_fdt_node_offset (xiface, port_index, + fdt_phy_node); +debug ("%s: Setting PHY fdt node offset for interface 0x%x, port %d to %d\n" , + __func__, xiface, port_index, fdt_phy_node); +debug ("%s: PHY node name: %s\n" , __func__, +fdt_get_name (fdt_addr, fdt_phy_node,NULL )); +cvmx_helper_set_port_phy_present (xiface, port_index, + true); + ipd_port =cvmx_helper_get_ipd_port (xiface, port_index); +if (ipd_port >=0 ) { +debug ("%s: Allocating phy info for 0x%x:%d\n" , + __func__, xiface, port_index); + phy_info = + (cvmx_phy_info_t *)cvmx_bootmem_alloc ( +sizeof (*phy_info),0 ); +if (!phy_info) { +debug ("%s: Out of memory\n" , __func__); +return -1 ; + } +memset (phy_info,0 ,sizeof (*phy_info)); + phy_info->phy_addr =-1 ; + err =__get_phy_info_from_dt (phy_info, + ipd_port); +if (err) { +debug ("%s: Error parsing phy info for ipd port %d\n" , + __func__, ipd_port); +return -1 ; + } +cvmx_helper_set_port_phy_info ( + xiface, port_index, phy_info); +debug ("%s: Saved phy info\n" , __func__); + } + }else { +cvmx_helper_set_phy_fdt_node_offset (xiface, port_index, +-1 ); +debug ("%s: No PHY fdt node offset for interface 0x%x, port %d to %d\n" , + __func__, xiface, port_index, fdt_phy_node); +cvmx_helper_set_port_phy_present (xiface, port_index, + false); + } + } +if (!sfp_parsed) +if (cvmx_sfp_parse_device_tree (fdt_addr)) +debug ("%s: Error parsing SFP device tree\n" , __func__); + parsed = true; +return 0 ; +} + +int __cvmx_helper_parse_bgx_rgmii_dt (const void *fdt_addr) +{ +u64 reg_addr; +struct cvmx_xiface xi; +int fdt_port_node =-1 ; +int fdt_interface_node; +int fdt_phy_node; +int port_index; +int xiface; + +/* There's only one xcv (RGMII) interface, so just search for the one +* that's part of a BGX entry. +*/ +while ((fdt_port_node =fdt_node_offset_by_compatible ( + fdt_addr, fdt_port_node,"cavium,octeon-7360-xcv" )) >= +0 ) { + fdt_interface_node =fdt_parent_offset (fdt_addr, fdt_port_node); +if (fdt_interface_node <0 ) { +printf ("Error: device tree corrupt!\n" ); +return -1 ; + } +debug ("%s: XCV parent node compatible: %s\n" , __func__, + (char *)fdt_getprop (fdt_addr, fdt_interface_node, +"compatible" ,NULL )); +if (!fdt_node_check_compatible (fdt_addr, fdt_interface_node, +"cavium,octeon-7890-bgx" )) +break ; + } +if (fdt_port_node == -FDT_ERR_NOTFOUND ) { +debug ("No XCV/RGMII interface found in device tree\n" ); +return 0 ; + }else if (fdt_port_node <0 ) { +debug ("%s: Error %d parsing device tree\n" , __func__, + fdt_port_node); +return -1 ; + } + port_index =cvmx_fdt_get_int (fdt_addr, fdt_port_node,"reg" ,-1 ); +if (port_index !=0 ) { +printf ("%s: Error: port index (reg) must be 0, not %d.\n" , + __func__, port_index); +return -1 ; + } + reg_addr =cvmx_fdt_get_addr (fdt_addr, fdt_interface_node,"reg" ); +if (reg_addr ==FDT_ADDR_T_NONE ) { +printf ("%s: Error: could not get BGX interface address\n" , + __func__); +return -1 ; + } +/* We don't have to bother translating since only 78xx supports OCX and +* doesn't support RGMII. +*/ + xi =__cvmx_bgx_reg_addr_to_xiface (reg_addr); +debug ("%s: xi.node: %d, xi.interface: 0x%x, addr: 0x%llx\n" , __func__, + xi.node, xi.interface, (unsigned long long )reg_addr); +if (xi.node <0 ) { +printf ("%s: Device tree BGX node has invalid address 0x%llx\n" , + __func__, (unsigned long long )reg_addr); +return -1 ; + } +debug ("%s: Found XCV (RGMII) interface on interface %d\n" , __func__, + xi.interface); +debug (" phy handle: 0x%x\n" , +cvmx_fdt_get_int (fdt_addr, fdt_port_node,"phy-handle" ,-1 )); + fdt_phy_node = +cvmx_fdt_lookup_phandle (fdt_addr, fdt_port_node,"phy-handle" ); +debug ("%s: phy-handle node: 0x%x\n" , __func__, fdt_phy_node); + xiface =cvmx_helper_node_interface_to_xiface (xi.node, xi.interface); + +cvmx_helper_set_port_fdt_node_offset (xiface, port_index, fdt_port_node); +if (fdt_phy_node >=0 ) { +debug ("%s: Setting PHY fdt node offset for interface 0x%x, port %d to %d\n" , + __func__, xiface, port_index, fdt_phy_node); +debug ("%s: PHY node name: %s\n" , __func__, +fdt_get_name (fdt_addr, fdt_phy_node,NULL )); +cvmx_helper_set_phy_fdt_node_offset (xiface, port_index, + fdt_phy_node); +cvmx_helper_set_port_phy_present (xiface, port_index, true); + }else { +cvmx_helper_set_phy_fdt_node_offset (xiface, port_index,-1 ); +debug ("%s: No PHY fdt node offset for interface 0x%x, port %d to %d\n" , + __func__, xiface, port_index, fdt_phy_node); +cvmx_helper_set_port_phy_present (xiface, port_index, false); + } + +return 0 ; +} + +/** +* Returns if a port is present on an interface +* +* @param fdt_addr - address fo flat device tree +* @param ipd_port - IPD port number +* +* @return 1 if port is present, 0 if not present, -1 if error +*/ +int __cvmx_helper_board_get_port_from_dt (void *fdt_addr,int ipd_port) +{ +int port_index; +int aliases; +const char *pip_path; +char name_buffer[24 ]; +int pip, iface, eth; +cvmx_helper_interface_mode_t mode; +int xiface =cvmx_helper_get_interface_num (ipd_port); +struct cvmx_xiface xi =cvmx_helper_xiface_to_node_interface (xiface); +u32 val; +int phy_node_offset; +int parse_bgx_dt_err; +int parse_vsc7224_err; + +debug ("%s(%p, %d)\n" , __func__, fdt_addr, ipd_port); +if (octeon_has_feature (OCTEON_FEATURE_BGX )) { +static int fdt_ports_initialized; + + port_index =cvmx_helper_get_interface_index_num (ipd_port); + +if (!fdt_ports_initialized) { +if (octeon_has_feature (OCTEON_FEATURE_BGX_XCV )) { +if (!__cvmx_helper_parse_bgx_rgmii_dt (fdt_addr)) + fdt_ports_initialized =1 ; + parse_bgx_dt_err = +__cvmx_helper_parse_bgx_dt (fdt_addr); + parse_vsc7224_err = +__cvmx_fdt_parse_vsc7224 (fdt_addr); +if (!parse_bgx_dt_err && !parse_vsc7224_err) + fdt_ports_initialized =1 ; + }else { +debug ("%s: Error parsing FDT\n" , __func__); +return -1 ; + } + } + +return cvmx_helper_is_port_valid (xiface, port_index); + } + + mode =cvmx_helper_interface_get_mode (xiface); + +switch (mode) { +/* Device tree has information about the following mode types. */ +case CVMX_HELPER_INTERFACE_MODE_RGMII : +case CVMX_HELPER_INTERFACE_MODE_GMII : +case CVMX_HELPER_INTERFACE_MODE_SPI : +case CVMX_HELPER_INTERFACE_MODE_XAUI : +case CVMX_HELPER_INTERFACE_MODE_SGMII : +case CVMX_HELPER_INTERFACE_MODE_QSGMII : +case CVMX_HELPER_INTERFACE_MODE_RXAUI : +case CVMX_HELPER_INTERFACE_MODE_AGL : +case CVMX_HELPER_INTERFACE_MODE_XLAUI : +case CVMX_HELPER_INTERFACE_MODE_XFI : + aliases =1 ; +break ; +default : + aliases =0 ; +break ; + } + +/* The device tree information is present on interfaces that have phy */ +if (!aliases) +return 1 ; + + port_index =cvmx_helper_get_interface_index_num (ipd_port); + + aliases =fdt_path_offset (fdt_addr,"/aliases" ); +if (aliases <0 ) { +debug ("%s: ERROR: /aliases not found in device tree fdt_addr=%p\n" , + __func__, fdt_addr); +return -1 ; + } + + pip_path = (const char *)fdt_getprop (fdt_addr, aliases,"pip" ,NULL ); +if (!pip_path) { +debug ("%s: ERROR: interface %x pip path not found in device tree\n" , + __func__, xiface); +return -1 ; + } + pip =fdt_path_offset (fdt_addr, pip_path); +if (pip <0 ) { +debug ("%s: ERROR: interface %x pip not found in device tree\n" , + __func__, xiface); +return -1 ; + } +snprintf (name_buffer,sizeof (name_buffer),"interface@%d" , + xi.interface); + iface =fdt_subnode_offset (fdt_addr, pip, name_buffer); +if (iface <0 ) +return 0 ; +snprintf (name_buffer,sizeof (name_buffer),"ethernet@%x" , port_index); + eth =fdt_subnode_offset (fdt_addr, iface, name_buffer); +debug ("%s: eth subnode offset %d from %s\n" , __func__, eth, + name_buffer); + +if (eth <0 ) +return -1 ; + +cvmx_helper_set_port_fdt_node_offset (xiface, port_index, eth); + + phy_node_offset =cvmx_fdt_get_int (fdt_addr, eth,"phy" ,-1 ); +cvmx_helper_set_phy_fdt_node_offset (xiface, port_index, + phy_node_offset); + +if (fdt_getprop (fdt_addr, eth,"cavium,sgmii-mac-phy-mode" ,NULL )) +cvmx_helper_set_mac_phy_mode (xiface, port_index, true); +else +cvmx_helper_set_mac_phy_mode (xiface, port_index, false); + +if (fdt_getprop (fdt_addr, eth,"cavium,force-link-up" ,NULL )) +cvmx_helper_set_port_force_link_up (xiface, port_index, true); +else +cvmx_helper_set_port_force_link_up (xiface, port_index, false); + +if (fdt_getprop (fdt_addr, eth,"cavium,sgmii-mac-1000x-mode" ,NULL )) +cvmx_helper_set_1000x_mode (xiface, port_index, true); +else +cvmx_helper_set_1000x_mode (xiface, port_index, false); + +if (fdt_getprop (fdt_addr, eth,"cavium,disable-autonegotiation" ,NULL )) +cvmx_helper_set_port_autonegotiation (xiface, port_index, false); +else +cvmx_helper_set_port_autonegotiation (xiface, port_index, true); + +if (mode ==CVMX_HELPER_INTERFACE_MODE_AGL ) { +bool tx_bypass = false; + +if (fdt_getprop (fdt_addr, eth,"cavium,rx-clk-delay-bypass" , +NULL )) +cvmx_helper_set_agl_rx_clock_delay_bypass ( + xiface, port_index, true); +else +cvmx_helper_set_agl_rx_clock_delay_bypass ( + xiface, port_index, false); + + val =cvmx_fdt_get_int (fdt_addr, eth,"cavium,rx-clk-skew" ,0 ); +cvmx_helper_set_agl_rx_clock_skew (xiface, port_index, val); + +if (fdt_getprop (fdt_addr, eth,"cavium,tx-clk-delay-bypass" , +NULL )) + tx_bypass = true; + + val =cvmx_fdt_get_int (fdt_addr, eth,"tx-clk-delay" ,0 ); +cvmx_helper_cfg_set_rgmii_tx_clk_delay (xiface, port_index, + tx_bypass, val); + + val =cvmx_fdt_get_int (fdt_addr, eth,"cavium,refclk-sel" ,0 ); +cvmx_helper_set_agl_refclk_sel (xiface, port_index, val); + } + +return (eth >=0 ); +} + +/** +* Given the address of the MDIO registers, output the CPU node and MDIO bus +* +* @param addr 64-bit address of MDIO registers (from device tree) +* @param[out] node CPU node number (78xx) +* @param[out] bus MDIO bus number +*/ +void __cvmx_mdio_addr_to_node_bus (u64 addr,int *node,int *bus) +{ +if (OCTEON_IS_MODEL (OCTEON_CN78XX )) { +if (node) + *node =cvmx_csr_addr_to_node (addr); + addr =cvmx_csr_addr_strip_node (addr); + }else { +if (node) + *node =0 ; + } +if (OCTEON_IS_MODEL (OCTEON_CN68XX ) ||OCTEON_IS_MODEL (OCTEON_CN78XX )) { +switch (addr) { +case 0x0001180000003800 : + *bus =0 ; +break ; +case 0x0001180000003880 : + *bus =1 ; +break ; +case 0x0001180000003900 : + *bus =2 ; +break ; +case 0x0001180000003980 : + *bus =3 ; +break ; +default : + *bus =-1 ; +printf ("%s: Invalid SMI bus address 0x%llx\n" , __func__, + (unsigned long long )addr); +break ; + } + }else if (OCTEON_IS_MODEL (OCTEON_CN73XX ) || +OCTEON_IS_MODEL (OCTEON_CNF75XX )) { +switch (addr) { +case 0x0001180000003800 : + *bus =0 ; +break ; +case 0x0001180000003880 : + *bus =1 ; +break ; +default : + *bus =-1 ; +printf ("%s: Invalid SMI bus address 0x%llx\n" , __func__, + (unsigned long long )addr); +break ; + } + }else { +switch (addr) { +case 0x0001180000001800 : + *bus =0 ; +break ; +case 0x0001180000001900 : + *bus =1 ; +break ; +default : + *bus =-1 ; +printf ("%s: Invalid SMI bus address 0x%llx\n" , __func__, + (unsigned long long )addr); +break ; + } + } +} + +/** +* @INTERNAL +* Figure out which mod_abs changed function to use based on the phy type +* +* @param xiface xinterface number +* @param index port index on interface +* +* @return 0 for success, -1 on error +* +* This function figures out the proper mod_abs_changed function to use and +* registers the appropriate function. This should be called after the device +* tree has been fully parsed for the given port as well as after all SFP +* slots and any Microsemi VSC7224 devices have been parsed in the device tree. +*/ +int cvmx_helper_phy_register_mod_abs_changed (int xiface,int index) +{ +struct cvmx_vsc7224_chan *vsc7224_chan; +struct cvmx_fdt_sfp_info *sfp_info; + +debug ("%s(0x%x, %d)\n" , __func__, xiface, index); + sfp_info =cvmx_helper_cfg_get_sfp_info (xiface, index); +/* Don't return an error if no SFP module is registered */ +if (!sfp_info) { +debug ("%s: No SFP associated with 0x%x:%d\n" , __func__, xiface, + index); +return 0 ; + } + +/* See if the Microsemi VSC7224 reclocking chip has been used */ + vsc7224_chan =cvmx_helper_cfg_get_vsc7224_chan_info (xiface, index); +if (vsc7224_chan) { +debug ("%s: Registering VSC7224 handler\n" , __func__); +cvmx_sfp_register_mod_abs_changed (sfp_info, + &cvmx_sfp_vsc7224_mod_abs_changed,NULL ); +return 0 ; + } + +return 0 ; +}
Signature · 1 line
2.35.1
PATCH 12/52 mips: octeon: Add cvmx-helper-fpa.c
In reply to Stefan RoeseFrom: Aaron Williams <[email protected]>
Import cvmx-helper-fpa.c from 2013 U-Boot. It will be used by the later added drivers to support networking on the MIPS Octeon II / III platforms.
--- arch/mips/mach-octeon/cvmx-helper-fpa.c | 329 ++++++++++++++++++++++++ 1 file changed, 329 insertions(+) create mode 100644 arch/mips/mach-octeon/cvmx-helper-fpa.c
arch/mips/mach-octeon/cvmx-helper-fpa.c new file +329 -0
@@ -0,0 +1,329 @@ +// SPDX-License-Identifier: GPL-2.0 +/* +* Copyright (C) 2018-2022 Marvell International Ltd. +* +* Helper functions for FPA setup. +*/ + +#include <errno.h> +#include <log.h> +#include <time.h> +#include <linux/delay.h> + +#include <mach/cvmx-regs.h> +#include <mach/cvmx-csr.h> +#include <mach/cvmx-bootmem.h> +#include <mach/octeon-model.h> +#include <mach/cvmx-fuse.h> +#include <mach/octeon-feature.h> +#include <mach/cvmx-qlm.h> +#include <mach/octeon_qlm.h> +#include <mach/cvmx-pcie.h> +#include <mach/cvmx-coremask.h> +#include <mach/cvmx-range.h> +#include <mach/cvmx-global-resources.h> + +#include <mach/cvmx-agl-defs.h> +#include <mach/cvmx-bgxx-defs.h> +#include <mach/cvmx-ciu-defs.h> +#include <mach/cvmx-gmxx-defs.h> +#include <mach/cvmx-gserx-defs.h> +#include <mach/cvmx-ilk-defs.h> +#include <mach/cvmx-ipd-defs.h> +#include <mach/cvmx-pcsx-defs.h> +#include <mach/cvmx-pcsxx-defs.h> +#include <mach/cvmx-pki-defs.h> +#include <mach/cvmx-pko-defs.h> +#include <mach/cvmx-xcv-defs.h> + +#include <mach/cvmx-hwpko.h> +#include <mach/cvmx-ilk.h> +#include <mach/cvmx-ipd.h> +#include <mach/cvmx-pki.h> +#include <mach/cvmx-pko3.h> +#include <mach/cvmx-pko3-queue.h> +#include <mach/cvmx-pko3-resources.h> +#include <mach/cvmx-pip.h> + +#include <mach/cvmx-helper.h> +#include <mach/cvmx-helper-board.h> +#include <mach/cvmx-helper-cfg.h> + +#include <mach/cvmx-helper-bgx.h> +#include <mach/cvmx-helper-cfg.h> +#include <mach/cvmx-helper-util.h> +#include <mach/cvmx-helper-pki.h> +#include <mach/cvmx-helper-pko.h> + +void cvmx_helper_fpa1_dump (int node) +{ +int pool_num =0 , pools_max =cvmx_fpa_get_max_pools (); + +if (node ==-1 ) + node =cvmx_get_node_num (); + +printf ("FPA pool status: pools count: %u\n" , pools_max); +printf ("----------------------------------------------------\n" ); +printf ("%5s %5s %12s %16s\n" ,"POOL" ,"Size" ,"Free" ,"Name" ); + +while (pool_num < pools_max) { +int pool = pool_num++; +unsigned int sz =cvmx_fpa_get_block_size (pool); +char *s ="" ; + +if (sz ==0 ) +continue ; +if (cvmx_fpa_get_pool_owner (pool) !=cvmx_get_app_id ()) + s ="*" ; + +printf ("%5u %5u %12u %16s %1s\n" , pool, sz, +cvmx_fpa_get_current_count (pool), +cvmx_fpa_get_name (pool), s); + } +} + +void cvmx_helper_fpa3_dump (unsigned int node) +{ +int lpool, laura; +unsigned int intr; +char line[128 ]; + + intr =csr_rd_node (node,CVMX_FPA_ERR_INT ); +memset (line,'*' ,80 ); + line[80 ] ='\0' ; +printf ("\n%s\n" , line); +printf (" FPA3 on node %u: intr=%#x\n" , node, intr); +printf ("%s\n" , line); +printf ("%6s %5s %14s %14s %16s %s\n" ,"POOL" ,"Size" ,"Free" ,"" , +"Name" ,"Intr" ); + +for (lpool =0 ; lpool <cvmx_fpa3_num_pools (); lpool++) { +cvmx_fpa3_pool_t pool; +cvmx_fpa_poolx_cfg_t pool_cfg; +cvmx_fpa_poolx_available_t avail_reg; +unsigned int bsz; +unsigned long long bcnt; + + pool =__cvmx_fpa3_pool (node, lpool); + pool_cfg.u64 = +csr_rd_node (pool.node,CVMX_FPA_POOLX_CFG (pool.lpool)); + bsz = pool_cfg.cn78xx.buf_size <<7 ; +if (bsz ==0 ) +continue ; + avail_reg.u64 =csr_rd_node ( + pool.node,CVMX_FPA_POOLX_AVAILABLE (pool.lpool)); + bcnt = avail_reg.cn78xx.count; + intr =csr_rd_node (pool.node,CVMX_FPA_POOLX_INT (pool.lpool)); + +printf ("%6u %5u %14llu %14s %16s %#4x\n" , lpool, bsz, bcnt,"" , +cvmx_fpa3_get_pool_name (pool), intr); + } +printf ("\n" ); + +printf ("%6s %5s %14s %14s %16s %s\n" ,"AURA" ,"POOL" ,"Allocated" , +"Remaining" ,"Name" ,"Intr" ); + +for (laura =0 ; laura <cvmx_fpa3_num_auras (); laura++) { +cvmx_fpa3_gaura_t aura; +cvmx_fpa_aurax_cnt_t cnt_reg; +cvmx_fpa_aurax_cnt_limit_t limit_reg; +cvmx_fpa_aurax_pool_t aurax_pool; +unsigned long long cnt, limit, rem; +unsigned int pool; +const char *name; + + aura =__cvmx_fpa3_gaura (node, laura); + aurax_pool.u64 = +csr_rd_node (aura.node,CVMX_FPA_AURAX_POOL (aura.laura)); + pool = aurax_pool.cn78xx.pool; +if (pool ==0 ) +continue ; + cnt_reg.u64 = +csr_rd_node (aura.node,CVMX_FPA_AURAX_CNT (aura.laura)); + limit_reg.u64 =csr_rd_node ( + aura.node,CVMX_FPA_AURAX_CNT_LIMIT (aura.laura)); + cnt = cnt_reg.cn78xx.cnt; + limit = limit_reg.cn78xx.limit; + rem = limit - cnt; + name =cvmx_fpa3_get_aura_name (aura); + intr =csr_rd_node (aura.node,CVMX_FPA_AURAX_INT (aura.laura)); + +if (limit ==CVMX_FPA3_AURAX_LIMIT_MAX ) +printf ("%6u %5u %14llu %14s %16s %#4x\n" , laura, pool, + cnt,"unlimited" , name, intr); +else +printf ("%6u %5u %14llu %14llu %16s %#4x\n" , laura, pool, + cnt, rem, name, intr); + } +printf ("\n" ); +} + +void cvmx_helper_fpa_dump (int node) +{ +if (node ==-1 ) + node =cvmx_get_node_num (); +if (octeon_has_feature (OCTEON_FEATURE_FPA3 )) +cvmx_helper_fpa3_dump (node); +else +cvmx_helper_fpa1_dump (node); +} + +int cvmx_helper_shutdown_fpa_pools (int node) +{ +if (octeon_has_feature (OCTEON_FEATURE_FPA3 )) { +cvmx_fpa3_gaura_t aura; +cvmx_fpa3_pool_t pool; +int laura, lpool; + +for (laura =0 ; laura <cvmx_fpa3_num_auras (); laura++) { + aura =__cvmx_fpa3_gaura (node, laura); + (void )cvmx_fpa3_shutdown_aura (aura); + } + +for (lpool =0 ; lpool <cvmx_fpa3_num_pools (); lpool++) { + pool =__cvmx_fpa3_pool (node, lpool); + (void )cvmx_fpa3_shutdown_pool (pool); + } + }else { +int pool; + +for (pool =0 ; pool <CVMX_FPA1_NUM_POOLS ; pool++) { +if (cvmx_fpa_get_block_size (pool) >0 ) +cvmx_fpa_shutdown_pool (pool); + } +if (!OCTEON_IS_MODEL (OCTEON_CN68XX )) +cvmx_fpa_disable (); + } + +return 0 ; +} + +/** +* @INTERNAL +* OBSOLETE +* +* Allocate memory for and initialize a single FPA pool. +* +* @param pool Pool to initialize +* @param buffer_size Size of buffers to allocate in bytes +* @param buffers Number of buffers to put in the pool. Zero is allowed +* @param name String name of the pool for debugging purposes +* @return Zero on success, non-zero on failure +* +* This function is only for transition, will be removed. +*/ +int __cvmx_helper_initialize_fpa_pool (int pool,u64 buffer_size,u64 buffers, +const char *name) +{ +return cvmx_fpa_setup_pool (pool, name,NULL , buffer_size, buffers); +} + +/** +* @INTERNAL +* Allocate memory and initialize the FPA pools using memory +* from cvmx-bootmem. Specifying zero for the number of +* buffers will cause that FPA pool to not be setup. This is +* useful if you aren't using some of the hardware and want +* to save memory. Use cvmx_helper_initialize_fpa instead of +* this function directly. +* +* @param pip_pool Should always be CVMX_FPA_PACKET_POOL +* @param pip_size Should always be CVMX_FPA_PACKET_POOL_SIZE +* @param pip_buffers +* Number of packet buffers. +* @param wqe_pool Should always be CVMX_FPA_WQE_POOL +* @param wqe_size Should always be CVMX_FPA_WQE_POOL_SIZE +* @param wqe_entries +* Number of work queue entries +* @param pko_pool Should always be CVMX_FPA_OUTPUT_BUFFER_POOL +* @param pko_size Should always be CVMX_FPA_OUTPUT_BUFFER_POOL_SIZE +* @param pko_buffers +* PKO Command buffers. You should at minimum have two per +* each PKO queue. +* @param tim_pool Should always be CVMX_FPA_TIMER_POOL +* @param tim_size Should always be CVMX_FPA_TIMER_POOL_SIZE +* @param tim_buffers +* TIM ring buffer command queues. At least two per timer bucket +* is recommended. +* @param dfa_pool Should always be CVMX_FPA_DFA_POOL +* @param dfa_size Should always be CVMX_FPA_DFA_POOL_SIZE +* @param dfa_buffers +* DFA command buffer. A relatively small (32 for example) +* number should work. +* @return Zero on success, non-zero if out of memory +*/ +static int +__cvmx_helper_initialize_fpa (int pip_pool,int pip_size,int pip_buffers, +int wqe_pool,int wqe_size,int wqe_entries, +int pko_pool,int pko_size,int pko_buffers, +int tim_pool,int tim_size,int tim_buffers, +int dfa_pool,int dfa_size,int dfa_buffers) +{ +cvmx_fpa_enable (); +if (pip_buffers >0 ) { +cvmx_fpa_setup_pool (pip_pool,"PKI_POOL" ,NULL , pip_size, + pip_buffers); + } +/* Allocate WQE pool only if it is distinct from packet pool */ +if (wqe_entries >0 && wqe_pool != pip_pool) { +cvmx_fpa_setup_pool (wqe_pool,"WQE_POOL" ,NULL , wqe_size, + wqe_entries); + } +/* cn78xx PKO allocates its own FPA pool per HW constraints */ +if (pko_buffers >0 ) { +if (!octeon_has_feature (OCTEON_FEATURE_PKI )) +cvmx_fpa_setup_pool (pko_pool,"PKO_POOL" ,NULL , + pko_size, pko_buffers); + } +if (tim_buffers >0 ) { +cvmx_fpa_setup_pool (tim_pool,"TIM_POOL" ,NULL , tim_size, + tim_buffers); + } +return 0 ; +} + +/** +* Allocate memory and initialize the FPA pools using memory +* from cvmx-bootmem. Sizes of each element in the pools is +* controlled by the cvmx-config.h header file. Specifying +* zero for any parameter will cause that FPA pool to not be +* setup. This is useful if you aren't using some of the +* hardware and want to save memory. +* +* @param packet_buffers +* Number of packet buffers to allocate +* @param work_queue_entries +* Number of work queue entries +* @param pko_buffers +* PKO Command buffers. You should at minimum have two per +* each PKO queue. +* @param tim_buffers +* TIM ring buffer command queues. At least two per timer bucket +* is recommended. +* @param dfa_buffers +* DFA command buffer. A relatively small (32 for example) +* number should work. +* @return Zero on success, non-zero if out of memory +*/ +int cvmx_helper_initialize_fpa (int packet_buffers,int work_queue_entries, +int pko_buffers,int tim_buffers, +int dfa_buffers) +{ +int packet_pool = (int )cvmx_fpa_get_packet_pool (); +int wqe_pool = (int )cvmx_fpa_get_wqe_pool (); +int outputbuffer_pool = (int )cvmx_fpa_get_pko_pool (); +int timer_pool; +int dfa_pool =0 ; +int rv; + + timer_pool =0 ; + + rv =__cvmx_helper_initialize_fpa ( + packet_pool,cvmx_fpa_get_packet_pool_block_size (), + packet_buffers, wqe_pool,cvmx_fpa_get_wqe_pool_block_size (), + work_queue_entries, outputbuffer_pool, +cvmx_fpa_get_pko_pool_block_size (), pko_buffers, timer_pool,0 , + tim_buffers, dfa_pool,0 , dfa_buffers); + +return rv; +}
Signature · 1 line
2.35.1
PATCH 13/52 mips: octeon: Add cvmx-helper-igl.c
In reply to Stefan RoeseFrom: Aaron Williams <[email protected]>
Import cvmx-helper-igl.c from 2013 U-Boot. It will be used by the later added drivers to support networking on the MIPS Octeon II / III platforms.
--- arch/mips/mach-octeon/cvmx-helper-ilk.c | 926 ++++++++++++++++++++++++ 1 file changed, 926 insertions(+) create mode 100644 arch/mips/mach-octeon/cvmx-helper-ilk.c
arch/mips/mach-octeon/cvmx-helper-ilk.c new file +926 -0
@@ -0,0 +1,926 @@ +// SPDX-License-Identifier: GPL-2.0 +/* +* Copyright (C) 2018-2022 Marvell International Ltd. +* +* Functions for ILK initialization, configuration, +* and monitoring. +*/ + +#include <time.h> +#include <log.h> +#include <linux/delay.h> + +#include <mach/cvmx-regs.h> +#include <mach/cvmx-csr.h> +#include <mach/cvmx-bootmem.h> +#include <mach/octeon-model.h> +#include <mach/cvmx-fuse.h> +#include <mach/octeon-feature.h> +#include <mach/cvmx-qlm.h> +#include <mach/octeon_qlm.h> +#include <mach/cvmx-pcie.h> +#include <mach/cvmx-coremask.h> + +#include <mach/cvmx-agl-defs.h> +#include <mach/cvmx-bgxx-defs.h> +#include <mach/cvmx-ciu-defs.h> +#include <mach/cvmx-gmxx-defs.h> +#include <mach/cvmx-ilk-defs.h> +#include <mach/cvmx-ipd-defs.h> +#include <mach/cvmx-pcsx-defs.h> +#include <mach/cvmx-pcsxx-defs.h> +#include <mach/cvmx-pki-defs.h> +#include <mach/cvmx-pko-defs.h> +#include <mach/cvmx-xcv-defs.h> + +#include <mach/cvmx-hwpko.h> +#include <mach/cvmx-ilk.h> +#include <mach/cvmx-pki.h> + +#include <mach/cvmx-helper.h> +#include <mach/cvmx-helper-board.h> +#include <mach/cvmx-helper-cfg.h> + +int __cvmx_helper_ilk_enumerate (int xiface) +{ +struct cvmx_xiface xi =cvmx_helper_xiface_to_node_interface (xiface); + + xi.interface -=CVMX_ILK_GBL_BASE (); +return cvmx_ilk_chans[xi.node][xi.interface]; +} + +/** +* @INTERNAL +* Initialize all tx calendar entries to the xoff state. +* Initialize all rx calendar entries to the xon state. The rx calendar entries +* must be in the xon state to allow new pko pipe assignments. If a calendar +* entry is assigned a different pko pipe while in the xoff state, the old pko +* pipe will stay in the xoff state even when no longer used by ilk. +* +* @param intf Interface whose calendar are to be initialized. +*/ +static void __cvmx_ilk_clear_cal_cn78xx (int intf) +{ +cvmx_ilk_txx_cal_entryx_t tx_entry; +cvmx_ilk_rxx_cal_entryx_t rx_entry; +int i; +int node = (intf >>4 ) &0xf ; +int interface = (intf &0xf ); + +/* Initialize all tx calendar entries to off */ + tx_entry.u64 =0 ; + tx_entry.s.ctl =XOFF ; +for (i =0 ; i <CVMX_ILK_MAX_CAL ; i++) { +csr_wr_node (node,CVMX_ILK_TXX_CAL_ENTRYX (i, interface), + tx_entry.u64); + } + +/* Initialize all rx calendar entries to on */ + rx_entry.u64 =0 ; + rx_entry.s.ctl =XOFF ; +for (i =0 ; i <CVMX_ILK_MAX_CAL ; i++) { +csr_wr_node (node,CVMX_ILK_RXX_CAL_ENTRYX (i, interface), + rx_entry.u64); + } +} + +/** +* @INTERNAL +* Initialize all tx calendar entries to the xoff state. +* Initialize all rx calendar entries to the xon state. The rx calendar entries +* must be in the xon state to allow new pko pipe assignments. If a calendar +* entry is assigned a different pko pipe while in the xoff state, the old pko +* pipe will stay in the xoff state even when no longer used by ilk. +* +* @param interface whose calendar are to be initialized. +*/ +static void __cvmx_ilk_clear_cal_cn68xx (int interface) +{ +cvmx_ilk_txx_idx_cal_t tx_idx; +cvmx_ilk_txx_mem_cal0_t tx_cal0; +cvmx_ilk_txx_mem_cal1_t tx_cal1; +cvmx_ilk_rxx_idx_cal_t rx_idx; +cvmx_ilk_rxx_mem_cal0_t rx_cal0; +cvmx_ilk_rxx_mem_cal1_t rx_cal1; +int i; + +/* +* First we initialize the tx calendar starting from entry 0, +* incrementing the entry with every write. +*/ + tx_idx.u64 =0 ; + tx_idx.s.inc =1 ; +csr_wr (CVMX_ILK_TXX_IDX_CAL (interface), tx_idx.u64); + +/* Set state to xoff for all entries */ + tx_cal0.u64 =0 ; + tx_cal0.s.entry_ctl0 =XOFF ; + tx_cal0.s.entry_ctl1 =XOFF ; + tx_cal0.s.entry_ctl2 =XOFF ; + tx_cal0.s.entry_ctl3 =XOFF ; + + tx_cal1.u64 =0 ; + tx_cal1.s.entry_ctl4 =XOFF ; + tx_cal1.s.entry_ctl5 =XOFF ; + tx_cal1.s.entry_ctl6 =XOFF ; + tx_cal1.s.entry_ctl7 =XOFF ; + +/* Write all 288 entries */ +for (i =0 ; i <CVMX_ILK_MAX_CAL_IDX ; i++) { +csr_wr (CVMX_ILK_TXX_MEM_CAL0 (interface), tx_cal0.u64); +csr_wr (CVMX_ILK_TXX_MEM_CAL1 (interface), tx_cal1.u64); + } + +/* +* Next we initialize the rx calendar starting from entry 0, +* incrementing the entry with every write. +*/ + rx_idx.u64 =0 ; + rx_idx.s.inc =1 ; +csr_wr (CVMX_ILK_RXX_IDX_CAL (interface), rx_idx.u64); + +/* Set state to xon for all entries */ + rx_cal0.u64 =0 ; + rx_cal0.s.entry_ctl0 =XON ; + rx_cal0.s.entry_ctl1 =XON ; + rx_cal0.s.entry_ctl2 =XON ; + rx_cal0.s.entry_ctl3 =XON ; + + rx_cal1.u64 =0 ; + rx_cal1.s.entry_ctl4 =XON ; + rx_cal1.s.entry_ctl5 =XON ; + rx_cal1.s.entry_ctl6 =XON ; + rx_cal1.s.entry_ctl7 =XON ; + +/* Write all 288 entries */ +for (i =0 ; i <CVMX_ILK_MAX_CAL_IDX ; i++) { +csr_wr (CVMX_ILK_RXX_MEM_CAL0 (interface), rx_cal0.u64); +csr_wr (CVMX_ILK_RXX_MEM_CAL1 (interface), rx_cal1.u64); + } +} + +/** +* @INTERNAL +* Initialize all calendar entries. +* +* @param interface whose calendar is to be initialized. +*/ +void __cvmx_ilk_clear_cal (int interface) +{ +if (OCTEON_IS_MODEL (OCTEON_CN68XX )) +__cvmx_ilk_clear_cal_cn68xx (interface); +else if (OCTEON_IS_MODEL (OCTEON_CN78XX )) +__cvmx_ilk_clear_cal_cn78xx (interface); +} + +void __cvmx_ilk_write_tx_cal_entry_cn68xx (int interface,int channel, +unsigned char bpid) +{ +cvmx_ilk_txx_idx_cal_t tx_idx; +cvmx_ilk_txx_mem_cal0_t tx_cal0; +cvmx_ilk_txx_mem_cal1_t tx_cal1; +int entry; +int window; +int window_entry; + +/* +* The calendar has 288 entries. Each calendar entry represents a +* channel's flow control state or the link flow control state. +* Starting with the first entry, every sixteenth entry is used for the +* link flow control state. The other 15 entries are used for the +* channels flow control state: +* entry 0 ----> link flow control state +* entry 1 ----> channel 0 flow control state +* entry 2 ----> channel 1 flow control state +* ... +* entry 15 ----> channel 14 flow control state +* entry 16 ----> link flow control state +* entry 17 ----> channel 15 flow control state +* +* Also, the calendar is accessed via windows into it. Each window maps +* to 8 entries. +*/ + entry =1 + channel + (channel /15 ); + window = entry /8 ; + window_entry = entry %8 ; + +/* Indicate the window we need to access */ + tx_idx.u64 =0 ; + tx_idx.s.index = window; +csr_wr (CVMX_ILK_TXX_IDX_CAL (interface), tx_idx.u64); + +/* Get the window's current value */ + tx_cal0.u64 =csr_rd (CVMX_ILK_TXX_MEM_CAL0 (interface)); + tx_cal1.u64 =csr_rd (CVMX_ILK_TXX_MEM_CAL1 (interface)); + +/* Force every sixteenth entry as link flow control state */ +if ((window &1 ) ==0 ) + tx_cal0.s.entry_ctl0 =LINK ; + +/* Update the entry */ +switch (window_entry) { +case 0 : + tx_cal0.s.entry_ctl0 =0 ; + tx_cal0.s.bpid0 = bpid; +break ; +case 1 : + tx_cal0.s.entry_ctl1 =0 ; + tx_cal0.s.bpid1 = bpid; +break ; +case 2 : + tx_cal0.s.entry_ctl2 =0 ; + tx_cal0.s.bpid2 = bpid; +break ; +case 3 : + tx_cal0.s.entry_ctl3 =0 ; + tx_cal0.s.bpid3 = bpid; +break ; +case 4 : + tx_cal1.s.entry_ctl4 =0 ; + tx_cal1.s.bpid4 = bpid; +break ; +case 5 : + tx_cal1.s.entry_ctl5 =0 ; + tx_cal1.s.bpid5 = bpid; +break ; +case 6 : + tx_cal1.s.entry_ctl6 =0 ; + tx_cal1.s.bpid6 = bpid; +break ; +case 7 : + tx_cal1.s.entry_ctl7 =0 ; + tx_cal1.s.bpid7 = bpid; +break ; + } + +/* Write the window new value */ +csr_wr (CVMX_ILK_TXX_MEM_CAL0 (interface), tx_cal0.u64); +csr_wr (CVMX_ILK_TXX_MEM_CAL1 (interface), tx_cal1.u64); +} + +void __cvmx_ilk_write_tx_cal_entry_cn78xx (int intf,int channel, +unsigned char bpid) +{ +cvmx_ilk_txx_cal_entryx_t tx_cal; +int calender_16_block = channel /15 ; +int calender_16_index = channel %15 +1 ; +int index = calender_16_block *16 + calender_16_index; +int node = (intf >>4 ) &0xf ; +int interface = intf &0xf ; + +/* Program the link status on first channel */ +if (calender_16_index ==1 ) { + tx_cal.u64 =0 ; + tx_cal.s.ctl =1 ; +csr_wr_node (node,CVMX_ILK_TXX_CAL_ENTRYX (index -1 , interface), + tx_cal.u64); + } + tx_cal.u64 =0 ; + tx_cal.s.ctl =0 ; + tx_cal.s.channel = channel; +csr_wr_node (node,CVMX_ILK_TXX_CAL_ENTRYX (index, interface), + tx_cal.u64); +} + +/** +* @INTERNAL +* Setup the channel's tx calendar entry. +* +* @param interface channel belongs to +* @param channel whose calendar entry is to be updated +* @param bpid assigned to the channel +*/ +void __cvmx_ilk_write_tx_cal_entry (int interface,int channel, +unsigned char bpid) +{ +if (OCTEON_IS_MODEL (OCTEON_CN68XX )) +__cvmx_ilk_write_tx_cal_entry_cn68xx (interface, channel, bpid); +else +__cvmx_ilk_write_tx_cal_entry_cn78xx (interface, channel, bpid); +} + +void __cvmx_ilk_write_rx_cal_entry_cn78xx (int intf,int channel, +unsigned char bpid) +{ +cvmx_ilk_rxx_cal_entryx_t rx_cal; +int calender_16_block = channel /15 ; +int calender_16_index = channel %15 +1 ; +int index = calender_16_block *16 + calender_16_index; +int node = (intf >>4 ) &0xf ; +int interface = intf &0xf ; + +/* Program the link status on first channel */ +if (calender_16_index ==1 ) { + rx_cal.u64 =0 ; + rx_cal.s.ctl =1 ; +csr_wr_node (node,CVMX_ILK_RXX_CAL_ENTRYX (index -1 , interface), + rx_cal.u64); + } + rx_cal.u64 =0 ; + rx_cal.s.ctl =0 ; + rx_cal.s.channel = channel; +csr_wr_node (node,CVMX_ILK_RXX_CAL_ENTRYX (index, interface), + rx_cal.u64); +} + +void __cvmx_ilk_write_rx_cal_entry_cn68xx (int interface,int channel, +unsigned char pipe) +{ +cvmx_ilk_rxx_idx_cal_t rx_idx; +cvmx_ilk_rxx_mem_cal0_t rx_cal0; +cvmx_ilk_rxx_mem_cal1_t rx_cal1; +int entry; +int window; +int window_entry; + +/* +* The calendar has 288 entries. Each calendar entry represents a +* channel's flow control state or the link flow control state. +* Starting with the first entry, every sixteenth entry is used for the +* link flow control state. The other 15 entries are used for the +* channels flow control state: +* entry 0 ----> link flow control state +* entry 1 ----> channel 0 flow control state +* entry 2 ----> channel 1 flow control state +* ... +* entry 15 ----> channel 14 flow control state +* entry 16 ----> link flow control state +* entry 17 ----> channel 15 flow control state +* +* Also, the calendar is accessed via windows into it. Each window maps +* to 8 entries. +*/ + entry =1 + channel + (channel /15 ); + window = entry /8 ; + window_entry = entry %8 ; + +/* Indicate the window we need to access */ + rx_idx.u64 =0 ; + rx_idx.s.index = window; +csr_wr (CVMX_ILK_RXX_IDX_CAL (interface), rx_idx.u64); + +/* Get the window's current value */ + rx_cal0.u64 =csr_rd (CVMX_ILK_RXX_MEM_CAL0 (interface)); + rx_cal1.u64 =csr_rd (CVMX_ILK_RXX_MEM_CAL1 (interface)); + +/* Force every sixteenth entry as link flow control state */ +if ((window &1 ) ==0 ) + rx_cal0.s.entry_ctl0 =LINK ; + +/* Update the entry */ +switch (window_entry) { +case 0 : + rx_cal0.s.entry_ctl0 =0 ; + rx_cal0.s.port_pipe0 = pipe; +break ; +case 1 : + rx_cal0.s.entry_ctl1 =0 ; + rx_cal0.s.port_pipe1 = pipe; +break ; +case 2 : + rx_cal0.s.entry_ctl2 =0 ; + rx_cal0.s.port_pipe2 = pipe; +break ; +case 3 : + rx_cal0.s.entry_ctl3 =0 ; + rx_cal0.s.port_pipe3 = pipe; +break ; +case 4 : + rx_cal1.s.entry_ctl4 =0 ; + rx_cal1.s.port_pipe4 = pipe; +break ; +case 5 : + rx_cal1.s.entry_ctl5 =0 ; + rx_cal1.s.port_pipe5 = pipe; +break ; +case 6 : + rx_cal1.s.entry_ctl6 =0 ; + rx_cal1.s.port_pipe6 = pipe; +break ; +case 7 : + rx_cal1.s.entry_ctl7 =0 ; + rx_cal1.s.port_pipe7 = pipe; +break ; + } + +/* Write the window new value */ +csr_wr (CVMX_ILK_RXX_MEM_CAL0 (interface), rx_cal0.u64); +csr_wr (CVMX_ILK_RXX_MEM_CAL1 (interface), rx_cal1.u64); +} + +/** +* @INTERNAL +* Setup the channel's rx calendar entry. +* +* @param interface channel belongs to +* @param channel whose calendar entry is to be updated +* @param pipe PKO assigned to the channel +*/ +void __cvmx_ilk_write_rx_cal_entry (int interface,int channel, +unsigned char pipe) +{ +if (OCTEON_IS_MODEL (OCTEON_CN68XX )) +__cvmx_ilk_write_rx_cal_entry_cn68xx (interface, channel, pipe); +else +__cvmx_ilk_write_rx_cal_entry_cn78xx (interface, channel, pipe); +} + +/** +* @INTERNAL +* Probe a ILK interface and determine the number of ports +* connected to it. The ILK interface should still be down +* after this call. +* +* @param xiface Interface to probe +* +* @return Number of ports on the interface. Zero to disable. +*/ +int __cvmx_helper_ilk_probe (int xiface) +{ +int res =0 ; +int interface; +struct cvmx_xiface xi =cvmx_helper_xiface_to_node_interface (xiface); + +if (!octeon_has_feature (OCTEON_FEATURE_ILK )) +return res; + + interface = xi.interface -CVMX_ILK_GBL_BASE (); +if (interface >=CVMX_NUM_ILK_INTF ) +return 0 ; + +/* the configuration should be done only once */ +if (cvmx_ilk_get_intf_ena (xiface)) +return cvmx_ilk_chans[xi.node][interface]; + +/* configure lanes and enable the link */ + res =cvmx_ilk_start_interface (((xi.node <<4 ) | interface), + cvmx_ilk_lane_mask[xi.node][interface]); +if (res <0 ) +return 0 ; + + res =__cvmx_helper_ilk_enumerate (xiface); + +return res; +} + +static int __cvmx_helper_ilk_init_port_cn68xx (int xiface) +{ +int i, j, res =-1 ; +static int pipe_base =0 , pknd_base; +static cvmx_ilk_pipe_chan_t *pch =NULL , *tmp; +static cvmx_ilk_chan_pknd_t *chpknd =NULL , *tmp1; +static cvmx_ilk_cal_entry_t *calent =NULL , *tmp2; +int enable_rx_cal =1 ; +int interface; +struct cvmx_xiface xi =cvmx_helper_xiface_to_node_interface (xiface); +int intf; +int num_chans; + + interface = xi.interface -CVMX_ILK_GBL_BASE (); + intf = (xi.node <<4 ) | interface; +if (interface >=CVMX_NUM_ILK_INTF ) +return 0 ; + + num_chans = cvmx_ilk_chans[0 ][interface]; + +/* set up channel to pkind mapping */ +if (pknd_base ==0 ) + pknd_base =cvmx_helper_get_pknd (xiface,0 ); + +/* set up the group of pipes available to ilk */ +if (pipe_base ==0 ) + pipe_base = +__cvmx_pko_get_pipe (interface +CVMX_ILK_GBL_BASE (),0 ); + +if (pipe_base ==-1 ) { + pipe_base =0 ; +return 0 ; + } + + res =cvmx_ilk_set_pipe (xiface, pipe_base, + cvmx_ilk_chans[0 ][interface]); +if (res <0 ) +return 0 ; + +/* set up pipe to channel mapping */ + i = pipe_base; +if (!pch) { + pch = (cvmx_ilk_pipe_chan_t *)cvmx_bootmem_alloc ( + num_chans *sizeof (cvmx_ilk_pipe_chan_t), +sizeof (cvmx_ilk_pipe_chan_t)); +if (!pch) +return 0 ; + } + +memset (pch,0 , num_chans *sizeof (cvmx_ilk_pipe_chan_t)); + tmp = pch; +for (j =0 ; j < num_chans; j++) { + tmp->pipe = i++; + tmp->chan = j; + tmp++; + } + res =cvmx_ilk_tx_set_channel (interface, pch, + cvmx_ilk_chans[0 ][interface]); +if (res <0 ) { + res =0 ; + goto err_free_pch; + } + pipe_base += cvmx_ilk_chans[0 ][interface]; + i = pknd_base; +if (!chpknd) { + chpknd = (cvmx_ilk_chan_pknd_t *)cvmx_bootmem_alloc ( +CVMX_ILK_MAX_PKNDS *sizeof (cvmx_ilk_chan_pknd_t), +sizeof (cvmx_ilk_chan_pknd_t)); +if (!chpknd) { + pipe_base -= cvmx_ilk_chans[xi.node][interface]; + res =0 ; + goto err_free_pch; + } + } + +memset (chpknd,0 ,CVMX_ILK_MAX_PKNDS *sizeof (cvmx_ilk_chan_pknd_t)); + tmp1 = chpknd; +for (j =0 ; j < cvmx_ilk_chans[xi.node][interface]; j++) { + tmp1->chan = j; + tmp1->pknd = i++; + tmp1++; + } + + res =cvmx_ilk_rx_set_pknd (xiface, chpknd, + cvmx_ilk_chans[xi.node][interface]); +if (res <0 ) { + pipe_base -= cvmx_ilk_chans[xi.node][interface]; + res =0 ; + goto err_free_chpknd; + } + pknd_base += cvmx_ilk_chans[xi.node][interface]; + +/* Set up tx calendar */ +if (!calent) { + calent = (cvmx_ilk_cal_entry_t *)cvmx_bootmem_alloc ( +CVMX_ILK_MAX_PIPES *sizeof (cvmx_ilk_cal_entry_t), +sizeof (cvmx_ilk_cal_entry_t)); +if (!calent) { + pipe_base -= cvmx_ilk_chans[xi.node][interface]; + pknd_base -= cvmx_ilk_chans[xi.node][interface]; + res =0 ; + goto err_free_chpknd; + } + } + +memset (calent,0 ,CVMX_ILK_MAX_PIPES *sizeof (cvmx_ilk_cal_entry_t)); + tmp1 = chpknd; + tmp2 = calent; +for (j =0 ; j < cvmx_ilk_chans[xi.node][interface]; j++) { + tmp2->pipe_bpid = tmp1->pknd; + tmp2->ent_ctrl =PIPE_BPID ; + tmp1++; + tmp2++; + } + res =cvmx_ilk_cal_setup_tx (intf, cvmx_ilk_chans[xi.node][interface], + calent,1 ); +if (res <0 ) { + pipe_base -= cvmx_ilk_chans[xi.node][interface]; + pknd_base -= cvmx_ilk_chans[xi.node][interface]; + res =0 ; + goto err_free_calent; + } + +/* set up rx calendar. allocated memory can be reused. +* this is because max pkind is always less than max pipe +*/ +memset (calent,0 ,CVMX_ILK_MAX_PIPES *sizeof (cvmx_ilk_cal_entry_t)); + tmp = pch; + tmp2 = calent; +for (j =0 ; j < cvmx_ilk_chans[0 ][interface]; j++) { + tmp2->pipe_bpid = tmp->pipe; + tmp2->ent_ctrl =PIPE_BPID ; + tmp++; + tmp2++; + } +if (cvmx_ilk_use_la_mode (interface,0 )) + enable_rx_cal =cvmx_ilk_la_mode_enable_rx_calendar (interface); +else + enable_rx_cal =1 ; + + res =cvmx_ilk_cal_setup_rx (intf, cvmx_ilk_chans[xi.node][interface], + calent,CVMX_ILK_RX_FIFO_WM , enable_rx_cal); +if (res <0 ) { + pipe_base -= cvmx_ilk_chans[xi.node][interface]; + pknd_base -= cvmx_ilk_chans[xi.node][interface]; + res =0 ; + goto err_free_calent; + } + goto out; + +err_free_calent: +/* no free() for cvmx_bootmem_alloc() */ + +err_free_chpknd: +/* no free() for cvmx_bootmem_alloc() */ + +err_free_pch: +/* no free() for cvmx_bootmem_alloc() */ +out: +return res; +} + +static int __cvmx_helper_ilk_init_port_cn78xx (int xiface) +{ +struct cvmx_xiface xi =cvmx_helper_xiface_to_node_interface (xiface); +int interface; +int intf; + + interface = xi.interface -CVMX_ILK_GBL_BASE (); + intf = (xi.node <<4 ) | interface; +if (interface >=CVMX_NUM_ILK_INTF ) +return 0 ; + +if (OCTEON_IS_MODEL (OCTEON_CN78XX )) { +struct cvmx_pki_style_config style_cfg; +int num_channels = cvmx_ilk_chans[xi.node][interface]; +int index, i; + +for (i =0 ; i < num_channels; i++) { +int pknd; + + index = (i %8 ); + +/* Set jabber to allow max sized packets */ +if (i ==0 ) +csr_wr_node (xi.node, +CVMX_ILK_RXX_JABBER (interface), +0xfff8 ); + +/* Setup PKND */ + pknd =cvmx_helper_get_pknd (xiface, index); +csr_wr_node (xi.node,CVMX_ILK_RXX_CHAX (i, interface), + pknd); +cvmx_pki_read_style_config ( +0 , pknd,CVMX_PKI_CLUSTER_ALL , &style_cfg); + style_cfg.parm_cfg.qpg_port_sh =0 ; +/* 256 channels */ + style_cfg.parm_cfg.qpg_port_msb =8 ; +cvmx_pki_write_style_config ( +0 , pknd,CVMX_PKI_CLUSTER_ALL , &style_cfg); + } + +cvmx_ilk_cal_setup_tx (intf, num_channels,NULL ,1 ); +cvmx_ilk_cal_setup_rx (intf, num_channels,NULL , +CVMX_ILK_RX_FIFO_WM ,1 ); + } +return 0 ; +} + +static int __cvmx_helper_ilk_init_port (int xiface) +{ +if (OCTEON_IS_MODEL (OCTEON_CN68XX )) +return __cvmx_helper_ilk_init_port_cn68xx (xiface); +else +return __cvmx_helper_ilk_init_port_cn78xx (xiface); +} + +/** +* @INTERNAL +* Bringup and enable ILK interface. After this call packet +* I/O should be fully functional. This is called with IPD +* enabled but PKO disabled. +* +* @param xiface Interface to bring up +* +* @return Zero on success, negative on failure +*/ +int __cvmx_helper_ilk_enable (int xiface) +{ +if (__cvmx_helper_ilk_init_port (xiface) <0 ) +return -1 ; + +return cvmx_ilk_enable (xiface); +} + +/** +* @INTERNAL +* Return the link state of an IPD/PKO port as returned by ILK link status. +* +* @param ipd_port IPD/PKO port to query +* +* @return Link state +*/ +cvmx_helper_link_info_t __cvmx_helper_ilk_link_get (int ipd_port) +{ +cvmx_helper_link_info_t result; +int xiface =cvmx_helper_get_interface_num (ipd_port); +struct cvmx_xiface xi =cvmx_helper_xiface_to_node_interface (xiface); +int interface; +int retry_count =0 ; +cvmx_ilk_rxx_cfg1_t ilk_rxx_cfg1; +cvmx_ilk_rxx_int_t ilk_rxx_int; +int lane_mask =0 ; +int i; +int node = xi.node; + + result.u64 =0 ; + interface = xi.interface -CVMX_ILK_GBL_BASE (); + +retry: + retry_count++; +if (retry_count >200 ) + goto fail; + +/* Read RX config and status bits */ + ilk_rxx_cfg1.u64 =csr_rd_node (node,CVMX_ILK_RXX_CFG1 (interface)); + ilk_rxx_int.u64 =csr_rd_node (node,CVMX_ILK_RXX_INT (interface)); + +if (ilk_rxx_cfg1.s.rx_bdry_lock_ena ==0 ) { +/* (GSER-21957) GSER RX Equalization may make >= 5gbaud non-KR +* channel better +*/ +if (OCTEON_IS_MODEL (OCTEON_CN78XX )) { +int qlm, lane_mask; + +for (qlm =4 ; qlm <8 ; qlm++) { + lane_mask =1 << (qlm -4 ) *4 ; +if (lane_mask & + cvmx_ilk_lane_mask[node][interface]) { +if (__cvmx_qlm_rx_equalization ( + node, qlm,-1 )) + goto retry; + } + } + } + +/* Clear the boundary lock status bit */ + ilk_rxx_int.u64 =0 ; + ilk_rxx_int.s.word_sync_done =1 ; +csr_wr_node (node,CVMX_ILK_RXX_INT (interface), ilk_rxx_int.u64); + +/* We need to start looking for word boundary lock */ + ilk_rxx_cfg1.s.rx_bdry_lock_ena = + cvmx_ilk_lane_mask[node][interface]; + ilk_rxx_cfg1.s.rx_align_ena =0 ; +csr_wr_node (node,CVMX_ILK_RXX_CFG1 (interface), + ilk_rxx_cfg1.u64); +//debug("ILK%d: Looking for word boundary lock\n", interface); +udelay (50 ); + goto retry; + } + +if (ilk_rxx_cfg1.s.rx_align_ena ==0 ) { +if (ilk_rxx_int.s.word_sync_done) { +/* Clear the lane align status bits */ + ilk_rxx_int.u64 =0 ; + ilk_rxx_int.s.lane_align_fail =1 ; + ilk_rxx_int.s.lane_align_done =1 ; +csr_wr_node (node,CVMX_ILK_RXX_INT (interface), + ilk_rxx_int.u64); + + ilk_rxx_cfg1.s.rx_align_ena =1 ; +csr_wr_node (node,CVMX_ILK_RXX_CFG1 (interface), + ilk_rxx_cfg1.u64); +//printf("ILK%d: Looking for lane alignment\n", interface); + } +udelay (50 ); + goto retry; + } + +if (ilk_rxx_int.s.lane_align_fail) { + ilk_rxx_cfg1.s.rx_bdry_lock_ena =0 ; + ilk_rxx_cfg1.s.rx_align_ena =0 ; +csr_wr_node (node,CVMX_ILK_RXX_CFG1 (interface), + ilk_rxx_cfg1.u64); +//debug("ILK%d: Lane alignment failed\n", interface); + goto fail; + } + + lane_mask = ilk_rxx_cfg1.s.rx_bdry_lock_ena; + +if (ilk_rxx_cfg1.s.pkt_ena ==0 && ilk_rxx_int.s.lane_align_done) { +cvmx_ilk_txx_cfg1_t ilk_txx_cfg1; + + ilk_txx_cfg1.u64 = +csr_rd_node (node,CVMX_ILK_TXX_CFG1 (interface)); + ilk_rxx_cfg1.u64 = +csr_rd_node (node,CVMX_ILK_RXX_CFG1 (interface)); + ilk_rxx_cfg1.s.pkt_ena = ilk_txx_cfg1.s.pkt_ena; +csr_wr_node (node,CVMX_ILK_RXX_CFG1 (interface), + ilk_rxx_cfg1.u64); + +if (OCTEON_IS_MODEL (OCTEON_CN68XX )) { +/* +* Enable rxf_ctl_perr, rxf_lnk0_perr, rxf_lnk1_perr, +* pop_empty, push_full. +*/ +csr_wr (CVMX_ILK_GBL_INT_EN ,0x1f ); +/* Enable bad_pipe, bad_seq, txf_err */ +csr_wr (CVMX_ILK_TXX_INT_EN (interface),0x7 ); + +/* +* Enable crc24_err, lane_bad_word, +* pkt_drop_{rid,rxf,sop} +*/ +csr_wr (CVMX_ILK_RXX_INT_EN (interface),0x1e2 ); + } +/* Need to enable ILK interrupts for 78xx */ + +for (i =0 ; i <CVMX_ILK_MAX_LANES (); i++) { +if ((1 << i) & lane_mask) { +/* clear pending interrupts, before enabling. */ +csr_wr_node (node,CVMX_ILK_RX_LNEX_INT (i), +0x1ff ); +/* Enable bad_64b67b, bdry_sync_loss, crc32_err, +* dskew_fifo_ovfl, scrm_sync_loss, +* serdes_lock_loss, stat_msg, ukwn_cntl_word +*/ +if (OCTEON_IS_MODEL (OCTEON_CN68XX )) +csr_wr (CVMX_ILK_RX_LNEX_INT_EN (i), +0x1ff ); + } + } + +//debug("ILK%d: Lane alignment complete\n", interface); + } + +/* Enable error interrupts, now link is up */ +cvmx_error_enable_group (CVMX_ERROR_GROUP_ILK , + node | (interface <<2 ) | (lane_mask <<4 )); + + result.s.link_up =1 ; + result.s.full_duplex =1 ; +if (OCTEON_IS_MODEL (OCTEON_CN78XX )) { +int qlm =cvmx_qlm_lmac (xiface,0 ); + + result.s.speed =cvmx_qlm_get_gbaud_mhz (qlm) *64 /67 ; + }else { + result.s.speed = +cvmx_qlm_get_gbaud_mhz (1 + interface) *64 /67 ; + } + result.s.speed *=cvmx_pop (lane_mask); + +return result; + +fail: +if (ilk_rxx_cfg1.s.pkt_ena) { +/* Disable the interface */ + ilk_rxx_cfg1.s.pkt_ena =0 ; +csr_wr_node (node,CVMX_ILK_RXX_CFG1 (interface), + ilk_rxx_cfg1.u64); + +/* Disable error interrupts */ +for (i =0 ; i <CVMX_ILK_MAX_LANES (); i++) { +/* Disable bad_64b67b, bdry_sync_loss, crc32_err, +* dskew_fifo_ovfl, scrm_sync_loss, serdes_lock_loss, +* stat_msg, ukwn_cntl_word +*/ +if ((1 << i) & lane_mask) { +csr_wr_node (node,CVMX_ILK_RX_LNEX_INT (i), +0x1ff ); +if (OCTEON_IS_MODEL (OCTEON_CN68XX )) +csr_wr (CVMX_ILK_RX_LNEX_INT_EN (i), + ~0x1ff ); + } + } +/* Disable error interrupts */ +cvmx_error_enable_group (CVMX_ERROR_GROUP_ILK ,0 ); + } + +return result; +} + +/** +* @INTERNAL +* Set the link state of an IPD/PKO port. +* +* @param ipd_port IPD/PKO port to configure +* @param link_info The new link state +* +* @return Zero on success, negative on failure +*/ +int __cvmx_helper_ilk_link_set (int ipd_port,cvmx_helper_link_info_t link_info) +{ +/* Do nothing */ +return 0 ; +} + +/** +* Display ilk interface statistics. +* +*/ +void __cvmx_helper_ilk_show_stats (void ) +{ +int i, j; +int chan_tmp[CVMX_ILK_MAX_CHANS ]; +cvmx_ilk_stats_ctrl_t ilk_stats_ctrl; + +for (i =0 ; i <CVMX_NUM_ILK_INTF ; i++) { +int num_chans = cvmx_ilk_chans[0 ][i]; + +memset (chan_tmp,0 , num_chans *sizeof (int )); +for (j =0 ; j < num_chans; j++) + chan_tmp[j] = j; + + ilk_stats_ctrl.chan_list = chan_tmp; + ilk_stats_ctrl.num_chans = num_chans; + ilk_stats_ctrl.clr_on_rd =0 ; +cvmx_ilk_show_stats (i, &ilk_stats_ctrl); + } +}
Signature · 1 line
2.35.1
PATCH 14/52 mips: octeon: Add cvmx-helper-ipd.c
In reply to Stefan RoeseFrom: Aaron Williams <[email protected]>
Import cvmx-helper-ipd.c from 2013 U-Boot. It will be used by the later added drivers to support networking on the MIPS Octeon II / III platforms.
--- arch/mips/mach-octeon/cvmx-helper-ipd.c | 313 ++++++++++++++++++++++++ 1 file changed, 313 insertions(+) create mode 100644 arch/mips/mach-octeon/cvmx-helper-ipd.c
arch/mips/mach-octeon/cvmx-helper-ipd.c new file +313 -0
@@ -0,0 +1,313 @@ +// SPDX-License-Identifier: GPL-2.0 +/* +* Copyright (C) 2018-2022 Marvell International Ltd. +* +* IPD helper functions. +*/ + +#include <errno.h> +#include <log.h> +#include <time.h> +#include <linux/delay.h> + +#include <mach/cvmx-regs.h> +#include <mach/cvmx-csr.h> +#include <mach/cvmx-bootmem.h> +#include <mach/octeon-model.h> +#include <mach/cvmx-fuse.h> +#include <mach/octeon-feature.h> +#include <mach/cvmx-qlm.h> +#include <mach/octeon_qlm.h> +#include <mach/cvmx-pcie.h> +#include <mach/cvmx-coremask.h> +#include <mach/cvmx-range.h> +#include <mach/cvmx-global-resources.h> + +#include <mach/cvmx-agl-defs.h> +#include <mach/cvmx-bgxx-defs.h> +#include <mach/cvmx-ciu-defs.h> +#include <mach/cvmx-gmxx-defs.h> +#include <mach/cvmx-gserx-defs.h> +#include <mach/cvmx-ilk-defs.h> +#include <mach/cvmx-ipd-defs.h> +#include <mach/cvmx-pcsx-defs.h> +#include <mach/cvmx-pcsxx-defs.h> +#include <mach/cvmx-pki-defs.h> +#include <mach/cvmx-pko-defs.h> +#include <mach/cvmx-xcv-defs.h> + +#include <mach/cvmx-hwpko.h> +#include <mach/cvmx-ilk.h> +#include <mach/cvmx-ipd.h> +#include <mach/cvmx-pki.h> +#include <mach/cvmx-pko3.h> +#include <mach/cvmx-pko3-queue.h> +#include <mach/cvmx-pko3-resources.h> +#include <mach/cvmx-pip.h> + +#include <mach/cvmx-helper.h> +#include <mach/cvmx-helper-board.h> +#include <mach/cvmx-helper-cfg.h> + +#include <mach/cvmx-helper-bgx.h> +#include <mach/cvmx-helper-cfg.h> +#include <mach/cvmx-helper-util.h> +#include <mach/cvmx-helper-pki.h> + +/** It allocate pools for packet and wqe pools +* and sets up the FPA hardware +*/ +int __cvmx_helper_ipd_setup_fpa_pools (void ) +{ +cvmx_fpa_global_initialize (); +if (cvmx_ipd_cfg.packet_pool.buffer_count ==0 ) +return 0 ; +__cvmx_helper_initialize_fpa_pool (cvmx_ipd_cfg.packet_pool.pool_num, + cvmx_ipd_cfg.packet_pool.buffer_size, + cvmx_ipd_cfg.packet_pool.buffer_count, +"Packet Buffers" ); +if (cvmx_ipd_cfg.wqe_pool.buffer_count ==0 ) +return 0 ; +__cvmx_helper_initialize_fpa_pool (cvmx_ipd_cfg.wqe_pool.pool_num, + cvmx_ipd_cfg.wqe_pool.buffer_size, + cvmx_ipd_cfg.wqe_pool.buffer_count, +"WQE Buffers" ); +return 0 ; +} + +/** +* @INTERNAL +* Setup global setting for IPD/PIP not related to a specific +* interface or port. This must be called before IPD is enabled. +* +* @return Zero on success, negative on failure. +*/ +int __cvmx_helper_ipd_global_setup (void ) +{ +/* Setup the packet and wqe pools*/ +__cvmx_helper_ipd_setup_fpa_pools (); +/* Setup the global packet input options */ +cvmx_ipd_config (cvmx_ipd_cfg.packet_pool.buffer_size /8 , + cvmx_ipd_cfg.first_mbuf_skip /8 , + cvmx_ipd_cfg.not_first_mbuf_skip /8 , +/* The +8 is to account for the next ptr */ + (cvmx_ipd_cfg.first_mbuf_skip +8 ) /128 , +/* The +8 is to account for the next ptr */ + (cvmx_ipd_cfg.not_first_mbuf_skip +8 ) /128 , + cvmx_ipd_cfg.wqe_pool.pool_num, + (cvmx_ipd_mode_t)(cvmx_ipd_cfg.cache_mode),1 ); +return 0 ; +} + +/** +* Enable or disable FCS stripping for all the ports on an interface. +* +* @param xiface +* @param nports number of ports +* @param has_fcs 0 for disable and !0 for enable +*/ +static int cvmx_helper_fcs_op (int xiface,int nports,int has_fcs) +{ +u64 port_bit; +int index; +int pknd; +union cvmx_pip_sub_pkind_fcsx pkind_fcsx; +union cvmx_pip_prt_cfgx port_cfg; +struct cvmx_xiface xi =cvmx_helper_xiface_to_node_interface (xiface); + +if (!octeon_has_feature (OCTEON_FEATURE_PKND )) +return 0 ; +if (octeon_has_feature (OCTEON_FEATURE_PKI )) { +cvmx_helper_pki_set_fcs_op (xi.node, xi.interface, nports, + has_fcs); +return 0 ; + } + + port_bit =0 ; +for (index =0 ; index < nports; index++) + port_bit |= ((u64 )1 <<cvmx_helper_get_pknd (xiface, index)); + + pkind_fcsx.u64 =csr_rd (CVMX_PIP_SUB_PKIND_FCSX (0 )); +if (has_fcs) + pkind_fcsx.s.port_bit |= port_bit; +else + pkind_fcsx.s.port_bit &= ~port_bit; +csr_wr (CVMX_PIP_SUB_PKIND_FCSX (0 ), pkind_fcsx.u64); + +for (pknd =0 ; pknd <64 ; pknd++) { +if ((1ull << pknd) & port_bit) { + port_cfg.u64 =csr_rd (CVMX_PIP_PRT_CFGX (pknd)); + port_cfg.s.crc_en = (has_fcs) ?1 :0 ; +csr_wr (CVMX_PIP_PRT_CFGX (pknd), port_cfg.u64); + } + } + +return 0 ; +} + +/** +* @INTERNAL +* Configure the IPD/PIP tagging and QoS options for a specific +* port. This function determines the POW work queue entry +* contents for a port. The setup performed here is controlled by +* the defines in executive-config.h. +* +* @param ipd_port Port/Port kind to configure. This follows the IPD numbering, +* not the per interface numbering +* +* @return Zero on success, negative on failure +*/ +static int __cvmx_helper_ipd_port_setup (int ipd_port) +{ +union cvmx_pip_prt_cfgx port_config; +union cvmx_pip_prt_tagx tag_config; + +if (octeon_has_feature (OCTEON_FEATURE_PKND )) { +int xiface, index, pknd; +union cvmx_pip_prt_cfgbx prt_cfgbx; + + xiface =cvmx_helper_get_interface_num (ipd_port); + index =cvmx_helper_get_interface_index_num (ipd_port); + pknd =cvmx_helper_get_pknd (xiface, index); + + port_config.u64 =csr_rd (CVMX_PIP_PRT_CFGX (pknd)); + tag_config.u64 =csr_rd (CVMX_PIP_PRT_TAGX (pknd)); + + port_config.s.qos = pknd &0x7 ; + +/* Default BPID to use for packets on this port-kind */ + prt_cfgbx.u64 =csr_rd (CVMX_PIP_PRT_CFGBX (pknd)); + prt_cfgbx.s.bpid = pknd; +csr_wr (CVMX_PIP_PRT_CFGBX (pknd), prt_cfgbx.u64); + }else { + port_config.u64 =csr_rd (CVMX_PIP_PRT_CFGX (ipd_port)); + tag_config.u64 =csr_rd (CVMX_PIP_PRT_TAGX (ipd_port)); + +/* Have each port go to a different POW queue */ + port_config.s.qos = ipd_port &0x7 ; + } + +/* Process the headers and place the IP header in the work queue */ + port_config.s.mode = + (cvmx_pip_port_parse_mode_t )cvmx_ipd_cfg.port_config.parse_mode; + + tag_config.s.ip6_src_flag = + cvmx_ipd_cfg.port_config.tag_fields.ipv6_src_ip; + tag_config.s.ip6_dst_flag = + cvmx_ipd_cfg.port_config.tag_fields.ipv6_dst_ip; + tag_config.s.ip6_sprt_flag = + cvmx_ipd_cfg.port_config.tag_fields.ipv6_src_port; + tag_config.s.ip6_dprt_flag = + cvmx_ipd_cfg.port_config.tag_fields.ipv6_dst_port; + tag_config.s.ip6_nxth_flag = + cvmx_ipd_cfg.port_config.tag_fields.ipv6_next_header; + tag_config.s.ip4_src_flag = + cvmx_ipd_cfg.port_config.tag_fields.ipv4_src_ip; + tag_config.s.ip4_dst_flag = + cvmx_ipd_cfg.port_config.tag_fields.ipv4_dst_ip; + tag_config.s.ip4_sprt_flag = + cvmx_ipd_cfg.port_config.tag_fields.ipv4_src_port; + tag_config.s.ip4_dprt_flag = + cvmx_ipd_cfg.port_config.tag_fields.ipv4_dst_port; + tag_config.s.ip4_pctl_flag = + cvmx_ipd_cfg.port_config.tag_fields.ipv4_protocol; + tag_config.s.inc_prt_flag = + cvmx_ipd_cfg.port_config.tag_fields.input_port; + tag_config.s.tcp6_tag_type = + (cvmx_pow_tag_type_t )cvmx_ipd_cfg.port_config.tag_type; + tag_config.s.tcp4_tag_type = + (cvmx_pow_tag_type_t )cvmx_ipd_cfg.port_config.tag_type; + tag_config.s.ip6_tag_type = + (cvmx_pow_tag_type_t )cvmx_ipd_cfg.port_config.tag_type; + tag_config.s.ip4_tag_type = + (cvmx_pow_tag_type_t )cvmx_ipd_cfg.port_config.tag_type; + tag_config.s.non_tag_type = + (cvmx_pow_tag_type_t )cvmx_ipd_cfg.port_config.tag_type; + +/* Put all packets in group 0. Other groups can be used by the app */ + tag_config.s.grp =0 ; + +cvmx_pip_config_port (ipd_port, port_config, tag_config); + +/* Give the user a chance to override our setting for each port */ +if (cvmx_override_ipd_port_setup) +cvmx_override_ipd_port_setup (ipd_port); + +return 0 ; +} + +/** +* @INTERNAL +* Setup the IPD/PIP for the ports on an interface. Packet +* classification and tagging are set for every port on the +* interface. The number of ports on the interface must already +* have been probed. +* +* @param xiface to setup IPD/PIP for +* +* @return Zero on success, negative on failure +*/ +int __cvmx_helper_ipd_setup_interface (int xiface) +{ +cvmx_helper_interface_mode_t mode; +int num_ports =cvmx_helper_ports_on_interface (xiface); +struct cvmx_xiface xi =cvmx_helper_xiface_to_node_interface (xiface); +int ipd_port =cvmx_helper_get_ipd_port (xiface,0 ); +int delta; + +if (num_ports ==CVMX_HELPER_CFG_INVALID_VALUE ) +return 0 ; + + delta =1 ; +if (octeon_has_feature (OCTEON_FEATURE_PKND )) { +if (xi.interface <CVMX_HELPER_MAX_GMX ) + delta =16 ; + } + +while (num_ports--) { +if (!cvmx_helper_is_port_valid (xiface, num_ports)) +continue ; +if (octeon_has_feature (OCTEON_FEATURE_PKI )) +__cvmx_helper_pki_port_setup (xi.node, ipd_port); +else +__cvmx_helper_ipd_port_setup (ipd_port); + ipd_port += delta; + } +/* FCS settings */ +cvmx_helper_fcs_op (xiface,cvmx_helper_ports_on_interface (xiface), +__cvmx_helper_get_has_fcs (xiface)); + + mode =cvmx_helper_interface_get_mode (xiface); + +if (mode ==CVMX_HELPER_INTERFACE_MODE_LOOP ) +__cvmx_helper_loop_enable (xiface); + +return 0 ; +} + +void cvmx_helper_ipd_set_wqe_no_ptr_mode (bool mode) +{ +if (!octeon_has_feature (OCTEON_FEATURE_PKI )) { +cvmx_ipd_ctl_status_t ipd_ctl_status; + + ipd_ctl_status.u64 =csr_rd (CVMX_IPD_CTL_STATUS ); + ipd_ctl_status.s.no_wptr = mode; +csr_wr (CVMX_IPD_CTL_STATUS , ipd_ctl_status.u64); + } +} + +void cvmx_helper_ipd_pkt_wqe_le_mode (bool mode) +{ +if (!octeon_has_feature (OCTEON_FEATURE_PKI )) { +cvmx_ipd_ctl_status_t ipd_ctl_status; + + ipd_ctl_status.u64 =csr_rd (CVMX_IPD_CTL_STATUS ); + ipd_ctl_status.s.pkt_lend = mode; + ipd_ctl_status.s.wqe_lend = mode; +csr_wr (CVMX_IPD_CTL_STATUS , ipd_ctl_status.u64); + }else { +int node =cvmx_get_node_num (); + +cvmx_helper_pki_set_little_endian (node); + } +}
Signature · 1 line
2.35.1
PATCH 15/52 mips: octeon: Add cvmx-helper-loop.c
In reply to Stefan RoeseFrom: Aaron Williams <[email protected]>
Import cvmx-helper-loop.c from 2013 U-Boot. It will be used by the later added drivers to support networking on the MIPS Octeon II / III platforms.
--- arch/mips/mach-octeon/cvmx-helper-loop.c | 178 +++++++++++++++++++++++ 1 file changed, 178 insertions(+) create mode 100644 arch/mips/mach-octeon/cvmx-helper-loop.c
arch/mips/mach-octeon/cvmx-helper-loop.c new file +178 -0
@@ -0,0 +1,178 @@ +// SPDX-License-Identifier: GPL-2.0 +/* +* Copyright (C) 2018-2022 Marvell International Ltd. +* +* Functions for LOOP initialization, configuration, +* and monitoring. +*/ + +#include <log.h> +#include <malloc.h> +#include <net.h> +#include <linux/delay.h> + +#include <mach/cvmx-regs.h> +#include <mach/cvmx-csr.h> +#include <mach/cvmx-bootmem.h> +#include <mach/octeon-model.h> +#include <mach/octeon_fdt.h> +#include <mach/cvmx-helper.h> +#include <mach/cvmx-helper-board.h> +#include <mach/cvmx-helper-cfg.h> +#include <mach/cvmx-helper-fdt.h> +#include <mach/cvmx-helper-gpio.h> + +#include <mach/cvmx-agl-defs.h> +#include <mach/cvmx-bgxx-defs.h> +#include <mach/cvmx-ciu-defs.h> +#include <mach/cvmx-gmxx-defs.h> +#include <mach/cvmx-gserx-defs.h> +#include <mach/cvmx-ilk-defs.h> +#include <mach/cvmx-ipd-defs.h> +#include <mach/cvmx-lbk-defs.h> +#include <mach/cvmx-pcsx-defs.h> +#include <mach/cvmx-pcsxx-defs.h> +#include <mach/cvmx-pki-defs.h> +#include <mach/cvmx-pko-defs.h> +#include <mach/cvmx-xcv-defs.h> + +#include <mach/cvmx-hwpko.h> +#include <mach/cvmx-ilk.h> +#include <mach/cvmx-pki.h> + +int __cvmx_helper_loop_enumerate (int xiface) +{ +return OCTEON_IS_MODEL (OCTEON_CN68XX ) ? +8 : (OCTEON_IS_MODEL (OCTEON_CNF71XX ) ?2 :4 ); +} + +/** +* @INTERNAL +* Probe a LOOP interface and determine the number of ports +* connected to it. The LOOP interface should still be down +* after this call. +* +* @param xiface Interface to probe +* +* @return Number of ports on the interface. Zero to disable. +*/ +int __cvmx_helper_loop_probe (int xiface) +{ +return __cvmx_helper_loop_enumerate (xiface); +} + +/** +* @INTERNAL +* Bringup and enable a LOOP interface. After this call packet +* I/O should be fully functional. This is called with IPD +* enabled but PKO disabled. +* +* @param interface to bring up +* +* @return Zero on success, negative on failure +*/ +int __cvmx_helper_loop_enable (int xiface) +{ +cvmx_pip_prt_cfgx_t port_cfg; +int num_ports, index; +unsigned long offset; +struct cvmx_xiface xi =cvmx_helper_xiface_to_node_interface (xiface); + + num_ports =__cvmx_helper_get_num_ipd_ports (xiface); +/* +* We need to disable length checking so packet < 64 bytes and jumbo +* frames don't get errors +*/ +for (index =0 ; index < num_ports; index++) { + offset = ((octeon_has_feature (OCTEON_FEATURE_PKND )) ? +cvmx_helper_get_pknd (xiface, index) : +cvmx_helper_get_ipd_port (xiface, index)); + +if (octeon_has_feature (OCTEON_FEATURE_PKI )) { +cvmx_pki_endis_l2_errs (xi.node, offset,1 ,0 ,0 ); +cvmx_pki_endis_fcs_check (xi.node, offset,0 ,0 ); + }else { + port_cfg.u64 =csr_rd (CVMX_PIP_PRT_CFGX (offset)); + port_cfg.s.maxerr_en =0 ; + port_cfg.s.minerr_en =0 ; +csr_wr (CVMX_PIP_PRT_CFGX (offset), port_cfg.u64); + } + } + +/* +* Disable FCS stripping for loopback ports +*/ +if (!octeon_has_feature (OCTEON_FEATURE_PKND )) { +cvmx_ipd_sub_port_fcs_t ipd_sub_port_fcs; + + ipd_sub_port_fcs.u64 =csr_rd (CVMX_IPD_SUB_PORT_FCS ); + ipd_sub_port_fcs.s.port_bit2 =0 ; +csr_wr (CVMX_IPD_SUB_PORT_FCS , ipd_sub_port_fcs.u64); + } +/* +* Set PKND and BPID for loopback ports. +*/ +if (OCTEON_IS_MODEL (OCTEON_CN68XX )) { +cvmx_pko_reg_loopback_pkind_t lp_pknd; +cvmx_pko_reg_loopback_bpid_t lp_bpid; + +for (index =0 ; index < num_ports; index++) { +int pknd =cvmx_helper_get_pknd (xiface, index); +int bpid =cvmx_helper_get_bpid (xiface, index); + + lp_pknd.u64 =csr_rd (CVMX_PKO_REG_LOOPBACK_PKIND ); + lp_bpid.u64 =csr_rd (CVMX_PKO_REG_LOOPBACK_BPID ); + +if (index ==0 ) + lp_pknd.s.num_ports = num_ports; + +switch (index) { +case 0 : + lp_pknd.s.pkind0 = pknd; + lp_bpid.s.bpid0 = bpid; +break ; +case 1 : + lp_pknd.s.pkind1 = pknd; + lp_bpid.s.bpid1 = bpid; +break ; +case 2 : + lp_pknd.s.pkind2 = pknd; + lp_bpid.s.bpid2 = bpid; +break ; +case 3 : + lp_pknd.s.pkind3 = pknd; + lp_bpid.s.bpid3 = bpid; +break ; +case 4 : + lp_pknd.s.pkind4 = pknd; + lp_bpid.s.bpid4 = bpid; +break ; +case 5 : + lp_pknd.s.pkind5 = pknd; + lp_bpid.s.bpid5 = bpid; +break ; +case 6 : + lp_pknd.s.pkind6 = pknd; + lp_bpid.s.bpid6 = bpid; +break ; +case 7 : + lp_pknd.s.pkind7 = pknd; + lp_bpid.s.bpid7 = bpid; +break ; + } +csr_wr (CVMX_PKO_REG_LOOPBACK_PKIND , lp_pknd.u64); +csr_wr (CVMX_PKO_REG_LOOPBACK_BPID , lp_bpid.u64); + } + }else if (octeon_has_feature (OCTEON_FEATURE_BGX )) { +cvmx_lbk_chx_pkind_t lbk_pkind; + +for (index =0 ; index < num_ports; index++) { + lbk_pkind.u64 =0 ; + lbk_pkind.s.pkind =cvmx_helper_get_pknd (xiface, index); +csr_wr_node (xi.node,CVMX_LBK_CHX_PKIND (index), + lbk_pkind.u64); + } + } + +return 0 ; +}
Signature · 1 line
2.35.1