blob: 087ea47f2395136776f24fdaed0858cef44067bf [file] [log] [blame]
Morgan Tsai1602dd52007-10-29 21:00:14 +00001/*
Stefan Reinauer7e61e452008-01-18 10:35:56 +00002 * This file is part of the coreboot project.
Morgan Tsai1602dd52007-10-29 21:00:14 +00003 *
4 * Copyright (C) 2004 Tyan Computer
5 * Written by Yinghai Lu <yhlu@tyan.com> for Tyan Computer.
6 * Copyright (C) 2006,2007 AMD
7 * Written by Yinghai Lu <yinghai.lu@amd.com> for AMD.
8 * Copyright (C) 2007 Silicon Integrated Systems Corp. (SiS)
9 * Written by Morgan Tsai <my_tsai@sis.com> for SiS.
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
15 *
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
20 *
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
24 */
25
26#include <device/smbus_def.h>
27
28#define SMBHSTSTAT 0x1
29#define SMBHSTPRTCL 0x0
30#define SMBHSTCMD 0x3
31#define SMBXMITADD 0x2
32#define SMBHSTDAT0 0x4
33#define SMBHSTDAT1 0x5
34
35/* Between 1-10 seconds, We should never timeout normally
36 * Longer than this is just painful when a timeout condition occurs.
37 */
38#define SMBUS_TIMEOUT (100*1000*10)
39
Stefan Reinauer6f57b512010-07-08 16:41:05 +000040int smbus_wait_until_ready(unsigned smbus_io_base);
41int smbus_wait_until_done(unsigned smbus_io_base);
42int do_smbus_recv_byte(unsigned smbus_io_base, unsigned device);
43int do_smbus_send_byte(unsigned smbus_io_base, unsigned device, unsigned char val);
44int smbus_read_byte(unsigned device, unsigned address);
45int smbus_write_byte(unsigned device, unsigned address, unsigned char val);
Morgan Tsai1602dd52007-10-29 21:00:14 +000046