iwlwifi: mvm: support init extended command
authorSara Sharon <sara.sharon@intel.com>
Sun, 11 Dec 2016 08:32:42 +0000 (10:32 +0200)
committerLuca Coelho <luciano.coelho@intel.com>
Wed, 19 Apr 2017 19:21:48 +0000 (22:21 +0300)
When we load firmware in extended mode (as we do by default for
now) driver should send a command what kind of commands ucode
should stop and wait for before proceeding with phy calibrations.
Support this command. Currently we only do NVM access - so mark
this bit only.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
drivers/net/wireless/intel/iwlwifi/mvm/fw-api.h
drivers/net/wireless/intel/iwlwifi/mvm/fw.c
drivers/net/wireless/intel/iwlwifi/mvm/ops.c

index 5086dc00346c0c8e88fea77c95358fb656d9fe68..8302cf03ac28804cef3ac6e1d759063f925e8e2d 100644 (file)
@@ -327,6 +327,7 @@ enum iwl_phy_ops_subcmd_ids {
 
 enum iwl_system_subcmd_ids {
        SHARED_MEM_CFG_CMD = 0x0,
+       INIT_EXTENDED_CFG_CMD = 0x03,
 };
 
 enum iwl_data_path_subcmd_ids {
@@ -2236,4 +2237,26 @@ struct iwl_nvm_access_complete_cmd {
        __le32 reserved;
 } __packed; /* NVM_ACCESS_COMPLETE_CMD_API_S_VER_1 */
 
+/**
+ * enum iwl_extended_cfg_flag - commands driver may send before
+ *     finishing init flow
+ * @IWL_INIT_DEBUG_CFG: driver is going to send debug config command
+ * @IWL_INIT_NVM: driver is going to send NVM_ACCESS commands
+ * @IWL_INIT_PHY: driver is going to send PHY_DB commands
+ */
+enum iwl_extended_cfg_flags {
+       IWL_INIT_DEBUG_CFG,
+       IWL_INIT_NVM,
+       IWL_INIT_PHY,
+};
+
+/**
+ * struct iwl_extended_cfg_cmd - mark what commands ucode should wait for
+ * before finishing init flows
+ * @init_flags: values from iwl_extended_cfg_flags
+ */
+struct iwl_init_extended_cfg_cmd {
+       __le32 init_flags;
+} __packed; /* INIT_EXTENDED_CFG_CMD_API_S_VER_1 */
+
 #endif /* __fw_api_h__ */
index bce3cf5fab67573b4465d641f7de3192eb5de263..900f1e25b9dac7b9c0f1098d35702eac36c523b2 100644 (file)
@@ -836,6 +836,9 @@ int iwl_run_unified_mvm_ucode(struct iwl_mvm *mvm, bool read_nvm)
 {
        struct iwl_notification_wait init_wait;
        struct iwl_nvm_access_complete_cmd nvm_complete = {};
+       struct iwl_init_extended_cfg_cmd init_cfg = {
+               .init_flags = cpu_to_le32(BIT(IWL_INIT_NVM)),
+       };
        static const u16 init_complete[] = {
                INIT_COMPLETE_NOTIF,
        };
@@ -857,6 +860,18 @@ int iwl_run_unified_mvm_ucode(struct iwl_mvm *mvm, bool read_nvm)
                goto error;
        }
 
+       /* Send init config command to mark that we are sending NVM access
+        * commands
+        */
+       ret = iwl_mvm_send_cmd_pdu(mvm, WIDE_ID(SYSTEM_GROUP,
+                                               INIT_EXTENDED_CFG_CMD), 0,
+                                  sizeof(init_cfg), &init_cfg);
+       if (ret) {
+               IWL_ERR(mvm, "Failed to run init config command: %d\n",
+                       ret);
+               goto error;
+       }
+
        /* Read the NVM only at driver load time, no need to do this twice */
        if (read_nvm) {
                /* Read nvm */
index 488d3c948fe84b2e057d54e9b294821e2b401a59..888053323c925511e7102242174aa980a80b5e5c 100644 (file)
@@ -428,6 +428,7 @@ static const struct iwl_hcmd_names iwl_mvm_legacy_names[] = {
  */
 static const struct iwl_hcmd_names iwl_mvm_system_names[] = {
        HCMD_NAME(SHARED_MEM_CFG_CMD),
+       HCMD_NAME(INIT_EXTENDED_CFG_CMD),
 };
 
 /* Please keep this array *SORTED* by hex value.