nmhw21,26: init pmic based on hw type
This commit is contained in:
parent
a02c9b9da3
commit
7336361d5c
|
|
@ -150,6 +150,8 @@ static int hw_rev = -1;
|
|||
static int hw_patch = -1;
|
||||
static int hw_type = -1;
|
||||
static char hw_variant_name[64];
|
||||
#else
|
||||
static int hw_type = -1;
|
||||
#endif
|
||||
|
||||
#if !defined(CONFIG_SPL_BUILD)
|
||||
|
|
@ -444,10 +446,12 @@ static void init_pmic_spl(void)
|
|||
bus = da9063_claim_i2c_bus();
|
||||
|
||||
/* Fix old configs (mainly prototype boards) */
|
||||
if (hw_type == 21) {
|
||||
pmic_fix_config();
|
||||
|
||||
/* Disable automatic mode switching */
|
||||
pmic_disable_auto_mode();
|
||||
}
|
||||
|
||||
/* Enable +3V3_GNSS (LDO6) */
|
||||
(void)da9063_set_reg(PMIC_REG_LDO6_CONT, PMIC_LDOx_EN_MASK);
|
||||
|
|
@ -459,8 +463,14 @@ static void init_pmic_spl(void)
|
|||
|
||||
pmic_ignition_gate_on();
|
||||
|
||||
/* Trim RTC to compensate +18ppm crystal deviation */
|
||||
if (hw_type == 21) {
|
||||
/* hw21: trim RTC to compensate +18ppm crystal deviation */
|
||||
(void)da9063_set_reg(PMIC_REG_TRIM_CLDR, (-18*10)/19);
|
||||
}
|
||||
else {
|
||||
/* hw26 does not need trimming */
|
||||
(void)da9063_set_reg(PMIC_REG_TRIM_CLDR, 0);
|
||||
}
|
||||
|
||||
da9063_release_i2c_bus(bus);
|
||||
}
|
||||
|
|
@ -520,6 +530,18 @@ void check_pmic_reset_reason(unsigned int reset_reason_shm_location)
|
|||
|
||||
#endif
|
||||
|
||||
static void init_bd_spl(void)
|
||||
{
|
||||
hw_type = 21; /* Assume hw21, unless BD tells different */
|
||||
|
||||
if (read_eeprom() >= 0) {
|
||||
bd_get_hw_type(&hw_type);
|
||||
}
|
||||
else {
|
||||
puts("Could not get board ID.\n");
|
||||
}
|
||||
}
|
||||
|
||||
void am33xx_spl_board_init(void)
|
||||
{
|
||||
/* Set CPU speed to 600 MHz (fix) */
|
||||
|
|
@ -531,6 +553,9 @@ void am33xx_spl_board_init(void)
|
|||
/* Configure both I2C buses used */
|
||||
init_i2c();
|
||||
|
||||
/* Get board descriptor */
|
||||
init_bd_spl();
|
||||
|
||||
/* Setup PMIC */
|
||||
init_pmic_spl();
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue