linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] cpufreq: imx-cpufreq-dt: Fix no OPPs available on unfused parts
@ 2019-05-29 11:52 Leonard Crestez
  2019-06-03  5:42 ` Viresh Kumar
  0 siblings, 1 reply; 2+ messages in thread
From: Leonard Crestez @ 2019-05-29 11:52 UTC (permalink / raw)
  To: Viresh Kumar
  Cc: Rafael J. Wysocki, Aisheng Dong, Fabio Estevam, Shawn Guo,
	linux-pm, kernel, dl-linux-imx, linux-arm-kernel

Early samples without fuses written report "0 0" which means consumer
segment and minumum speed grading. According to datasheet the minimum speed
grade is not supported for consumer parts so all OPPs are disabled
which results in stack dumps later on.

Fix by clamping minimum consumer speed grade to 1 on imx8mm and imx8mq.

Fixes: 4d28ba1d62c4 ("cpufreq: Add imx-cpufreq-dt driver")

Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
---
 drivers/cpufreq/imx-cpufreq-dt.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/drivers/cpufreq/imx-cpufreq-dt.c b/drivers/cpufreq/imx-cpufreq-dt.c
index 27b9b94cd4fc..ce26ffc18ce6 100644
--- a/drivers/cpufreq/imx-cpufreq-dt.c
+++ b/drivers/cpufreq/imx-cpufreq-dt.c
@@ -49,10 +49,25 @@ static int imx_cpufreq_dt_probe(struct platform_device *pdev)
 	if (ret)
 		return ret;
 
 	speed_grade = (cell_value & OCOTP_CFG3_SPEED_GRADE_MASK) >> OCOTP_CFG3_SPEED_GRADE_SHIFT;
 	mkt_segment = (cell_value & OCOTP_CFG3_MKT_SEGMENT_MASK) >> OCOTP_CFG3_MKT_SEGMENT_SHIFT;
+
+	/*
+	 * Early samples without fuses written report "0 0" which means
+	 * consumer segment and minumum speed grading.
+	 *
+	 * According to datasheet minimum speed grading is not supported for
+	 * consumer parts so clamp to 1 to avoid warning for "no OPPs"
+	 *
+	 * Applies to 8mq and 8mm.
+	 */
+	if (mkt_segment == 0 && speed_grade == 0 && (
+			!strcmp(match->compatible, "fsl,imx8mm") ||
+			!strcmp(match->compatible, "fsl,imx8mq")))
+		speed_grade = 1;
+
 	supported_hw[0] = BIT(speed_grade);
 	supported_hw[1] = BIT(mkt_segment);
 	dev_info(&pdev->dev, "cpu speed grade %d mkt segment %d supported-hw %#x %#x\n",
 			speed_grade, mkt_segment, supported_hw[0], supported_hw[1]);
 
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] cpufreq: imx-cpufreq-dt: Fix no OPPs available on unfused parts
  2019-05-29 11:52 [PATCH] cpufreq: imx-cpufreq-dt: Fix no OPPs available on unfused parts Leonard Crestez
@ 2019-06-03  5:42 ` Viresh Kumar
  0 siblings, 0 replies; 2+ messages in thread
From: Viresh Kumar @ 2019-06-03  5:42 UTC (permalink / raw)
  To: Leonard Crestez
  Cc: Rafael J. Wysocki, Aisheng Dong, Fabio Estevam, Shawn Guo,
	linux-pm, kernel, dl-linux-imx, linux-arm-kernel

On 29-05-19, 11:52, Leonard Crestez wrote:
> Early samples without fuses written report "0 0" which means consumer
> segment and minumum speed grading. According to datasheet the minimum speed
> grade is not supported for consumer parts so all OPPs are disabled
> which results in stack dumps later on.
> 
> Fix by clamping minimum consumer speed grade to 1 on imx8mm and imx8mq.
> 
> Fixes: 4d28ba1d62c4 ("cpufreq: Add imx-cpufreq-dt driver")
> 
> Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
> ---
>  drivers/cpufreq/imx-cpufreq-dt.c | 15 +++++++++++++++
>  1 file changed, 15 insertions(+)

Applied with following changes:

s/minumum/minimum/

Thanks.

-- 
viresh

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-06-03  5:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-29 11:52 [PATCH] cpufreq: imx-cpufreq-dt: Fix no OPPs available on unfused parts Leonard Crestez
2019-06-03  5:42 ` Viresh Kumar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).