diff options
author | Jianjun Wang <jianjun.wang@mediatek.com> | 2022-03-30 09:09:43 +0800 |
---|---|---|
committer | Hung-Te Lin <hungte@chromium.org> | 2022-03-31 01:50:42 +0000 |
commit | 79b35ca4812ab839ff12bfd7036ea90ea8f24f59 (patch) | |
tree | db136ccdab32811c9d85061df51cffb09b33901b /src | |
parent | e1e30b150474f62717792f9f7ccc5785461a04d0 (diff) |
soc/mediatek/early_init: Fix function return type
Fix return type of early_init_get_elapsed_time_us() to comply with the
data type of return value.
Also replace memset() with struct initializer.
Signed-off-by: Jianjun Wang <jianjun.wang@mediatek.com>
Fixes: commit 41faa22 (soc/mediatek: Add early_init for passing data
across stages)
Change-Id: I7c361828362c2dfec91358ad8a420f5360243da0
Reviewed-on: https://review.coreboot.org/c/coreboot/+/63190
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Yu-Ping Wu <yupingso@google.com>
Reviewed-by: Felix Held <felix-coreboot@felixheld.de>
Diffstat (limited to 'src')
-rw-r--r-- | src/soc/mediatek/common/early_init.c | 6 | ||||
-rw-r--r-- | src/soc/mediatek/common/include/soc/early_init.h | 2 | ||||
-rw-r--r-- | src/soc/mediatek/common/pcie.c | 8 |
3 files changed, 7 insertions, 9 deletions
diff --git a/src/soc/mediatek/common/early_init.c b/src/soc/mediatek/common/early_init.c index 329663c8c3..55ba447ce0 100644 --- a/src/soc/mediatek/common/early_init.c +++ b/src/soc/mediatek/common/early_init.c @@ -31,16 +31,14 @@ void early_init_save_time(enum early_init_type init_type) timer_monotonic_get(&data->init_time[init_type]); } -uint64_t early_init_get_elapsed_time_us(enum early_init_type init_type) +long early_init_get_elapsed_time_us(enum early_init_type init_type) { struct early_init_data *data = find_early_init(); - struct mono_time cur_time; + struct mono_time cur_time = {0}; if (!data) return 0; - memset(&cur_time, 0, sizeof(cur_time)); - /* If early init data was never saved */ if (!memcmp(&data->init_time[init_type], &cur_time, sizeof(cur_time))) return 0; diff --git a/src/soc/mediatek/common/include/soc/early_init.h b/src/soc/mediatek/common/include/soc/early_init.h index 2811b0d69a..533dffd023 100644 --- a/src/soc/mediatek/common/include/soc/early_init.h +++ b/src/soc/mediatek/common/include/soc/early_init.h @@ -21,6 +21,6 @@ struct early_init_data { void early_init_clear(void); void early_init_save_time(enum early_init_type init_type); -uint64_t early_init_get_elapsed_time_us(enum early_init_type init_type); +long early_init_get_elapsed_time_us(enum early_init_type init_type); #endif /* SOC_MEDIATEK_EARLY_INIT_H */ diff --git a/src/soc/mediatek/common/pcie.c b/src/soc/mediatek/common/pcie.c index 3a75f6bbbc..bcae4b5dd6 100644 --- a/src/soc/mediatek/common/pcie.c +++ b/src/soc/mediatek/common/pcie.c @@ -215,7 +215,7 @@ void mtk_pcie_domain_enable(struct device *dev) const mtk_soc_config_t *config = config_of(dev); const struct mtk_pcie_config *conf = &config->pcie_config; const char *ltssm_state; - uint64_t perst_time_us; + long perst_time_us; size_t tries = 0; uint32_t val; @@ -236,7 +236,7 @@ void mtk_pcie_domain_enable(struct device *dev) write32p(conf->base + PCIE_INT_ENABLE_REG, val); perst_time_us = early_init_get_elapsed_time_us(EARLY_INIT_PCIE); - printk(BIOS_DEBUG, "%s: %lld us elapsed since assert PERST#\n", + printk(BIOS_DEBUG, "%s: %ld us elapsed since assert PERST#\n", __func__, perst_time_us); /* @@ -245,7 +245,7 @@ void mtk_pcie_domain_enable(struct device *dev) * The deassertion of PERST# should be delayed 100ms (TPVPERL) * for the power and clock to become stable. */ - const uint64_t min_perst_time_us = 100000; /* 100 ms */ + const long min_perst_time_us = 100000; /* 100 ms */ if (perst_time_us < min_perst_time_us) { if (!perst_time_us) { printk(BIOS_WARNING, @@ -254,7 +254,7 @@ void mtk_pcie_domain_enable(struct device *dev) mtk_pcie_reset(conf->base + PCIE_RST_CTRL_REG, true); } else { printk(BIOS_WARNING, - "%s: Need an extra %lld us delay to meet PERST# deassertion requirement\n", + "%s: Need an extra %ld us delay to meet PERST# deassertion requirement\n", __func__, min_perst_time_us - perst_time_us); } |