iwlwifi: Start scratch debug register for Bz family
authorMatti Gottlieb <matti.gottlieb@intel.com>
Thu, 26 Aug 2021 19:47:48 +0000 (22:47 +0300)
committerLuca Coelho <luciano.coelho@intel.com>
Fri, 22 Oct 2021 07:40:58 +0000 (10:40 +0300)
Start scratch debug register for Bz family.
This register is used for FW debug, and the driver
should start this register with a fixed value, during
init, and upon an error, should read it, and add it to
the dump.

Signed-off-by: Matti Gottlieb <matti.gottlieb@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20210826224715.609ad58a49f3.I05c351233601ecc51dddfa5df69ace292216eb95@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
drivers/net/wireless/intel/iwlwifi/fw/dump.c
drivers/net/wireless/intel/iwlwifi/iwl-csr.h
drivers/net/wireless/intel/iwlwifi/pcie/trans-gen2.c

index a1842205e86a15bed3d11e5674006eb96c0fc096..1f9cf4e40547528a57328575575350d86c7da5db 100644 (file)
@@ -328,6 +328,13 @@ static void iwl_fwrt_dump_tcm_error_log(struct iwl_fw_runtime *fwrt)
        for (i = 0; i < ARRAY_SIZE(table.sw_status); i++)
                IWL_ERR(fwrt, "0x%08X | tcm SW status[%d]\n",
                        table.sw_status[i], i);
+
+       if (trans->trans_cfg->device_family >= IWL_DEVICE_FAMILY_BZ) {
+               u32 scratch = iwl_read32(trans, CSR_FUNC_SCRATCH);
+
+               IWL_ERR(fwrt, "Function Scratch status:\n");
+               IWL_ERR(fwrt, "0x%08X | Func Scratch\n", scratch);
+       }
 }
 
 static void iwl_fwrt_dump_iml_error_log(struct iwl_fw_runtime *fwrt)
index cf796403c45c0e908ddaf7fb78a5bf7b7311e3c6..2c4d70fb32fa8279a9427cd8fc56950d8b7217e2 100644 (file)
@@ -34,6 +34,7 @@
 #define CSR_GPIO_IN             (CSR_BASE+0x018) /* read external chip pins */
 #define CSR_RESET               (CSR_BASE+0x020) /* busmaster enable, NMI, etc*/
 #define CSR_GP_CNTRL            (CSR_BASE+0x024)
+#define CSR_FUNC_SCRATCH        (CSR_BASE+0x02c) /* Scratch register - used for FW dbg */
 
 /* 2nd byte of CSR_INT_COALESCING, not accessible via iwl_write32()! */
 #define CSR_INT_PERIODIC_REG   (CSR_BASE+0x005)
 #define CSR_DBG_HPET_MEM_REG           (CSR_BASE+0x240)
 #define CSR_DBG_LINK_PWR_MGMT_REG      (CSR_BASE+0x250)
 
+/*
+ * Scratch register initial configuration - this is set on init, and read
+ * during a error FW error.
+ */
+#define CSR_FUNC_SCRATCH_INIT_VALUE            (0x01010101)
+
 /* Bits for CSR_HW_IF_CONFIG_REG */
 #define CSR_HW_IF_CONFIG_REG_MSK_MAC_DASH      (0x00000003)
 #define CSR_HW_IF_CONFIG_REG_MSK_MAC_STEP      (0x0000000C)
index bf0c32a74ca473287588d7106bed77225b46d87d..53bc5b7d8d5c8e2cc1cfa70d2f74803fb3b00b11 100644 (file)
@@ -466,13 +466,15 @@ int iwl_trans_pcie_gen2_start_fw(struct iwl_trans *trans,
 
        iwl_pcie_set_ltr(trans);
 
-       if (trans->trans_cfg->device_family >= IWL_DEVICE_FAMILY_BZ)
+       if (trans->trans_cfg->device_family >= IWL_DEVICE_FAMILY_BZ) {
+               iwl_write32(trans, CSR_FUNC_SCRATCH, CSR_FUNC_SCRATCH_INIT_VALUE);
                iwl_set_bit(trans, CSR_GP_CNTRL,
                            CSR_GP_CNTRL_REG_FLAG_ROM_START);
-       else if (trans->trans_cfg->device_family >= IWL_DEVICE_FAMILY_AX210)
+       } else if (trans->trans_cfg->device_family >= IWL_DEVICE_FAMILY_AX210) {
                iwl_write_umac_prph(trans, UREG_CPU_INIT_RUN, 1);
-       else
+       } else {
                iwl_write_prph(trans, UREG_CPU_INIT_RUN, 1);
+       }
 
        /* re-check RF-Kill state since we may have missed the interrupt */
        hw_rfkill = iwl_pcie_check_hw_rf_kill(trans);