1 /* *********************************************************************
2 * SB1250 Board Support Package
4 * SMBUS Constants File: sb1250_smbus.h
6 * This module contains constants and macros useful for
7 * manipulating the SB1250's SMbus devices.
9 * SB1250 specification level: 10/21/02
10 * BCM1280 specification level: 11/24/03
12 *********************************************************************
14 * Copyright 2000,2001,2002,2003,2004
15 * Broadcom Corporation. All rights reserved.
17 * This software is furnished under license and may be used and
18 * copied only in accordance with the following terms and
19 * conditions. Subject to these conditions, you may download,
20 * copy, install, use, modify and distribute modified or unmodified
21 * copies of this software in source and/or binary form. No title
22 * or ownership is transferred hereby.
24 * 1) Any source code used, modified or distributed must reproduce
25 * and retain this copyright notice and list of conditions
26 * as they appear in the source file.
28 * 2) No right is granted to use any trade name, trademark, or
29 * logo of Broadcom Corporation. The "Broadcom Corporation"
30 * name may not be used to endorse or promote products derived
31 * from this software without the prior written permission of
32 * Broadcom Corporation.
34 * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR
35 * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED
36 * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
37 * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT
38 * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN
39 * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT,
40 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
41 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
42 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
43 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
44 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
45 * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF
46 * THE POSSIBILITY OF SUCH DAMAGE.
47 ********************************************************************* */
50 #ifndef _SB1250_SMBUS_H
51 #define _SB1250_SMBUS_H
53 #include "sb1250_defs.h"
56 * SMBus Clock Frequency Register (Table 14-2)
59 #define S_SMB_FREQ_DIV 0
60 #define M_SMB_FREQ_DIV _SB_MAKEMASK(13,S_SMB_FREQ_DIV)
61 #define V_SMB_FREQ_DIV(x) _SB_MAKEVALUE(x,S_SMB_FREQ_DIV)
63 #define K_SMB_FREQ_400KHZ 0x1F
64 #define K_SMB_FREQ_100KHZ 0x7D
65 #define K_SMB_FREQ_10KHZ 1250
68 #define M_SMB_CMD _SB_MAKEMASK(8,S_SMB_CMD)
69 #define V_SMB_CMD(x) _SB_MAKEVALUE(x,S_SMB_CMD)
72 * SMBus control register (Table 14-4)
75 #define M_SMB_ERR_INTR _SB_MAKEMASK1(0)
76 #define M_SMB_FINISH_INTR _SB_MAKEMASK1(1)
78 #define S_SMB_DATA_OUT 4
79 #define M_SMB_DATA_OUT _SB_MAKEMASK1(S_SMB_DATA_OUT)
80 #define V_SMB_DATA_OUT(x) _SB_MAKEVALUE(x,S_SMB_DATA_OUT)
82 #define M_SMB_DATA_DIR _SB_MAKEMASK1(5)
83 #define M_SMB_DATA_DIR_OUTPUT M_SMB_DATA_DIR
84 #define M_SMB_CLK_OUT _SB_MAKEMASK1(6)
85 #define M_SMB_DIRECT_ENABLE _SB_MAKEMASK1(7)
88 * SMBus status registers (Table 14-5)
91 #define M_SMB_BUSY _SB_MAKEMASK1(0)
92 #define M_SMB_ERROR _SB_MAKEMASK1(1)
93 #define M_SMB_ERROR_TYPE _SB_MAKEMASK1(2)
95 #if SIBYTE_HDR_FEATURE(1250, PASS3) || SIBYTE_HDR_FEATURE(112x, PASS1) || SIBYTE_HDR_FEATURE_CHIP(1480)
96 #define S_SMB_SCL_IN 5
97 #define M_SMB_SCL_IN _SB_MAKEMASK1(S_SMB_SCL_IN)
98 #define V_SMB_SCL_IN(x) _SB_MAKEVALUE(x,S_SMB_SCL_IN)
99 #define G_SMB_SCL_IN(x) _SB_GETVALUE(x,S_SMB_SCL_IN,M_SMB_SCL_IN)
100 #endif /* 1250 PASS3 || 112x PASS1 || 1480 */
103 #define M_SMB_REF _SB_MAKEMASK1(S_SMB_REF)
104 #define V_SMB_REF(x) _SB_MAKEVALUE(x,S_SMB_REF)
105 #define G_SMB_REF(x) _SB_GETVALUE(x,S_SMB_REF,M_SMB_REF)
107 #define S_SMB_DATA_IN 7
108 #define M_SMB_DATA_IN _SB_MAKEMASK1(S_SMB_DATA_IN)
109 #define V_SMB_DATA_IN(x) _SB_MAKEVALUE(x,S_SMB_DATA_IN)
110 #define G_SMB_DATA_IN(x) _SB_GETVALUE(x,S_SMB_DATA_IN,M_SMB_DATA_IN)
113 * SMBus Start/Command registers (Table 14-9)
117 #define M_SMB_ADDR _SB_MAKEMASK(7,S_SMB_ADDR)
118 #define V_SMB_ADDR(x) _SB_MAKEVALUE(x,S_SMB_ADDR)
119 #define G_SMB_ADDR(x) _SB_GETVALUE(x,S_SMB_ADDR,M_SMB_ADDR)
121 #define M_SMB_QDATA _SB_MAKEMASK1(7)
124 #define M_SMB_TT _SB_MAKEMASK(3,S_SMB_TT)
125 #define V_SMB_TT(x) _SB_MAKEVALUE(x,S_SMB_TT)
126 #define G_SMB_TT(x) _SB_GETVALUE(x,S_SMB_TT,M_SMB_TT)
128 #define K_SMB_TT_WR1BYTE 0
129 #define K_SMB_TT_WR2BYTE 1
130 #define K_SMB_TT_WR3BYTE 2
131 #define K_SMB_TT_CMD_RD1BYTE 3
132 #define K_SMB_TT_CMD_RD2BYTE 4
133 #define K_SMB_TT_RD1BYTE 5
134 #define K_SMB_TT_QUICKCMD 6
135 #define K_SMB_TT_EEPROMREAD 7
137 #define V_SMB_TT_WR1BYTE V_SMB_TT(K_SMB_TT_WR1BYTE)
138 #define V_SMB_TT_WR2BYTE V_SMB_TT(K_SMB_TT_WR2BYTE)
139 #define V_SMB_TT_WR3BYTE V_SMB_TT(K_SMB_TT_WR3BYTE)
140 #define V_SMB_TT_CMD_RD1BYTE V_SMB_TT(K_SMB_TT_CMD_RD1BYTE)
141 #define V_SMB_TT_CMD_RD2BYTE V_SMB_TT(K_SMB_TT_CMD_RD2BYTE)
142 #define V_SMB_TT_RD1BYTE V_SMB_TT(K_SMB_TT_RD1BYTE)
143 #define V_SMB_TT_QUICKCMD V_SMB_TT(K_SMB_TT_QUICKCMD)
144 #define V_SMB_TT_EEPROMREAD V_SMB_TT(K_SMB_TT_EEPROMREAD)
146 #define M_SMB_PEC _SB_MAKEMASK1(15)
149 * SMBus Data Register (Table 14-6) and SMBus Extra Register (Table 14-7)
153 #define M_SMB_LB _SB_MAKEMASK(8,S_SMB_LB)
154 #define V_SMB_LB(x) _SB_MAKEVALUE(x,S_SMB_LB)
157 #define M_SMB_MB _SB_MAKEMASK(8,S_SMB_MB)
158 #define V_SMB_MB(x) _SB_MAKEVALUE(x,S_SMB_MB)
162 * SMBus Packet Error Check register (Table 14-8)
166 #define M_SPEC_PEC _SB_MAKEMASK(8,S_SPEC_PEC)
167 #define V_SPEC_MB(x) _SB_MAKEVALUE(x,S_SPEC_PEC)
170 #if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1) || SIBYTE_HDR_FEATURE_CHIP(1480)
173 #define M_SMB_CMDH _SB_MAKEMASK(8,S_SMB_CMDH)
174 #define V_SMB_CMDH(x) _SB_MAKEVALUE(x,S_SMB_CMDH)
176 #define M_SMB_EXTEND _SB_MAKEMASK1(14)
179 #define M_SMB_DFMT _SB_MAKEMASK(3,S_SMB_DFMT)
180 #define V_SMB_DFMT(x) _SB_MAKEVALUE(x,S_SMB_DFMT)
181 #define G_SMB_DFMT(x) _SB_GETVALUE(x,S_SMB_DFMT,M_SMB_DFMT)
183 #define K_SMB_DFMT_1BYTE 0
184 #define K_SMB_DFMT_2BYTE 1
185 #define K_SMB_DFMT_3BYTE 2
186 #define K_SMB_DFMT_4BYTE 3
187 #define K_SMB_DFMT_NODATA 4
188 #define K_SMB_DFMT_CMD4BYTE 5
189 #define K_SMB_DFMT_CMD5BYTE 6
190 #define K_SMB_DFMT_RESERVED 7
192 #define V_SMB_DFMT_1BYTE V_SMB_DFMT(K_SMB_DFMT_1BYTE)
193 #define V_SMB_DFMT_2BYTE V_SMB_DFMT(K_SMB_DFMT_2BYTE)
194 #define V_SMB_DFMT_3BYTE V_SMB_DFMT(K_SMB_DFMT_3BYTE)
195 #define V_SMB_DFMT_4BYTE V_SMB_DFMT(K_SMB_DFMT_4BYTE)
196 #define V_SMB_DFMT_NODATA V_SMB_DFMT(K_SMB_DFMT_NODATA)
197 #define V_SMB_DFMT_CMD4BYTE V_SMB_DFMT(K_SMB_DFMT_CMD4BYTE)
198 #define V_SMB_DFMT_CMD5BYTE V_SMB_DFMT(K_SMB_DFMT_CMD5BYTE)
199 #define V_SMB_DFMT_RESERVED V_SMB_DFMT(K_SMB_DFMT_RESERVED)
201 #define S_SMB_AFMT 11
202 #define M_SMB_AFMT _SB_MAKEMASK(2,S_SMB_AFMT)
203 #define V_SMB_AFMT(x) _SB_MAKEVALUE(x,S_SMB_AFMT)
204 #define G_SMB_AFMT(x) _SB_GETVALUE(x,S_SMB_AFMT,M_SMB_AFMT)
206 #define K_SMB_AFMT_NONE 0
207 #define K_SMB_AFMT_ADDR 1
208 #define K_SMB_AFMT_ADDR_CMD1BYTE 2
209 #define K_SMB_AFMT_ADDR_CMD2BYTE 3
211 #define V_SMB_AFMT_NONE V_SMB_AFMT(K_SMB_AFMT_NONE)
212 #define V_SMB_AFMT_ADDR V_SMB_AFMT(K_SMB_AFMT_ADDR)
213 #define V_SMB_AFMT_ADDR_CMD1BYTE V_SMB_AFMT(K_SMB_AFMT_ADDR_CMD1BYTE)
214 #define V_SMB_AFMT_ADDR_CMD2BYTE V_SMB_AFMT(K_SMB_AFMT_ADDR_CMD2BYTE)
216 #define M_SMB_DIR _SB_MAKEMASK1(13)
218 #endif /* 1250 PASS2 || 112x PASS1 || 1480 */