qcacmn: [1/2] Support both qca8074v1 and qca8074v2 from hal
Some of the macro names defined in qca8074v1, are defined with a slightly different name in qca8074v2, and few macros have the same name in both headers but are defined with different values. Fixed the same. Change-Id: I5e948baf5326d1d8fdfa2bd7ee8aa072c710d17c
This commit is contained in:

committed by
nshrivas

parent
31c991610b
commit
5d80641550
@@ -1,31 +1,21 @@
|
||||
/*
|
||||
* Copyright (c) 2016-2018 The Linux Foundation. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
* met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above
|
||||
* copyright notice, this list of conditions and the following
|
||||
* disclaimer in the documentation and/or other materials provided
|
||||
* with the distribution.
|
||||
* * Neither the name of The Linux Foundation nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
* Permission to use, copy, modify, and/or distribute this software for
|
||||
* any purpose with or without fee is hereby granted, provided that the
|
||||
* above copyright notice and this permission notice appear in all
|
||||
* copies.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
|
||||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
||||
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
||||
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
|
||||
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
|
||||
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
|
||||
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
|
||||
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
|
||||
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
||||
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "hal_hw_headers.h"
|
||||
#include "hal_api.h"
|
||||
#include "target_type.h"
|
||||
@@ -37,6 +27,9 @@ void hal_qca6290_attach(struct hal_soc *hal);
|
||||
#ifdef QCA_WIFI_QCA8074
|
||||
void hal_qca8074_attach(struct hal_soc *hal);
|
||||
#endif
|
||||
#ifdef QCA_WIFI_QCA8074V2
|
||||
void hal_qca8074v2_attach(struct hal_soc *hal);
|
||||
#endif
|
||||
#ifdef QCA_WIFI_QCA6390
|
||||
void hal_qca6390_attach(struct hal_soc *hal);
|
||||
#endif
|
||||
@@ -220,7 +213,6 @@ static void hal_target_based_configure(struct hal_soc *hal)
|
||||
switch (hal->target_type) {
|
||||
#ifdef QCA_WIFI_QCA6290
|
||||
case TARGET_TYPE_QCA6290:
|
||||
case TARGET_TYPE_QCA6390:
|
||||
hal->use_register_windowing = true;
|
||||
hal_qca6290_attach(hal);
|
||||
break;
|
||||
@@ -236,6 +228,12 @@ static void hal_target_based_configure(struct hal_soc *hal)
|
||||
hal_qca8074_attach(hal);
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if defined(QCA_WIFI_QCA8074V2) && defined(CONFIG_WIN)
|
||||
case TARGET_TYPE_QCA8074V2:
|
||||
hal_qca8074v2_attach(hal);
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -369,121 +367,6 @@ extern void hal_detach(void *hal_soc)
|
||||
}
|
||||
qdf_export_symbol(hal_detach);
|
||||
|
||||
/**
|
||||
* hal_srng_src_hw_init - Private function to initialize SRNG
|
||||
* source ring HW
|
||||
* @hal_soc: HAL SOC handle
|
||||
* @srng: SRNG ring pointer
|
||||
*/
|
||||
static inline void hal_srng_src_hw_init(struct hal_soc *hal,
|
||||
struct hal_srng *srng)
|
||||
{
|
||||
uint32_t reg_val = 0;
|
||||
uint64_t tp_addr = 0;
|
||||
|
||||
HIF_DBG("%s: hw_init srng %d", __func__, srng->ring_id);
|
||||
|
||||
if (srng->flags & HAL_SRNG_MSI_INTR) {
|
||||
SRNG_SRC_REG_WRITE(srng, MSI1_BASE_LSB,
|
||||
srng->msi_addr & 0xffffffff);
|
||||
reg_val = SRNG_SM(SRNG_SRC_FLD(MSI1_BASE_MSB, ADDR),
|
||||
(uint64_t)(srng->msi_addr) >> 32) |
|
||||
SRNG_SM(SRNG_SRC_FLD(MSI1_BASE_MSB,
|
||||
MSI1_ENABLE), 1);
|
||||
SRNG_SRC_REG_WRITE(srng, MSI1_BASE_MSB, reg_val);
|
||||
SRNG_SRC_REG_WRITE(srng, MSI1_DATA, srng->msi_data);
|
||||
}
|
||||
|
||||
SRNG_SRC_REG_WRITE(srng, BASE_LSB, srng->ring_base_paddr & 0xffffffff);
|
||||
reg_val = SRNG_SM(SRNG_SRC_FLD(BASE_MSB, RING_BASE_ADDR_MSB),
|
||||
((uint64_t)(srng->ring_base_paddr) >> 32)) |
|
||||
SRNG_SM(SRNG_SRC_FLD(BASE_MSB, RING_SIZE),
|
||||
srng->entry_size * srng->num_entries);
|
||||
SRNG_SRC_REG_WRITE(srng, BASE_MSB, reg_val);
|
||||
|
||||
#if defined(WCSS_VERSION) && \
|
||||
((defined(CONFIG_WIN) && (WCSS_VERSION > 81)) || \
|
||||
(defined(CONFIG_MCL) && (WCSS_VERSION >= 72)))
|
||||
reg_val = SRNG_SM(SRNG_SRC_FLD(ID, ENTRY_SIZE), srng->entry_size);
|
||||
#else
|
||||
reg_val = SRNG_SM(SRNG_SRC_FLD(ID, RING_ID), srng->ring_id) |
|
||||
SRNG_SM(SRNG_SRC_FLD(ID, ENTRY_SIZE), srng->entry_size);
|
||||
#endif
|
||||
SRNG_SRC_REG_WRITE(srng, ID, reg_val);
|
||||
|
||||
/**
|
||||
* Interrupt setup:
|
||||
* Default interrupt mode is 'pulse'. Need to setup SW_INTERRUPT_MODE
|
||||
* if level mode is required
|
||||
*/
|
||||
reg_val = 0;
|
||||
|
||||
/*
|
||||
* WAR - Hawkeye v1 has a hardware bug which requires timer value to be
|
||||
* programmed in terms of 1us resolution instead of 8us resolution as
|
||||
* given in MLD.
|
||||
*/
|
||||
if (srng->intr_timer_thres_us) {
|
||||
reg_val |= SRNG_SM(SRNG_SRC_FLD(CONSUMER_INT_SETUP_IX0,
|
||||
INTERRUPT_TIMER_THRESHOLD),
|
||||
srng->intr_timer_thres_us);
|
||||
/* For HK v2 this should be (srng->intr_timer_thres_us >> 3) */
|
||||
}
|
||||
|
||||
if (srng->intr_batch_cntr_thres_entries) {
|
||||
reg_val |= SRNG_SM(SRNG_SRC_FLD(CONSUMER_INT_SETUP_IX0,
|
||||
BATCH_COUNTER_THRESHOLD),
|
||||
srng->intr_batch_cntr_thres_entries *
|
||||
srng->entry_size);
|
||||
}
|
||||
SRNG_SRC_REG_WRITE(srng, CONSUMER_INT_SETUP_IX0, reg_val);
|
||||
|
||||
reg_val = 0;
|
||||
if (srng->flags & HAL_SRNG_LOW_THRES_INTR_ENABLE) {
|
||||
reg_val |= SRNG_SM(SRNG_SRC_FLD(CONSUMER_INT_SETUP_IX1,
|
||||
LOW_THRESHOLD), srng->u.src_ring.low_threshold);
|
||||
}
|
||||
|
||||
SRNG_SRC_REG_WRITE(srng, CONSUMER_INT_SETUP_IX1, reg_val);
|
||||
|
||||
/* As per HW team, TP_ADDR and HP_ADDR for Idle link ring should
|
||||
* remain 0 to avoid some WBM stability issues. Remote head/tail
|
||||
* pointers are not required since this ring is completely managed
|
||||
* by WBM HW */
|
||||
if (srng->ring_id != HAL_SRNG_WBM_IDLE_LINK) {
|
||||
tp_addr = (uint64_t)(hal->shadow_rdptr_mem_paddr +
|
||||
((unsigned long)(srng->u.src_ring.tp_addr) -
|
||||
(unsigned long)(hal->shadow_rdptr_mem_vaddr)));
|
||||
SRNG_SRC_REG_WRITE(srng, TP_ADDR_LSB, tp_addr & 0xffffffff);
|
||||
SRNG_SRC_REG_WRITE(srng, TP_ADDR_MSB, tp_addr >> 32);
|
||||
}
|
||||
|
||||
/* Initilaize head and tail pointers to indicate ring is empty */
|
||||
SRNG_SRC_REG_WRITE(srng, HP, 0);
|
||||
SRNG_SRC_REG_WRITE(srng, TP, 0);
|
||||
*(srng->u.src_ring.tp_addr) = 0;
|
||||
|
||||
reg_val = ((srng->flags & HAL_SRNG_DATA_TLV_SWAP) ?
|
||||
SRNG_SM(SRNG_SRC_FLD(MISC, DATA_TLV_SWAP_BIT), 1) : 0) |
|
||||
((srng->flags & HAL_SRNG_RING_PTR_SWAP) ?
|
||||
SRNG_SM(SRNG_SRC_FLD(MISC, HOST_FW_SWAP_BIT), 1) : 0) |
|
||||
((srng->flags & HAL_SRNG_MSI_SWAP) ?
|
||||
SRNG_SM(SRNG_SRC_FLD(MISC, MSI_SWAP_BIT), 1) : 0);
|
||||
|
||||
/* Loop count is not used for SRC rings */
|
||||
reg_val |= SRNG_SM(SRNG_SRC_FLD(MISC, LOOPCNT_DISABLE), 1);
|
||||
|
||||
/*
|
||||
* reg_val |= SRNG_SM(SRNG_SRC_FLD(MISC, SRNG_ENABLE), 1);
|
||||
* todo: update fw_api and replace with above line
|
||||
* (when SRNG_ENABLE field for the MISC register is available in fw_api)
|
||||
* (WCSS_UMAC_CE_0_SRC_WFSS_CE_CHANNEL_SRC_R0_SRC_RING_MISC)
|
||||
*/
|
||||
reg_val |= 0x40;
|
||||
|
||||
SRNG_SRC_REG_WRITE(srng, MISC, reg_val);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* hal_ce_dst_setup - Initialize CE destination ring registers
|
||||
@@ -554,93 +437,6 @@ void hal_srng_dst_init_hp(struct hal_srng *srng,
|
||||
*(srng->u.dst_ring.hp_addr));
|
||||
}
|
||||
|
||||
/**
|
||||
* hal_srng_dst_hw_init - Private function to initialize SRNG
|
||||
* destination ring HW
|
||||
* @hal_soc: HAL SOC handle
|
||||
* @srng: SRNG ring pointer
|
||||
*/
|
||||
static inline void hal_srng_dst_hw_init(struct hal_soc *hal,
|
||||
struct hal_srng *srng)
|
||||
{
|
||||
uint32_t reg_val = 0;
|
||||
uint64_t hp_addr = 0;
|
||||
|
||||
HIF_DBG("%s: hw_init srng %d", __func__, srng->ring_id);
|
||||
|
||||
if (srng->flags & HAL_SRNG_MSI_INTR) {
|
||||
SRNG_DST_REG_WRITE(srng, MSI1_BASE_LSB,
|
||||
srng->msi_addr & 0xffffffff);
|
||||
reg_val = SRNG_SM(SRNG_DST_FLD(MSI1_BASE_MSB, ADDR),
|
||||
(uint64_t)(srng->msi_addr) >> 32) |
|
||||
SRNG_SM(SRNG_DST_FLD(MSI1_BASE_MSB,
|
||||
MSI1_ENABLE), 1);
|
||||
SRNG_DST_REG_WRITE(srng, MSI1_BASE_MSB, reg_val);
|
||||
SRNG_DST_REG_WRITE(srng, MSI1_DATA, srng->msi_data);
|
||||
}
|
||||
|
||||
SRNG_DST_REG_WRITE(srng, BASE_LSB, srng->ring_base_paddr & 0xffffffff);
|
||||
reg_val = SRNG_SM(SRNG_DST_FLD(BASE_MSB, RING_BASE_ADDR_MSB),
|
||||
((uint64_t)(srng->ring_base_paddr) >> 32)) |
|
||||
SRNG_SM(SRNG_DST_FLD(BASE_MSB, RING_SIZE),
|
||||
srng->entry_size * srng->num_entries);
|
||||
SRNG_DST_REG_WRITE(srng, BASE_MSB, reg_val);
|
||||
|
||||
reg_val = SRNG_SM(SRNG_DST_FLD(ID, RING_ID), srng->ring_id) |
|
||||
SRNG_SM(SRNG_DST_FLD(ID, ENTRY_SIZE), srng->entry_size);
|
||||
SRNG_DST_REG_WRITE(srng, ID, reg_val);
|
||||
|
||||
|
||||
/**
|
||||
* Interrupt setup:
|
||||
* Default interrupt mode is 'pulse'. Need to setup SW_INTERRUPT_MODE
|
||||
* if level mode is required
|
||||
*/
|
||||
reg_val = 0;
|
||||
if (srng->intr_timer_thres_us) {
|
||||
reg_val |= SRNG_SM(SRNG_DST_FLD(PRODUCER_INT_SETUP,
|
||||
INTERRUPT_TIMER_THRESHOLD),
|
||||
srng->intr_timer_thres_us >> 3);
|
||||
}
|
||||
|
||||
if (srng->intr_batch_cntr_thres_entries) {
|
||||
reg_val |= SRNG_SM(SRNG_DST_FLD(PRODUCER_INT_SETUP,
|
||||
BATCH_COUNTER_THRESHOLD),
|
||||
srng->intr_batch_cntr_thres_entries *
|
||||
srng->entry_size);
|
||||
}
|
||||
|
||||
SRNG_DST_REG_WRITE(srng, PRODUCER_INT_SETUP, reg_val);
|
||||
hp_addr = (uint64_t)(hal->shadow_rdptr_mem_paddr +
|
||||
((unsigned long)(srng->u.dst_ring.hp_addr) -
|
||||
(unsigned long)(hal->shadow_rdptr_mem_vaddr)));
|
||||
SRNG_DST_REG_WRITE(srng, HP_ADDR_LSB, hp_addr & 0xffffffff);
|
||||
SRNG_DST_REG_WRITE(srng, HP_ADDR_MSB, hp_addr >> 32);
|
||||
|
||||
/* Initilaize head and tail pointers to indicate ring is empty */
|
||||
SRNG_DST_REG_WRITE(srng, HP, 0);
|
||||
SRNG_DST_REG_WRITE(srng, TP, 0);
|
||||
*(srng->u.dst_ring.hp_addr) = 0;
|
||||
|
||||
reg_val = ((srng->flags & HAL_SRNG_DATA_TLV_SWAP) ?
|
||||
SRNG_SM(SRNG_DST_FLD(MISC, DATA_TLV_SWAP_BIT), 1) : 0) |
|
||||
((srng->flags & HAL_SRNG_RING_PTR_SWAP) ?
|
||||
SRNG_SM(SRNG_DST_FLD(MISC, HOST_FW_SWAP_BIT), 1) : 0) |
|
||||
((srng->flags & HAL_SRNG_MSI_SWAP) ?
|
||||
SRNG_SM(SRNG_DST_FLD(MISC, MSI_SWAP_BIT), 1) : 0);
|
||||
|
||||
/*
|
||||
* reg_val |= SRNG_SM(SRNG_SRC_FLD(MISC, SRNG_ENABLE), 1);
|
||||
* todo: update fw_api and replace with above line
|
||||
* (when SRNG_ENABLE field for the MISC register is available in fw_api)
|
||||
* (WCSS_UMAC_CE_0_SRC_WFSS_CE_CHANNEL_SRC_R0_SRC_RING_MISC)
|
||||
*/
|
||||
reg_val |= 0x40;
|
||||
|
||||
SRNG_DST_REG_WRITE(srng, MISC, reg_val);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* hal_srng_hw_init - Private function to initialize SRNG HW
|
||||
* @hal_soc: HAL SOC handle
|
||||
|
Reference in New Issue
Block a user