1 /* SPDX-License-Identifier: GPL-2.0-only */
4 #include <device/mmio.h>
8 SRAM_ISOINT_B
= 1U << 6,
10 PWR_CLK_DIS
= 1U << 4,
17 __weak
void mtcmos_set_scpd_ext_buck_iso(const struct power_domain_data
*pd
)
22 void mtcmos_power_on(const struct power_domain_data
*pd
)
24 write32(&mtk_spm
->poweron_config_set
,
25 (SPM_PROJECT_CODE
<< 16) | (1U << 0));
27 if (pd
->caps
& SCPD_EXT_BUCK_ISO
)
28 mtcmos_set_scpd_ext_buck_iso(pd
);
30 setbits32(pd
->pwr_con
, PWR_ON
);
31 setbits32(pd
->pwr_con
, PWR_ON_2ND
);
33 while (!(read32(&mtk_spm
->pwr_status
) & pd
->pwr_sta_mask
) ||
34 !(read32(&mtk_spm
->pwr_status_2nd
) & pd
->pwr_sta_mask
))
37 clrbits32(pd
->pwr_con
, PWR_CLK_DIS
);
38 clrbits32(pd
->pwr_con
, PWR_ISO
);
39 setbits32(pd
->pwr_con
, PWR_RST_B
);
40 clrbits32(pd
->pwr_con
, pd
->sram_pdn_mask
);
42 while (read32(pd
->pwr_con
) & pd
->sram_ack_mask
)
45 if (pd
->caps
& SCPD_SRAM_ISO
) {
46 setbits32(pd
->pwr_con
, SRAM_ISOINT_B
);
48 clrbits32(pd
->pwr_con
, SRAM_CKISO
);
52 void mtcmos_display_power_on(void)
56 for (i
= 0; i
< ARRAY_SIZE(disp
); i
++)
57 mtcmos_power_on(&disp
[i
]);
60 void mtcmos_audio_power_on(void)
64 for (i
= 0; i
< ARRAY_SIZE(audio
); i
++)
65 mtcmos_power_on(&audio
[i
]);