ce.c (e3396b8bddd2ea822f9390f1ba49c22d769a7534) ce.c (6e5e9f59dc5b49bad3af283c165beb8321e2a89b)
1// SPDX-License-Identifier: BSD-3-Clause-Clear
2/*
3 * Copyright (c) 2018-2019 The Linux Foundation. All rights reserved.
4 */
5
6#include "dp_rx.h"
7#include "debug.h"
8#include "hif.h"
9
1// SPDX-License-Identifier: BSD-3-Clause-Clear
2/*
3 * Copyright (c) 2018-2019 The Linux Foundation. All rights reserved.
4 */
5
6#include "dp_rx.h"
7#include "debug.h"
8#include "hif.h"
9
10#define host_ce_config_wlan ab->hw_params.host_ce_config
11
12const struct ce_attr ath11k_host_ce_config_ipq8074[] = {
13 /* CE0: host->target HTC control and raw streams */
14 {
15 .flags = CE_ATTR_FLAGS,
16 .src_nentries = 16,
17 .src_sz_max = 2048,
18 .dest_nentries = 0,
19 },

--- 446 unchanged lines hidden (view full) ---

466 int ret;
467
468 params.ring_base_paddr = ce_ring->base_addr_ce_space;
469 params.ring_base_vaddr = ce_ring->base_addr_owner_space;
470 params.num_entries = ce_ring->nentries;
471
472 switch (type) {
473 case HAL_CE_SRC:
10const struct ce_attr ath11k_host_ce_config_ipq8074[] = {
11 /* CE0: host->target HTC control and raw streams */
12 {
13 .flags = CE_ATTR_FLAGS,
14 .src_nentries = 16,
15 .src_sz_max = 2048,
16 .dest_nentries = 0,
17 },

--- 446 unchanged lines hidden (view full) ---

464 int ret;
465
466 params.ring_base_paddr = ce_ring->base_addr_ce_space;
467 params.ring_base_vaddr = ce_ring->base_addr_owner_space;
468 params.num_entries = ce_ring->nentries;
469
470 switch (type) {
471 case HAL_CE_SRC:
474 if (!(CE_ATTR_DIS_INTR & host_ce_config_wlan[ce_id].flags))
472 if (!(CE_ATTR_DIS_INTR & ab->hw_params.host_ce_config[ce_id].flags))
475 params.intr_batch_cntr_thres_entries = 1;
476 break;
477 case HAL_CE_DST:
473 params.intr_batch_cntr_thres_entries = 1;
474 break;
475 case HAL_CE_DST:
478 params.max_buffer_len = host_ce_config_wlan[ce_id].src_sz_max;
479 if (!(host_ce_config_wlan[ce_id].flags & CE_ATTR_DIS_INTR)) {
476 params.max_buffer_len = ab->hw_params.host_ce_config[ce_id].src_sz_max;
477 if (!(ab->hw_params.host_ce_config[ce_id].flags & CE_ATTR_DIS_INTR)) {
480 params.intr_timer_thres_us = 1024;
481 params.flags |= HAL_SRNG_FLAGS_LOW_THRESH_INTR_EN;
482 params.low_threshold = ce_ring->nentries - 3;
483 }
484 break;
485 case HAL_CE_DST_STATUS:
478 params.intr_timer_thres_us = 1024;
479 params.flags |= HAL_SRNG_FLAGS_LOW_THRESH_INTR_EN;
480 params.low_threshold = ce_ring->nentries - 3;
481 }
482 break;
483 case HAL_CE_DST_STATUS:
486 if (!(host_ce_config_wlan[ce_id].flags & CE_ATTR_DIS_INTR)) {
484 if (!(ab->hw_params.host_ce_config[ce_id].flags & CE_ATTR_DIS_INTR)) {
487 params.intr_batch_cntr_thres_entries = 1;
488 params.intr_timer_thres_us = 0x1000;
489 }
490 break;
491 default:
492 ath11k_warn(ab, "Invalid CE ring type %d\n", type);
493 return -EINVAL;
494 }
495
496 /* TODO: Init other params needed by HAL to init the ring */
497
498 ret = ath11k_hal_srng_setup(ab, type, ce_id, 0, &params);
499 if (ret < 0) {
500 ath11k_warn(ab, "failed to setup srng: %d ring_id %d\n",
501 ret, ce_id);
502 return ret;
503 }
504
485 params.intr_batch_cntr_thres_entries = 1;
486 params.intr_timer_thres_us = 0x1000;
487 }
488 break;
489 default:
490 ath11k_warn(ab, "Invalid CE ring type %d\n", type);
491 return -EINVAL;
492 }
493
494 /* TODO: Init other params needed by HAL to init the ring */
495
496 ret = ath11k_hal_srng_setup(ab, type, ce_id, 0, &params);
497 if (ret < 0) {
498 ath11k_warn(ab, "failed to setup srng: %d ring_id %d\n",
499 ret, ce_id);
500 return ret;
501 }
502
505 if (!(CE_ATTR_DIS_INTR & host_ce_config_wlan[ce_id].flags))
503 if (!(CE_ATTR_DIS_INTR & ab->hw_params.host_ce_config[ce_id].flags))
506 ath11k_ce_srng_msi_ring_params_setup(ab, ce_id, &params);
507
508 ce_ring->hal_ring_id = ret;
509
510 return 0;
511}
512
513static struct ath11k_ce_ring *

--- 31 unchanged lines hidden (view full) ---

545 CE_DESC_RING_ALIGN);
546
547 return ce_ring;
548}
549
550static int ath11k_ce_alloc_pipe(struct ath11k_base *ab, int ce_id)
551{
552 struct ath11k_ce_pipe *pipe = &ab->ce.ce_pipe[ce_id];
504 ath11k_ce_srng_msi_ring_params_setup(ab, ce_id, &params);
505
506 ce_ring->hal_ring_id = ret;
507
508 return 0;
509}
510
511static struct ath11k_ce_ring *

--- 31 unchanged lines hidden (view full) ---

543 CE_DESC_RING_ALIGN);
544
545 return ce_ring;
546}
547
548static int ath11k_ce_alloc_pipe(struct ath11k_base *ab, int ce_id)
549{
550 struct ath11k_ce_pipe *pipe = &ab->ce.ce_pipe[ce_id];
553 const struct ce_attr *attr = &host_ce_config_wlan[ce_id];
551 const struct ce_attr *attr = &ab->hw_params.host_ce_config[ce_id];
554 struct ath11k_ce_ring *ring;
555 int nentries;
556 int desc_sz;
557
558 pipe->attr_flags = attr->flags;
559
560 if (attr->src_nentries) {
561 pipe->send_cb = ath11k_ce_send_done_cb;

--- 310 unchanged lines hidden (view full) ---

872 struct ath11k_ce_pipe *pipe;
873 int i;
874 int ret;
875 const struct ce_attr *attr;
876
877 spin_lock_init(&ab->ce.ce_lock);
878
879 for (i = 0; i < CE_COUNT; i++) {
552 struct ath11k_ce_ring *ring;
553 int nentries;
554 int desc_sz;
555
556 pipe->attr_flags = attr->flags;
557
558 if (attr->src_nentries) {
559 pipe->send_cb = ath11k_ce_send_done_cb;

--- 310 unchanged lines hidden (view full) ---

870 struct ath11k_ce_pipe *pipe;
871 int i;
872 int ret;
873 const struct ce_attr *attr;
874
875 spin_lock_init(&ab->ce.ce_lock);
876
877 for (i = 0; i < CE_COUNT; i++) {
880 attr = &host_ce_config_wlan[i];
878 attr = &ab->hw_params.host_ce_config[i];
881 pipe = &ab->ce.ce_pipe[i];
882 pipe->pipe_num = i;
883 pipe->ab = ab;
884 pipe->buf_sz = attr->src_sz_max;
885
886 ret = ath11k_ce_alloc_pipe(ab, i);
887 if (ret) {
888 /* Free any parial successful allocation */

--- 25 unchanged lines hidden (view full) ---

914 }
915}
916
917int ath11k_ce_get_attr_flags(struct ath11k_base *ab, int ce_id)
918{
919 if (ce_id >= CE_COUNT)
920 return -EINVAL;
921
879 pipe = &ab->ce.ce_pipe[i];
880 pipe->pipe_num = i;
881 pipe->ab = ab;
882 pipe->buf_sz = attr->src_sz_max;
883
884 ret = ath11k_ce_alloc_pipe(ab, i);
885 if (ret) {
886 /* Free any parial successful allocation */

--- 25 unchanged lines hidden (view full) ---

912 }
913}
914
915int ath11k_ce_get_attr_flags(struct ath11k_base *ab, int ce_id)
916{
917 if (ce_id >= CE_COUNT)
918 return -EINVAL;
919
922 return host_ce_config_wlan[ce_id].flags;
920 return ab->hw_params.host_ce_config[ce_id].flags;
923}
924EXPORT_SYMBOL(ath11k_ce_get_attr_flags);
921}
922EXPORT_SYMBOL(ath11k_ce_get_attr_flags);