* [ath9k-devel] [PATCH 1/2] ath10k: kill pci_write32_v1_workaround function
2013-04-24 12:34 [ath9k-devel] [PATCH 0/2] ath10k: killing things Bartosz Markowski
@ 2013-04-24 12:34 ` Bartosz Markowski
2013-04-24 12:34 ` [ath9k-devel] [PATCH 2/2] ath10k: kill TARGET_TYPE_AR9888 Bartosz Markowski
2013-04-24 14:17 ` [ath9k-devel] [PATCH 0/2] ath10k: killing things Markowski Bartosz
2 siblings, 0 replies; 4+ messages in thread
From: Bartosz Markowski @ 2013-04-24 12:34 UTC (permalink / raw)
To: ath9k-devel
Signed-off-by: Bartosz Markowski <bartosz.markowski@tieto.com>
---
drivers/net/wireless/ath/ath10k/pci.h | 38 +++++++++++++++------------------
1 file changed, 17 insertions(+), 21 deletions(-)
diff --git a/drivers/net/wireless/ath/ath10k/pci.h b/drivers/net/wireless/ath/ath10k/pci.h
index e05a7e0..add59ea 100644
--- a/drivers/net/wireless/ath/ath10k/pci.h
+++ b/drivers/net/wireless/ath/ath10k/pci.h
@@ -268,26 +268,6 @@ static inline void ath10k_pci_reg_write32(void __iomem *mem, u32 addr, u32 val)
/* Wait up to this many Ms for a Diagnostic Access CE operation to complete */
#define DIAG_ACCESS_CE_TIMEOUT_MS 10
-static inline void pci_write32_v1_workaround(struct ath10k *ar, u32 offset, u32 value)
-{
- struct ath10k_pci *ar_pci = ath10k_pci_priv(ar);
- void __iomem *addr = ar_pci->mem;
-
- if (ar_pci->hw_v1_workaround) {
- unsigned long irq_flags;
-
- spin_lock_irqsave(&ar_pci->hw_v1_workaround_lock, irq_flags);
-
- ioread32(addr+offset+4); /* 3rd read prior to write */
- ioread32(addr+offset+4); /* 2nd read prior to write */
- ioread32(addr+offset+4); /* 1st read prior to write */
- iowrite32(value, addr+offset);
-
- spin_unlock_irqrestore(&ar_pci->hw_v1_workaround_lock, irq_flags);
- } else
- iowrite32(value, addr+offset);
-}
-
/*
* This API allows the Host to access Target registers directly
* and relatively efficiently over PCIe.
@@ -318,7 +298,23 @@ static inline void pci_write32_v1_workaround(struct ath10k *ar, u32 offset, u32
* multiple code paths may issue BEGIN/END on a single targid.
*/
static inline void ath10k_pci_write32(struct ath10k *ar, u32 offset, u32 value) {
- pci_write32_v1_workaround(ar, offset, value);
+
+ struct ath10k_pci *ar_pci = ath10k_pci_priv(ar);
+ void __iomem *addr = ar_pci->mem;
+
+ if (ar_pci->hw_v1_workaround) {
+ unsigned long irq_flags;
+
+ spin_lock_irqsave(&ar_pci->hw_v1_workaround_lock, irq_flags);
+
+ ioread32(addr+offset+4); /* 3rd read prior to write */
+ ioread32(addr+offset+4); /* 2nd read prior to write */
+ ioread32(addr+offset+4); /* 1st read prior to write */
+ iowrite32(value, addr+offset);
+
+ spin_unlock_irqrestore(&ar_pci->hw_v1_workaround_lock, irq_flags);
+ } else
+ iowrite32(value, addr+offset);
}
static inline u32 ath10k_pci_read32(struct ath10k *ar, u32 offset) {
--
1.7.10
^ permalink raw reply related [flat|nested] 4+ messages in thread* [ath9k-devel] [PATCH 2/2] ath10k: kill TARGET_TYPE_AR9888
2013-04-24 12:34 [ath9k-devel] [PATCH 0/2] ath10k: killing things Bartosz Markowski
2013-04-24 12:34 ` [ath9k-devel] [PATCH 1/2] ath10k: kill pci_write32_v1_workaround function Bartosz Markowski
@ 2013-04-24 12:34 ` Bartosz Markowski
2013-04-24 14:17 ` [ath9k-devel] [PATCH 0/2] ath10k: killing things Markowski Bartosz
2 siblings, 0 replies; 4+ messages in thread
From: Bartosz Markowski @ 2013-04-24 12:34 UTC (permalink / raw)
To: ath9k-devel
Get rid of target_type variable also. At the moment ath10k
does not support anything else then QCA988x HW.
Signed-off-by: Bartosz Markowski <bartosz.markowski@tieto.com>
---
drivers/net/wireless/ath/ath10k/bmi.h | 8 +++-----
drivers/net/wireless/ath/ath10k/core.c | 28 ++++++----------------------
drivers/net/wireless/ath/ath10k/core.h | 12 +++---------
drivers/net/wireless/ath/ath10k/hw.h | 2 --
drivers/net/wireless/ath/ath10k/pci.c | 21 +++++++--------------
5 files changed, 19 insertions(+), 52 deletions(-)
diff --git a/drivers/net/wireless/ath/ath10k/bmi.h b/drivers/net/wireless/ath/ath10k/bmi.h
index f431589..49261d7 100644
--- a/drivers/net/wireless/ath/ath10k/bmi.h
+++ b/drivers/net/wireless/ath/ath10k/bmi.h
@@ -198,8 +198,7 @@ int ath10k_bmi_write_memory(struct ath10k *ar, u32 address,
u32 addr; \
__le32 tmp; \
\
- addr = host_interest_item_address(ar->target_type, \
- HI_ITEM(item)); \
+ addr = host_interest_item_address(HI_ITEM(item)); \
ret = ath10k_bmi_read_memory(ar, addr, (u8 *) &tmp, 4); \
*val = __le32_to_cpu(tmp); \
ret; \
@@ -211,10 +210,9 @@ int ath10k_bmi_write_memory(struct ath10k *ar, u32 address,
u32 address; \
__le32 v = __cpu_to_le32(val); \
\
- address = host_interest_item_address(ar->target_type, \
- HI_ITEM(item)); \
+ address = host_interest_item_address(HI_ITEM(item)); \
ret = ath10k_bmi_write_memory(ar, address, \
- (u8 *) &v, sizeof(v)); \
+ (u8 *) &v, sizeof(v)); \
ret; \
})
diff --git a/drivers/net/wireless/ath/ath10k/core.c b/drivers/net/wireless/ath/ath10k/core.c
index 4ff500c..186b216 100644
--- a/drivers/net/wireless/ath/ath10k/core.c
+++ b/drivers/net/wireless/ath/ath10k/core.c
@@ -191,7 +191,6 @@ static int ath10k_init_transfer_bin_file(struct ath10k *ar,
const struct firmware *fw_entry;
u32 fw_entry_size;
u8 *temp_eeprom = NULL, *fw_buf = NULL;
- u32 board_data_size;
switch (file) {
default:
@@ -240,7 +239,6 @@ static int ath10k_init_transfer_bin_file(struct ath10k *ar,
if (file == ATH10K_FILE_BOARD_DATA && fw_entry->data) {
u32 board_ext_address;
- int32_t board_ext_data_size;
temp_eeprom = kmalloc(fw_entry_size, GFP_ATOMIC);
if (!temp_eeprom) {
@@ -251,16 +249,6 @@ static int ath10k_init_transfer_bin_file(struct ath10k *ar,
memcpy(temp_eeprom, fw_buf, fw_entry_size);
- switch (ar->target_type) {
- default:
- board_ext_data_size = 0;
- break;
- case TARGET_TYPE_AR9888:
- board_data_size = AR9888_BOARD_DATA_SZ;
- board_ext_data_size = AR9888_BOARD_EXT_DATA_SZ;
- break;
- }
-
/* Determine where in Target RAM to write Board Data */
ath10k_bmi_read32(ar, hi_board_ext_data, &board_ext_address);
@@ -272,12 +260,10 @@ static int ath10k_init_transfer_bin_file(struct ath10k *ar,
* Check whether the target has allocated memory for extended
* board data and file contains extended board data
*/
- if (board_ext_address && (fw_entry_size == (board_data_size +
- board_ext_data_size))) {
+ if (board_ext_address && (fw_entry_size == (AR9888_BOARD_DATA_SZ + AR9888_BOARD_EXT_DATA_SZ))) {
status = ath10k_bmi_write_memory(ar, board_ext_address,
- (u8 *)(((unsigned long)temp_eeprom) +
- board_data_size),
- board_ext_data_size);
+ (u8 *)(((unsigned long)temp_eeprom) + AR9888_BOARD_DATA_SZ),
+ AR9888_BOARD_EXT_DATA_SZ);
if (status != 0) {
ath10k_err("ath10k: BMI operation failed\n");
@@ -288,9 +274,9 @@ static int ath10k_init_transfer_bin_file(struct ath10k *ar,
* Record the fact that extended board Data IS initialized
*/
ath10k_bmi_write32(ar, hi_board_ext_data_config,
- (board_ext_data_size << 16) | 1);
+ (AR9888_BOARD_EXT_DATA_SZ << 16) | 1);
- fw_entry_size = board_data_size;
+ fw_entry_size = AR9888_BOARD_DATA_SZ;
}
}
@@ -410,7 +396,7 @@ static int ath10k_init_hw_params(struct ath10k *ar)
}
struct ath10k *ath10k_core_create(void *hif_priv, struct device *dev,
- enum ath10k_bus bus, u32 target_type,
+ enum ath10k_bus bus,
const struct ath10k_hif_ops *hif_ops)
{
struct ath10k *ar;
@@ -426,7 +412,6 @@ struct ath10k *ath10k_core_create(void *hif_priv, struct device *dev,
ar->p2p = !!ath10k_p2p;
ar->dev = dev;
- ar->target_type = target_type;
ar->hif.priv = hif_priv;
ar->hif.ops = hif_ops;
@@ -487,7 +472,6 @@ int ath10k_core_register(struct ath10k *ar)
if (status)
goto err;
- ar->target_type = target_info.type;
ar->target_version = target_info.version;
ar->hw->wiphy->hw_version = target_info.version;
diff --git a/drivers/net/wireless/ath/ath10k/core.h b/drivers/net/wireless/ath/ath10k/core.h
index 069471a..9f1a9fc 100644
--- a/drivers/net/wireless/ath/ath10k/core.h
+++ b/drivers/net/wireless/ath/ath10k/core.h
@@ -105,14 +105,9 @@ static inline int ath10k_skb_unmap(struct device *dev, struct sk_buff *skb)
return 0;
}
-static inline u32 host_interest_item_address(u32 target_type, u32 item_offset)
+static inline u32 host_interest_item_address(u32 item_offset)
{
- switch (target_type) {
- default:
- WARN_ON(1);
- case TARGET_TYPE_AR9888:
- return AR9888_HOST_INTEREST_ADDRESS + item_offset;
- }
+ return AR9888_HOST_INTEREST_ADDRESS + item_offset;
}
struct ath10k_bmi {
@@ -266,7 +261,6 @@ struct ath10k {
struct device *dev;
u8 mac_addr[ETH_ALEN];
- u32 target_type;
u32 target_version;
u8 fw_version_major;
u32 fw_version_minor;
@@ -370,7 +364,7 @@ static inline struct ath_common *ath10k_common(struct ath10k *ar)
}
struct ath10k *ath10k_core_create(void *hif_priv, struct device *dev,
- enum ath10k_bus bus, u32 target_type,
+ enum ath10k_bus bus,
const struct ath10k_hif_ops *hif_ops);
void ath10k_core_destroy(struct ath10k *ar);
diff --git a/drivers/net/wireless/ath/ath10k/hw.h b/drivers/net/wireless/ath/ath10k/hw.h
index 2e6fed9..1b6afa6 100644
--- a/drivers/net/wireless/ath/ath10k/hw.h
+++ b/drivers/net/wireless/ath/ath10k/hw.h
@@ -20,8 +20,6 @@
#include "targaddrs.h"
-#define TARGET_TYPE_AR9888 7
-
/* Supported FW version */
#define SUPPORTED_FW_MAJOR 1
#define SUPPORTED_FW_MINOR 0
diff --git a/drivers/net/wireless/ath/ath10k/pci.c b/drivers/net/wireless/ath/ath10k/pci.c
index 40ca6d3..e824d98 100644
--- a/drivers/net/wireless/ath/ath10k/pci.c
+++ b/drivers/net/wireless/ath/ath10k/pci.c
@@ -694,10 +694,9 @@ static void ath10k_pci_hif_dump_area(struct ath10k *ar)
u32 host_addr;
u32 i;
- host_addr = host_interest_item_address(ar->target_type,
- HI_ITEM(hi_failure_state));
- if (ath10k_pci_diag_read_mem(ar, host_addr, (u8 *) ®_dump_area,
- sizeof(u32)) != 0) {
+ host_addr = host_interest_item_address(HI_ITEM(hi_failure_state));
+ if (ath10k_pci_diag_read_mem(ar, host_addr,
+ (u8 *) ®_dump_area, sizeof(u32)) != 0) {
ath10k_warn("could not read hi_failure_state\n");
return;
}
@@ -1478,8 +1477,7 @@ static int ath10k_pci_init_config(struct ath10k *ar)
int ret = 0;
/* Download to Target the CE Config and the service-to-CE map */
- interconnect_targ_addr = host_interest_item_address(ar->target_type,
- HI_ITEM(hi_interconnect_state));
+ interconnect_targ_addr = host_interest_item_address(HI_ITEM(hi_interconnect_state));
/* Supply Target-side CE configuration */
ret = ath10k_pci_diag_read_access(ar, interconnect_targ_addr,
@@ -1560,8 +1558,7 @@ static int ath10k_pci_init_config(struct ath10k *ar)
}
/* configure early allocation */
- ealloc_targ_addr = host_interest_item_address(ar->target_type,
- HI_ITEM(hi_early_alloc));
+ ealloc_targ_addr = host_interest_item_address(HI_ITEM(hi_early_alloc));
ret = ath10k_pci_diag_read_access(ar, ealloc_targ_addr, &ealloc_value);
if (ret != 0) {
@@ -1582,8 +1579,7 @@ static int ath10k_pci_init_config(struct ath10k *ar)
}
/* Tell Target to proceed with initialization */
- flag2_targ_addr = host_interest_item_address(ar->target_type,
- HI_ITEM(hi_option_flag2));
+ flag2_targ_addr = host_interest_item_address(HI_ITEM(hi_option_flag2));
ret = ath10k_pci_diag_read_access(ar, flag2_targ_addr, &flag2_value);
if (ret != 0) {
@@ -2154,7 +2150,6 @@ static int ath10k_pci_probe(struct pci_dev *pdev,
u32 fw_indicator;
u32 lcr_val;
int retries = 3;
- u32 target_type;
ath10k_dbg(ATH10K_DBG_PCI, "%s\n", __func__);
retry:
@@ -2169,10 +2164,8 @@ retry:
switch (pci_dev->device) {
case AR9888_1_0_DEVICE_ID:
- target_type = TARGET_TYPE_AR9888;
break;
case AR9888_2_0_DEVICE_ID:
- target_type = TARGET_TYPE_AR9888;
set_bit(ATH10K_PCI_FEATURE_MSI_X, ar_pci->features);
break;
default:
@@ -2184,7 +2177,7 @@ retry:
ath10k_pci_dump_features(ar_pci);
ar = ath10k_core_create(ar_pci, ar_pci->dev, ATH10K_BUS_PCI,
- target_type, &ath10k_pci_hif_ops);
+ &ath10k_pci_hif_ops);
if (!ar) {
ath10k_err("ath10k_core_create failed!\n");
ret = -EINVAL;
--
1.7.10
^ permalink raw reply related [flat|nested] 4+ messages in thread