ath6kl: add support for ar6004 hw3.0
authorJessica Wu <wjessica@qca.qualcomm.com>
Tue, 17 Jun 2014 09:41:16 +0000 (12:41 +0300)
committerKalle Valo <kvalo@qca.qualcomm.com>
Mon, 14 Jul 2014 13:03:38 +0000 (16:03 +0300)
This change enables ath6kl driver to support ar6004 hw3.0. At the same time do
some fixes in firmware initialisation which applies to ar6004 hw1.3 as well.

Signed-off-by: Jessica Wu <wjessica@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
drivers/net/wireless/ath/ath6kl/core.h
drivers/net/wireless/ath/ath6kl/init.c
drivers/net/wireless/ath/ath6kl/main.c
drivers/net/wireless/ath/ath6kl/usb.c

index 23a776391e44cc4cf55fa950d80bcfb2d2f89b5f..2b78c863d03095b035991d3d123ea375b35a4cb6 100644 (file)
@@ -148,6 +148,9 @@ enum ath6kl_fw_capability {
        /* ratetable is the 2 stream version (max MCS15) */
        ATH6KL_FW_CAPABILITY_RATETABLE_MCS15,
 
+       /* firmare doesn't support IP checksumming */
+       ATH6KL_FW_CAPABILITY_NO_IP_CHECKSUM,
+
        /* this needs to be last */
        ATH6KL_FW_CAPABILITY_MAX,
 };
@@ -167,6 +170,7 @@ enum ath6kl_hw_flags {
 #define ATH6KL_FW_API2_FILE "fw-2.bin"
 #define ATH6KL_FW_API3_FILE "fw-3.bin"
 #define ATH6KL_FW_API4_FILE "fw-4.bin"
+#define ATH6KL_FW_API5_FILE "fw-5.bin"
 
 /* AR6003 1.0 definitions */
 #define AR6003_HW_1_0_VERSION                 0x300002ba
@@ -224,8 +228,21 @@ enum ath6kl_hw_flags {
 #define AR6004_HW_1_3_VERSION                  0x31c8088a
 #define AR6004_HW_1_3_FW_DIR                   "ath6k/AR6004/hw1.3"
 #define AR6004_HW_1_3_FIRMWARE_FILE            "fw.ram.bin"
-#define AR6004_HW_1_3_BOARD_DATA_FILE          "ath6k/AR6004/hw1.3/bdata.bin"
-#define AR6004_HW_1_3_DEFAULT_BOARD_DATA_FILE  "ath6k/AR6004/hw1.3/bdata.bin"
+#define AR6004_HW_1_3_TCMD_FIRMWARE_FILE       "utf.bin"
+#define AR6004_HW_1_3_UTF_FIRMWARE_FILE                "utf.bin"
+#define AR6004_HW_1_3_TESTSCRIPT_FILE          "nullTestFlow.bin"
+#define AR6004_HW_1_3_BOARD_DATA_FILE        AR6004_HW_1_3_FW_DIR "/bdata.bin"
+#define AR6004_HW_1_3_DEFAULT_BOARD_DATA_FILE AR6004_HW_1_3_FW_DIR "/bdata.bin"
+
+/* AR6004 3.0 definitions */
+#define AR6004_HW_3_0_VERSION                  0x31C809F8
+#define AR6004_HW_3_0_FW_DIR                   "ath6k/AR6004/hw3.0"
+#define AR6004_HW_3_0_FIRMWARE_FILE            "fw.ram.bin"
+#define AR6004_HW_3_0_TCMD_FIRMWARE_FILE       "utf.bin"
+#define AR6004_HW_3_0_UTF_FIRMWARE_FILE                "utf.bin"
+#define AR6004_HW_3_0_TESTSCRIPT_FILE          "nullTestFlow.bin"
+#define AR6004_HW_3_0_BOARD_DATA_FILE        AR6004_HW_3_0_FW_DIR "/bdata.bin"
+#define AR6004_HW_3_0_DEFAULT_BOARD_DATA_FILE AR6004_HW_3_0_FW_DIR "/bdata.bin"
 
 /* Per STA data, used in AP mode */
 #define STA_PS_AWAKE           BIT(0)
index 8cd0cdfdb800bcca0101366010c323259437ddaf..a61118484de6171b04ad004a0bb3a1be73d12c29 100644 (file)
@@ -149,18 +149,43 @@ static const struct ath6kl_hw hw_list[] = {
                .board_ext_data_addr            = 0x437000,
                .reserved_ram_size              = 7168,
                .board_addr                     = 0x436400,
-               .refclk_hz                      = 40000000,
+               .refclk_hz                      = 0,
                .uarttx_pin                     = 11,
                .flags                          = 0,
 
                .fw = {
                        .dir            = AR6004_HW_1_3_FW_DIR,
                        .fw             = AR6004_HW_1_3_FIRMWARE_FILE,
+                       .tcmd           = AR6004_HW_1_3_TCMD_FIRMWARE_FILE,
+                       .utf            = AR6004_HW_1_3_UTF_FIRMWARE_FILE,
+                       .testscript     = AR6004_HW_1_3_TESTSCRIPT_FILE,
                },
 
                .fw_board               = AR6004_HW_1_3_BOARD_DATA_FILE,
                .fw_default_board       = AR6004_HW_1_3_DEFAULT_BOARD_DATA_FILE,
        },
+       {
+               .id                             = AR6004_HW_3_0_VERSION,
+               .name                           = "ar6004 hw 3.0",
+               .dataset_patch_addr             = 0,
+               .app_load_addr                  = 0x1234,
+               .board_ext_data_addr            = 0,
+               .reserved_ram_size              = 7168,
+               .board_addr                     = 0x436400,
+               .testscript_addr                = 0,
+               .flags                          = 0,
+
+               .fw = {
+                       .dir            = AR6004_HW_3_0_FW_DIR,
+                       .fw             = AR6004_HW_3_0_FIRMWARE_FILE,
+                       .tcmd           = AR6004_HW_3_0_TCMD_FIRMWARE_FILE,
+                       .utf            = AR6004_HW_3_0_UTF_FIRMWARE_FILE,
+                       .testscript     = AR6004_HW_3_0_TESTSCRIPT_FILE,
+               },
+
+               .fw_board               = AR6004_HW_3_0_BOARD_DATA_FILE,
+               .fw_default_board       = AR6004_HW_3_0_DEFAULT_BOARD_DATA_FILE,
+       },
 };
 
 /*
@@ -596,7 +621,9 @@ int ath6kl_configure_target(struct ath6kl *ar)
         * but possible in theory.
         */
 
-       if (ar->target_type == TARGET_TYPE_AR6003) {
+       if ((ar->target_type == TARGET_TYPE_AR6003) ||
+           (ar->version.target_ver == AR6004_HW_1_3_VERSION) ||
+           (ar->version.target_ver == AR6004_HW_3_0_VERSION)) {
                param = ar->hw.board_ext_data_addr;
                ram_reserved_size = ar->hw.reserved_ram_size;
 
@@ -1110,6 +1137,12 @@ int ath6kl_init_fetch_firmwares(struct ath6kl *ar)
        if (ret)
                return ret;
 
+       ret = ath6kl_fetch_fw_apin(ar, ATH6KL_FW_API5_FILE);
+       if (ret == 0) {
+               ar->fw_api = 5;
+               goto out;
+       }
+
        ret = ath6kl_fetch_fw_apin(ar, ATH6KL_FW_API4_FILE);
        if (ret == 0) {
                ar->fw_api = 4;
@@ -1236,7 +1269,13 @@ static int ath6kl_upload_board_file(struct ath6kl *ar)
        }
 
        /* record the fact that Board Data IS initialized */
-       ath6kl_bmi_write_hi32(ar, hi_board_data_initialized, 1);
+       if ((ar->version.target_ver == AR6004_HW_1_3_VERSION) ||
+           (ar->version.target_ver == AR6004_HW_3_0_VERSION))
+               param = board_data_size;
+       else
+               param = 1;
+
+       ath6kl_bmi_write_hi32(ar, hi_board_data_initialized, param);
 
        return ret;
 }
@@ -1367,7 +1406,11 @@ static int ath6kl_upload_testscript(struct ath6kl *ar)
        }
 
        ath6kl_bmi_write_hi32(ar, hi_ota_testscript, address);
-       ath6kl_bmi_write_hi32(ar, hi_end_ram_reserve_sz, 4096);
+
+       if ((ar->version.target_ver != AR6004_HW_1_3_VERSION) &&
+           (ar->version.target_ver != AR6004_HW_3_0_VERSION))
+               ath6kl_bmi_write_hi32(ar, hi_end_ram_reserve_sz, 4096);
+
        ath6kl_bmi_write_hi32(ar, hi_test_apps_related, 1);
 
        return 0;
@@ -1577,6 +1620,7 @@ static const struct fw_capa_str_map {
        { ATH6KL_FW_CAPABILITY_AP_INACTIVITY_MINS, "ap-inactivity-mins" },
        { ATH6KL_FW_CAPABILITY_MAP_LP_ENDPOINT, "map-lp-endpoint" },
        { ATH6KL_FW_CAPABILITY_RATETABLE_MCS15, "ratetable-mcs15" },
+       { ATH6KL_FW_CAPABILITY_NO_IP_CHECKSUM, "no-ip-checksum" },
 };
 
 static const char *ath6kl_init_get_fw_capa_name(unsigned int id)
index baa447f50fdaa22bc8200699be809ac7f29c9d10..21516bc657857b8a44405c5c22944a275271e5f2 100644 (file)
@@ -1293,6 +1293,8 @@ static const struct net_device_ops ath6kl_netdev_ops = {
 
 void init_netdev(struct net_device *dev)
 {
+       struct ath6kl *ar = ath6kl_priv(dev);
+
        dev->netdev_ops = &ath6kl_netdev_ops;
        dev->destructor = free_netdev;
        dev->watchdog_timeo = ATH6KL_TX_TIMEOUT;
@@ -1304,7 +1306,9 @@ void init_netdev(struct net_device *dev)
                                        WMI_MAX_TX_META_SZ +
                                        ATH6KL_HTC_ALIGN_BYTES, 4);
 
-       dev->hw_features |= NETIF_F_IP_CSUM | NETIF_F_RXCSUM;
+       if (!test_bit(ATH6KL_FW_CAPABILITY_NO_IP_CHECKSUM,
+                     ar->fw_capabilities))
+               dev->hw_features |= NETIF_F_IP_CSUM | NETIF_F_RXCSUM;
 
        return;
 }
index e5a9e7fe2cea69a0f6322676451d6bd3b9476ba1..c44325856b81fc4cee191ec9aceb2102f2f0b23b 100644 (file)
@@ -1210,6 +1210,7 @@ static int ath6kl_usb_pm_reset_resume(struct usb_interface *intf)
 
 /* table of devices that work with this driver */
 static struct usb_device_id ath6kl_usb_ids[] = {
+       {USB_DEVICE(0x0cf3, 0x9375)},
        {USB_DEVICE(0x0cf3, 0x9374)},
        { /* Terminating entry */ },
 };