From 1039ae6642d89c401c3d186a2562306fb8f763e9 Mon Sep 17 00:00:00 2001 From: Nandha Kishore Easwaran Date: Mon, 30 Mar 2020 16:32:34 +0530 Subject: [PATCH] qcacmn: Support for IPQ8074 2G PHYB mode 2/3 This mode is supported through hw_mode_id 7. A special mode for IPQ8074 platform alone to bring up single pdev alone on 2G mode. FW would advertise the mode 7 support through the WMI service ready message and this mode will be the default mode for AP-HK10 alone. Added preferred_hw_mode and target_pdev_id into dp structures so that they can be used to configure the dp rings for this particular mode. Also changed the lmac_id to target_pdev_id mapping for mode 7. Change-Id: I3aae46fea13132eebaf7d37cff68ef517253d229 --- dp/inc/cdp_txrx_cmn_struct.h | 3 +++ dp/wifi3.0/dp_internal.h | 25 ++++++++++++++++++++++--- dp/wifi3.0/dp_main.c | 12 +++++++++++- dp/wifi3.0/dp_types.h | 9 +++++++++ 4 files changed, 45 insertions(+), 4 deletions(-) diff --git a/dp/inc/cdp_txrx_cmn_struct.h b/dp/inc/cdp_txrx_cmn_struct.h index b0362850d2..3cd71f6e99 100644 --- a/dp/inc/cdp_txrx_cmn_struct.h +++ b/dp/inc/cdp_txrx_cmn_struct.h @@ -1156,6 +1156,7 @@ typedef union cdp_config_param_t { /* psoc params */ bool cdp_psoc_param_en_rate_stats; int cdp_psoc_param_en_nss_cfg; + int cdp_psoc_param_preferred_hw_mode; } cdp_config_param_type; /** @@ -1257,10 +1258,12 @@ enum cdp_vdev_param_type { * to set values in psoc * @CDP_ENABLE_RATE_STATS: set rate stats enable/disable * @CDP_SET_NSS_CFG: set nss cfg + * @CDP_SET_PREFERRED_HW_MODE: set preferred hw mode */ enum cdp_psoc_param_type { CDP_ENABLE_RATE_STATS, CDP_SET_NSS_CFG, + CDP_SET_PREFERRED_HW_MODE, }; #define TXRX_FW_STATS_TXSTATS 1 diff --git a/dp/wifi3.0/dp_internal.h b/dp/wifi3.0/dp_internal.h index 9160f2fa57..6da00e77ba 100644 --- a/dp/wifi3.0/dp_internal.h +++ b/dp/wifi3.0/dp_internal.h @@ -1405,8 +1405,8 @@ static inline struct dp_pdev * } /** - * dp_get_target_pdev_id_for_host_pdev_id() - Return target pdev corresponding - * to host pdev id + * dp_calculate_target_pdev_id_from_host_pdev_id() - Return target pdev + * corresponding to host pdev id * @soc: soc pointer * @mac_for_pdev: pdev_id corresponding to host pdev for WIN, mac id for MCL * @@ -1419,7 +1419,7 @@ static inline struct dp_pdev * * For MCL, return the offset-1 translated mac_id */ static inline int -dp_get_target_pdev_id_for_host_pdev_id +dp_calculate_target_pdev_id_from_host_pdev_id (struct dp_soc *soc, uint32_t mac_for_pdev) { struct dp_pdev *pdev; @@ -1433,6 +1433,25 @@ dp_get_target_pdev_id_for_host_pdev_id return wlan_cfg_get_target_pdev_id(soc->wlan_cfg_ctx, pdev->lmac_id); } +/** + * dp_get_target_pdev_id_for_host_pdev_id() - Return target pdev corresponding + * to host pdev id + * @soc: soc pointer + * @mac_for_pdev: pdev_id corresponding to host pdev for WIN, mac id for MCL + * + * returns target pdev_id for host pdev id. + * For WIN, return the value stored in pdev object. + * For MCL, return the offset-1 translated mac_id. + */ +static inline int +dp_get_target_pdev_id_for_host_pdev_id + (struct dp_soc *soc, uint32_t mac_for_pdev) +{ + struct dp_pdev *pdev = soc->pdev_list[mac_for_pdev]; + + return pdev->target_pdev_id; +} + /** * dp_get_host_pdev_id_for_target_pdev_id() - Return host pdev corresponding * to target pdev id diff --git a/dp/wifi3.0/dp_main.c b/dp/wifi3.0/dp_main.c index 3f345be315..d0447985b3 100644 --- a/dp/wifi3.0/dp_main.c +++ b/dp/wifi3.0/dp_main.c @@ -3764,6 +3764,14 @@ static inline QDF_STATUS dp_pdev_attach_wifi3(struct cdp_soc_t *txrx_soc, pdev->lmac_id = wlan_cfg_get_hw_mac_idx(soc->wlan_cfg_ctx, pdev_id); soc->pdev_count++; + pdev->target_pdev_id = + dp_calculate_target_pdev_id_from_host_pdev_id(soc, pdev_id); + + if (soc->preferred_hw_mode == WMI_HOST_HW_MODE_2G_PHYB && + pdev->lmac_id == PHYB_2G_LMAC_ID) { + pdev->target_pdev_id = PHYB_2G_TARGET_PDEV_ID; + } + TAILQ_INIT(&pdev->vdev_list); qdf_spinlock_create(&pdev->vdev_list_lock); pdev->vdev_count = 0; @@ -8616,7 +8624,9 @@ dp_set_psoc_param(struct cdp_soc_t *cdp_soc, QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_INFO, FL("nss-wifi<0> nss config is enabled")); break; - + case CDP_SET_PREFERRED_HW_MODE: + soc->preferred_hw_mode = val.cdp_psoc_param_preferred_hw_mode; + break; default: break; } diff --git a/dp/wifi3.0/dp_types.h b/dp/wifi3.0/dp_types.h index f8d644c6ef..ee0d8abe84 100644 --- a/dp/wifi3.0/dp_types.h +++ b/dp/wifi3.0/dp_types.h @@ -110,6 +110,10 @@ #define REO_CMD_EVENT_HIST_MAX 64 +/* 2G PHYB */ +#define PHYB_2G_LMAC_ID 2 +#define PHYB_2G_TARGET_PDEV_ID 2 + #ifndef REMOVE_PKT_LOG enum rx_pktlog_mode { DP_RX_PKTLOG_DISABLED = 0, @@ -1260,6 +1264,8 @@ struct dp_soc { qdf_atomic_t num_tx_outstanding; /* Num Tx allowed */ uint32_t num_tx_allowed; + /* Preferred HW mode */ + uint8_t preferred_hw_mode; /** * Flag to indicate whether WAR to address single cache entry @@ -1487,6 +1493,9 @@ struct dp_pdev { /* LMAC Id */ int lmac_id; + /* Target pdev Id */ + int target_pdev_id; + /* TXRX SOC handle */ struct dp_soc *soc;