Lines Matching +full:a1 +full:- +full:spifc

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 <linux/arm-smccc.h>
55 if (meson_sm_call(pwrc_domain->pwrc->fw, SM_A1_PWRC_GET, &is_off, in pwrc_secure_is_off()
56 pwrc_domain->index, 0, 0, 0, 0) < 0) in pwrc_secure_is_off()
68 if (meson_sm_call(pwrc_domain->pwrc->fw, SM_A1_PWRC_SET, NULL, in meson_secure_pwrc_off()
69 pwrc_domain->index, PWRC_OFF, 0, 0, 0) < 0) { in meson_secure_pwrc_off()
71 ret = -EINVAL; in meson_secure_pwrc_off()
83 if (meson_sm_call(pwrc_domain->pwrc->fw, SM_A1_PWRC_SET, NULL, in meson_secure_pwrc_on()
84 pwrc_domain->index, PWRC_ON, 0, 0, 0) < 0) { in meson_secure_pwrc_on()
86 ret = -EINVAL; in meson_secure_pwrc_on()
131 SEC_PD(SPIFC, 0),
133 /* NIC is for the Arm NIC-400 interconnect, and should be always on */
213 /* NIC is for the Arm NIC-400 interconnect, and should be always on */
238 match = of_device_get_match_data(&pdev->dev); in meson_secure_pwrc_probe()
240 dev_err(&pdev->dev, "failed to get match data\n"); in meson_secure_pwrc_probe()
241 return -ENODEV; in meson_secure_pwrc_probe()
244 sm_np = of_find_compatible_node(NULL, NULL, "amlogic,meson-gxbb-sm"); in meson_secure_pwrc_probe()
246 dev_err(&pdev->dev, "no secure-monitor node\n"); in meson_secure_pwrc_probe()
247 return -ENODEV; in meson_secure_pwrc_probe()
250 pwrc = devm_kzalloc(&pdev->dev, sizeof(*pwrc), GFP_KERNEL); in meson_secure_pwrc_probe()
253 return -ENOMEM; in meson_secure_pwrc_probe()
256 pwrc->fw = meson_sm_get(sm_np); in meson_secure_pwrc_probe()
258 if (!pwrc->fw) in meson_secure_pwrc_probe()
259 return -EPROBE_DEFER; in meson_secure_pwrc_probe()
261 pwrc->xlate.domains = devm_kcalloc(&pdev->dev, match->count, in meson_secure_pwrc_probe()
262 sizeof(*pwrc->xlate.domains), in meson_secure_pwrc_probe()
264 if (!pwrc->xlate.domains) in meson_secure_pwrc_probe()
265 return -ENOMEM; in meson_secure_pwrc_probe()
267 pwrc->domains = devm_kcalloc(&pdev->dev, match->count, in meson_secure_pwrc_probe()
268 sizeof(*pwrc->domains), GFP_KERNEL); in meson_secure_pwrc_probe()
269 if (!pwrc->domains) in meson_secure_pwrc_probe()
270 return -ENOMEM; in meson_secure_pwrc_probe()
272 pwrc->xlate.num_domains = match->count; in meson_secure_pwrc_probe()
275 for (i = 0 ; i < match->count ; ++i) { in meson_secure_pwrc_probe()
276 struct meson_secure_pwrc_domain *dom = &pwrc->domains[i]; in meson_secure_pwrc_probe()
278 if (!match->domains[i].name) in meson_secure_pwrc_probe()
281 dom->pwrc = pwrc; in meson_secure_pwrc_probe()
282 dom->index = match->domains[i].index; in meson_secure_pwrc_probe()
283 dom->parent = match->domains[i].parent; in meson_secure_pwrc_probe()
284 dom->base.name = match->domains[i].name; in meson_secure_pwrc_probe()
285 dom->base.flags = match->domains[i].flags; in meson_secure_pwrc_probe()
286 dom->base.power_on = meson_secure_pwrc_on; in meson_secure_pwrc_probe()
287 dom->base.power_off = meson_secure_pwrc_off; in meson_secure_pwrc_probe()
289 if (match->domains[i].is_off(dom) && (dom->base.flags & GENPD_FLAG_ALWAYS_ON)) in meson_secure_pwrc_probe()
290 meson_secure_pwrc_on(&dom->base); in meson_secure_pwrc_probe()
292 pm_genpd_init(&dom->base, NULL, match->domains[i].is_off(dom)); in meson_secure_pwrc_probe()
294 pwrc->xlate.domains[i] = &dom->base; in meson_secure_pwrc_probe()
297 for (i = 0; i < match->count; i++) { in meson_secure_pwrc_probe()
298 struct meson_secure_pwrc_domain *dom = pwrc->domains; in meson_secure_pwrc_probe()
300 if (!match->domains[i].name || match->domains[i].parent == PWRC_NO_PARENT) in meson_secure_pwrc_probe()
306 return of_genpd_add_provider_onecell(pdev->dev.of_node, &pwrc->xlate); in meson_secure_pwrc_probe()
331 .compatible = "amlogic,meson-a1-pwrc",
335 .compatible = "amlogic,c3-pwrc",
339 .compatible = "amlogic,meson-s4-pwrc",
343 .compatible = "amlogic,t7-pwrc",