• Home
  • Raw
  • Download

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 <linux/arm-smccc.h>
15 #include <linux/firmware/meson/meson_sm.h>
23 struct meson_secure_pwrc *pwrc; member
48 if (meson_sm_call(pwrc_domain->pwrc->fw, SM_A1_PWRC_GET, &is_off, in pwrc_secure_is_off()
49 pwrc_domain->index, 0, 0, 0, 0) < 0) in pwrc_secure_is_off()
61 if (meson_sm_call(pwrc_domain->pwrc->fw, SM_A1_PWRC_SET, NULL, in meson_secure_pwrc_off()
62 pwrc_domain->index, PWRC_OFF, 0, 0, 0) < 0) { in meson_secure_pwrc_off()
64 ret = -EINVAL; in meson_secure_pwrc_off()
76 if (meson_sm_call(pwrc_domain->pwrc->fw, SM_A1_PWRC_SET, NULL, in meson_secure_pwrc_on()
77 pwrc_domain->index, PWRC_ON, 0, 0, 0) < 0) { in meson_secure_pwrc_on()
79 ret = -EINVAL; in meson_secure_pwrc_on()
115 /* NIC is for the Arm NIC-400 interconnect, and should be always on */
125 struct meson_secure_pwrc *pwrc; in meson_secure_pwrc_probe() local
128 match = of_device_get_match_data(&pdev->dev); in meson_secure_pwrc_probe()
130 dev_err(&pdev->dev, "failed to get match data\n"); in meson_secure_pwrc_probe()
131 return -ENODEV; in meson_secure_pwrc_probe()
134 sm_np = of_find_compatible_node(NULL, NULL, "amlogic,meson-gxbb-sm"); in meson_secure_pwrc_probe()
136 dev_err(&pdev->dev, "no secure-monitor node\n"); in meson_secure_pwrc_probe()
137 return -ENODEV; in meson_secure_pwrc_probe()
140 pwrc = devm_kzalloc(&pdev->dev, sizeof(*pwrc), GFP_KERNEL); in meson_secure_pwrc_probe()
141 if (!pwrc) { in meson_secure_pwrc_probe()
143 return -ENOMEM; in meson_secure_pwrc_probe()
146 pwrc->fw = meson_sm_get(sm_np); in meson_secure_pwrc_probe()
148 if (!pwrc->fw) in meson_secure_pwrc_probe()
149 return -EPROBE_DEFER; in meson_secure_pwrc_probe()
151 pwrc->xlate.domains = devm_kcalloc(&pdev->dev, match->count, in meson_secure_pwrc_probe()
152 sizeof(*pwrc->xlate.domains), in meson_secure_pwrc_probe()
154 if (!pwrc->xlate.domains) in meson_secure_pwrc_probe()
155 return -ENOMEM; in meson_secure_pwrc_probe()
157 pwrc->domains = devm_kcalloc(&pdev->dev, match->count, in meson_secure_pwrc_probe()
158 sizeof(*pwrc->domains), GFP_KERNEL); in meson_secure_pwrc_probe()
159 if (!pwrc->domains) in meson_secure_pwrc_probe()
160 return -ENOMEM; in meson_secure_pwrc_probe()
162 pwrc->xlate.num_domains = match->count; in meson_secure_pwrc_probe()
163 platform_set_drvdata(pdev, pwrc); in meson_secure_pwrc_probe()
165 for (i = 0 ; i < match->count ; ++i) { in meson_secure_pwrc_probe()
166 struct meson_secure_pwrc_domain *dom = &pwrc->domains[i]; in meson_secure_pwrc_probe()
168 if (!match->domains[i].index) in meson_secure_pwrc_probe()
171 dom->pwrc = pwrc; in meson_secure_pwrc_probe()
172 dom->index = match->domains[i].index; in meson_secure_pwrc_probe()
173 dom->base.name = match->domains[i].name; in meson_secure_pwrc_probe()
174 dom->base.flags = match->domains[i].flags; in meson_secure_pwrc_probe()
175 dom->base.power_on = meson_secure_pwrc_on; in meson_secure_pwrc_probe()
176 dom->base.power_off = meson_secure_pwrc_off; in meson_secure_pwrc_probe()
178 pm_genpd_init(&dom->base, NULL, match->domains[i].is_off(dom)); in meson_secure_pwrc_probe()
180 pwrc->xlate.domains[i] = &dom->base; in meson_secure_pwrc_probe()
183 return of_genpd_add_provider_onecell(pdev->dev.of_node, &pwrc->xlate); in meson_secure_pwrc_probe()
193 .compatible = "amlogic,meson-a1-pwrc",