Skip to content

Commit

Permalink
ath11k: Move parameters in bus_params to hw_params
Browse files Browse the repository at this point in the history
In ath11k, bus_params were added with an intention to hold
parameters related to bus (AHB/PCI), but this is not true
as some bus parameters being different between chipsets of
the same bus.

With the addition of WCN6750 to ath11k, bus parameters are
going to be entirely different among AHB devices. Therefore,
it is wise to move bus_params to hw_params and get rid of
bus_params entirely.

Also, mhi_support parameter is not used anywhere in the driver,
remove it from bus_params.

Tested-on: WCN6750 hw1.0 AHB WLAN.MSL.1.0.1-00887-QCAMSLSWPLZ-1

Signed-off-by: Manikanta Pubbisetty <quic_mpubbise@quicinc.com>
Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
Link: https://lore.kernel.org/r/20220429170502.20080-3-quic_mpubbise@quicinc.com
  • Loading branch information
Manikanta Pubbisetty authored and Kalle Valo committed May 2, 2022
1 parent 00fd240 commit 92c1858
Show file tree
Hide file tree
Showing 7 changed files with 49 additions and 47 deletions.
11 changes: 2 additions & 9 deletions drivers/net/wireless/ath/ath11k/ahb.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// SPDX-License-Identifier: BSD-3-Clause-Clear
/*
* Copyright (c) 2018-2019 The Linux Foundation. All rights reserved.
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
*/

#include <linux/module.h>
Expand Down Expand Up @@ -28,13 +29,6 @@ static const struct of_device_id ath11k_ahb_of_match[] = {

MODULE_DEVICE_TABLE(of, ath11k_ahb_of_match);

static const struct ath11k_bus_params ath11k_ahb_bus_params = {
.mhi_support = false,
.m3_fw_support = false,
.fixed_bdf_addr = true,
.fixed_mem_region = true,
};

#define ATH11K_IRQ_CE0_OFFSET 4

static const char *irq_name[ATH11K_IRQ_NUM_MAX] = {
Expand Down Expand Up @@ -685,8 +679,7 @@ static int ath11k_ahb_probe(struct platform_device *pdev)
}

ab = ath11k_core_alloc(&pdev->dev, sizeof(struct ath11k_ahb),
ATH11K_BUS_AHB,
&ath11k_ahb_bus_params);
ATH11K_BUS_AHB);
if (!ab) {
dev_err(&pdev->dev, "failed to allocate ath11k base\n");
return -ENOMEM;
Expand Down
28 changes: 25 additions & 3 deletions drivers/net/wireless/ath/ath11k/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,10 @@ static const struct ath11k_hw_params ath11k_hw_params[] = {
.dbr_debug_support = true,
.global_reset = false,
.bios_sar_capa = NULL,
.m3_fw_support = false,
.fixed_bdf_addr = true,
.fixed_mem_region = true,
.static_window_map = false,
},
{
.hw_rev = ATH11K_HW_IPQ6018_HW10,
Expand Down Expand Up @@ -169,6 +173,10 @@ static const struct ath11k_hw_params ath11k_hw_params[] = {
.dbr_debug_support = true,
.global_reset = false,
.bios_sar_capa = NULL,
.m3_fw_support = false,
.fixed_bdf_addr = true,
.fixed_mem_region = true,
.static_window_map = false,
},
{
.name = "qca6390 hw2.0",
Expand Down Expand Up @@ -235,6 +243,10 @@ static const struct ath11k_hw_params ath11k_hw_params[] = {
.dbr_debug_support = false,
.global_reset = true,
.bios_sar_capa = NULL,
.m3_fw_support = true,
.fixed_bdf_addr = false,
.fixed_mem_region = false,
.static_window_map = false,
},
{
.name = "qcn9074 hw1.0",
Expand Down Expand Up @@ -301,6 +313,10 @@ static const struct ath11k_hw_params ath11k_hw_params[] = {
.dbr_debug_support = true,
.global_reset = false,
.bios_sar_capa = NULL,
.m3_fw_support = true,
.fixed_bdf_addr = false,
.fixed_mem_region = false,
.static_window_map = true,
},
{
.name = "wcn6855 hw2.0",
Expand Down Expand Up @@ -367,6 +383,10 @@ static const struct ath11k_hw_params ath11k_hw_params[] = {
.dbr_debug_support = false,
.global_reset = true,
.bios_sar_capa = &ath11k_hw_sar_capa_wcn6855,
.m3_fw_support = true,
.fixed_bdf_addr = false,
.fixed_mem_region = false,
.static_window_map = false,
},
{
.name = "wcn6855 hw2.1",
Expand Down Expand Up @@ -432,6 +452,10 @@ static const struct ath11k_hw_params ath11k_hw_params[] = {
.dbr_debug_support = false,
.global_reset = true,
.bios_sar_capa = &ath11k_hw_sar_capa_wcn6855,
.m3_fw_support = true,
.fixed_bdf_addr = false,
.fixed_mem_region = false,
.static_window_map = false,
},
};

Expand Down Expand Up @@ -1730,8 +1754,7 @@ void ath11k_core_free(struct ath11k_base *ab)
EXPORT_SYMBOL(ath11k_core_free);

struct ath11k_base *ath11k_core_alloc(struct device *dev, size_t priv_size,
enum ath11k_bus bus,
const struct ath11k_bus_params *bus_params)
enum ath11k_bus bus)
{
struct ath11k_base *ab;

Expand Down Expand Up @@ -1770,7 +1793,6 @@ struct ath11k_base *ath11k_core_alloc(struct device *dev, size_t priv_size,
init_completion(&ab->wow.wakeup_completed);

ab->dev = dev;
ab->bus_params = *bus_params;
ab->hif.bus = bus;

return ab;
Expand Down
12 changes: 1 addition & 11 deletions drivers/net/wireless/ath/ath11k/core.h
Original file line number Diff line number Diff line change
Expand Up @@ -748,14 +748,6 @@ struct ath11k_board_data {
size_t len;
};

struct ath11k_bus_params {
bool mhi_support;
bool m3_fw_support;
bool fixed_bdf_addr;
bool fixed_mem_region;
bool static_window_map;
};

struct ath11k_pci_ops {
int (*wakeup)(struct ath11k_base *ab);
void (*release)(struct ath11k_base *ab);
Expand Down Expand Up @@ -887,7 +879,6 @@ struct ath11k_base {
int bd_api;

struct ath11k_hw_params hw_params;
struct ath11k_bus_params bus_params;

const struct firmware *cal_file;

Expand Down Expand Up @@ -1135,8 +1126,7 @@ int ath11k_core_pre_init(struct ath11k_base *ab);
int ath11k_core_init(struct ath11k_base *ath11k);
void ath11k_core_deinit(struct ath11k_base *ath11k);
struct ath11k_base *ath11k_core_alloc(struct device *dev, size_t priv_size,
enum ath11k_bus bus,
const struct ath11k_bus_params *bus_params);
enum ath11k_bus bus);
void ath11k_core_free(struct ath11k_base *ath11k);
int ath11k_core_fetch_bdf(struct ath11k_base *ath11k,
struct ath11k_board_data *bd);
Expand Down
4 changes: 4 additions & 0 deletions drivers/net/wireless/ath/ath11k/hw.h
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,10 @@ struct ath11k_hw_params {
bool dbr_debug_support;
bool global_reset;
const struct cfg80211_sar_capa *bios_sar_capa;
bool m3_fw_support;
bool fixed_bdf_addr;
bool fixed_mem_region;
bool static_window_map;
};

struct ath11k_hw_ops {
Expand Down
14 changes: 3 additions & 11 deletions drivers/net/wireless/ath/ath11k/pci.c
Original file line number Diff line number Diff line change
Expand Up @@ -115,13 +115,6 @@ static const struct ath11k_pci_ops ath11k_pci_ops_qcn9074 = {
.window_read32 = ath11k_pci_window_read32,
};

static const struct ath11k_bus_params ath11k_pci_bus_params = {
.mhi_support = true,
.m3_fw_support = true,
.fixed_bdf_addr = false,
.fixed_mem_region = false,
};

static const struct ath11k_msi_config msi_config_one_msi = {
.total_vectors = 1,
.total_users = 4,
Expand Down Expand Up @@ -593,7 +586,7 @@ static int ath11k_pci_power_up(struct ath11k_base *ab)
return ret;
}

if (ab->bus_params.static_window_map)
if (ab->hw_params.static_window_map)
ath11k_pci_select_static_window(ab_pci);

return 0;
Expand Down Expand Up @@ -706,8 +699,8 @@ static int ath11k_pci_probe(struct pci_dev *pdev,
u32 soc_hw_version_major, soc_hw_version_minor, addr;
int ret;

ab = ath11k_core_alloc(&pdev->dev, sizeof(*ab_pci), ATH11K_BUS_PCI,
&ath11k_pci_bus_params);
ab = ath11k_core_alloc(&pdev->dev, sizeof(*ab_pci), ATH11K_BUS_PCI);

if (!ab) {
dev_err(&pdev->dev, "failed to allocate ath11k base\n");
return -ENOMEM;
Expand Down Expand Up @@ -764,7 +757,6 @@ static int ath11k_pci_probe(struct pci_dev *pdev,
ab->pci.ops = &ath11k_pci_ops_qca6390;
break;
case QCN9074_DEVICE_ID:
ab->bus_params.static_window_map = true;
ab->pci.ops = &ath11k_pci_ops_qcn9074;
ab->hw_rev = ATH11K_HW_QCN9074_HW10;
break;
Expand Down
4 changes: 2 additions & 2 deletions drivers/net/wireless/ath/ath11k/pcic.c
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ void ath11k_pcic_write32(struct ath11k_base *ab, u32 offset, u32 value)
if (offset < ATH11K_PCI_WINDOW_START) {
iowrite32(value, ab->mem + offset);
} else {
if (ab->bus_params.static_window_map)
if (ab->hw_params.static_window_map)
window_start = ath11k_pcic_get_window_start(ab, offset);
else
window_start = ATH11K_PCI_WINDOW_START;
Expand Down Expand Up @@ -198,7 +198,7 @@ u32 ath11k_pcic_read32(struct ath11k_base *ab, u32 offset)
if (offset < ATH11K_PCI_WINDOW_START) {
val = ioread32(ab->mem + offset);
} else {
if (ab->bus_params.static_window_map)
if (ab->hw_params.static_window_map)
window_start = ath11k_pcic_get_window_start(ab, offset);
else
window_start = ATH11K_PCI_WINDOW_START;
Expand Down
23 changes: 12 additions & 11 deletions drivers/net/wireless/ath/ath11k/qmi.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// SPDX-License-Identifier: BSD-3-Clause-Clear
/*
* Copyright (c) 2018-2019 The Linux Foundation. All rights reserved.
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
*/

#include <linux/elf.h>
Expand Down Expand Up @@ -1648,7 +1649,7 @@ static int ath11k_qmi_host_cap_send(struct ath11k_base *ab)
req.bdf_support_valid = 1;
req.bdf_support = 1;

if (ab->bus_params.m3_fw_support) {
if (ab->hw_params.m3_fw_support) {
req.m3_support_valid = 1;
req.m3_support = 1;
req.m3_cache_support_valid = 1;
Expand Down Expand Up @@ -1803,7 +1804,7 @@ static int ath11k_qmi_respond_fw_mem_request(struct ath11k_base *ab)
* failure to FW and FW will then request mulitple blocks of small
* chunk size memory.
*/
if (!(ab->bus_params.fixed_mem_region ||
if (!(ab->hw_params.fixed_mem_region ||
test_bit(ATH11K_FLAG_FIXED_MEM_RGN, &ab->dev_flags)) &&
ab->qmi.target_mem_delayed) {
delayed = true;
Expand Down Expand Up @@ -1873,7 +1874,7 @@ static void ath11k_qmi_free_target_mem_chunk(struct ath11k_base *ab)
int i;

for (i = 0; i < ab->qmi.mem_seg_count; i++) {
if ((ab->bus_params.fixed_mem_region ||
if ((ab->hw_params.fixed_mem_region ||
test_bit(ATH11K_FLAG_FIXED_MEM_RGN, &ab->dev_flags)) &&
ab->qmi.target_mem[i].iaddr)
iounmap(ab->qmi.target_mem[i].iaddr);
Expand Down Expand Up @@ -2124,7 +2125,7 @@ static int ath11k_qmi_load_file_target_mem(struct ath11k_base *ab,

memset(&resp, 0, sizeof(resp));

if (ab->bus_params.fixed_bdf_addr) {
if (ab->hw_params.fixed_bdf_addr) {
bdf_addr = ioremap(ab->hw_params.bdf_addr, ab->hw_params.fw.board_size);
if (!bdf_addr) {
ath11k_warn(ab, "qmi ioremap error for bdf_addr\n");
Expand Down Expand Up @@ -2153,7 +2154,7 @@ static int ath11k_qmi_load_file_target_mem(struct ath11k_base *ab,
req->end = 1;
}

if (ab->bus_params.fixed_bdf_addr ||
if (ab->hw_params.fixed_bdf_addr ||
type == ATH11K_QMI_FILE_TYPE_EEPROM) {
req->data_valid = 0;
req->end = 1;
Expand All @@ -2162,7 +2163,7 @@ static int ath11k_qmi_load_file_target_mem(struct ath11k_base *ab,
memcpy(req->data, temp, req->data_len);
}

if (ab->bus_params.fixed_bdf_addr) {
if (ab->hw_params.fixed_bdf_addr) {
if (type == ATH11K_QMI_FILE_TYPE_CALDATA)
bdf_addr += ab->hw_params.fw.cal_offset;

Expand Down Expand Up @@ -2201,7 +2202,7 @@ static int ath11k_qmi_load_file_target_mem(struct ath11k_base *ab,
goto err_iounmap;
}

if (ab->bus_params.fixed_bdf_addr ||
if (ab->hw_params.fixed_bdf_addr ||
type == ATH11K_QMI_FILE_TYPE_EEPROM) {
remaining = 0;
} else {
Expand All @@ -2214,7 +2215,7 @@ static int ath11k_qmi_load_file_target_mem(struct ath11k_base *ab,
}

err_iounmap:
if (ab->bus_params.fixed_bdf_addr)
if (ab->hw_params.fixed_bdf_addr)
iounmap(bdf_addr);

err_free_req:
Expand Down Expand Up @@ -2353,7 +2354,7 @@ static void ath11k_qmi_m3_free(struct ath11k_base *ab)
{
struct m3_mem_region *m3_mem = &ab->qmi.m3_mem;

if (!ab->bus_params.m3_fw_support || !m3_mem->vaddr)
if (!ab->hw_params.m3_fw_support || !m3_mem->vaddr)
return;

dma_free_coherent(ab->dev, m3_mem->size,
Expand All @@ -2373,7 +2374,7 @@ static int ath11k_qmi_wlanfw_m3_info_send(struct ath11k_base *ab)
memset(&req, 0, sizeof(req));
memset(&resp, 0, sizeof(resp));

if (ab->bus_params.m3_fw_support) {
if (ab->hw_params.m3_fw_support) {
ret = ath11k_qmi_m3_load(ab);
if (ret) {
ath11k_err(ab, "failed to load m3 firmware: %d", ret);
Expand Down Expand Up @@ -2792,7 +2793,7 @@ static void ath11k_qmi_msg_mem_request_cb(struct qmi_handle *qmi_hdl,
msg->mem_seg[i].type, msg->mem_seg[i].size);
}

if (ab->bus_params.fixed_mem_region ||
if (ab->hw_params.fixed_mem_region ||
test_bit(ATH11K_FLAG_FIXED_MEM_RGN, &ab->dev_flags)) {
ret = ath11k_qmi_assign_target_mem_chunk(ab);
if (ret) {
Expand Down

0 comments on commit 92c1858

Please sign in to comment.