Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp3056343ybi; Tue, 2 Jul 2019 01:16:31 -0700 (PDT) X-Google-Smtp-Source: APXvYqyBVAo/NAOf1zMYQs6z6PA5klF9/ZxOqGEktYTwhbVoZle8VBhNEp3+bc21vaznOrQXs0Lb X-Received: by 2002:a17:90a:5207:: with SMTP id v7mr3941846pjh.127.1562055391202; Tue, 02 Jul 2019 01:16:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562055391; cv=none; d=google.com; s=arc-20160816; b=Y4X9nZvmwDWMrUAAsyt7Lg/Dcxtr0Dsa9vXwLagaL6A1Vgn8lncaZe3Vz/HuKB1waN hrA6C0Ov8rivAzBgsPlf2DyB7VEl9uVGEUgUq6PapU9NfbBlODvElVQhKUATGGfklNXr DVKCc3wnZWkhqN9eZsQqk7vBai8CeccAhcfQoKG6tcIU88up+1senSUzG1ETDVdm8AlJ KkLtTMK3iX+XVLVet/qdt6HTbNBH9pm9MmT1UUF23EJkXSrDHwoo8vYaKu36S9VmROAn ZxrESq0LmMur/TIwZIsb4hYRgG5nerSq3fZtgY16nTeazs/CRhH7vEMjfnwJUvRTcuRb J3qg== 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; bh=PPafZdXVM4Od6MIOpFexeYf6j7cxPvRhL5mvU4WGbLA=; b=zT1yYqmqtECuoBE/iNM3x7OiTWCmABeizRXBVBusjH77FKauARbkSqZy3eJBO25atv 0R4Lx2t7cy53NRypxt0U7o/0nCY8io3R/8+pbdkTzdAZDRDJkOua1hJu5sLhTqBte37F RFGiH8QdPW/9PrXRJF7NOrGamKheH8/kynbndGZkyBtuKtP0PyQ77KDXNSye1gRo/AgM CHfjZbeky7XbTzxaIAzOugXL887PEuhaXMBmwUqbd5hEBX7ZXtUtkavoHlD5u61GIPMD qDGGuuM5jcc8SathMRMZlX8Jl36DBQYpnje7W2hkbIK7RrkSqQBBsK2BirlflN7SViyI 7tJA== 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 s8si1789690pjb.40.2019.07.02.01.16.16; Tue, 02 Jul 2019 01:16:31 -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 S1727520AbfGBIP6 (ORCPT + 99 others); Tue, 2 Jul 2019 04:15:58 -0400 Received: from inva021.nxp.com ([92.121.34.21]:40984 "EHLO inva021.nxp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727746AbfGBIEe (ORCPT ); Tue, 2 Jul 2019 04:04:34 -0400 Received: from inva021.nxp.com (localhost [127.0.0.1]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id 87DF7200B4F; Tue, 2 Jul 2019 10:04:32 +0200 (CEST) Received: from invc005.ap-rdc01.nxp.com (invc005.ap-rdc01.nxp.com [165.114.16.14]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id C7BDE200B57; Tue, 2 Jul 2019 10:04:21 +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 86569402B6; Tue, 2 Jul 2019 16:04:08 +0800 (SGT) From: Anson.Huang@nxp.com To: daniel.lezcano@linaro.org, tglx@linutronix.de, robh+dt@kernel.org, mark.rutland@arm.com, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, leonard.crestez@nxp.com, viresh.kumar@linaro.org, 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-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: Linux-imx@nxp.com Subject: [PATCH RESEND V4 3/5] clocksource: imx-sysctr: Make timer work with clock driver using platform driver model Date: Tue, 2 Jul 2019 15:55:11 +0800 Message-Id: <20190702075513.17451-3-Anson.Huang@nxp.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20190702075513.17451-1-Anson.Huang@nxp.com> References: <20190702075513.17451-1-Anson.Huang@nxp.com> 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 On some i.MX8M platforms, clock driver uses platform driver model and it is NOT ready during timer initialization phase, the clock operations will fail and system counter driver will fail too. As all the i.MX8M platforms' system counter clock are from OSC which is always enabled, so it is no need to enable clock for system counter driver, the ONLY thing is to pass clock frequence to driver. To make system counter driver work for upper scenario, if DT's system counter node has property "clock-frequency" present, setting TIMER_OF_CLOCK_FREQUENCY flag to indicate timer-of driver to get clock frequency from DT directly instead of of_clk operation via clk APIs. Signed-off-by: Anson Huang --- Changes since V3: - remove the .prop_name initialization acording to timer-of changes in V4. --- drivers/clocksource/timer-imx-sysctr.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/clocksource/timer-imx-sysctr.c b/drivers/clocksource/timer-imx-sysctr.c index fd7d680..b82a549 100644 --- a/drivers/clocksource/timer-imx-sysctr.c +++ b/drivers/clocksource/timer-imx-sysctr.c @@ -98,7 +98,7 @@ static irqreturn_t sysctr_timer_interrupt(int irq, void *dev_id) } static struct timer_of to_sysctr = { - .flags = TIMER_OF_IRQ | TIMER_OF_CLOCK | TIMER_OF_BASE, + .flags = TIMER_OF_IRQ | TIMER_OF_BASE, .clkevt = { .name = "i.MX system counter timer", .features = CLOCK_EVT_FEAT_ONESHOT | @@ -130,6 +130,9 @@ static int __init sysctr_timer_init(struct device_node *np) { int ret = 0; + to_sysctr.flags |= of_find_property(np, "clock-frequency", NULL) ? + TIMER_OF_CLOCK_FREQUENCY : TIMER_OF_CLOCK; + ret = timer_of_init(np, &to_sysctr); if (ret) return ret; -- 2.7.4