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

Commit e3648221 authored by Can Guo's avatar Can Guo Committed by Gerrit - the friendly Code Review server
Browse files

scsi: ufs: add delay after reference clock ungating



This change adds a device quirk for some UFS devices which need long delay
after device reference clock is turned on but before initiation of the
state transition to STALL from a LS-MODE or from the HIBERN8 state.

Change-Id: I587dba737633034cca93b8ba839ab367dbc326e1
Signed-off-by: default avatarCan Guo <cang@codeaurora.org>
Signed-off-by: default avatarSayali Lokhande <sayalil@codeaurora.org>
parent 6085f0ad
Loading
Loading
Loading
Loading
+9 −4
Original line number Diff line number Diff line
/*
 * Copyright (c) 2013-2018, Linux Foundation. All rights reserved.
 * Copyright (c) 2013-2019, 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
@@ -1321,11 +1321,16 @@ static void ufs_qcom_dev_ref_clk_ctrl(struct ufs_qcom_host *host, bool enable)

		/*
		 * If we call hibern8 exit after this, we need to make sure that
		 * device ref_clk is stable for at least 1us before the hibern8
		 * device ref_clk is stable for a given time before the hibern8
		 * exit command.
		 */
		if (enable)
		if (enable) {
			if (host->hba->dev_info.quirks &
			    UFS_DEVICE_QUIRK_WAIT_AFTER_REF_CLK_UNGATE)
				usleep_range(50, 60);
			else
				udelay(1);
		}

		host->is_dev_ref_clk_enabled = enable;
	}
+3 −1
Original line number Diff line number Diff line
/*
 * Copyright (c) 2013-2017, The Linux Foundation. All rights reserved.
 * Copyright (c) 2013-2019, 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
@@ -28,6 +28,8 @@ static struct ufs_card_fix ufs_fixups[] = {
	UFS_FIX(UFS_VENDOR_SKHYNIX, UFS_ANY_MODEL,
		UFS_DEVICE_QUIRK_HOST_PA_SAVECONFIGTIME),
	UFS_FIX(UFS_VENDOR_SKHYNIX, UFS_ANY_MODEL, UFS_DEVICE_NO_VCCQ),
	UFS_FIX(UFS_VENDOR_SKHYNIX, UFS_ANY_MODEL,
		UFS_DEVICE_QUIRK_WAIT_AFTER_REF_CLK_UNGATE),
	UFS_FIX(UFS_VENDOR_SKHYNIX, "hB8aL1",
		UFS_DEVICE_QUIRK_HS_G1_TO_HS_G3_SWITCH),
	UFS_FIX(UFS_VENDOR_SKHYNIX, "hC8aL1",
+8 −1
Original line number Diff line number Diff line
/* Copyright (c) 2014-2017, The Linux Foundation. All rights reserved.
/* Copyright (c) 2014-2019, 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
@@ -138,6 +138,13 @@ struct ufs_card_fix {
 */
#define UFS_DEVICE_QUIRK_HS_G1_TO_HS_G3_SWITCH (1 << 8)

/*
 * Some UFS devices need more delay after device reference clk is turned on
 * but before initiation of the state transition to STALL from a LS-MODE or
 * from the HIBERN8 state. Enable this quirk to give UFS devices 50us delay
 * instead of the default delay.
 */
#define UFS_DEVICE_QUIRK_WAIT_AFTER_REF_CLK_UNGATE	(1 << 9)

struct ufs_hba;
void ufs_advertise_fixup_device(struct ufs_hba *hba);