[PATCH 2/7] wcn36xx: get chip type from platform ops
fengwei.yin at linaro.org
fengwei.yin at linaro.org
Tue May 19 23:57:40 PDT 2015
From: Andy Green <andy.green at linaro.org>
Autodetecting the chip type does not work well.
Stop attempting to do it and require a platform op
that tells us what the chip is.
fall back to old chip type detection method if there is no
platform defined chip type detection implementation.
Signed-off-by: Andy Green <andy.green at linaro.org>
[Yin Fengwei: add fall back to old chip type detection]
Signed-off-by: Yin, Fengwei <fengwei.yin at linaro.org>
---
drivers/net/wireless/ath/wcn36xx/main.c | 17 ++++++++++++-----
drivers/net/wireless/ath/wcn36xx/wcn36xx.h | 1 +
2 files changed, 13 insertions(+), 5 deletions(-)
diff --git a/drivers/net/wireless/ath/wcn36xx/main.c b/drivers/net/wireless/ath/wcn36xx/main.c
index 0783d2e..1f65833 100644
--- a/drivers/net/wireless/ath/wcn36xx/main.c
+++ b/drivers/net/wireless/ath/wcn36xx/main.c
@@ -221,15 +221,19 @@ static void wcn36xx_feat_caps_info(struct wcn36xx *wcn)
}
}
-static void wcn36xx_detect_chip_version(struct wcn36xx *wcn)
+static int wcn36xx_detect_chip_version(struct wcn36xx *wcn)
{
+ int ret = WCN36XX_CHIP_UNKNOWN;
+
if (get_feat_caps(wcn->fw_feat_caps, DOT11AC)) {
wcn36xx_info("Chip is 3680\n");
- wcn->chip_version = WCN36XX_CHIP_3680;
+ ret = WCN36XX_CHIP_3680;
} else {
wcn36xx_info("Chip is 3660\n");
- wcn->chip_version = WCN36XX_CHIP_3660;
+ ret = WCN36XX_CHIP_3660;
}
+
+ return ret;
}
static int wcn36xx_start(struct ieee80211_hw *hw)
@@ -286,8 +290,6 @@ static int wcn36xx_start(struct ieee80211_hw *hw)
wcn36xx_feat_caps_info(wcn);
}
- wcn36xx_detect_chip_version(wcn);
-
/* DMA channel initialization */
ret = wcn36xx_dxe_init(wcn);
if (ret) {
@@ -1038,6 +1040,11 @@ static int wcn36xx_probe(struct platform_device *pdev)
wcn->dev = &pdev->dev;
wcn->ctrl_ops = pdev->dev.platform_data;
+ if (wcn->ctrl_ops->get_chip_type)
+ wcn->chip_version = wcn->ctrl_ops->get_chip_type();
+ else
+ wcn->chip_version = wcn36xx_detect_chip_version(wcn);
+
mutex_init(&wcn->hal_mutex);
if (!wcn->ctrl_ops->get_hw_mac(addr)) {
diff --git a/drivers/net/wireless/ath/wcn36xx/wcn36xx.h b/drivers/net/wireless/ath/wcn36xx/wcn36xx.h
index abb9bb1..9ca730c 100644
--- a/drivers/net/wireless/ath/wcn36xx/wcn36xx.h
+++ b/drivers/net/wireless/ath/wcn36xx/wcn36xx.h
@@ -120,6 +120,7 @@ struct wcn36xx_platform_ctrl_ops {
void (*close)(void);
int (*tx)(char *buf, size_t len);
int (*get_hw_mac)(u8 *addr);
+ int (*get_chip_type)(void);
int (*smsm_change_state)(u32 clear_mask, u32 set_mask);
};
--
2.1.4
More information about the wcn36xx
mailing list