Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1031502AbdDTNQy (ORCPT ); Thu, 20 Apr 2017 09:16:54 -0400 Received: from terminus.zytor.com ([65.50.211.136]:44929 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S945846AbdDTNQt (ORCPT ); Thu, 20 Apr 2017 09:16:49 -0400 Date: Thu, 20 Apr 2017 06:13:27 -0700 From: tip-bot for Matt Redfearn Message-ID: Cc: matt.redfearn@imgtec.com, james.hogan@imgtec.com, hpa@zytor.com, mingo@kernel.org, ralf@linux-mips.org, tglx@linutronix.de, daniel.lezcano@linaro.org, linux-kernel@vger.kernel.org Reply-To: matt.redfearn@imgtec.com, james.hogan@imgtec.com, tglx@linutronix.de, ralf@linux-mips.org, hpa@zytor.com, mingo@kernel.org, linux-kernel@vger.kernel.org, daniel.lezcano@linaro.org In-Reply-To: <1492604806-23420-1-git-send-email-matt.redfearn@imgtec.com> References: <1492604806-23420-1-git-send-email-matt.redfearn@imgtec.com> To: linux-tip-commits@vger.kernel.org Subject: [tip:timers/core] MIPS/Malta: Probe gic-timer via devicetree Git-Commit-ID: 4287adec7212d48fb878a45400fd7e11a198462c X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2799 Lines: 86 Commit-ID: 4287adec7212d48fb878a45400fd7e11a198462c Gitweb: http://git.kernel.org/tip/4287adec7212d48fb878a45400fd7e11a198462c Author: Matt Redfearn AuthorDate: Wed, 19 Apr 2017 13:26:45 +0100 Committer: Thomas Gleixner CommitDate: Thu, 20 Apr 2017 14:56:58 +0200 MIPS/Malta: Probe gic-timer via devicetree The Malta platform is the only platform remaining to probe the GIC clocksource via gic_clocksource_init. This route hardcodes an expected virq number based on MIPS_GIC_IRQ_BASE, which can be fragile to the eventual virq layout. Instread, probe the driver using the preferred and more modern devicetree method. Before the driver is probed, set the "clock-frequency" property of the devicetree node to the value detected by Malta platform code. Signed-off-by: Matt Redfearn Cc: linux-mips@linux-mips.org Cc: James Hogan Cc: Daniel Lezcano Cc: Ralf Baechle Link: http://lkml.kernel.org/r/1492604806-23420-1-git-send-email-matt.redfearn@imgtec.com Signed-off-by: Thomas Gleixner --- arch/mips/mti-malta/malta-time.c | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/arch/mips/mti-malta/malta-time.c b/arch/mips/mti-malta/malta-time.c index 1829a90..289edcf 100644 --- a/arch/mips/mti-malta/malta-time.c +++ b/arch/mips/mti-malta/malta-time.c @@ -21,6 +21,7 @@ #include #include #include +#include #include #include #include @@ -207,6 +208,33 @@ static void __init init_rtc(void) CMOS_WRITE(ctrl & ~RTC_SET, RTC_CONTROL); } +#ifdef CONFIG_CLKSRC_MIPS_GIC +static u32 gic_frequency_dt; + +static struct property gic_frequency_prop = { + .name = "clock-frequency", + .length = sizeof(u32), + .value = &gic_frequency_dt, +}; + +static void update_gic_frequency_dt(void) +{ + struct device_node *node; + + gic_frequency_dt = cpu_to_be32(gic_frequency); + + node = of_find_compatible_node(NULL, NULL, "mti,gic-timer"); + if (!node) { + pr_err("mti,gic-timer device node not found\n"); + return; + } + + if (of_update_property(node, &gic_frequency_prop) < 0) + pr_err("error updating gic frequency property\n"); +} + +#endif + void __init plat_time_init(void) { unsigned int prid = read_c0_prid() & (PRID_COMP_MASK | PRID_IMP_MASK); @@ -236,7 +264,8 @@ void __init plat_time_init(void) printk("GIC frequency %d.%02d MHz\n", freq/1000000, (freq%1000000)*100/1000000); #ifdef CONFIG_CLKSRC_MIPS_GIC - gic_clocksource_init(gic_frequency); + update_gic_frequency_dt(); + clocksource_probe(); #endif } #endif