| 1 |
|
| 2 |
|
| 3 |
#ifndef HUDSON_SMBUS_H |
| 4 |
#define HUDSON_SMBUS_H |
| 5 |
|
| 6 |
#include <stdint.h> |
| 7 |
|
| 8 |
#define SMBHSTSTAT 0x0 |
| 9 |
#define SMBSLVSTAT 0x1 |
| 10 |
#define SMBHSTCTRL 0x2 |
| 11 |
#define SMBHSTCMD 0x3 |
| 12 |
#define SMBHSTADDR 0x4 |
| 13 |
#define SMBHSTDAT0 0x5 |
| 14 |
#define SMBHSTDAT1 0x6 |
| 15 |
#define SMBHSTBLKDAT 0x7 |
| 16 |
|
| 17 |
#define SMBSLVCTRL 0x8 |
| 18 |
#define SMBSLVCMD_SHADOW 0x9 |
| 19 |
#define SMBSLVEVT 0xa |
| 20 |
#define SMBSLVDAT 0xc |
| 21 |
|
| 22 |
#define AX_INDXC 0 |
| 23 |
#define AX_INDXP 2 |
| 24 |
#define AXCFG 4 |
| 25 |
#define ABCFG 6 |
| 26 |
#define RC_INDXC 1 |
| 27 |
#define RC_INDXP 3 |
| 28 |
|
| 29 |
#define AB_INDX 0xcd8 |
| 30 |
#define AB_DATA (AB_INDX + 4) |
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
#define SMBUS_TIMEOUT (100 * 1000 * 10) |
| 36 |
|
| 37 |
#define abcfg_reg(reg, mask, val) \ |
| 38 |
alink_ab_indx((ABCFG), (reg), (mask), (val)) |
| 39 |
#define axcfg_reg(reg, mask, val) \ |
| 40 |
alink_ab_indx((AXCFG), (reg), (mask), (val)) |
| 41 |
#define axindxc_reg(reg, mask, val) \ |
| 42 |
alink_ax_indx((AX_INDXC), (reg), (mask), (val)) |
| 43 |
#define axindxp_reg(reg, mask, val) \ |
| 44 |
alink_ax_indx((AX_INDXP), (reg), (mask), (val)) |
| 45 |
#define rcindxc_reg(reg, port, mask, val) \ |
| 46 |
alink_rc_indx((RC_INDXC), (reg), (port), (mask), (val)) |
| 47 |
#define rcindxp_reg(reg, port, mask, val) \ |
| 48 |
alink_rc_indx((RC_INDXP), (reg), (port), (mask), (val)) |
| 49 |
|
| 50 |
int do_smbus_read_byte(u32 smbus_io_base, u32 device, u32 address); |
| 51 |
int do_smbus_write_byte(u32 smbus_io_base, u32 device, u32 address, u8 val); |
| 52 |
int do_smbus_recv_byte(u32 smbus_io_base, u32 device); |
| 53 |
int do_smbus_send_byte(u32 smbus_io_base, u32 device, u8 val); |
| 54 |
void alink_rc_indx(u32 reg_space, u32 reg_addr, u32 port, u32 mask, u32 val); |
| 55 |
void alink_ab_indx(u32 reg_space, u32 reg_addr, u32 mask, u32 val); |
| 56 |
void alink_ax_indx(u32 space , u32 axindc, u32 mask, u32 val); |
| 57 |
|
| 58 |
#endif |