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);
265 struct qcom_smsm *smsm = entry->smsm;
277 val = readl(entry->subscription + smsm->local_host);
279 writel(val, entry->subscription + smsm->local_host);
310 .name = "smsm",
342 * @smsm: smsm driver context
348 static int smsm_parse_ipc(struct qcom_smsm *smsm, unsigned host_id)
351 struct device_node *node = smsm->dev->of_node;
352 struct smsm_host *host = &smsm->hosts[host_id];
368 dev_err(smsm->dev, "no offset in %s\n", key);
374 dev_err(smsm->dev, "no bit in %s\n", key);
383 * @smsm: smsm driver context
387 static int smsm_inbound_entry(struct qcom_smsm *smsm,
396 dev_err(smsm->dev, "failed to parse smsm interrupt\n");
400 ret = devm_request_threaded_irq(smsm->dev, irq,
403 "smsm", (void *)entry);
405 dev_err(smsm->dev, "failed to request interrupt\n");
411 dev_err(smsm->dev, "failed to add irq_domain\n");
420 * @smsm: smsm driver context
429 static int smsm_get_size_info(struct qcom_smsm *smsm)
442 dev_err(smsm->dev, "unable to retrieve smsm size info\n");
445 dev_warn(smsm->dev, "no smsm size info, using defaults\n");
446 smsm->num_entries = SMSM_DEFAULT_NUM_ENTRIES;
447 smsm->num_hosts = SMSM_DEFAULT_NUM_HOSTS;
451 smsm->num_entries = info->num_entries;
452 smsm->num_hosts = info->num_hosts;
454 dev_dbg(smsm->dev,
455 "found custom size of smsm: %d entries %d hosts\n",
456 smsm->num_entries, smsm->num_hosts);
466 struct qcom_smsm *smsm;
473 smsm = devm_kzalloc(&pdev->dev, sizeof(*smsm), GFP_KERNEL);
474 if (!smsm)
476 smsm->dev = &pdev->dev;
477 spin_lock_init(&smsm->lock);
479 ret = smsm_get_size_info(smsm);
483 smsm->entries = devm_kcalloc(&pdev->dev,
484 smsm->num_entries,
487 if (!smsm->entries)
490 smsm->hosts = devm_kcalloc(&pdev->dev,
491 smsm->num_hosts,
494 if (!smsm->hosts)
508 &smsm->local_host);
511 for (id = 0; id < smsm->num_hosts; id++) {
512 ret = smsm_parse_ipc(smsm, id);
519 smsm->num_entries * sizeof(u32));
533 size = smsm->num_entries * smsm->num_hosts * sizeof(u32);
536 dev_err(&pdev->dev, "unable to allocate smsm interrupt mask\n");
548 smsm->local_state = states + smsm->local_host;
549 smsm->subscription = intr_mask + smsm->local_host * smsm->num_hosts;
552 smsm->state = qcom_smem_state_register(local_node, &smsm_state_ops, smsm);
553 if (IS_ERR(smsm->state)) {
554 dev_err(smsm->dev, "failed to register qcom_smem_state\n");
555 ret = PTR_ERR(smsm->state);
565 if (ret || id >= smsm->num_entries) {
571 entry = &smsm->entries[id];
573 entry->smsm = smsm;
577 entry->subscription = intr_mask + id * smsm->num_hosts;
578 writel(0, entry->subscription + smsm->local_host);
580 ret = smsm_inbound_entry(smsm, entry, node);
585 platform_set_drvdata(pdev, smsm);
592 for (id = 0; id < smsm->num_entries; id++)
593 if (smsm->entries[id].domain)
594 irq_domain_remove(smsm->entries[id].domain);
596 qcom_smem_state_unregister(smsm->state);
604 struct qcom_smsm *smsm = platform_get_drvdata(pdev);
607 for (id = 0; id < smsm->num_entries; id++)
608 if (smsm->entries[id].domain)
609 irq_domain_remove(smsm->entries[id].domain);
611 qcom_smem_state_unregister(smsm->state);
617 { .compatible = "qcom,smsm" },
626 .name = "qcom-smsm",