lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1568123236-767-8-git-send-email-claudiu.beznea@microchip.com>
Date:   Tue, 10 Sep 2019 16:47:16 +0300
From:   Claudiu Beznea <claudiu.beznea@...rochip.com>
To:     <daniel.lezcano@...aro.org>, <robh+dt@...nel.org>,
        <mark.rutland@....com>, <linux@...linux.org.uk>, <nsekhar@...com>,
        <bgolaszewski@...libre.com>, <monstr@...str.eu>,
        <john@...ozen.org>, <ralf@...ux-mips.org>, <paul.burton@...s.com>,
        <jhogan@...nel.org>, <lftan@...era.com>, <tglx@...utronix.de>,
        <vgupta@...opsys.com>, <marc.zyngier@....com>,
        <patrice.chotard@...com>, <mcoquelin.stm32@...il.com>,
        <alexandre.torgue@...com>, <eric@...olt.net>, <wahrenst@....net>,
        <f.fainelli@...il.com>, <rjui@...adcom.com>,
        <sbranden@...adcom.com>, <bcm-kernel-feedback-list@...adcom.com>,
        <linus.walleij@...aro.org>, <shc_work@...l.ru>, <kgene@...nel.org>,
        <krzk@...nel.org>, <ysato@...rs.sourceforge.jp>,
        <liviu.dudau@....com>, <sudeep.holla@....com>,
        <lorenzo.pieralisi@....com>, <shawnguo@...nel.org>,
        <s.hauer@...gutronix.de>, <kernel@...gutronix.de>,
        <festevam@...il.com>, <linux-imx@....com>, <baohua@...nel.org>,
        <nicolas.ferre@...rochip.com>, <alexandre.belloni@...tlin.com>,
        <ludovic.desroches@...rochip.com>, <baruch@...s.co.il>,
        <u.kleine-koenig@...gutronix.de>, <guoren@...nel.org>,
        <kaloz@...nwrt.org>, <khalasa@...p.pl>, <ssantosh@...nel.org>,
        <vz@...ia.com>, <slemieux.tyco@...il.com>, <khilman@...libre.com>,
        <avifishman70@...il.com>, <tmaimon77@...il.com>,
        <tali.perry1@...il.com>, <venture@...gle.com>, <yuenn@...gle.com>,
        <benjaminfair@...gle.com>, <afaerber@...e.de>,
        <manivannan.sadhasivam@...aro.org>, <narmstrong@...libre.com>,
        <agross@...nel.org>, <palmer@...ive.com>, <aou@...s.berkeley.edu>,
        <heiko@...ech.de>, <orsonzhai@...il.com>, <baolin.wang@...aro.org>,
        <zhang.lyra@...il.com>, <maxime.ripard@...tlin.com>,
        <wens@...e.org>, <thierry.reding@...il.com>,
        <jonathanh@...dia.com>, <linux@...sktech.co.nz>,
        <john.stultz@...aro.org>, <sboyd@...nel.org>,
        <matthias.bgg@...il.com>
CC:     <devicetree@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
        <linux-arm-kernel@...ts.infradead.org>,
        <linux-mips@...r.kernel.org>, <nios2-dev@...ts.rocketboards.org>,
        <linux-snps-arc@...ts.infradead.org>,
        <linux-stm32@...md-mailman.stormreply.com>,
        <linux-rpi-kernel@...ts.infradead.org>,
        <linux-samsung-soc@...r.kernel.org>,
        <uclinux-h8-devel@...ts.sourceforge.jp>,
        <linux-amlogic@...ts.infradead.org>, <openbmc@...ts.ozlabs.org>,
        <linux-oxnas@...ups.io>, <linux-arm-msm@...r.kernel.org>,
        <linux-unisoc@...ts.infradead.org>,
        <linux-riscv@...ts.infradead.org>,
        <linux-rockchip@...ts.infradead.org>,
        <linux-tegra@...r.kernel.org>,
        <linux-mediatek@...ts.infradead.org>,
        "Claudiu Beznea" <claudiu.beznea@...rochip.com>
Subject: [PATCH 7/7] clocksource/drivers/integrator-ap: parse the chosen node

From: Alexandre Belloni <alexandre.belloni@...tlin.com>

The driver currently uses aliases to know whether the timer is the
clocksource or the clockevent. Add the /chosen/linux,clocksource and
/chosen/linux,clockevent parsing while keeping backward compatibility.

Signed-off-by: Alexandre Belloni <alexandre.belloni@...tlin.com>
Signed-off-by: Claudiu Beznea <claudiu.beznea@...rochip.com>
---
 drivers/clocksource/Kconfig               |  1 +
 drivers/clocksource/timer-integrator-ap.c | 21 ++++++++++++++++++++-
 2 files changed, 21 insertions(+), 1 deletion(-)

diff --git a/drivers/clocksource/Kconfig b/drivers/clocksource/Kconfig
index a642c23b2fba..e1742c0abb03 100644
--- a/drivers/clocksource/Kconfig
+++ b/drivers/clocksource/Kconfig
@@ -240,6 +240,7 @@ config KEYSTONE_TIMER
 config INTEGRATOR_AP_TIMER
 	bool "Integrator-ap timer driver" if COMPILE_TEST
 	select CLKSRC_MMIO
+	select TIMER_OF
 	help
 	  Enables support for the Integrator-ap timer.
 
diff --git a/drivers/clocksource/timer-integrator-ap.c b/drivers/clocksource/timer-integrator-ap.c
index 8d6f814ace36..78af89e73125 100644
--- a/drivers/clocksource/timer-integrator-ap.c
+++ b/drivers/clocksource/timer-integrator-ap.c
@@ -14,6 +14,7 @@
 #include <linux/interrupt.h>
 #include <linux/sched_clock.h>
 
+#include "timer-of.h"
 #include "timer-sp.h"
 
 static void __iomem * sched_clk_base;
@@ -160,6 +161,12 @@ static int integrator_clockevent_init(unsigned long inrate,
 	return 0;
 }
 
+static struct timer_of to[] = {
+	{ .flags = TIMER_OF_TYPE_CS, },
+	{ .flags = TIMER_OF_TYPE_CE, },
+	{ /* sentinel */ }
+};
+
 static int __init integrator_ap_timer_init_of(struct device_node *node)
 {
 	const char *path;
@@ -169,6 +176,7 @@ static int __init integrator_ap_timer_init_of(struct device_node *node)
 	struct clk *clk;
 	unsigned long rate;
 	struct device_node *alias_node;
+	struct timer_of *to = node->data;
 
 	base = of_io_request_and_map(node, 0, "integrator-timer");
 	if (IS_ERR(base))
@@ -183,6 +191,17 @@ static int __init integrator_ap_timer_init_of(struct device_node *node)
 	rate = clk_get_rate(clk);
 	writel(0, base + TIMER_CTRL);
 
+	if (timer_of_is_clocksource(to))
+		/* The primary timer lacks IRQ, use as clocksource */
+		return integrator_clocksource_init(rate, base);
+
+	if (timer_of_is_clockevent(to)) {
+		/* The secondary timer will drive the clock event */
+		irq = irq_of_parse_and_map(node, 0);
+		return integrator_clockevent_init(rate, base, irq);
+	}
+
+	/* DT ABI compatibility below */
 	err = of_property_read_string(of_aliases,
 				"arm,timer-primary", &path);
 	if (err) {
@@ -227,4 +246,4 @@ static int __init integrator_ap_timer_init_of(struct device_node *node)
 }
 
 TIMER_OF_DECLARE(integrator_ap_timer, "arm,integrator-timer",
-		       integrator_ap_timer_init_of, NULL);
+		       integrator_ap_timer_init_of, to);
-- 
2.7.4

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ