Lines Matching +full:meson +full:- +full:gxbb +full:- +full:sm
1 // SPDX-License-Identifier: (GPL-2.0+ OR MIT)
13 #include <dt-bindings/power/meson-a1-power.h>
14 #include <linux/arm-smccc.h>
15 #include <linux/firmware/meson/meson_sm.h>
49 if (meson_sm_call(pwrc_domain->pwrc->fw, SM_A1_PWRC_GET, &is_off, in pwrc_secure_is_off()
50 pwrc_domain->index, 0, 0, 0, 0) < 0) in pwrc_secure_is_off()
62 if (meson_sm_call(pwrc_domain->pwrc->fw, SM_A1_PWRC_SET, NULL, in meson_secure_pwrc_off()
63 pwrc_domain->index, PWRC_OFF, 0, 0, 0) < 0) { in meson_secure_pwrc_off()
65 ret = -EINVAL; in meson_secure_pwrc_off()
77 if (meson_sm_call(pwrc_domain->pwrc->fw, SM_A1_PWRC_SET, NULL, in meson_secure_pwrc_on()
78 pwrc_domain->index, PWRC_ON, 0, 0, 0) < 0) { in meson_secure_pwrc_on()
80 ret = -EINVAL; in meson_secure_pwrc_on()
116 /* NIC is for the Arm NIC-400 interconnect, and should be always on */
129 match = of_device_get_match_data(&pdev->dev); in meson_secure_pwrc_probe()
131 dev_err(&pdev->dev, "failed to get match data\n"); in meson_secure_pwrc_probe()
132 return -ENODEV; in meson_secure_pwrc_probe()
135 sm_np = of_find_compatible_node(NULL, NULL, "amlogic,meson-gxbb-sm"); in meson_secure_pwrc_probe()
137 dev_err(&pdev->dev, "no secure-monitor node\n"); in meson_secure_pwrc_probe()
138 return -ENODEV; in meson_secure_pwrc_probe()
141 pwrc = devm_kzalloc(&pdev->dev, sizeof(*pwrc), GFP_KERNEL); in meson_secure_pwrc_probe()
143 return -ENOMEM; in meson_secure_pwrc_probe()
145 pwrc->fw = meson_sm_get(sm_np); in meson_secure_pwrc_probe()
147 if (!pwrc->fw) in meson_secure_pwrc_probe()
148 return -EPROBE_DEFER; in meson_secure_pwrc_probe()
150 pwrc->xlate.domains = devm_kcalloc(&pdev->dev, match->count, in meson_secure_pwrc_probe()
151 sizeof(*pwrc->xlate.domains), in meson_secure_pwrc_probe()
153 if (!pwrc->xlate.domains) in meson_secure_pwrc_probe()
154 return -ENOMEM; in meson_secure_pwrc_probe()
156 pwrc->domains = devm_kcalloc(&pdev->dev, match->count, in meson_secure_pwrc_probe()
157 sizeof(*pwrc->domains), GFP_KERNEL); in meson_secure_pwrc_probe()
158 if (!pwrc->domains) in meson_secure_pwrc_probe()
159 return -ENOMEM; in meson_secure_pwrc_probe()
161 pwrc->xlate.num_domains = match->count; in meson_secure_pwrc_probe()
164 for (i = 0 ; i < match->count ; ++i) { in meson_secure_pwrc_probe()
165 struct meson_secure_pwrc_domain *dom = &pwrc->domains[i]; in meson_secure_pwrc_probe()
167 if (!match->domains[i].index) in meson_secure_pwrc_probe()
170 dom->pwrc = pwrc; in meson_secure_pwrc_probe()
171 dom->index = match->domains[i].index; in meson_secure_pwrc_probe()
172 dom->base.name = match->domains[i].name; in meson_secure_pwrc_probe()
173 dom->base.flags = match->domains[i].flags; in meson_secure_pwrc_probe()
174 dom->base.power_on = meson_secure_pwrc_on; in meson_secure_pwrc_probe()
175 dom->base.power_off = meson_secure_pwrc_off; in meson_secure_pwrc_probe()
177 pm_genpd_init(&dom->base, NULL, match->domains[i].is_off(dom)); in meson_secure_pwrc_probe()
179 pwrc->xlate.domains[i] = &dom->base; in meson_secure_pwrc_probe()
182 return of_genpd_add_provider_onecell(pdev->dev.of_node, &pwrc->xlate); in meson_secure_pwrc_probe()
192 .compatible = "amlogic,meson-a1-pwrc",