From e1f4d790e43e62f00edfe70602de0cf4da4b9e92 Mon Sep 17 00:00:00 2001 From: Lijian Zhao Date: Thu, 9 Nov 2017 15:52:16 -0800 Subject: soc/intel/common: Add error print in common i2c MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Print error message when using common i2c without default clock defined. TEST=Do not define default clock in Kconfig, compile will stop for assertion. Change-Id: I803f97698b3928e6b64df0010e71a6ded1400f87 Signed-off-by: Lijian Zhao Reviewed-on: https://review.coreboot.org/22405 Tested-by: build bot (Jenkins) Reviewed-by: Aaron Durbin Reviewed-by: Philippe Mathieu-Daudé --- src/soc/intel/common/block/i2c/lpss_i2c.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/soc/intel/common/block/i2c/lpss_i2c.c b/src/soc/intel/common/block/i2c/lpss_i2c.c index 7db3fe9668..34e04ecf1b 100644 --- a/src/soc/intel/common/block/i2c/lpss_i2c.c +++ b/src/soc/intel/common/block/i2c/lpss_i2c.c @@ -540,9 +540,8 @@ int lpss_i2c_gen_speed_config(struct lpss_i2c_regs *regs, uint16_t hcnt_min, lcnt_min; int i; - /* Clock must be provided by Kconfig */ - if (!ic_clk) - return -1; + _Static_assert(CONFIG_SOC_INTEL_COMMON_LPSS_CLOCK_MHZ != 0, + "SOC_INTEL_COMMON_LPSS_CLOCK_MHZ can't be zero!"); /* Apply board specific override for this speed if found */ for (i = 0; i < LPSS_I2C_SPEED_CONFIG_COUNT; i++) { -- cgit v1.2.3