Commit d547ca4c authored by Anilkumar Kolli's avatar Anilkumar Kolli Committed by Kalle Valo

ath11k: add hw_ops for pdev id to hw_mac mapping

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.
Signed-off-by: default avatarAnilkumar Kolli <akolli@codeaurora.org>
Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/1592316055-24958-5-git-send-email-kvalo@codeaurora.org
parent b1cc29e9
...@@ -16,7 +16,8 @@ ath11k-y += core.o \ ...@@ -16,7 +16,8 @@ ath11k-y += core.o \
debug.o \ debug.o \
ce.o \ ce.o \
peer.o \ peer.o \
dbring.o dbring.o \
hw.o
ath11k-$(CONFIG_ATH11K_DEBUGFS) += debug_htt_stats.o debugfs_sta.o ath11k-$(CONFIG_ATH11K_DEBUGFS) += debug_htt_stats.o debugfs_sta.o
ath11k-$(CONFIG_NL80211_TESTMODE) += testmode.o ath11k-$(CONFIG_NL80211_TESTMODE) += testmode.o
......
...@@ -734,6 +734,7 @@ static irqreturn_t ath11k_ahb_ext_interrupt_handler(int irq, void *arg) ...@@ -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) static int ath11k_ahb_ext_irq_config(struct ath11k_base *ab)
{ {
struct ath11k_hw_params *hw = &ab->hw_params;
int i, j; int i, j;
int irq; int irq;
int ret; int ret;
...@@ -768,26 +769,26 @@ static int ath11k_ahb_ext_irq_config(struct ath11k_base *ab) ...@@ -768,26 +769,26 @@ static int ath11k_ahb_ext_irq_config(struct ath11k_base *ab)
if (ath11k_reo_status_ring_mask[i] & BIT(j)) if (ath11k_reo_status_ring_mask[i] & BIT(j))
irq_grp->irqs[num_irq++] = reo2host_status; 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)) { if (ath11k_rxdma2host_ring_mask[i] & BIT(j)) {
irq_grp->irqs[num_irq++] = irq_grp->irqs[num_irq++] =
rxdma2host_destination_ring_mac1 rxdma2host_destination_ring_mac1 -
- ath11k_core_get_hw_mac_id(ab, j); ath11k_hw_get_mac_from_pdev_id(hw, j);
} }
if (ath11k_host2rxdma_ring_mask[i] & BIT(j)) { if (ath11k_host2rxdma_ring_mask[i] & BIT(j)) {
irq_grp->irqs[num_irq++] = irq_grp->irqs[num_irq++] =
host2rxdma_host_buf_ring_mac1 host2rxdma_host_buf_ring_mac1 -
- ath11k_core_get_hw_mac_id(ab, j); ath11k_hw_get_mac_from_pdev_id(hw, j);
} }
if (rx_mon_status_ring_mask[i] & BIT(j)) { if (rx_mon_status_ring_mask[i] & BIT(j)) {
irq_grp->irqs[num_irq++] = irq_grp->irqs[num_irq++] =
ppdu_end_interrupts_mac1 - 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++] = irq_grp->irqs[num_irq++] =
rxdma2host_monitor_status_ring_mac1 - rxdma2host_monitor_status_ring_mac1 -
ath11k_core_get_hw_mac_id(ab, j); ath11k_hw_get_mac_from_pdev_id(hw, j);
} }
} }
} }
......
...@@ -27,26 +27,10 @@ static const struct ath11k_hw_params ath11k_hw_params[] = { ...@@ -27,26 +27,10 @@ static const struct ath11k_hw_params ath11k_hw_params[] = {
.cal_size = IPQ8074_MAX_CAL_DATA_SZ, .cal_size = IPQ8074_MAX_CAL_DATA_SZ,
}, },
.max_radios = 3, .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, static int ath11k_core_create_board_name(struct ath11k_base *ab, char *name,
size_t name_len) size_t name_len)
{ {
......
...@@ -860,7 +860,6 @@ int ath11k_core_fetch_bdf(struct ath11k_base *ath11k, ...@@ -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_free_bdf(struct ath11k_base *ab, struct ath11k_board_data *bd);
void ath11k_core_halt(struct ath11k *ar); 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) static inline const char *ath11k_scan_state_str(enum ath11k_scan_state state)
{ {
......
// 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,
};
...@@ -104,6 +104,10 @@ enum ath11k_bus { ...@@ -104,6 +104,10 @@ enum ath11k_bus {
ATH11K_BUS_PCI, ATH11K_BUS_PCI,
}; };
struct ath11k_hw_ops {
u8 (*get_hw_mac_from_pdev_id)(int pdev_id);
};
struct ath11k_hw_params { struct ath11k_hw_params {
const char *name; const char *name;
u16 hw_rev; u16 hw_rev;
...@@ -113,8 +117,23 @@ struct ath11k_hw_params { ...@@ -113,8 +117,23 @@ struct ath11k_hw_params {
size_t board_size; size_t board_size;
size_t cal_size; size_t cal_size;
} fw; } 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 { struct ath11k_fw_ie {
__le32 id; __le32 id;
__le32 len; __le32 len;
......
...@@ -6194,7 +6194,7 @@ int ath11k_mac_allocate(struct ath11k_base *ab) ...@@ -6194,7 +6194,7 @@ int ath11k_mac_allocate(struct ath11k_base *ab)
ar->ab = ab; ar->ab = ab;
ar->pdev = pdev; ar->pdev = pdev;
ar->pdev_idx = i; 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]; ar->wmi = &ab->wmi_ab.wmi[i];
/* FIXME wmi[0] is already initialized during attach, /* FIXME wmi[0] is already initialized during attach,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment