mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-03 15:47:36 +00:00
soc: mediatek: Refactor bus protection control
Put bus protection enable and disable control in separate functions. Signed-off-by: Weiyi Lu <weiyi.lu@mediatek.com> Signed-off-by: Matthias Brugger <matthias.bgg@gmail.com>
This commit is contained in:
parent
0545aa1b7a
commit
662c9d55c5
1 changed files with 30 additions and 14 deletions
|
@ -276,6 +276,30 @@ static int scpsys_sram_disable(struct scp_domain *scpd, void __iomem *ctl_addr)
|
||||||
MTK_POLL_DELAY_US, MTK_POLL_TIMEOUT);
|
MTK_POLL_DELAY_US, MTK_POLL_TIMEOUT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int scpsys_bus_protect_enable(struct scp_domain *scpd)
|
||||||
|
{
|
||||||
|
struct scp *scp = scpd->scp;
|
||||||
|
|
||||||
|
if (!scpd->data->bus_prot_mask)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
return mtk_infracfg_set_bus_protection(scp->infracfg,
|
||||||
|
scpd->data->bus_prot_mask,
|
||||||
|
scp->bus_prot_reg_update);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int scpsys_bus_protect_disable(struct scp_domain *scpd)
|
||||||
|
{
|
||||||
|
struct scp *scp = scpd->scp;
|
||||||
|
|
||||||
|
if (!scpd->data->bus_prot_mask)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
return mtk_infracfg_clear_bus_protection(scp->infracfg,
|
||||||
|
scpd->data->bus_prot_mask,
|
||||||
|
scp->bus_prot_reg_update);
|
||||||
|
}
|
||||||
|
|
||||||
static int scpsys_power_on(struct generic_pm_domain *genpd)
|
static int scpsys_power_on(struct generic_pm_domain *genpd)
|
||||||
{
|
{
|
||||||
struct scp_domain *scpd = container_of(genpd, struct scp_domain, genpd);
|
struct scp_domain *scpd = container_of(genpd, struct scp_domain, genpd);
|
||||||
|
@ -318,13 +342,9 @@ static int scpsys_power_on(struct generic_pm_domain *genpd)
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
goto err_pwr_ack;
|
goto err_pwr_ack;
|
||||||
|
|
||||||
if (scpd->data->bus_prot_mask) {
|
ret = scpsys_bus_protect_disable(scpd);
|
||||||
ret = mtk_infracfg_clear_bus_protection(scp->infracfg,
|
if (ret < 0)
|
||||||
scpd->data->bus_prot_mask,
|
|
||||||
scp->bus_prot_reg_update);
|
|
||||||
if (ret)
|
|
||||||
goto err_pwr_ack;
|
goto err_pwr_ack;
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
@ -346,13 +366,9 @@ static int scpsys_power_off(struct generic_pm_domain *genpd)
|
||||||
u32 val;
|
u32 val;
|
||||||
int ret, tmp;
|
int ret, tmp;
|
||||||
|
|
||||||
if (scpd->data->bus_prot_mask) {
|
ret = scpsys_bus_protect_enable(scpd);
|
||||||
ret = mtk_infracfg_set_bus_protection(scp->infracfg,
|
if (ret < 0)
|
||||||
scpd->data->bus_prot_mask,
|
|
||||||
scp->bus_prot_reg_update);
|
|
||||||
if (ret)
|
|
||||||
goto out;
|
goto out;
|
||||||
}
|
|
||||||
|
|
||||||
ret = scpsys_sram_disable(scpd, ctl_addr);
|
ret = scpsys_sram_disable(scpd, ctl_addr);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
|
|
Loading…
Reference in a new issue