Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp8814810ybi; Tue, 9 Jul 2019 23:44:13 -0700 (PDT) X-Google-Smtp-Source: APXvYqw7bijnyt8G5gSeD/RKWxA+3NiPMetoVzJ2kbqZvcNEYoWQJlDs+QD3vJoVZh9m2Oz35r+K X-Received: by 2002:a17:902:306:: with SMTP id 6mr37554553pld.148.1562741053644; Tue, 09 Jul 2019 23:44:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562741053; cv=none; d=google.com; s=arc-20160816; b=kl2P/+bBmyXZ8yEgXMoND77RBSAq57HbgrIOM4xjhVgER8GkhGVQh3OUzwkiI5x2n8 hC76xTlmVkH3j/vMzvHCehgWddvZlJCt9lPVZK/PEa4e7FtjT6a/nmWP9Xuag33S20t4 xAwXyK+fqOpk0xIMKpXNvL6wq9G7mWt1u5F7FudiLYNhtbGoDC9fgH3TMklQbPwwRmdF iC2QjWAaUfnCok1j9uEkhqS02cDnf3RjF7d6fIu3D49BZblz9sPokZ8xGrKkRtA51PNN /pEsD3m/qusc4LKvso49gaCiomG12kVomtyNl00h1AwuJVj2HfzEGsMRv8XIHYfWqV31 hh9g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=xyoFEAHVb6oNa+8sLlDE0V2MRb0/Bo4tTdKvAZdPDMs=; b=CyKaesz0kG1tpZ0TeBpTxGoJDREd8EWa6w6ilNOGedMulcok/ZZFnPKWy7OmBsYiFL SVEEPJGs3Sh5kwdApmuO73/HUUPgYDiryq9MV/J2YtUG3XJknXtzfloFL/jy+wZrTiZT 7W7H34o/9VWRL+SGSg3RJk6f+zQBXCiHXlpsszi5Rg/1cGRNfE45y8O7BIfHt2FKs06M JVJzECNRMPeXsHrSm9Si8JEGubS/Vb6PLeqipJFPwbcgnT5XPG8LWwMuByd2ll2II7ah c+ibEf2br1hIS9QjGWJTMK7nApOUgr1lTpqdee9liYg1QJW4A8FkMk3VdJ8mLf9souFx lEcw== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b38si1348241pla.137.2019.07.09.23.43.58; Tue, 09 Jul 2019 23:44:13 -0700 (PDT) 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726344AbfGJGkZ (ORCPT + 99 others); Wed, 10 Jul 2019 02:40:25 -0400 Received: from inva020.nxp.com ([92.121.34.13]:57638 "EHLO inva020.nxp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725844AbfGJGkY (ORCPT ); Wed, 10 Jul 2019 02:40:24 -0400 Received: from inva020.nxp.com (localhost [127.0.0.1]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id A044A1A013B; Wed, 10 Jul 2019 08:40:22 +0200 (CEST) Received: from invc005.ap-rdc01.nxp.com (invc005.ap-rdc01.nxp.com [165.114.16.14]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 661041A029E; Wed, 10 Jul 2019 08:40:09 +0200 (CEST) Received: from titan.ap.freescale.net (TITAN.ap.freescale.net [10.192.208.233]) by invc005.ap-rdc01.nxp.com (Postfix) with ESMTP id 24218402E3; Wed, 10 Jul 2019 14:39:56 +0800 (SGT) From: Anson.Huang@nxp.com To: catalin.marinas@arm.com, will@kernel.org, robh+dt@kernel.org, mark.rutland@arm.com, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, daniel.lezcano@linaro.org, tglx@linutronix.de, leonard.crestez@nxp.com, aisheng.dong@nxp.com, daniel.baluta@nxp.com, ping.bai@nxp.com, l.stach@pengutronix.de, abel.vesa@nxp.com, andrew.smirnov@gmail.com, ccaione@baylibre.com, angus@akkea.ca, agx@sigxcpu.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org Cc: Linux-imx@nxp.com Subject: [PATCH V5 1/5] clocksource: imx-sysctr: Add internal clock divider handle Date: Wed, 10 Jul 2019 14:30:52 +0800 Message-Id: <20190710063056.35689-1-Anson.Huang@nxp.com> X-Mailer: git-send-email 2.9.5 X-Virus-Scanned: ClamAV using ClamSMTP Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Anson Huang The system counter block guide states that the base clock is internally divided by 3 before use, that means the clock input of system counter defined in DT should be base clock which is normally from OSC, and then internally divided by 3 before use. Signed-off-by: Anson Huang --- Changes since V4: - to solve the clock driver probed after system counter driver issue, now we can easily switch to use fixed clock defined in DT and get its rate, then divided by 3 to get real clock rate for system counter driver, no need to add "clock-frequency" property in DT. --- drivers/clocksource/timer-imx-sysctr.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/clocksource/timer-imx-sysctr.c b/drivers/clocksource/timer-imx-sysctr.c index fd7d680..b7c80a3 100644 --- a/drivers/clocksource/timer-imx-sysctr.c +++ b/drivers/clocksource/timer-imx-sysctr.c @@ -20,6 +20,8 @@ #define SYS_CTR_EN 0x1 #define SYS_CTR_IRQ_MASK 0x2 +#define SYS_CTR_CLK_DIV 0x3 + static void __iomem *sys_ctr_base; static u32 cmpcr; @@ -134,6 +136,9 @@ static int __init sysctr_timer_init(struct device_node *np) if (ret) return ret; + /* system counter clock is divided by 3 internally */ + to_sysctr.of_clk.rate /= SYS_CTR_CLK_DIV; + sys_ctr_base = timer_of_base(&to_sysctr); cmpcr = readl(sys_ctr_base + CMPCR); cmpcr &= ~SYS_CTR_EN; -- 2.7.4