blob: 3d04778b242ad00605160d6603c7345df0b6653d [file] [log] [blame]
Felix Held43a5f882020-12-01 21:17:17 +01001/* 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
8void 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}