soc/mediatek: Move the power domain data under each SoC
In follow-up patches, we need to set multiple power domains to power on the display and audio on MT8195. Move the power domain data under each SoC and make power_on() API to support multiple settings. Signed-off-by: Weiyi Lu <weiyi.lu@mediatek.com> Change-Id: I8c3d19f1e9a4e516d674d68989ad509f37e5b593 Reviewed-on: https://review.coreboot.org/c/coreboot/+/52881 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Yu-Ping Wu <yupingso@google.com>
This commit is contained in:
parent
46e1b84fad
commit
7fd932744e
|
@ -3,6 +3,13 @@
|
|||
#ifndef __SOC_MEDIATEK_COMMON_MTCMOS_H__
|
||||
#define __SOC_MEDIATEK_COMMON_MTCMOS_H__
|
||||
|
||||
struct power_domain_data {
|
||||
void *pwr_con;
|
||||
u32 pwr_sta_mask;
|
||||
u32 sram_pdn_mask;
|
||||
u32 sram_ack_mask;
|
||||
};
|
||||
|
||||
void mtcmos_audio_power_on(void);
|
||||
void mtcmos_display_power_on(void);
|
||||
|
||||
|
|
|
@ -1,16 +1,9 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
|
||||
#include <delay.h>
|
||||
#include <device/mmio.h>
|
||||
#include <soc/mtcmos.h>
|
||||
#include <soc/spm.h>
|
||||
|
||||
struct power_domain_data {
|
||||
void *pwr_con;
|
||||
u32 pwr_sta_mask;
|
||||
u32 sram_pdn_mask;
|
||||
u32 sram_ack_mask;
|
||||
};
|
||||
|
||||
enum {
|
||||
SRAM_ISOINT_B = 1U << 6,
|
||||
SRAM_CKISO = 1U << 5,
|
||||
|
@ -44,24 +37,16 @@ static void mtcmos_power_on(const struct power_domain_data *pd)
|
|||
|
||||
void mtcmos_display_power_on(void)
|
||||
{
|
||||
static const struct power_domain_data disp = {
|
||||
.pwr_con = &mtk_spm->dis_pwr_con,
|
||||
.pwr_sta_mask = DISP_PWR_STA_MASK,
|
||||
.sram_pdn_mask = DISP_SRAM_PDN_MASK,
|
||||
.sram_ack_mask = DISP_SRAM_ACK_MASK,
|
||||
};
|
||||
int i;
|
||||
|
||||
mtcmos_power_on(&disp);
|
||||
for (i = 0; i < ARRAY_SIZE(disp); i++)
|
||||
mtcmos_power_on(&disp[i]);
|
||||
}
|
||||
|
||||
void mtcmos_audio_power_on(void)
|
||||
{
|
||||
static const struct power_domain_data audio = {
|
||||
.pwr_con = &mtk_spm->audio_pwr_con,
|
||||
.pwr_sta_mask = AUDIO_PWR_STA_MASK,
|
||||
.sram_pdn_mask = AUDIO_SRAM_PDN_MASK,
|
||||
.sram_ack_mask = AUDIO_SRAM_ACK_MASK,
|
||||
};
|
||||
int i;
|
||||
|
||||
mtcmos_power_on(&audio);
|
||||
for (i = 0; i < ARRAY_SIZE(audio); i++)
|
||||
mtcmos_power_on(&audio[i]);
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
#define __SOC_MEDIATEK_MT8173_SPM_H__
|
||||
|
||||
#include <soc/addressmap.h>
|
||||
#include <soc/mtcmos.h>
|
||||
#include <stddef.h>
|
||||
|
||||
enum {
|
||||
|
@ -152,4 +153,22 @@ check_member(mtk_spm_regs, sleep_ca15_wfi_en[3], 0xf1c);
|
|||
|
||||
static struct mtk_spm_regs *const mtk_spm = (void *)SPM_BASE;
|
||||
|
||||
static const struct power_domain_data disp[] = {
|
||||
{
|
||||
.pwr_con = &mtk_spm->dis_pwr_con,
|
||||
.pwr_sta_mask = DISP_PWR_STA_MASK,
|
||||
.sram_pdn_mask = DISP_SRAM_PDN_MASK,
|
||||
.sram_ack_mask = DISP_SRAM_ACK_MASK,
|
||||
},
|
||||
};
|
||||
|
||||
static const struct power_domain_data audio[] = {
|
||||
{
|
||||
.pwr_con = &mtk_spm->audio_pwr_con,
|
||||
.pwr_sta_mask = AUDIO_PWR_STA_MASK,
|
||||
.sram_pdn_mask = AUDIO_SRAM_PDN_MASK,
|
||||
.sram_ack_mask = AUDIO_SRAM_ACK_MASK,
|
||||
},
|
||||
};
|
||||
|
||||
#endif /* __SOC_MEDIATEK_MT8173_SPM_H__ */
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
#define SOC_MEDIATEK_MT8183_SPM_H
|
||||
|
||||
#include <soc/addressmap.h>
|
||||
#include <soc/mtcmos.h>
|
||||
#include <types.h>
|
||||
|
||||
/* SPM READ/WRITE CFG */
|
||||
|
@ -580,4 +581,22 @@ struct dyna_load_pcm {
|
|||
|
||||
int spm_init(void);
|
||||
|
||||
static const struct power_domain_data disp[] = {
|
||||
{
|
||||
.pwr_con = &mtk_spm->dis_pwr_con,
|
||||
.pwr_sta_mask = DISP_PWR_STA_MASK,
|
||||
.sram_pdn_mask = DISP_SRAM_PDN_MASK,
|
||||
.sram_ack_mask = DISP_SRAM_ACK_MASK,
|
||||
},
|
||||
};
|
||||
|
||||
static const struct power_domain_data audio[] = {
|
||||
{
|
||||
.pwr_con = &mtk_spm->audio_pwr_con,
|
||||
.pwr_sta_mask = AUDIO_PWR_STA_MASK,
|
||||
.sram_pdn_mask = AUDIO_SRAM_PDN_MASK,
|
||||
.sram_ack_mask = AUDIO_SRAM_ACK_MASK,
|
||||
},
|
||||
};
|
||||
|
||||
#endif /* SOC_MEDIATEK_MT8183_SPM_H */
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
#define SOC_MEDIATEK_MT8192_SPM_H
|
||||
|
||||
#include <soc/addressmap.h>
|
||||
#include <soc/mtcmos.h>
|
||||
#include <stdint.h>
|
||||
#include <types.h>
|
||||
|
||||
|
@ -674,4 +675,22 @@ struct dyna_load_pcm {
|
|||
|
||||
int spm_init(void);
|
||||
|
||||
static const struct power_domain_data disp[] = {
|
||||
{
|
||||
.pwr_con = &mtk_spm->dis_pwr_con,
|
||||
.pwr_sta_mask = DISP_PWR_STA_MASK,
|
||||
.sram_pdn_mask = DISP_SRAM_PDN_MASK,
|
||||
.sram_ack_mask = DISP_SRAM_ACK_MASK,
|
||||
},
|
||||
};
|
||||
|
||||
static const struct power_domain_data audio[] = {
|
||||
{
|
||||
.pwr_con = &mtk_spm->audio_pwr_con,
|
||||
.pwr_sta_mask = AUDIO_PWR_STA_MASK,
|
||||
.sram_pdn_mask = AUDIO_SRAM_PDN_MASK,
|
||||
.sram_ack_mask = AUDIO_SRAM_ACK_MASK,
|
||||
},
|
||||
};
|
||||
|
||||
#endif /* SOC_MEDIATEK_MT8192_SPM_H */
|
||||
|
|
Loading…
Reference in New Issue