162306a36Sopenharmony_ci/* 262306a36Sopenharmony_ci * This file is subject to the terms and conditions of the GNU General Public 362306a36Sopenharmony_ci * License. See the file "COPYING" in the main directory of this archive 462306a36Sopenharmony_ci * for more details. 562306a36Sopenharmony_ci * 662306a36Sopenharmony_ci * xwidget.h - generic crosstalk widget header file, derived from IRIX 762306a36Sopenharmony_ci * <sys/xtalk/xtalkwidget.h>, revision 1.32. 862306a36Sopenharmony_ci * 962306a36Sopenharmony_ci * Copyright (C) 1996, 1999 Silcon Graphics, Inc. 1062306a36Sopenharmony_ci * Copyright (C) 1999 Ralf Baechle (ralf@gnu.org) 1162306a36Sopenharmony_ci */ 1262306a36Sopenharmony_ci#ifndef _ASM_XTALK_XWIDGET_H 1362306a36Sopenharmony_ci#define _ASM_XTALK_XWIDGET_H 1462306a36Sopenharmony_ci 1562306a36Sopenharmony_ci#include <linux/types.h> 1662306a36Sopenharmony_ci#include <asm/xtalk/xtalk.h> 1762306a36Sopenharmony_ci 1862306a36Sopenharmony_ci#define WIDGET_ID 0x04 1962306a36Sopenharmony_ci#define WIDGET_STATUS 0x0c 2062306a36Sopenharmony_ci#define WIDGET_ERR_UPPER_ADDR 0x14 2162306a36Sopenharmony_ci#define WIDGET_ERR_LOWER_ADDR 0x1c 2262306a36Sopenharmony_ci#define WIDGET_CONTROL 0x24 2362306a36Sopenharmony_ci#define WIDGET_REQ_TIMEOUT 0x2c 2462306a36Sopenharmony_ci#define WIDGET_INTDEST_UPPER_ADDR 0x34 2562306a36Sopenharmony_ci#define WIDGET_INTDEST_LOWER_ADDR 0x3c 2662306a36Sopenharmony_ci#define WIDGET_ERR_CMD_WORD 0x44 2762306a36Sopenharmony_ci#define WIDGET_LLP_CFG 0x4c 2862306a36Sopenharmony_ci#define WIDGET_TFLUSH 0x54 2962306a36Sopenharmony_ci 3062306a36Sopenharmony_ci/* WIDGET_ID */ 3162306a36Sopenharmony_ci#define WIDGET_REV_NUM 0xf0000000 3262306a36Sopenharmony_ci#define WIDGET_PART_NUM 0x0ffff000 3362306a36Sopenharmony_ci#define WIDGET_MFG_NUM 0x00000ffe 3462306a36Sopenharmony_ci#define WIDGET_REV_NUM_SHFT 28 3562306a36Sopenharmony_ci#define WIDGET_PART_NUM_SHFT 12 3662306a36Sopenharmony_ci#define WIDGET_MFG_NUM_SHFT 1 3762306a36Sopenharmony_ci 3862306a36Sopenharmony_ci#define XWIDGET_PART_NUM(widgetid) (((widgetid) & WIDGET_PART_NUM) >> WIDGET_PART_NUM_SHFT) 3962306a36Sopenharmony_ci#define XWIDGET_REV_NUM(widgetid) (((widgetid) & WIDGET_REV_NUM) >> WIDGET_REV_NUM_SHFT) 4062306a36Sopenharmony_ci#define XWIDGET_MFG_NUM(widgetid) (((widgetid) & WIDGET_MFG_NUM) >> WIDGET_MFG_NUM_SHFT) 4162306a36Sopenharmony_ci 4262306a36Sopenharmony_ci/* WIDGET_STATUS */ 4362306a36Sopenharmony_ci#define WIDGET_LLP_REC_CNT 0xff000000 4462306a36Sopenharmony_ci#define WIDGET_LLP_TX_CNT 0x00ff0000 4562306a36Sopenharmony_ci#define WIDGET_PENDING 0x0000001f 4662306a36Sopenharmony_ci 4762306a36Sopenharmony_ci/* WIDGET_ERR_UPPER_ADDR */ 4862306a36Sopenharmony_ci#define WIDGET_ERR_UPPER_ADDR_ONLY 0x0000ffff 4962306a36Sopenharmony_ci 5062306a36Sopenharmony_ci/* WIDGET_CONTROL */ 5162306a36Sopenharmony_ci#define WIDGET_F_BAD_PKT 0x00010000 5262306a36Sopenharmony_ci#define WIDGET_LLP_XBAR_CRD 0x0000f000 5362306a36Sopenharmony_ci#define WIDGET_LLP_XBAR_CRD_SHFT 12 5462306a36Sopenharmony_ci#define WIDGET_CLR_RLLP_CNT 0x00000800 5562306a36Sopenharmony_ci#define WIDGET_CLR_TLLP_CNT 0x00000400 5662306a36Sopenharmony_ci#define WIDGET_SYS_END 0x00000200 5762306a36Sopenharmony_ci#define WIDGET_MAX_TRANS 0x000001f0 5862306a36Sopenharmony_ci#define WIDGET_WIDGET_ID 0x0000000f 5962306a36Sopenharmony_ci 6062306a36Sopenharmony_ci/* WIDGET_INTDEST_UPPER_ADDR */ 6162306a36Sopenharmony_ci#define WIDGET_INT_VECTOR 0xff000000 6262306a36Sopenharmony_ci#define WIDGET_INT_VECTOR_SHFT 24 6362306a36Sopenharmony_ci#define WIDGET_TARGET_ID 0x000f0000 6462306a36Sopenharmony_ci#define WIDGET_TARGET_ID_SHFT 16 6562306a36Sopenharmony_ci#define WIDGET_UPP_ADDR 0x0000ffff 6662306a36Sopenharmony_ci 6762306a36Sopenharmony_ci/* WIDGET_ERR_CMD_WORD */ 6862306a36Sopenharmony_ci#define WIDGET_DIDN 0xf0000000 6962306a36Sopenharmony_ci#define WIDGET_SIDN 0x0f000000 7062306a36Sopenharmony_ci#define WIDGET_PACTYP 0x00f00000 7162306a36Sopenharmony_ci#define WIDGET_TNUM 0x000f8000 7262306a36Sopenharmony_ci#define WIDGET_COHERENT 0x00004000 7362306a36Sopenharmony_ci#define WIDGET_DS 0x00003000 7462306a36Sopenharmony_ci#define WIDGET_GBR 0x00000800 7562306a36Sopenharmony_ci#define WIDGET_VBPM 0x00000400 7662306a36Sopenharmony_ci#define WIDGET_ERROR 0x00000200 7762306a36Sopenharmony_ci#define WIDGET_BARRIER 0x00000100 7862306a36Sopenharmony_ci 7962306a36Sopenharmony_ci/* WIDGET_LLP_CFG */ 8062306a36Sopenharmony_ci#define WIDGET_LLP_MAXRETRY 0x03ff0000 8162306a36Sopenharmony_ci#define WIDGET_LLP_MAXRETRY_SHFT 16 8262306a36Sopenharmony_ci#define WIDGET_LLP_NULLTIMEOUT 0x0000fc00 8362306a36Sopenharmony_ci#define WIDGET_LLP_NULLTIMEOUT_SHFT 10 8462306a36Sopenharmony_ci#define WIDGET_LLP_MAXBURST 0x000003ff 8562306a36Sopenharmony_ci#define WIDGET_LLP_MAXBURST_SHFT 0 8662306a36Sopenharmony_ci 8762306a36Sopenharmony_ci/* Xtalk Widget Device Mfgr Nums */ 8862306a36Sopenharmony_ci#define WIDGET_XBOW_MFGR_NUM 0x0 /* IP30 XBow Chip */ 8962306a36Sopenharmony_ci#define WIDGET_XXBOW_MFGR_NUM 0x0 /* IP35 Xbow + XBridge Chip */ 9062306a36Sopenharmony_ci#define WIDGET_ODYS_MFGR_NUM 0x023 /* Odyssey / VPro GFX */ 9162306a36Sopenharmony_ci#define WIDGET_TPU_MFGR_NUM 0x024 /* Tensor Processor Unit */ 9262306a36Sopenharmony_ci#define WIDGET_XBRDG_MFGR_NUM 0x024 /* IP35 XBridge Chip */ 9362306a36Sopenharmony_ci#define WIDGET_HEART_MFGR_NUM 0x036 /* IP30 HEART Chip */ 9462306a36Sopenharmony_ci#define WIDGET_BRIDG_MFGR_NUM 0x036 /* PCI Bridge */ 9562306a36Sopenharmony_ci#define WIDGET_HUB_MFGR_NUM 0x036 /* IP27 Hub Chip */ 9662306a36Sopenharmony_ci#define WIDGET_BDRCK_MFGR_NUM 0x036 /* IP35 Bedrock Chip */ 9762306a36Sopenharmony_ci#define WIDGET_IMPCT_MFGR_NUM 0x2aa /* HQ4 / Impact GFX */ 9862306a36Sopenharmony_ci#define WIDGET_KONA_MFGR_NUM 0x2aa /* InfiniteReality3 / Kona GFX */ 9962306a36Sopenharmony_ci#define WIDGET_NULL_MFGR_NUM -1 /* NULL */ 10062306a36Sopenharmony_ci 10162306a36Sopenharmony_ci/* Xtalk Widget Device Part Nums */ 10262306a36Sopenharmony_ci#define WIDGET_XBOW_PART_NUM 0x0000 10362306a36Sopenharmony_ci#define WIDGET_HEART_PART_NUM 0xc001 10462306a36Sopenharmony_ci#define WIDGET_BRIDG_PART_NUM 0xc002 10562306a36Sopenharmony_ci#define WIDGET_IMPCT_PART_NUM 0xc003 10662306a36Sopenharmony_ci#define WIDGET_ODYS_PART_NUM 0xc013 10762306a36Sopenharmony_ci#define WIDGET_HUB_PART_NUM 0xc101 10862306a36Sopenharmony_ci#define WIDGET_KONA_PART_NUM 0xc102 10962306a36Sopenharmony_ci#define WIDGET_BDRCK_PART_NUM 0xc110 11062306a36Sopenharmony_ci#define WIDGET_TPU_PART_NUM 0xc202 11162306a36Sopenharmony_ci#define WIDGET_XXBOW_PART_NUM 0xd000 11262306a36Sopenharmony_ci#define WIDGET_XBRDG_PART_NUM 0xd002 11362306a36Sopenharmony_ci#define WIDGET_NULL_PART_NUM -1 11462306a36Sopenharmony_ci 11562306a36Sopenharmony_ci/* For Xtalk Widget identification */ 11662306a36Sopenharmony_cistruct widget_ident { 11762306a36Sopenharmony_ci u32 mfgr; 11862306a36Sopenharmony_ci u32 part; 11962306a36Sopenharmony_ci char *name; 12062306a36Sopenharmony_ci char *revs[16]; 12162306a36Sopenharmony_ci}; 12262306a36Sopenharmony_ci 12362306a36Sopenharmony_ci/* Known Xtalk Widgets */ 12462306a36Sopenharmony_cistatic const struct widget_ident __initconst widget_idents[] = { 12562306a36Sopenharmony_ci { 12662306a36Sopenharmony_ci WIDGET_XBOW_MFGR_NUM, 12762306a36Sopenharmony_ci WIDGET_XBOW_PART_NUM, 12862306a36Sopenharmony_ci "xbow", 12962306a36Sopenharmony_ci {NULL, "1.0", "1.1", "1.2", "1.3", "2.0", NULL}, 13062306a36Sopenharmony_ci }, 13162306a36Sopenharmony_ci { 13262306a36Sopenharmony_ci WIDGET_HEART_MFGR_NUM, 13362306a36Sopenharmony_ci WIDGET_HEART_PART_NUM, 13462306a36Sopenharmony_ci "heart", 13562306a36Sopenharmony_ci {NULL, "A", "B", "C", "D", "E", "F", NULL}, 13662306a36Sopenharmony_ci }, 13762306a36Sopenharmony_ci { 13862306a36Sopenharmony_ci WIDGET_BRIDG_MFGR_NUM, 13962306a36Sopenharmony_ci WIDGET_BRIDG_PART_NUM, 14062306a36Sopenharmony_ci "bridge", 14162306a36Sopenharmony_ci {NULL, "A", "B", "C", "D", NULL}, 14262306a36Sopenharmony_ci }, 14362306a36Sopenharmony_ci { 14462306a36Sopenharmony_ci WIDGET_IMPCT_MFGR_NUM, 14562306a36Sopenharmony_ci WIDGET_IMPCT_PART_NUM, 14662306a36Sopenharmony_ci "impact", 14762306a36Sopenharmony_ci {NULL, "A", "B", NULL}, 14862306a36Sopenharmony_ci }, 14962306a36Sopenharmony_ci { 15062306a36Sopenharmony_ci WIDGET_ODYS_MFGR_NUM, 15162306a36Sopenharmony_ci WIDGET_ODYS_PART_NUM, 15262306a36Sopenharmony_ci "odyssey", 15362306a36Sopenharmony_ci {NULL, "A", "B", NULL}, 15462306a36Sopenharmony_ci }, 15562306a36Sopenharmony_ci { 15662306a36Sopenharmony_ci WIDGET_HUB_MFGR_NUM, 15762306a36Sopenharmony_ci WIDGET_HUB_PART_NUM, 15862306a36Sopenharmony_ci "hub", 15962306a36Sopenharmony_ci {NULL, "1.0", "2.0", "2.1", "2.2", "2.3", "2.4", NULL}, 16062306a36Sopenharmony_ci }, 16162306a36Sopenharmony_ci { 16262306a36Sopenharmony_ci WIDGET_KONA_MFGR_NUM, 16362306a36Sopenharmony_ci WIDGET_KONA_PART_NUM, 16462306a36Sopenharmony_ci "kona", 16562306a36Sopenharmony_ci {NULL}, 16662306a36Sopenharmony_ci }, 16762306a36Sopenharmony_ci { 16862306a36Sopenharmony_ci WIDGET_BDRCK_MFGR_NUM, 16962306a36Sopenharmony_ci WIDGET_BDRCK_PART_NUM, 17062306a36Sopenharmony_ci "bedrock", 17162306a36Sopenharmony_ci {NULL, "1.0", "1.1", NULL}, 17262306a36Sopenharmony_ci }, 17362306a36Sopenharmony_ci { 17462306a36Sopenharmony_ci WIDGET_TPU_MFGR_NUM, 17562306a36Sopenharmony_ci WIDGET_TPU_PART_NUM, 17662306a36Sopenharmony_ci "tpu", 17762306a36Sopenharmony_ci {"0", NULL}, 17862306a36Sopenharmony_ci }, 17962306a36Sopenharmony_ci { 18062306a36Sopenharmony_ci WIDGET_XXBOW_MFGR_NUM, 18162306a36Sopenharmony_ci WIDGET_XXBOW_PART_NUM, 18262306a36Sopenharmony_ci "xxbow", 18362306a36Sopenharmony_ci {NULL, "1.0", "2.0", NULL}, 18462306a36Sopenharmony_ci }, 18562306a36Sopenharmony_ci { 18662306a36Sopenharmony_ci WIDGET_XBRDG_MFGR_NUM, 18762306a36Sopenharmony_ci WIDGET_XBRDG_PART_NUM, 18862306a36Sopenharmony_ci "xbridge", 18962306a36Sopenharmony_ci {NULL, "A", "B", NULL}, 19062306a36Sopenharmony_ci }, 19162306a36Sopenharmony_ci { 19262306a36Sopenharmony_ci WIDGET_NULL_MFGR_NUM, 19362306a36Sopenharmony_ci WIDGET_NULL_PART_NUM, 19462306a36Sopenharmony_ci NULL, 19562306a36Sopenharmony_ci {NULL}, 19662306a36Sopenharmony_ci } 19762306a36Sopenharmony_ci}; 19862306a36Sopenharmony_ci 19962306a36Sopenharmony_ci/* 20062306a36Sopenharmony_ci * according to the crosstalk spec, only 32-bits access to the widget 20162306a36Sopenharmony_ci * configuration registers is allowed. some widgets may allow 64-bits 20262306a36Sopenharmony_ci * access but software should not depend on it. registers beyond the 20362306a36Sopenharmony_ci * widget target flush register are widget dependent thus will not be 20462306a36Sopenharmony_ci * defined here 20562306a36Sopenharmony_ci */ 20662306a36Sopenharmony_ci#ifndef __ASSEMBLY__ 20762306a36Sopenharmony_citypedef u32 widgetreg_t; 20862306a36Sopenharmony_ci 20962306a36Sopenharmony_ci/* widget configuration registers */ 21062306a36Sopenharmony_citypedef volatile struct widget_cfg { 21162306a36Sopenharmony_ci widgetreg_t w_pad_0; /* 0x00 */ 21262306a36Sopenharmony_ci widgetreg_t w_id; /* 0x04 */ 21362306a36Sopenharmony_ci widgetreg_t w_pad_1; /* 0x08 */ 21462306a36Sopenharmony_ci widgetreg_t w_status; /* 0x0c */ 21562306a36Sopenharmony_ci widgetreg_t w_pad_2; /* 0x10 */ 21662306a36Sopenharmony_ci widgetreg_t w_err_upper_addr; /* 0x14 */ 21762306a36Sopenharmony_ci widgetreg_t w_pad_3; /* 0x18 */ 21862306a36Sopenharmony_ci widgetreg_t w_err_lower_addr; /* 0x1c */ 21962306a36Sopenharmony_ci widgetreg_t w_pad_4; /* 0x20 */ 22062306a36Sopenharmony_ci widgetreg_t w_control; /* 0x24 */ 22162306a36Sopenharmony_ci widgetreg_t w_pad_5; /* 0x28 */ 22262306a36Sopenharmony_ci widgetreg_t w_req_timeout; /* 0x2c */ 22362306a36Sopenharmony_ci widgetreg_t w_pad_6; /* 0x30 */ 22462306a36Sopenharmony_ci widgetreg_t w_intdest_upper_addr; /* 0x34 */ 22562306a36Sopenharmony_ci widgetreg_t w_pad_7; /* 0x38 */ 22662306a36Sopenharmony_ci widgetreg_t w_intdest_lower_addr; /* 0x3c */ 22762306a36Sopenharmony_ci widgetreg_t w_pad_8; /* 0x40 */ 22862306a36Sopenharmony_ci widgetreg_t w_err_cmd_word; /* 0x44 */ 22962306a36Sopenharmony_ci widgetreg_t w_pad_9; /* 0x48 */ 23062306a36Sopenharmony_ci widgetreg_t w_llp_cfg; /* 0x4c */ 23162306a36Sopenharmony_ci widgetreg_t w_pad_10; /* 0x50 */ 23262306a36Sopenharmony_ci widgetreg_t w_tflush; /* 0x54 */ 23362306a36Sopenharmony_ci} widget_cfg_t; 23462306a36Sopenharmony_ci 23562306a36Sopenharmony_citypedef struct { 23662306a36Sopenharmony_ci unsigned didn:4; 23762306a36Sopenharmony_ci unsigned sidn:4; 23862306a36Sopenharmony_ci unsigned pactyp:4; 23962306a36Sopenharmony_ci unsigned tnum:5; 24062306a36Sopenharmony_ci unsigned ct:1; 24162306a36Sopenharmony_ci unsigned ds:2; 24262306a36Sopenharmony_ci unsigned gbr:1; 24362306a36Sopenharmony_ci unsigned vbpm:1; 24462306a36Sopenharmony_ci unsigned error:1; 24562306a36Sopenharmony_ci unsigned bo:1; 24662306a36Sopenharmony_ci unsigned other:8; 24762306a36Sopenharmony_ci} w_err_cmd_word_f; 24862306a36Sopenharmony_ci 24962306a36Sopenharmony_citypedef union { 25062306a36Sopenharmony_ci widgetreg_t r; 25162306a36Sopenharmony_ci w_err_cmd_word_f f; 25262306a36Sopenharmony_ci} w_err_cmd_word_u; 25362306a36Sopenharmony_ci 25462306a36Sopenharmony_citypedef struct xwidget_info_s *xwidget_info_t; 25562306a36Sopenharmony_ci 25662306a36Sopenharmony_ci/* 25762306a36Sopenharmony_ci * Crosstalk Widget Hardware Identification, as defined in the Crosstalk spec. 25862306a36Sopenharmony_ci */ 25962306a36Sopenharmony_citypedef struct xwidget_hwid_s { 26062306a36Sopenharmony_ci xwidget_part_num_t part_num; 26162306a36Sopenharmony_ci xwidget_rev_num_t rev_num; 26262306a36Sopenharmony_ci xwidget_mfg_num_t mfg_num; 26362306a36Sopenharmony_ci} *xwidget_hwid_t; 26462306a36Sopenharmony_ci 26562306a36Sopenharmony_ci 26662306a36Sopenharmony_ci/* 26762306a36Sopenharmony_ci * Returns 1 if a driver that handles devices described by hwid1 is able 26862306a36Sopenharmony_ci * to manage a device with hardwareid hwid2. NOTE: We don't check rev 26962306a36Sopenharmony_ci * numbers at all. 27062306a36Sopenharmony_ci */ 27162306a36Sopenharmony_ci#define XWIDGET_HARDWARE_ID_MATCH(hwid1, hwid2) \ 27262306a36Sopenharmony_ci (((hwid1)->part_num == (hwid2)->part_num) && \ 27362306a36Sopenharmony_ci (((hwid1)->mfg_num == XWIDGET_MFG_NUM_NONE) || \ 27462306a36Sopenharmony_ci ((hwid2)->mfg_num == XWIDGET_MFG_NUM_NONE) || \ 27562306a36Sopenharmony_ci ((hwid1)->mfg_num == (hwid2)->mfg_num))) 27662306a36Sopenharmony_ci 27762306a36Sopenharmony_ci#endif /* !__ASSEMBLY__ */ 27862306a36Sopenharmony_ci 27962306a36Sopenharmony_ci#endif /* _ASM_XTALK_XWIDGET_H */ 280