pit: save setup_power() status and die later if needed
Since system clock and console initialization now happen after power setup, we cannot print error messages in setup_power(). This patch re-factors the code a little bit to save the status of setup_power() so that if we get an error during setup_power() we will wait until we can actually print something before dying. BUG=none BRANCH=none TEST=build and booted on pit Change-Id: Id7ff477224b104b3c7e221c1d2df460ca9125f3b Reviewed-on: https://gerrit.chromium.org/gerrit/65009 Reviewed-by: Gabe Black <gabeblack@chromium.org> Commit-Queue: David Hendricks <dhendrix@chromium.org> Tested-by: David Hendricks <dhendrix@chromium.org>
This commit is contained in:
parent
56144ddf1f
commit
0c89f922b2
1 changed files with 8 additions and 7 deletions
|
|
@ -78,7 +78,7 @@ struct pmic_write pmic_writes[] =
|
|||
{ 0, MAX77802_REG_PMIC_BOOSTCTRL, MAX77802_BOOSTCTRL_OFF},
|
||||
};
|
||||
|
||||
static void setup_power(int is_resume)
|
||||
static int setup_power(int is_resume)
|
||||
{
|
||||
int error = 0;
|
||||
int i;
|
||||
|
|
@ -86,15 +86,13 @@ static void setup_power(int is_resume)
|
|||
power_init();
|
||||
|
||||
if (is_resume) {
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Initialize I2C bus to configure PMIC. */
|
||||
exynos_pinmux_i2c4();
|
||||
i2c_init(PMIC_I2C_BUS, 1000000, 0x00); /* 1MHz */
|
||||
|
||||
printk(BIOS_DEBUG, "%s: Setting up PMIC...\n", __func__);
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(pmic_writes); i++) {
|
||||
uint8_t data = 0;
|
||||
uint8_t reg = pmic_writes[i].reg;
|
||||
|
|
@ -109,8 +107,7 @@ static void setup_power(int is_resume)
|
|||
&data, sizeof(data));
|
||||
}
|
||||
|
||||
if (error)
|
||||
die("Failed to intialize PMIC.\n");
|
||||
return error;
|
||||
}
|
||||
|
||||
static void setup_storage(void)
|
||||
|
|
@ -248,6 +245,7 @@ void main(void)
|
|||
extern struct mem_timings mem_timings;
|
||||
void *entry;
|
||||
int is_resume = (get_wakeup_state() != IS_NOT_WAKEUP);
|
||||
int power_init_failed;
|
||||
#if CONFIG_COLLECT_TIMESTAMPS
|
||||
uint64_t start_romstage_time;
|
||||
uint64_t before_dram_time;
|
||||
|
|
@ -257,7 +255,7 @@ void main(void)
|
|||
start_romstage_time = timestamp_get();
|
||||
#endif
|
||||
|
||||
setup_power(is_resume);
|
||||
power_init_failed = setup_power(is_resume);
|
||||
|
||||
/* Clock must be initialized before console_init, otherwise you may need
|
||||
* to re-initialize serial console drivers again. */
|
||||
|
|
@ -265,6 +263,9 @@ void main(void)
|
|||
|
||||
console_init();
|
||||
|
||||
if (power_init_failed)
|
||||
die("Failed to intialize power.\n");
|
||||
|
||||
/* re-initialize PMIC I2C channel after (re-)setting system clocks */
|
||||
i2c_init(PMIC_I2C_BUS, 1000000, 0x00); /* 1MHz */
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue