Lines Matching full:power
3 * Power domain driver for Broadcom BCM2835
61 /* The power gates must be enabled with this bit before enabling the LDO in the
109 #define PM_READ(reg) readl(power->base + (reg))
110 #define PM_WRITE(reg, val) writel(PM_PASSWORD | (val), power->base + (reg))
129 #define ASB_READ(reg) readl(power->asb + (reg))
130 #define ASB_WRITE(reg, val) writel(PM_PASSWORD | (val), power->asb + (reg))
134 struct bcm2835_power *power; member
151 static int bcm2835_asb_enable(struct bcm2835_power *power, u32 reg) in bcm2835_asb_enable() argument
171 static int bcm2835_asb_disable(struct bcm2835_power *power, u32 reg) in bcm2835_asb_disable() argument
193 struct bcm2835_power *power = pd->power; in bcm2835_power_power_off() local
201 /* Open the power switches. */ in bcm2835_power_power_off()
209 struct bcm2835_power *power = pd->power; in bcm2835_power_power_on() local
210 struct device *dev = power->dev; in bcm2835_power_power_on()
220 /* Enable power. Allowing too much current at once may result in bcm2835_power_power_on()
239 dev_err(dev, "Timeout waiting for %s power OK\n", in bcm2835_power_power_on()
279 struct bcm2835_power *power = pd->power; in bcm2835_asb_power_on() local
284 dev_err(power->dev, "Failed to enable clock for %s\n", in bcm2835_asb_power_on()
299 dev_err(power->dev, "Failed to enable clock for %s\n", in bcm2835_asb_power_on()
304 ret = bcm2835_asb_enable(power, asb_m_reg); in bcm2835_asb_power_on()
306 dev_err(power->dev, "Failed to enable ASB master for %s\n", in bcm2835_asb_power_on()
310 ret = bcm2835_asb_enable(power, asb_s_reg); in bcm2835_asb_power_on()
312 dev_err(power->dev, "Failed to enable ASB slave for %s\n", in bcm2835_asb_power_on()
320 bcm2835_asb_disable(power, asb_m_reg); in bcm2835_asb_power_on()
334 struct bcm2835_power *power = pd->power; in bcm2835_asb_power_off() local
337 ret = bcm2835_asb_disable(power, asb_s_reg); in bcm2835_asb_power_off()
339 dev_warn(power->dev, "Failed to disable ASB slave for %s\n", in bcm2835_asb_power_off()
343 ret = bcm2835_asb_disable(power, asb_m_reg); in bcm2835_asb_power_off()
345 dev_warn(power->dev, "Failed to disable ASB master for %s\n", in bcm2835_asb_power_off()
347 bcm2835_asb_enable(power, asb_s_reg); in bcm2835_asb_power_off()
363 struct bcm2835_power *power = pd->power; in bcm2835_power_pd_power_on() local
420 dev_err(power->dev, "Invalid domain %d\n", pd->domain); in bcm2835_power_pd_power_on()
429 struct bcm2835_power *power = pd->power; in bcm2835_power_pd_power_off() local
483 dev_err(power->dev, "Invalid domain %d\n", pd->domain); in bcm2835_power_pd_power_off()
489 bcm2835_init_power_domain(struct bcm2835_power *power, in bcm2835_init_power_domain() argument
492 struct device *dev = power->dev; in bcm2835_init_power_domain()
493 struct bcm2835_power_domain *dom = &power->domains[pd_xlate_index]; in bcm2835_init_power_domain()
513 dom->power = power; in bcm2835_init_power_domain()
518 power->pd_xlate.domains[pd_xlate_index] = &dom->base; in bcm2835_init_power_domain()
526 * The consumer of the reset controller must have the power domain up
527 * -- there's no reset ability with the power domain down. To reset
534 struct bcm2835_power *power = container_of(rcdev, struct bcm2835_power, in bcm2835_reset_reset() local
541 pd = &power->domains[BCM2835_POWER_DOMAIN_GRAFX_V3D]; in bcm2835_reset_reset()
544 pd = &power->domains[BCM2835_POWER_DOMAIN_IMAGE_H264]; in bcm2835_reset_reset()
547 pd = &power->domains[BCM2835_POWER_DOMAIN_IMAGE_ISP]; in bcm2835_reset_reset()
550 dev_err(power->dev, "Bad reset id %ld\n", id); in bcm2835_reset_reset()
564 struct bcm2835_power *power = container_of(rcdev, struct bcm2835_power, in bcm2835_reset_status() local
606 struct bcm2835_power *power; in bcm2835_power_probe() local
621 power = devm_kzalloc(dev, sizeof(*power), GFP_KERNEL); in bcm2835_power_probe()
622 if (!power) in bcm2835_power_probe()
624 platform_set_drvdata(pdev, power); in bcm2835_power_probe()
626 power->dev = dev; in bcm2835_power_probe()
627 power->base = pm->base; in bcm2835_power_probe()
628 power->asb = pm->asb; in bcm2835_power_probe()
636 power->pd_xlate.domains = devm_kcalloc(dev, in bcm2835_power_probe()
638 sizeof(*power->pd_xlate.domains), in bcm2835_power_probe()
640 if (!power->pd_xlate.domains) in bcm2835_power_probe()
643 power->pd_xlate.num_domains = ARRAY_SIZE(power_domain_names); in bcm2835_power_probe()
646 ret = bcm2835_init_power_domain(power, i, power_domain_names[i]); in bcm2835_power_probe()
652 pm_genpd_add_subdomain(&power->domains[domain_deps[i].parent].base, in bcm2835_power_probe()
653 &power->domains[domain_deps[i].child].base); in bcm2835_power_probe()
656 power->reset.owner = THIS_MODULE; in bcm2835_power_probe()
657 power->reset.nr_resets = BCM2835_RESET_COUNT; in bcm2835_power_probe()
658 power->reset.ops = &bcm2835_reset_ops; in bcm2835_power_probe()
659 power->reset.of_node = dev->parent->of_node; in bcm2835_power_probe()
661 ret = devm_reset_controller_register(dev, &power->reset); in bcm2835_power_probe()
665 of_genpd_add_provider_onecell(dev->parent->of_node, &power->pd_xlate); in bcm2835_power_probe()
667 dev_info(dev, "Broadcom BCM2835 power domains driver"); in bcm2835_power_probe()
672 struct generic_pm_domain *dom = &power->domains[i].base; in bcm2835_power_probe()
689 .name = "bcm2835-power",
695 MODULE_DESCRIPTION("Driver for Broadcom BCM2835 PM power domains and reset");