Lines Matching +full:meson +full:- +full:gxbb +full:- +full:pwrc
1 // SPDX-License-Identifier: (GPL-2.0+ OR MIT)
13 #include <dt-bindings/power/meson-a1-power.h>
14 #include <dt-bindings/power/amlogic,c3-pwrc.h>
15 #include <dt-bindings/power/meson-s4-power.h>
16 #include <dt-bindings/power/amlogic,t7-pwrc.h>
17 #include <dt-bindings/power/amlogic,a4-pwrc.h>
18 #include <dt-bindings/power/amlogic,a5-pwrc.h>
19 #include <linux/arm-smccc.h>
20 #include <linux/firmware/meson/meson_sm.h>
31 struct meson_secure_pwrc *pwrc; member
57 if (meson_sm_call(pwrc_domain->pwrc->fw, SM_A1_PWRC_GET, &is_off, in pwrc_secure_is_off()
58 pwrc_domain->index, 0, 0, 0, 0) < 0) in pwrc_secure_is_off()
70 if (meson_sm_call(pwrc_domain->pwrc->fw, SM_A1_PWRC_SET, NULL, in meson_secure_pwrc_off()
71 pwrc_domain->index, PWRC_OFF, 0, 0, 0) < 0) { in meson_secure_pwrc_off()
73 ret = -EINVAL; in meson_secure_pwrc_off()
85 if (meson_sm_call(pwrc_domain->pwrc->fw, SM_A1_PWRC_SET, NULL, in meson_secure_pwrc_on()
86 pwrc_domain->index, PWRC_ON, 0, 0, 0) < 0) { in meson_secure_pwrc_on()
88 ret = -EINVAL; in meson_secure_pwrc_on()
135 /* NIC is for the Arm NIC-400 interconnect, and should be always on */
249 /* NIC is for the Arm NIC-400 interconnect, and should be always on */
271 struct meson_secure_pwrc *pwrc; in meson_secure_pwrc_probe() local
274 match = of_device_get_match_data(&pdev->dev); in meson_secure_pwrc_probe()
276 dev_err(&pdev->dev, "failed to get match data\n"); in meson_secure_pwrc_probe()
277 return -ENODEV; in meson_secure_pwrc_probe()
280 sm_np = of_find_compatible_node(NULL, NULL, "amlogic,meson-gxbb-sm"); in meson_secure_pwrc_probe()
282 dev_err(&pdev->dev, "no secure-monitor node\n"); in meson_secure_pwrc_probe()
283 return -ENODEV; in meson_secure_pwrc_probe()
286 pwrc = devm_kzalloc(&pdev->dev, sizeof(*pwrc), GFP_KERNEL); in meson_secure_pwrc_probe()
287 if (!pwrc) { in meson_secure_pwrc_probe()
289 return -ENOMEM; in meson_secure_pwrc_probe()
292 pwrc->fw = meson_sm_get(sm_np); in meson_secure_pwrc_probe()
294 if (!pwrc->fw) in meson_secure_pwrc_probe()
295 return -EPROBE_DEFER; in meson_secure_pwrc_probe()
297 pwrc->xlate.domains = devm_kcalloc(&pdev->dev, match->count, in meson_secure_pwrc_probe()
298 sizeof(*pwrc->xlate.domains), in meson_secure_pwrc_probe()
300 if (!pwrc->xlate.domains) in meson_secure_pwrc_probe()
301 return -ENOMEM; in meson_secure_pwrc_probe()
303 pwrc->domains = devm_kcalloc(&pdev->dev, match->count, in meson_secure_pwrc_probe()
304 sizeof(*pwrc->domains), GFP_KERNEL); in meson_secure_pwrc_probe()
305 if (!pwrc->domains) in meson_secure_pwrc_probe()
306 return -ENOMEM; in meson_secure_pwrc_probe()
308 pwrc->xlate.num_domains = match->count; in meson_secure_pwrc_probe()
309 platform_set_drvdata(pdev, pwrc); in meson_secure_pwrc_probe()
311 for (i = 0 ; i < match->count ; ++i) { in meson_secure_pwrc_probe()
312 struct meson_secure_pwrc_domain *dom = &pwrc->domains[i]; in meson_secure_pwrc_probe()
314 if (!match->domains[i].name) in meson_secure_pwrc_probe()
317 dom->pwrc = pwrc; in meson_secure_pwrc_probe()
318 dom->index = match->domains[i].index; in meson_secure_pwrc_probe()
319 dom->parent = match->domains[i].parent; in meson_secure_pwrc_probe()
320 dom->base.name = match->domains[i].name; in meson_secure_pwrc_probe()
321 dom->base.flags = match->domains[i].flags; in meson_secure_pwrc_probe()
322 dom->base.power_on = meson_secure_pwrc_on; in meson_secure_pwrc_probe()
323 dom->base.power_off = meson_secure_pwrc_off; in meson_secure_pwrc_probe()
325 if (match->domains[i].is_off(dom) && (dom->base.flags & GENPD_FLAG_ALWAYS_ON)) in meson_secure_pwrc_probe()
326 meson_secure_pwrc_on(&dom->base); in meson_secure_pwrc_probe()
328 pm_genpd_init(&dom->base, NULL, match->domains[i].is_off(dom)); in meson_secure_pwrc_probe()
330 pwrc->xlate.domains[i] = &dom->base; in meson_secure_pwrc_probe()
333 for (i = 0; i < match->count; i++) { in meson_secure_pwrc_probe()
334 struct meson_secure_pwrc_domain *dom = pwrc->domains; in meson_secure_pwrc_probe()
336 if (!match->domains[i].name || match->domains[i].parent == PWRC_NO_PARENT) in meson_secure_pwrc_probe()
342 return of_genpd_add_provider_onecell(pdev->dev.of_node, &pwrc->xlate); in meson_secure_pwrc_probe()
377 .compatible = "amlogic,meson-a1-pwrc",
381 .compatible = "amlogic,a4-pwrc",
385 .compatible = "amlogic,a5-pwrc",
389 .compatible = "amlogic,c3-pwrc",
393 .compatible = "amlogic,meson-s4-pwrc",
397 .compatible = "amlogic,t7-pwrc",
412 MODULE_DESCRIPTION("Amlogic Meson Secure Power Domains driver");