blob: a96a9c204410fc92b6353a5010b75560f023bea1 [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.
Morgan Tsai1602dd52007-10-29 21:00:14 +000020 */
21
22#include <device/smbus_def.h>
23
24#define SMBHSTSTAT 0x1
25#define SMBHSTPRTCL 0x0
26#define SMBHSTCMD 0x3
27#define SMBXMITADD 0x2
28#define SMBHSTDAT0 0x4
29#define SMBHSTDAT1 0x5
30
31/* Between 1-10 seconds, We should never timeout normally
32 * Longer than this is just painful when a timeout condition occurs.
33 */
34#define SMBUS_TIMEOUT (100*1000*10)
35
Stefan Reinauer6f57b512010-07-08 16:41:05 +000036int smbus_wait_until_ready(unsigned smbus_io_base);
37int smbus_wait_until_done(unsigned smbus_io_base);
38int do_smbus_recv_byte(unsigned smbus_io_base, unsigned device);
39int do_smbus_send_byte(unsigned smbus_io_base, unsigned device, unsigned char val);
40int smbus_read_byte(unsigned device, unsigned address);
41int smbus_write_byte(unsigned device, unsigned address, unsigned char val);