From patchwork Mon Aug 26 20:43:54 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 172203 Delivered-To: patch@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp4862667ily; Mon, 26 Aug 2019 13:44:57 -0700 (PDT) X-Google-Smtp-Source: APXvYqy/75MiCMO6XOWGw98t8Yd2q9rSLvYSRyRSQk9PIxRNdLZUw7RJIfejWfyLHYucVmKICRpG X-Received: by 2002:a63:4c5a:: with SMTP id m26mr17779345pgl.270.1566852297194; Mon, 26 Aug 2019 13:44:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566852297; cv=none; d=google.com; s=arc-20160816; b=YvXSqZkcU02USvRkMeQjOk72NnueBt8B6rb1I8uolnGmRo2xUEHX4T5JkmCxVrgWBO yR3Ir1nO/9G3OXf0I5NrLyeokKL6qsquY0PbIbc/step4wr8Q9+mMTA7Xlv78Zi6T9gZ 47A3WlHPnVfvt5Aqbo7D7UGELJZRMtlhm7azBEAU8zdwixQvqeGywAL3GwFW8SLCuXu/ dYDfaKYaRvUBdEUPFu/8d3VcipVGRbFbfDFn8EfUtawydSEF1v1mWzhWtFVH4KiMsyVT RNitqdMsTiPZss2QC76bfZJokuxDIoIaS2LPCvk9EgjToxluKo1WA0O3ViwGmorIO6CO wLjw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=OboacTrzgAOa6X4jkuvUHc+l7jAME1gqmIpY2bzkzqY=; b=FF1N0EjL8LIrQcnfB3uh9BeyzyYsjNqQCHlWMQ+wrFfhx4U1v43N2vUknLhrfkk9Ft +uQxMKtveJ5mij9Lm6qYiengTrAqaRUZL9KoVuS7RKDd7OAUPSJXFSwtYAd2Q5NvJO5U DFCjVbY6YfSBBnuz0J8QPjOapBbxhq0YHt662JnyEMZGS22VPGXa2cIs309H4vBPkwzu iizMt3npwliO1FEYr0DeoGgC267vceT/Zt0YshMXDEicYP0VGITBdD21MZqKfgHkVkTn gfFeJGW7Qy8t7MVjltod+DrSr2wzldpAGdy3F0lFkanlfzA8GQMipIa2AdPQZ+ZmPRFQ oZAQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=PyD+LfjU; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p4si9831591pgh.350.2019.08.26.13.44.56; Mon, 26 Aug 2019 13:44:57 -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; dkim=pass header.i=@linaro.org header.s=google header.b=PyD+LfjU; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731040AbfHZUo4 (ORCPT + 28 others); Mon, 26 Aug 2019 16:44:56 -0400 Received: from mail-wr1-f66.google.com ([209.85.221.66]:37907 "EHLO mail-wr1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730804AbfHZUoy (ORCPT ); Mon, 26 Aug 2019 16:44:54 -0400 Received: by mail-wr1-f66.google.com with SMTP id g17so16620482wrr.5 for ; Mon, 26 Aug 2019 13:44:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=OboacTrzgAOa6X4jkuvUHc+l7jAME1gqmIpY2bzkzqY=; b=PyD+LfjU7OVquXNkhIpuu1n1a7Ab8iOnkoR+6jLIXYZZWBcjBT2NqMthIH6UklpW1s QbETODPNNIdMcOEFvYqkj9YryteX7MuLgjyT1j8a4JT5YMxdSwxqYhJ6m4pmw8uawZeo Jd2zQQFBws2rVZG/K7HCAGMX0veGaqCnnEisfHTqKu8/czwwnnnupRnnH2CfhAAh6E/L abwUbQ5mnY/Yx5qJZOIEglK2RhU7+b81wd4Sn83SqSNMehTm5xH1FC4f0wc5ZkD2H/Q6 prmV2kpcdp+tWoMM/ru37JKd6+fUBlk3ZUqYBtDTktare9gDoW+NhxNRfsX9k1bgsBAR H0WQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=OboacTrzgAOa6X4jkuvUHc+l7jAME1gqmIpY2bzkzqY=; b=lgYHb5n3GE3bVu+AzVp6QMOFN2SM8eyZaW+j9TyJgUUMKDbXtVRKyUpb7FQP/GwU5v EtgJDEMYLSrbR+GCI0KXPhAlUwTel7eNp8CQbIZiWlGShOfXHeVKCT7Vc4M9kYUJjCwm biHOJW6XWbxjuNGQ+Uy3H9yU2H+uISvXvz88sS8NYBaxd+Nnx1RovCKcjL2j3Qv7/col kTjLVPvdpG372Zh7LA1v3g0QI+XCxUAzIyiS/m4nTC4EsuG8YxySCR87qIF0/DpJAnCm 7ua1gXveE5P8Xprf4rt0Bzfe0wy2RaShudpe1ejvXjzSToconQyRo+1sSkB33m9DAgP2 q93g== X-Gm-Message-State: APjAAAVivZ+KUMQRL9+88dIbMxYEYrbRXlXQ0y0s8r1IA79lLi+4mMUP IUQRef+cjCfaPtNRUUZAZPRD7A== X-Received: by 2002:a5d:4448:: with SMTP id x8mr25331881wrr.119.1566852292217; Mon, 26 Aug 2019 13:44:52 -0700 (PDT) Received: from mai.imgcgcw.net ([2a01:e34:ed2f:f020:f881:f5ed:b15d:96ab]) by smtp.gmail.com with ESMTPSA id 20sm549557wmk.34.2019.08.26.13.44.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Aug 2019 13:44:51 -0700 (PDT) From: Daniel Lezcano To: tglx@linutronix.de Cc: linux-kernel@vger.kernel.org, Anson Huang , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , linux-arm-kernel@lists.infradead.org (moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE) Subject: [PATCH 07/20] clocksource/drivers/imx-sysctr: Add internal clock divider handle Date: Mon, 26 Aug 2019 22:43:54 +0200 Message-Id: <20190826204407.17759-7-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190826204407.17759-1-daniel.lezcano@linaro.org> References: <20190826204407.17759-1-daniel.lezcano@linaro.org> 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 Signed-off-by: Daniel Lezcano --- drivers/clocksource/timer-imx-sysctr.c | 5 +++++ 1 file changed, 5 insertions(+) -- 2.17.1 diff --git a/drivers/clocksource/timer-imx-sysctr.c b/drivers/clocksource/timer-imx-sysctr.c index fd7d68066efb..b7c80a368a1b 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;