Lines Matching refs:scpd

172 static int scpsys_domain_is_on(struct scp_domain *scpd)  in scpsys_domain_is_on()  argument
174 struct scp *scp = scpd->scp; in scpsys_domain_is_on()
177 scpd->data->sta_mask; in scpsys_domain_is_on()
179 scpd->data->sta_mask; in scpsys_domain_is_on()
194 static int scpsys_regulator_enable(struct scp_domain *scpd) in scpsys_regulator_enable() argument
196 if (!scpd->supply) in scpsys_regulator_enable()
199 return regulator_enable(scpd->supply); in scpsys_regulator_enable()
202 static int scpsys_regulator_disable(struct scp_domain *scpd) in scpsys_regulator_disable() argument
204 if (!scpd->supply) in scpsys_regulator_disable()
207 return regulator_disable(scpd->supply); in scpsys_regulator_disable()
233 static int scpsys_sram_enable(struct scp_domain *scpd, void __iomem *ctl_addr) in scpsys_sram_enable() argument
236 u32 pdn_ack = scpd->data->sram_pdn_ack_bits; in scpsys_sram_enable()
240 val &= ~scpd->data->sram_pdn_bits; in scpsys_sram_enable()
244 if (MTK_SCPD_CAPS(scpd, MTK_SCPD_FWAIT_SRAM)) { in scpsys_sram_enable()
263 static int scpsys_sram_disable(struct scp_domain *scpd, void __iomem *ctl_addr) in scpsys_sram_disable() argument
266 u32 pdn_ack = scpd->data->sram_pdn_ack_bits; in scpsys_sram_disable()
270 val |= scpd->data->sram_pdn_bits; in scpsys_sram_disable()
279 static int scpsys_bus_protect_enable(struct scp_domain *scpd) in scpsys_bus_protect_enable() argument
281 struct scp *scp = scpd->scp; in scpsys_bus_protect_enable()
283 if (!scpd->data->bus_prot_mask) in scpsys_bus_protect_enable()
287 scpd->data->bus_prot_mask, in scpsys_bus_protect_enable()
291 static int scpsys_bus_protect_disable(struct scp_domain *scpd) in scpsys_bus_protect_disable() argument
293 struct scp *scp = scpd->scp; in scpsys_bus_protect_disable()
295 if (!scpd->data->bus_prot_mask) in scpsys_bus_protect_disable()
299 scpd->data->bus_prot_mask, in scpsys_bus_protect_disable()
305 struct scp_domain *scpd = container_of(genpd, struct scp_domain, genpd); in scpsys_power_on() local
306 struct scp *scp = scpd->scp; in scpsys_power_on()
307 void __iomem *ctl_addr = scp->base + scpd->data->ctl_offs; in scpsys_power_on()
311 ret = scpsys_regulator_enable(scpd); in scpsys_power_on()
315 ret = scpsys_clk_enable(scpd->clk, MAX_CLKS); in scpsys_power_on()
327 ret = readx_poll_timeout(scpsys_domain_is_on, scpd, tmp, tmp > 0, in scpsys_power_on()
341 ret = scpsys_sram_enable(scpd, ctl_addr); in scpsys_power_on()
345 ret = scpsys_bus_protect_disable(scpd); in scpsys_power_on()
352 scpsys_clk_disable(scpd->clk, MAX_CLKS); in scpsys_power_on()
354 scpsys_regulator_disable(scpd); in scpsys_power_on()
363 struct scp_domain *scpd = container_of(genpd, struct scp_domain, genpd); in scpsys_power_off() local
364 struct scp *scp = scpd->scp; in scpsys_power_off()
365 void __iomem *ctl_addr = scp->base + scpd->data->ctl_offs; in scpsys_power_off()
369 ret = scpsys_bus_protect_enable(scpd); in scpsys_power_off()
373 ret = scpsys_sram_disable(scpd, ctl_addr); in scpsys_power_off()
395 ret = readx_poll_timeout(scpsys_domain_is_on, scpd, tmp, tmp == 0, in scpsys_power_off()
400 scpsys_clk_disable(scpd->clk, MAX_CLKS); in scpsys_power_off()
402 ret = scpsys_regulator_disable(scpd); in scpsys_power_off()
468 struct scp_domain *scpd = &scp->domains[i]; in init_scp() local
471 scpd->supply = devm_regulator_get_optional(&pdev->dev, data->name); in init_scp()
472 if (IS_ERR(scpd->supply)) { in init_scp()
473 if (PTR_ERR(scpd->supply) == -ENODEV) in init_scp()
474 scpd->supply = NULL; in init_scp()
476 return ERR_CAST(scpd->supply); in init_scp()
485 struct scp_domain *scpd = &scp->domains[i]; in init_scp() local
486 struct generic_pm_domain *genpd = &scpd->genpd; in init_scp()
490 scpd->scp = scp; in init_scp()
492 scpd->data = data; in init_scp()
503 scpd->clk[j] = c; in init_scp()
509 if (MTK_SCPD_CAPS(scpd, MTK_SCPD_ACTIVE_WAKEUP)) in init_scp()
523 struct scp_domain *scpd = &scp->domains[i]; in mtk_register_power_domains() local
524 struct generic_pm_domain *genpd = &scpd->genpd; in mtk_register_power_domains()