Li-Ta Lo | 416b3d7 | 2006-03-02 18:02:24 +0000 | [diff] [blame] | 1 | //#include <device/smbus_def.h> |
| 2 | #define SMBUS_ERROR -1 |
| 3 | #define SMBUS_WAIT_UNTIL_READY_TIMEOUT -2 |
| 4 | #define SMBUS_WAIT_UNTIL_DONE_TIMEOUT -3 |
| 5 | |
Li-Ta Lo | 71eae20 | 2006-03-13 21:58:43 +0000 | [diff] [blame] | 6 | #define SMB_SDA 0x00 |
| 7 | #define SMB_STS 0x01 |
| 8 | #define SMB_CTRL_STS 0x02 |
| 9 | #define SMB_CTRL1 0x03 |
| 10 | #define SMB_ADD 0x04 |
| 11 | #define SMB_CTRL2 0x05 |
| 12 | #define SMB_CTRL3 0x06 |
Li-Ta Lo | 416b3d7 | 2006-03-02 18:02:24 +0000 | [diff] [blame] | 13 | |
Li-Ta Lo | 71eae20 | 2006-03-13 21:58:43 +0000 | [diff] [blame] | 14 | #define SMB_STS_SLVSTP (0x01 << 7) |
| 15 | #define SMB_STS_SDAST (0x01 << 6) |
| 16 | #define SMB_STS_BER (0x01 << 5) |
| 17 | #define SMB_STS_NEGACK (0x01 << 4) |
| 18 | #define SMB_STS_STASTR (0x01 << 3) |
| 19 | #define SMB_STS_NMATCH (0x01 << 2) |
| 20 | #define SMB_STS_MASTER (0x01 << 1) |
| 21 | #define SMB_STS_XMIT (0x01 << 0) |
Li-Ta Lo | 416b3d7 | 2006-03-02 18:02:24 +0000 | [diff] [blame] | 22 | |
Li-Ta Lo | 71eae20 | 2006-03-13 21:58:43 +0000 | [diff] [blame] | 23 | #define SMB_CSTS_TGSCL (0x01 << 5) |
| 24 | #define SMB_CSTS_TSDA (0x01 << 4) |
| 25 | #define SMB_CSTS_GCMTCH (0x01 << 3) |
| 26 | #define SMB_CSTS_MATCH (0x01 << 2) |
| 27 | #define SMB_CSTS_BB (0x01 << 1) |
| 28 | #define SMB_CSTS_BUSY (0x01 << 0) |
Li-Ta Lo | 416b3d7 | 2006-03-02 18:02:24 +0000 | [diff] [blame] | 29 | |
Li-Ta Lo | 71eae20 | 2006-03-13 21:58:43 +0000 | [diff] [blame] | 30 | #define SMB_CTRL1_STASTRE (0x01 << 7) |
| 31 | #define SMB_CTRL1_NMINTE (0x01 << 6) |
| 32 | #define SMB_CTRL1_GCMEN (0x01 << 5) |
| 33 | #define SMB_CTRL1_ACK (0x01 << 4) |
| 34 | #define SMB_CTRL1_RSVD (0x01 << 3) |
| 35 | #define SMB_CTRL1_INTEN (0x01 << 2) |
| 36 | #define SMB_CTRL1_STOP (0x01 << 1) |
| 37 | #define SMB_CTRL1_START (0x01 << 0) |
Li-Ta Lo | 416b3d7 | 2006-03-02 18:02:24 +0000 | [diff] [blame] | 38 | |
Li-Ta Lo | 71eae20 | 2006-03-13 21:58:43 +0000 | [diff] [blame] | 39 | #define SMB_ADD_SAEN (0x01 << 7) |
Li-Ta Lo | 416b3d7 | 2006-03-02 18:02:24 +0000 | [diff] [blame] | 40 | |
Li-Ta Lo | 71eae20 | 2006-03-13 21:58:43 +0000 | [diff] [blame] | 41 | #define SMB_CTRL2_ENABLE 0x01 |
Li-Ta Lo | 416b3d7 | 2006-03-02 18:02:24 +0000 | [diff] [blame] | 42 | |
| 43 | #define SMBUS_TIMEOUT (100*1000*10) |
| 44 | #define SMBUS_STATUS_MASK 0xfbff |
| 45 | |
Li-Ta Lo | 042f043 | 2006-03-17 20:11:38 +0000 | [diff] [blame] | 46 | #define SMBUS_IO_BASE 0x6000 |