blob: 287cbfe9efa2ce48c2034ee6485c024fd91fb0bd [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/* *********************************************************************
2 * SB1250 Board Support Package
3 *
4 * SMBUS Constants File: sb1250_smbus.h
5 *
6 * This module contains constants and macros useful for
7 * manipulating the SB1250's SMbus devices.
8 *
9 * SB1250 specification level: 01/02/2002
10 *
11 * Author: Mitch Lichtenberg
12 *
13 *********************************************************************
14 *
15 * Copyright 2000,2001,2002,2003
16 * Broadcom Corporation. All rights reserved.
17 *
18 * This program is free software; you can redistribute it and/or
19 * modify it under the terms of the GNU General Public License as
20 * published by the Free Software Foundation; either version 2 of
21 * the License, or (at your option) any later version.
22 *
23 * This program is distributed in the hope that it will be useful,
24 * but WITHOUT ANY WARRANTY; without even the implied warranty of
25 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26 * GNU General Public License for more details.
27 *
28 * You should have received a copy of the GNU General Public License
29 * along with this program; if not, write to the Free Software
30 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
31 * MA 02111-1307 USA
32 ********************************************************************* */
33
34
35#ifndef _SB1250_SMBUS_H
36#define _SB1250_SMBUS_H
37
38#include "sb1250_defs.h"
39
40/*
41 * SMBus Clock Frequency Register (Table 14-2)
42 */
43
44#define S_SMB_FREQ_DIV 0
45#define M_SMB_FREQ_DIV _SB_MAKEMASK(13,S_SMB_FREQ_DIV)
46#define V_SMB_FREQ_DIV(x) _SB_MAKEVALUE(x,S_SMB_FREQ_DIV)
47
48#define K_SMB_FREQ_400KHZ 0x1F
49#define K_SMB_FREQ_100KHZ 0x7D
50
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)
54
55/*
56 * SMBus control register (Table 14-4)
57 */
58
59#define M_SMB_ERR_INTR _SB_MAKEMASK1(0)
60#define M_SMB_FINISH_INTR _SB_MAKEMASK1(1)
61#define M_SMB_DATA_OUT _SB_MAKEMASK1(4)
62#define M_SMB_DATA_DIR _SB_MAKEMASK1(5)
63#define M_SMB_DATA_DIR_OUTPUT M_SMB_DATA_DIR
64#define M_SMB_CLK_OUT _SB_MAKEMASK1(6)
65#define M_SMB_DIRECT_ENABLE _SB_MAKEMASK1(7)
66
67/*
68 * SMBus status registers (Table 14-5)
69 */
70
71#define M_SMB_BUSY _SB_MAKEMASK1(0)
72#define M_SMB_ERROR _SB_MAKEMASK1(1)
73#define M_SMB_ERROR_TYPE _SB_MAKEMASK1(2)
74#define M_SMB_REF _SB_MAKEMASK1(6)
75#define M_SMB_DATA_IN _SB_MAKEMASK1(7)
76
77/*
78 * SMBus Start/Command registers (Table 14-9)
79 */
80
81#define S_SMB_ADDR 0
82#define M_SMB_ADDR _SB_MAKEMASK(7,S_SMB_ADDR)
83#define V_SMB_ADDR(x) _SB_MAKEVALUE(x,S_SMB_ADDR)
84#define G_SMB_ADDR(x) _SB_GETVALUE(x,S_SMB_ADDR,M_SMB_ADDR)
85
86#define M_SMB_QDATA _SB_MAKEMASK1(7)
87
88#define S_SMB_TT 8
89#define M_SMB_TT _SB_MAKEMASK(3,S_SMB_TT)
90#define V_SMB_TT(x) _SB_MAKEVALUE(x,S_SMB_TT)
91#define G_SMB_TT(x) _SB_GETVALUE(x,S_SMB_TT,M_SMB_TT)
92
93#define K_SMB_TT_WR1BYTE 0
94#define K_SMB_TT_WR2BYTE 1
95#define K_SMB_TT_WR3BYTE 2
96#define K_SMB_TT_CMD_RD1BYTE 3
97#define K_SMB_TT_CMD_RD2BYTE 4
98#define K_SMB_TT_RD1BYTE 5
99#define K_SMB_TT_QUICKCMD 6
100#define K_SMB_TT_EEPROMREAD 7
101
102#define V_SMB_TT_WR1BYTE V_SMB_TT(K_SMB_TT_WR1BYTE)
103#define V_SMB_TT_WR2BYTE V_SMB_TT(K_SMB_TT_WR2BYTE)
104#define V_SMB_TT_WR3BYTE V_SMB_TT(K_SMB_TT_WR3BYTE)
105#define V_SMB_TT_CMD_RD1BYTE V_SMB_TT(K_SMB_TT_CMD_RD1BYTE)
106#define V_SMB_TT_CMD_RD2BYTE V_SMB_TT(K_SMB_TT_CMD_RD2BYTE)
107#define V_SMB_TT_RD1BYTE V_SMB_TT(K_SMB_TT_RD1BYTE)
108#define V_SMB_TT_QUICKCMD V_SMB_TT(K_SMB_TT_QUICKCMD)
109#define V_SMB_TT_EEPROMREAD V_SMB_TT(K_SMB_TT_EEPROMREAD)
110
111#define M_SMB_PEC _SB_MAKEMASK1(15)
112
113/*
114 * SMBus Data Register (Table 14-6) and SMBus Extra Register (Table 14-7)
115 */
116
117#define S_SMB_LB 0
118#define M_SMB_LB _SB_MAKEMASK(8,S_SMB_LB)
119#define V_SMB_LB(x) _SB_MAKEVALUE(x,S_SMB_LB)
120
121#define S_SMB_MB 8
122#define M_SMB_MB _SB_MAKEMASK(8,S_SMB_MB)
123#define V_SMB_MB(x) _SB_MAKEVALUE(x,S_SMB_MB)
124
125
126/*
127 * SMBus Packet Error Check register (Table 14-8)
128 */
129
130#define S_SPEC_PEC 0
131#define M_SPEC_PEC _SB_MAKEMASK(8,S_SPEC_PEC)
132#define V_SPEC_MB(x) _SB_MAKEVALUE(x,S_SPEC_PEC)
133
134
135#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1)
136
137#define S_SMB_CMDH 8
138#define M_SMB_CMDH _SB_MAKEMASK(8,S_SMBH_CMD)
139#define V_SMB_CMDH(x) _SB_MAKEVALUE(x,S_SMBH_CMD)
140
141#define M_SMB_EXTEND _SB_MAKEMASK1(14)
142
143#define M_SMB_DIR _SB_MAKEMASK1(13)
144
145#define S_SMB_DFMT 8
146#define M_SMB_DFMT _SB_MAKEMASK(3,S_SMB_DFMT)
147#define V_SMB_DFMT(x) _SB_MAKEVALUE(x,S_SMB_DFMT)
148#define G_SMB_DFMT(x) _SB_GETVALUE(x,S_SMB_DFMT,M_SMB_DFMT)
149
150#define K_SMB_DFMT_1BYTE 0
151#define K_SMB_DFMT_2BYTE 1
152#define K_SMB_DFMT_3BYTE 2
153#define K_SMB_DFMT_4BYTE 3
154#define K_SMB_DFMT_NODATA 4
155#define K_SMB_DFMT_CMD4BYTE 5
156#define K_SMB_DFMT_CMD5BYTE 6
157#define K_SMB_DFMT_RESERVED 7
158
159#define V_SMB_DFMT_1BYTE V_SMB_DFMT(K_SMB_DFMT_1BYTE)
160#define V_SMB_DFMT_2BYTE V_SMB_DFMT(K_SMB_DFMT_2BYTE)
161#define V_SMB_DFMT_3BYTE V_SMB_DFMT(K_SMB_DFMT_3BYTE)
162#define V_SMB_DFMT_4BYTE V_SMB_DFMT(K_SMB_DFMT_4BYTE)
163#define V_SMB_DFMT_NODATA V_SMB_DFMT(K_SMB_DFMT_NODATA)
164#define V_SMB_DFMT_CMD4BYTE V_SMB_DFMT(K_SMB_DFMT_CMD4BYTE)
165#define V_SMB_DFMT_CMD5BYTE V_SMB_DFMT(K_SMB_DFMT_CMD5BYTE)
166#define V_SMB_DFMT_RESERVED V_SMB_DFMT(K_SMB_DFMT_RESERVED)
167
168#endif /* 1250 PASS2 || 112x PASS1 */
169
170#endif