preparation for IPQ6018 support
cover preparation for IPQ6018 support
Here are some preparation patches for IPQ6018. Some of the patches are from Anil's patchset "ath11k: Add IPQ6018 support" which I modifies and I did some refactoring and cleanup on top.
All patches are compile tested only.
Anilkumar Kolli (5):
ath11k: ahb: call ath11k_core_init() before irq configuration
ath11k: convert ath11k_hw_params to an array
ath11k: define max_radios in hw_params
ath11k: add hw_ops for pdev id to hw_mac mapping
ath11k: Add bdf-addr in hw_params
Kalle Valo (7):
ath11k: create a common function to request all firmware files
ath11k: don't use defines for hw specific firmware directories
ath11k: change ath11k_core_fetch_board_data_api_n() to use
ath11k_core_create_firmware_path()
ath11k: remove useless info messages
ath11k: qmi: cleanup info messages
ath11k: don't use defines in hw_params
ath11k: remove define ATH11K_QMI_DEFAULT_CAL_FILE_NAME
drivers/net/wireless/ath/ath11k/Makefile | 3 +- drivers/net/wireless/ath/ath11k/ahb.c | 23 +++--- drivers/net/wireless/ath/ath11k/core.c | 115 ++++++++++++++++------------- drivers/net/wireless/ath/ath11k/core.h | 12 ++- drivers/net/wireless/ath/ath11k/dp_rx.c | 2 +- drivers/net/wireless/ath/ath11k/htc.c | 2 +- drivers/net/wireless/ath/ath11k/hw.c | 34 +++++++++ drivers/net/wireless/ath/ath11k/hw.h | 28 +++++-- drivers/net/wireless/ath/ath11k/mac.c | 10 +-- drivers/net/wireless/ath/ath11k/peer.c | 3 - drivers/net/wireless/ath/ath11k/qmi.c | 22 ++---- drivers/net/wireless/ath/ath11k/qmi.h | 2 - drivers/net/wireless/ath/ath11k/reg.c | 2 +- drivers/net/wireless/ath/ath11k/spectral.c | 8 +- drivers/net/wireless/ath/ath11k/wmi.c | 4 +- 15 files changed, 163 insertions(+), 107 deletions(-) create mode 100644 drivers/net/wireless/ath/ath11k/hw.c
Signature · 7 lines
2.7.4 _______________________________________________ ath11k mailing list [email protected] http://lists.infradead.org/mailman/listinfo/ath11k
PATCH 1/12 ath11k: ahb: call ath11k_core_init() before irq configuration
From: Anilkumar Kolli <[email protected]>
This is needed to init .max_radios in hw_params and onfigure external interrupts for available pdev_ids.
Compile tested only.
--- drivers/net/wireless/ath/ath11k/ahb.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/net/wireless/ath/ath11k/ahb.c +4 -4
@@ -951,15 +951,15 @@ static int ath11k_ahb_probe(struct platform_device *pdev)ath11k_ahb_init_qmi_ce_config (ab); - ret =ath11k_ahb_config_irq (ab); + ret =ath11k_core_init (ab);if (ret) { -ath11k_err (ab,"failed to configure irq: %d\n" , ret); +ath11k_err (ab,"failed to init core: %d\n" , ret); goto err_ce_free; } - ret =ath11k_core_init (ab); + ret =ath11k_ahb_config_irq (ab);if (ret) { -ath11k_err (ab,"failed to init core: %d\n" , ret); +ath11k_err (ab,"failed to configure irq: %d\n" , ret); goto err_ce_free; }
Signature · 7 lines
2.7.4 _______________________________________________ ath11k mailing list [email protected] http://lists.infradead.org/mailman/listinfo/ath11k
PATCH 5/12 ath11k: Add bdf-addr in hw_params
In reply to Kalle ValoFrom: Anilkumar Kolli <[email protected]>
bdf-addr is different for IPQ8074 and IPQ6018 so add it to hw_params.
No functional changes. Compile tested only.
--- drivers/net/wireless/ath/ath11k/core.c | 1 + drivers/net/wireless/ath/ath11k/hw.h | 2 ++ drivers/net/wireless/ath/ath11k/qmi.c | 6 +++--- drivers/net/wireless/ath/ath11k/qmi.h | 1 - 4 files changed, 6 insertions(+), 4 deletions(-)
drivers/net/wireless/ath/ath11k/core.c +1 -0
@@ -27,6 +27,7 @@ static const struct ath11k_hw_params ath11k_hw_params[] = { .cal_size = IPQ8074_MAX_CAL_DATA_SZ, }, .max_radios = 3, + .bdf_addr = 0x4B0C0000, .hw_ops = &ipq8074_ops, }, };
drivers/net/wireless/ath/ath11k/hw.h +2 -0
@@ -112,6 +112,8 @@ struct ath11k_hw_params {const char *name;u16 hw_rev;u8 max_radios; +u32 bdf_addr; +struct {const char *dir;size_t board_size;
drivers/net/wireless/ath/ath11k/qmi.c +3 -3
@@ -1681,8 +1681,8 @@ static int ath11k_qmi_alloc_target_mem_chunk(struct ath11k_base *ab)for (i =0 , idx =0 ; i < ab->qmi.mem_seg_count; i++) {switch (ab->qmi.target_mem[i].type) {case BDF_MEM_REGION_TYPE : - ab->qmi.target_mem[idx].paddr =ATH11K_QMI_BDF_ADDRESS ; - ab->qmi.target_mem[idx].vaddr =ATH11K_QMI_BDF_ADDRESS ; + ab->qmi.target_mem[idx].paddr = ab->hw_params.bdf_addr; + ab->qmi.target_mem[idx].vaddr = ab->hw_params.bdf_addr; ab->qmi.target_mem[idx].size = ab->qmi.target_mem[i].size; ab->qmi.target_mem[idx].type = ab->qmi.target_mem[i].type; idx++;
@@ -1854,7 +1854,7 @@ static int ath11k_qmi_load_bdf(struct ath11k_base *ab)return -ENOMEM ;memset (&resp,0 ,sizeof (resp)); - bdf_addr =ioremap (ATH11K_QMI_BDF_ADDRESS ,ATH11K_QMI_BDF_MAX_SIZE ); + bdf_addr =ioremap (ab->hw_params.bdf_addr,ATH11K_QMI_BDF_MAX_SIZE );if (!bdf_addr) {ath11k_warn (ab,"qmi ioremap error for BDF\n" ); ret = -EIO ;
drivers/net/wireless/ath/ath11k/qmi.h +0 -1
@@ -12,7 +12,6 @@#define ATH11K_HOST_VERSION_STRING "WIN"#define ATH11K_QMI_WLANFW_TIMEOUT_MS 5000#define ATH11K_QMI_MAX_BDF_FILE_NAME_SIZE 64 -#define ATH11K_QMI_BDF_ADDRESS 0x4B0C0000#define ATH11K_QMI_BDF_MAX_SIZE (256 * 1024)#define ATH11K_QMI_CALDATA_OFFSET (128 * 1024)#define ATH11K_QMI_WLANFW_MAX_BUILD_ID_LEN_V01 128
Signature · 1 line
2.7.4
PATCH 4/12 ath11k: add hw_ops for pdev id to hw_mac mapping
In reply to Kalle ValoFrom: Anilkumar Kolli <[email protected]>
pdev_id to hw_mac is different for ipq8074 and ipq6018 Below table has the mapping
pdev_id ipq8074 ipq6018
------- ------- -------
0 0 0
1 2 1
2 1 Not applicable
No functional changes. Compile tested only.
--- drivers/net/wireless/ath/ath11k/Makefile | 3 ++- drivers/net/wireless/ath/ath11k/ahb.c | 15 +++++++------- drivers/net/wireless/ath/ath11k/core.c | 18 +---------------- drivers/net/wireless/ath/ath11k/core.h | 1 - drivers/net/wireless/ath/ath11k/hw.c | 34 ++++++++++++++++++++++++++++++++ drivers/net/wireless/ath/ath11k/hw.h | 19 ++++++++++++++++++ drivers/net/wireless/ath/ath11k/mac.c | 2 +- 7 files changed, 65 insertions(+), 27 deletions(-) create mode 100644 drivers/net/wireless/ath/ath11k/hw.c
drivers/net/wireless/ath/ath11k/Makefile +2 -1
@@ -16,7 +16,8 @@ ath11k-y += core.o \ debug.o \ ce.o \ peer.o \ - dbring.o + dbring.o \ + hw.o ath11k-$(CONFIG_ATH11K_DEBUGFS) += debug_htt_stats.o debugfs_sta.o ath11k-$(CONFIG_NL80211_TESTMODE) += testmode.o
drivers/net/wireless/ath/ath11k/ahb.c +8 -7
@@ -734,6 +734,7 @@ static irqreturn_t ath11k_ahb_ext_interrupt_handler(int irq, void *arg)static int ath11k_ahb_ext_irq_config (struct ath11k_base *ab) { +struct ath11k_hw_params *hw = &ab->hw_params;int i, j;int irq;int ret;
@@ -768,26 +769,26 @@ static int ath11k_ahb_ext_irq_config(struct ath11k_base *ab)if (ath11k_reo_status_ring_mask[i] &BIT (j)) irq_grp->irqs[num_irq++] = reo2host_status; -if (j <MAX_RADIOS ) { +if (j < ab->hw_params.max_radios) {if (ath11k_rxdma2host_ring_mask[i] &BIT (j)) { irq_grp->irqs[num_irq++] = - rxdma2host_destination_ring_mac1 - -ath11k_core_get_hw_mac_id (ab, j); + rxdma2host_destination_ring_mac1 - +ath11k_hw_get_mac_from_pdev_id (hw, j); }if (ath11k_host2rxdma_ring_mask[i] &BIT (j)) { irq_grp->irqs[num_irq++] = - host2rxdma_host_buf_ring_mac1 - -ath11k_core_get_hw_mac_id (ab, j); + host2rxdma_host_buf_ring_mac1 - +ath11k_hw_get_mac_from_pdev_id (hw, j); }if (rx_mon_status_ring_mask[i] &BIT (j)) { irq_grp->irqs[num_irq++] = ppdu_end_interrupts_mac1 - -ath11k_core_get_hw_mac_id (ab, j); +ath11k_hw_get_mac_from_pdev_id (hw, j); irq_grp->irqs[num_irq++] = rxdma2host_monitor_status_ring_mac1 - -ath11k_core_get_hw_mac_id (ab, j); +ath11k_hw_get_mac_from_pdev_id (hw, j); } } }
drivers/net/wireless/ath/ath11k/core.c +1 -17
@@ -27,26 +27,10 @@ static const struct ath11k_hw_params ath11k_hw_params[] = { .cal_size = IPQ8074_MAX_CAL_DATA_SZ, }, .max_radios = 3, + .hw_ops = &ipq8074_ops, }, }; -/* Map from pdev index to hw mac index */ -u8 ath11k_core_get_hw_mac_id (struct ath11k_base *ab,int pdev_idx) -{ -switch (pdev_idx) { -case 0 : -return 0 ; -case 1 : -return 2 ; -case 2 : -return 1 ; -default : -ath11k_warn (ab,"Invalid pdev idx %d\n" , pdev_idx); -return ATH11K_INVALID_HW_MAC_ID ; - } -} -EXPORT_SYMBOL (ath11k_core_get_hw_mac_id); -static int ath11k_core_create_board_name (struct ath11k_base *ab,char *name,size_t name_len) {
drivers/net/wireless/ath/ath11k/core.h +0 -1
@@ -860,7 +860,6 @@ int ath11k_core_fetch_bdf(struct ath11k_base *ath11k,void ath11k_core_free_bdf (struct ath11k_base *ab,struct ath11k_board_data *bd);void ath11k_core_halt (struct ath11k *ar); -u8 ath11k_core_get_hw_mac_id (struct ath11k_base *ab,int pdev_idx);static inline const char *ath11k_scan_state_str (enum ath11k_scan_state state) {
drivers/net/wireless/ath/ath11k/hw.c new file +34 -0
@@ -0,0 +1,34 @@ +// SPDX-License-Identifier: BSD-3-Clause-Clear +/* +* Copyright (c) 2018-2020 The Linux Foundation. All rights reserved. +*/ + +#include "core.h" + +/* Map from pdev index to hw mac index */ +static u8 ath11k_hw_ipq8074_mac_from_pdev_id (int pdev_idx) +{ +switch (pdev_idx) { +case 0 : +return 0 ; +case 1 : +return 2 ; +case 2 : +return 1 ; +default : +return ATH11K_INVALID_HW_MAC_ID ; + } +} + +static u8 ath11k_hw_ipq6018_mac_from_pdev_id (int pdev_idx) +{ +return pdev_idx; +} + +const struct ath11k_hw_ops ipq8074_ops = { + .get_hw_mac_from_pdev_id = ath11k_hw_ipq8074_mac_from_pdev_id, +}; + +const struct ath11k_hw_ops ipq6018_ops = { + .get_hw_mac_from_pdev_id = ath11k_hw_ipq6018_mac_from_pdev_id, +};
drivers/net/wireless/ath/ath11k/hw.h +19 -0
@@ -104,6 +104,10 @@ enum ath11k_bus { ATH11K_BUS_PCI, }; +struct ath11k_hw_ops { +u8 (*get_hw_mac_from_pdev_id)(int pdev_id); +}; +struct ath11k_hw_params {const char *name;u16 hw_rev;
@@ -113,8 +117,23 @@ struct ath11k_hw_params {size_t board_size;size_t cal_size; } fw; + +const struct ath11k_hw_ops *hw_ops; }; +extern const struct ath11k_hw_ops ipq8074_ops; +extern const struct ath11k_hw_ops ipq6018_ops; + +static inline +int ath11k_hw_get_mac_from_pdev_id (struct ath11k_hw_params *hw, +int pdev_idx) +{ +if (hw->hw_ops->get_hw_mac_from_pdev_id) +return hw->hw_ops->get_hw_mac_from_pdev_id (pdev_idx); + +return 0 ; +} +struct ath11k_fw_ie {__le32 id;__le32 len;
drivers/net/wireless/ath/ath11k/mac.c +1 -1
@@ -6194,7 +6194,7 @@ int ath11k_mac_allocate(struct ath11k_base *ab) ar->ab = ab; ar->pdev = pdev; ar->pdev_idx = i; - ar->lmac_id =ath11k_core_get_hw_mac_id (ab, i); + ar->lmac_id =ath11k_hw_get_mac_from_pdev_id (&ab->hw_params, i); ar->wmi = &ab->wmi_ab.wmi[i];/* FIXME wmi[0] is already initialized during attach,
Signature · 1 line
2.7.4
PATCH 6/12 ath11k: create a common function to request all firmware files
In reply to Kalle ValoTo avoid duplicating the logic how the full firmware path is created create a common function ath11k_core_firmware_request() and convert also qmi.c to use it.
Also remove a useless info print, it's more like a debug message anyway.
No functional changes. Compile tested only.
--- drivers/net/wireless/ath/ath11k/core.c | 27 +++++++++++++-------------- drivers/net/wireless/ath/ath11k/core.h | 4 ++++ drivers/net/wireless/ath/ath11k/qmi.c | 12 ++++-------- 3 files changed, 21 insertions(+), 22 deletions(-)
drivers/net/wireless/ath/ath11k/core.c +13 -14
@@ -48,9 +48,9 @@ static int ath11k_core_create_board_name(struct ath11k_base *ab, char *name,return 0 ; } -static const struct firmware *ath11k_fetch_fw_file (struct ath11k_base *ab, -const char *dir, -const char *file) +const struct firmware *ath11k_core_firmware_request (struct ath11k_base *ab, +const char *dir, +const char *file) {char filename[100 ];const struct firmware *fw;
@@ -63,14 +63,13 @@ static const struct firmware *ath11k_fetch_fw_file(struct ath11k_base *ab, dir ="." ;snprintf (filename,sizeof (filename),"%s/%s" , dir, file); - ret =firmware_request_nowarn (&fw, filename, ab->dev); -ath11k_dbg (ab,ATH11K_DBG_BOOT ,"boot fw request '%s': %d\n" , - filename, ret); + ret =firmware_request_nowarn (&fw, filename, ab->dev);if (ret)return ERR_PTR (ret); -ath11k_warn (ab,"Downloading BDF: %s, size: %zu\n" , - filename, fw->size); + +ath11k_dbg (ab,ATH11K_DBG_BOOT ,"boot firmware request %s size %zu\n" , + filename, fw->size);return fw; }
@@ -176,9 +175,9 @@ static int ath11k_core_fetch_board_data_api_n(struct ath11k_base *ab,int ret, ie_id;if (!bd->fw) - bd->fw =ath11k_fetch_fw_file (ab, - ab->hw_params.fw.dir, - filename); + bd->fw =ath11k_core_firmware_request (ab, + ab->hw_params.fw.dir, + filename);if (IS_ERR (bd->fw))return PTR_ERR (bd->fw);
@@ -268,9 +267,9 @@ static int ath11k_core_fetch_board_data_api_n(struct ath11k_base *ab,static int ath11k_core_fetch_board_data_api_1 (struct ath11k_base *ab,struct ath11k_board_data *bd) { - bd->fw =ath11k_fetch_fw_file (ab, - ab->hw_params.fw.dir, -ATH11K_DEFAULT_BOARD_FILE ); + bd->fw =ath11k_core_firmware_request (ab, + ab->hw_params.fw.dir, +ATH11K_DEFAULT_BOARD_FILE );if (IS_ERR (bd->fw))return PTR_ERR (bd->fw);
drivers/net/wireless/ath/ath11k/core.h +4 -0
@@ -861,6 +861,10 @@ void ath11k_core_free_bdf(struct ath11k_base *ab, struct ath11k_board_data *bd);void ath11k_core_halt (struct ath11k *ar); +const struct firmware *ath11k_core_firmware_request (struct ath11k_base *ab, +const char *dir, +const char *file); +static inline const char *ath11k_scan_state_str (enum ath11k_scan_state state) {switch (state) {
drivers/net/wireless/ath/ath11k/qmi.c +4 -8
@@ -1790,8 +1790,6 @@ ath11k_qmi_prepare_bdf_download(struct ath11k_base *ab, int type,struct qmi_wlanfw_bdf_download_req_msg_v01 *req, void __iomem *bdf_addr) { - struct device *dev = ab->dev; -char filename[ATH11K_QMI_MAX_BDF_FILE_NAME_SIZE ]; const struct firmware *fw_entry;struct ath11k_board_data bd;u32 fw_size;
@@ -1812,11 +1810,11 @@ ath11k_qmi_prepare_bdf_download(struct ath11k_base *ab, int type,ath11k_core_free_bdf (ab, &bd);break ;case ATH11K_QMI_FILE_TYPE_CALDATA : -snprintf (filename,sizeof (filename), -"%s/%s" , ab->hw_params.fw.dir,ATH11K_QMI_DEFAULT_CAL_FILE_NAME ); - ret =request_firmware (&fw_entry, filename, dev); + fw_entry =ath11k_core_firmware_request (ab, ab->hw_params.fw.dir, +ATH11K_QMI_DEFAULT_CAL_FILE_NAME );if (ret) { -ath11k_warn (ab,"qmi failed to load CAL: %s\n" , filename); +ath11k_warn (ab,"failed to load %s: %d\n" , +ATH11K_QMI_DEFAULT_CAL_FILE_NAME , ret); goto out; }
@@ -1825,8 +1823,6 @@ ath11k_qmi_prepare_bdf_download(struct ath11k_base *ab, int type,memcpy_toio (bdf_addr +ATH11K_QMI_CALDATA_OFFSET , fw_entry->data, fw_size); -ath11k_info (ab,"qmi downloading BDF: %s, size: %zu\n" , - filename, fw_entry->size);release_firmware (fw_entry);break ;
Signature · 1 line
2.7.4
PATCH 7/12 ath11k: don't use defines for hw specific firmware directories
In reply to Kalle ValoThe downside of using defines in struct ath11k_hw_params.fw.dir is that it's easy to get it wrong as the full path is not visible. So drop the use of defines and instead create the patch runtime using a static inline function ath11k_core_create_firmware_path(). Hopefully this reduces the chances of using incorrect firmware path.
No functional changes. Compile tested only.
--- drivers/net/wireless/ath/ath11k/core.c | 23 ++++++++--------------- drivers/net/wireless/ath/ath11k/core.h | 11 +++++++++-- drivers/net/wireless/ath/ath11k/hw.h | 1 - drivers/net/wireless/ath/ath11k/qmi.c | 2 +- 4 files changed, 18 insertions(+), 19 deletions(-)
drivers/net/wireless/ath/ath11k/core.c +8 -15
@@ -22,7 +22,7 @@ static const struct ath11k_hw_params ath11k_hw_params[] = { .hw_rev = ATH11K_HW_IPQ8074, .name = "ipq8074 hw2.0", .fw = { - .dir = IPQ8074_FW_DIR, + .dir = "IPQ8074/hw2.0", .board_size = IPQ8074_MAX_BOARD_DATA_SZ, .cal_size = IPQ8074_MAX_CAL_DATA_SZ, },
@@ -49,27 +49,23 @@ static int ath11k_core_create_board_name(struct ath11k_base *ab, char *name, }const struct firmware *ath11k_core_firmware_request (struct ath11k_base *ab, -const char *dir,const char *file) { -char filename[100 ];const struct firmware *fw; +char path[100 ];int ret;if (file ==NULL )return ERR_PTR (-ENOENT ); -if (dir ==NULL ) - dir ="." ; +ath11k_core_create_firmware_path (ab, file, path,sizeof (path)); -snprintf (filename,sizeof (filename),"%s/%s" , dir, file); - - ret =firmware_request_nowarn (&fw, filename, ab->dev); + ret =firmware_request_nowarn (&fw, path, ab->dev);if (ret)return ERR_PTR (ret);ath11k_dbg (ab,ATH11K_DBG_BOOT ,"boot firmware request %s size %zu\n" , - filename, fw->size); + path, fw->size);return fw; }
@@ -175,9 +171,8 @@ static int ath11k_core_fetch_board_data_api_n(struct ath11k_base *ab,int ret, ie_id;if (!bd->fw) - bd->fw =ath11k_core_firmware_request (ab, - ab->hw_params.fw.dir, - filename); + bd->fw =ath11k_core_firmware_request (ab, filename); +if (IS_ERR (bd->fw))return PTR_ERR (bd->fw);
@@ -267,9 +262,7 @@ static int ath11k_core_fetch_board_data_api_n(struct ath11k_base *ab,static int ath11k_core_fetch_board_data_api_1 (struct ath11k_base *ab,struct ath11k_board_data *bd) { - bd->fw =ath11k_core_firmware_request (ab, - ab->hw_params.fw.dir, -ATH11K_DEFAULT_BOARD_FILE ); + bd->fw =ath11k_core_firmware_request (ab,ATH11K_DEFAULT_BOARD_FILE );if (IS_ERR (bd->fw))return PTR_ERR (bd->fw);
drivers/net/wireless/ath/ath11k/core.h +9 -2
@@ -862,8 +862,7 @@ void ath11k_core_free_bdf(struct ath11k_base *ab, struct ath11k_board_data *bd);void ath11k_core_halt (struct ath11k *ar);const struct firmware *ath11k_core_firmware_request (struct ath11k_base *ab, -const char *dir, -const char *file); +const char *filename);static inline const char *ath11k_scan_state_str (enum ath11k_scan_state state) {
@@ -897,4 +896,12 @@ static inline struct ath11k_vif *ath11k_vif_to_arvif(struct ieee80211_vif *vif) return (struct ath11k_vif *)vif->drv_priv; } +static inline void ath11k_core_create_firmware_path (struct ath11k_base *ab, +const char *filename, +void *buf,size_t buf_len) +{ +snprintf (buf, buf_len,"%s/%s/%s" ,ATH11K_FW_DIR , + ab->hw_params.fw.dir, filename); +} +#endif /* _CORE_H_ */
drivers/net/wireless/ath/ath11k/hw.h +0 -1
@@ -69,7 +69,6 @@#define ATH11K_FW_DIR "ath11k"/* IPQ8074 definitions */ -#define IPQ8074_FW_DIR ATH11K_FW_DIR "/IPQ8074/hw2.0"#define IPQ8074_MAX_BOARD_DATA_SZ (256 * 1024)#define IPQ8074_MAX_CAL_DATA_SZ IPQ8074_MAX_BOARD_DATA_SZ
drivers/net/wireless/ath/ath11k/qmi.c +1 -1
@@ -1810,7 +1810,7 @@ ath11k_qmi_prepare_bdf_download(struct ath11k_base *ab, int type,ath11k_core_free_bdf (ab, &bd);break ;case ATH11K_QMI_FILE_TYPE_CALDATA : - fw_entry =ath11k_core_firmware_request (ab, ab->hw_params.fw.dir, + fw_entry =ath11k_core_firmware_request (ab,ATH11K_QMI_DEFAULT_CAL_FILE_NAME );if (ret) { ath11k_warn(ab, "failed to load %s: %d\n",
Signature · 1 line
2.7.4
PATCH 3/12 ath11k: define max_radios in hw_params
In reply to Kalle ValoFrom: Anilkumar Kolli <[email protected]>
IPQ6018 needs different value for max_radios so make it configurable via hw_params.
No functional changes. Compile tested only.
--- drivers/net/wireless/ath/ath11k/core.c | 1 + drivers/net/wireless/ath/ath11k/dp_rx.c | 2 +- drivers/net/wireless/ath/ath11k/htc.c | 2 +- drivers/net/wireless/ath/ath11k/hw.h | 1 + drivers/net/wireless/ath/ath11k/reg.c | 2 +- drivers/net/wireless/ath/ath11k/wmi.c | 4 ++-- 6 files changed, 7 insertions(+), 5 deletions(-)
drivers/net/wireless/ath/ath11k/core.c +1 -0
@@ -26,6 +26,7 @@ static const struct ath11k_hw_params ath11k_hw_params[] = { .board_size = IPQ8074_MAX_BOARD_DATA_SZ, .cal_size = IPQ8074_MAX_CAL_DATA_SZ, }, + .max_radios = 3, }, };
drivers/net/wireless/ath/ath11k/dp_rx.c +1 -1
@@ -3820,7 +3820,7 @@ int ath11k_dp_rx_process_wbm_err(struct ath11k_base *ab,int total_num_buffs_reaped =0 ;int ret, i; -for (i =0 ; i <MAX_RADIOS ; i++) +for (i =0 ; i < ab->num_radios; i++)__skb_queue_head_init (&msdu_list[i]); srng = &ab->hal.srng_list[dp->rx_rel_ring.ring_id];
drivers/net/wireless/ath/ath11k/htc.c +1 -1
@@ -748,7 +748,7 @@ int ath11k_htc_init(struct ath11k_base *ab) htc->wmi_ep_count =3 ;break ;default : - htc->wmi_ep_count =3 ; + htc->wmi_ep_count = ab->hw_params.max_radios;break ; }
drivers/net/wireless/ath/ath11k/hw.h +1 -0
@@ -107,6 +107,7 @@ enum ath11k_bus {struct ath11k_hw_params {const char *name;u16 hw_rev; +u8 max_radios;struct {const char *dir;size_t board_size;
drivers/net/wireless/ath/ath11k/reg.c +1 -1
@@ -699,7 +699,7 @@ void ath11k_reg_free(struct ath11k_base *ab) {int i; -for (i =0 ; i <MAX_RADIOS ; i++) { +for (i =0 ; i < ab->hw_params.max_radios; i++) {kfree (ab->default_regd[i]);kfree (ab->new_regd[i]); }
drivers/net/wireless/ath/ath11k/wmi.c +2 -2
@@ -6682,7 +6682,7 @@ int ath11k_wmi_connect(struct ath11k_base *ab)u8 wmi_ep_count; wmi_ep_count = ab->htc.wmi_ep_count; -if (wmi_ep_count >MAX_RADIOS ) +if (wmi_ep_count > ab->hw_params.max_radios)return -1 ;for (i =0 ; i < wmi_ep_count; i++)
@@ -6704,7 +6704,7 @@ int ath11k_wmi_pdev_attach(struct ath11k_base *ab, {struct ath11k_pdev_wmi *wmi_handle; -if (pdev_id >=MAX_RADIOS ) +if (pdev_id >= ab->hw_params.max_radios)return -EINVAL ; wmi_handle = &ab->wmi_ab.wmi[pdev_id];
Signature · 7 lines
2.7.4 _______________________________________________ ath11k mailing list [email protected] http://lists.infradead.org/mailman/listinfo/ath11k
PATCH 10/12 ath11k: qmi: cleanup info messages
In reply to Kalle ValoUse simplified format, just like ath10k uses, which is easier to read.
Compile tested only.
--- drivers/net/wireless/ath/ath11k/qmi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/wireless/ath/ath11k/qmi.c +2 -2
@@ -1772,11 +1772,11 @@ static int ath11k_qmi_request_target_cap(struct ath11k_base *ab)strlcpy (ab->qmi.target.fw_build_id, resp.fw_build_id,sizeof (ab->qmi.target.fw_build_id)); -ath11k_info (ab,"qmi target: chip_id: 0x%x, chip_family: 0x%x, board_id: 0x%x, soc_id: 0x%x\n" , +ath11k_info (ab,"qmi chip_id 0x%x chip_family 0x%x board_id 0x%x soc_id 0x%x\n" , ab->qmi.target.chip_id, ab->qmi.target.chip_family, ab->qmi.target.board_id, ab->qmi.target.soc_id); -ath11k_info (ab,"qmi fw_version: 0x%x fw_build_timestamp: %s fw_build_id: %s" , +ath11k_info (ab,"qmi fw_version 0x%x fw_build_timestamp %s fw_build_id %s" , ab->qmi.target.fw_version, ab->qmi.target.fw_build_timestamp, ab->qmi.target.fw_build_id);
Signature · 7 lines
2.7.4 _______________________________________________ ath11k mailing list [email protected] http://lists.infradead.org/mailman/listinfo/ath11k
PATCH 2/12 ath11k: convert ath11k_hw_params to an array
In reply to Kalle ValoFrom: Anilkumar Kolli <[email protected]>
Convert to ath11k_hw_params to an array to make it possible add new hardware in the future, for example IPQ6018 or QCA6390.
No functional changes. Compile tested only.
--- drivers/net/wireless/ath/ath11k/core.c | 46 ++++++++++++++++++++++++++++------ drivers/net/wireless/ath/ath11k/hw.h | 1 + 2 files changed, 40 insertions(+), 7 deletions(-)
drivers/net/wireless/ath/ath11k/core.c +39 -7
@@ -17,12 +17,15 @@ unsigned int ath11k_debug_mask;module_param_named (debug_mask, ath11k_debug_mask, uint,0644 );MODULE_PARM_DESC (debug_mask,"Debugging mask" ); -static const struct ath11k_hw_params ath11k_hw_params = { - .name ="ipq8074" , - .fw = { - .dir =IPQ8074_FW_DIR , - .board_size =IPQ8074_MAX_BOARD_DATA_SZ , - .cal_size =IPQ8074_MAX_CAL_DATA_SZ , +static const struct ath11k_hw_params ath11k_hw_params[] = { + { + .hw_rev =ATH11K_HW_IPQ8074 , + .name ="ipq8074 hw2.0" , + .fw = { + .dir =IPQ8074_FW_DIR , + .board_size =IPQ8074_MAX_BOARD_DATA_SZ , + .cal_size =IPQ8074_MAX_CAL_DATA_SZ , + }, }, };
@@ -717,6 +720,30 @@ static void ath11k_core_restart(struct work_struct *work)complete (&ab->driver_recovery); } +static int ath11k_init_hw_params (struct ath11k_base *ab) +{ +const struct ath11k_hw_params *hw_params =NULL ; +int i; + +for (i =0 ; i <ARRAY_SIZE (ath11k_hw_params); i++) { + hw_params = &ath11k_hw_params[i]; + +if (hw_params->hw_rev == ab->hw_rev) +break ; + } + +if (i ==ARRAY_SIZE (ath11k_hw_params)) { +ath11k_err (ab,"Unsupported hardware version: 0x%x\n" , ab->hw_rev); +return -EINVAL ; + } + + ab->hw_params = *hw_params; + +ath11k_dbg (ab,ATH11K_DBG_BOOT ,"Hardware name %s\n" , ab->hw_params.name); + +return 0 ; +} +int ath11k_core_init (struct ath11k_base *ab) {struct device *dev = ab->dev;
@@ -735,7 +762,12 @@ int ath11k_core_init(struct ath11k_base *ab)return -EINVAL ; } ab->tgt_rproc = prproc; - ab->hw_params = ath11k_hw_params; + + ret =ath11k_init_hw_params (ab); +if (ret) { +ath11k_err (ab,"failed to get hw params %d\n" , ret); +return ret; + } ret =ath11k_core_soc_create (ab);if (ret) {
drivers/net/wireless/ath/ath11k/hw.h +1 -0
@@ -106,6 +106,7 @@ enum ath11k_bus {struct ath11k_hw_params {const char *name; +u16 hw_rev;struct {const char *dir;size_t board_size;
Signature · 7 lines
2.7.4 _______________________________________________ ath11k mailing list [email protected] http://lists.infradead.org/mailman/listinfo/ath11k
PATCH 9/12 ath11k: remove useless info messages
In reply to Kalle Valoath11k should not be spamming these to the logs. If these are important they should be debug messages, but I just remove them for now.
Compile tested only.
--- drivers/net/wireless/ath/ath11k/mac.c | 8 -------- drivers/net/wireless/ath/ath11k/peer.c | 3 --- drivers/net/wireless/ath/ath11k/qmi.c | 1 - drivers/net/wireless/ath/ath11k/spectral.c | 8 ++------ 4 files changed, 2 insertions(+), 18 deletions(-)
drivers/net/wireless/ath/ath11k/mac.c +0 -8
@@ -3039,10 +3039,6 @@ static int ath11k_mac_op_sta_state(struct ieee80211_hw *hw,if (ret)ath11k_warn (ar->ab,"Failed to associate station: %pM\n" , sta->addr); -else -ath11k_info (ar->ab, -"Station %pM moved to assoc state\n" , - sta->addr); } else if (old_state == IEEE80211_STA_ASSOC && new_state == IEEE80211_STA_AUTH && (vif->type == NL80211_IFTYPE_AP ||
@@ -3052,10 +3048,6 @@ static int ath11k_mac_op_sta_state(struct ieee80211_hw *hw,if (ret)ath11k_warn (ar->ab,"Failed to disassociate station: %pM\n" , sta->addr); -else -ath11k_info (ar->ab, -"Station %pM moved to disassociated state\n" , - sta->addr); }mutex_unlock (&ar->conf_mutex);
drivers/net/wireless/ath/ath11k/peer.c +0 -3
@@ -223,9 +223,6 @@ int ath11k_peer_create(struct ath11k *ar, struct ath11k_vif *arvif, peer =ath11k_peer_find_by_pdev_idx (ar->ab, ar->pdev_idx, param->peer_addr);if (peer) {spin_unlock_bh (&ar->ab->base_lock); -ath11k_info (ar->ab, -"ignoring the peer %pM creation on same pdev idx %d\n" , - param->peer_addr, ar->pdev_idx);return -EINVAL ; }spin_unlock_bh (&ar->ab->base_lock);
drivers/net/wireless/ath/ath11k/qmi.c +0 -1
@@ -1901,7 +1901,6 @@ static int ath11k_qmi_load_bdf(struct ath11k_base *ab) goto out_qmi_bdf; } } -ath11k_info (ab,"qmi BDF downloaded\n" ); out_qmi_bdf:iounmap (bdf_addr);
drivers/net/wireless/ath/ath11k/spectral.c +2 -6
@@ -954,10 +954,8 @@ int ath11k_spectral_init(struct ath11k_base *ab)int i;if (!test_bit (WMI_TLV_SERVICE_FREQINFO_IN_METADATA , - ab->wmi_ab.svc_map)) { -ath11k_info (ab,"spectral not supported\n" ); + ab->wmi_ab.svc_map))return 0 ; - }for (i =0 ; i < ab->num_radios; i++) { ar = ab->pdevs[i].ar;
@@ -966,10 +964,8 @@ int ath11k_spectral_init(struct ath11k_base *ab) ret =ath11k_dbring_get_cap (ar->ab, ar->pdev_idx,WMI_DIRECT_BUF_SPECTRAL , &db_cap); -if (ret) { -ath11k_info (ab,"spectral not enabled for pdev %d\n" , i); +if (ret)continue ; - }idr_init (&sp->rx_ring.bufs_idr);spin_lock_init (&sp->rx_ring.idr_lock);
Signature · 7 lines
2.7.4 _______________________________________________ ath11k mailing list [email protected] http://lists.infradead.org/mailman/listinfo/ath11k
PATCH 11/12 ath11k: don't use defines in hw_params
In reply to Kalle ValoThese defines are not used anywhere else so to avoid extra indirection add the values directly to hw_params.
No functional changes. Compile tested only.
--- drivers/net/wireless/ath/ath11k/core.c | 4 ++-- drivers/net/wireless/ath/ath11k/hw.h | 4 ---- 2 files changed, 2 insertions(+), 6 deletions(-)
drivers/net/wireless/ath/ath11k/core.c +2 -2
@@ -23,8 +23,8 @@ static const struct ath11k_hw_params ath11k_hw_params[] = { .name = "ipq8074 hw2.0", .fw = { .dir = "IPQ8074/hw2.0", - .board_size = IPQ8074_MAX_BOARD_DATA_SZ, - .cal_size = IPQ8074_MAX_CAL_DATA_SZ, + .board_size = 256 * 1024, + .cal_size = 256 * 1024, }, .max_radios = 3, .bdf_addr = 0x4B0C0000,
drivers/net/wireless/ath/ath11k/hw.h +0 -4
@@ -68,10 +68,6 @@#define ATH11K_FW_DIR "ath11k" -/* IPQ8074 definitions */ -#define IPQ8074_MAX_BOARD_DATA_SZ (256 * 1024) -#define IPQ8074_MAX_CAL_DATA_SZ IPQ8074_MAX_BOARD_DATA_SZ -#define ATH11K_BOARD_MAGIC "QCA-ATH11K-BOARD"#define ATH11K_BOARD_API2_FILE "board-2.bin"#define ATH11K_DEFAULT_BOARD_FILE "board.bin"
Signature · 7 lines
2.7.4 _______________________________________________ ath11k mailing list [email protected] http://lists.infradead.org/mailman/listinfo/ath11k
PATCH 8/12 ath11k: change ath11k_core_fetch_board_data_api_n() to use ath11k_core_create_firmware_path()
In reply to Kalle ValoUse the helper added in previous comment to create the full path, instead of doing it manually.
No functional changes. Compile tested only.
--- drivers/net/wireless/ath/ath11k/core.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-)
drivers/net/wireless/ath/ath11k/core.c +12 -7
@@ -165,11 +165,13 @@ static int ath11k_core_fetch_board_data_api_n(struct ath11k_base *ab, {size_t len, magic_len;const u8 *data; -char *filename =ATH11K_BOARD_API2_FILE ; +char *filename, filepath[100 ];size_t ie_len;struct ath11k_fw_ie *hdr;int ret, ie_id; + filename =ATH11K_BOARD_API2_FILE ; +if (!bd->fw) bd->fw =ath11k_core_firmware_request (ab, filename);
@@ -179,11 +181,14 @@ static int ath11k_core_fetch_board_data_api_n(struct ath11k_base *ab, data = bd->fw->data; len = bd->fw->size; +ath11k_core_create_firmware_path (ab, filename, + filepath,sizeof (filepath)); +/* magic has extra null byte padded */ magic_len =strlen (ATH11K_BOARD_MAGIC ) +1 ;if (len < magic_len) { -ath11k_err (ab,"failed to find magic value in %s/%s, file too short: %zu\n" , - ab->hw_params.fw.dir, filename, len); +ath11k_err (ab,"failed to find magic value in %s, file too short: %zu\n" , + filepath, len); ret = -EINVAL ; goto err; }
@@ -197,8 +202,8 @@ static int ath11k_core_fetch_board_data_api_n(struct ath11k_base *ab,/* magic is padded to 4 bytes */ magic_len =ALIGN (magic_len,4 );if (len < magic_len) { -ath11k_err (ab,"failed: %s/%s too small to contain board data, len: %zu\n" , - ab->hw_params.fw.dir, filename, len); +ath11k_err (ab,"failed: %s too small to contain board data, len: %zu\n" , + filepath, len); ret = -EINVAL ; goto err; }
@@ -246,8 +251,8 @@ static int ath11k_core_fetch_board_data_api_n(struct ath11k_base *ab, out:if (!bd->data || !bd->len) {ath11k_err (ab, -"failed to fetch board data for %s from %s/%s\n" , - boardname, ab->hw_params.fw.dir, filename); +"failed to fetch board data for %s from %s\n" , + boardname, filepath); ret = -ENODATA ; goto err; }
Signature · 7 lines
2.7.4 _______________________________________________ ath11k mailing list [email protected] http://lists.infradead.org/mailman/listinfo/ath11k
PATCH 12/12 ath11k: remove define ATH11K_QMI_DEFAULT_CAL_FILE_NAME
In reply to Kalle ValoIt's just a duplicate of ATH11K_DEFAULT_CAL_FILE.
--- drivers/net/wireless/ath/ath11k/qmi.c | 5 ++--- drivers/net/wireless/ath/ath11k/qmi.h | 1 - 2 files changed, 2 insertions(+), 4 deletions(-)
drivers/net/wireless/ath/ath11k/qmi.c +2 -3
@@ -1810,11 +1810,10 @@ ath11k_qmi_prepare_bdf_download(struct ath11k_base *ab, int type,ath11k_core_free_bdf (ab, &bd);break ;case ATH11K_QMI_FILE_TYPE_CALDATA : - fw_entry =ath11k_core_firmware_request (ab, -ATH11K_QMI_DEFAULT_CAL_FILE_NAME ); + fw_entry =ath11k_core_firmware_request (ab,ATH11K_DEFAULT_CAL_FILE );if (ret) {ath11k_warn (ab,"failed to load %s: %d\n" , -ATH11K_QMI_DEFAULT_CAL_FILE_NAME , ret); +ATH11K_DEFAULT_CAL_FILE , ret); goto out; }
drivers/net/wireless/ath/ath11k/qmi.h +0 -1
@@ -22,7 +22,6 @@#define ATH11K_QMI_RESP_LEN_MAX 8192#define ATH11K_QMI_WLANFW_MAX_NUM_MEM_SEG_V01 32#define ATH11K_QMI_CALDB_SIZE 0x480000 -#define ATH11K_QMI_DEFAULT_CAL_FILE_NAME "caldata.bin"#define QMI_WLFW_REQUEST_MEM_IND_V01 0x0035#define QMI_WLFW_FW_MEM_READY_IND_V01 0x0037
Signature · 7 lines
2.7.4 _______________________________________________ ath11k mailing list [email protected] http://lists.infradead.org/mailman/listinfo/ath11k
Re: [PATCH 01/12] ath11k: ahb: call ath11k_core_init() before irq configuration
In reply to Kalle ValoQuoted 7 lines · Kalle Valo
This is needed to init .max_radios in
hw_paramsand onfigure external interrupts for availablepdev_ids.Compile tested only.
Signed-off-by Anilkumar Kolli <[email protected]>Signed-off-by Kalle Valo <[email protected]>
12 patches applied to ath-next branch of ath.git, thanks.
166e22b38aa3 ath11k: ahb: call ath11k_core_init() before irq configurationd3318abf41cf ath11k: convert ath11k_hw_params to an arrayb1cc29e97d1b ath11k: define max_radios in hw_paramsd547ca4c8cc5 ath11k: add hw_ops for pdev id to hw_mac mapping3b94ae4c62db ath11k: Add bdf-addr in hw_params7b57b2ddec21 ath11k: create a common function to request all firmware files34d9fc80bac3 ath11k: don't use defines for hw specific firmware directories31d78a3de4de ath11k: change ath11k_core_fetch_board_data_api_n() to use ath11k_core_create_firmware_path() 21b1a5a4c34c ath11k: remove useless info messages6e5dd03c0b1f ath11k: qmi: cleanup info messagesb3a18338ebd6 ath11k: don't use defines in hw_paramsa9bf09093203 ath11k: remove define ATH11K_QMI_DEFAULT_CAL_FILE_NAME
Signature · 3 lines
https://patchwork.kernel.org/patch/11607585/ https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches