Lines Matching +full:bcm6328 +full:- +full:power +full:- +full:controller
1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * BCM63xx Power Domain Controller Driver
8 #include <dt-bindings/soc/bcm6318-pm.h>
9 #include <dt-bindings/soc/bcm6328-pm.h>
10 #include <dt-bindings/soc/bcm6362-pm.h>
11 #include <dt-bindings/soc/bcm63268-pm.h>
20 struct bcm63xx_power *power; member
40 struct bcm63xx_power *power = pmd->power; in bcm63xx_power_get_state() local
42 if (!pmd->mask) { in bcm63xx_power_get_state()
44 return -EINVAL; in bcm63xx_power_get_state()
47 *is_on = !(__raw_readl(power->base) & pmd->mask); in bcm63xx_power_get_state()
54 struct bcm63xx_power *power = pmd->power; in bcm63xx_power_set_state() local
58 if (!pmd->mask) in bcm63xx_power_set_state()
59 return -EINVAL; in bcm63xx_power_set_state()
61 spin_lock_irqsave(&power->lock, flags); in bcm63xx_power_set_state()
62 val = __raw_readl(power->base); in bcm63xx_power_set_state()
64 val &= ~pmd->mask; in bcm63xx_power_set_state()
66 val |= pmd->mask; in bcm63xx_power_set_state()
67 __raw_writel(val, power->base); in bcm63xx_power_set_state()
68 spin_unlock_irqrestore(&power->lock, flags); in bcm63xx_power_set_state()
91 struct device *dev = &pdev->dev; in bcm63xx_power_probe()
92 struct device_node *np = dev->of_node; in bcm63xx_power_probe()
94 struct bcm63xx_power *power; in bcm63xx_power_probe() local
99 power = devm_kzalloc(dev, sizeof(*power), GFP_KERNEL); in bcm63xx_power_probe()
100 if (!power) in bcm63xx_power_probe()
101 return -ENOMEM; in bcm63xx_power_probe()
103 power->base = devm_platform_ioremap_resource(pdev, 0); in bcm63xx_power_probe()
104 if (IS_ERR(power->base)) in bcm63xx_power_probe()
105 return PTR_ERR(power->base); in bcm63xx_power_probe()
109 return -EINVAL; in bcm63xx_power_probe()
111 power->genpd_data.num_domains = 0; in bcm63xx_power_probe()
113 for (entry = table; entry->name; entry++) { in bcm63xx_power_probe()
114 max_bit = max(max_bit, entry->bit); in bcm63xx_power_probe()
119 return -ENODEV; in bcm63xx_power_probe()
121 power->genpd_data.num_domains = max_bit + 1; in bcm63xx_power_probe()
123 power->dev = devm_kcalloc(dev, power->genpd_data.num_domains, in bcm63xx_power_probe()
126 if (!power->dev) in bcm63xx_power_probe()
127 return -ENOMEM; in bcm63xx_power_probe()
129 power->genpd = devm_kcalloc(dev, power->genpd_data.num_domains, in bcm63xx_power_probe()
132 if (!power->genpd) in bcm63xx_power_probe()
133 return -ENOMEM; in bcm63xx_power_probe()
135 power->genpd_data.domains = power->genpd; in bcm63xx_power_probe()
138 for (entry = table; entry->name; entry++) { in bcm63xx_power_probe()
139 struct bcm63xx_power_dev *pmd = &power->dev[ndom]; in bcm63xx_power_probe()
142 pmd->power = power; in bcm63xx_power_probe()
143 pmd->mask = BIT(entry->bit); in bcm63xx_power_probe()
144 pmd->genpd.name = entry->name; in bcm63xx_power_probe()
145 pmd->genpd.flags = entry->flags; in bcm63xx_power_probe()
150 pmd->genpd.name); in bcm63xx_power_probe()
152 pmd->genpd.power_on = bcm63xx_power_on; in bcm63xx_power_probe()
153 pmd->genpd.power_off = bcm63xx_power_off; in bcm63xx_power_probe()
155 pm_genpd_init(&pmd->genpd, NULL, !is_on); in bcm63xx_power_probe()
156 power->genpd[entry->bit] = &pmd->genpd; in bcm63xx_power_probe()
161 spin_lock_init(&power->lock); in bcm63xx_power_probe()
163 ret = of_genpd_add_provider_onecell(np, &power->genpd_data); in bcm63xx_power_probe()
169 dev_info(dev, "registered %u power domains\n", ndom); in bcm63xx_power_probe()
216 .name = "adsl2-mips",
219 .name = "adsl2-phy",
222 .name = "adsl2-afe",
281 .name = "adsl-phy",
284 .name = "gmii-pads",
293 .name = "wlan-pads",
331 .name = "vdsl-phy",
334 .name = "vdsl-mips",
343 .name = "wlan-pads",
352 .compatible = "brcm,bcm6318-power-controller",
355 .compatible = "brcm,bcm6328-power-controller",
358 .compatible = "brcm,bcm6362-power-controller",
361 .compatible = "brcm,bcm63268-power-controller",
370 .name = "bcm63xx-power-controller",