18c2ecf20Sopenharmony_ci/*
28c2ecf20Sopenharmony_ci * This file is subject to the terms and conditions of the GNU General Public
38c2ecf20Sopenharmony_ci * License.  See the file "COPYING" in the main directory of this archive
48c2ecf20Sopenharmony_ci * for more details.
58c2ecf20Sopenharmony_ci *
68c2ecf20Sopenharmony_ci * xwidget.h - generic crosstalk widget header file, derived from IRIX
78c2ecf20Sopenharmony_ci * <sys/xtalk/xtalkwidget.h>, revision 1.32.
88c2ecf20Sopenharmony_ci *
98c2ecf20Sopenharmony_ci * Copyright (C) 1996, 1999 Silcon Graphics, Inc.
108c2ecf20Sopenharmony_ci * Copyright (C) 1999 Ralf Baechle (ralf@gnu.org)
118c2ecf20Sopenharmony_ci */
128c2ecf20Sopenharmony_ci#ifndef _ASM_XTALK_XWIDGET_H
138c2ecf20Sopenharmony_ci#define _ASM_XTALK_XWIDGET_H
148c2ecf20Sopenharmony_ci
158c2ecf20Sopenharmony_ci#include <linux/types.h>
168c2ecf20Sopenharmony_ci#include <asm/xtalk/xtalk.h>
178c2ecf20Sopenharmony_ci
188c2ecf20Sopenharmony_ci#define WIDGET_ID			0x04
198c2ecf20Sopenharmony_ci#define WIDGET_STATUS			0x0c
208c2ecf20Sopenharmony_ci#define WIDGET_ERR_UPPER_ADDR		0x14
218c2ecf20Sopenharmony_ci#define WIDGET_ERR_LOWER_ADDR		0x1c
228c2ecf20Sopenharmony_ci#define WIDGET_CONTROL			0x24
238c2ecf20Sopenharmony_ci#define WIDGET_REQ_TIMEOUT		0x2c
248c2ecf20Sopenharmony_ci#define WIDGET_INTDEST_UPPER_ADDR	0x34
258c2ecf20Sopenharmony_ci#define WIDGET_INTDEST_LOWER_ADDR	0x3c
268c2ecf20Sopenharmony_ci#define WIDGET_ERR_CMD_WORD		0x44
278c2ecf20Sopenharmony_ci#define WIDGET_LLP_CFG			0x4c
288c2ecf20Sopenharmony_ci#define WIDGET_TFLUSH			0x54
298c2ecf20Sopenharmony_ci
308c2ecf20Sopenharmony_ci/* WIDGET_ID */
318c2ecf20Sopenharmony_ci#define WIDGET_REV_NUM			0xf0000000
328c2ecf20Sopenharmony_ci#define WIDGET_PART_NUM			0x0ffff000
338c2ecf20Sopenharmony_ci#define WIDGET_MFG_NUM			0x00000ffe
348c2ecf20Sopenharmony_ci#define WIDGET_REV_NUM_SHFT		28
358c2ecf20Sopenharmony_ci#define WIDGET_PART_NUM_SHFT		12
368c2ecf20Sopenharmony_ci#define WIDGET_MFG_NUM_SHFT		1
378c2ecf20Sopenharmony_ci
388c2ecf20Sopenharmony_ci#define XWIDGET_PART_NUM(widgetid) (((widgetid) & WIDGET_PART_NUM) >> WIDGET_PART_NUM_SHFT)
398c2ecf20Sopenharmony_ci#define XWIDGET_REV_NUM(widgetid) (((widgetid) & WIDGET_REV_NUM) >> WIDGET_REV_NUM_SHFT)
408c2ecf20Sopenharmony_ci#define XWIDGET_MFG_NUM(widgetid) (((widgetid) & WIDGET_MFG_NUM) >> WIDGET_MFG_NUM_SHFT)
418c2ecf20Sopenharmony_ci
428c2ecf20Sopenharmony_ci/* WIDGET_STATUS */
438c2ecf20Sopenharmony_ci#define WIDGET_LLP_REC_CNT		0xff000000
448c2ecf20Sopenharmony_ci#define WIDGET_LLP_TX_CNT		0x00ff0000
458c2ecf20Sopenharmony_ci#define WIDGET_PENDING			0x0000001f
468c2ecf20Sopenharmony_ci
478c2ecf20Sopenharmony_ci/* WIDGET_ERR_UPPER_ADDR */
488c2ecf20Sopenharmony_ci#define WIDGET_ERR_UPPER_ADDR_ONLY	0x0000ffff
498c2ecf20Sopenharmony_ci
508c2ecf20Sopenharmony_ci/* WIDGET_CONTROL */
518c2ecf20Sopenharmony_ci#define WIDGET_F_BAD_PKT		0x00010000
528c2ecf20Sopenharmony_ci#define WIDGET_LLP_XBAR_CRD		0x0000f000
538c2ecf20Sopenharmony_ci#define WIDGET_LLP_XBAR_CRD_SHFT	12
548c2ecf20Sopenharmony_ci#define WIDGET_CLR_RLLP_CNT		0x00000800
558c2ecf20Sopenharmony_ci#define WIDGET_CLR_TLLP_CNT		0x00000400
568c2ecf20Sopenharmony_ci#define WIDGET_SYS_END			0x00000200
578c2ecf20Sopenharmony_ci#define WIDGET_MAX_TRANS		0x000001f0
588c2ecf20Sopenharmony_ci#define WIDGET_WIDGET_ID		0x0000000f
598c2ecf20Sopenharmony_ci
608c2ecf20Sopenharmony_ci/* WIDGET_INTDEST_UPPER_ADDR */
618c2ecf20Sopenharmony_ci#define WIDGET_INT_VECTOR		0xff000000
628c2ecf20Sopenharmony_ci#define WIDGET_INT_VECTOR_SHFT		24
638c2ecf20Sopenharmony_ci#define WIDGET_TARGET_ID		0x000f0000
648c2ecf20Sopenharmony_ci#define WIDGET_TARGET_ID_SHFT		16
658c2ecf20Sopenharmony_ci#define WIDGET_UPP_ADDR			0x0000ffff
668c2ecf20Sopenharmony_ci
678c2ecf20Sopenharmony_ci/* WIDGET_ERR_CMD_WORD */
688c2ecf20Sopenharmony_ci#define WIDGET_DIDN			0xf0000000
698c2ecf20Sopenharmony_ci#define WIDGET_SIDN			0x0f000000
708c2ecf20Sopenharmony_ci#define WIDGET_PACTYP			0x00f00000
718c2ecf20Sopenharmony_ci#define WIDGET_TNUM			0x000f8000
728c2ecf20Sopenharmony_ci#define WIDGET_COHERENT			0x00004000
738c2ecf20Sopenharmony_ci#define WIDGET_DS			0x00003000
748c2ecf20Sopenharmony_ci#define WIDGET_GBR			0x00000800
758c2ecf20Sopenharmony_ci#define WIDGET_VBPM			0x00000400
768c2ecf20Sopenharmony_ci#define WIDGET_ERROR			0x00000200
778c2ecf20Sopenharmony_ci#define WIDGET_BARRIER			0x00000100
788c2ecf20Sopenharmony_ci
798c2ecf20Sopenharmony_ci/* WIDGET_LLP_CFG */
808c2ecf20Sopenharmony_ci#define WIDGET_LLP_MAXRETRY		0x03ff0000
818c2ecf20Sopenharmony_ci#define WIDGET_LLP_MAXRETRY_SHFT	16
828c2ecf20Sopenharmony_ci#define WIDGET_LLP_NULLTIMEOUT		0x0000fc00
838c2ecf20Sopenharmony_ci#define WIDGET_LLP_NULLTIMEOUT_SHFT	10
848c2ecf20Sopenharmony_ci#define WIDGET_LLP_MAXBURST		0x000003ff
858c2ecf20Sopenharmony_ci#define WIDGET_LLP_MAXBURST_SHFT	0
868c2ecf20Sopenharmony_ci
878c2ecf20Sopenharmony_ci/* Xtalk Widget Device Mfgr Nums */
888c2ecf20Sopenharmony_ci#define WIDGET_XBOW_MFGR_NUM	0x0      /* IP30 XBow Chip */
898c2ecf20Sopenharmony_ci#define WIDGET_XXBOW_MFGR_NUM	0x0      /* IP35 Xbow + XBridge Chip */
908c2ecf20Sopenharmony_ci#define WIDGET_ODYS_MFGR_NUM	0x023    /* Odyssey / VPro GFX */
918c2ecf20Sopenharmony_ci#define WIDGET_TPU_MFGR_NUM	0x024    /* Tensor Processor Unit */
928c2ecf20Sopenharmony_ci#define WIDGET_XBRDG_MFGR_NUM	0x024    /* IP35 XBridge Chip */
938c2ecf20Sopenharmony_ci#define WIDGET_HEART_MFGR_NUM	0x036    /* IP30 HEART Chip */
948c2ecf20Sopenharmony_ci#define WIDGET_BRIDG_MFGR_NUM	0x036    /* PCI Bridge */
958c2ecf20Sopenharmony_ci#define WIDGET_HUB_MFGR_NUM	0x036    /* IP27 Hub Chip */
968c2ecf20Sopenharmony_ci#define WIDGET_BDRCK_MFGR_NUM	0x036    /* IP35 Bedrock Chip */
978c2ecf20Sopenharmony_ci#define WIDGET_IMPCT_MFGR_NUM	0x2aa    /* HQ4 / Impact GFX */
988c2ecf20Sopenharmony_ci#define WIDGET_KONA_MFGR_NUM	0x2aa    /* InfiniteReality3 / Kona GFX */
998c2ecf20Sopenharmony_ci#define WIDGET_NULL_MFGR_NUM	-1       /* NULL */
1008c2ecf20Sopenharmony_ci
1018c2ecf20Sopenharmony_ci/* Xtalk Widget Device Part Nums */
1028c2ecf20Sopenharmony_ci#define WIDGET_XBOW_PART_NUM	0x0000
1038c2ecf20Sopenharmony_ci#define WIDGET_HEART_PART_NUM	0xc001
1048c2ecf20Sopenharmony_ci#define WIDGET_BRIDG_PART_NUM	0xc002
1058c2ecf20Sopenharmony_ci#define WIDGET_IMPCT_PART_NUM	0xc003
1068c2ecf20Sopenharmony_ci#define WIDGET_ODYS_PART_NUM	0xc013
1078c2ecf20Sopenharmony_ci#define WIDGET_HUB_PART_NUM	0xc101
1088c2ecf20Sopenharmony_ci#define WIDGET_KONA_PART_NUM	0xc102
1098c2ecf20Sopenharmony_ci#define WIDGET_BDRCK_PART_NUM	0xc110
1108c2ecf20Sopenharmony_ci#define WIDGET_TPU_PART_NUM	0xc202
1118c2ecf20Sopenharmony_ci#define WIDGET_XXBOW_PART_NUM	0xd000
1128c2ecf20Sopenharmony_ci#define WIDGET_XBRDG_PART_NUM	0xd002
1138c2ecf20Sopenharmony_ci#define WIDGET_NULL_PART_NUM	-1
1148c2ecf20Sopenharmony_ci
1158c2ecf20Sopenharmony_ci/* For Xtalk Widget identification */
1168c2ecf20Sopenharmony_cistruct widget_ident {
1178c2ecf20Sopenharmony_ci	u32 mfgr;
1188c2ecf20Sopenharmony_ci	u32 part;
1198c2ecf20Sopenharmony_ci	char *name;
1208c2ecf20Sopenharmony_ci	char *revs[16];
1218c2ecf20Sopenharmony_ci};
1228c2ecf20Sopenharmony_ci
1238c2ecf20Sopenharmony_ci/* Known Xtalk Widgets */
1248c2ecf20Sopenharmony_cistatic const struct widget_ident __initconst widget_idents[] = {
1258c2ecf20Sopenharmony_ci	{
1268c2ecf20Sopenharmony_ci		WIDGET_XBOW_MFGR_NUM,
1278c2ecf20Sopenharmony_ci		WIDGET_XBOW_PART_NUM,
1288c2ecf20Sopenharmony_ci		"xbow",
1298c2ecf20Sopenharmony_ci		{NULL, "1.0", "1.1", "1.2", "1.3", "2.0", NULL},
1308c2ecf20Sopenharmony_ci	},
1318c2ecf20Sopenharmony_ci	{
1328c2ecf20Sopenharmony_ci		WIDGET_HEART_MFGR_NUM,
1338c2ecf20Sopenharmony_ci		WIDGET_HEART_PART_NUM,
1348c2ecf20Sopenharmony_ci		"heart",
1358c2ecf20Sopenharmony_ci		{NULL, "A", "B", "C", "D", "E", "F", NULL},
1368c2ecf20Sopenharmony_ci	},
1378c2ecf20Sopenharmony_ci	{
1388c2ecf20Sopenharmony_ci		WIDGET_BRIDG_MFGR_NUM,
1398c2ecf20Sopenharmony_ci		WIDGET_BRIDG_PART_NUM,
1408c2ecf20Sopenharmony_ci		"bridge",
1418c2ecf20Sopenharmony_ci		{NULL, "A", "B", "C", "D", NULL},
1428c2ecf20Sopenharmony_ci	},
1438c2ecf20Sopenharmony_ci	{
1448c2ecf20Sopenharmony_ci		WIDGET_IMPCT_MFGR_NUM,
1458c2ecf20Sopenharmony_ci		WIDGET_IMPCT_PART_NUM,
1468c2ecf20Sopenharmony_ci		"impact",
1478c2ecf20Sopenharmony_ci		{NULL, "A", "B", NULL},
1488c2ecf20Sopenharmony_ci	},
1498c2ecf20Sopenharmony_ci	{
1508c2ecf20Sopenharmony_ci		WIDGET_ODYS_MFGR_NUM,
1518c2ecf20Sopenharmony_ci		WIDGET_ODYS_PART_NUM,
1528c2ecf20Sopenharmony_ci		"odyssey",
1538c2ecf20Sopenharmony_ci		{NULL, "A", "B", NULL},
1548c2ecf20Sopenharmony_ci	},
1558c2ecf20Sopenharmony_ci	{
1568c2ecf20Sopenharmony_ci		WIDGET_HUB_MFGR_NUM,
1578c2ecf20Sopenharmony_ci		WIDGET_HUB_PART_NUM,
1588c2ecf20Sopenharmony_ci		"hub",
1598c2ecf20Sopenharmony_ci		{NULL, "1.0", "2.0", "2.1", "2.2", "2.3", "2.4", NULL},
1608c2ecf20Sopenharmony_ci	},
1618c2ecf20Sopenharmony_ci	{
1628c2ecf20Sopenharmony_ci		WIDGET_KONA_MFGR_NUM,
1638c2ecf20Sopenharmony_ci		WIDGET_KONA_PART_NUM,
1648c2ecf20Sopenharmony_ci		"kona",
1658c2ecf20Sopenharmony_ci		{NULL},
1668c2ecf20Sopenharmony_ci	},
1678c2ecf20Sopenharmony_ci	{
1688c2ecf20Sopenharmony_ci		WIDGET_BDRCK_MFGR_NUM,
1698c2ecf20Sopenharmony_ci		WIDGET_BDRCK_PART_NUM,
1708c2ecf20Sopenharmony_ci		"bedrock",
1718c2ecf20Sopenharmony_ci		{NULL, "1.0", "1.1", NULL},
1728c2ecf20Sopenharmony_ci	},
1738c2ecf20Sopenharmony_ci	{
1748c2ecf20Sopenharmony_ci		WIDGET_TPU_MFGR_NUM,
1758c2ecf20Sopenharmony_ci		WIDGET_TPU_PART_NUM,
1768c2ecf20Sopenharmony_ci		"tpu",
1778c2ecf20Sopenharmony_ci		{"0", NULL},
1788c2ecf20Sopenharmony_ci	},
1798c2ecf20Sopenharmony_ci	{
1808c2ecf20Sopenharmony_ci		WIDGET_XXBOW_MFGR_NUM,
1818c2ecf20Sopenharmony_ci		WIDGET_XXBOW_PART_NUM,
1828c2ecf20Sopenharmony_ci		"xxbow",
1838c2ecf20Sopenharmony_ci		{NULL, "1.0", "2.0", NULL},
1848c2ecf20Sopenharmony_ci	},
1858c2ecf20Sopenharmony_ci	{
1868c2ecf20Sopenharmony_ci		WIDGET_XBRDG_MFGR_NUM,
1878c2ecf20Sopenharmony_ci		WIDGET_XBRDG_PART_NUM,
1888c2ecf20Sopenharmony_ci		"xbridge",
1898c2ecf20Sopenharmony_ci		{NULL, "A", "B", NULL},
1908c2ecf20Sopenharmony_ci	},
1918c2ecf20Sopenharmony_ci	{
1928c2ecf20Sopenharmony_ci		WIDGET_NULL_MFGR_NUM,
1938c2ecf20Sopenharmony_ci		WIDGET_NULL_PART_NUM,
1948c2ecf20Sopenharmony_ci		NULL,
1958c2ecf20Sopenharmony_ci		{NULL},
1968c2ecf20Sopenharmony_ci	}
1978c2ecf20Sopenharmony_ci};
1988c2ecf20Sopenharmony_ci
1998c2ecf20Sopenharmony_ci/*
2008c2ecf20Sopenharmony_ci * according to the crosstalk spec, only 32-bits access to the widget
2018c2ecf20Sopenharmony_ci * configuration registers is allowed.	some widgets may allow 64-bits
2028c2ecf20Sopenharmony_ci * access but software should not depend on it.	 registers beyond the
2038c2ecf20Sopenharmony_ci * widget target flush register are widget dependent thus will not be
2048c2ecf20Sopenharmony_ci * defined here
2058c2ecf20Sopenharmony_ci */
2068c2ecf20Sopenharmony_ci#ifndef __ASSEMBLY__
2078c2ecf20Sopenharmony_citypedef u32 widgetreg_t;
2088c2ecf20Sopenharmony_ci
2098c2ecf20Sopenharmony_ci/* widget configuration registers */
2108c2ecf20Sopenharmony_citypedef volatile struct widget_cfg {
2118c2ecf20Sopenharmony_ci	widgetreg_t		w_pad_0;		/* 0x00 */
2128c2ecf20Sopenharmony_ci	widgetreg_t		w_id;			/* 0x04 */
2138c2ecf20Sopenharmony_ci	widgetreg_t		w_pad_1;		/* 0x08 */
2148c2ecf20Sopenharmony_ci	widgetreg_t		w_status;		/* 0x0c */
2158c2ecf20Sopenharmony_ci	widgetreg_t		w_pad_2;		/* 0x10 */
2168c2ecf20Sopenharmony_ci	widgetreg_t		w_err_upper_addr;	/* 0x14 */
2178c2ecf20Sopenharmony_ci	widgetreg_t		w_pad_3;		/* 0x18 */
2188c2ecf20Sopenharmony_ci	widgetreg_t		w_err_lower_addr;	/* 0x1c */
2198c2ecf20Sopenharmony_ci	widgetreg_t		w_pad_4;		/* 0x20 */
2208c2ecf20Sopenharmony_ci	widgetreg_t		w_control;		/* 0x24 */
2218c2ecf20Sopenharmony_ci	widgetreg_t		w_pad_5;		/* 0x28 */
2228c2ecf20Sopenharmony_ci	widgetreg_t		w_req_timeout;		/* 0x2c */
2238c2ecf20Sopenharmony_ci	widgetreg_t		w_pad_6;		/* 0x30 */
2248c2ecf20Sopenharmony_ci	widgetreg_t		w_intdest_upper_addr;	/* 0x34 */
2258c2ecf20Sopenharmony_ci	widgetreg_t		w_pad_7;		/* 0x38 */
2268c2ecf20Sopenharmony_ci	widgetreg_t		w_intdest_lower_addr;	/* 0x3c */
2278c2ecf20Sopenharmony_ci	widgetreg_t		w_pad_8;		/* 0x40 */
2288c2ecf20Sopenharmony_ci	widgetreg_t		w_err_cmd_word;		/* 0x44 */
2298c2ecf20Sopenharmony_ci	widgetreg_t		w_pad_9;		/* 0x48 */
2308c2ecf20Sopenharmony_ci	widgetreg_t		w_llp_cfg;		/* 0x4c */
2318c2ecf20Sopenharmony_ci	widgetreg_t		w_pad_10;		/* 0x50 */
2328c2ecf20Sopenharmony_ci	widgetreg_t		w_tflush;		/* 0x54 */
2338c2ecf20Sopenharmony_ci} widget_cfg_t;
2348c2ecf20Sopenharmony_ci
2358c2ecf20Sopenharmony_citypedef struct {
2368c2ecf20Sopenharmony_ci	unsigned	didn:4;
2378c2ecf20Sopenharmony_ci	unsigned	sidn:4;
2388c2ecf20Sopenharmony_ci	unsigned	pactyp:4;
2398c2ecf20Sopenharmony_ci	unsigned	tnum:5;
2408c2ecf20Sopenharmony_ci	unsigned	ct:1;
2418c2ecf20Sopenharmony_ci	unsigned	ds:2;
2428c2ecf20Sopenharmony_ci	unsigned	gbr:1;
2438c2ecf20Sopenharmony_ci	unsigned	vbpm:1;
2448c2ecf20Sopenharmony_ci	unsigned	error:1;
2458c2ecf20Sopenharmony_ci	unsigned	bo:1;
2468c2ecf20Sopenharmony_ci	unsigned	other:8;
2478c2ecf20Sopenharmony_ci} w_err_cmd_word_f;
2488c2ecf20Sopenharmony_ci
2498c2ecf20Sopenharmony_citypedef union {
2508c2ecf20Sopenharmony_ci	widgetreg_t		r;
2518c2ecf20Sopenharmony_ci	w_err_cmd_word_f	f;
2528c2ecf20Sopenharmony_ci} w_err_cmd_word_u;
2538c2ecf20Sopenharmony_ci
2548c2ecf20Sopenharmony_citypedef struct xwidget_info_s *xwidget_info_t;
2558c2ecf20Sopenharmony_ci
2568c2ecf20Sopenharmony_ci/*
2578c2ecf20Sopenharmony_ci * Crosstalk Widget Hardware Identification, as defined in the Crosstalk spec.
2588c2ecf20Sopenharmony_ci */
2598c2ecf20Sopenharmony_citypedef struct xwidget_hwid_s {
2608c2ecf20Sopenharmony_ci	xwidget_part_num_t	part_num;
2618c2ecf20Sopenharmony_ci	xwidget_rev_num_t	rev_num;
2628c2ecf20Sopenharmony_ci	xwidget_mfg_num_t	mfg_num;
2638c2ecf20Sopenharmony_ci} *xwidget_hwid_t;
2648c2ecf20Sopenharmony_ci
2658c2ecf20Sopenharmony_ci
2668c2ecf20Sopenharmony_ci/*
2678c2ecf20Sopenharmony_ci * Returns 1 if a driver that handles devices described by hwid1 is able
2688c2ecf20Sopenharmony_ci * to manage a device with hardwareid hwid2.  NOTE: We don't check rev
2698c2ecf20Sopenharmony_ci * numbers at all.
2708c2ecf20Sopenharmony_ci */
2718c2ecf20Sopenharmony_ci#define XWIDGET_HARDWARE_ID_MATCH(hwid1, hwid2) \
2728c2ecf20Sopenharmony_ci	(((hwid1)->part_num == (hwid2)->part_num) && \
2738c2ecf20Sopenharmony_ci	(((hwid1)->mfg_num == XWIDGET_MFG_NUM_NONE) || \
2748c2ecf20Sopenharmony_ci	((hwid2)->mfg_num == XWIDGET_MFG_NUM_NONE) || \
2758c2ecf20Sopenharmony_ci	((hwid1)->mfg_num == (hwid2)->mfg_num)))
2768c2ecf20Sopenharmony_ci
2778c2ecf20Sopenharmony_ci#endif /* !__ASSEMBLY__ */
2788c2ecf20Sopenharmony_ci
2798c2ecf20Sopenharmony_ci#endif /* _ASM_XTALK_XWIDGET_H */
280