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

Commit e18d9cff authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "scsi: ufs-qcom: add ICE debug prints"

parents 9708d4a8 76d194dc
Loading
Loading
Loading
Loading
+38 −2
Original line number Diff line number Diff line
/* Copyright (c) 2014, The Linux Foundation. All rights reserved.
/*
 * Copyright (c) 2014-2015, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -18,12 +19,45 @@
#include <crypto/ice.h>

#include "ufs-qcom-ice.h"

#include "qcom-debugfs.h"

#define UFS_QCOM_CRYPTO_LABEL "ufs-qcom-crypto"
/* Timeout waiting for ICE initialization, that requires TZ access */
#define UFS_QCOM_ICE_COMPLETION_TIMEOUT_MS 500

#define UFS_QCOM_ICE_DEFAULT_DBG_PRINT_EN	0

static void ufs_qcom_ice_dump_regs(struct ufs_qcom_host *qcom_host, int offset,
					int len, char *prefix)
{
	print_hex_dump(KERN_ERR, prefix,
			len > 4 ? DUMP_PREFIX_OFFSET : DUMP_PREFIX_NONE,
			16, 4, qcom_host->hba->mmio_base + offset, len * 4,
			false);
}

void ufs_qcom_ice_print_regs(struct ufs_qcom_host *qcom_host)
{
	int i;

	if (!(qcom_host->dbg_print_en & UFS_QCOM_DBG_PRINT_ICE_REGS_EN))
		return;

	ufs_qcom_ice_dump_regs(qcom_host, REG_UFS_QCOM_ICE_CFG, 1,
			"REG_UFS_QCOM_ICE_CFG ");
	for (i = 0; i < NUM_QCOM_ICE_CTRL_INFO_n_REGS; i++) {
		pr_err("REG_UFS_QCOM_ICE_CTRL_INFO_1_%d = 0x%08X\n", i,
			ufshcd_readl(qcom_host->hba,
				(REG_UFS_QCOM_ICE_CTRL_INFO_1_n + 8 * i)));

		pr_err("REG_UFS_QCOM_ICE_CTRL_INFO_2_%d = 0x%08X\n", i,
			ufshcd_readl(qcom_host->hba,
				(REG_UFS_QCOM_ICE_CTRL_INFO_2_n + 8 * i)));

	}

}

static void ufs_qcom_ice_success_cb(void *host_ctrl,
				enum ice_event_completion evt)
{
@@ -190,6 +224,8 @@ int ufs_qcom_ice_init(struct ufs_qcom_host *qcom_host)
		err = -EINVAL;
	}

	qcom_host->dbg_print_en |= UFS_QCOM_ICE_DEFAULT_DBG_PRINT_EN;

out:
	return err;
}
+9 −1
Original line number Diff line number Diff line
/* Copyright (c) 2014, The Linux Foundation. All rights reserved.
/*
 * Copyright (c) 2014-2015, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -23,9 +24,11 @@
 * of each of these registers
 */
enum {
	REG_UFS_QCOM_ICE_CFG		         = 0x2200,
	REG_UFS_QCOM_ICE_CTRL_INFO_1_n           = 0x2204,
	REG_UFS_QCOM_ICE_CTRL_INFO_2_n           = 0x2208,
};
#define NUM_QCOM_ICE_CTRL_INFO_n_REGS		32

/* UFS QCOM ICE CTRL Info 2 register offset */
enum {
@@ -73,6 +76,7 @@ int ufs_qcom_ice_reset(struct ufs_qcom_host *qcom_host);
int ufs_qcom_ice_resume(struct ufs_qcom_host *qcom_host);
int ufs_qcom_ice_suspend(struct ufs_qcom_host *qcom_host);
int ufs_qcom_ice_get_status(struct ufs_qcom_host *qcom_host, int *ice_status);
void ufs_qcom_ice_print_regs(struct ufs_qcom_host *qcom_host);
#else
inline int ufs_qcom_ice_get_dev(struct ufs_qcom_host *qcom_host)
{
@@ -108,6 +112,10 @@ inline int ufs_qcom_ice_get_status(struct ufs_qcom_host *qcom_host,
{
	return 0;
}
inline void ufs_qcom_ice_print_regs(struct ufs_qcom_host *qcom_host)
{
	return;
}
#endif /* CONFIG_SCSI_UFS_QCOM_ICE */

#endif /* UFS_QCOM_ICE_H_ */
+3 −0
Original line number Diff line number Diff line
@@ -1406,10 +1406,13 @@ static void ufs_qcom_print_hw_debug_reg_all(struct ufs_hba *hba)

static void ufs_qcom_dump_dbg_regs(struct ufs_hba *hba)
{
	struct ufs_qcom_host *host = hba->priv;

	ufs_qcom_dump_regs(hba, REG_UFS_SYS1CLK_1US, 16,
			"HCI Vendor Specific Registers ");

	ufs_qcom_print_hw_debug_reg_all(hba);
	ufs_qcom_ice_print_regs(host);
}

/**
+4 −1
Original line number Diff line number Diff line
@@ -121,8 +121,11 @@ struct ufs_qcom_phy_vreg {

/* QCOM UFS debug print bit mask */
#define UFS_QCOM_DBG_PRINT_REGS_EN	BIT(0)
#define UFS_QCOM_DBG_PRINT_ICE_REGS_EN	BIT(1)

#define UFS_QCOM_DBG_PRINT_ALL	\
	(UFS_QCOM_DBG_PRINT_REGS_EN | UFS_QCOM_DBG_PRINT_ICE_REGS_EN)

#define UFS_QCOM_DBG_PRINT_ALL	UFS_QCOM_DBG_PRINT_REGS_EN

static inline void
ufs_qcom_get_controller_revision(struct ufs_hba *hba,