linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ARM: mmp/mmp2: fix cpu_is_mmp2() on mmp2-dt
@ 2018-12-02 11:12 Lubomir Rintel
  2018-12-02 15:53 ` Arnd Bergmann
  0 siblings, 1 reply; 3+ messages in thread
From: Lubomir Rintel @ 2018-12-02 11:12 UTC (permalink / raw)
  To: arm-soc, Arnd Bergmann, Olof Johansson
  Cc: Eric Miao, Haojian Zhuang, Pavel Machek, James Cameron,
	Linux ARM, Linux Kernel Mailing List, Lubomir Rintel

cpu_is_mmp2() was equivalent to cpu_is_pj4(), wouldn't be correct for
multiplatform kernels. Fix it by also considering mmp_chip_id, as is
done for cpu_is_pxa168() and cpu_is_pxa910() above.

Moreover, it is only available with CONFIG_CPU_MMP2 and thus doesn't work
on DT-based MMP2 machines. Enable it on CONFIG_MACH_MMP2_DT too.

Note: CONFIG_CPU_MMP2 is only used for machines that use board files
instead of DT. It should perhaps be renamed. I'm not doing it now, because
I don't have a better idea.

Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
---
 arch/arm/mach-mmp/cputype.h | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-mmp/cputype.h b/arch/arm/mach-mmp/cputype.h
index 446edaeb78a7..a96abcf521b4 100644
--- a/arch/arm/mach-mmp/cputype.h
+++ b/arch/arm/mach-mmp/cputype.h
@@ -44,10 +44,12 @@ static inline int cpu_is_pxa910(void)
 #define cpu_is_pxa910()	(0)
 #endif
 
-#ifdef CONFIG_CPU_MMP2
+#if defined(CONFIG_CPU_MMP2) || defined(CONFIG_MACH_MMP2_DT)
 static inline int cpu_is_mmp2(void)
 {
-	return (((read_cpuid_id() >> 8) & 0xff) == 0x58);
+	return (((read_cpuid_id() >> 8) & 0xff) == 0x58) &&
+		(((mmp_chip_id & 0xfff) == 0x410) ||
+		 ((mmp_chip_id & 0xfff) == 0x610));
 }
 #else
 #define cpu_is_mmp2()	(0)
-- 
2.19.1


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

* Re: [PATCH] ARM: mmp/mmp2: fix cpu_is_mmp2() on mmp2-dt
  2018-12-02 11:12 [PATCH] ARM: mmp/mmp2: fix cpu_is_mmp2() on mmp2-dt Lubomir Rintel
@ 2018-12-02 15:53 ` Arnd Bergmann
  2018-12-03 20:39   ` Olof Johansson
  0 siblings, 1 reply; 3+ messages in thread
From: Arnd Bergmann @ 2018-12-02 15:53 UTC (permalink / raw)
  To: Lubomir Rintel
  Cc: arm-soc, Olof Johansson, Eric Miao, Haojian Zhuang, Pavel Machek,
	quozl, Linux ARM, Linux Kernel Mailing List

On Sun, Dec 2, 2018 at 12:12 PM Lubomir Rintel <lkundrak@v3.sk> wrote:
>
> cpu_is_mmp2() was equivalent to cpu_is_pj4(), wouldn't be correct for
> multiplatform kernels. Fix it by also considering mmp_chip_id, as is
> done for cpu_is_pxa168() and cpu_is_pxa910() above.
>
> Moreover, it is only available with CONFIG_CPU_MMP2 and thus doesn't work
> on DT-based MMP2 machines. Enable it on CONFIG_MACH_MMP2_DT too.
>
> Note: CONFIG_CPU_MMP2 is only used for machines that use board files
> instead of DT. It should perhaps be renamed. I'm not doing it now, because
> I don't have a better idea.
>
> Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>

Acked-by: Arnd Bergmann <arnd@arndb.de>

I'd suggest adding

Cc: stable@vger.kernel.org

since this fixes bugs on other platforms when CONFIG_MMP2 is enabled
in a multiplatform kernel.

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

* Re: [PATCH] ARM: mmp/mmp2: fix cpu_is_mmp2() on mmp2-dt
  2018-12-02 15:53 ` Arnd Bergmann
@ 2018-12-03 20:39   ` Olof Johansson
  0 siblings, 0 replies; 3+ messages in thread
From: Olof Johansson @ 2018-12-03 20:39 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Lubomir Rintel, arm-soc, Eric Miao, Haojian Zhuang, Pavel Machek,
	quozl, Linux ARM, Linux Kernel Mailing List

On Sun, Dec 02, 2018 at 04:53:07PM +0100, Arnd Bergmann wrote:
> On Sun, Dec 2, 2018 at 12:12 PM Lubomir Rintel <lkundrak@v3.sk> wrote:
> >
> > cpu_is_mmp2() was equivalent to cpu_is_pj4(), wouldn't be correct for
> > multiplatform kernels. Fix it by also considering mmp_chip_id, as is
> > done for cpu_is_pxa168() and cpu_is_pxa910() above.
> >
> > Moreover, it is only available with CONFIG_CPU_MMP2 and thus doesn't work
> > on DT-based MMP2 machines. Enable it on CONFIG_MACH_MMP2_DT too.
> >
> > Note: CONFIG_CPU_MMP2 is only used for machines that use board files
> > instead of DT. It should perhaps be renamed. I'm not doing it now, because
> > I don't have a better idea.
> >
> > Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
> 
> Acked-by: Arnd Bergmann <arnd@arndb.de>
> 
> I'd suggest adding
> 
> Cc: stable@vger.kernel.org
> 
> since this fixes bugs on other platforms when CONFIG_MMP2 is enabled
> in a multiplatform kernel.

Applied to fixes with those tags. Thanks!


-Olof

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

end of thread, other threads:[~2018-12-03 20:48 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-02 11:12 [PATCH] ARM: mmp/mmp2: fix cpu_is_mmp2() on mmp2-dt Lubomir Rintel
2018-12-02 15:53 ` Arnd Bergmann
2018-12-03 20:39   ` Olof Johansson

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).