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

Commit e21de0b6 authored by qctecmdr's avatar qctecmdr Committed by Gerrit - the friendly Code Review server
Browse files

Merge "scsi: ufs: Honor device quirks and spm level for Link state"

parents 757f1d14 06cdfc4e
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
/*
 * Copyright (c) 2014-2019, The Linux Foundation. All rights reserved.
 * Copyright (c) 2014-2020, 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
@@ -25,6 +25,7 @@
#define UFS_VENDOR_SAMSUNG     0x1CE
#define UFS_VENDOR_SKHYNIX     0x1AD
#define UFS_VENDOR_WDC         0x145
#define UFS_VENDOR_MICRON      0x12C

/**
 * ufs_dev_fix - ufs device quirk info
+21 −13
Original line number Diff line number Diff line
@@ -438,6 +438,8 @@ static struct ufs_dev_fix ufs_fixups[] = {
		UFS_DEVICE_QUIRK_DELAY_BEFORE_LPM),
	UFS_FIX(UFS_VENDOR_TOSHIBA, UFS_ANY_MODEL,
		UFS_DEVICE_QUIRK_NO_LINK_OFF),
	UFS_FIX(UFS_VENDOR_MICRON, UFS_ANY_MODEL,
		UFS_DEVICE_QUIRK_NO_LINK_OFF),
	UFS_FIX(UFS_VENDOR_TOSHIBA, "THGLF2G9C8KBADG",
		UFS_DEVICE_QUIRK_PA_TACTIVATE),
	UFS_FIX(UFS_VENDOR_TOSHIBA, "THGLF2G9D8KBADG",
@@ -9080,21 +9082,27 @@ static int ufshcd_probe_hba(struct ufs_hba *hba)
			goto out;
	}

	/**
	 * UFS3.0 and newer devices use Vcc and Vccq(1.2V)
	 * while UFS2.1 devices use Vcc and Vccq2(1.8V) power
	 * supplies. If the system allows turning off the regulators
	 * during power collapse event, turn off the regulators
	 * during system suspend events. This will cause the UFS
	 * device to re-initialize upon system resume events.
	/*
	 * On 4.19 kernel, the controlling of Vccq requlator got changed.
	 * Its relying on sys_suspend_pwr_off regulator dt flag instead of spm
	 * level.
	 * Updated logic is not honoring spm level specified and the device
	 * specific quirks for the desired link state.
	 * Below change is to fix above listed issue without distrubing the
	 * present logic.
	 */
	if ((hba->dev_info.w_spec_version >= 0x300 && hba->vreg_info.vccq &&
		hba->vreg_info.vccq->sys_suspend_pwr_off) ||
		(hba->dev_info.w_spec_version < 0x300 &&
		hba->vreg_info.vccq2->sys_suspend_pwr_off))
		hba->spm_lvl = ufs_get_desired_pm_lvl_for_dev_link_state(
	if (hba->spm_lvl == ufs_get_desired_pm_lvl_for_dev_link_state(
				UFS_POWERDOWN_PWR_MODE,
				UIC_LINK_OFF_STATE);
				UIC_LINK_OFF_STATE)) {
		if ((hba->dev_info.w_spec_version >= 0x300 &&
		     hba->vreg_info.vccq &&
		     !hba->vreg_info.vccq->sys_suspend_pwr_off))
			hba->vreg_info.vccq->sys_suspend_pwr_off = true;

		if ((hba->dev_info.w_spec_version < 0x300 &&
		     !hba->vreg_info.vccq2->sys_suspend_pwr_off))
			hba->vreg_info.vccq2->sys_suspend_pwr_off = true;
	}

	/* UFS device is also active now */
	ufshcd_set_ufs_dev_active(hba);