Lines Matching refs:smsm
114 struct qcom_smsm *smsm; member
149 struct qcom_smsm *smsm = data; in smsm_update_bits() local
157 spin_lock_irqsave(&smsm->lock, flags); in smsm_update_bits()
160 val = orig = readl(smsm->local_state); in smsm_update_bits()
167 spin_unlock_irqrestore(&smsm->lock, flags); in smsm_update_bits()
172 writel(val, smsm->local_state); in smsm_update_bits()
173 spin_unlock_irqrestore(&smsm->lock, flags); in smsm_update_bits()
179 for (host = 0; host < smsm->num_hosts; host++) { in smsm_update_bits()
180 hostp = &smsm->hosts[host]; in smsm_update_bits()
182 val = readl(smsm->subscription + host); in smsm_update_bits()
249 struct qcom_smsm *smsm = entry->smsm; in smsm_mask_irq() local
253 val = readl(entry->subscription + smsm->local_host); in smsm_mask_irq()
255 writel(val, entry->subscription + smsm->local_host); in smsm_mask_irq()
274 struct qcom_smsm *smsm = entry->smsm; in smsm_unmask_irq() local
280 val = readl(entry->subscription + smsm->local_host); in smsm_unmask_irq()
282 writel(val, entry->subscription + smsm->local_host); in smsm_unmask_irq()
351 static int smsm_parse_ipc(struct qcom_smsm *smsm, unsigned host_id) in smsm_parse_ipc() argument
354 struct device_node *node = smsm->dev->of_node; in smsm_parse_ipc()
355 struct smsm_host *host = &smsm->hosts[host_id]; in smsm_parse_ipc()
370 dev_err(smsm->dev, "no offset in %s\n", key); in smsm_parse_ipc()
376 dev_err(smsm->dev, "no bit in %s\n", key); in smsm_parse_ipc()
389 static int smsm_inbound_entry(struct qcom_smsm *smsm, in smsm_inbound_entry() argument
398 dev_err(smsm->dev, "failed to parse smsm interrupt\n"); in smsm_inbound_entry()
402 ret = devm_request_threaded_irq(smsm->dev, irq, in smsm_inbound_entry()
407 dev_err(smsm->dev, "failed to request interrupt\n"); in smsm_inbound_entry()
413 dev_err(smsm->dev, "failed to add irq_domain\n"); in smsm_inbound_entry()
431 static int smsm_get_size_info(struct qcom_smsm *smsm) in smsm_get_size_info() argument
444 dev_err(smsm->dev, "unable to retrieve smsm size info\n"); in smsm_get_size_info()
447 dev_warn(smsm->dev, "no smsm size info, using defaults\n"); in smsm_get_size_info()
448 smsm->num_entries = SMSM_DEFAULT_NUM_ENTRIES; in smsm_get_size_info()
449 smsm->num_hosts = SMSM_DEFAULT_NUM_HOSTS; in smsm_get_size_info()
453 smsm->num_entries = info->num_entries; in smsm_get_size_info()
454 smsm->num_hosts = info->num_hosts; in smsm_get_size_info()
456 dev_dbg(smsm->dev, in smsm_get_size_info()
458 smsm->num_entries, smsm->num_hosts); in smsm_get_size_info()
468 struct qcom_smsm *smsm; in qcom_smsm_probe() local
475 smsm = devm_kzalloc(&pdev->dev, sizeof(*smsm), GFP_KERNEL); in qcom_smsm_probe()
476 if (!smsm) in qcom_smsm_probe()
478 smsm->dev = &pdev->dev; in qcom_smsm_probe()
479 spin_lock_init(&smsm->lock); in qcom_smsm_probe()
481 ret = smsm_get_size_info(smsm); in qcom_smsm_probe()
485 smsm->entries = devm_kcalloc(&pdev->dev, in qcom_smsm_probe()
486 smsm->num_entries, in qcom_smsm_probe()
489 if (!smsm->entries) in qcom_smsm_probe()
492 smsm->hosts = devm_kcalloc(&pdev->dev, in qcom_smsm_probe()
493 smsm->num_hosts, in qcom_smsm_probe()
496 if (!smsm->hosts) in qcom_smsm_probe()
510 &smsm->local_host); in qcom_smsm_probe()
513 for (id = 0; id < smsm->num_hosts; id++) { in qcom_smsm_probe()
514 ret = smsm_parse_ipc(smsm, id); in qcom_smsm_probe()
521 smsm->num_entries * sizeof(u32)); in qcom_smsm_probe()
534 size = smsm->num_entries * smsm->num_hosts * sizeof(u32); in qcom_smsm_probe()
548 smsm->local_state = states + smsm->local_host; in qcom_smsm_probe()
549 smsm->subscription = intr_mask + smsm->local_host * smsm->num_hosts; in qcom_smsm_probe()
552 smsm->state = qcom_smem_state_register(local_node, &smsm_state_ops, smsm); in qcom_smsm_probe()
553 if (IS_ERR(smsm->state)) { in qcom_smsm_probe()
554 dev_err(smsm->dev, "failed to register qcom_smem_state\n"); in qcom_smsm_probe()
555 return PTR_ERR(smsm->state); in qcom_smsm_probe()
564 if (ret || id >= smsm->num_entries) { in qcom_smsm_probe()
570 entry = &smsm->entries[id]; in qcom_smsm_probe()
572 entry->smsm = smsm; in qcom_smsm_probe()
576 entry->subscription = intr_mask + id * smsm->num_hosts; in qcom_smsm_probe()
577 writel(0, entry->subscription + smsm->local_host); in qcom_smsm_probe()
579 ret = smsm_inbound_entry(smsm, entry, node); in qcom_smsm_probe()
584 platform_set_drvdata(pdev, smsm); in qcom_smsm_probe()
589 for (id = 0; id < smsm->num_entries; id++) in qcom_smsm_probe()
590 if (smsm->entries[id].domain) in qcom_smsm_probe()
591 irq_domain_remove(smsm->entries[id].domain); in qcom_smsm_probe()
593 qcom_smem_state_unregister(smsm->state); in qcom_smsm_probe()
600 struct qcom_smsm *smsm = platform_get_drvdata(pdev); in qcom_smsm_remove() local
603 for (id = 0; id < smsm->num_entries; id++) in qcom_smsm_remove()
604 if (smsm->entries[id].domain) in qcom_smsm_remove()
605 irq_domain_remove(smsm->entries[id].domain); in qcom_smsm_remove()
607 qcom_smem_state_unregister(smsm->state); in qcom_smsm_remove()