aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKalle Valo <kvalo@qca.qualcomm.com>2013-03-06 01:56:06 -0500
committerKalle Valo <kvalo@qca.qualcomm.com>2013-03-18 07:37:11 -0400
commite72c27464cce59be432e6322a407a4d94626f8df (patch)
tree4851dcc1e94dc2a088da099168c3bf74d6cd91c0
parent1fdc7fe18e396d02f9c2dfec3de6975dc8314b60 (diff)
ath6kl: print firmware capabilities
Printin the firmware capabilities during the first firmware boot makes it easier to find out what features firmware supports. Obligatory screenshot: [21025.678481] ath6kl: ar6003 hw 2.1.1 sdio fw 3.2.0.144 api 3 [21025.678667] ath6kl: firmware supports: sched-scan,sta-p2pdev-duplex,rsn-cap-override Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
-rw-r--r--drivers/net/wireless/ath/ath6kl/init.c73
1 files changed, 73 insertions, 0 deletions
diff --git a/drivers/net/wireless/ath/ath6kl/init.c b/drivers/net/wireless/ath/ath6kl/init.c
index 072a2295eff8..3e45adc4a5c2 100644
--- a/drivers/net/wireless/ath/ath6kl/init.c
+++ b/drivers/net/wireless/ath/ath6kl/init.c
@@ -1549,10 +1549,81 @@ static const char *ath6kl_init_get_hif_name(enum ath6kl_hif_type type)
1549 return NULL; 1549 return NULL;
1550} 1550}
1551 1551
1552
1553static const struct fw_capa_str_map {
1554 int id;
1555 const char *name;
1556} fw_capa_map[] = {
1557 { ATH6KL_FW_CAPABILITY_HOST_P2P, "host-p2p" },
1558 { ATH6KL_FW_CAPABILITY_SCHED_SCAN, "sched-scan" },
1559 { ATH6KL_FW_CAPABILITY_STA_P2PDEV_DUPLEX, "sta-p2pdev-duplex" },
1560 { ATH6KL_FW_CAPABILITY_INACTIVITY_TIMEOUT, "inactivity-timeout" },
1561 { ATH6KL_FW_CAPABILITY_RSN_CAP_OVERRIDE, "rsn-cap-override" },
1562 { ATH6KL_FW_CAPABILITY_WOW_MULTICAST_FILTER, "wow-mc-filter" },
1563 { ATH6KL_FW_CAPABILITY_BMISS_ENHANCE, "bmiss-enhance" },
1564 { ATH6KL_FW_CAPABILITY_SCHED_SCAN_MATCH_LIST, "sscan-match-list" },
1565 { ATH6KL_FW_CAPABILITY_RSSI_SCAN_THOLD, "rssi-scan-thold" },
1566 { ATH6KL_FW_CAPABILITY_CUSTOM_MAC_ADDR, "custom-mac-addr" },
1567 { ATH6KL_FW_CAPABILITY_TX_ERR_NOTIFY, "tx-err-notify" },
1568 { ATH6KL_FW_CAPABILITY_REGDOMAIN, "regdomain" },
1569 { ATH6KL_FW_CAPABILITY_SCHED_SCAN_V2, "sched-scan-v2" },
1570 { ATH6KL_FW_CAPABILITY_HEART_BEAT_POLL, "hb-poll" },
1571};
1572
1573static const char *ath6kl_init_get_fw_capa_name(unsigned int id)
1574{
1575 int i;
1576
1577 for (i = 0; i < ARRAY_SIZE(fw_capa_map); i++) {
1578 if (fw_capa_map[i].id == id)
1579 return fw_capa_map[i].name;
1580 }
1581
1582 return "<unknown>";
1583}
1584
1585static void ath6kl_init_get_fwcaps(struct ath6kl *ar, char *buf, size_t buf_len)
1586{
1587 u8 *data = (u8 *) ar->fw_capabilities;
1588 size_t trunc_len, len = 0;
1589 int i, index, bit;
1590 char *trunc = "...";
1591
1592 for (i = 0; i < ATH6KL_FW_CAPABILITY_MAX; i++) {
1593 index = i / 8;
1594 bit = i % 8;
1595
1596 if (index >= sizeof(ar->fw_capabilities) * 4)
1597 break;
1598
1599 if (buf_len - len < 4) {
1600 ath6kl_warn("firmware capability buffer too small!\n");
1601
1602 /* add "..." to the end of string */
1603 trunc_len = strlen(trunc) + 1;
1604 strncpy(buf + buf_len - trunc_len, trunc, trunc_len);
1605
1606 return;
1607 }
1608
1609 if (data[index] & (1 << bit)) {
1610 len += scnprintf(buf + len, buf_len - len, "%s,",
1611 ath6kl_init_get_fw_capa_name(i));
1612 }
1613 }
1614
1615 /* overwrite the last comma */
1616 if (len > 0)
1617 len--;
1618
1619 buf[len] = '\0';
1620}
1621
1552static int __ath6kl_init_hw_start(struct ath6kl *ar) 1622static int __ath6kl_init_hw_start(struct ath6kl *ar)
1553{ 1623{
1554 long timeleft; 1624 long timeleft;
1555 int ret, i; 1625 int ret, i;
1626 char buf[200];
1556 1627
1557 ath6kl_dbg(ATH6KL_DBG_BOOT, "hw start\n"); 1628 ath6kl_dbg(ATH6KL_DBG_BOOT, "hw start\n");
1558 1629
@@ -1615,6 +1686,8 @@ static int __ath6kl_init_hw_start(struct ath6kl *ar)
1615 ar->wiphy->fw_version, 1686 ar->wiphy->fw_version,
1616 ar->fw_api, 1687 ar->fw_api,
1617 test_bit(TESTMODE, &ar->flag) ? " testmode" : ""); 1688 test_bit(TESTMODE, &ar->flag) ? " testmode" : "");
1689 ath6kl_init_get_fwcaps(ar, buf, sizeof(buf));
1690 ath6kl_info("firmware supports: %s\n", buf);
1618 } 1691 }
1619 1692
1620 if (ar->version.abi_ver != ATH6KL_ABI_VERSION) { 1693 if (ar->version.abi_ver != ATH6KL_ABI_VERSION) {