|
|
|
@ -32,8 +32,8 @@ |
|
|
|
|
|
|
|
|
|
void mx28_power_clock2xtal(void) |
|
|
|
|
{ |
|
|
|
|
struct mx28_clkctrl_regs *clkctrl_regs = |
|
|
|
|
(struct mx28_clkctrl_regs *)MXS_CLKCTRL_BASE; |
|
|
|
|
struct mxs_clkctrl_regs *clkctrl_regs = |
|
|
|
|
(struct mxs_clkctrl_regs *)MXS_CLKCTRL_BASE; |
|
|
|
|
|
|
|
|
|
/* Set XTAL as CPU reference clock */ |
|
|
|
|
writel(CLKCTRL_CLKSEQ_BYPASS_CPU, |
|
|
|
@ -42,8 +42,8 @@ void mx28_power_clock2xtal(void) |
|
|
|
|
|
|
|
|
|
void mx28_power_clock2pll(void) |
|
|
|
|
{ |
|
|
|
|
struct mx28_clkctrl_regs *clkctrl_regs = |
|
|
|
|
(struct mx28_clkctrl_regs *)MXS_CLKCTRL_BASE; |
|
|
|
|
struct mxs_clkctrl_regs *clkctrl_regs = |
|
|
|
|
(struct mxs_clkctrl_regs *)MXS_CLKCTRL_BASE; |
|
|
|
|
|
|
|
|
|
setbits_le32(&clkctrl_regs->hw_clkctrl_pll0ctrl0, |
|
|
|
|
CLKCTRL_PLL0CTRL0_POWER); |
|
|
|
@ -54,8 +54,8 @@ void mx28_power_clock2pll(void) |
|
|
|
|
|
|
|
|
|
void mx28_power_clear_auto_restart(void) |
|
|
|
|
{ |
|
|
|
|
struct mx28_rtc_regs *rtc_regs = |
|
|
|
|
(struct mx28_rtc_regs *)MXS_RTC_BASE; |
|
|
|
|
struct mxs_rtc_regs *rtc_regs = |
|
|
|
|
(struct mxs_rtc_regs *)MXS_RTC_BASE; |
|
|
|
|
|
|
|
|
|
writel(RTC_CTRL_SFTRST, &rtc_regs->hw_rtc_ctrl_clr); |
|
|
|
|
while (readl(&rtc_regs->hw_rtc_ctrl) & RTC_CTRL_SFTRST) |
|
|
|
@ -87,8 +87,8 @@ void mx28_power_clear_auto_restart(void) |
|
|
|
|
|
|
|
|
|
void mx28_power_set_linreg(void) |
|
|
|
|
{ |
|
|
|
|
struct mx28_power_regs *power_regs = |
|
|
|
|
(struct mx28_power_regs *)MXS_POWER_BASE; |
|
|
|
|
struct mxs_power_regs *power_regs = |
|
|
|
|
(struct mxs_power_regs *)MXS_POWER_BASE; |
|
|
|
|
|
|
|
|
|
/* Set linear regulator 25mV below switching converter */ |
|
|
|
|
clrsetbits_le32(&power_regs->hw_power_vdddctrl, |
|
|
|
@ -106,8 +106,8 @@ void mx28_power_set_linreg(void) |
|
|
|
|
|
|
|
|
|
int mx28_get_batt_volt(void) |
|
|
|
|
{ |
|
|
|
|
struct mx28_power_regs *power_regs = |
|
|
|
|
(struct mx28_power_regs *)MXS_POWER_BASE; |
|
|
|
|
struct mxs_power_regs *power_regs = |
|
|
|
|
(struct mxs_power_regs *)MXS_POWER_BASE; |
|
|
|
|
uint32_t volt = readl(&power_regs->hw_power_battmonitor); |
|
|
|
|
volt &= POWER_BATTMONITOR_BATT_VAL_MASK; |
|
|
|
|
volt >>= POWER_BATTMONITOR_BATT_VAL_OFFSET; |
|
|
|
@ -122,8 +122,8 @@ int mx28_is_batt_ready(void) |
|
|
|
|
|
|
|
|
|
int mx28_is_batt_good(void) |
|
|
|
|
{ |
|
|
|
|
struct mx28_power_regs *power_regs = |
|
|
|
|
(struct mx28_power_regs *)MXS_POWER_BASE; |
|
|
|
|
struct mxs_power_regs *power_regs = |
|
|
|
|
(struct mxs_power_regs *)MXS_POWER_BASE; |
|
|
|
|
uint32_t volt = mx28_get_batt_volt(); |
|
|
|
|
|
|
|
|
|
if ((volt >= 2400) && (volt <= 4300)) |
|
|
|
@ -162,8 +162,8 @@ int mx28_is_batt_good(void) |
|
|
|
|
|
|
|
|
|
void mx28_power_setup_5v_detect(void) |
|
|
|
|
{ |
|
|
|
|
struct mx28_power_regs *power_regs = |
|
|
|
|
(struct mx28_power_regs *)MXS_POWER_BASE; |
|
|
|
|
struct mxs_power_regs *power_regs = |
|
|
|
|
(struct mxs_power_regs *)MXS_POWER_BASE; |
|
|
|
|
|
|
|
|
|
/* Start 5V detection */ |
|
|
|
|
clrsetbits_le32(&power_regs->hw_power_5vctrl, |
|
|
|
@ -174,8 +174,8 @@ void mx28_power_setup_5v_detect(void) |
|
|
|
|
|
|
|
|
|
void mx28_src_power_init(void) |
|
|
|
|
{ |
|
|
|
|
struct mx28_power_regs *power_regs = |
|
|
|
|
(struct mx28_power_regs *)MXS_POWER_BASE; |
|
|
|
|
struct mxs_power_regs *power_regs = |
|
|
|
|
(struct mxs_power_regs *)MXS_POWER_BASE; |
|
|
|
|
|
|
|
|
|
/* Improve efficieny and reduce transient ripple */ |
|
|
|
|
writel(POWER_LOOPCTRL_TOGGLE_DIF | POWER_LOOPCTRL_EN_CM_HYST | |
|
|
|
@ -205,8 +205,8 @@ void mx28_src_power_init(void) |
|
|
|
|
|
|
|
|
|
void mx28_power_init_4p2_params(void) |
|
|
|
|
{ |
|
|
|
|
struct mx28_power_regs *power_regs = |
|
|
|
|
(struct mx28_power_regs *)MXS_POWER_BASE; |
|
|
|
|
struct mxs_power_regs *power_regs = |
|
|
|
|
(struct mxs_power_regs *)MXS_POWER_BASE; |
|
|
|
|
|
|
|
|
|
/* Setup 4P2 parameters */ |
|
|
|
|
clrsetbits_le32(&power_regs->hw_power_dcdc4p2, |
|
|
|
@ -229,8 +229,8 @@ void mx28_power_init_4p2_params(void) |
|
|
|
|
|
|
|
|
|
void mx28_enable_4p2_dcdc_input(int xfer) |
|
|
|
|
{ |
|
|
|
|
struct mx28_power_regs *power_regs = |
|
|
|
|
(struct mx28_power_regs *)MXS_POWER_BASE; |
|
|
|
|
struct mxs_power_regs *power_regs = |
|
|
|
|
(struct mxs_power_regs *)MXS_POWER_BASE; |
|
|
|
|
uint32_t tmp, vbus_thresh, vbus_5vdetect, pwd_bo; |
|
|
|
|
uint32_t prev_5v_brnout, prev_5v_droop; |
|
|
|
|
|
|
|
|
@ -325,8 +325,8 @@ void mx28_enable_4p2_dcdc_input(int xfer) |
|
|
|
|
|
|
|
|
|
void mx28_power_init_4p2_regulator(void) |
|
|
|
|
{ |
|
|
|
|
struct mx28_power_regs *power_regs = |
|
|
|
|
(struct mx28_power_regs *)MXS_POWER_BASE; |
|
|
|
|
struct mxs_power_regs *power_regs = |
|
|
|
|
(struct mxs_power_regs *)MXS_POWER_BASE; |
|
|
|
|
uint32_t tmp, tmp2; |
|
|
|
|
|
|
|
|
|
setbits_le32(&power_regs->hw_power_dcdc4p2, POWER_DCDC4P2_ENABLE_4P2); |
|
|
|
@ -409,8 +409,8 @@ void mx28_power_init_4p2_regulator(void) |
|
|
|
|
|
|
|
|
|
void mx28_power_init_dcdc_4p2_source(void) |
|
|
|
|
{ |
|
|
|
|
struct mx28_power_regs *power_regs = |
|
|
|
|
(struct mx28_power_regs *)MXS_POWER_BASE; |
|
|
|
|
struct mxs_power_regs *power_regs = |
|
|
|
|
(struct mxs_power_regs *)MXS_POWER_BASE; |
|
|
|
|
|
|
|
|
|
if (!(readl(&power_regs->hw_power_dcdc4p2) & |
|
|
|
|
POWER_DCDC4P2_ENABLE_DCDC)) { |
|
|
|
@ -431,8 +431,8 @@ void mx28_power_init_dcdc_4p2_source(void) |
|
|
|
|
|
|
|
|
|
void mx28_power_enable_4p2(void) |
|
|
|
|
{ |
|
|
|
|
struct mx28_power_regs *power_regs = |
|
|
|
|
(struct mx28_power_regs *)MXS_POWER_BASE; |
|
|
|
|
struct mxs_power_regs *power_regs = |
|
|
|
|
(struct mxs_power_regs *)MXS_POWER_BASE; |
|
|
|
|
uint32_t vdddctrl, vddactrl, vddioctrl; |
|
|
|
|
uint32_t tmp; |
|
|
|
|
|
|
|
|
@ -490,8 +490,8 @@ void mx28_power_enable_4p2(void) |
|
|
|
|
|
|
|
|
|
void mx28_boot_valid_5v(void) |
|
|
|
|
{ |
|
|
|
|
struct mx28_power_regs *power_regs = |
|
|
|
|
(struct mx28_power_regs *)MXS_POWER_BASE; |
|
|
|
|
struct mxs_power_regs *power_regs = |
|
|
|
|
(struct mxs_power_regs *)MXS_POWER_BASE; |
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Use VBUSVALID level instead of VDD5V_GT_VDDIO level to trigger a 5V |
|
|
|
@ -513,8 +513,8 @@ void mx28_boot_valid_5v(void) |
|
|
|
|
|
|
|
|
|
void mx28_powerdown(void) |
|
|
|
|
{ |
|
|
|
|
struct mx28_power_regs *power_regs = |
|
|
|
|
(struct mx28_power_regs *)MXS_POWER_BASE; |
|
|
|
|
struct mxs_power_regs *power_regs = |
|
|
|
|
(struct mxs_power_regs *)MXS_POWER_BASE; |
|
|
|
|
writel(POWER_RESET_UNLOCK_KEY, &power_regs->hw_power_reset); |
|
|
|
|
writel(POWER_RESET_UNLOCK_KEY | POWER_RESET_PWD_OFF, |
|
|
|
|
&power_regs->hw_power_reset); |
|
|
|
@ -522,8 +522,8 @@ void mx28_powerdown(void) |
|
|
|
|
|
|
|
|
|
void mx28_batt_boot(void) |
|
|
|
|
{ |
|
|
|
|
struct mx28_power_regs *power_regs = |
|
|
|
|
(struct mx28_power_regs *)MXS_POWER_BASE; |
|
|
|
|
struct mxs_power_regs *power_regs = |
|
|
|
|
(struct mxs_power_regs *)MXS_POWER_BASE; |
|
|
|
|
|
|
|
|
|
clrbits_le32(&power_regs->hw_power_5vctrl, POWER_5VCTRL_PWDN_5VBRNOUT); |
|
|
|
|
clrbits_le32(&power_regs->hw_power_5vctrl, POWER_5VCTRL_ENABLE_DCDC); |
|
|
|
@ -566,8 +566,8 @@ void mx28_batt_boot(void) |
|
|
|
|
|
|
|
|
|
void mx28_handle_5v_conflict(void) |
|
|
|
|
{ |
|
|
|
|
struct mx28_power_regs *power_regs = |
|
|
|
|
(struct mx28_power_regs *)MXS_POWER_BASE; |
|
|
|
|
struct mxs_power_regs *power_regs = |
|
|
|
|
(struct mxs_power_regs *)MXS_POWER_BASE; |
|
|
|
|
uint32_t tmp; |
|
|
|
|
|
|
|
|
|
setbits_le32(&power_regs->hw_power_vddioctrl, |
|
|
|
@ -598,8 +598,8 @@ void mx28_handle_5v_conflict(void) |
|
|
|
|
|
|
|
|
|
void mx28_5v_boot(void) |
|
|
|
|
{ |
|
|
|
|
struct mx28_power_regs *power_regs = |
|
|
|
|
(struct mx28_power_regs *)MXS_POWER_BASE; |
|
|
|
|
struct mxs_power_regs *power_regs = |
|
|
|
|
(struct mxs_power_regs *)MXS_POWER_BASE; |
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* NOTE: In original IMX-Bootlets, this also checks for VBUSVALID, |
|
|
|
@ -621,8 +621,8 @@ void mx28_5v_boot(void) |
|
|
|
|
|
|
|
|
|
void mx28_init_batt_bo(void) |
|
|
|
|
{ |
|
|
|
|
struct mx28_power_regs *power_regs = |
|
|
|
|
(struct mx28_power_regs *)MXS_POWER_BASE; |
|
|
|
|
struct mxs_power_regs *power_regs = |
|
|
|
|
(struct mxs_power_regs *)MXS_POWER_BASE; |
|
|
|
|
|
|
|
|
|
/* Brownout at 3V */ |
|
|
|
|
clrsetbits_le32(&power_regs->hw_power_battmonitor, |
|
|
|
@ -635,8 +635,8 @@ void mx28_init_batt_bo(void) |
|
|
|
|
|
|
|
|
|
void mx28_switch_vddd_to_dcdc_source(void) |
|
|
|
|
{ |
|
|
|
|
struct mx28_power_regs *power_regs = |
|
|
|
|
(struct mx28_power_regs *)MXS_POWER_BASE; |
|
|
|
|
struct mxs_power_regs *power_regs = |
|
|
|
|
(struct mxs_power_regs *)MXS_POWER_BASE; |
|
|
|
|
|
|
|
|
|
clrsetbits_le32(&power_regs->hw_power_vdddctrl, |
|
|
|
|
POWER_VDDDCTRL_LINREG_OFFSET_MASK, |
|
|
|
@ -650,10 +650,10 @@ void mx28_switch_vddd_to_dcdc_source(void) |
|
|
|
|
void mx28_power_configure_power_source(void) |
|
|
|
|
{ |
|
|
|
|
int batt_ready, batt_good; |
|
|
|
|
struct mx28_power_regs *power_regs = |
|
|
|
|
(struct mx28_power_regs *)MXS_POWER_BASE; |
|
|
|
|
struct mx28_lradc_regs *lradc_regs = |
|
|
|
|
(struct mx28_lradc_regs *)MXS_LRADC_BASE; |
|
|
|
|
struct mxs_power_regs *power_regs = |
|
|
|
|
(struct mxs_power_regs *)MXS_POWER_BASE; |
|
|
|
|
struct mxs_lradc_regs *lradc_regs = |
|
|
|
|
(struct mxs_lradc_regs *)MXS_LRADC_BASE; |
|
|
|
|
|
|
|
|
|
mx28_src_power_init(); |
|
|
|
|
|
|
|
|
@ -690,8 +690,8 @@ void mx28_power_configure_power_source(void) |
|
|
|
|
|
|
|
|
|
void mx28_enable_output_rail_protection(void) |
|
|
|
|
{ |
|
|
|
|
struct mx28_power_regs *power_regs = |
|
|
|
|
(struct mx28_power_regs *)MXS_POWER_BASE; |
|
|
|
|
struct mxs_power_regs *power_regs = |
|
|
|
|
(struct mxs_power_regs *)MXS_POWER_BASE; |
|
|
|
|
|
|
|
|
|
writel(POWER_CTRL_VDDD_BO_IRQ | POWER_CTRL_VDDA_BO_IRQ | |
|
|
|
|
POWER_CTRL_VDDIO_BO_IRQ, &power_regs->hw_power_ctrl_clr); |
|
|
|
@ -708,8 +708,8 @@ void mx28_enable_output_rail_protection(void) |
|
|
|
|
|
|
|
|
|
int mx28_get_vddio_power_source_off(void) |
|
|
|
|
{ |
|
|
|
|
struct mx28_power_regs *power_regs = |
|
|
|
|
(struct mx28_power_regs *)MXS_POWER_BASE; |
|
|
|
|
struct mxs_power_regs *power_regs = |
|
|
|
|
(struct mxs_power_regs *)MXS_POWER_BASE; |
|
|
|
|
uint32_t tmp; |
|
|
|
|
|
|
|
|
|
if (readl(&power_regs->hw_power_sts) & POWER_STS_VDD5V_GT_VDDIO) { |
|
|
|
@ -736,8 +736,8 @@ int mx28_get_vddio_power_source_off(void) |
|
|
|
|
|
|
|
|
|
int mx28_get_vddd_power_source_off(void) |
|
|
|
|
{ |
|
|
|
|
struct mx28_power_regs *power_regs = |
|
|
|
|
(struct mx28_power_regs *)MXS_POWER_BASE; |
|
|
|
|
struct mxs_power_regs *power_regs = |
|
|
|
|
(struct mxs_power_regs *)MXS_POWER_BASE; |
|
|
|
|
uint32_t tmp; |
|
|
|
|
|
|
|
|
|
tmp = readl(&power_regs->hw_power_vdddctrl); |
|
|
|
@ -767,8 +767,8 @@ int mx28_get_vddd_power_source_off(void) |
|
|
|
|
|
|
|
|
|
void mx28_power_set_vddio(uint32_t new_target, uint32_t new_brownout) |
|
|
|
|
{ |
|
|
|
|
struct mx28_power_regs *power_regs = |
|
|
|
|
(struct mx28_power_regs *)MXS_POWER_BASE; |
|
|
|
|
struct mxs_power_regs *power_regs = |
|
|
|
|
(struct mxs_power_regs *)MXS_POWER_BASE; |
|
|
|
|
uint32_t cur_target, diff, bo_int = 0; |
|
|
|
|
uint32_t powered_by_linreg = 0; |
|
|
|
|
|
|
|
|
@ -864,8 +864,8 @@ void mx28_power_set_vddio(uint32_t new_target, uint32_t new_brownout) |
|
|
|
|
|
|
|
|
|
void mx28_power_set_vddd(uint32_t new_target, uint32_t new_brownout) |
|
|
|
|
{ |
|
|
|
|
struct mx28_power_regs *power_regs = |
|
|
|
|
(struct mx28_power_regs *)MXS_POWER_BASE; |
|
|
|
|
struct mxs_power_regs *power_regs = |
|
|
|
|
(struct mxs_power_regs *)MXS_POWER_BASE; |
|
|
|
|
uint32_t cur_target, diff, bo_int = 0; |
|
|
|
|
uint32_t powered_by_linreg = 0; |
|
|
|
|
|
|
|
|
@ -968,8 +968,8 @@ void mx28_setup_batt_detect(void) |
|
|
|
|
|
|
|
|
|
void mx28_power_init(void) |
|
|
|
|
{ |
|
|
|
|
struct mx28_power_regs *power_regs = |
|
|
|
|
(struct mx28_power_regs *)MXS_POWER_BASE; |
|
|
|
|
struct mxs_power_regs *power_regs = |
|
|
|
|
(struct mxs_power_regs *)MXS_POWER_BASE; |
|
|
|
|
|
|
|
|
|
mx28_power_clock2xtal(); |
|
|
|
|
mx28_power_clear_auto_restart(); |
|
|
|
@ -998,8 +998,8 @@ void mx28_power_init(void) |
|
|
|
|
#ifdef CONFIG_SPL_MX28_PSWITCH_WAIT |
|
|
|
|
void mx28_power_wait_pswitch(void) |
|
|
|
|
{ |
|
|
|
|
struct mx28_power_regs *power_regs = |
|
|
|
|
(struct mx28_power_regs *)MXS_POWER_BASE; |
|
|
|
|
struct mxs_power_regs *power_regs = |
|
|
|
|
(struct mxs_power_regs *)MXS_POWER_BASE; |
|
|
|
|
|
|
|
|
|
while (!(readl(&power_regs->hw_power_sts) & POWER_STS_PSWITCH_MASK)) |
|
|
|
|
; |
|
|
|
|