From patchwork Sun Mar 22 22:55:53 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ola Jeppsson X-Patchwork-Id: 6068041 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id C04A09F350 for ; Sun, 22 Mar 2015 22:59:09 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E02B62022D for ; Sun, 22 Mar 2015 22:59:08 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E60372021B for ; Sun, 22 Mar 2015 22:59:07 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1YZon7-0007VG-V6; Sun, 22 Mar 2015 22:56:21 +0000 Received: from mail-lb0-f178.google.com ([209.85.217.178]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1YZon5-0007UA-QA for linux-arm-kernel@lists.infradead.org; Sun, 22 Mar 2015 22:56:20 +0000 Received: by lbbrr9 with SMTP id rr9so42833456lbb.0 for ; Sun, 22 Mar 2015 15:55:56 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:message-id:date:from:user-agent:mime-version:to :cc:subject:content-type:content-transfer-encoding; bh=FDLHinZSRQD4abhwBALpN2H/hXbaDbzCsJlzBEu1HlQ=; b=FrDMWbaCfTB86rfLiHQ5ULQQrUqQ+HKzUNeW/NNHMLvuh33WBYJA8x3eawxSelEt0c gywBLN1EAehw6HD5b0QPqAAwGyZuEPN3Z9vNcDPB1At3Q4fSkBmIHB4ZBcu1slXOH5ym U9NU6eA4264XFh85oEHLvPThWoG6WAAFR2YGxXGaQ3i5whudu+a/LSP14dqfyrJr/KCK QIUKAPoyYnC8Dq3EmKg5iVwLTkfiSCjg5AGQ45r6DoP1MeO6vZDXbyJIKBADgl/YgmKk M1GJ+HePpI3Nxsq53TBzLKIgSWOCc+HssxKcmJv2TwW6DlYX4DEJjPD78m+huuRXjzX3 CG0A== X-Gm-Message-State: ALoCoQnvHHJCZhwjxcwmwk5FSSvN1somCGSWqR+/CZQeMGR56CCEAUXm+6ZY4467U4F7bUhO93f0 X-Received: by 10.152.244.161 with SMTP id xh1mr52884676lac.119.1427064956196; Sun, 22 Mar 2015 15:55:56 -0700 (PDT) Received: from [192.168.0.143] (tulip.olf.sgsnet.se. [46.239.120.142]) by mx.google.com with ESMTPSA id v10sm172735laj.37.2015.03.22.15.55.54 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 22 Mar 2015 15:55:55 -0700 (PDT) Message-ID: <550F4879.3020207@adapteva.com> Date: Sun, 22 Mar 2015 23:55:53 +0100 From: Ola Jeppsson User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.3.0 MIME-Version: 1.0 To: Michal Simek Subject: [PATCH] arm: zynq: Fix system clock with multi_v7_defconfig X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150322_155620_046432_4FEECBB8 X-CRM114-Status: GOOD ( 12.08 ) X-Spam-Score: -0.7 (/) Cc: linux-arm-kernel@lists.infradead.org, =?UTF-8?B?QW5kcmVhcyBGw6RyYmVy?= , =?UTF-8?B?U8O2cmVuIEJyaW5rbWFubg==?= X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP As mentioned in this commit: arm: zynq: Don't use arm_global_timer with cpufreq 61f1fc7e9258a169ac8afb5ddf657a181e60d052 arm_global_timer depends on the CPU frequency. With cpufreq altering the CPU frequency arm_global_timer will not maintain a stable time base. So arm_global_timer must not be the clocksource when cpufreq is enabled. The above commit tries to solve this at build time by only selecting CONFIG_ARM_GLOBAL_TIMER if CONFIG_CPU_FREQ is disabled. This is not always sufficient because other machs can also enable CONFIG_ARM_GLOBAL_TIMER. Therefore: If built with CONFIG_CPU_FREQ and CONFIG_ARM_GLOBAL_TIMER, disable (on Zynq) the arm_global_timer devicetree node at boot before clock sources are initialized. This ensures that arm_global_timer will not be selected clocksource. Signed-off-by: Ola Jeppsson --- arch/arm/mach-zynq/Makefile | 4 ++++ arch/arm/mach-zynq/common.c | 28 ++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/arch/arm/mach-zynq/Makefile b/arch/arm/mach-zynq/Makefile index b03a97e..ec94b04 100644 --- a/arch/arm/mach-zynq/Makefile +++ b/arch/arm/mach-zynq/Makefile @@ -2,6 +2,10 @@ # Makefile for the linux kernel. # +ifeq ($(CONFIG_CPU_FREQ)-$(CONFIG_ARM_GLOBAL_TIMER), y-y) + CFLAGS_common.o += -DDISABLE_ARM_GLOBAL_TIMER +endif + # Common support obj-y := common.o slcr.o pm.o obj-$(CONFIG_SMP) += headsmp.o platsmp.o diff --git a/arch/arm/mach-zynq/common.c b/arch/arm/mach-zynq/common.c index c887196..0619ef4 100644 --- a/arch/arm/mach-zynq/common.c +++ b/arch/arm/mach-zynq/common.c @@ -148,10 +148,38 @@ out: platform_device_register_full(&devinfo); } +#ifdef DISABLE_ARM_GLOBAL_TIMER +static struct property zynq_disable_arm_global_timer_prop = { + .name = "status", + .length = sizeof("disabled"), + .value = "disabled" +}; + +static void __init zynq_maybe_disable_arm_global_timer(void) +{ + struct device_node *np; + + np = of_find_compatible_node(NULL, NULL, "arm,cortex-a9-global-timer"); + if (!np) + return; + + pr_info("%s: disabling arm_global_timer node\n", __func__); + + if (of_update_property(np, &zynq_disable_arm_global_timer_prop)) + pr_warn("%s: could not disable arm_global_timer node\n", + __func__); +} +#else +static void __init zynq_maybe_disable_arm_global_timer(void) +{ +} +#endif + static void __init zynq_timer_init(void) { zynq_early_slcr_init(); + zynq_maybe_disable_arm_global_timer(); zynq_clock_init(); of_clk_init(NULL); clocksource_of_init();