ACPI: Use _TSS for throttling control, when present. Add error checks.
[linux-2.6/mini2440.git] / include / asm-mips / sibyte / sb1250_smbus.h
blob04769923cf1e3a29e926febd5e5143fd8bff0161
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
15 * Broadcom Corporation. All rights reserved.
17 * This program is free software; you can redistribute it and/or
18 * modify it under the terms of the GNU General Public License as
19 * published by the Free Software Foundation; either version 2 of
20 * the License, or (at your option) any later version.
22 * This program is distributed in the hope that it will be useful,
23 * but WITHOUT ANY WARRANTY; without even the implied warranty of
24 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25 * GNU General Public License for more details.
27 * You should have received a copy of the GNU General Public License
28 * along with this program; if not, write to the Free Software
29 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
30 * MA 02111-1307 USA
31 ********************************************************************* */
34 #ifndef _SB1250_SMBUS_H
35 #define _SB1250_SMBUS_H
37 #include "sb1250_defs.h"
40 * SMBus Clock Frequency Register (Table 14-2)
43 #define S_SMB_FREQ_DIV 0
44 #define M_SMB_FREQ_DIV _SB_MAKEMASK(13, S_SMB_FREQ_DIV)
45 #define V_SMB_FREQ_DIV(x) _SB_MAKEVALUE(x, S_SMB_FREQ_DIV)
47 #define K_SMB_FREQ_400KHZ 0x1F
48 #define K_SMB_FREQ_100KHZ 0x7D
49 #define K_SMB_FREQ_10KHZ 1250
51 #define S_SMB_CMD 0
52 #define M_SMB_CMD _SB_MAKEMASK(8, S_SMB_CMD)
53 #define V_SMB_CMD(x) _SB_MAKEVALUE(x, S_SMB_CMD)
56 * SMBus control register (Table 14-4)
59 #define M_SMB_ERR_INTR _SB_MAKEMASK1(0)
60 #define M_SMB_FINISH_INTR _SB_MAKEMASK1(1)
62 #define S_SMB_DATA_OUT 4
63 #define M_SMB_DATA_OUT _SB_MAKEMASK1(S_SMB_DATA_OUT)
64 #define V_SMB_DATA_OUT(x) _SB_MAKEVALUE(x, S_SMB_DATA_OUT)
66 #define M_SMB_DATA_DIR _SB_MAKEMASK1(5)
67 #define M_SMB_DATA_DIR_OUTPUT M_SMB_DATA_DIR
68 #define M_SMB_CLK_OUT _SB_MAKEMASK1(6)
69 #define M_SMB_DIRECT_ENABLE _SB_MAKEMASK1(7)
72 * SMBus status registers (Table 14-5)
75 #define M_SMB_BUSY _SB_MAKEMASK1(0)
76 #define M_SMB_ERROR _SB_MAKEMASK1(1)
77 #define M_SMB_ERROR_TYPE _SB_MAKEMASK1(2)
79 #if SIBYTE_HDR_FEATURE(1250, PASS3) || SIBYTE_HDR_FEATURE(112x, PASS1) || SIBYTE_HDR_FEATURE_CHIP(1480)
80 #define S_SMB_SCL_IN 5
81 #define M_SMB_SCL_IN _SB_MAKEMASK1(S_SMB_SCL_IN)
82 #define V_SMB_SCL_IN(x) _SB_MAKEVALUE(x, S_SMB_SCL_IN)
83 #define G_SMB_SCL_IN(x) _SB_GETVALUE(x, S_SMB_SCL_IN, M_SMB_SCL_IN)
84 #endif /* 1250 PASS3 || 112x PASS1 || 1480 */
86 #define S_SMB_REF 6
87 #define M_SMB_REF _SB_MAKEMASK1(S_SMB_REF)
88 #define V_SMB_REF(x) _SB_MAKEVALUE(x, S_SMB_REF)
89 #define G_SMB_REF(x) _SB_GETVALUE(x, S_SMB_REF, M_SMB_REF)
91 #define S_SMB_DATA_IN 7
92 #define M_SMB_DATA_IN _SB_MAKEMASK1(S_SMB_DATA_IN)
93 #define V_SMB_DATA_IN(x) _SB_MAKEVALUE(x, S_SMB_DATA_IN)
94 #define G_SMB_DATA_IN(x) _SB_GETVALUE(x, S_SMB_DATA_IN, M_SMB_DATA_IN)
97 * SMBus Start/Command registers (Table 14-9)
100 #define S_SMB_ADDR 0
101 #define M_SMB_ADDR _SB_MAKEMASK(7, S_SMB_ADDR)
102 #define V_SMB_ADDR(x) _SB_MAKEVALUE(x, S_SMB_ADDR)
103 #define G_SMB_ADDR(x) _SB_GETVALUE(x, S_SMB_ADDR, M_SMB_ADDR)
105 #define M_SMB_QDATA _SB_MAKEMASK1(7)
107 #define S_SMB_TT 8
108 #define M_SMB_TT _SB_MAKEMASK(3, S_SMB_TT)
109 #define V_SMB_TT(x) _SB_MAKEVALUE(x, S_SMB_TT)
110 #define G_SMB_TT(x) _SB_GETVALUE(x, S_SMB_TT, M_SMB_TT)
112 #define K_SMB_TT_WR1BYTE 0
113 #define K_SMB_TT_WR2BYTE 1
114 #define K_SMB_TT_WR3BYTE 2
115 #define K_SMB_TT_CMD_RD1BYTE 3
116 #define K_SMB_TT_CMD_RD2BYTE 4
117 #define K_SMB_TT_RD1BYTE 5
118 #define K_SMB_TT_QUICKCMD 6
119 #define K_SMB_TT_EEPROMREAD 7
121 #define V_SMB_TT_WR1BYTE V_SMB_TT(K_SMB_TT_WR1BYTE)
122 #define V_SMB_TT_WR2BYTE V_SMB_TT(K_SMB_TT_WR2BYTE)
123 #define V_SMB_TT_WR3BYTE V_SMB_TT(K_SMB_TT_WR3BYTE)
124 #define V_SMB_TT_CMD_RD1BYTE V_SMB_TT(K_SMB_TT_CMD_RD1BYTE)
125 #define V_SMB_TT_CMD_RD2BYTE V_SMB_TT(K_SMB_TT_CMD_RD2BYTE)
126 #define V_SMB_TT_RD1BYTE V_SMB_TT(K_SMB_TT_RD1BYTE)
127 #define V_SMB_TT_QUICKCMD V_SMB_TT(K_SMB_TT_QUICKCMD)
128 #define V_SMB_TT_EEPROMREAD V_SMB_TT(K_SMB_TT_EEPROMREAD)
130 #define M_SMB_PEC _SB_MAKEMASK1(15)
133 * SMBus Data Register (Table 14-6) and SMBus Extra Register (Table 14-7)
136 #define S_SMB_LB 0
137 #define M_SMB_LB _SB_MAKEMASK(8, S_SMB_LB)
138 #define V_SMB_LB(x) _SB_MAKEVALUE(x, S_SMB_LB)
140 #define S_SMB_MB 8
141 #define M_SMB_MB _SB_MAKEMASK(8, S_SMB_MB)
142 #define V_SMB_MB(x) _SB_MAKEVALUE(x, S_SMB_MB)
146 * SMBus Packet Error Check register (Table 14-8)
149 #define S_SPEC_PEC 0
150 #define M_SPEC_PEC _SB_MAKEMASK(8, S_SPEC_PEC)
151 #define V_SPEC_MB(x) _SB_MAKEVALUE(x, S_SPEC_PEC)
154 #if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1) || SIBYTE_HDR_FEATURE_CHIP(1480)
156 #define S_SMB_CMDH 8
157 #define M_SMB_CMDH _SB_MAKEMASK(8, S_SMB_CMDH)
158 #define V_SMB_CMDH(x) _SB_MAKEVALUE(x, S_SMB_CMDH)
160 #define M_SMB_EXTEND _SB_MAKEMASK1(14)
162 #define S_SMB_DFMT 8
163 #define M_SMB_DFMT _SB_MAKEMASK(3, S_SMB_DFMT)
164 #define V_SMB_DFMT(x) _SB_MAKEVALUE(x, S_SMB_DFMT)
165 #define G_SMB_DFMT(x) _SB_GETVALUE(x, S_SMB_DFMT, M_SMB_DFMT)
167 #define K_SMB_DFMT_1BYTE 0
168 #define K_SMB_DFMT_2BYTE 1
169 #define K_SMB_DFMT_3BYTE 2
170 #define K_SMB_DFMT_4BYTE 3
171 #define K_SMB_DFMT_NODATA 4
172 #define K_SMB_DFMT_CMD4BYTE 5
173 #define K_SMB_DFMT_CMD5BYTE 6
174 #define K_SMB_DFMT_RESERVED 7
176 #define V_SMB_DFMT_1BYTE V_SMB_DFMT(K_SMB_DFMT_1BYTE)
177 #define V_SMB_DFMT_2BYTE V_SMB_DFMT(K_SMB_DFMT_2BYTE)
178 #define V_SMB_DFMT_3BYTE V_SMB_DFMT(K_SMB_DFMT_3BYTE)
179 #define V_SMB_DFMT_4BYTE V_SMB_DFMT(K_SMB_DFMT_4BYTE)
180 #define V_SMB_DFMT_NODATA V_SMB_DFMT(K_SMB_DFMT_NODATA)
181 #define V_SMB_DFMT_CMD4BYTE V_SMB_DFMT(K_SMB_DFMT_CMD4BYTE)
182 #define V_SMB_DFMT_CMD5BYTE V_SMB_DFMT(K_SMB_DFMT_CMD5BYTE)
183 #define V_SMB_DFMT_RESERVED V_SMB_DFMT(K_SMB_DFMT_RESERVED)
185 #define S_SMB_AFMT 11
186 #define M_SMB_AFMT _SB_MAKEMASK(2, S_SMB_AFMT)
187 #define V_SMB_AFMT(x) _SB_MAKEVALUE(x, S_SMB_AFMT)
188 #define G_SMB_AFMT(x) _SB_GETVALUE(x, S_SMB_AFMT, M_SMB_AFMT)
190 #define K_SMB_AFMT_NONE 0
191 #define K_SMB_AFMT_ADDR 1
192 #define K_SMB_AFMT_ADDR_CMD1BYTE 2
193 #define K_SMB_AFMT_ADDR_CMD2BYTE 3
195 #define V_SMB_AFMT_NONE V_SMB_AFMT(K_SMB_AFMT_NONE)
196 #define V_SMB_AFMT_ADDR V_SMB_AFMT(K_SMB_AFMT_ADDR)
197 #define V_SMB_AFMT_ADDR_CMD1BYTE V_SMB_AFMT(K_SMB_AFMT_ADDR_CMD1BYTE)
198 #define V_SMB_AFMT_ADDR_CMD2BYTE V_SMB_AFMT(K_SMB_AFMT_ADDR_CMD2BYTE)
200 #define M_SMB_DIR _SB_MAKEMASK1(13)
202 #endif /* 1250 PASS2 || 112x PASS1 || 1480 */
204 #endif