Lines Matching refs:smsm

62  * struct qcom_smsm - smsm driver context
63 * @dev: smsm device pointer
95 * @smsm: back-reference to driver context
106 struct qcom_smsm *smsm;
132 * @data: smsm context pointer
141 struct qcom_smsm *smsm = data;
149 spin_lock_irqsave(&smsm->lock, flags);
152 val = orig = readl(smsm->local_state);
159 spin_unlock_irqrestore(&smsm->lock, flags);
164 writel(val, smsm->local_state);
165 spin_unlock_irqrestore(&smsm->lock, flags);
171 for (host = 0; host < smsm->num_hosts; host++) {
172 hostp = &smsm->hosts[host];
174 val = readl(smsm->subscription + host);
240 struct qcom_smsm *smsm = entry->smsm;
244 val = readl(entry->subscription + smsm->local_host);
246 writel(val, entry->subscription + smsm->local_host);
263 struct qcom_smsm *smsm = entry->smsm;
275 val = readl(entry->subscription + smsm->local_host);
277 writel(val, entry->subscription + smsm->local_host);
324 .name = "smsm",
357 * @smsm: smsm driver context
363 static int smsm_parse_ipc(struct qcom_smsm *smsm, unsigned host_id)
366 struct device_node *node = smsm->dev->of_node;
367 struct smsm_host *host = &smsm->hosts[host_id];
383 dev_err(smsm->dev, "no offset in %s\n", key);
389 dev_err(smsm->dev, "no bit in %s\n", key);
398 * @smsm: smsm driver context
402 static int smsm_inbound_entry(struct qcom_smsm *smsm,
411 dev_err(smsm->dev, "failed to parse smsm interrupt\n");
415 ret = devm_request_threaded_irq(smsm->dev, irq,
418 "smsm", (void *)entry);
420 dev_err(smsm->dev, "failed to request interrupt\n");
426 dev_err(smsm->dev, "failed to add irq_domain\n");
435 * @smsm: smsm driver context
444 static int smsm_get_size_info(struct qcom_smsm *smsm)
456 return dev_err_probe(smsm->dev, PTR_ERR(info),
457 "unable to retrieve smsm size info\n");
459 dev_warn(smsm->dev, "no smsm size info, using defaults\n");
460 smsm->num_entries = SMSM_DEFAULT_NUM_ENTRIES;
461 smsm->num_hosts = SMSM_DEFAULT_NUM_HOSTS;
465 smsm->num_entries = info->num_entries;
466 smsm->num_hosts = info->num_hosts;
468 dev_dbg(smsm->dev,
469 "found custom size of smsm: %d entries %d hosts\n",
470 smsm->num_entries, smsm->num_hosts);
480 struct qcom_smsm *smsm;
487 smsm = devm_kzalloc(&pdev->dev, sizeof(*smsm), GFP_KERNEL);
488 if (!smsm)
490 smsm->dev = &pdev->dev;
491 spin_lock_init(&smsm->lock);
493 ret = smsm_get_size_info(smsm);
497 smsm->entries = devm_kcalloc(&pdev->dev,
498 smsm->num_entries,
501 if (!smsm->entries)
504 smsm->hosts = devm_kcalloc(&pdev->dev,
505 smsm->num_hosts,
508 if (!smsm->hosts)
522 &smsm->local_host);
525 for (id = 0; id < smsm->num_hosts; id++) {
526 ret = smsm_parse_ipc(smsm, id);
533 smsm->num_entries * sizeof(u32));
547 size = smsm->num_entries * smsm->num_hosts * sizeof(u32);
550 dev_err(&pdev->dev, "unable to allocate smsm interrupt mask\n");
562 smsm->local_state = states + smsm->local_host;
563 smsm->subscription = intr_mask + smsm->local_host * smsm->num_hosts;
566 smsm->state = qcom_smem_state_register(local_node, &smsm_state_ops, smsm);
567 if (IS_ERR(smsm->state)) {
568 dev_err(smsm->dev, "failed to register qcom_smem_state\n");
569 ret = PTR_ERR(smsm->state);
579 if (ret || id >= smsm->num_entries) {
585 entry = &smsm->entries[id];
587 entry->smsm = smsm;
591 entry->subscription = intr_mask + id * smsm->num_hosts;
592 writel(0, entry->subscription + smsm->local_host);
594 ret = smsm_inbound_entry(smsm, entry, node);
599 platform_set_drvdata(pdev, smsm);
606 for (id = 0; id < smsm->num_entries; id++)
607 if (smsm->entries[id].domain)
608 irq_domain_remove(smsm->entries[id].domain);
610 qcom_smem_state_unregister(smsm->state);
618 struct qcom_smsm *smsm = platform_get_drvdata(pdev);
621 for (id = 0; id < smsm->num_entries; id++)
622 if (smsm->entries[id].domain)
623 irq_domain_remove(smsm->entries[id].domain);
625 qcom_smem_state_unregister(smsm->state);
631 { .compatible = "qcom,smsm" },
640 .name = "qcom-smsm",