Lines Matching +full:q6v5 +full:- +full:wcss
1 // SPDX-License-Identifier: GPL-2.0-only
7 * Copyright (c) 2012-2013, The Linux Foundation. All rights reserved.
60 struct qcom_q6v5 q6v5; member
112 struct qcom_adsp *adsp = rproc->priv; in adsp_segment_dump()
115 total_offset = segment->da + segment->offset + offset - adsp->mem_phys; in adsp_segment_dump()
116 if (total_offset < 0 || total_offset + size > adsp->mem_size) { in adsp_segment_dump()
117 dev_err(adsp->dev, in adsp_segment_dump()
119 &segment->da, offset, size); in adsp_segment_dump()
124 memcpy_fromio(dest, adsp->mem_region + total_offset, size); in adsp_segment_dump()
129 struct qcom_adsp *adsp = rproc->priv; in adsp_minidump()
131 if (rproc->dump_conf == RPROC_COREDUMP_DISABLED) in adsp_minidump()
134 qcom_minidump(rproc, adsp->minidump_id, adsp_segment_dump); in adsp_minidump()
156 for (i--; i >= 0; i--) { in adsp_pds_enable()
182 ret = qcom_scm_pas_shutdown(adsp->pas_id); in adsp_shutdown_poll_decrypt()
183 } while (ret == -EINVAL && --retry_num); in adsp_shutdown_poll_decrypt()
190 struct qcom_adsp *adsp = rproc->priv; in adsp_unprepare()
198 qcom_scm_pas_metadata_release(&adsp->pas_metadata); in adsp_unprepare()
199 if (adsp->dtb_pas_id) in adsp_unprepare()
200 qcom_scm_pas_metadata_release(&adsp->dtb_pas_metadata); in adsp_unprepare()
207 struct qcom_adsp *adsp = rproc->priv; in adsp_load()
211 adsp->firmware = fw; in adsp_load()
213 if (adsp->dtb_pas_id) { in adsp_load()
214 ret = request_firmware(&adsp->dtb_firmware, adsp->dtb_firmware_name, adsp->dev); in adsp_load()
216 dev_err(adsp->dev, "request_firmware failed for %s: %d\n", in adsp_load()
217 adsp->dtb_firmware_name, ret); in adsp_load()
221 ret = qcom_mdt_pas_init(adsp->dev, adsp->dtb_firmware, adsp->dtb_firmware_name, in adsp_load()
222 adsp->dtb_pas_id, adsp->dtb_mem_phys, in adsp_load()
223 &adsp->dtb_pas_metadata); in adsp_load()
227 ret = qcom_mdt_load_no_init(adsp->dev, adsp->dtb_firmware, adsp->dtb_firmware_name, in adsp_load()
228 adsp->dtb_pas_id, adsp->dtb_mem_region, in adsp_load()
229 adsp->dtb_mem_phys, adsp->dtb_mem_size, in adsp_load()
230 &adsp->dtb_mem_reloc); in adsp_load()
238 qcom_scm_pas_metadata_release(&adsp->dtb_pas_metadata); in adsp_load()
241 release_firmware(adsp->dtb_firmware); in adsp_load()
248 struct qcom_adsp *adsp = rproc->priv; in adsp_start()
251 ret = qcom_q6v5_prepare(&adsp->q6v5); in adsp_start()
255 ret = adsp_pds_enable(adsp, adsp->proxy_pds, adsp->proxy_pd_count); in adsp_start()
259 ret = clk_prepare_enable(adsp->xo); in adsp_start()
263 ret = clk_prepare_enable(adsp->aggre2_clk); in adsp_start()
267 if (adsp->cx_supply) { in adsp_start()
268 ret = regulator_enable(adsp->cx_supply); in adsp_start()
273 if (adsp->px_supply) { in adsp_start()
274 ret = regulator_enable(adsp->px_supply); in adsp_start()
279 if (adsp->dtb_pas_id) { in adsp_start()
280 ret = qcom_scm_pas_auth_and_reset(adsp->dtb_pas_id); in adsp_start()
282 dev_err(adsp->dev, in adsp_start()
288 ret = qcom_mdt_pas_init(adsp->dev, adsp->firmware, rproc->firmware, adsp->pas_id, in adsp_start()
289 adsp->mem_phys, &adsp->pas_metadata); in adsp_start()
293 ret = qcom_mdt_load_no_init(adsp->dev, adsp->firmware, rproc->firmware, adsp->pas_id, in adsp_start()
294 adsp->mem_region, adsp->mem_phys, adsp->mem_size, in adsp_start()
295 &adsp->mem_reloc); in adsp_start()
299 qcom_pil_info_store(adsp->info_name, adsp->mem_phys, adsp->mem_size); in adsp_start()
301 ret = qcom_scm_pas_auth_and_reset(adsp->pas_id); in adsp_start()
303 dev_err(adsp->dev, in adsp_start()
308 ret = qcom_q6v5_wait_for_start(&adsp->q6v5, msecs_to_jiffies(5000)); in adsp_start()
309 if (ret == -ETIMEDOUT) { in adsp_start()
310 dev_err(adsp->dev, "start timed out\n"); in adsp_start()
311 qcom_scm_pas_shutdown(adsp->pas_id); in adsp_start()
315 qcom_scm_pas_metadata_release(&adsp->pas_metadata); in adsp_start()
316 if (adsp->dtb_pas_id) in adsp_start()
317 qcom_scm_pas_metadata_release(&adsp->dtb_pas_metadata); in adsp_start()
320 adsp->firmware = NULL; in adsp_start()
325 qcom_scm_pas_metadata_release(&adsp->pas_metadata); in adsp_start()
326 if (adsp->dtb_pas_id) in adsp_start()
327 qcom_scm_pas_metadata_release(&adsp->dtb_pas_metadata); in adsp_start()
329 if (adsp->px_supply) in adsp_start()
330 regulator_disable(adsp->px_supply); in adsp_start()
332 if (adsp->cx_supply) in adsp_start()
333 regulator_disable(adsp->cx_supply); in adsp_start()
335 clk_disable_unprepare(adsp->aggre2_clk); in adsp_start()
337 clk_disable_unprepare(adsp->xo); in adsp_start()
339 adsp_pds_disable(adsp, adsp->proxy_pds, adsp->proxy_pd_count); in adsp_start()
341 qcom_q6v5_unprepare(&adsp->q6v5); in adsp_start()
344 adsp->firmware = NULL; in adsp_start()
349 static void qcom_pas_handover(struct qcom_q6v5 *q6v5) in qcom_pas_handover() argument
351 struct qcom_adsp *adsp = container_of(q6v5, struct qcom_adsp, q6v5); in qcom_pas_handover()
353 if (adsp->px_supply) in qcom_pas_handover()
354 regulator_disable(adsp->px_supply); in qcom_pas_handover()
355 if (adsp->cx_supply) in qcom_pas_handover()
356 regulator_disable(adsp->cx_supply); in qcom_pas_handover()
357 clk_disable_unprepare(adsp->aggre2_clk); in qcom_pas_handover()
358 clk_disable_unprepare(adsp->xo); in qcom_pas_handover()
359 adsp_pds_disable(adsp, adsp->proxy_pds, adsp->proxy_pd_count); in qcom_pas_handover()
364 struct qcom_adsp *adsp = rproc->priv; in adsp_stop()
368 ret = qcom_q6v5_request_stop(&adsp->q6v5, adsp->sysmon); in adsp_stop()
369 if (ret == -ETIMEDOUT) in adsp_stop()
370 dev_err(adsp->dev, "timed out on wait\n"); in adsp_stop()
372 ret = qcom_scm_pas_shutdown(adsp->pas_id); in adsp_stop()
373 if (ret && adsp->decrypt_shutdown) in adsp_stop()
377 dev_err(adsp->dev, "failed to shutdown: %d\n", ret); in adsp_stop()
379 if (adsp->dtb_pas_id) { in adsp_stop()
380 ret = qcom_scm_pas_shutdown(adsp->dtb_pas_id); in adsp_stop()
382 dev_err(adsp->dev, "failed to shutdown dtb: %d\n", ret); in adsp_stop()
385 handover = qcom_q6v5_unprepare(&adsp->q6v5); in adsp_stop()
387 qcom_pas_handover(&adsp->q6v5); in adsp_stop()
394 struct qcom_adsp *adsp = rproc->priv; in adsp_da_to_va()
397 offset = da - adsp->mem_reloc; in adsp_da_to_va()
398 if (offset < 0 || offset + len > adsp->mem_size) in adsp_da_to_va()
404 return adsp->mem_region + offset; in adsp_da_to_va()
409 struct qcom_adsp *adsp = rproc->priv; in adsp_panic()
411 return qcom_q6v5_panic(&adsp->q6v5); in adsp_panic()
439 adsp->xo = devm_clk_get(adsp->dev, "xo"); in adsp_init_clock()
440 if (IS_ERR(adsp->xo)) { in adsp_init_clock()
441 ret = PTR_ERR(adsp->xo); in adsp_init_clock()
442 if (ret != -EPROBE_DEFER) in adsp_init_clock()
443 dev_err(adsp->dev, "failed to get xo clock"); in adsp_init_clock()
447 adsp->aggre2_clk = devm_clk_get_optional(adsp->dev, "aggre2"); in adsp_init_clock()
448 if (IS_ERR(adsp->aggre2_clk)) { in adsp_init_clock()
449 ret = PTR_ERR(adsp->aggre2_clk); in adsp_init_clock()
450 if (ret != -EPROBE_DEFER) in adsp_init_clock()
451 dev_err(adsp->dev, in adsp_init_clock()
461 adsp->cx_supply = devm_regulator_get_optional(adsp->dev, "cx"); in adsp_init_regulator()
462 if (IS_ERR(adsp->cx_supply)) { in adsp_init_regulator()
463 if (PTR_ERR(adsp->cx_supply) == -ENODEV) in adsp_init_regulator()
464 adsp->cx_supply = NULL; in adsp_init_regulator()
466 return PTR_ERR(adsp->cx_supply); in adsp_init_regulator()
469 if (adsp->cx_supply) in adsp_init_regulator()
470 regulator_set_load(adsp->cx_supply, 100000); in adsp_init_regulator()
472 adsp->px_supply = devm_regulator_get_optional(adsp->dev, "px"); in adsp_init_regulator()
473 if (IS_ERR(adsp->px_supply)) { in adsp_init_regulator()
474 if (PTR_ERR(adsp->px_supply) == -ENODEV) in adsp_init_regulator()
475 adsp->px_supply = NULL; in adsp_init_regulator()
477 return PTR_ERR(adsp->px_supply); in adsp_init_regulator()
494 if (dev->pm_domain) { in adsp_pds_attach()
506 ret = PTR_ERR(devs[i]) ? : -ENODATA; in adsp_pds_attach()
514 for (i--; i >= 0; i--) in adsp_pds_attach()
523 struct device *dev = adsp->dev; in adsp_pds_detach()
527 if (dev->pm_domain && pd_count) { in adsp_pds_detach()
541 node = of_parse_phandle(adsp->dev->of_node, "memory-region", 0); in adsp_alloc_memory_region()
543 dev_err(adsp->dev, "no memory-region specified\n"); in adsp_alloc_memory_region()
544 return -EINVAL; in adsp_alloc_memory_region()
550 dev_err(adsp->dev, "unable to resolve memory-region\n"); in adsp_alloc_memory_region()
551 return -EINVAL; in adsp_alloc_memory_region()
554 adsp->mem_phys = adsp->mem_reloc = rmem->base; in adsp_alloc_memory_region()
555 adsp->mem_size = rmem->size; in adsp_alloc_memory_region()
556 adsp->mem_region = devm_ioremap_wc(adsp->dev, adsp->mem_phys, adsp->mem_size); in adsp_alloc_memory_region()
557 if (!adsp->mem_region) { in adsp_alloc_memory_region()
558 dev_err(adsp->dev, "unable to map memory region: %pa+%zx\n", in adsp_alloc_memory_region()
559 &rmem->base, adsp->mem_size); in adsp_alloc_memory_region()
560 return -EBUSY; in adsp_alloc_memory_region()
563 if (!adsp->dtb_pas_id) in adsp_alloc_memory_region()
566 node = of_parse_phandle(adsp->dev->of_node, "memory-region", 1); in adsp_alloc_memory_region()
568 dev_err(adsp->dev, "no dtb memory-region specified\n"); in adsp_alloc_memory_region()
569 return -EINVAL; in adsp_alloc_memory_region()
575 dev_err(adsp->dev, "unable to resolve dtb memory-region\n"); in adsp_alloc_memory_region()
576 return -EINVAL; in adsp_alloc_memory_region()
579 adsp->dtb_mem_phys = adsp->dtb_mem_reloc = rmem->base; in adsp_alloc_memory_region()
580 adsp->dtb_mem_size = rmem->size; in adsp_alloc_memory_region()
581 adsp->dtb_mem_region = devm_ioremap_wc(adsp->dev, adsp->dtb_mem_phys, adsp->dtb_mem_size); in adsp_alloc_memory_region()
582 if (!adsp->dtb_mem_region) { in adsp_alloc_memory_region()
583 dev_err(adsp->dev, "unable to map dtb memory region: %pa+%zx\n", in adsp_alloc_memory_region()
584 &rmem->base, adsp->dtb_mem_size); in adsp_alloc_memory_region()
585 return -EBUSY; in adsp_alloc_memory_region()
598 if (!adsp->region_assign_idx) in adsp_assign_memory_region()
601 node = of_parse_phandle(adsp->dev->of_node, "memory-region", adsp->region_assign_idx); in adsp_assign_memory_region()
606 dev_err(adsp->dev, "unable to resolve shareable memory-region\n"); in adsp_assign_memory_region()
607 return -EINVAL; in adsp_assign_memory_region()
613 adsp->region_assign_phys = rmem->base; in adsp_assign_memory_region()
614 adsp->region_assign_size = rmem->size; in adsp_assign_memory_region()
615 adsp->region_assign_perms = BIT(QCOM_SCM_VMID_HLOS); in adsp_assign_memory_region()
617 ret = qcom_scm_assign_mem(adsp->region_assign_phys, in adsp_assign_memory_region()
618 adsp->region_assign_size, in adsp_assign_memory_region()
619 &adsp->region_assign_perms, in adsp_assign_memory_region()
622 dev_err(adsp->dev, "assign memory failed\n"); in adsp_assign_memory_region()
634 if (!adsp->region_assign_idx) in adsp_unassign_memory_region()
640 ret = qcom_scm_assign_mem(adsp->region_assign_phys, in adsp_unassign_memory_region()
641 adsp->region_assign_size, in adsp_unassign_memory_region()
642 &adsp->region_assign_perms, in adsp_unassign_memory_region()
645 dev_err(adsp->dev, "unassign memory failed\n"); in adsp_unassign_memory_region()
657 desc = of_device_get_match_data(&pdev->dev); in adsp_probe()
659 return -EINVAL; in adsp_probe()
662 return -EPROBE_DEFER; in adsp_probe()
664 fw_name = desc->firmware_name; in adsp_probe()
665 ret = of_property_read_string(pdev->dev.of_node, "firmware-name", in adsp_probe()
667 if (ret < 0 && ret != -EINVAL) in adsp_probe()
670 if (desc->dtb_firmware_name) { in adsp_probe()
671 dtb_fw_name = desc->dtb_firmware_name; in adsp_probe()
672 ret = of_property_read_string_index(pdev->dev.of_node, "firmware-name", 1, in adsp_probe()
674 if (ret < 0 && ret != -EINVAL) in adsp_probe()
678 if (desc->minidump_id) in adsp_probe()
681 rproc = rproc_alloc(&pdev->dev, pdev->name, ops, fw_name, sizeof(*adsp)); in adsp_probe()
684 dev_err(&pdev->dev, "unable to allocate remoteproc\n"); in adsp_probe()
685 return -ENOMEM; in adsp_probe()
688 rproc->auto_boot = desc->auto_boot; in adsp_probe()
691 adsp = rproc->priv; in adsp_probe()
692 adsp->dev = &pdev->dev; in adsp_probe()
693 adsp->rproc = rproc; in adsp_probe()
694 adsp->minidump_id = desc->minidump_id; in adsp_probe()
695 adsp->pas_id = desc->pas_id; in adsp_probe()
696 adsp->info_name = desc->sysmon_name; in adsp_probe()
697 adsp->decrypt_shutdown = desc->decrypt_shutdown; in adsp_probe()
698 adsp->region_assign_idx = desc->region_assign_idx; in adsp_probe()
700 adsp->dtb_firmware_name = dtb_fw_name; in adsp_probe()
701 adsp->dtb_pas_id = desc->dtb_pas_id; in adsp_probe()
705 ret = device_init_wakeup(adsp->dev, true); in adsp_probe()
725 ret = adsp_pds_attach(&pdev->dev, adsp->proxy_pds, in adsp_probe()
726 desc->proxy_pd_names); in adsp_probe()
729 adsp->proxy_pd_count = ret; in adsp_probe()
731 ret = qcom_q6v5_init(&adsp->q6v5, pdev, rproc, desc->crash_reason_smem, desc->load_state, in adsp_probe()
736 qcom_add_glink_subdev(rproc, &adsp->glink_subdev, desc->ssr_name); in adsp_probe()
737 qcom_add_smd_subdev(rproc, &adsp->smd_subdev); in adsp_probe()
738 adsp->sysmon = qcom_add_sysmon_subdev(rproc, in adsp_probe()
739 desc->sysmon_name, in adsp_probe()
740 desc->ssctl_id); in adsp_probe()
741 if (IS_ERR(adsp->sysmon)) { in adsp_probe()
742 ret = PTR_ERR(adsp->sysmon); in adsp_probe()
746 qcom_add_ssr_subdev(rproc, &adsp->ssr_subdev, desc->ssr_name); in adsp_probe()
754 adsp_pds_detach(adsp, adsp->proxy_pds, adsp->proxy_pd_count); in adsp_probe()
756 device_init_wakeup(adsp->dev, false); in adsp_probe()
766 rproc_del(adsp->rproc); in adsp_remove()
768 qcom_q6v5_deinit(&adsp->q6v5); in adsp_remove()
770 qcom_remove_glink_subdev(adsp->rproc, &adsp->glink_subdev); in adsp_remove()
771 qcom_remove_sysmon_subdev(adsp->sysmon); in adsp_remove()
772 qcom_remove_smd_subdev(adsp->rproc, &adsp->smd_subdev); in adsp_remove()
773 qcom_remove_ssr_subdev(adsp->rproc, &adsp->ssr_subdev); in adsp_remove()
774 adsp_pds_detach(adsp, adsp->proxy_pds, adsp->proxy_pd_count); in adsp_remove()
775 device_init_wakeup(adsp->dev, false); in adsp_remove()
776 rproc_free(adsp->rproc); in adsp_remove()
1243 { .compatible = "qcom,msm8226-adsp-pil", .data = &adsp_resource_init},
1244 { .compatible = "qcom,msm8953-adsp-pil", .data = &msm8996_adsp_resource},
1245 { .compatible = "qcom,msm8974-adsp-pil", .data = &adsp_resource_init},
1246 { .compatible = "qcom,msm8996-adsp-pil", .data = &msm8996_adsp_resource},
1247 { .compatible = "qcom,msm8996-slpi-pil", .data = &msm8996_slpi_resource_init},
1248 { .compatible = "qcom,msm8998-adsp-pas", .data = &msm8996_adsp_resource},
1249 { .compatible = "qcom,msm8998-slpi-pas", .data = &msm8996_slpi_resource_init},
1250 { .compatible = "qcom,qcs404-adsp-pas", .data = &adsp_resource_init },
1251 { .compatible = "qcom,qcs404-cdsp-pas", .data = &cdsp_resource_init },
1252 { .compatible = "qcom,qcs404-wcss-pas", .data = &wcss_resource_init },
1253 { .compatible = "qcom,sa8775p-adsp-pas", .data = &sa8775p_adsp_resource},
1254 { .compatible = "qcom,sa8775p-cdsp0-pas", .data = &sa8775p_cdsp0_resource},
1255 { .compatible = "qcom,sa8775p-cdsp1-pas", .data = &sa8775p_cdsp1_resource},
1256 { .compatible = "qcom,sa8775p-gpdsp0-pas", .data = &sa8775p_gpdsp0_resource},
1257 { .compatible = "qcom,sa8775p-gpdsp1-pas", .data = &sa8775p_gpdsp1_resource},
1258 { .compatible = "qcom,sar2130p-adsp-pas", .data = &sm8350_adsp_resource},
1259 { .compatible = "qcom,sc7180-adsp-pas", .data = &sm8250_adsp_resource},
1260 { .compatible = "qcom,sc7180-mpss-pas", .data = &mpss_resource_init},
1261 { .compatible = "qcom,sc7280-mpss-pas", .data = &mpss_resource_init},
1262 { .compatible = "qcom,sc8180x-adsp-pas", .data = &sm8150_adsp_resource},
1263 { .compatible = "qcom,sc8180x-cdsp-pas", .data = &sm8150_cdsp_resource},
1264 { .compatible = "qcom,sc8180x-mpss-pas", .data = &sc8180x_mpss_resource},
1265 { .compatible = "qcom,sc8280xp-adsp-pas", .data = &sm8250_adsp_resource},
1266 { .compatible = "qcom,sc8280xp-nsp0-pas", .data = &sc8280xp_nsp0_resource},
1267 { .compatible = "qcom,sc8280xp-nsp1-pas", .data = &sc8280xp_nsp1_resource},
1268 { .compatible = "qcom,sdm660-adsp-pas", .data = &adsp_resource_init},
1269 { .compatible = "qcom,sdm845-adsp-pas", .data = &sdm845_adsp_resource_init},
1270 { .compatible = "qcom,sdm845-cdsp-pas", .data = &sdm845_cdsp_resource_init},
1271 { .compatible = "qcom,sdm845-slpi-pas", .data = &sdm845_slpi_resource_init},
1272 { .compatible = "qcom,sdx55-mpss-pas", .data = &sdx55_mpss_resource},
1273 { .compatible = "qcom,sm6115-adsp-pas", .data = &adsp_resource_init},
1274 { .compatible = "qcom,sm6115-cdsp-pas", .data = &cdsp_resource_init},
1275 { .compatible = "qcom,sm6115-mpss-pas", .data = &sc8180x_mpss_resource},
1276 { .compatible = "qcom,sm6350-adsp-pas", .data = &sm6350_adsp_resource},
1277 { .compatible = "qcom,sm6350-cdsp-pas", .data = &sm6350_cdsp_resource},
1278 { .compatible = "qcom,sm6350-mpss-pas", .data = &mpss_resource_init},
1279 { .compatible = "qcom,sm8150-adsp-pas", .data = &sm8150_adsp_resource},
1280 { .compatible = "qcom,sm8150-cdsp-pas", .data = &sm8150_cdsp_resource},
1281 { .compatible = "qcom,sm8150-mpss-pas", .data = &mpss_resource_init},
1282 { .compatible = "qcom,sm8150-slpi-pas", .data = &sdm845_slpi_resource_init},
1283 { .compatible = "qcom,sm8250-adsp-pas", .data = &sm8250_adsp_resource},
1284 { .compatible = "qcom,sm8250-cdsp-pas", .data = &sm8250_cdsp_resource},
1285 { .compatible = "qcom,sm8250-slpi-pas", .data = &sdm845_slpi_resource_init},
1286 { .compatible = "qcom,sm8350-adsp-pas", .data = &sm8350_adsp_resource},
1287 { .compatible = "qcom,sm8350-cdsp-pas", .data = &sm8350_cdsp_resource},
1288 { .compatible = "qcom,sm8350-slpi-pas", .data = &sdm845_slpi_resource_init},
1289 { .compatible = "qcom,sm8350-mpss-pas", .data = &mpss_resource_init},
1290 { .compatible = "qcom,sm8450-adsp-pas", .data = &sm8350_adsp_resource},
1291 { .compatible = "qcom,sm8450-cdsp-pas", .data = &sm8350_cdsp_resource},
1292 { .compatible = "qcom,sm8450-slpi-pas", .data = &sdm845_slpi_resource_init},
1293 { .compatible = "qcom,sm8450-mpss-pas", .data = &sm8450_mpss_resource},
1294 { .compatible = "qcom,sm8550-adsp-pas", .data = &sm8550_adsp_resource},
1295 { .compatible = "qcom,sm8550-cdsp-pas", .data = &sm8550_cdsp_resource},
1296 { .compatible = "qcom,sm8550-mpss-pas", .data = &sm8550_mpss_resource},