Lines Matching +full:reo2host +full:- +full:destination +full:- +full:ring1

1 // SPDX-License-Identifier: BSD-3-Clause-Clear
3 * Copyright (c) 2018-2019 The Linux Foundation. All rights reserved.
10 #include <linux/dma-mapping.h>
20 { .compatible = "qcom,ipq8074-wifi",
23 { .compatible = "qcom,ipq6018-wifi",
41 "misc-pulse1",
42 "misc-latch",
43 "sw-exception",
57 "host2wbm-desc-feed",
58 "host2reo-re-injection",
59 "host2reo-command",
60 "host2rxdma-monitor-ring3",
61 "host2rxdma-monitor-ring2",
62 "host2rxdma-monitor-ring1",
63 "reo2ost-exception",
64 "wbm2host-rx-release",
65 "reo2host-status",
66 "reo2host-destination-ring4",
67 "reo2host-destination-ring3",
68 "reo2host-destination-ring2",
69 "reo2host-destination-ring1",
70 "rxdma2host-monitor-destination-mac3",
71 "rxdma2host-monitor-destination-mac2",
72 "rxdma2host-monitor-destination-mac1",
73 "ppdu-end-interrupts-mac3",
74 "ppdu-end-interrupts-mac2",
75 "ppdu-end-interrupts-mac1",
76 "rxdma2host-monitor-status-ring-mac3",
77 "rxdma2host-monitor-status-ring-mac2",
78 "rxdma2host-monitor-status-ring-mac1",
79 "host2rxdma-host-buf-ring-mac3",
80 "host2rxdma-host-buf-ring-mac2",
81 "host2rxdma-host-buf-ring-mac1",
82 "rxdma2host-destination-ring-mac3",
83 "rxdma2host-destination-ring-mac2",
84 "rxdma2host-destination-ring-mac1",
85 "host2tcl-input-ring4",
86 "host2tcl-input-ring3",
87 "host2tcl-input-ring2",
88 "host2tcl-input-ring1",
89 "wbm2host-tx-completions-ring3",
90 "wbm2host-tx-completions-ring2",
91 "wbm2host-tx-completions-ring1",
92 "tcl2host-status-ring",
95 /* enum ext_irq_num - irq numbers that can be used by external modules
139 return ioread32(ab->mem + offset); in ath11k_ahb_read32()
144 iowrite32(value, ab->mem + offset); in ath11k_ahb_write32()
151 for (i = 0; i < ab->hw_params.ce_count; i++) { in ath11k_ahb_kill_tasklets()
152 struct ath11k_ce_pipe *ce_pipe = &ab->ce.ce_pipe[i]; in ath11k_ahb_kill_tasklets()
157 tasklet_kill(&ce_pipe->intr_tq); in ath11k_ahb_kill_tasklets()
165 for (i = 0; i < irq_grp->num_irq; i++) in ath11k_ahb_ext_grp_disable()
166 disable_irq_nosync(irq_grp->ab->irq_num[irq_grp->irqs[i]]); in ath11k_ahb_ext_grp_disable()
174 struct ath11k_ext_irq_grp *irq_grp = &ab->ext_irq_grp[i]; in __ath11k_ahb_ext_irq_disable()
178 napi_synchronize(&irq_grp->napi); in __ath11k_ahb_ext_irq_disable()
179 napi_disable(&irq_grp->napi); in __ath11k_ahb_ext_irq_disable()
187 for (i = 0; i < irq_grp->num_irq; i++) in ath11k_ahb_ext_grp_enable()
188 enable_irq(irq_grp->ab->irq_num[irq_grp->irqs[i]]); in ath11k_ahb_ext_grp_enable()
211 ce_config = &ab->hw_params.target_ce_config[ce_id]; in ath11k_ahb_ce_irq_enable()
212 if (__le32_to_cpu(ce_config->pipedir) & PIPEDIR_OUT) in ath11k_ahb_ce_irq_enable()
215 if (__le32_to_cpu(ce_config->pipedir) & PIPEDIR_IN) { in ath11k_ahb_ce_irq_enable()
226 ce_config = &ab->hw_params.target_ce_config[ce_id]; in ath11k_ahb_ce_irq_disable()
227 if (__le32_to_cpu(ce_config->pipedir) & PIPEDIR_OUT) in ath11k_ahb_ce_irq_disable()
230 if (__le32_to_cpu(ce_config->pipedir) & PIPEDIR_IN) { in ath11k_ahb_ce_irq_disable()
242 for (i = 0; i < ab->hw_params.ce_count; i++) { in ath11k_ahb_sync_ce_irqs()
247 synchronize_irq(ab->irq_num[irq_idx]); in ath11k_ahb_sync_ce_irqs()
257 struct ath11k_ext_irq_grp *irq_grp = &ab->ext_irq_grp[i]; in ath11k_ahb_sync_ext_irqs()
259 for (j = 0; j < irq_grp->num_irq; j++) { in ath11k_ahb_sync_ext_irqs()
260 irq_idx = irq_grp->irqs[j]; in ath11k_ahb_sync_ext_irqs()
261 synchronize_irq(ab->irq_num[irq_idx]); in ath11k_ahb_sync_ext_irqs()
270 for (i = 0; i < ab->hw_params.ce_count; i++) { in ath11k_ahb_ce_irqs_enable()
281 for (i = 0; i < ab->hw_params.ce_count; i++) { in ath11k_ahb_ce_irqs_disable()
301 struct ath11k_ext_irq_grp *irq_grp = &ab->ext_irq_grp[i]; in ath11k_ahb_ext_irq_enable()
303 napi_enable(&irq_grp->napi); in ath11k_ahb_ext_irq_enable()
316 if (!test_bit(ATH11K_FLAG_CRASH_FLUSH, &ab->dev_flags)) in ath11k_ahb_stop()
320 del_timer_sync(&ab->rx_replenish_retry); in ath11k_ahb_stop()
329 ret = rproc_boot(ab_ahb->tgt_rproc); in ath11k_ahb_power_up()
340 rproc_shutdown(ab_ahb->tgt_rproc); in ath11k_ahb_power_down()
345 struct ath11k_qmi_ce_cfg *cfg = &ab->qmi.ce_cfg; in ath11k_ahb_init_qmi_ce_config()
347 cfg->tgt_ce_len = ab->hw_params.target_ce_count; in ath11k_ahb_init_qmi_ce_config()
348 cfg->tgt_ce = ab->hw_params.target_ce_config; in ath11k_ahb_init_qmi_ce_config()
349 cfg->svc_to_ce_map_len = ab->hw_params.svc_to_ce_map_len; in ath11k_ahb_init_qmi_ce_config()
350 cfg->svc_to_ce_map = ab->hw_params.svc_to_ce_map; in ath11k_ahb_init_qmi_ce_config()
351 ab->qmi.service_ins_id = ATH11K_QMI_WLFW_SERVICE_INS_ID_V01_IPQ8074; in ath11k_ahb_init_qmi_ce_config()
359 struct ath11k_ext_irq_grp *irq_grp = &ab->ext_irq_grp[i]; in ath11k_ahb_free_ext_irq()
361 for (j = 0; j < irq_grp->num_irq; j++) in ath11k_ahb_free_ext_irq()
362 free_irq(ab->irq_num[irq_grp->irqs[j]], irq_grp); in ath11k_ahb_free_ext_irq()
371 for (i = 0; i < ab->hw_params.ce_count; i++) { in ath11k_ahb_free_irq()
375 free_irq(ab->irq_num[irq_idx], &ab->ce.ce_pipe[i]); in ath11k_ahb_free_irq()
385 ath11k_ce_per_engine_service(ce_pipe->ab, ce_pipe->pipe_num); in ath11k_ahb_ce_tasklet()
387 ath11k_ahb_ce_irq_enable(ce_pipe->ab, ce_pipe->pipe_num); in ath11k_ahb_ce_tasklet()
395 ce_pipe->timestamp = jiffies; in ath11k_ahb_ce_interrupt_handler()
397 ath11k_ahb_ce_irq_disable(ce_pipe->ab, ce_pipe->pipe_num); in ath11k_ahb_ce_interrupt_handler()
399 tasklet_schedule(&ce_pipe->intr_tq); in ath11k_ahb_ce_interrupt_handler()
409 struct ath11k_base *ab = irq_grp->ab; in ath11k_ahb_ext_grp_napi_poll()
429 irq_grp->timestamp = jiffies; in ath11k_ahb_ext_interrupt_handler()
433 napi_schedule(&irq_grp->napi); in ath11k_ahb_ext_interrupt_handler()
440 struct ath11k_hw_params *hw = &ab->hw_params; in ath11k_ahb_ext_irq_config()
446 struct ath11k_ext_irq_grp *irq_grp = &ab->ext_irq_grp[i]; in ath11k_ahb_ext_irq_config()
449 irq_grp->ab = ab; in ath11k_ahb_ext_irq_config()
450 irq_grp->grp_id = i; in ath11k_ahb_ext_irq_config()
451 init_dummy_netdev(&irq_grp->napi_ndev); in ath11k_ahb_ext_irq_config()
452 netif_napi_add(&irq_grp->napi_ndev, &irq_grp->napi, in ath11k_ahb_ext_irq_config()
456 if (ab->hw_params.ring_mask->tx[i] & BIT(j)) { in ath11k_ahb_ext_irq_config()
457 irq_grp->irqs[num_irq++] = in ath11k_ahb_ext_irq_config()
458 wbm2host_tx_completions_ring1 - j; in ath11k_ahb_ext_irq_config()
461 if (ab->hw_params.ring_mask->rx[i] & BIT(j)) { in ath11k_ahb_ext_irq_config()
462 irq_grp->irqs[num_irq++] = in ath11k_ahb_ext_irq_config()
463 reo2host_destination_ring1 - j; in ath11k_ahb_ext_irq_config()
466 if (ab->hw_params.ring_mask->rx_err[i] & BIT(j)) in ath11k_ahb_ext_irq_config()
467 irq_grp->irqs[num_irq++] = reo2host_exception; in ath11k_ahb_ext_irq_config()
469 if (ab->hw_params.ring_mask->rx_wbm_rel[i] & BIT(j)) in ath11k_ahb_ext_irq_config()
470 irq_grp->irqs[num_irq++] = wbm2host_rx_release; in ath11k_ahb_ext_irq_config()
472 if (ab->hw_params.ring_mask->reo_status[i] & BIT(j)) in ath11k_ahb_ext_irq_config()
473 irq_grp->irqs[num_irq++] = reo2host_status; in ath11k_ahb_ext_irq_config()
475 if (j < ab->hw_params.max_radios) { in ath11k_ahb_ext_irq_config()
476 if (ab->hw_params.ring_mask->rxdma2host[i] & BIT(j)) { in ath11k_ahb_ext_irq_config()
477 irq_grp->irqs[num_irq++] = in ath11k_ahb_ext_irq_config()
478 rxdma2host_destination_ring_mac1 - in ath11k_ahb_ext_irq_config()
482 if (ab->hw_params.ring_mask->host2rxdma[i] & BIT(j)) { in ath11k_ahb_ext_irq_config()
483 irq_grp->irqs[num_irq++] = in ath11k_ahb_ext_irq_config()
484 host2rxdma_host_buf_ring_mac1 - in ath11k_ahb_ext_irq_config()
488 if (ab->hw_params.ring_mask->rx_mon_status[i] & BIT(j)) { in ath11k_ahb_ext_irq_config()
489 irq_grp->irqs[num_irq++] = in ath11k_ahb_ext_irq_config()
490 ppdu_end_interrupts_mac1 - in ath11k_ahb_ext_irq_config()
492 irq_grp->irqs[num_irq++] = in ath11k_ahb_ext_irq_config()
493 rxdma2host_monitor_status_ring_mac1 - in ath11k_ahb_ext_irq_config()
498 irq_grp->num_irq = num_irq; in ath11k_ahb_ext_irq_config()
500 for (j = 0; j < irq_grp->num_irq; j++) { in ath11k_ahb_ext_irq_config()
501 int irq_idx = irq_grp->irqs[j]; in ath11k_ahb_ext_irq_config()
503 irq = platform_get_irq_byname(ab->pdev, in ath11k_ahb_ext_irq_config()
505 ab->irq_num[irq_idx] = irq; in ath11k_ahb_ext_irq_config()
526 for (i = 0; i < ab->hw_params.ce_count; i++) { in ath11k_ahb_config_irq()
527 struct ath11k_ce_pipe *ce_pipe = &ab->ce.ce_pipe[i]; in ath11k_ahb_config_irq()
534 tasklet_setup(&ce_pipe->intr_tq, ath11k_ahb_ce_tasklet); in ath11k_ahb_config_irq()
535 irq = platform_get_irq_byname(ab->pdev, irq_name[irq_idx]); in ath11k_ahb_config_irq()
542 ab->irq_num[irq_idx] = irq; in ath11k_ahb_config_irq()
558 for (i = 0; i < ab->hw_params.svc_to_ce_map_len; i++) { in ath11k_ahb_map_service_to_pipe()
559 entry = &ab->hw_params.svc_to_ce_map[i]; in ath11k_ahb_map_service_to_pipe()
561 if (__le32_to_cpu(entry->service_id) != service_id) in ath11k_ahb_map_service_to_pipe()
564 switch (__le32_to_cpu(entry->pipedir)) { in ath11k_ahb_map_service_to_pipe()
569 *dl_pipe = __le32_to_cpu(entry->pipenum); in ath11k_ahb_map_service_to_pipe()
574 *ul_pipe = __le32_to_cpu(entry->pipenum); in ath11k_ahb_map_service_to_pipe()
580 *dl_pipe = __le32_to_cpu(entry->pipenum); in ath11k_ahb_map_service_to_pipe()
581 *ul_pipe = __le32_to_cpu(entry->pipenum); in ath11k_ahb_map_service_to_pipe()
589 return -ENOENT; in ath11k_ahb_map_service_to_pipe()
609 struct device *dev = ab->dev; in ath11k_core_get_rproc()
613 if (of_property_read_u32(dev->of_node, "qcom,rproc", &rproc_phandle)) { in ath11k_core_get_rproc()
615 return -ENOENT; in ath11k_core_get_rproc()
621 return -EINVAL; in ath11k_core_get_rproc()
623 ab_ahb->tgt_rproc = prproc; in ath11k_core_get_rproc()
636 of_id = of_match_device(ath11k_ahb_of_match, &pdev->dev); in ath11k_ahb_probe()
638 dev_err(&pdev->dev, "failed to find matching device tree id\n"); in ath11k_ahb_probe()
639 return -EINVAL; in ath11k_ahb_probe()
644 dev_err(&pdev->dev, "ioremap error\n"); in ath11k_ahb_probe()
648 ret = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32)); in ath11k_ahb_probe()
650 dev_err(&pdev->dev, "failed to set 32-bit consistent dma\n"); in ath11k_ahb_probe()
654 ab = ath11k_core_alloc(&pdev->dev, sizeof(struct ath11k_ahb), in ath11k_ahb_probe()
658 dev_err(&pdev->dev, "failed to allocate ath11k base\n"); in ath11k_ahb_probe()
659 return -ENOMEM; in ath11k_ahb_probe()
662 ab->hif.ops = &ath11k_ahb_hif_ops; in ath11k_ahb_probe()
663 ab->pdev = pdev; in ath11k_ahb_probe()
664 ab->hw_rev = (enum ath11k_hw_rev)of_id->data; in ath11k_ahb_probe()
665 ab->mem = mem; in ath11k_ahb_probe()
666 ab->mem_len = resource_size(mem_res); in ath11k_ahb_probe()
723 reinit_completion(&ab->driver_recovery); in ath11k_ahb_remove()
725 if (test_bit(ATH11K_FLAG_RECOVERY, &ab->dev_flags)) { in ath11k_ahb_remove()
726 left = wait_for_completion_timeout(&ab->driver_recovery, in ath11k_ahb_remove()
732 set_bit(ATH11K_FLAG_UNREGISTERING, &ab->dev_flags); in ath11k_ahb_remove()
733 cancel_work_sync(&ab->restart_work); in ath11k_ahb_remove()