Morgan Tsai | 1602dd5 | 2007-10-29 21:00:14 +0000 | [diff] [blame] | 1 | /* |
Stefan Reinauer | 7e61e45 | 2008-01-18 10:35:56 +0000 | [diff] [blame] | 2 | * This file is part of the coreboot project. |
Morgan Tsai | 1602dd5 | 2007-10-29 21:00:14 +0000 | [diff] [blame] | 3 | * |
| 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 Tsai | 1602dd5 | 2007-10-29 21:00:14 +0000 | [diff] [blame] | 20 | */ |
| 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 Reinauer | 6f57b51 | 2010-07-08 16:41:05 +0000 | [diff] [blame] | 36 | int smbus_wait_until_ready(unsigned smbus_io_base); |
| 37 | int smbus_wait_until_done(unsigned smbus_io_base); |
| 38 | int do_smbus_recv_byte(unsigned smbus_io_base, unsigned device); |
| 39 | int do_smbus_send_byte(unsigned smbus_io_base, unsigned device, unsigned char val); |
| 40 | int smbus_read_byte(unsigned device, unsigned address); |
| 41 | int smbus_write_byte(unsigned device, unsigned address, unsigned char val); |