[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1613750416-11901-7-git-send-email-abel.vesa@nxp.com>
Date: Fri, 19 Feb 2021 18:00:03 +0200
From: Abel Vesa <abel.vesa@....com>
To: Rob Herring <robh@...nel.org>, Shawn Guo <shawnguo@...nel.org>,
Sascha Hauer <kernel@...gutronix.de>,
Lucas Stach <l.stach@...gutronix.de>,
Fabio Estevam <festevam@...il.com>,
Chanwoo Choi <cw00.choi@...sung.com>,
Georgi Djakov <djakov@...nel.org>,
Dong Aisheng <aisheng.dong@....com>,
Peng Fan <peng.fan@....com>,
Martin Kepplinger <martink@...teo.de>,
devicetree@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
linux-clk@...r.kernel.org,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Cc: NXP Linux Team <linux-imx@....com>, Abel Vesa <abel.vesa@....com>
Subject: [RFC 06/19] devfreq: imx8m-ddrc: Use the opps acquired from EL3
i.MX8M platforms get their dram OPPs from the EL3.
We don't need to duplicate that in the kernel dram dts node.
We should just trust the OPPs provided by the EL3.
Signed-off-by: Abel Vesa <abel.vesa@....com>
---
drivers/devfreq/imx8m-ddrc.c | 49 ++----------------------------------
1 file changed, 2 insertions(+), 47 deletions(-)
diff --git a/drivers/devfreq/imx8m-ddrc.c b/drivers/devfreq/imx8m-ddrc.c
index 3a6c04ba4f2e..33de83acfd8b 100644
--- a/drivers/devfreq/imx8m-ddrc.c
+++ b/drivers/devfreq/imx8m-ddrc.c
@@ -333,38 +333,9 @@ static int imx8m_ddrc_init_freq_info(struct device *dev)
if (freq->dram_core_parent_index == 2 &&
freq->dram_alt_parent_index == 0)
return -ENODEV;
- }
-
- return 0;
-}
-
-static int imx8m_ddrc_check_opps(struct device *dev)
-{
- struct imx8m_ddrc *priv = dev_get_drvdata(dev);
- struct imx8m_ddrc_freq *freq_info;
- struct dev_pm_opp *opp;
- unsigned long freq;
- int i, opp_count;
-
- /* Enumerate DT OPPs and disable those not supported by firmware */
- opp_count = dev_pm_opp_get_opp_count(dev);
- if (opp_count < 0)
- return opp_count;
- for (i = 0, freq = 0; i < opp_count; ++i, ++freq) {
- opp = dev_pm_opp_find_freq_ceil(dev, &freq);
- if (IS_ERR(opp)) {
- dev_err(dev, "Failed enumerating OPPs: %ld\n",
- PTR_ERR(opp));
- return PTR_ERR(opp);
- }
- dev_pm_opp_put(opp);
- freq_info = imx8m_ddrc_find_freq(priv, freq);
- if (!freq_info) {
- dev_info(dev, "Disable unsupported OPP %luHz %luMT/s\n",
- freq, DIV_ROUND_CLOSEST(freq, 250000));
- dev_pm_opp_disable(dev, freq);
- }
+ if (dev_pm_opp_add(dev, freq->rate * 250000, 0))
+ return -ENODEV;
}
return 0;
@@ -372,7 +343,6 @@ static int imx8m_ddrc_check_opps(struct device *dev)
static void imx8m_ddrc_exit(struct device *dev)
{
- dev_pm_opp_of_remove_table(dev);
}
static int imx8m_ddrc_probe(struct platform_device *pdev)
@@ -419,16 +389,6 @@ static int imx8m_ddrc_probe(struct platform_device *pdev)
return ret;
}
- ret = dev_pm_opp_of_add_table(dev);
- if (ret < 0) {
- dev_err(dev, "failed to get OPP table\n");
- return ret;
- }
-
- ret = imx8m_ddrc_check_opps(dev);
- if (ret < 0)
- goto err;
-
priv->profile.polling_ms = 1000;
priv->profile.target = imx8m_ddrc_target;
priv->profile.get_dev_status = imx8m_ddrc_get_dev_status;
@@ -441,13 +401,8 @@ static int imx8m_ddrc_probe(struct platform_device *pdev)
if (IS_ERR(priv->devfreq)) {
ret = PTR_ERR(priv->devfreq);
dev_err(dev, "failed to add devfreq device: %d\n", ret);
- goto err;
}
- return 0;
-
-err:
- dev_pm_opp_of_remove_table(dev);
return ret;
}
--
2.29.2
Powered by blists - more mailing lists