linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: "Pali Rohár" <pali@kernel.org>
To: nnet <nnet@fastmail.fm>
Cc: "Marek Behún" <kabel@kernel.org>,
	andrew@lunn.ch, luka.perkov@sartura.hr, sboyd@kernel.org,
	gregory.clement@bootlin.com, a.heider@gmail.com,
	linux-kernel@vger.kernel.org, vladimir.vid@sartura.hr,
	mturquette@baylibre.com, rmk+kernel@armlinux.org.uk,
	tmn505@gmail.com, gerald@gk2.net, miquel.raynal@bootlin.com,
	kostap@marvell.com, linux-clk@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH mvebu v2 00/10] Armada 37xx: Fix cpufreq changing base CPU speed to 800 MHz from 1000 MHz
Date: Tue, 16 Feb 2021 11:41:41 +0100	[thread overview]
Message-ID: <20210216104141.umy6zrrkal3dlj5j@pali> (raw)
In-Reply-To: <675b7a74-066b-4dc0-8dcb-f11c5606ae52@www.fastmail.com>

On Monday 15 February 2021 21:48:08 nnet wrote:
> > Could you test following change instead of PATCH 04/10? I added here also
> > logic for 1.2 GHz variant with 1.132 V value another change is that
> > value for load L0 is not touched as it is stable.
> 
> These changes to patch 04/10 worked going 600 MHz <-> 1.2 GHz , _but_ only with:
> 
> ++#define MIN_VOLT_MV_FOR_L1_1200MHZ 1213
> 
> During this latest testing I saw freezes with 1132 mV.
> 
> I've had no lockups with 1213 mV which I just used from the values for L1/L0 from OTP.

I still do not know what is the meaning of values stored in OTP...
And there are more non-zero bits which are not used (yet).

Anyway, with your another test it looks like that limit is not based on
fixed value but rather on current L0 value. Therefore I'm thinking if
the correct way is instead to use L1 := L0 voltage value for 1/1.2 GHz
mode. Could you try following change instead of previous and PATCH 04/10?

diff --git a/drivers/cpufreq/armada-37xx-cpufreq.c b/drivers/cpufreq/armada-37xx-cpufreq.c
index b8dc6c849..12d0ff7b1 100644
--- a/drivers/cpufreq/armada-37xx-cpufreq.c
+++ b/drivers/cpufreq/armada-37xx-cpufreq.c
@@ -208,6 +208,8 @@ static u32 armada_37xx_avs_val_match(int target_vm)
  * - L2 & L3 voltage should be about 150mv smaller than L0 voltage.
  * This function calculates L1 & L2 & L3 AVS values dynamically based
  * on L0 voltage and fill all AVS values to the AVS value table.
+ * When base CPU frequency is 1000 or 1200 MHz then there is additional
+ * minimal avs value for load L1.
  */
 static void __init armada37xx_cpufreq_avs_configure(struct regmap *base,
 						struct armada_37xx_dvfs *dvfs)
@@ -239,17 +241,36 @@ static void __init armada37xx_cpufreq_avs_configure(struct regmap *base,
 		for (load_level = 1; load_level < LOAD_LEVEL_NR; load_level++)
 			dvfs->avs[load_level] = avs_min;
 
+		/*
+		 * Set the avs values for load L0 and L1 when base CPU frequency
+		 * is 1000/1200 MHz to its typical initial values according to
+		 * the Armada 3700 Hardware Specifications.
+		 */
+		if (dvfs->cpu_freq_max >= 1000*1000*1000) {
+			if (dvfs->cpu_freq_max >= 1200*1000*1000)
+				avs_min = armada_37xx_avs_val_match(1155);
+			else
+				avs_min = armada_37xx_avs_val_match(1108);
+			dvfs->avs[0] = dvfs->avs[1] = avs_min;
+		}
+
 		return;
 	}
 
 	/*
 	 * L1 voltage is equal to L0 voltage - 100mv and it must be
-	 * larger than 1000mv
+	 * larger than 1000mv. When base CPU frequency is 1000/1200 MHz,
+	 * L1 voltage must must be equal to L0 voltage, otherwise
+	 * the CPU gets stuck when switching from load L1 to load L0.
 	 */
 
-	target_vm = avs_map[l0_vdd_min] - 100;
-	target_vm = target_vm > MIN_VOLT_MV ? target_vm : MIN_VOLT_MV;
-	dvfs->avs[1] = armada_37xx_avs_val_match(target_vm);
+	if (dvfs->cpu_freq_max >= 1000*1000*1000) {
+		dvfs->avs[1] = dvfs->avs[0];
+	} else {
+		target_vm = avs_map[l0_vdd_min] - 100;
+		target_vm = target_vm > MIN_VOLT_MV ? target_vm : MIN_VOLT_MV;
+		dvfs->avs[1] = armada_37xx_avs_val_match(target_vm);
+	}
 
 	/*
 	 * L2 & L3 voltage is equal to L0 voltage - 150mv and it must

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2021-02-16 10:43 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <d59ba191-43db-4b7b-b201-62a60ca752c0@www.fastmail.com>
2021-02-09 21:33 ` [PATCH mvebu v2 00/10] Armada 37xx: Fix cpufreq changing base CPU speed to 800 MHz from 1000 MHz Pali Rohár
2021-02-09 21:45   ` nnet
2021-02-09 22:42     ` Pali Rohár
2021-02-09 22:52       ` nnet
2021-02-09 22:56         ` Pali Rohár
2021-02-09 23:16           ` nnet
2021-02-09 23:26             ` Marek Behún
2021-02-10  1:31               ` nnet
2021-02-10  1:51                 ` nnet
2021-02-10  2:07                   ` nnet
2021-02-10  9:23                     ` Pali Rohár
2021-02-10 17:34                       ` nnet
2021-02-10 18:03                         ` Pali Rohár
2021-02-10 19:08                           ` nnet
2021-02-10 19:18                             ` Marek Behún
2021-02-11 19:55                             ` Pali Rohár
2021-02-11 20:22                               ` nnet
2021-02-11 23:44                                 ` Pali Rohár
2021-02-12  0:41                                   ` nnet
2021-02-13 10:01                                     ` Pali Rohár
2021-02-13 18:30                                       ` nnet
2021-02-14 12:33                                         ` Pali Rohár
2021-02-16  5:48                                           ` nnet
2021-02-16 10:41                                             ` Pali Rohár [this message]
2021-02-16 16:27                                               ` nnet
2021-02-19 19:33                                                 ` Pali Rohár
2021-02-22  3:17                                                   ` nnet
2021-02-22  9:51                                                     ` Pali Rohár
2021-02-22 16:36                                                       ` nnet
2021-02-22 16:40                                                         ` Philip Soares
2021-02-10  2:12                   ` Marek Behún
2021-01-14 12:40 Pali Rohár
2021-02-01 14:35 ` Tomasz Maciej Nowak
2021-02-03 19:29 ` Anders Trier Olesen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210216104141.umy6zrrkal3dlj5j@pali \
    --to=pali@kernel.org \
    --cc=a.heider@gmail.com \
    --cc=andrew@lunn.ch \
    --cc=gerald@gk2.net \
    --cc=gregory.clement@bootlin.com \
    --cc=kabel@kernel.org \
    --cc=kostap@marvell.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luka.perkov@sartura.hr \
    --cc=miquel.raynal@bootlin.com \
    --cc=mturquette@baylibre.com \
    --cc=nnet@fastmail.fm \
    --cc=rmk+kernel@armlinux.org.uk \
    --cc=sboyd@kernel.org \
    --cc=tmn505@gmail.com \
    --cc=vladimir.vid@sartura.hr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).