From 3bee7df954fd4285f8445c54de90b8a12fdbc9fd Mon Sep 17 00:00:00 2001 From: Aaron Durbin Date: Tue, 28 Jan 2020 10:58:13 -0700 Subject: soc/amd/picasso: use SMBus speed in compilation unit MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The fixed bus speed of 400 kHz doesn't need to reside in a header file. Just move the assumption into the code itself. Change-Id: I8bb68607070d0daeae2ad3bcd79f49d5c20048fd Signed-off-by: Aaron Durbin Reviewed-on: https://review.coreboot.org/c/coreboot/+/38613 Tested-by: build bot (Jenkins) Reviewed-by: Kyösti Mälkki Reviewed-by: Angel Pons --- src/soc/amd/picasso/include/soc/smbus.h | 2 -- src/soc/amd/picasso/southbridge.c | 5 ++++- 2 files changed, 4 insertions(+), 3 deletions(-) (limited to 'src/soc/amd') diff --git a/src/soc/amd/picasso/include/soc/smbus.h b/src/soc/amd/picasso/include/soc/smbus.h index c4bc28fdf2..60b8bfa055 100644 --- a/src/soc/amd/picasso/include/soc/smbus.h +++ b/src/soc/amd/picasso/include/soc/smbus.h @@ -19,8 +19,6 @@ #include #include -#define SMB_SPEED_400KHZ (66000000 / (400000 * 4)) - /* * Between 1-10 seconds, We should never timeout normally * Longer than this is just painful when a timeout condition occurs. diff --git a/src/soc/amd/picasso/southbridge.c b/src/soc/amd/picasso/southbridge.c index 0dff4bcae3..310d9a2962 100644 --- a/src/soc/amd/picasso/southbridge.c +++ b/src/soc/amd/picasso/southbridge.c @@ -253,8 +253,11 @@ void sb_read_mode(u32 mode) static void fch_smbus_init(void) { + /* 400 kHz smbus speed. */ + const uint8_t smbus_speed = (66000000 / (400000 * 4)); + pm_write8(SMB_ASF_IO_BASE, SMB_BASE_ADDR >> 8); - smbus_write8(SMBTIMING, SMB_SPEED_400KHZ); + smbus_write8(SMBTIMING, smbus_speed); /* Clear all SMBUS status bits */ smbus_write8(SMBHSTSTAT, SMBHST_STAT_CLEAR); smbus_write8(SMBSLVSTAT, SMBSLV_STAT_CLEAR); -- cgit v1.2.3