All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lubomir Rintel <lkundrak@v3.sk>
To: arm@kernel.org, Olof Johansson <olof@lixom.net>,
	Arnd Bergmann <arnd@arndb.de>
Cc: Eric Miao <eric.y.miao@gmail.com>,
	Haojian Zhuang <haojian.zhuang@gmail.com>,
	Russell King <linux@armlinux.org.uk>,
	Robert Jarzmik <robert.jarzmik@free.fr>,
	Pavel Machek <pavel@ucw.cz>, James Cameron <quozl@laptop.org>,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, Lubomir Rintel <lkundrak@v3.sk>
Subject: [PATCH v4 14/20] ARM: mmp/mmp2: use cpu_is_pj4() instead of cpu_is_mmp2()
Date: Wed, 28 Nov 2018 18:53:18 +0100	[thread overview]
Message-ID: <20181128175324.163202-15-lkundrak@v3.sk> (raw)
In-Reply-To: <20181128175324.163202-1-lkundrak@v3.sk>

The MMP2 platform uses the PJ4 CPU. The cpu_is_mmp2() macro is thus
actually not useful at all and moreover gives the wrong result on
MACH_MMP2_DT.

The actual problem I aim to fix is that on a device-tree enabled system,
the timer ends up being initialized incorrectly. In fact, it ticks like
at rate that's 1/100 slower or so.

Perhaps the other cpu_is_mmp2() uses are more benign, but still useless.

Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
Acked-by: Pavel Machek <pavel@ucw.cz>
---
 arch/arm/mach-mmp/cputype.h | 9 ---------
 arch/arm/mach-mmp/mmp2.c    | 2 +-
 arch/arm/mach-mmp/pm-mmp2.c | 2 +-
 arch/arm/mach-mmp/time.c    | 2 +-
 4 files changed, 3 insertions(+), 12 deletions(-)

diff --git a/arch/arm/mach-mmp/cputype.h b/arch/arm/mach-mmp/cputype.h
index 446edaeb78a7..405dbbbbbcdd 100644
--- a/arch/arm/mach-mmp/cputype.h
+++ b/arch/arm/mach-mmp/cputype.h
@@ -44,13 +44,4 @@ static inline int cpu_is_pxa910(void)
 #define cpu_is_pxa910()	(0)
 #endif
 
-#ifdef CONFIG_CPU_MMP2
-static inline int cpu_is_mmp2(void)
-{
-	return (((read_cpuid_id() >> 8) & 0xff) == 0x58);
-}
-#else
-#define cpu_is_mmp2()	(0)
-#endif
-
 #endif /* __ASM_MACH_CPUTYPE_H */
diff --git a/arch/arm/mach-mmp/mmp2.c b/arch/arm/mach-mmp/mmp2.c
index afba5460cdaf..b670fafedeac 100644
--- a/arch/arm/mach-mmp/mmp2.c
+++ b/arch/arm/mach-mmp/mmp2.c
@@ -104,7 +104,7 @@ void __init mmp2_init_irq(void)
 
 static int __init mmp2_init(void)
 {
-	if (cpu_is_mmp2()) {
+	if (cpu_is_pj4()) {
 #ifdef CONFIG_CACHE_TAUROS2
 		tauros2_init(0);
 #endif
diff --git a/arch/arm/mach-mmp/pm-mmp2.c b/arch/arm/mach-mmp/pm-mmp2.c
index 17699be3bc3d..bcd5111ffb37 100644
--- a/arch/arm/mach-mmp/pm-mmp2.c
+++ b/arch/arm/mach-mmp/pm-mmp2.c
@@ -220,7 +220,7 @@ static int __init mmp2_pm_init(void)
 {
 	uint32_t apcr;
 
-	if (!cpu_is_mmp2())
+	if (!cpu_is_pj4())
 		return -EIO;
 
 	suspend_set_ops(&mmp2_pm_ops);
diff --git a/arch/arm/mach-mmp/time.c b/arch/arm/mach-mmp/time.c
index 96ad1db0b04b..0f49ac579a17 100644
--- a/arch/arm/mach-mmp/time.c
+++ b/arch/arm/mach-mmp/time.c
@@ -163,7 +163,7 @@ static void __init timer_config(void)
 
 	__raw_writel(0x0, mmp_timer_base + TMR_CER); /* disable */
 
-	ccr &= (cpu_is_mmp2()) ? (TMR_CCR_CS_0(0) | TMR_CCR_CS_1(0)) :
+	ccr &= (cpu_is_pj4()) ? (TMR_CCR_CS_0(0) | TMR_CCR_CS_1(0)) :
 		(TMR_CCR_CS_0(3) | TMR_CCR_CS_1(3));
 	__raw_writel(ccr, mmp_timer_base + TMR_CCR);
 
-- 
2.19.1


WARNING: multiple messages have this Message-ID (diff)
From: lkundrak@v3.sk (Lubomir Rintel)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v4 14/20] ARM: mmp/mmp2: use cpu_is_pj4() instead of cpu_is_mmp2()
Date: Wed, 28 Nov 2018 18:53:18 +0100	[thread overview]
Message-ID: <20181128175324.163202-15-lkundrak@v3.sk> (raw)
In-Reply-To: <20181128175324.163202-1-lkundrak@v3.sk>

The MMP2 platform uses the PJ4 CPU. The cpu_is_mmp2() macro is thus
actually not useful at all and moreover gives the wrong result on
MACH_MMP2_DT.

The actual problem I aim to fix is that on a device-tree enabled system,
the timer ends up being initialized incorrectly. In fact, it ticks like
at rate that's 1/100 slower or so.

Perhaps the other cpu_is_mmp2() uses are more benign, but still useless.

Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
Acked-by: Pavel Machek <pavel@ucw.cz>
---
 arch/arm/mach-mmp/cputype.h | 9 ---------
 arch/arm/mach-mmp/mmp2.c    | 2 +-
 arch/arm/mach-mmp/pm-mmp2.c | 2 +-
 arch/arm/mach-mmp/time.c    | 2 +-
 4 files changed, 3 insertions(+), 12 deletions(-)

diff --git a/arch/arm/mach-mmp/cputype.h b/arch/arm/mach-mmp/cputype.h
index 446edaeb78a7..405dbbbbbcdd 100644
--- a/arch/arm/mach-mmp/cputype.h
+++ b/arch/arm/mach-mmp/cputype.h
@@ -44,13 +44,4 @@ static inline int cpu_is_pxa910(void)
 #define cpu_is_pxa910()	(0)
 #endif
 
-#ifdef CONFIG_CPU_MMP2
-static inline int cpu_is_mmp2(void)
-{
-	return (((read_cpuid_id() >> 8) & 0xff) == 0x58);
-}
-#else
-#define cpu_is_mmp2()	(0)
-#endif
-
 #endif /* __ASM_MACH_CPUTYPE_H */
diff --git a/arch/arm/mach-mmp/mmp2.c b/arch/arm/mach-mmp/mmp2.c
index afba5460cdaf..b670fafedeac 100644
--- a/arch/arm/mach-mmp/mmp2.c
+++ b/arch/arm/mach-mmp/mmp2.c
@@ -104,7 +104,7 @@ void __init mmp2_init_irq(void)
 
 static int __init mmp2_init(void)
 {
-	if (cpu_is_mmp2()) {
+	if (cpu_is_pj4()) {
 #ifdef CONFIG_CACHE_TAUROS2
 		tauros2_init(0);
 #endif
diff --git a/arch/arm/mach-mmp/pm-mmp2.c b/arch/arm/mach-mmp/pm-mmp2.c
index 17699be3bc3d..bcd5111ffb37 100644
--- a/arch/arm/mach-mmp/pm-mmp2.c
+++ b/arch/arm/mach-mmp/pm-mmp2.c
@@ -220,7 +220,7 @@ static int __init mmp2_pm_init(void)
 {
 	uint32_t apcr;
 
-	if (!cpu_is_mmp2())
+	if (!cpu_is_pj4())
 		return -EIO;
 
 	suspend_set_ops(&mmp2_pm_ops);
diff --git a/arch/arm/mach-mmp/time.c b/arch/arm/mach-mmp/time.c
index 96ad1db0b04b..0f49ac579a17 100644
--- a/arch/arm/mach-mmp/time.c
+++ b/arch/arm/mach-mmp/time.c
@@ -163,7 +163,7 @@ static void __init timer_config(void)
 
 	__raw_writel(0x0, mmp_timer_base + TMR_CER); /* disable */
 
-	ccr &= (cpu_is_mmp2()) ? (TMR_CCR_CS_0(0) | TMR_CCR_CS_1(0)) :
+	ccr &= (cpu_is_pj4()) ? (TMR_CCR_CS_0(0) | TMR_CCR_CS_1(0)) :
 		(TMR_CCR_CS_0(3) | TMR_CCR_CS_1(3));
 	__raw_writel(ccr, mmp_timer_base + TMR_CCR);
 
-- 
2.19.1

  parent reply	other threads:[~2018-11-28 17:54 UTC|newest]

Thread overview: 78+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-28 17:53 [PATCH v4 0/20] MMP platform fixes Lubomir Rintel
2018-11-28 17:53 ` Lubomir Rintel
2018-11-28 17:53 ` [PATCH v4 01/20] dt-bindings: mrvl,mmp-timer: add clock Lubomir Rintel
2018-11-28 17:53   ` Lubomir Rintel
2018-11-30 23:10   ` Olof Johansson
2018-11-30 23:10     ` Olof Johansson
2018-11-28 17:53 ` [PATCH v4 02/20] DT: marvell,mmp2: fix the gpio interrupt cell number Lubomir Rintel
2018-11-28 17:53   ` [PATCH v4 02/20] DT: marvell, mmp2: " Lubomir Rintel
2018-11-30 23:11   ` [PATCH v4 02/20] DT: marvell,mmp2: " Olof Johansson
2018-11-30 23:11     ` Olof Johansson
2018-11-28 17:53 ` [PATCH v4 03/20] DT: marvell,mmp2: give gpio node a name Lubomir Rintel
2018-11-28 17:53   ` Lubomir Rintel
2018-11-28 17:53 ` [PATCH v4 04/20] DT: marvell,mmp2: add clock to the timer Lubomir Rintel
2018-11-28 17:53   ` Lubomir Rintel
2018-11-28 17:53 ` [PATCH v4 05/20] DT: marvell,mmp2: add MMC controllers Lubomir Rintel
2018-11-28 17:53   ` Lubomir Rintel
2018-11-28 17:53 ` [PATCH v4 06/20] DT: marvell,mmp2: fix TWSI2 Lubomir Rintel
2018-11-28 17:53   ` Lubomir Rintel
2018-11-28 17:53 ` [PATCH v4 07/20] DT: marvell,mmp2: add more TWSI controllers Lubomir Rintel
2018-11-28 17:53   ` Lubomir Rintel
2018-11-28 17:53 ` [PATCH v4 08/20] DT: marvell,mmp2: add OTG PHY Lubomir Rintel
2018-11-28 17:53   ` Lubomir Rintel
2018-11-28 17:53 ` [PATCH v4 09/20] DT: marvell,mmp2: add USB OTG host controller Lubomir Rintel
2018-11-28 17:53   ` Lubomir Rintel
2018-11-28 17:53 ` [PATCH v4 10/20] DT: marvell,mmp2: Add SSP controllers Lubomir Rintel
2018-11-28 17:53   ` Lubomir Rintel
2018-11-28 17:53 ` [PATCH v4 11/20] irqchip/mmp: only touch the PJ4 & FIQ bits on enable/disable Lubomir Rintel
2018-11-28 17:53   ` Lubomir Rintel
2018-11-28 17:53 ` [PATCH v4 12/20] irqchip/mmp: do not use of_address_to_resource() to get mux regs Lubomir Rintel
2018-11-28 17:53   ` Lubomir Rintel
2018-12-01 12:59   ` Pavel Machek
2018-12-01 12:59     ` Pavel Machek
2018-11-28 17:53 ` [PATCH v4 13/20] gpio: pxa: avoid attempting to set pin direction via pinctrl on MMP2 Lubomir Rintel
2018-11-28 17:53   ` Lubomir Rintel
2018-11-28 17:53 ` Lubomir Rintel [this message]
2018-11-28 17:53   ` [PATCH v4 14/20] ARM: mmp/mmp2: use cpu_is_pj4() instead of cpu_is_mmp2() Lubomir Rintel
2018-11-28 21:34   ` Arnd Bergmann
2018-11-28 21:34     ` Arnd Bergmann
2018-11-28 17:53 ` [PATCH v4 15/20] ARM: mmp2: initialize clocks before the timer Lubomir Rintel
2018-11-28 17:53   ` Lubomir Rintel
2018-11-30 23:59   ` Olof Johansson
2018-11-30 23:59     ` Olof Johansson
2018-11-28 17:53 ` [PATCH v4 16/20] ARM: mmp/mmp2: dt: enable the clock Lubomir Rintel
2018-11-28 17:53   ` Lubomir Rintel
2018-11-30 23:59   ` Olof Johansson
2018-11-30 23:59     ` Olof Johansson
2018-11-28 17:53 ` [PATCH v4 17/20] ARM: mmp: add a pxa-usb-phy device Lubomir Rintel
2018-11-28 17:53   ` Lubomir Rintel
2018-11-30 23:59   ` Olof Johansson
2018-11-30 23:59     ` Olof Johansson
2018-11-28 17:53 ` [PATCH v4 18/20] ARM: mmp: add an instance of pxa-usb-phy to ttc_dkb and aspenite Lubomir Rintel
2018-11-28 17:53   ` Lubomir Rintel
2018-12-01  0:00   ` Olof Johansson
2018-12-01  0:00     ` Olof Johansson
2018-11-28 17:53 ` [PATCH v4 19/20] USB: phy-mv-usb: use phy-pxa-usb Lubomir Rintel
2018-11-28 17:53   ` Lubomir Rintel
2018-11-30 23:42   ` Olof Johansson
2018-11-30 23:42     ` Olof Johansson
2018-12-01 13:10     ` Pavel Machek
2018-12-01 13:10       ` Pavel Machek
2018-12-02 19:07       ` Olof Johansson
2018-12-02 19:07         ` Olof Johansson
2018-11-28 17:53 ` [PATCH v4 20/20] USB: gadget: mv-udc: " Lubomir Rintel
2018-11-28 17:53   ` Lubomir Rintel
2018-11-30 23:42   ` Olof Johansson
2018-11-30 23:42     ` Olof Johansson
2018-11-28 21:39 ` [PATCH v4 0/20] MMP platform fixes Arnd Bergmann
2018-11-28 21:39   ` Arnd Bergmann
2018-11-28 21:44   ` Pavel Machek
2018-11-28 21:44     ` Pavel Machek
2018-11-30 23:44   ` Olof Johansson
2018-11-30 23:44     ` Olof Johansson
2018-12-02 12:07     ` Lubomir Rintel
2018-12-02 12:07       ` Lubomir Rintel
2018-12-02 22:29     ` Pavel Machek
2018-12-02 22:29       ` Pavel Machek
2018-12-02 23:24       ` James Cameron
2018-12-02 23:24         ` James Cameron

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=20181128175324.163202-15-lkundrak@v3.sk \
    --to=lkundrak@v3.sk \
    --cc=arm@kernel.org \
    --cc=arnd@arndb.de \
    --cc=eric.y.miao@gmail.com \
    --cc=haojian.zhuang@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=olof@lixom.net \
    --cc=pavel@ucw.cz \
    --cc=quozl@laptop.org \
    --cc=robert.jarzmik@free.fr \
    /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.