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

Commit d07049b6 authored by Can Guo's avatar Can Guo
Browse files

scsi: ufs-qcom: Configure LPM timer settings



The timer settings of LPM features such as clock gating, auto hibern8 and
RPM auto suspend are hard coded in UFS common driver, make this change to
configure these settings in vendor specific driver.

Change-Id: Iddf5c5024a168bc6b8ebc8948a5aa9ffbb2e4e1b
Signed-off-by: default avatarCan Guo <cang@codeaurora.org>
parent 333b4ccb
Loading
Loading
Loading
Loading
+23 −0
Original line number Diff line number Diff line
@@ -6,6 +6,7 @@
#include <linux/acpi.h>
#include <linux/time.h>
#include <linux/of.h>
#include <linux/bitfield.h>
#include <linux/platform_device.h>
#include <linux/phy/phy.h>
#include <linux/gpio/consumer.h>
@@ -1486,8 +1487,19 @@ static int ufs_qcom_quirk_host_pa_saveconfigtime(struct ufs_hba *hba)

static int ufs_qcom_apply_dev_quirks(struct ufs_hba *hba)
{
	unsigned long flags;
	int err = 0;

	spin_lock_irqsave(hba->host->host_lock, flags);
	/* Set the rpm auto suspend delay to 3s */
	hba->host->hostt->rpm_autosuspend_delay = UFS_QCOM_AUTO_SUSPEND_DELAY;
	/* Set the default auto-hiberate idle timer value to 1ms */
	hba->ahit = FIELD_PREP(UFSHCI_AHIBERN8_TIMER_MASK, 1) |
		    FIELD_PREP(UFSHCI_AHIBERN8_SCALE_MASK, 3);
	/* Set the clock gating delay to performance mode */
	hba->clk_gating.delay_ms = UFS_QCOM_CLK_GATING_DELAY_MS_PERF;
	spin_unlock_irqrestore(hba->host->host_lock, flags);

	if (hba->dev_quirks & UFS_DEVICE_QUIRK_HOST_PA_SAVECONFIGTIME)
		err = ufs_qcom_quirk_host_pa_saveconfigtime(hba);

@@ -2352,6 +2364,12 @@ static int ufs_qcom_clk_scale_up_pre_change(struct ufs_hba *hba)

static int ufs_qcom_clk_scale_up_post_change(struct ufs_hba *hba)
{
	unsigned long flags;

	spin_lock_irqsave(hba->host->host_lock, flags);
	hba->clk_gating.delay_ms = UFS_QCOM_CLK_GATING_DELAY_MS_PERF;
	spin_unlock_irqrestore(hba->host->host_lock, flags);

	return 0;
}

@@ -2388,6 +2406,11 @@ static int ufs_qcom_clk_scale_down_post_change(struct ufs_hba *hba)
	struct ufs_clk_info *clki;
	struct list_head *head = &hba->clk_list_head;
	u32 curr_freq = 0;
	unsigned long flags;

	spin_lock_irqsave(hba->host->host_lock, flags);
	hba->clk_gating.delay_ms = UFS_QCOM_CLK_GATING_DELAY_MS_PWR_SAVE;
	spin_unlock_irqrestore(hba->host->host_lock, flags);

	if (!ufs_qcom_cap_qunipro(host))
		return 0;
+5 −0
Original line number Diff line number Diff line
@@ -52,6 +52,11 @@
#define UFS_QCOM_LIMIT_DESIRED_MODE	FAST
#define UFS_QCOM_LIMIT_PHY_SUBMODE	UFS_QCOM_PHY_SUBMODE_G4

/* default value of auto suspend is 3 seconds */
#define UFS_QCOM_AUTO_SUSPEND_DELAY	3000
#define UFS_QCOM_CLK_GATING_DELAY_MS_PWR_SAVE	10
#define UFS_QCOM_CLK_GATING_DELAY_MS_PERF	50

/* QCOM UFS host controller vendor specific registers */
enum {
	REG_UFS_SYS1CLK_1US                 = 0xC0,