All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gregory CLEMENT <gregory.clement@bootlin.com>
To: Ilias Apalodimas <ilias.apalodimas@linaro.org>,
	Christian Neubert <christian.neubert.86@gmail.com>
Cc: "Stephen Boyd" <sboyd@codeaurora.org>,
	"Mike Turquette" <mturquette@baylibre.com>,
	linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org,
	"Rafael J. Wysocki" <rjw@rjwysocki.net>,
	"Viresh Kumar" <viresh.kumar@linaro.org>,
	linux-pm@vger.kernel.org,
	"Vincent Guittot" <vincent.guittot@linaro.org>,
	"Jason Cooper" <jason@lakedaemon.net>,
	"Andrew Lunn" <andrew@lunn.ch>,
	"Sebastian Hesselbarth" <sebastian.hesselbarth@gmail.com>,
	"Thomas Petazzoni" <thomas.petazzoni@bootlin.com>,
	linux-arm-kernel@lists.infradead.org,
	"Antoine Tenart" <antoine.tenart@bootlin.com>,
	"Miquèl Raynal" <miquel.raynal@bootlin.com>,
	"Maxime Chevallier" <maxime.chevallier@bootlin.com>,
	stable@vger.kernel.org
Subject: Re: [PATCH] clk: mvebu: armada-37xx-periph: Fix initialization for cpu clocks
Date: Thu, 14 Mar 2019 15:20:37 +0100	[thread overview]
Message-ID: <874l85v8p6.fsf@FE-laptop> (raw)
In-Reply-To: <20190314134428.GA24768@apalos>

Hi Ilias,
 
 On jeu., mars 14 2019, Ilias Apalodimas <ilias.apalodimas@linaro.org> wrote:

> Hello Christian,
>> Hi,
>> 
>> I assume you use the 1000 MHz firmware. This does also not work on my Rev 7
>> board. But I'm pretty sure this is not a problem of the patches, because if
>> I take a newer kernel (4.19.20/27) without the patches it also does not
>> work. A kernel 4.19.17 does work for me. My opinion on that is that this is
>> another problem which does just occure now because now the cpu frequency
>> scaling is working with the right frequencies.
> I am not sure which firmware i am running, i did all my tests on 5.0.0 and
> changing between governors worked fine without the patches

Curently my espressobin is broken so I tested the patches on the Armada
3700 DB and I didn't observe the issue you had.

The 3700 DB I used is configured to run at 800MHz.

Could you apply the following patch and sent me the boot log?

diff --git a/drivers/clk/mvebu/armada-37xx-periph.c b/drivers/clk/mvebu/armada-37xx-periph.c
index 26ed3c18a239..f814ade5cd80 100644
--- a/drivers/clk/mvebu/armada-37xx-periph.c
+++ b/drivers/clk/mvebu/armada-37xx-periph.c
@@ -452,14 +452,17 @@ static int clk_pm_cpu_set_parent(struct clk_hw *hw, u8 index)
 
        /* Set the parent clock for all the load level */
        for (load_level = 0; load_level < LOAD_LEVEL_NR; load_level++) {
-               unsigned int reg, mask,  val,
+               unsigned int reg, mask,  val, old,
                        offset = ARMADA_37XX_NB_TBG_SEL_OFF;
 
                armada_3700_pm_dvfs_update_regs(load_level, &reg, &offset);
 
                val = index << offset;
                mask = ARMADA_37XX_NB_TBG_SEL_MASK << offset;
+               regmap_read(base, reg, &old);
                regmap_update_bits(base, reg, mask, val);
+               pr_err("%s old=%X -> val=0x%X load_level=%d\n",
+                      __func__, old,  val, load_level);
        }
        return 0;
 }



>
> Regards
> /Ilias
>> 
>> Ilias Apalodimas <ilias.apalodimas@linaro.org> schrieb am Do., 14. März
>> 2019, 13:15:
>> 
>> > Hi Gregory,
>> > > The clock parenting was not setup properly when DVFS was enabled. It was
>> > > expected that the same clock source was used with and without DVFS which
>> > > was not the case.
>> > >
>> > > This patch fixes this issue, allowing to make the cpufreq support work
>> > > when the CPU clocks source are not the default ones.
>> > >
>> > > Fixes: 92ce45fb875d ("cpufreq: Add DVFS support for Armada 37xx")
>> > > Cc: <stable@vger.kernel.org>
>> > > Reported-by: Christian Neubert <christian.neubert.86@gmail.com>
>> > > Reported-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
>> > > Signed-off-by: Gregory CLEMENT <gregory.clement@bootlin.com>
>> > > ---
>> > >  drivers/clk/mvebu/armada-37xx-periph.c | 11 +++++++++++
>> > >  1 file changed, 11 insertions(+)
>> > >
>> > > diff --git a/drivers/clk/mvebu/armada-37xx-periph.c
>> > b/drivers/clk/mvebu/armada-37xx-periph.c
>> > > index 1f1cff428d78..26ed3c18a239 100644
>> > > --- a/drivers/clk/mvebu/armada-37xx-periph.c
>> > > +++ b/drivers/clk/mvebu/armada-37xx-periph.c
>> > > @@ -671,6 +671,17 @@ static int armada_3700_add_composite_clk(const
>> > struct clk_periph_data *data,
>> > >               map = syscon_regmap_lookup_by_compatible(
>> > >                               "marvell,armada-3700-nb-pm");
>> > >               pmcpu_clk->nb_pm_base = map;
>> > > +
>> > > +             /*
>> > > +              * Use the same parent when DVFS is enabled that the
>> > > +              * default parent received at boot time. When this
>> > > +              * function is called, DVFS is not enabled yet, so we
>> > > +              * get the default parent and we can set the parent
>> > > +              * for DVFS.
>> > > +              */
>> > > +             if (clk_pm_cpu_set_parent(muxrate_hw,
>> > > +
>> >  clk_pm_cpu_get_parent(muxrate_hw)))
>> > > +                     dev_warn(dev, "Failed to setup default parent
>> > clock for DVFS\n");
>> > >       }
>> > >
>> > >       *hw = clk_hw_register_composite(dev, data->name,
>> > data->parent_names,
>> > > --
>> > > 2.20.1
>> > >
>> > Applied this and selected only
>> >
>> > CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE=y
>> > CONFIG_CPU_FREQ_GOV_PERFORMANCE=y
>> > CONFIG_CPU_FREQ_GOV_POWERSAVE=y
>> >
>> > After changing the governor from 'powersave' to 'performance' the board
>> > completely froze (i even lost access to the serial port)
>> >
>> > Cheers
>> > /Ilias
>> >

-- 
Gregory Clement, Bootlin
Embedded Linux and Kernel engineering
http://bootlin.com

WARNING: multiple messages have this Message-ID (diff)
From: Gregory CLEMENT <gregory.clement@bootlin.com>
To: Ilias Apalodimas <ilias.apalodimas@linaro.org>,
	Christian Neubert <christian.neubert.86@gmail.com>
Cc: "Andrew Lunn" <andrew@lunn.ch>,
	"Vincent Guittot" <vincent.guittot@linaro.org>,
	"Jason Cooper" <jason@lakedaemon.net>,
	linux-pm@vger.kernel.org,
	"Antoine Tenart" <antoine.tenart@bootlin.com>,
	"Viresh Kumar" <viresh.kumar@linaro.org>,
	"Mike Turquette" <mturquette@baylibre.com>,
	"Rafael J. Wysocki" <rjw@rjwysocki.net>,
	linux-kernel@vger.kernel.org, stable@vger.kernel.org,
	linux-clk@vger.kernel.org,
	"Thomas Petazzoni" <thomas.petazzoni@bootlin.com>,
	"Miquèl Raynal" <miquel.raynal@bootlin.com>,
	"Maxime Chevallier" <maxime.chevallier@bootlin.com>,
	"Stephen Boyd" <sboyd@codeaurora.org>,
	linux-arm-kernel@lists.infradead.org,
	"Sebastian Hesselbarth" <sebastian.hesselbarth@gmail.com>
Subject: Re: [PATCH] clk: mvebu: armada-37xx-periph: Fix initialization for cpu clocks
Date: Thu, 14 Mar 2019 15:20:37 +0100	[thread overview]
Message-ID: <874l85v8p6.fsf@FE-laptop> (raw)
In-Reply-To: <20190314134428.GA24768@apalos>

Hi Ilias,
 
 On jeu., mars 14 2019, Ilias Apalodimas <ilias.apalodimas@linaro.org> wrote:

> Hello Christian,
>> Hi,
>> 
>> I assume you use the 1000 MHz firmware. This does also not work on my Rev 7
>> board. But I'm pretty sure this is not a problem of the patches, because if
>> I take a newer kernel (4.19.20/27) without the patches it also does not
>> work. A kernel 4.19.17 does work for me. My opinion on that is that this is
>> another problem which does just occure now because now the cpu frequency
>> scaling is working with the right frequencies.
> I am not sure which firmware i am running, i did all my tests on 5.0.0 and
> changing between governors worked fine without the patches

Curently my espressobin is broken so I tested the patches on the Armada
3700 DB and I didn't observe the issue you had.

The 3700 DB I used is configured to run at 800MHz.

Could you apply the following patch and sent me the boot log?

diff --git a/drivers/clk/mvebu/armada-37xx-periph.c b/drivers/clk/mvebu/armada-37xx-periph.c
index 26ed3c18a239..f814ade5cd80 100644
--- a/drivers/clk/mvebu/armada-37xx-periph.c
+++ b/drivers/clk/mvebu/armada-37xx-periph.c
@@ -452,14 +452,17 @@ static int clk_pm_cpu_set_parent(struct clk_hw *hw, u8 index)
 
        /* Set the parent clock for all the load level */
        for (load_level = 0; load_level < LOAD_LEVEL_NR; load_level++) {
-               unsigned int reg, mask,  val,
+               unsigned int reg, mask,  val, old,
                        offset = ARMADA_37XX_NB_TBG_SEL_OFF;
 
                armada_3700_pm_dvfs_update_regs(load_level, &reg, &offset);
 
                val = index << offset;
                mask = ARMADA_37XX_NB_TBG_SEL_MASK << offset;
+               regmap_read(base, reg, &old);
                regmap_update_bits(base, reg, mask, val);
+               pr_err("%s old=%X -> val=0x%X load_level=%d\n",
+                      __func__, old,  val, load_level);
        }
        return 0;
 }



>
> Regards
> /Ilias
>> 
>> Ilias Apalodimas <ilias.apalodimas@linaro.org> schrieb am Do., 14. März
>> 2019, 13:15:
>> 
>> > Hi Gregory,
>> > > The clock parenting was not setup properly when DVFS was enabled. It was
>> > > expected that the same clock source was used with and without DVFS which
>> > > was not the case.
>> > >
>> > > This patch fixes this issue, allowing to make the cpufreq support work
>> > > when the CPU clocks source are not the default ones.
>> > >
>> > > Fixes: 92ce45fb875d ("cpufreq: Add DVFS support for Armada 37xx")
>> > > Cc: <stable@vger.kernel.org>
>> > > Reported-by: Christian Neubert <christian.neubert.86@gmail.com>
>> > > Reported-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
>> > > Signed-off-by: Gregory CLEMENT <gregory.clement@bootlin.com>
>> > > ---
>> > >  drivers/clk/mvebu/armada-37xx-periph.c | 11 +++++++++++
>> > >  1 file changed, 11 insertions(+)
>> > >
>> > > diff --git a/drivers/clk/mvebu/armada-37xx-periph.c
>> > b/drivers/clk/mvebu/armada-37xx-periph.c
>> > > index 1f1cff428d78..26ed3c18a239 100644
>> > > --- a/drivers/clk/mvebu/armada-37xx-periph.c
>> > > +++ b/drivers/clk/mvebu/armada-37xx-periph.c
>> > > @@ -671,6 +671,17 @@ static int armada_3700_add_composite_clk(const
>> > struct clk_periph_data *data,
>> > >               map = syscon_regmap_lookup_by_compatible(
>> > >                               "marvell,armada-3700-nb-pm");
>> > >               pmcpu_clk->nb_pm_base = map;
>> > > +
>> > > +             /*
>> > > +              * Use the same parent when DVFS is enabled that the
>> > > +              * default parent received at boot time. When this
>> > > +              * function is called, DVFS is not enabled yet, so we
>> > > +              * get the default parent and we can set the parent
>> > > +              * for DVFS.
>> > > +              */
>> > > +             if (clk_pm_cpu_set_parent(muxrate_hw,
>> > > +
>> >  clk_pm_cpu_get_parent(muxrate_hw)))
>> > > +                     dev_warn(dev, "Failed to setup default parent
>> > clock for DVFS\n");
>> > >       }
>> > >
>> > >       *hw = clk_hw_register_composite(dev, data->name,
>> > data->parent_names,
>> > > --
>> > > 2.20.1
>> > >
>> > Applied this and selected only
>> >
>> > CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE=y
>> > CONFIG_CPU_FREQ_GOV_PERFORMANCE=y
>> > CONFIG_CPU_FREQ_GOV_POWERSAVE=y
>> >
>> > After changing the governor from 'powersave' to 'performance' the board
>> > completely froze (i even lost access to the serial port)
>> >
>> > Cheers
>> > /Ilias
>> >

-- 
Gregory Clement, Bootlin
Embedded Linux and Kernel engineering
http://bootlin.com

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

  parent reply	other threads:[~2019-03-14 14:20 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-13 16:35 [PATCH] clk: mvebu: armada-37xx-periph: Fix initialization for cpu clocks Gregory CLEMENT
2019-03-13 16:35 ` Gregory CLEMENT
2019-03-14 12:15 ` Ilias Apalodimas
2019-03-14 12:15   ` Ilias Apalodimas
     [not found]   ` <CAC5LXJcCs4nr-qFOWzUJpUBAJ9ngG-cgeTCVCFBKFc1SPzHMuQ@mail.gmail.com>
2019-03-14 13:44     ` Ilias Apalodimas
2019-03-14 13:44       ` Ilias Apalodimas
     [not found]       ` <CAC5LXJf=f2bZLroSXFkGiF2W=1XzAgb_wwtpvZY7O9xv28wbVA@mail.gmail.com>
2019-03-14 14:15         ` Ilias Apalodimas
2019-03-14 14:15           ` Ilias Apalodimas
2019-03-14 14:20       ` Gregory CLEMENT [this message]
2019-03-14 14:20         ` Gregory CLEMENT
2019-03-18 11:28         ` Ilias Apalodimas
2019-03-18 11:28           ` Ilias Apalodimas
2019-03-18 11:40           ` Gregory CLEMENT
2019-03-18 11:40             ` Gregory CLEMENT
2019-03-18 12:21             ` Ilias Apalodimas
2019-03-18 12:21               ` Ilias Apalodimas
2019-04-24  9:30               ` Viresh Kumar
2019-04-24  9:30                 ` Viresh Kumar
2019-04-25 12:33                 ` Ilias Apalodimas
2019-04-25 12:33                   ` Ilias Apalodimas
2019-05-20 11:20                   ` Viresh Kumar
2019-05-20 11:20                     ` Viresh Kumar
2019-05-22  7:03                     ` Ilias Apalodimas
2019-05-22  7:03                       ` Ilias Apalodimas
2019-05-22  7:06                       ` Viresh Kumar
2019-05-22  7:06                         ` Viresh Kumar
2019-06-10 10:19                         ` Viresh Kumar
2019-06-10 10:19                           ` Viresh Kumar
2019-07-17 10:33                           ` Viresh Kumar
2019-07-17 10:33                             ` Viresh Kumar

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=874l85v8p6.fsf@FE-laptop \
    --to=gregory.clement@bootlin.com \
    --cc=andrew@lunn.ch \
    --cc=antoine.tenart@bootlin.com \
    --cc=christian.neubert.86@gmail.com \
    --cc=ilias.apalodimas@linaro.org \
    --cc=jason@lakedaemon.net \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=maxime.chevallier@bootlin.com \
    --cc=miquel.raynal@bootlin.com \
    --cc=mturquette@baylibre.com \
    --cc=rjw@rjwysocki.net \
    --cc=sboyd@codeaurora.org \
    --cc=sebastian.hesselbarth@gmail.com \
    --cc=stable@vger.kernel.org \
    --cc=thomas.petazzoni@bootlin.com \
    --cc=vincent.guittot@linaro.org \
    --cc=viresh.kumar@linaro.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.