Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1696985imu; Wed, 28 Nov 2018 13:37:50 -0800 (PST) X-Google-Smtp-Source: AFSGD/XGlGkXJG0yOs4Wj0+SwGRAm8ircq3BR4N9ioFWssKs74HzfPrI+OQswgm/bGzhOTfQM8aF X-Received: by 2002:a17:902:468:: with SMTP id 95mr31276981ple.3.1543441069986; Wed, 28 Nov 2018 13:37:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543441069; cv=none; d=google.com; s=arc-20160816; b=LqJ8ATeRToe8x/o7KB7bgVIkUa60dXJ5vrAai1bG6wDTEwTnLFWcgzbRR3VyccMFLz AHPAOdZTE/NuJiKBJuZCCn7h94Z7WqYRW0OeBN65OTBqkziXIG9uIBOMk/g7FI4D+SeJ H4ySC5fIfN3N4kXA0iFxzEyx5mGTMR5jfND0chJT5h0MACx1V5JW/w15pT62ASTFjfUB zNwDRL8vuGHejtzRINydgAiazzlJUtqDPGqN2MRRqdRBkgQ+7zGwlg9pkCVsLIiTwL3t Jw68A/azc+3sj4LAgldZJtAq+78AXNPbK6x4CkC8MJbZJOVr4q9OAtq5eqLUzRcTLRx/ nNrA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version; bh=NAwgbzfjrplFZPtEfwcTtm1K91xj/h0NzY76QEOUON8=; b=Smh3wzgqs81/pBdC+Go9Ws+yRYZFe4fg5g9aiMRmhe3ga7JUThGJ9bfrDS4HJJzWuS tX6a0JtRhOQwPs5BEkLtHX7mHCo1H7yHxCnE4bOv5Scmwy7tgOIXrRufDZg9wCVbugQE l3XcGO/nVtH+mE2htk75gkAzAyDSPbT+0l4fcW4g9MezatToX+AmwYp3WpB9XNGd/YfV 2N4zKROliDOe5HAFfRL+aO0CZLGkF680WfqzBbV2Mq0GxtYPE/3zikdb30ut7sBM0JT7 Hgm6afIBHo94WTfthwwDj/Bd8tNcluqprTMk7U3BZ3lBGZ6FljDwl2C20KDN216hl3Ra gtVQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h32si8656921pgh.276.2018.11.28.13.37.34; Wed, 28 Nov 2018 13:37:49 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726498AbeK2IiP (ORCPT + 99 others); Thu, 29 Nov 2018 03:38:15 -0500 Received: from mail-qt1-f196.google.com ([209.85.160.196]:36572 "EHLO mail-qt1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726340AbeK2IiP (ORCPT ); Thu, 29 Nov 2018 03:38:15 -0500 Received: by mail-qt1-f196.google.com with SMTP id t13so27644577qtn.3 for ; Wed, 28 Nov 2018 13:35:14 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=NAwgbzfjrplFZPtEfwcTtm1K91xj/h0NzY76QEOUON8=; b=VV4faYiWzWPyfs659C1r5byQWdb4n5U48VafRWF4eFMsb2g0D933sfYtuQpIDXddCx 9QLBm4Bl9nIFgEngSk4lIX2eNSBPp2n7B/+1X7u59wDni5w6pvvs+ghqxnp3lUjOn9YW Vkc4h7Lj5rDRlmZChZlJUPJxmcB1eXWAeIh3QzCtU3X8KfTlVa2HnUB4jGb3QthheBTy IxDJhm0Kqgflg4tKGRlGmI5xhXw93IrhzH6stdouxFsmq9ImpwTmWD6zmsLRvQ0czODn XbZC3VH+foyLnJK2aXTJSkdgL+lx/dPIW3nMT/7TzG4KHpFX4Ejgxs2ED4XJ7bOCQo/N 4ZWA== X-Gm-Message-State: AGRZ1gLJHJEXA1Sf4enw9KMcP/z7KmxlCMZYssSvMafYcEPwaM+oBcg/ hupuAIJr3SkbR/xTTPVnclJF3Ohca9TNWbAwljCnOA== X-Received: by 2002:ac8:1d12:: with SMTP id d18mr36228458qtl.343.1543440913564; Wed, 28 Nov 2018 13:35:13 -0800 (PST) MIME-Version: 1.0 References: <20181128175324.163202-1-lkundrak@v3.sk> <20181128175324.163202-15-lkundrak@v3.sk> In-Reply-To: <20181128175324.163202-15-lkundrak@v3.sk> From: Arnd Bergmann Date: Wed, 28 Nov 2018 22:34:57 +0100 Message-ID: Subject: Re: [PATCH v4 14/20] ARM: mmp/mmp2: use cpu_is_pj4() instead of cpu_is_mmp2() To: lkundrak@v3.sk Cc: arm-soc , Olof Johansson , Eric Miao , Haojian Zhuang , Russell King - ARM Linux , Robert Jarzmik , Pavel Machek , quozl@laptop.org, Linux ARM , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Nov 28, 2018 at 6:54 PM Lubomir Rintel wrote: > > 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. I think we still need the helper. If it's broken on some platforms, it has to be fixed instead. > @@ -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); These are both regular initcalls. On a multiplatform kernel, they will be called unconditionally, and the cpu_is_mmp2() has to guard code that would be wrong on other SoCs, including those with a pj4 CPU (Armada XP, Dove, Berlin). > 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); > This looks correct, here we just need to ensure we are not on pj1. Note: we should probably rename 'timer_init' to something that that has 'mmp' in the name, the current name conflicts with a function of the same name in mach-davinci, which is not yet multiplatform, but hopefully will be one day. Arnd