summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--drivers/memory/tegra/tegra20-emc.c30
1 files changed, 19 insertions, 11 deletions
diff --git a/drivers/memory/tegra/tegra20-emc.c b/drivers/memory/tegra/tegra20-emc.c
index 5e10aa97809f..bb3f315c9587 100644
--- a/drivers/memory/tegra/tegra20-emc.c
+++ b/drivers/memory/tegra/tegra20-emc.c
@@ -902,7 +902,7 @@ err_msg:
static int tegra_emc_opp_table_init(struct tegra_emc *emc)
{
- struct opp_table *opp_table;
+ struct opp_table *reg_opp_table = NULL, *clk_opp_table;
const char *rname = "core";
int err;
@@ -917,19 +917,24 @@ static int tegra_emc_opp_table_init(struct tegra_emc *emc)
}
/* voltage scaling is optional */
- if (device_property_present(emc->dev, "core-supply"))
- opp_table = dev_pm_opp_set_regulators(emc->dev, &rname, 1);
- else
- opp_table = dev_pm_opp_get_opp_table(emc->dev);
+ if (device_property_present(emc->dev, "core-supply")) {
+ reg_opp_table = dev_pm_opp_set_regulators(emc->dev, &rname, 1);
+ if (IS_ERR(reg_opp_table))
+ return dev_err_probe(emc->dev, PTR_ERR(reg_opp_table),
+ "failed to set OPP regulator\n");
+ }
- if (IS_ERR(opp_table))
- return dev_err_probe(emc->dev, PTR_ERR(opp_table),
- "failed to prepare OPP table\n");
+ clk_opp_table = dev_pm_opp_set_clkname(emc->dev, NULL);
+ err = PTR_ERR_OR_ZERO(clk_opp_table);
+ if (err) {
+ dev_err(emc->dev, "failed to set OPP clk: %d\n", err);
+ goto put_reg_table;
+ }
err = dev_pm_opp_of_add_table(emc->dev);
if (err) {
dev_err(emc->dev, "failed to add OPP table: %d\n", err);
- goto put_table;
+ goto put_clk_table;
}
dev_info(emc->dev, "current clock rate %lu MHz\n",
@@ -946,8 +951,11 @@ static int tegra_emc_opp_table_init(struct tegra_emc *emc)
remove_table:
dev_pm_opp_of_remove_table(emc->dev);
-put_table:
- dev_pm_opp_put_regulators(opp_table);
+put_clk_table:
+ dev_pm_opp_put_clkname(clk_opp_table);
+put_reg_table:
+ if (reg_opp_table)
+ dev_pm_opp_put_regulators(reg_opp_table);
return err;
}