]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
ata: ahci_tegra: Explicitly specify PMC instance to use
authorThierry Reding <treding@nvidia.com>
Mon, 3 Feb 2025 15:25:29 +0000 (16:25 +0100)
committerThierry Reding <treding@nvidia.com>
Thu, 28 May 2026 20:46:11 +0000 (22:46 +0200)
Currently the kernel relies on a global variable to reference the PMC
context. Use an explicit lookup for the PMC and pass that to the public
PMC APIs.

Acked-by: Damien Le Moal <dlemoal@kernel.org>
Acked-by: Jon Hunter <jonathanh@nvidia.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
drivers/ata/ahci_tegra.c

index 44584eed637442da2897c552e7e7566ab91b1072..554f05e09f983310f1b9fe4af4f5b34ed40fdf12 100644 (file)
@@ -175,6 +175,7 @@ struct tegra_ahci_priv {
        struct reset_control       *sata_cold_rst;
        /* Needs special handling, cannot use ahci_platform */
        struct clk                 *sata_clk;
+       struct tegra_pmc           *pmc;
        struct regulator_bulk_data *supplies;
        const struct tegra_ahci_soc *soc;
 };
@@ -246,9 +247,10 @@ static int tegra_ahci_power_on(struct ahci_host_priv *hpriv)
                return ret;
 
        if (!tegra->pdev->dev.pm_domain) {
-               ret = tegra_powergate_sequence_power_up(TEGRA_POWERGATE_SATA,
-                                                       tegra->sata_clk,
-                                                       tegra->sata_rst);
+               ret = tegra_pmc_powergate_sequence_power_up(tegra->pmc,
+                                                           TEGRA_POWERGATE_SATA,
+                                                           tegra->sata_clk,
+                                                           tegra->sata_rst);
                if (ret)
                        goto disable_regulators;
        }
@@ -269,7 +271,7 @@ disable_power:
        clk_disable_unprepare(tegra->sata_clk);
 
        if (!tegra->pdev->dev.pm_domain)
-               tegra_powergate_power_off(TEGRA_POWERGATE_SATA);
+               tegra_pmc_powergate_power_off(tegra->pmc, TEGRA_POWERGATE_SATA);
 
 disable_regulators:
        regulator_bulk_disable(tegra->soc->num_supplies, tegra->supplies);
@@ -289,7 +291,7 @@ static void tegra_ahci_power_off(struct ahci_host_priv *hpriv)
 
        clk_disable_unprepare(tegra->sata_clk);
        if (!tegra->pdev->dev.pm_domain)
-               tegra_powergate_power_off(TEGRA_POWERGATE_SATA);
+               tegra_pmc_powergate_power_off(tegra->pmc, TEGRA_POWERGATE_SATA);
 
        regulator_bulk_disable(tegra->soc->num_supplies, tegra->supplies);
 }
@@ -571,6 +573,11 @@ static int tegra_ahci_probe(struct platform_device *pdev)
                return PTR_ERR(tegra->sata_clk);
        }
 
+       tegra->pmc = devm_tegra_pmc_get(&pdev->dev);
+       if (IS_ERR(tegra->pmc))
+               return dev_err_probe(&pdev->dev, PTR_ERR(tegra->pmc),
+                                    "failed to get PMC\n");
+
        tegra->supplies = devm_kcalloc(&pdev->dev,
                                       tegra->soc->num_supplies,
                                       sizeof(*tegra->supplies), GFP_KERNEL);