18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * Intel(R) Trace Hub Global Trace Hub (GTH) data structures
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci * Copyright (C) 2014-2015 Intel Corporation.
68c2ecf20Sopenharmony_ci */
78c2ecf20Sopenharmony_ci
88c2ecf20Sopenharmony_ci#ifndef __INTEL_TH_GTH_H__
98c2ecf20Sopenharmony_ci#define __INTEL_TH_GTH_H__
108c2ecf20Sopenharmony_ci
118c2ecf20Sopenharmony_ci/* Map output port parameter bits to symbolic names */
128c2ecf20Sopenharmony_ci#define TH_OUTPUT_PARM(name)			\
138c2ecf20Sopenharmony_ci	TH_OUTPUT_ ## name
148c2ecf20Sopenharmony_ci
158c2ecf20Sopenharmony_cienum intel_th_output_parm {
168c2ecf20Sopenharmony_ci	/* output port type */
178c2ecf20Sopenharmony_ci	TH_OUTPUT_PARM(port),
188c2ecf20Sopenharmony_ci	/* generate NULL packet */
198c2ecf20Sopenharmony_ci	TH_OUTPUT_PARM(null),
208c2ecf20Sopenharmony_ci	/* packet drop */
218c2ecf20Sopenharmony_ci	TH_OUTPUT_PARM(drop),
228c2ecf20Sopenharmony_ci	/* port in reset state */
238c2ecf20Sopenharmony_ci	TH_OUTPUT_PARM(reset),
248c2ecf20Sopenharmony_ci	/* flush out data */
258c2ecf20Sopenharmony_ci	TH_OUTPUT_PARM(flush),
268c2ecf20Sopenharmony_ci	/* mainenance packet frequency */
278c2ecf20Sopenharmony_ci	TH_OUTPUT_PARM(smcfreq),
288c2ecf20Sopenharmony_ci};
298c2ecf20Sopenharmony_ci
308c2ecf20Sopenharmony_ci/*
318c2ecf20Sopenharmony_ci * Register offsets
328c2ecf20Sopenharmony_ci */
338c2ecf20Sopenharmony_cienum {
348c2ecf20Sopenharmony_ci	REG_GTH_GTHOPT0		= 0x00, /* Output ports 0..3 config */
358c2ecf20Sopenharmony_ci	REG_GTH_GTHOPT1		= 0x04, /* Output ports 4..7 config */
368c2ecf20Sopenharmony_ci	REG_GTH_SWDEST0		= 0x08, /* Switching destination masters 0..7 */
378c2ecf20Sopenharmony_ci	REG_GTH_GSWTDEST	= 0x88, /* Global sw trace destination */
388c2ecf20Sopenharmony_ci	REG_GTH_SMCR0		= 0x9c, /* STP mainenance for ports 0/1 */
398c2ecf20Sopenharmony_ci	REG_GTH_SMCR1		= 0xa0, /* STP mainenance for ports 2/3 */
408c2ecf20Sopenharmony_ci	REG_GTH_SMCR2		= 0xa4, /* STP mainenance for ports 4/5 */
418c2ecf20Sopenharmony_ci	REG_GTH_SMCR3		= 0xa8, /* STP mainenance for ports 6/7 */
428c2ecf20Sopenharmony_ci	REG_GTH_SCR		= 0xc8, /* Source control (storeEn override) */
438c2ecf20Sopenharmony_ci	REG_GTH_STAT		= 0xd4, /* GTH status */
448c2ecf20Sopenharmony_ci	REG_GTH_SCR2		= 0xd8, /* Source control (force storeEn off) */
458c2ecf20Sopenharmony_ci	REG_GTH_DESTOVR		= 0xdc, /* Destination override */
468c2ecf20Sopenharmony_ci	REG_GTH_SCRPD0		= 0xe0, /* ScratchPad[0] */
478c2ecf20Sopenharmony_ci	REG_GTH_SCRPD1		= 0xe4, /* ScratchPad[1] */
488c2ecf20Sopenharmony_ci	REG_GTH_SCRPD2		= 0xe8, /* ScratchPad[2] */
498c2ecf20Sopenharmony_ci	REG_GTH_SCRPD3		= 0xec, /* ScratchPad[3] */
508c2ecf20Sopenharmony_ci	REG_TSCU_TSUCTRL	= 0x2000, /* TSCU control register */
518c2ecf20Sopenharmony_ci	REG_TSCU_TSCUSTAT	= 0x2004, /* TSCU status register */
528c2ecf20Sopenharmony_ci
538c2ecf20Sopenharmony_ci	/* Common Capture Sequencer (CTS) registers */
548c2ecf20Sopenharmony_ci	REG_CTS_C0S0_EN		= 0x30c0, /* clause_event_enable_c0s0 */
558c2ecf20Sopenharmony_ci	REG_CTS_C0S0_ACT	= 0x3180, /* clause_action_control_c0s0 */
568c2ecf20Sopenharmony_ci	REG_CTS_STAT		= 0x32a0, /* cts_status */
578c2ecf20Sopenharmony_ci	REG_CTS_CTL		= 0x32a4, /* cts_control */
588c2ecf20Sopenharmony_ci};
598c2ecf20Sopenharmony_ci
608c2ecf20Sopenharmony_ci/* waiting for Pipeline Empty bit(s) to assert for GTH */
618c2ecf20Sopenharmony_ci#define GTH_PLE_WAITLOOP_DEPTH	10000
628c2ecf20Sopenharmony_ci
638c2ecf20Sopenharmony_ci#define TSUCTRL_CTCRESYNC	BIT(0)
648c2ecf20Sopenharmony_ci#define TSCUSTAT_CTCSYNCING	BIT(1)
658c2ecf20Sopenharmony_ci
668c2ecf20Sopenharmony_ci/* waiting for Trigger status to assert for CTS */
678c2ecf20Sopenharmony_ci#define CTS_TRIG_WAITLOOP_DEPTH	10000
688c2ecf20Sopenharmony_ci
698c2ecf20Sopenharmony_ci#define CTS_EVENT_ENABLE_IF_ANYTHING	BIT(31)
708c2ecf20Sopenharmony_ci#define CTS_ACTION_CONTROL_STATE_OFF	27
718c2ecf20Sopenharmony_ci#define CTS_ACTION_CONTROL_SET_STATE(x)	\
728c2ecf20Sopenharmony_ci	(((x) & 0x1f) << CTS_ACTION_CONTROL_STATE_OFF)
738c2ecf20Sopenharmony_ci#define CTS_ACTION_CONTROL_TRIGGER	BIT(4)
748c2ecf20Sopenharmony_ci
758c2ecf20Sopenharmony_ci#define CTS_STATE_IDLE			0x10u
768c2ecf20Sopenharmony_ci
778c2ecf20Sopenharmony_ci#define CTS_CTL_SEQUENCER_ENABLE	BIT(0)
788c2ecf20Sopenharmony_ci
798c2ecf20Sopenharmony_ci#endif /* __INTEL_TH_GTH_H__ */
80