Felix Held | 43a5f88 | 2020-12-01 21:17:17 +0100 | [diff] [blame^] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
| 2 | |
| 3 | #include <stdint.h> |
| 4 | #include <amdblocks/acpimmio.h> |
| 5 | #include <amdblocks/smbus.h> |
| 6 | #include <soc/southbridge.h> |
| 7 | |
| 8 | void fch_smbus_init(void) |
| 9 | { |
| 10 | /* 400 kHz smbus speed. */ |
| 11 | const uint8_t smbus_speed = (66000000 / (400000 * 4)); |
| 12 | |
| 13 | pm_write8(SMB_ASF_IO_BASE, SMB_BASE_ADDR >> 8); |
| 14 | smbus_write8(SMBTIMING, smbus_speed); |
| 15 | /* Clear all SMBUS status bits */ |
| 16 | smbus_write8(SMBHSTSTAT, SMBHST_STAT_CLEAR); |
| 17 | smbus_write8(SMBSLVSTAT, SMBSLV_STAT_CLEAR); |
| 18 | asf_write8(SMBHSTSTAT, SMBHST_STAT_CLEAR); |
| 19 | asf_write8(SMBSLVSTAT, SMBSLV_STAT_CLEAR); |
| 20 | } |