Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a1fe6414 authored by Mohammed Siddiq's avatar Mohammed Siddiq
Browse files

cnss2: Add debug dump for Wlan FW PBL and SBL for HST



Primary and secondary bootloader debug data is required to debug
FW initialization issues. Add support to dump debug data for
PBL and SBL for Hastings.

Change-Id: If5c3a5c76a4b073bc6122f8a866592515fe277ad
Signed-off-by: default avatarMohammed Siddiq <msiddiq@codeaurora.org>
parent 8ef4da1b
Loading
Loading
Loading
Loading
+58 −4
Original line number Diff line number Diff line
@@ -1692,6 +1692,57 @@ static void cnss_pci_collect_dump(struct cnss_pci_data *pci_priv)
}
#endif

/**
 * cnss_pci_dump_qca6390_sram_mem - Dump WLAN FW bootloader debug log
 * @pci_priv: PCI device private data structure of cnss platform driver
 *
 * Dump Primary and secondary bootloader debug log data. For SBL check the
 * log struct address and size for validity.
 *
 * Supported only on QCA6390
 *
 * Return: None
 */
static void cnss_pci_dump_qca6390_sram_mem(struct cnss_pci_data *pci_priv)
{
	int i;
	u32 mem_addr, val, pbl_stage;
	u32 pbl_wlan_boot_cfg, pbl_bootstrap_status;
	struct cnss_plat_data *plat_priv = pci_priv->plat_priv;

	if (plat_priv->device_id != QCA6390_DEVICE_ID)
		return;

	if (cnss_pci_check_link_status(pci_priv))
		return;

	cnss_pci_reg_read(pci_priv, QCA6390_TCSR_PBL_LOGGING_REG, &pbl_stage);
	cnss_pci_reg_read(pci_priv, QCA6390_PBL_WLAN_BOOT_CFG,
			  &pbl_wlan_boot_cfg);
	cnss_pci_reg_read(pci_priv, QCA6390_PBL_BOOTSTRAP_STATUS,
			  &pbl_bootstrap_status);
	cnss_pr_dbg("TCSR_PBL_LOGGING: 0x%08x", pbl_stage);
	cnss_pr_dbg("PBL_WLAN_BOOT_CFG: 0x%08x PBL_BOOTSTRAP_STATUS: 0x%08x",
		    pbl_wlan_boot_cfg, pbl_bootstrap_status);

	cnss_pr_dbg("Dumping PBL log data");
	/* cnss_pci_reg_read provides 32bit register values */
	for (i = 0; i < QCA6390_DEBUG_PBL_LOG_SRAM_MAX_SIZE; i += sizeof(val)) {
		mem_addr = QCA6390_DEBUG_PBL_LOG_SRAM_START + i;
		if (cnss_pci_reg_read(pci_priv, mem_addr, &val))
			break;
		cnss_pr_dbg("SRAM[0x%x] = 0x%x\n", mem_addr, val);
	}

	cnss_pr_dbg("Dumping SBL log data");
	for (i = 0; i < QCA6390_DEBUG_SBL_LOG_SRAM_MAX_SIZE; i += sizeof(val)) {
		mem_addr = QCA6390_V2_SBL_DATA_START + i;
		if (cnss_pci_reg_read(pci_priv, mem_addr, &val))
			break;
		cnss_pr_dbg("SRAM[0x%x] = 0x%x\n", mem_addr, val);
	}
}

/**
 * cnss_pci_dump_bl_sram_mem - Dump WLAN FW bootloader debug log
 * @pci_priv: PCI device private data structure of cnss platform driver
@@ -1710,8 +1761,12 @@ static void cnss_pci_dump_bl_sram_mem(struct cnss_pci_data *pci_priv)
	u32 pbl_wlan_boot_cfg, pbl_bootstrap_status;
	struct cnss_plat_data *plat_priv = pci_priv->plat_priv;

	if (plat_priv->device_id != QCA6490_DEVICE_ID)
	if (plat_priv->device_id == QCA6390_DEVICE_ID) {
		cnss_pci_dump_qca6390_sram_mem(pci_priv);
		return;
	} else if (plat_priv->device_id != QCA6490_DEVICE_ID) {
		return;
	}

	if (cnss_pci_check_link_status(pci_priv))
		return;
@@ -4395,11 +4450,10 @@ static void cnss_mhi_notify_status(struct mhi_controller *mhi_ctrl, void *priv,
		cnss_pci_update_fw_name(pci_priv);
		return;
	case MHI_CB_BOOTUP_TIMEOUT:
		if (plat_priv->device_id == QCA6490_DEVICE_ID) {
		if (plat_priv->device_id == QCA6490_DEVICE_ID ||
		    plat_priv->device_id == QCA6390_DEVICE_ID) {
			cnss_pci_dump_bl_sram_mem(pci_priv);
			cnss_pci_dump_mhi_reg(pci_priv);
		} else if (plat_priv->device_id == QCA6390_DEVICE_ID) {
			cnss_pci_dump_mhi_reg(pci_priv);
		}
		break;
	default:
+11 −0
Original line number Diff line number Diff line
@@ -279,4 +279,15 @@
#define QCA6490_PCIE_BHI_ERRDBG3_REG 0x01E0E23C
#define QCA6490_PBL_WLAN_BOOT_CFG 0x01E22B34
#define QCA6490_PBL_BOOTSTRAP_STATUS 0x01910008

#define QCA6390_DEBUG_PBL_LOG_SRAM_START 0x01403D58
#define QCA6390_DEBUG_PBL_LOG_SRAM_MAX_SIZE 80
#define QCA6390_V2_SBL_DATA_START 0x016c8580
#define QCA6390_V2_SBL_DATA_END (0x016c8580 + 0x00011000)
#define QCA6390_DEBUG_SBL_LOG_SRAM_MAX_SIZE 44
#define QCA6390_TCSR_PBL_LOGGING_REG 0x01B000F8
#define QCA6390_PCIE_BHI_ERRDBG2_REG 0x01E0E238
#define QCA6390_PCIE_BHI_ERRDBG3_REG 0x01E0E23C
#define QCA6390_PBL_WLAN_BOOT_CFG    0x01E22B34
#define QCA6390_PBL_BOOTSTRAP_STATUS 0x01910008
#endif