From: Peter Griffin <peter.griffin@linaro.org>
To: vkoul@kernel.org, kishon@kernel.org,
krzysztof.kozlowski@linaro.org, alim.akhtar@samsung.com
Cc: tudor.ambarus@linaro.org, andre.draszik@linaro.org,
kernel-team@android.com, willmcvicker@google.com,
linux-phy@lists.infradead.org, linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-samsung-soc@vger.kernel.org,
Peter Griffin <peter.griffin@linaro.org>
Subject: [PATCH 2/3] phy: samsung-ufs: add support for HIBERN8_ENTER and HIBERN8_EXIT
Date: Wed, 2 Oct 2024 21:15:54 +0100 [thread overview]
Message-ID: <20241002201555.3332138-3-peter.griffin@linaro.org> (raw)
In-Reply-To: <20241002201555.3332138-1-peter.griffin@linaro.org>
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@linaro.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
--
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy
next prev parent reply other threads:[~2024-10-02 20:18 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-02 20:15 [PATCH 0/3] Add phy support for hibern8 enter & exit on gs101 Peter Griffin
2024-10-02 20:15 ` [PATCH 1/3] phy: Add UFS phy hibernate modes Peter Griffin
2024-10-07 6:28 ` Vinod Koul
2024-10-08 10:30 ` Peter Griffin
2024-10-17 12:32 ` Vinod Koul
2024-10-21 11:01 ` Peter Griffin
2024-10-02 20:15 ` Peter Griffin [this message]
2024-10-02 20:15 ` [PATCH 3/3] phy: samsung: gs101-ufs: Add hibern8 enter and exit specific tuning values Peter Griffin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20241002201555.3332138-3-peter.griffin@linaro.org \
--to=peter.griffin@linaro.org \
--cc=alim.akhtar@samsung.com \
--cc=andre.draszik@linaro.org \
--cc=kernel-team@android.com \
--cc=kishon@kernel.org \
--cc=krzysztof.kozlowski@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-phy@lists.infradead.org \
--cc=linux-samsung-soc@vger.kernel.org \
--cc=tudor.ambarus@linaro.org \
--cc=vkoul@kernel.org \
--cc=willmcvicker@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox