Angel Pons | 182dbde | 2020-04-02 23:49:05 +0200 | [diff] [blame^] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
| 2 | /* This file is part of the coreboot project. */ |
Frank Vibrans | 63e62b0 | 2011-02-14 18:38:14 +0000 | [diff] [blame] | 3 | |
| 4 | #ifndef _SB800_SMBUS_H_ |
| 5 | #define _SB800_SMBUS_H_ |
| 6 | |
Frank Vibrans | 63e62b0 | 2011-02-14 18:38:14 +0000 | [diff] [blame] | 7 | #define SMBUS_IO_BASE SMBUS0_BASE_ADDRESS |
| 8 | |
| 9 | #define SMBHSTSTAT 0x0 |
| 10 | #define SMBSLVSTAT 0x1 |
| 11 | #define SMBHSTCTRL 0x2 |
| 12 | #define SMBHSTCMD 0x3 |
| 13 | #define SMBHSTADDR 0x4 |
| 14 | #define SMBHSTDAT0 0x5 |
| 15 | #define SMBHSTDAT1 0x6 |
| 16 | #define SMBHSTBLKDAT 0x7 |
| 17 | |
| 18 | #define SMBSLVCTRL 0x8 |
| 19 | #define SMBSLVCMD_SHADOW 0x9 |
| 20 | #define SMBSLVEVT 0xa |
| 21 | #define SMBSLVDAT 0xc |
| 22 | |
| 23 | /*//SB00.H |
| 24 | #define AX_INDXC 0 |
| 25 | #define AX_INDXP 2 |
| 26 | #define AXCFG 4 |
| 27 | #define ABCFG 6 |
| 28 | #define RC_INDXC 1 |
| 29 | #define RC_INDXP 3 |
| 30 | */ |
| 31 | |
| 32 | #define AB_INDX 0xCD8 |
| 33 | #define AB_DATA (AB_INDX+4) |
| 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 | |
| 40 | #define abcfg_reg(reg, mask, val) \ |
| 41 | alink_ab_indx((ABCFG), (reg), (mask), (val)) |
| 42 | #define axcfg_reg(reg, mask, val) \ |
| 43 | alink_ab_indx((AXCFG), (reg), (mask), (val)) |
| 44 | #define axindxc_reg(reg, mask, val) \ |
| 45 | alink_ax_indx((AX_INDXC), (reg), (mask), (val)) |
| 46 | #define axindxp_reg(reg, mask, val) \ |
| 47 | alink_ax_indx((AX_INDXP), (reg), (mask), (val)) |
| 48 | #define rcindxc_reg(reg, port, mask, val) \ |
| 49 | alink_rc_indx((RC_INDXC), (reg), (port), (mask), (val)) |
| 50 | #define rcindxp_reg(reg, port, mask, val) \ |
| 51 | alink_rc_indx((RC_INDXP), (reg), (port), (mask), (val)) |
| 52 | |
| 53 | int do_smbus_read_byte(u32 smbus_io_base, u32 device, u32 address); |
| 54 | int do_smbus_write_byte(u32 smbus_io_base, u32 device, u32 address, u8 val); |
| 55 | int do_smbus_recv_byte(u32 smbus_io_base, u32 device); |
| 56 | int do_smbus_send_byte(u32 smbus_io_base, u32 device, u8 val); |
| 57 | void alink_rc_indx(u32 reg_space, u32 reg_addr, u32 port, u32 mask, u32 val); |
| 58 | void alink_ab_indx(u32 reg_space, u32 reg_addr, u32 mask, u32 val); |
| 59 | void alink_ax_indx(u32 space /*c or p? */ , u32 axindc, u32 mask, u32 val); |
| 60 | |
| 61 | #endif |