BCM WL 6.30.102.9 (r366174)
[tomato.git] / release / src-rt / cfe / cfe / pci / ldtreg.h
blob140effeda1a811ad92577355d1fc139cc16bd112
1 /*
2 * Copyright 2000,2001
3 * Broadcom Corporation. All rights reserved.
4 *
5 * This software is furnished under license and may be used and
6 * copied only in accordance with the following terms and
7 * conditions. Subject to these conditions, you may download,
8 * copy, install, use, modify and distribute modified or unmodified
9 * copies of this software in source and/or binary form. No title
10 * or ownership is transferred hereby.
12 * 1) Any source code used, modified or distributed must reproduce
13 * and retain this copyright notice and list of conditions as
14 * they appear in the source file.
16 * 2) No right is granted to use any trade name, trademark, or
17 * logo of Broadcom Corporation. Neither the "Broadcom
18 * Corporation" name nor any trademark or logo of Broadcom
19 * Corporation may be used to endorse or promote products
20 * derived from this software without the prior written
21 * permission of Broadcom Corporation.
23 * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR
24 * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED
25 * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
26 * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT
27 * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN
28 * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT,
29 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
30 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
31 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
32 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
33 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
34 * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF
35 * THE POSSIBILITY OF SUCH DAMAGE.
38 #ifndef _LDTREG_H_
39 #define _LDTREG_H_
42 * LDT capability register definitions and macros.
43 * Derived from Revison 0.17 of the LDT (now HyperTransport)
44 * Specification with some 1.02/1.03 features.
46 * Note: Register and field definitions assume 32-bit register accesses.
50 * LDT Capability registers (identified by offsets within the capability)
54 * Command Register; contains command and capability fields.
56 #define LDT_COMMAND_CAP_OFF 0x00
58 #define LDT_CAP_ID_MASK 0x000000ff
59 #define LDT_CAP_ID_SHIFT 0
60 #define LDT_CAP_PTR_MASK 0x0000ff00
61 #define LDT_CAP_PTR_SHIFT 8
63 #define LDT_COMMAND_MASK 0xffff0000
64 #define LDT_COMMAND_SHIFT 16
65 #define LDT_COMMAND(cmd) \
66 (((cmd) & LDT_COMMAND_MASK) >> LDT_COMMAND_SHIFT)
67 #define LDT_COMMAND_TYPE_MASK 0xe0000000
68 #define LDT_COMMAND_TYPE_SHIFT (16+13)
69 #define LDT_COMMAND_TYPE(cmd) \
70 (((cmd) & LDT_COMMAND_TYPE_MASK) >> LDT_COMMAND_TYPE_SHIFT)
71 #define LDT_COMMAND_TYPE_SLAVE 0x0
72 #define LDT_COMMAND_TYPE_HOST 0x1
73 #define LDT_COMMAND_TYPE_IDC 0x4
74 #define LDT_COMMAND_TYPE_AMAP 0x5
75 /* Following for 1.0x only */
76 #define LDT_COMMAND_DROP_ON_INIT 0x10000000
79 * An LDT capability for type Slave (aka Primary, aka "tunnel") consists
80 * of a Command register, two Link registers, and two Freq/Rev registers.
82 /* Slave/Primary commands */
83 #define LDT_COMMAND_UNIT_ID_MASK 0x001f0000
84 #define LDT_COMMAND_UNIT_ID_SHIFT (16+0)
85 #define LDT_COMMAND_UNIT_ID(cmd) \
86 (((cmd) & LDT_COMMAND_UNIT_ID_MASK) >> LDT_COMMAND_UNIT_ID_SHIFT)
87 #define LDT_COMMAND_UNIT_COUNT_MASK 0x03e00000
88 #define LDT_COMMAND_UNIT_COUNT_SHIFT (16+5)
89 #define LDT_COMMAND_UNIT_COUNT(cmd) \
90 (((cmd) & LDT_COMMAND_UNIT_COUNT_MASK) >> LDT_COMMAND_UNIT_COUNT_SHIFT)
91 #define LDT_COMMAND_MASTER_HOST_MASK 0x04000000
92 #define LDT_COMMAND_MASTER_HOST(cmd) \
93 (((cmd) & LDT_COMMAND_MASTER_HOST_MASK) ? 1 : 0)
94 #define LDT_COMMAND_DEFAULT_DIRECTION_MASK 0x08000000
95 #define LDT_COMMAND_DEFAULT_DIRECTION(cmd) \
96 (((cmd) & LDT_COMMAND_DEFAULT_DIRECTION_MASK) ? 1 : 0)
99 * An LDT capability for type Host (aka Secondary) consists of a
100 * Command register, a single Link register, and a Freq/Rev register.
102 /* Host/Secondary command fields */
103 #define LDT_COMMAND_WARM_RESET 0x00010000
104 #define LDT_COMMAND_DOUBLE_ENDED 0x00020000
105 #define LDT_COMMAND_DEVICE_NUMBER_MASK 0x007c0000
106 #define LDT_COMMAND_DEVICE_NUMBER_SHIFT (16+2)
107 /* Following for 1.0x only */
108 #define LDT_COMMAND_CHAIN_SIDE 0x00800000
109 #define LDT_COMMAND_HOST_HIDE 0x01000000
110 #define LDT_COMMAND_ACT_AS_SLAVE 0x02000000
111 #define LDT_COMMAND_INBOUND_EOC_ERROR 0x04000000
115 * Link Register; contains control and config fields.
117 #define LDT_LINK_OFF(n) (0x04 + ((n)<<2))
119 #define LDT_LINKCTRL_MASK 0x0000ffff
120 #define LDT_LINKCTRL_SHIFT 0
121 #define LDT_LINKCTRL(cr) \
122 (((cr) & LDT_LINKCTRL_MASK) >> LDT_LINKCTRL_SHIFT)
123 #define LDT_LINKCTRL_CFLE 0x00000002
124 #define LDT_LINKCTRL_CST 0x00000004
125 #define LDT_LINKCTRL_CFE 0x00000008
126 #define LDT_LINKCTRL_LINKFAIL 0x00000010
127 #define LDT_LINKCTRL_INITDONE 0x00000020
128 #define LDT_LINKCTRL_EOC 0x00000040
129 #define LDT_LINKCTRL_TXOFF 0x00000080
130 #define LDT_LINKCTRL_CRCERROR_MASK 0x00000f00
131 #define LDT_LINKCTRL_CRCERROR_SHIFT 8
132 #define LDT_LINKCTRL_ISOCEN 0x00001000
133 #define LDT_LINKCTRL_LSEN 0x00002000
134 /* Following for 1.0x only */
135 #define LDT_LINKCTRL_EXTCTL 0x00004000
137 #define LDT_LINKCFG_MASK 0xffff0000
138 #define LDT_LINKCFG_SHIFT 16
139 #define LDT_LINKCFG(cr) \
140 (((cr) & LDT_LINKCFG_MASK) >> LDT_LINKCFG_SHIFT)
141 #define LDT_LINKCFG_MAX_WIDTH_IN(cr) \
142 (((cr) >> (16+0)) & 0xf)
143 #define LDT_LINKCFG_MAX_WIDTH_OUT(cr) \
144 (((cr) >> (16+4)) & 0xf)
145 #define LDT_LINKCFG_WIDTH_IN(cr) \
146 (((cr) >> (16+8)) & 0xf)
147 #define LDT_LINKCFG_WIDTH_OUT(cr) \
148 (((cr) >> (16+12)) & 0xf)
152 * Link Frequency Register; contains version and frequency fields.
154 #define LDT_LINKFREQ_CAP(cr) \
155 (((cr) >> 16) & 0xffff)
157 #define LDT_LINKFREQ_MASK 0x00000f00
158 #define LDT_LINKFREQ_SHIFT 8
159 #define LDT_LINKFREQ(cr) \
160 (((cr) >> 8) & 0x0f)
162 #define LDT_REVISION_ID(cr) \
163 (((cr) >> 0) & 0xff)
165 #define LDT_REV_017 0x11
166 #define LDT_REV_102 0x22
168 /* Slave/Primary offsets */
169 #define LDT_FREQ0_OFF 0x0c
170 #define LDT_FREQ1_OFF 0x10
171 #define LDT_FREQn_OFF(n) (0x0c + ((n)<<2))
173 /* Host/Secondary offsets */
174 #define LDT_FREQ_OFF 0x08
176 #define LDT_FREQ_200 0x00
177 #define LDT_FREQ_300 0x01
178 #define LDT_FREQ_400 0x02
179 #define LDT_FREQ_500 0x03
180 #define LDT_FREQ_600 0x04
181 #define LDT_FREQ_800 0x05
182 #define LDT_FREQ_1000 0x06
184 #endif /* _LDTREG_H_ */