18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
28c2ecf20Sopenharmony_ci/* Octeon CIU definitions
38c2ecf20Sopenharmony_ci *
48c2ecf20Sopenharmony_ci * Copyright (C) 2003-2018 Cavium, Inc.
58c2ecf20Sopenharmony_ci */
68c2ecf20Sopenharmony_ci
78c2ecf20Sopenharmony_ci#ifndef __CVMX_CIU_DEFS_H__
88c2ecf20Sopenharmony_ci#define __CVMX_CIU_DEFS_H__
98c2ecf20Sopenharmony_ci
108c2ecf20Sopenharmony_ci#include <asm/bitfield.h>
118c2ecf20Sopenharmony_ci
128c2ecf20Sopenharmony_ci#define CVMX_CIU_ADDR(addr, coreid, coremask, offset)			       \
138c2ecf20Sopenharmony_ci	(CVMX_ADD_IO_SEG(0x0001070000000000ull + addr##ull) +		       \
148c2ecf20Sopenharmony_ci	(((coreid) & (coremask)) * offset))
158c2ecf20Sopenharmony_ci
168c2ecf20Sopenharmony_ci#define CVMX_CIU_EN2_PPX_IP4(c)		CVMX_CIU_ADDR(0xA400, c, 0x0F, 8)
178c2ecf20Sopenharmony_ci#define CVMX_CIU_EN2_PPX_IP4_W1C(c)	CVMX_CIU_ADDR(0xCC00, c, 0x0F, 8)
188c2ecf20Sopenharmony_ci#define CVMX_CIU_EN2_PPX_IP4_W1S(c)	CVMX_CIU_ADDR(0xAC00, c, 0x0F, 8)
198c2ecf20Sopenharmony_ci#define CVMX_CIU_FUSE			CVMX_CIU_ADDR(0x0728, 0, 0x00, 0)
208c2ecf20Sopenharmony_ci#define CVMX_CIU_INT_SUM1		CVMX_CIU_ADDR(0x0108, 0, 0x00, 0)
218c2ecf20Sopenharmony_ci#define CVMX_CIU_INTX_EN0(c)		CVMX_CIU_ADDR(0x0200, c, 0x3F, 16)
228c2ecf20Sopenharmony_ci#define CVMX_CIU_INTX_EN0_W1C(c)	CVMX_CIU_ADDR(0x2200, c, 0x3F, 16)
238c2ecf20Sopenharmony_ci#define CVMX_CIU_INTX_EN0_W1S(c)	CVMX_CIU_ADDR(0x6200, c, 0x3F, 16)
248c2ecf20Sopenharmony_ci#define CVMX_CIU_INTX_EN1(c)		CVMX_CIU_ADDR(0x0208, c, 0x3F, 16)
258c2ecf20Sopenharmony_ci#define CVMX_CIU_INTX_EN1_W1C(c)	CVMX_CIU_ADDR(0x2208, c, 0x3F, 16)
268c2ecf20Sopenharmony_ci#define CVMX_CIU_INTX_EN1_W1S(c)	CVMX_CIU_ADDR(0x6208, c, 0x3F, 16)
278c2ecf20Sopenharmony_ci#define CVMX_CIU_INTX_SUM0(c)		CVMX_CIU_ADDR(0x0000, c, 0x3F, 8)
288c2ecf20Sopenharmony_ci#define CVMX_CIU_NMI			CVMX_CIU_ADDR(0x0718, 0, 0x00, 0)
298c2ecf20Sopenharmony_ci#define CVMX_CIU_PCI_INTA		CVMX_CIU_ADDR(0x0750, 0, 0x00, 0)
308c2ecf20Sopenharmony_ci#define CVMX_CIU_PP_BIST_STAT		CVMX_CIU_ADDR(0x07E0, 0, 0x00, 0)
318c2ecf20Sopenharmony_ci#define CVMX_CIU_PP_DBG			CVMX_CIU_ADDR(0x0708, 0, 0x00, 0)
328c2ecf20Sopenharmony_ci#define CVMX_CIU_PP_RST			CVMX_CIU_ADDR(0x0700, 0, 0x00, 0)
338c2ecf20Sopenharmony_ci#define CVMX_CIU_QLM0			CVMX_CIU_ADDR(0x0780, 0, 0x00, 0)
348c2ecf20Sopenharmony_ci#define CVMX_CIU_QLM1			CVMX_CIU_ADDR(0x0788, 0, 0x00, 0)
358c2ecf20Sopenharmony_ci#define CVMX_CIU_QLM_JTGC		CVMX_CIU_ADDR(0x0768, 0, 0x00, 0)
368c2ecf20Sopenharmony_ci#define CVMX_CIU_QLM_JTGD		CVMX_CIU_ADDR(0x0770, 0, 0x00, 0)
378c2ecf20Sopenharmony_ci#define CVMX_CIU_SOFT_BIST		CVMX_CIU_ADDR(0x0738, 0, 0x00, 0)
388c2ecf20Sopenharmony_ci#define CVMX_CIU_SOFT_PRST1		CVMX_CIU_ADDR(0x0758, 0, 0x00, 0)
398c2ecf20Sopenharmony_ci#define CVMX_CIU_SOFT_PRST		CVMX_CIU_ADDR(0x0748, 0, 0x00, 0)
408c2ecf20Sopenharmony_ci#define CVMX_CIU_SOFT_RST		CVMX_CIU_ADDR(0x0740, 0, 0x00, 0)
418c2ecf20Sopenharmony_ci#define CVMX_CIU_SUM2_PPX_IP4(c)	CVMX_CIU_ADDR(0x8C00, c, 0x0F, 8)
428c2ecf20Sopenharmony_ci#define CVMX_CIU_TIM_MULTI_CAST		CVMX_CIU_ADDR(0xC200, 0, 0x00, 0)
438c2ecf20Sopenharmony_ci#define CVMX_CIU_TIMX(c)		CVMX_CIU_ADDR(0x0480, c, 0x0F, 8)
448c2ecf20Sopenharmony_ci
458c2ecf20Sopenharmony_cistatic inline uint64_t CVMX_CIU_MBOX_CLRX(unsigned int coreid)
468c2ecf20Sopenharmony_ci{
478c2ecf20Sopenharmony_ci	if (cvmx_get_octeon_family() == (OCTEON_CN68XX & OCTEON_FAMILY_MASK))
488c2ecf20Sopenharmony_ci		return CVMX_CIU_ADDR(0x100100600, coreid, 0x0F, 8);
498c2ecf20Sopenharmony_ci	else
508c2ecf20Sopenharmony_ci		return CVMX_CIU_ADDR(0x000000680, coreid, 0x0F, 8);
518c2ecf20Sopenharmony_ci}
528c2ecf20Sopenharmony_ci
538c2ecf20Sopenharmony_cistatic inline uint64_t CVMX_CIU_MBOX_SETX(unsigned int coreid)
548c2ecf20Sopenharmony_ci{
558c2ecf20Sopenharmony_ci	if (cvmx_get_octeon_family() == (OCTEON_CN68XX & OCTEON_FAMILY_MASK))
568c2ecf20Sopenharmony_ci		return CVMX_CIU_ADDR(0x100100400, coreid, 0x0F, 8);
578c2ecf20Sopenharmony_ci	else
588c2ecf20Sopenharmony_ci		return CVMX_CIU_ADDR(0x000000600, coreid, 0x0F, 8);
598c2ecf20Sopenharmony_ci}
608c2ecf20Sopenharmony_ci
618c2ecf20Sopenharmony_cistatic inline uint64_t CVMX_CIU_PP_POKEX(unsigned int coreid)
628c2ecf20Sopenharmony_ci{
638c2ecf20Sopenharmony_ci	switch (cvmx_get_octeon_family()) {
648c2ecf20Sopenharmony_ci	case OCTEON_CN68XX & OCTEON_FAMILY_MASK:
658c2ecf20Sopenharmony_ci		return CVMX_CIU_ADDR(0x100100200, coreid, 0x0F, 8);
668c2ecf20Sopenharmony_ci	case OCTEON_CNF75XX & OCTEON_FAMILY_MASK:
678c2ecf20Sopenharmony_ci	case OCTEON_CN73XX & OCTEON_FAMILY_MASK:
688c2ecf20Sopenharmony_ci	case OCTEON_CN78XX & OCTEON_FAMILY_MASK:
698c2ecf20Sopenharmony_ci		return CVMX_CIU_ADDR(0x000030000, coreid, 0x0F, 8) -
708c2ecf20Sopenharmony_ci			0x60000000000ull;
718c2ecf20Sopenharmony_ci	default:
728c2ecf20Sopenharmony_ci		return CVMX_CIU_ADDR(0x000000580, coreid, 0x0F, 8);
738c2ecf20Sopenharmony_ci	}
748c2ecf20Sopenharmony_ci}
758c2ecf20Sopenharmony_ci
768c2ecf20Sopenharmony_cistatic inline uint64_t CVMX_CIU_WDOGX(unsigned int coreid)
778c2ecf20Sopenharmony_ci{
788c2ecf20Sopenharmony_ci	switch (cvmx_get_octeon_family()) {
798c2ecf20Sopenharmony_ci	case OCTEON_CN68XX & OCTEON_FAMILY_MASK:
808c2ecf20Sopenharmony_ci		return CVMX_CIU_ADDR(0x100100000, coreid, 0x0F, 8);
818c2ecf20Sopenharmony_ci	case OCTEON_CNF75XX & OCTEON_FAMILY_MASK:
828c2ecf20Sopenharmony_ci	case OCTEON_CN73XX & OCTEON_FAMILY_MASK:
838c2ecf20Sopenharmony_ci	case OCTEON_CN78XX & OCTEON_FAMILY_MASK:
848c2ecf20Sopenharmony_ci		return CVMX_CIU_ADDR(0x000020000, coreid, 0x0F, 8) -
858c2ecf20Sopenharmony_ci			0x60000000000ull;
868c2ecf20Sopenharmony_ci	default:
878c2ecf20Sopenharmony_ci		return CVMX_CIU_ADDR(0x000000500, coreid, 0x0F, 8);
888c2ecf20Sopenharmony_ci	}
898c2ecf20Sopenharmony_ci}
908c2ecf20Sopenharmony_ci
918c2ecf20Sopenharmony_ci
928c2ecf20Sopenharmony_ciunion cvmx_ciu_qlm {
938c2ecf20Sopenharmony_ci	uint64_t u64;
948c2ecf20Sopenharmony_ci	struct cvmx_ciu_qlm_s {
958c2ecf20Sopenharmony_ci		__BITFIELD_FIELD(uint64_t g2bypass:1,
968c2ecf20Sopenharmony_ci		__BITFIELD_FIELD(uint64_t reserved_53_62:10,
978c2ecf20Sopenharmony_ci		__BITFIELD_FIELD(uint64_t g2deemph:5,
988c2ecf20Sopenharmony_ci		__BITFIELD_FIELD(uint64_t reserved_45_47:3,
998c2ecf20Sopenharmony_ci		__BITFIELD_FIELD(uint64_t g2margin:5,
1008c2ecf20Sopenharmony_ci		__BITFIELD_FIELD(uint64_t reserved_32_39:8,
1018c2ecf20Sopenharmony_ci		__BITFIELD_FIELD(uint64_t txbypass:1,
1028c2ecf20Sopenharmony_ci		__BITFIELD_FIELD(uint64_t reserved_21_30:10,
1038c2ecf20Sopenharmony_ci		__BITFIELD_FIELD(uint64_t txdeemph:5,
1048c2ecf20Sopenharmony_ci		__BITFIELD_FIELD(uint64_t reserved_13_15:3,
1058c2ecf20Sopenharmony_ci		__BITFIELD_FIELD(uint64_t txmargin:5,
1068c2ecf20Sopenharmony_ci		__BITFIELD_FIELD(uint64_t reserved_4_7:4,
1078c2ecf20Sopenharmony_ci		__BITFIELD_FIELD(uint64_t lane_en:4,
1088c2ecf20Sopenharmony_ci		;)))))))))))))
1098c2ecf20Sopenharmony_ci	} s;
1108c2ecf20Sopenharmony_ci};
1118c2ecf20Sopenharmony_ci
1128c2ecf20Sopenharmony_ciunion cvmx_ciu_qlm_jtgc {
1138c2ecf20Sopenharmony_ci	uint64_t u64;
1148c2ecf20Sopenharmony_ci	struct cvmx_ciu_qlm_jtgc_s {
1158c2ecf20Sopenharmony_ci		__BITFIELD_FIELD(uint64_t reserved_17_63:47,
1168c2ecf20Sopenharmony_ci		__BITFIELD_FIELD(uint64_t bypass_ext:1,
1178c2ecf20Sopenharmony_ci		__BITFIELD_FIELD(uint64_t reserved_11_15:5,
1188c2ecf20Sopenharmony_ci		__BITFIELD_FIELD(uint64_t clk_div:3,
1198c2ecf20Sopenharmony_ci		__BITFIELD_FIELD(uint64_t reserved_7_7:1,
1208c2ecf20Sopenharmony_ci		__BITFIELD_FIELD(uint64_t mux_sel:3,
1218c2ecf20Sopenharmony_ci		__BITFIELD_FIELD(uint64_t bypass:4,
1228c2ecf20Sopenharmony_ci		;)))))))
1238c2ecf20Sopenharmony_ci	} s;
1248c2ecf20Sopenharmony_ci};
1258c2ecf20Sopenharmony_ci
1268c2ecf20Sopenharmony_ciunion cvmx_ciu_qlm_jtgd {
1278c2ecf20Sopenharmony_ci	uint64_t u64;
1288c2ecf20Sopenharmony_ci	struct cvmx_ciu_qlm_jtgd_s {
1298c2ecf20Sopenharmony_ci		__BITFIELD_FIELD(uint64_t capture:1,
1308c2ecf20Sopenharmony_ci		__BITFIELD_FIELD(uint64_t shift:1,
1318c2ecf20Sopenharmony_ci		__BITFIELD_FIELD(uint64_t update:1,
1328c2ecf20Sopenharmony_ci		__BITFIELD_FIELD(uint64_t reserved_45_60:16,
1338c2ecf20Sopenharmony_ci		__BITFIELD_FIELD(uint64_t select:5,
1348c2ecf20Sopenharmony_ci		__BITFIELD_FIELD(uint64_t reserved_37_39:3,
1358c2ecf20Sopenharmony_ci		__BITFIELD_FIELD(uint64_t shft_cnt:5,
1368c2ecf20Sopenharmony_ci		__BITFIELD_FIELD(uint64_t shft_reg:32,
1378c2ecf20Sopenharmony_ci		;))))))))
1388c2ecf20Sopenharmony_ci	} s;
1398c2ecf20Sopenharmony_ci};
1408c2ecf20Sopenharmony_ci
1418c2ecf20Sopenharmony_ciunion cvmx_ciu_soft_prst {
1428c2ecf20Sopenharmony_ci	uint64_t u64;
1438c2ecf20Sopenharmony_ci	struct cvmx_ciu_soft_prst_s {
1448c2ecf20Sopenharmony_ci		__BITFIELD_FIELD(uint64_t reserved_3_63:61,
1458c2ecf20Sopenharmony_ci		__BITFIELD_FIELD(uint64_t host64:1,
1468c2ecf20Sopenharmony_ci		__BITFIELD_FIELD(uint64_t npi:1,
1478c2ecf20Sopenharmony_ci		__BITFIELD_FIELD(uint64_t soft_prst:1,
1488c2ecf20Sopenharmony_ci		;))))
1498c2ecf20Sopenharmony_ci	} s;
1508c2ecf20Sopenharmony_ci};
1518c2ecf20Sopenharmony_ci
1528c2ecf20Sopenharmony_ciunion cvmx_ciu_timx {
1538c2ecf20Sopenharmony_ci	uint64_t u64;
1548c2ecf20Sopenharmony_ci	struct cvmx_ciu_timx_s {
1558c2ecf20Sopenharmony_ci		__BITFIELD_FIELD(uint64_t reserved_37_63:27,
1568c2ecf20Sopenharmony_ci		__BITFIELD_FIELD(uint64_t one_shot:1,
1578c2ecf20Sopenharmony_ci		__BITFIELD_FIELD(uint64_t len:36,
1588c2ecf20Sopenharmony_ci		;)))
1598c2ecf20Sopenharmony_ci	} s;
1608c2ecf20Sopenharmony_ci};
1618c2ecf20Sopenharmony_ci
1628c2ecf20Sopenharmony_ciunion cvmx_ciu_wdogx {
1638c2ecf20Sopenharmony_ci	uint64_t u64;
1648c2ecf20Sopenharmony_ci	struct cvmx_ciu_wdogx_s {
1658c2ecf20Sopenharmony_ci		__BITFIELD_FIELD(uint64_t reserved_46_63:18,
1668c2ecf20Sopenharmony_ci		__BITFIELD_FIELD(uint64_t gstopen:1,
1678c2ecf20Sopenharmony_ci		__BITFIELD_FIELD(uint64_t dstop:1,
1688c2ecf20Sopenharmony_ci		__BITFIELD_FIELD(uint64_t cnt:24,
1698c2ecf20Sopenharmony_ci		__BITFIELD_FIELD(uint64_t len:16,
1708c2ecf20Sopenharmony_ci		__BITFIELD_FIELD(uint64_t state:2,
1718c2ecf20Sopenharmony_ci		__BITFIELD_FIELD(uint64_t mode:2,
1728c2ecf20Sopenharmony_ci		;)))))))
1738c2ecf20Sopenharmony_ci	} s;
1748c2ecf20Sopenharmony_ci};
1758c2ecf20Sopenharmony_ci
1768c2ecf20Sopenharmony_ci#endif /* __CVMX_CIU_DEFS_H__ */
177