All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] [Loongson2F] adjust cpufreq uses of LOONGSON_CHIPCFG
@ 2020-01-18  5:00 Alexandre Oliva
  2020-01-20 18:06 ` Paul Burton
  0 siblings, 1 reply; 5+ messages in thread
From: Alexandre Oliva @ 2020-01-18  5:00 UTC (permalink / raw)
  To: Jiaxun Yang; +Cc: linux-mips, paul.burton


The post-fork cleanup of loongson2ef from loongson64 changed
LOONGSON_CHIPCFG from a single-argument functional macro to a
non-functional macro with an mmio address in loongson2ef, but
loongson2_cpufreq still uses the notation of a functional macro call
expecting it to be an lvalue.  Fixed based on loongson_suspend_enter.

Signed-off-by: Alexandre Oliva <lxoliva@fsfla.org>
Cc: Jiaxun Yang <jiaxun.yang@flygoat.com>
Cc: linux-mips@vger.kernel.org
Cc: paul.burton@mips.com
---
 drivers/cpufreq/loongson2_cpufreq.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/cpufreq/loongson2_cpufreq.c b/drivers/cpufreq/loongson2_cpufreq.c
index 84f0eee..ace2d46 100644
--- a/drivers/cpufreq/loongson2_cpufreq.c
+++ b/drivers/cpufreq/loongson2_cpufreq.c
@@ -144,9 +144,11 @@ static void loongson2_cpu_wait(void)
 	u32 cpu_freq;
 
 	spin_lock_irqsave(&loongson2_wait_lock, flags);
-	cpu_freq = LOONGSON_CHIPCFG(0);
-	LOONGSON_CHIPCFG(0) &= ~0x7;	/* Put CPU into wait mode */
-	LOONGSON_CHIPCFG(0) = cpu_freq;	/* Restore CPU state */
+	cpu_freq = readl(LOONGSON_CHIPCFG);
+	/* Put CPU into wait mode */
+	writel(readl(LOONGSON_CHIPCFG) & ~0x7, LOONGSON_CHIPCFG);
+	/* Restore CPU state */
+	writel(cpu_freq, LOONGSON_CHIPCFG);
 	spin_unlock_irqrestore(&loongson2_wait_lock, flags);
 	local_irq_enable();
 }
-- 
2.7.4


-- 
Alexandre Oliva, freedom fighter   he/him   https://FSFLA.org/blogs/lxo
Free Software Evangelist           Stallman was right, but he's left :(
GNU Toolchain Engineer    FSMatrix: It was he who freed the first of us
FSF & FSFLA board member                The Savior shall return (true);

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

* Re: [PATCH] [Loongson2F] adjust cpufreq uses of LOONGSON_CHIPCFG
  2020-01-18  5:00 [PATCH] [Loongson2F] adjust cpufreq uses of LOONGSON_CHIPCFG Alexandre Oliva
@ 2020-01-20 18:06 ` Paul Burton
  2020-01-21  4:53   ` Viresh Kumar
  0 siblings, 1 reply; 5+ messages in thread
From: Paul Burton @ 2020-01-20 18:06 UTC (permalink / raw)
  To: Alexandre Oliva
  Cc: Jiaxun Yang, linux-mips, paul.burton, Rafael J. Wysocki,
	Viresh Kumar, linux-pm

Hi Alexandre,

On Sat, Jan 18, 2020 at 02:00:43AM -0300, Alexandre Oliva wrote:
> 
> The post-fork cleanup of loongson2ef from loongson64 changed
> LOONGSON_CHIPCFG from a single-argument functional macro to a
> non-functional macro with an mmio address in loongson2ef, but
> loongson2_cpufreq still uses the notation of a functional macro call
> expecting it to be an lvalue.  Fixed based on loongson_suspend_enter.
> 
> Signed-off-by: Alexandre Oliva <lxoliva@fsfla.org>
> Cc: Jiaxun Yang <jiaxun.yang@flygoat.com>
> Cc: linux-mips@vger.kernel.org
> Cc: paul.burton@mips.com

This patch looks good to me, but you need to copy the cpufreq
maintainers:

$ ./scripts/get_maintainer.pl -f drivers/cpufreq/loongson2_cpufreq.c
Jiaxun Yang <jiaxun.yang@flygoat.com> (maintainer:MIPS/LOONGSON2EF ARCHITECTURE)
"Rafael J. Wysocki" <rjw@rjwysocki.net> (maintainer:CPU FREQUENCY SCALING FRAMEWORK)
Viresh Kumar <viresh.kumar@linaro.org> (maintainer:CPU FREQUENCY SCALING FRAMEWORK)
linux-mips@vger.kernel.org (open list:MIPS/LOONGSON2EF ARCHITECTURE)
linux-pm@vger.kernel.org (open list:CPU FREQUENCY SCALING FRAMEWORK)
linux-kernel@vger.kernel.org (open list)

I've CC'd them now, but they might want the patch resending.

Thanks,
    Paul

> ---
>  drivers/cpufreq/loongson2_cpufreq.c | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/cpufreq/loongson2_cpufreq.c b/drivers/cpufreq/loongson2_cpufreq.c
> index 84f0eee..ace2d46 100644
> --- a/drivers/cpufreq/loongson2_cpufreq.c
> +++ b/drivers/cpufreq/loongson2_cpufreq.c
> @@ -144,9 +144,11 @@ static void loongson2_cpu_wait(void)
>  	u32 cpu_freq;
>  
>  	spin_lock_irqsave(&loongson2_wait_lock, flags);
> -	cpu_freq = LOONGSON_CHIPCFG(0);
> -	LOONGSON_CHIPCFG(0) &= ~0x7;	/* Put CPU into wait mode */
> -	LOONGSON_CHIPCFG(0) = cpu_freq;	/* Restore CPU state */
> +	cpu_freq = readl(LOONGSON_CHIPCFG);
> +	/* Put CPU into wait mode */
> +	writel(readl(LOONGSON_CHIPCFG) & ~0x7, LOONGSON_CHIPCFG);
> +	/* Restore CPU state */
> +	writel(cpu_freq, LOONGSON_CHIPCFG);
>  	spin_unlock_irqrestore(&loongson2_wait_lock, flags);
>  	local_irq_enable();
>  }
> -- 
> 2.7.4
> 
> 
> -- 
> Alexandre Oliva, freedom fighter   he/him   https://FSFLA.org/blogs/lxo
> Free Software Evangelist           Stallman was right, but he's left :(
> GNU Toolchain Engineer    FSMatrix: It was he who freed the first of us
> FSF & FSFLA board member                The Savior shall return (true);

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

* Re: [PATCH] [Loongson2F] adjust cpufreq uses of LOONGSON_CHIPCFG
  2020-01-20 18:06 ` Paul Burton
@ 2020-01-21  4:53   ` Viresh Kumar
  2020-01-21 12:30     ` Alexandre Oliva
  0 siblings, 1 reply; 5+ messages in thread
From: Viresh Kumar @ 2020-01-21  4:53 UTC (permalink / raw)
  To: Paul Burton
  Cc: Alexandre Oliva, Jiaxun Yang, linux-mips, paul.burton,
	Rafael J. Wysocki, linux-pm

On 20-01-20, 10:06, Paul Burton wrote:
> Hi Alexandre,
> 
> On Sat, Jan 18, 2020 at 02:00:43AM -0300, Alexandre Oliva wrote:
> > 
> > The post-fork cleanup of loongson2ef from loongson64 changed
> > LOONGSON_CHIPCFG from a single-argument functional macro to a
> > non-functional macro with an mmio address in loongson2ef, but
> > loongson2_cpufreq still uses the notation of a functional macro call
> > expecting it to be an lvalue.  Fixed based on loongson_suspend_enter.
> > 
> > Signed-off-by: Alexandre Oliva <lxoliva@fsfla.org>
> > Cc: Jiaxun Yang <jiaxun.yang@flygoat.com>
> > Cc: linux-mips@vger.kernel.org
> > Cc: paul.burton@mips.com
> 
> This patch looks good to me, but you need to copy the cpufreq
> maintainers:
> 
> $ ./scripts/get_maintainer.pl -f drivers/cpufreq/loongson2_cpufreq.c
> Jiaxun Yang <jiaxun.yang@flygoat.com> (maintainer:MIPS/LOONGSON2EF ARCHITECTURE)
> "Rafael J. Wysocki" <rjw@rjwysocki.net> (maintainer:CPU FREQUENCY SCALING FRAMEWORK)
> Viresh Kumar <viresh.kumar@linaro.org> (maintainer:CPU FREQUENCY SCALING FRAMEWORK)
> linux-mips@vger.kernel.org (open list:MIPS/LOONGSON2EF ARCHITECTURE)
> linux-pm@vger.kernel.org (open list:CPU FREQUENCY SCALING FRAMEWORK)
> linux-kernel@vger.kernel.org (open list)
> 
> I've CC'd them now, but they might want the patch resending.
> 
> Thanks,
>     Paul
> 
> > ---
> >  drivers/cpufreq/loongson2_cpufreq.c | 8 +++++---
> >  1 file changed, 5 insertions(+), 3 deletions(-)
> > 
> > diff --git a/drivers/cpufreq/loongson2_cpufreq.c b/drivers/cpufreq/loongson2_cpufreq.c
> > index 84f0eee..ace2d46 100644
> > --- a/drivers/cpufreq/loongson2_cpufreq.c
> > +++ b/drivers/cpufreq/loongson2_cpufreq.c
> > @@ -144,9 +144,11 @@ static void loongson2_cpu_wait(void)
> >  	u32 cpu_freq;
> >  
> >  	spin_lock_irqsave(&loongson2_wait_lock, flags);
> > -	cpu_freq = LOONGSON_CHIPCFG(0);
> > -	LOONGSON_CHIPCFG(0) &= ~0x7;	/* Put CPU into wait mode */
> > -	LOONGSON_CHIPCFG(0) = cpu_freq;	/* Restore CPU state */
> > +	cpu_freq = readl(LOONGSON_CHIPCFG);
> > +	/* Put CPU into wait mode */
> > +	writel(readl(LOONGSON_CHIPCFG) & ~0x7, LOONGSON_CHIPCFG);
> > +	/* Restore CPU state */
> > +	writel(cpu_freq, LOONGSON_CHIPCFG);
> >  	spin_unlock_irqrestore(&loongson2_wait_lock, flags);
> >  	local_irq_enable();
> >  }

Please resend it and add my

Acked-by: Viresh Kumar <viresh.kumar@linaro.org>

-- 
viresh

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

* [PATCH] [Loongson2F] adjust cpufreq uses of LOONGSON_CHIPCFG
  2020-01-21  4:53   ` Viresh Kumar
@ 2020-01-21 12:30     ` Alexandre Oliva
  2020-01-22 23:46       ` Rafael J. Wysocki
  0 siblings, 1 reply; 5+ messages in thread
From: Alexandre Oliva @ 2020-01-21 12:30 UTC (permalink / raw)
  To: Viresh Kumar
  Cc: Paul Burton, Jiaxun Yang, linux-mips, paul.burton,
	Rafael J. Wysocki, linux-pm

The post-fork cleanup of loongson2ef from loongson64 changed
LOONGSON_CHIPCFG from a single-argument functional macro to a
non-functional macro with an mmio address in loongson2ef, but
loongson2_cpufreq still uses the notation of a functional macro call
expecting it to be an lvalue.  Fixed based on loongson_suspend_enter.

Signed-off-by: Alexandre Oliva <lxoliva@fsfla.org>
Cc: Jiaxun Yang <jiaxun.yang@flygoat.com>
Cc: linux-mips@vger.kernel.org
Cc: paul.burton@mips.com
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
---
 drivers/cpufreq/loongson2_cpufreq.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/cpufreq/loongson2_cpufreq.c b/drivers/cpufreq/loongson2_cpufreq.c
index 84f0eee..ace2d46 100644
--- a/drivers/cpufreq/loongson2_cpufreq.c
+++ b/drivers/cpufreq/loongson2_cpufreq.c
@@ -144,9 +144,11 @@ static void loongson2_cpu_wait(void)
 	u32 cpu_freq;
 
 	spin_lock_irqsave(&loongson2_wait_lock, flags);
-	cpu_freq = LOONGSON_CHIPCFG(0);
-	LOONGSON_CHIPCFG(0) &= ~0x7;	/* Put CPU into wait mode */
-	LOONGSON_CHIPCFG(0) = cpu_freq;	/* Restore CPU state */
+	cpu_freq = readl(LOONGSON_CHIPCFG);
+	/* Put CPU into wait mode */
+	writel(readl(LOONGSON_CHIPCFG) & ~0x7, LOONGSON_CHIPCFG);
+	/* Restore CPU state */
+	writel(cpu_freq, LOONGSON_CHIPCFG);
 	spin_unlock_irqrestore(&loongson2_wait_lock, flags);
 	local_irq_enable();
 }
-- 
2.7.4

-- 
Alexandre Oliva, freedom fighter   he/him   https://FSFLA.org/blogs/lxo
Free Software Evangelist           Stallman was right, but he's left :(
GNU Toolchain Engineer    FSMatrix: It was he who freed the first of us
FSF & FSFLA board member                The Savior shall return (true);

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

* Re: [PATCH] [Loongson2F] adjust cpufreq uses of LOONGSON_CHIPCFG
  2020-01-21 12:30     ` Alexandre Oliva
@ 2020-01-22 23:46       ` Rafael J. Wysocki
  0 siblings, 0 replies; 5+ messages in thread
From: Rafael J. Wysocki @ 2020-01-22 23:46 UTC (permalink / raw)
  To: Alexandre Oliva
  Cc: Viresh Kumar, Paul Burton, Jiaxun Yang, linux-mips, paul.burton,
	Rafael J. Wysocki, Linux PM

On Tue, Jan 21, 2020 at 1:39 PM Alexandre Oliva <lxoliva@fsfla.org> wrote:
>
> The post-fork cleanup of loongson2ef from loongson64 changed
> LOONGSON_CHIPCFG from a single-argument functional macro to a
> non-functional macro with an mmio address in loongson2ef, but
> loongson2_cpufreq still uses the notation of a functional macro call
> expecting it to be an lvalue.  Fixed based on loongson_suspend_enter.
>
> Signed-off-by: Alexandre Oliva <lxoliva@fsfla.org>
> Cc: Jiaxun Yang <jiaxun.yang@flygoat.com>
> Cc: linux-mips@vger.kernel.org
> Cc: paul.burton@mips.com
> Acked-by: Viresh Kumar <viresh.kumar@linaro.org>

Queued up as 5.6 material under modified subject ("cpufreq:
loongson2_cpufreq: adjust cpufreq uses of LOONGSON_CHIPCFG"), thanks!

> ---
>  drivers/cpufreq/loongson2_cpufreq.c | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/cpufreq/loongson2_cpufreq.c b/drivers/cpufreq/loongson2_cpufreq.c
> index 84f0eee..ace2d46 100644
> --- a/drivers/cpufreq/loongson2_cpufreq.c
> +++ b/drivers/cpufreq/loongson2_cpufreq.c
> @@ -144,9 +144,11 @@ static void loongson2_cpu_wait(void)
>         u32 cpu_freq;
>
>         spin_lock_irqsave(&loongson2_wait_lock, flags);
> -       cpu_freq = LOONGSON_CHIPCFG(0);
> -       LOONGSON_CHIPCFG(0) &= ~0x7;    /* Put CPU into wait mode */
> -       LOONGSON_CHIPCFG(0) = cpu_freq; /* Restore CPU state */
> +       cpu_freq = readl(LOONGSON_CHIPCFG);
> +       /* Put CPU into wait mode */
> +       writel(readl(LOONGSON_CHIPCFG) & ~0x7, LOONGSON_CHIPCFG);
> +       /* Restore CPU state */
> +       writel(cpu_freq, LOONGSON_CHIPCFG);
>         spin_unlock_irqrestore(&loongson2_wait_lock, flags);
>         local_irq_enable();
>  }
> --
> 2.7.4
>
> --
> Alexandre Oliva, freedom fighter   he/him   https://FSFLA.org/blogs/lxo
> Free Software Evangelist           Stallman was right, but he's left :(
> GNU Toolchain Engineer    FSMatrix: It was he who freed the first of us
> FSF & FSFLA board member                The Savior shall return (true);

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

end of thread, other threads:[~2020-01-22 23:47 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-18  5:00 [PATCH] [Loongson2F] adjust cpufreq uses of LOONGSON_CHIPCFG Alexandre Oliva
2020-01-20 18:06 ` Paul Burton
2020-01-21  4:53   ` Viresh Kumar
2020-01-21 12:30     ` Alexandre Oliva
2020-01-22 23:46       ` Rafael J. Wysocki

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.