lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20241002201555.3332138-3-peter.griffin@linaro.org>
Date: Wed,  2 Oct 2024 21:15:54 +0100
From: Peter Griffin <peter.griffin@...aro.org>
To: vkoul@...nel.org,
	kishon@...nel.org,
	krzysztof.kozlowski@...aro.org,
	alim.akhtar@...sung.com
Cc: tudor.ambarus@...aro.org,
	andre.draszik@...aro.org,
	kernel-team@...roid.com,
	willmcvicker@...gle.com,
	linux-phy@...ts.infradead.org,
	linux-kernel@...r.kernel.org,
	linux-arm-kernel@...ts.infradead.org,
	linux-samsung-soc@...r.kernel.org,
	Peter Griffin <peter.griffin@...aro.org>
Subject: [PATCH 2/3] phy: samsung-ufs: add support for HIBERN8_ENTER and HIBERN8_EXIT

Add two new states CFG_POST_HIBERN8_ENTER and CFG_PRE_HIBERN8_EXIT to
the phy driver which map to the new PHY_MODE_UFS_HIBERN8_ENTER
and PHY_MODE_UFS_HIBERN8_EXIT modes.

These are used to program phy specific calibration values when entering
and exiting hibern8. When exiting from hibern8 state we also update the
logic to wait for cdr lock.

Signed-off-by: Peter Griffin <peter.griffin@...aro.org>
---
 drivers/phy/samsung/phy-samsung-ufs.c | 18 ++++++++++++++++--
 drivers/phy/samsung/phy-samsung-ufs.h |  2 ++
 2 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/drivers/phy/samsung/phy-samsung-ufs.c b/drivers/phy/samsung/phy-samsung-ufs.c
index 6c5d41552649..7162ae5c7bc8 100644
--- a/drivers/phy/samsung/phy-samsung-ufs.c
+++ b/drivers/phy/samsung/phy-samsung-ufs.c
@@ -87,6 +87,12 @@ static int samsung_ufs_phy_calibrate(struct phy *phy)
 		return -EINVAL;
 	}
 
+	if (ufs_phy->mode == PHY_MODE_UFS_HIBERN8_ENTER)
+		ufs_phy->ufs_phy_state = CFG_POST_HIBERN8_ENTER;
+
+	if (ufs_phy->mode == PHY_MODE_UFS_HIBERN8_EXIT)
+		ufs_phy->ufs_phy_state = CFG_PRE_HIBERN8_EXIT;
+
 	cfg = cfgs[ufs_phy->ufs_phy_state];
 	if (!cfg)
 		goto out;
@@ -105,8 +111,9 @@ static int samsung_ufs_phy_calibrate(struct phy *phy)
 				goto out;
 		}
 
-		if (ufs_phy->ufs_phy_state == CFG_POST_PWR_HS &&
-		    ufs_phy->drvdata->wait_for_cdr) {
+		if ((ufs_phy->ufs_phy_state == CFG_POST_PWR_HS ||
+		     ufs_phy->ufs_phy_state == CFG_PRE_HIBERN8_EXIT) &&
+		     ufs_phy->drvdata->wait_for_cdr) {
 			err = ufs_phy->drvdata->wait_for_cdr(phy, i);
 			if (err)
 				goto out;
@@ -137,6 +144,13 @@ static int samsung_ufs_phy_calibrate(struct phy *phy)
 		/* Change back to INIT state */
 		ufs_phy->ufs_phy_state = CFG_PRE_INIT;
 		break;
+	case CFG_POST_HIBERN8_ENTER:
+		ufs_phy->ufs_phy_state = CFG_PRE_HIBERN8_EXIT;
+		break;
+	case CFG_PRE_HIBERN8_EXIT:
+		/* Change back to INIT state */
+		ufs_phy->ufs_phy_state = CFG_PRE_INIT;
+		break;
 	default:
 		dev_err(ufs_phy->dev, "wrong state for phy calibration\n");
 	}
diff --git a/drivers/phy/samsung/phy-samsung-ufs.h b/drivers/phy/samsung/phy-samsung-ufs.h
index 9b7deef6e10f..b42ed586aba8 100644
--- a/drivers/phy/samsung/phy-samsung-ufs.h
+++ b/drivers/phy/samsung/phy-samsung-ufs.h
@@ -89,6 +89,8 @@ enum {
 	CFG_POST_INIT,
 	CFG_PRE_PWR_HS,
 	CFG_POST_PWR_HS,
+	CFG_POST_HIBERN8_ENTER,
+	CFG_PRE_HIBERN8_EXIT,
 	CFG_TAG_MAX,
 };
 
-- 
2.46.1.824.gd892dcdcdd-goog


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ