drivers: ufs: ufs-mediatek: fix phy handling

Currently mphy is declared as a pointer inside ufs_mtk_host struct, but
it is never initialized.

Fix this by using a struct phy directly in ufs_mtk_host struct instead
of a struct phy*. Update all call to mphy accordingly.

Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
Signed-off-by: Julien Stephan <jstephan@baylibre.com>
Link: https://patch.msgid.link/20260318-mt8195-add-ufs-support-v2-6-f18eeeeb0e72@baylibre.com
Signed-off-by: David Lechner <dlechner@baylibre.com>
This commit is contained in:
Julien Stephan 2026-03-18 17:50:58 +01:00 committed by David Lechner
parent e13229b66a
commit ac6e41ee6e
2 changed files with 8 additions and 12 deletions

View File

@ -182,19 +182,15 @@ static int ufs_mtk_bind_mphy(struct ufs_hba *hba)
struct ufs_mtk_host *host = dev_get_priv(hba->dev);
int err = 0;
err = generic_phy_get_by_index(hba->dev, 0, host->mphy);
err = generic_phy_get_by_index(hba->dev, 0, &host->mphy);
if (IS_ERR(host->mphy)) {
err = PTR_ERR(host->mphy);
if (err != -ENODEV) {
dev_info(hba->dev, "%s: Could NOT get a valid PHY %d\n", __func__,
err);
}
if (err) {
if (err == -ENOENT)
return 0; /* no PHY, nothing to do */
dev_err(hba->dev, "Failed to get PHY: %d.\n", err);
return err;
}
if (err)
host->mphy = NULL;
return err;
}
@ -323,7 +319,7 @@ static int ufs_mtk_init(struct ufs_hba *hba)
// TODO: Clocking
err = generic_phy_power_on(priv->mphy);
err = generic_phy_power_on(&priv->mphy);
if (err) {
dev_err(hba->dev, "%s: phy init failed, err = %d\n",
__func__, err);

View File

@ -154,7 +154,7 @@ struct ufs_mtk_mcq_intr_info {
};
struct ufs_mtk_host {
struct phy *mphy;
struct phy mphy;
struct reset_ctl *unipro_reset;
struct reset_ctl *crypto_reset;
struct reset_ctl *hci_reset;