1384740dcSRalf Baechle /* 2384740dcSRalf Baechle * This file is subject to the terms and conditions of the GNU General Public 3384740dcSRalf Baechle * License. See the file "COPYING" in the main directory of this archive 4384740dcSRalf Baechle * for more details. 5384740dcSRalf Baechle * 6384740dcSRalf Baechle * xwidget.h - generic crosstalk widget header file, derived from IRIX 7384740dcSRalf Baechle * <sys/xtalk/xtalkwidget.h>, revision 1.32. 8384740dcSRalf Baechle * 9384740dcSRalf Baechle * Copyright (C) 1996, 1999 Silcon Graphics, Inc. 10384740dcSRalf Baechle * Copyright (C) 1999 Ralf Baechle (ralf@gnu.org) 11384740dcSRalf Baechle */ 12384740dcSRalf Baechle #ifndef _ASM_XTALK_XWIDGET_H 13384740dcSRalf Baechle #define _ASM_XTALK_XWIDGET_H 14384740dcSRalf Baechle 15384740dcSRalf Baechle #include <linux/types.h> 16384740dcSRalf Baechle #include <asm/xtalk/xtalk.h> 17384740dcSRalf Baechle 18384740dcSRalf Baechle #define WIDGET_ID 0x04 19384740dcSRalf Baechle #define WIDGET_STATUS 0x0c 20384740dcSRalf Baechle #define WIDGET_ERR_UPPER_ADDR 0x14 21384740dcSRalf Baechle #define WIDGET_ERR_LOWER_ADDR 0x1c 22384740dcSRalf Baechle #define WIDGET_CONTROL 0x24 23384740dcSRalf Baechle #define WIDGET_REQ_TIMEOUT 0x2c 24384740dcSRalf Baechle #define WIDGET_INTDEST_UPPER_ADDR 0x34 25384740dcSRalf Baechle #define WIDGET_INTDEST_LOWER_ADDR 0x3c 26384740dcSRalf Baechle #define WIDGET_ERR_CMD_WORD 0x44 27384740dcSRalf Baechle #define WIDGET_LLP_CFG 0x4c 28384740dcSRalf Baechle #define WIDGET_TFLUSH 0x54 29384740dcSRalf Baechle 30384740dcSRalf Baechle /* WIDGET_ID */ 31384740dcSRalf Baechle #define WIDGET_REV_NUM 0xf0000000 32384740dcSRalf Baechle #define WIDGET_PART_NUM 0x0ffff000 33384740dcSRalf Baechle #define WIDGET_MFG_NUM 0x00000ffe 34384740dcSRalf Baechle #define WIDGET_REV_NUM_SHFT 28 35384740dcSRalf Baechle #define WIDGET_PART_NUM_SHFT 12 36384740dcSRalf Baechle #define WIDGET_MFG_NUM_SHFT 1 37384740dcSRalf Baechle 38384740dcSRalf Baechle #define XWIDGET_PART_NUM(widgetid) (((widgetid) & WIDGET_PART_NUM) >> WIDGET_PART_NUM_SHFT) 39384740dcSRalf Baechle #define XWIDGET_REV_NUM(widgetid) (((widgetid) & WIDGET_REV_NUM) >> WIDGET_REV_NUM_SHFT) 40384740dcSRalf Baechle #define XWIDGET_MFG_NUM(widgetid) (((widgetid) & WIDGET_MFG_NUM) >> WIDGET_MFG_NUM_SHFT) 41384740dcSRalf Baechle 42384740dcSRalf Baechle /* WIDGET_STATUS */ 43384740dcSRalf Baechle #define WIDGET_LLP_REC_CNT 0xff000000 44384740dcSRalf Baechle #define WIDGET_LLP_TX_CNT 0x00ff0000 45384740dcSRalf Baechle #define WIDGET_PENDING 0x0000001f 46384740dcSRalf Baechle 47384740dcSRalf Baechle /* WIDGET_ERR_UPPER_ADDR */ 48384740dcSRalf Baechle #define WIDGET_ERR_UPPER_ADDR_ONLY 0x0000ffff 49384740dcSRalf Baechle 50384740dcSRalf Baechle /* WIDGET_CONTROL */ 51384740dcSRalf Baechle #define WIDGET_F_BAD_PKT 0x00010000 52384740dcSRalf Baechle #define WIDGET_LLP_XBAR_CRD 0x0000f000 53384740dcSRalf Baechle #define WIDGET_LLP_XBAR_CRD_SHFT 12 54384740dcSRalf Baechle #define WIDGET_CLR_RLLP_CNT 0x00000800 55384740dcSRalf Baechle #define WIDGET_CLR_TLLP_CNT 0x00000400 56384740dcSRalf Baechle #define WIDGET_SYS_END 0x00000200 57384740dcSRalf Baechle #define WIDGET_MAX_TRANS 0x000001f0 58384740dcSRalf Baechle #define WIDGET_WIDGET_ID 0x0000000f 59384740dcSRalf Baechle 60384740dcSRalf Baechle /* WIDGET_INTDEST_UPPER_ADDR */ 61384740dcSRalf Baechle #define WIDGET_INT_VECTOR 0xff000000 62384740dcSRalf Baechle #define WIDGET_INT_VECTOR_SHFT 24 63384740dcSRalf Baechle #define WIDGET_TARGET_ID 0x000f0000 64384740dcSRalf Baechle #define WIDGET_TARGET_ID_SHFT 16 65384740dcSRalf Baechle #define WIDGET_UPP_ADDR 0x0000ffff 66384740dcSRalf Baechle 67384740dcSRalf Baechle /* WIDGET_ERR_CMD_WORD */ 68384740dcSRalf Baechle #define WIDGET_DIDN 0xf0000000 69384740dcSRalf Baechle #define WIDGET_SIDN 0x0f000000 70384740dcSRalf Baechle #define WIDGET_PACTYP 0x00f00000 71384740dcSRalf Baechle #define WIDGET_TNUM 0x000f8000 72384740dcSRalf Baechle #define WIDGET_COHERENT 0x00004000 73384740dcSRalf Baechle #define WIDGET_DS 0x00003000 74384740dcSRalf Baechle #define WIDGET_GBR 0x00000800 75384740dcSRalf Baechle #define WIDGET_VBPM 0x00000400 76384740dcSRalf Baechle #define WIDGET_ERROR 0x00000200 77384740dcSRalf Baechle #define WIDGET_BARRIER 0x00000100 78384740dcSRalf Baechle 79384740dcSRalf Baechle /* WIDGET_LLP_CFG */ 80384740dcSRalf Baechle #define WIDGET_LLP_MAXRETRY 0x03ff0000 81384740dcSRalf Baechle #define WIDGET_LLP_MAXRETRY_SHFT 16 82384740dcSRalf Baechle #define WIDGET_LLP_NULLTIMEOUT 0x0000fc00 83384740dcSRalf Baechle #define WIDGET_LLP_NULLTIMEOUT_SHFT 10 84384740dcSRalf Baechle #define WIDGET_LLP_MAXBURST 0x000003ff 85384740dcSRalf Baechle #define WIDGET_LLP_MAXBURST_SHFT 0 86384740dcSRalf Baechle 87*de5792a4SJoshua Kinard /* Xtalk Widget Device Mfgr Nums */ 88*de5792a4SJoshua Kinard #define WIDGET_XBOW_MFGR_NUM 0x0 /* IP30 XBow Chip */ 89*de5792a4SJoshua Kinard #define WIDGET_XXBOW_MFGR_NUM 0x0 /* IP35 Xbow + XBridge Chip */ 90*de5792a4SJoshua Kinard #define WIDGET_ODYS_MFGR_NUM 0x023 /* Odyssey / VPro GFX */ 91*de5792a4SJoshua Kinard #define WIDGET_TPU_MFGR_NUM 0x024 /* Tensor Processor Unit */ 92*de5792a4SJoshua Kinard #define WIDGET_XBRDG_MFGR_NUM 0x024 /* IP35 XBridge Chip */ 93*de5792a4SJoshua Kinard #define WIDGET_HEART_MFGR_NUM 0x036 /* IP30 HEART Chip */ 94*de5792a4SJoshua Kinard #define WIDGET_BRIDG_MFGR_NUM 0x036 /* PCI Bridge */ 95*de5792a4SJoshua Kinard #define WIDGET_HUB_MFGR_NUM 0x036 /* IP27 Hub Chip */ 96*de5792a4SJoshua Kinard #define WIDGET_BDRCK_MFGR_NUM 0x036 /* IP35 Bedrock Chip */ 97*de5792a4SJoshua Kinard #define WIDGET_IMPCT_MFGR_NUM 0x2aa /* HQ4 / Impact GFX */ 98*de5792a4SJoshua Kinard #define WIDGET_KONA_MFGR_NUM 0x2aa /* InfiniteReality3 / Kona GFX */ 99*de5792a4SJoshua Kinard #define WIDGET_NULL_MFGR_NUM -1 /* NULL */ 100*de5792a4SJoshua Kinard 101*de5792a4SJoshua Kinard /* Xtalk Widget Device Part Nums */ 102*de5792a4SJoshua Kinard #define WIDGET_XBOW_PART_NUM 0x0000 103*de5792a4SJoshua Kinard #define WIDGET_HEART_PART_NUM 0xc001 104*de5792a4SJoshua Kinard #define WIDGET_BRIDG_PART_NUM 0xc002 105*de5792a4SJoshua Kinard #define WIDGET_IMPCT_PART_NUM 0xc003 106*de5792a4SJoshua Kinard #define WIDGET_ODYS_PART_NUM 0xc013 107*de5792a4SJoshua Kinard #define WIDGET_HUB_PART_NUM 0xc101 108*de5792a4SJoshua Kinard #define WIDGET_KONA_PART_NUM 0xc102 109*de5792a4SJoshua Kinard #define WIDGET_BDRCK_PART_NUM 0xc110 110*de5792a4SJoshua Kinard #define WIDGET_TPU_PART_NUM 0xc202 111*de5792a4SJoshua Kinard #define WIDGET_XXBOW_PART_NUM 0xd000 112*de5792a4SJoshua Kinard #define WIDGET_XBRDG_PART_NUM 0xd002 113*de5792a4SJoshua Kinard #define WIDGET_NULL_PART_NUM -1 114*de5792a4SJoshua Kinard 115*de5792a4SJoshua Kinard /* For Xtalk Widget identification */ 116*de5792a4SJoshua Kinard struct widget_ident { 117*de5792a4SJoshua Kinard u32 mfgr; 118*de5792a4SJoshua Kinard u32 part; 119*de5792a4SJoshua Kinard char *name; 120*de5792a4SJoshua Kinard char *revs[16]; 121*de5792a4SJoshua Kinard }; 122*de5792a4SJoshua Kinard 123*de5792a4SJoshua Kinard /* Known Xtalk Widgets */ 124*de5792a4SJoshua Kinard static const struct widget_ident __initconst widget_idents[] = { 125*de5792a4SJoshua Kinard { 126*de5792a4SJoshua Kinard WIDGET_XBOW_MFGR_NUM, 127*de5792a4SJoshua Kinard WIDGET_XBOW_PART_NUM, 128*de5792a4SJoshua Kinard "xbow", 129*de5792a4SJoshua Kinard {NULL, "1.0", "1.1", "1.2", "1.3", "2.0", NULL}, 130*de5792a4SJoshua Kinard }, 131*de5792a4SJoshua Kinard { 132*de5792a4SJoshua Kinard WIDGET_HEART_MFGR_NUM, 133*de5792a4SJoshua Kinard WIDGET_HEART_PART_NUM, 134*de5792a4SJoshua Kinard "heart", 135*de5792a4SJoshua Kinard {NULL, "A", "B", "C", "D", "E", "F", NULL}, 136*de5792a4SJoshua Kinard }, 137*de5792a4SJoshua Kinard { 138*de5792a4SJoshua Kinard WIDGET_BRIDG_MFGR_NUM, 139*de5792a4SJoshua Kinard WIDGET_BRIDG_PART_NUM, 140*de5792a4SJoshua Kinard "bridge", 141*de5792a4SJoshua Kinard {NULL, "A", "B", "C", "D", NULL}, 142*de5792a4SJoshua Kinard }, 143*de5792a4SJoshua Kinard { 144*de5792a4SJoshua Kinard WIDGET_IMPCT_MFGR_NUM, 145*de5792a4SJoshua Kinard WIDGET_IMPCT_PART_NUM, 146*de5792a4SJoshua Kinard "impact", 147*de5792a4SJoshua Kinard {NULL, "A", "B", NULL}, 148*de5792a4SJoshua Kinard }, 149*de5792a4SJoshua Kinard { 150*de5792a4SJoshua Kinard WIDGET_ODYS_MFGR_NUM, 151*de5792a4SJoshua Kinard WIDGET_ODYS_PART_NUM, 152*de5792a4SJoshua Kinard "odyssey", 153*de5792a4SJoshua Kinard {NULL, "A", "B", NULL}, 154*de5792a4SJoshua Kinard }, 155*de5792a4SJoshua Kinard { 156*de5792a4SJoshua Kinard WIDGET_HUB_MFGR_NUM, 157*de5792a4SJoshua Kinard WIDGET_HUB_PART_NUM, 158*de5792a4SJoshua Kinard "hub", 159*de5792a4SJoshua Kinard {NULL, "1.0", "2.0", "2.1", "2.2", "2.3", "2.4", NULL}, 160*de5792a4SJoshua Kinard }, 161*de5792a4SJoshua Kinard { 162*de5792a4SJoshua Kinard WIDGET_KONA_MFGR_NUM, 163*de5792a4SJoshua Kinard WIDGET_KONA_PART_NUM, 164*de5792a4SJoshua Kinard "kona", 165*de5792a4SJoshua Kinard {NULL}, 166*de5792a4SJoshua Kinard }, 167*de5792a4SJoshua Kinard { 168*de5792a4SJoshua Kinard WIDGET_BDRCK_MFGR_NUM, 169*de5792a4SJoshua Kinard WIDGET_BDRCK_PART_NUM, 170*de5792a4SJoshua Kinard "bedrock", 171*de5792a4SJoshua Kinard {NULL, "1.0", "1.1", NULL}, 172*de5792a4SJoshua Kinard }, 173*de5792a4SJoshua Kinard { 174*de5792a4SJoshua Kinard WIDGET_TPU_MFGR_NUM, 175*de5792a4SJoshua Kinard WIDGET_TPU_PART_NUM, 176*de5792a4SJoshua Kinard "tpu", 177*de5792a4SJoshua Kinard {"0", NULL}, 178*de5792a4SJoshua Kinard }, 179*de5792a4SJoshua Kinard { 180*de5792a4SJoshua Kinard WIDGET_XXBOW_MFGR_NUM, 181*de5792a4SJoshua Kinard WIDGET_XXBOW_PART_NUM, 182*de5792a4SJoshua Kinard "xxbow", 183*de5792a4SJoshua Kinard {NULL, "1.0", "2.0", NULL}, 184*de5792a4SJoshua Kinard }, 185*de5792a4SJoshua Kinard { 186*de5792a4SJoshua Kinard WIDGET_XBRDG_MFGR_NUM, 187*de5792a4SJoshua Kinard WIDGET_XBRDG_PART_NUM, 188*de5792a4SJoshua Kinard "xbridge", 189*de5792a4SJoshua Kinard {NULL, "A", "B", NULL}, 190*de5792a4SJoshua Kinard }, 191*de5792a4SJoshua Kinard { 192*de5792a4SJoshua Kinard WIDGET_NULL_MFGR_NUM, 193*de5792a4SJoshua Kinard WIDGET_NULL_PART_NUM, 194*de5792a4SJoshua Kinard NULL, 195*de5792a4SJoshua Kinard {NULL}, 196*de5792a4SJoshua Kinard } 197*de5792a4SJoshua Kinard }; 198*de5792a4SJoshua Kinard 199384740dcSRalf Baechle /* 200384740dcSRalf Baechle * according to the crosstalk spec, only 32-bits access to the widget 201384740dcSRalf Baechle * configuration registers is allowed. some widgets may allow 64-bits 202384740dcSRalf Baechle * access but software should not depend on it. registers beyond the 203384740dcSRalf Baechle * widget target flush register are widget dependent thus will not be 204384740dcSRalf Baechle * defined here 205384740dcSRalf Baechle */ 206384740dcSRalf Baechle #ifndef __ASSEMBLY__ 207384740dcSRalf Baechle typedef u32 widgetreg_t; 208384740dcSRalf Baechle 209384740dcSRalf Baechle /* widget configuration registers */ 210384740dcSRalf Baechle typedef volatile struct widget_cfg { 211384740dcSRalf Baechle widgetreg_t w_pad_0; /* 0x00 */ 212384740dcSRalf Baechle widgetreg_t w_id; /* 0x04 */ 213384740dcSRalf Baechle widgetreg_t w_pad_1; /* 0x08 */ 214384740dcSRalf Baechle widgetreg_t w_status; /* 0x0c */ 215384740dcSRalf Baechle widgetreg_t w_pad_2; /* 0x10 */ 216384740dcSRalf Baechle widgetreg_t w_err_upper_addr; /* 0x14 */ 217384740dcSRalf Baechle widgetreg_t w_pad_3; /* 0x18 */ 218384740dcSRalf Baechle widgetreg_t w_err_lower_addr; /* 0x1c */ 219384740dcSRalf Baechle widgetreg_t w_pad_4; /* 0x20 */ 220384740dcSRalf Baechle widgetreg_t w_control; /* 0x24 */ 221384740dcSRalf Baechle widgetreg_t w_pad_5; /* 0x28 */ 222384740dcSRalf Baechle widgetreg_t w_req_timeout; /* 0x2c */ 223384740dcSRalf Baechle widgetreg_t w_pad_6; /* 0x30 */ 224384740dcSRalf Baechle widgetreg_t w_intdest_upper_addr; /* 0x34 */ 225384740dcSRalf Baechle widgetreg_t w_pad_7; /* 0x38 */ 226384740dcSRalf Baechle widgetreg_t w_intdest_lower_addr; /* 0x3c */ 227384740dcSRalf Baechle widgetreg_t w_pad_8; /* 0x40 */ 228384740dcSRalf Baechle widgetreg_t w_err_cmd_word; /* 0x44 */ 229384740dcSRalf Baechle widgetreg_t w_pad_9; /* 0x48 */ 230384740dcSRalf Baechle widgetreg_t w_llp_cfg; /* 0x4c */ 231384740dcSRalf Baechle widgetreg_t w_pad_10; /* 0x50 */ 232384740dcSRalf Baechle widgetreg_t w_tflush; /* 0x54 */ 233384740dcSRalf Baechle } widget_cfg_t; 234384740dcSRalf Baechle 235384740dcSRalf Baechle typedef struct { 236384740dcSRalf Baechle unsigned didn:4; 237384740dcSRalf Baechle unsigned sidn:4; 238384740dcSRalf Baechle unsigned pactyp:4; 239384740dcSRalf Baechle unsigned tnum:5; 240384740dcSRalf Baechle unsigned ct:1; 241384740dcSRalf Baechle unsigned ds:2; 242384740dcSRalf Baechle unsigned gbr:1; 243384740dcSRalf Baechle unsigned vbpm:1; 244384740dcSRalf Baechle unsigned error:1; 245384740dcSRalf Baechle unsigned bo:1; 246384740dcSRalf Baechle unsigned other:8; 247384740dcSRalf Baechle } w_err_cmd_word_f; 248384740dcSRalf Baechle 249384740dcSRalf Baechle typedef union { 250384740dcSRalf Baechle widgetreg_t r; 251384740dcSRalf Baechle w_err_cmd_word_f f; 252384740dcSRalf Baechle } w_err_cmd_word_u; 253384740dcSRalf Baechle 254384740dcSRalf Baechle typedef struct xwidget_info_s *xwidget_info_t; 255384740dcSRalf Baechle 256384740dcSRalf Baechle /* 257384740dcSRalf Baechle * Crosstalk Widget Hardware Identification, as defined in the Crosstalk spec. 258384740dcSRalf Baechle */ 259384740dcSRalf Baechle typedef struct xwidget_hwid_s { 260384740dcSRalf Baechle xwidget_part_num_t part_num; 261384740dcSRalf Baechle xwidget_rev_num_t rev_num; 262384740dcSRalf Baechle xwidget_mfg_num_t mfg_num; 263384740dcSRalf Baechle } *xwidget_hwid_t; 264384740dcSRalf Baechle 265384740dcSRalf Baechle 266384740dcSRalf Baechle /* 267384740dcSRalf Baechle * Returns 1 if a driver that handles devices described by hwid1 is able 268384740dcSRalf Baechle * to manage a device with hardwareid hwid2. NOTE: We don't check rev 269384740dcSRalf Baechle * numbers at all. 270384740dcSRalf Baechle */ 271384740dcSRalf Baechle #define XWIDGET_HARDWARE_ID_MATCH(hwid1, hwid2) \ 272384740dcSRalf Baechle (((hwid1)->part_num == (hwid2)->part_num) && \ 273384740dcSRalf Baechle (((hwid1)->mfg_num == XWIDGET_MFG_NUM_NONE) || \ 274384740dcSRalf Baechle ((hwid2)->mfg_num == XWIDGET_MFG_NUM_NONE) || \ 275384740dcSRalf Baechle ((hwid1)->mfg_num == (hwid2)->mfg_num))) 276384740dcSRalf Baechle 277384740dcSRalf Baechle #endif /* !__ASSEMBLY__ */ 278384740dcSRalf Baechle 279384740dcSRalf Baechle #endif /* _ASM_XTALK_XWIDGET_H */ 280