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>
This commit is contained in:
parent
e1e30b1504
commit
79b35ca481
|
@ -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;
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue