blob: 37ca5efcf5fbec0849a848feff0a7435cc1d124a [file] [log] [blame]
Frank Vibrans63e62b02011-02-14 18:38:14 +00001/*
2 * This file is part of the coreboot project.
3 *
4 * Copyright (C) 2011 Advanced Micro Devices, Inc.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 2 of the License.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 */
19
20#ifndef _SB800_SMBUS_H_
21#define _SB800_SMBUS_H_
22
23//#include <stdint.h>
24
25#define SMBUS_IO_BASE SMBUS0_BASE_ADDRESS
26
27#define SMBHSTSTAT 0x0
28#define SMBSLVSTAT 0x1
29#define SMBHSTCTRL 0x2
30#define SMBHSTCMD 0x3
31#define SMBHSTADDR 0x4
32#define SMBHSTDAT0 0x5
33#define SMBHSTDAT1 0x6
34#define SMBHSTBLKDAT 0x7
35
36#define SMBSLVCTRL 0x8
37#define SMBSLVCMD_SHADOW 0x9
38#define SMBSLVEVT 0xa
39#define SMBSLVDAT 0xc
40
41/*//SB00.H
42#define AX_INDXC 0
43#define AX_INDXP 2
44#define AXCFG 4
45#define ABCFG 6
46#define RC_INDXC 1
47#define RC_INDXP 3
48*/
49
50#define AB_INDX 0xCD8
51#define AB_DATA (AB_INDX+4)
52
53/* Between 1-10 seconds, We should never timeout normally
54 * Longer than this is just painful when a timeout condition occurs.
55 */
56#define SMBUS_TIMEOUT (100*1000*10)
57
58#define abcfg_reg(reg, mask, val) \
59 alink_ab_indx((ABCFG), (reg), (mask), (val))
60#define axcfg_reg(reg, mask, val) \
61 alink_ab_indx((AXCFG), (reg), (mask), (val))
62#define axindxc_reg(reg, mask, val) \
63 alink_ax_indx((AX_INDXC), (reg), (mask), (val))
64#define axindxp_reg(reg, mask, val) \
65 alink_ax_indx((AX_INDXP), (reg), (mask), (val))
66#define rcindxc_reg(reg, port, mask, val) \
67 alink_rc_indx((RC_INDXC), (reg), (port), (mask), (val))
68#define rcindxp_reg(reg, port, mask, val) \
69 alink_rc_indx((RC_INDXP), (reg), (port), (mask), (val))
70
71int do_smbus_read_byte(u32 smbus_io_base, u32 device, u32 address);
72int do_smbus_write_byte(u32 smbus_io_base, u32 device, u32 address, u8 val);
73int do_smbus_recv_byte(u32 smbus_io_base, u32 device);
74int do_smbus_send_byte(u32 smbus_io_base, u32 device, u8 val);
75void alink_rc_indx(u32 reg_space, u32 reg_addr, u32 port, u32 mask, u32 val);
76void alink_ab_indx(u32 reg_space, u32 reg_addr, u32 mask, u32 val);
77void alink_ax_indx(u32 space /*c or p? */ , u32 axindc, u32 mask, u32 val);
78
79#endif